public DraftPostItemsGalleryCommand(IBlogPostEditingSite postEditingSite, CommandManager commandManager, bool isPost)
            : base((isPost ? CommandId.OpenPostSplit : CommandId.OpenDraftSplit))
        {
            this.postEditingSite = postEditingSite;
            _isPost = isPost;
            if (isPost)
            {
                draftCmdStart = (int)CommandId.OpenPostMRU0;
            }
            lock (_commandsLock)
            {
                // initialize commands
                for (int i = 0; i < _commands.Length; i++)
                {
                    _commands[i] = new Command((CommandId)(i + draftCmdStart));
                    _commands[i].Execute += new EventHandler(DraftPostItemsGalleryCommand_Execute);
                    _commands[i].CommandBarButtonStyle = CommandBarButtonStyle.Provider;
                    _commands[i].On = false;
                }

                // add them to the command manager
                commandManager.Add(new CommandCollection(_commands));
                commandManager.Add(this);
            }
        }
        /// <summary>
        /// Shows a CommandContextMenu modally.
        /// </summary>
        ///	<param name="commandManager">The CommandManager to use.</param>
        /// <param name="parentWindow">The parent window.</param>
        /// <param name="position">The position to show the menu, in screen coordinates.</param>
        /// <param name="alternateXPosition">An alternate X-position in case the showing of the
        /// menu results in the menu going offscreen to the right</param>
        /// <param name="commandContextMenuDefinition">The CommandContextMenuDefinition of the commands to show in the menu.  These commands must be present in the CommandManager.</param>
        /// <returns>The command that was selected; or null if no command was selected.</returns>
        public static Command ShowModal(CommandManager commandManager, Control parentWindow, Point position, int alternateXPosition, CommandContextMenuDefinition commandContextMenuDefinition)
        {
            //	If the command context menu definition was null, or contained no Command identifiers, we're done.
            Debug.Assert(commandContextMenuDefinition != null, "Cannot show a CommandContextMenu without a CommandContextMenuDefinition");
            if (commandContextMenuDefinition == null || commandContextMenuDefinition.Entries.Count == 0)
                return null;

            //	Obtain the parent window's context menu.
            ContextMenu parentContextMenu = parentWindow.ContextMenu;

            //	Instantiate the CommandContextMenu from the command context menu definition.
            CommandContextMenu commandContextMenu = new CommandContextMenu(commandManager, commandContextMenuDefinition);

            //	Set the context menu as our parent window's context menu so that keyboard mnemonics work.
            parentWindow.ContextMenu = commandContextMenu;

            //	Run the context menu.
            Command command = commandContextMenu.ShowModal(parentWindow, position, alternateXPosition);

            //	Restore our parent window's contetx menu.
            parentWindow.ContextMenu = parentContextMenu;

            //	Dipose of the context menu.
            commandContextMenu.Dispose();

            //	Return the selected command.
            return command;
        }
        /// <summary>
        /// Creates menu items for the specified MenuDefinitionEntryCollection.
        /// </summary>
        ///	<param name="commandManager">The CommandManager to use.</param>
        /// <param name="menuDefinitionEntryCollection">The MenuDefinitionEntryCollection to create menu items for.</param>
        /// <returns>The menu items.</returns>
        public static MenuItem[] CreateMenuItems(CommandManager commandManager, MenuType menuType, MenuDefinitionEntryCollection menuDefinitionEntryCollection)
        {
            ArrayList menuItemArrayList = new ArrayList();
            for (int position = 0; position < menuDefinitionEntryCollection.Count; position++)
            {
                MenuItem[] menuItems = menuDefinitionEntryCollection[position].GetMenuItems(commandManager, menuType);
                if (menuItems != null)
                    menuItemArrayList.AddRange(menuItems);
            }

            // remove leading, trailing, and adjacent separators
            for (int i = menuItemArrayList.Count - 1; i >= 0; i--)
            {
                if (((MenuItem)menuItemArrayList[i]).Text == "-")
                {
                    if (i == 0 ||  // leading
                        i == menuItemArrayList.Count - 1 ||  // trailing
                        ((MenuItem)menuItemArrayList[i - 1]).Text == "-")  // adjacent
                    {
                        menuItemArrayList.RemoveAt(i);
                    }
                }
            }

            return (menuItemArrayList.Count == 0) ? null : (MenuItem[])menuItemArrayList.ToArray(typeof(MenuItem));
        }
        //ToDo: OLW Spell Checker
        //public HtmlSourceEditorControl(ISpellingChecker spellingChecker, CommandManager commandManager)
        public HtmlSourceEditorControl(CommandManager commandManager)
        {
            _commandManager = commandManager;
            //_spellingChecker = spellingChecker;

            contextMenu.Entries.Add(CommandId.Cut, false, false);
            contextMenu.Entries.Add(CommandId.CopyCommand, false, false);
            contextMenu.Entries.Add(CommandId.Paste, false, false);
            contextMenu.Entries.Add(CommandId.PasteSpecial, false, false);
            contextMenu.Entries.Add(CommandId.SelectAll, true, true);
            contextMenu.Entries.Add(CommandId.InsertLink, true, true);

            // create and initialize the editor
            _textBox = new TextBoxEditorControl();
            _textBox.BorderStyle = BorderStyle.None;
            _textBox.Multiline = true;
            _textBox.HideSelection = false;
            _textBox.ScrollBars = ScrollBars.Vertical;
            _textBox.Font = new Font("Courier New", 10);
            _textBox.Dock = DockStyle.Fill;
            _textBox.MaxLength = 0;
            _textBox.AcceptsTab = true;
            _textBox.ContextMenu = new ContextMenu();
            _textBox.TextChanged += new EventHandler(_textBox_TextChanged);
            _textBox.ModifiedChanged += new EventHandler(_textBox_ModifiedChanged);
            _textBox.ContextMenuTriggered += new TextBoxEditorControl.ContextMenuTriggeredEventHandler(_textBox_ContextMenuTriggered);
            _textBox.GotFocus += new EventHandler(_textBox_GotFocus);
            _textBox.LostFocus += new EventHandler(_textBox_LostFocus);
            _textBox.KeyDown += new KeyEventHandler(_textBox_KeyDown);
            _textBox.MouseDown += new MouseEventHandler(_textBox_MouseDown);
            _textBox.MouseUp += new MouseEventHandler(_textBox_MouseUp);
            _textBox.RightToLeft = RightToLeft.No;
        }
        public HyperlinkForm(CommandManager commandManager, bool showAllOptions)
        {
            _slimOptions = !showAllOptions;
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            CommandManager = commandManager;
            buttonInsert.Text = Res.Get(StringId.InsertButtonText);
            buttonCancel.Text = Res.Get(StringId.CancelButton);
            label1.Text = Res.Get(StringId.UrlLabel);
            labelLinkText.Text = Res.Get(StringId.LinkTextLabel);
            labelTitle.Text = Res.Get(StringId.LinkTitleLabel);
            labelRel.Text = Res.Get(StringId.LinkRelLabel);
            ckboxNewWindow.Text = Res.Get(StringId.LinkNewWindowLabel);
            btnOptions.Text = " " + Res.Get(StringId.LinkLinkTo);
            btnOptions.AccessibleName = ControlHelper.ToAccessibleName(Res.Get(StringId.LinkLinkTo));
            btnOptionsToolTip.SetToolTip(this.btnOptions, Res.Get(StringId.LinkOptionsTooltip));
            btnRemove.Text = Res.Get(StringId.LinkRemoveLink);
            ckBoxGlossary.Text = Res.Get(StringId.LinkAddToGlossary);
            this.Text = Res.Get(StringId.LinkFormTitle);

            CommandManager.BeginUpdate();

            CommandManager.Add(new CommandGlossary());

            CommandManager.EndUpdate();

            textBoxAddress.GotFocus += new EventHandler(textBoxAddress_GotFocus);
            textBoxAddress.RightToLeft = System.Windows.Forms.RightToLeft.No;
            if (BidiHelper.IsRightToLeft)
                textBoxAddress.TextAlign = HorizontalAlignment.Right;
        }
        public MarginCommand(CommandManager commandManager)
            : base(CommandId.MarginsGroup)
        {
            RepresentativeString = Res.Get(StringId.SpinnerPixelRepresentativeString);
            FormatString = Res.Get(StringId.SpinnerPixelFormatString);

            // @RIBBON TODO: Have a way to initialize this.
            marginValue = new Padding(Convert.ToInt32(MinMargin));

            commandManager.BeginUpdate();

            commandLeftMargin = new SpinnerCommand(CommandId.AdjustLeftMargin, MinMargin, MaxMargin, MinMargin, Increment, DecimalPlaces, RepresentativeString, FormatString);
            commandManager.Add(commandLeftMargin, commandMargin_ExecuteWithArgs);

            commandTopMargin = new SpinnerCommand(CommandId.AdjustTopMargin, MinMargin, MaxMargin, MinMargin, Increment, DecimalPlaces, RepresentativeString, FormatString);
            commandManager.Add(commandTopMargin, commandMargin_ExecuteWithArgs);

            commandRightMargin = new SpinnerCommand(CommandId.AdjustRightMargin, MinMargin, MaxMargin, MinMargin, Increment, DecimalPlaces, RepresentativeString, FormatString);
            commandManager.Add(commandRightMargin, commandMargin_ExecuteWithArgs);

            commandBottomMargin = new SpinnerCommand(CommandId.AdjustBottomMargin, MinMargin, MaxMargin, MinMargin, Increment, DecimalPlaces, RepresentativeString, FormatString);
            commandManager.Add(commandBottomMargin, commandMargin_ExecuteWithArgs);

            commandManager.EndUpdate();
        }
        public CommandLoader(CommandManager commandManager, params CommandId[] commandIds)
        {
            if (commandManager == null)
                throw new ArgumentNullException("commandManager");

            this._commandManager = commandManager;
            try
            {
                _commandManager.BeginUpdate();
                foreach (CommandId commandId in commandIds)
                {
                    Command command = new Command(commandId);
                    commandManager.Add(command);
                    _loadedCommands.Add(command);
                }
            }
            catch (Exception)
            {
                Dispose();
                throw;
            }
            finally
            {
                _commandManager.EndUpdate();
            }
        }
Beispiel #8
0
        internal MapForm(bool insertNewMap, MapOptions mapOptions, CommandManager commandManager)
        {
            CommandManager = commandManager;
            _mapOptions = mapOptions;

            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //set accessibility names
            comboBoxStyle.Initialize(VEMapStyle.Road);
            comboBoxStyle.AccessibleName = Res.Get(StringId.MapStyle);
            mapZoomPlusButton.AccessibleName = Res.Get(StringId.MapZoomIn);
            buttonZoomMinus.AccessibleName = Res.Get(StringId.MapZoomOut);
            trackBarZoom.AccessibleName = Res.Get(StringId.MapZoomSlider);
            buttonSearch.AccessibleName = Res.Get(StringId.MapSearch);
            buttonGotoBirdseye.AccessibleName = Res.Get(StringId.MapBirdseyeButton);

            label1.Text = Res.Get(StringId.MapFindAddress);
            buttonCancel.Text = Res.Get(StringId.CancelButton);
            buttonGotoBirdseye.Text = Res.Get(StringId.MapBirdseyeLabel);
            cbShowLabels.Text = Res.Get(StringId.MapShowLabel);
            mapTipControl.Text = Res.Get(StringId.MapPushpinTip);

            if (insertNewMap)
            {
                Text = Res.Get(StringId.InsertMap);
                buttonOK.Text = Res.Get(StringId.InsertButton);
            }
            else
            {
                Text = Res.Get(StringId.CustomizeMap);
                buttonOK.Text = Res.Get(StringId.OKButtonText);
            }

            if (!DesignMode)
                Icon = ApplicationEnvironment.ProductIcon;

            comboBoxStyle.SelectedIndexChanged += new EventHandler(comboBoxStyle_SelectedIndexChanged);
            mapControl.MapStyleChanged += new EventHandler(mapControl_MapStyleChanged);
            mapControl.ZoomLevelChanged += new EventHandler(mapControl_ZoomLevelChanged);
            mapControl.BirdseyeChanged += new EventHandler(mapControl_BirdseyeChanged);
            mapControl.ShowMapContextMenu += new MapContextMenuHandler(mapControl_ShowMapContextMenu);
            mapControl.ShowPushpinContextMenu += new MapPushpinContextMenuHandler(mapControl_ShowPushpinContextMenu);

            mapScrollControl.DirectionalButtonClicked +=
                new DirectionalButtonClickedHandler(mapScrollControl_DirectionalButtonClicked);
            mapBirdsEyeZoomControl.ZoomLevelChanged += new EventHandler(mapBirdsEyeZoomControl_ZoomLevelChanged);
            mapBirdsEyeDirectionControl.DirectionChanged += new EventHandler(mapBirdsEyeDirectionControl_DirectionChanged);

            trackBarZoom.Maximum = MapControl.MAX_ZOOM;
            trackBarZoom.Minimum = MapControl.MIN_ZOOM;

            trackBarZoom.AutoSize = false;
            trackBarZoom.Height = 30;
            cbShowLabels.Top = trackBarZoom.Bottom;

        }
 public ImageDecoratorEditorContextImpl(IProperties settings, ApplyDecoratorCallback applyDecoratorCallback, ImagePropertiesInfo imageProperties, IUndoUnitFactory undoHost, CommandManager commandManager)
 {
     _applyDecoratorCallback = applyDecoratorCallback;
     _settings = settings;
     _imageProperties = imageProperties;
     _undoHost = undoHost;
     _commandManager = commandManager;
 }
        public static Bitmap GetGalleryItemImageFromCommand(CommandManager commandManager, CommandId commandId)
        {
            // @RIBBON TODO: Deal with high constrast appropriately
            Command command = commandManager.Get(commandId);
            if (command != null)
                return command.LargeImage;

            return Images.Missing_LargeImage;
        }
        /// <summary>
        ///	Initializes a new instance of the PrimaryWorkspaceControl class.
        /// </summary>
        public PrimaryWorkspaceControl(CommandManager commandManager) : base(commandManager)
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            //	Set the CommandManager of the CommandBarLightweightControls.
            primaryWorkspaceFirstCommandBarLightweightControl.CommandManager = commandManager;
            primaryWorkspaceSecondCommandBarLightweightControl.CommandManager = commandManager;
        }
 public NativeBehaviors(CommandManager commandManager, params Control[] controls)
 {
     Controls = controls;
     CommandManager = commandManager;
     foreach (Control c in Controls)
     {
         c.GotFocus += new EventHandler(c_GotFocus);
         c.LostFocus += new EventHandler(c_LostFocus);
     }
 }
        public ContentEditor(IMainFrameWindow mainFrameWindow, Control editorContainer, IBlogPostEditingSite postEditingSite, IInternetSecurityManager internetSecurityManager, BlogPostHtmlEditorControl.TemplateStrategy templateStrategy, int dlControlFlags)
        {
            // create a docked panel to host the editor
            Panel panel = new Panel();
            panel.Dock = DockStyle.Fill;

            if (!BidiHelper.IsRightToLeft)
                panel.DockPadding.Right = 0;
            else
                panel.DockPadding.Left = 0;

            editorContainer.Controls.Add(panel);
            panel.Resize += new EventHandler(panel_Resize);
            if (BidiHelper.IsRightToLeft)
                editorContainer.RightToLeft = RightToLeft.Yes;

            // save references
            _mainFrameWindow = mainFrameWindow;
            _editorContainer = panel;
            _postEditingSite = postEditingSite;

            _commandManager = new CommandManager();

            _userPreferencesMonitor = new UserPreferencesMonitor();

            // To be high-contrast-aware we need to respond to changes in the high contrast mode
            // by invalidating commands, forcing the ribbon to ask us for new high contrast images.
            _userPreferencesMonitor.AccessibilityUserPreferencesChanged +=
                new EventHandler(delegate (object sender, EventArgs args)
                                     {
                                         _commandManager.InvalidateAllImages();
                                     });

            _imageDecoratorsManager = new LazyLoader<ImageDecoratorsManager>(() => new ImageDecoratorsManager(components, CommandManager, GlobalEditorOptions.SupportsFeature(ContentEditorFeature.ImageBorderInherit)));
            _emoticonsManager = new EmoticonsManager(this, this);

            // initialize commands
            InitializeCommands();

            // initialize normal editor
            InitializeNormalEditor(postEditingSite, internetSecurityManager, templateStrategy, dlControlFlags);

            // initialize source editor
            if (GlobalEditorOptions.SupportsFeature(ContentEditorFeature.SourceEditor))
                InitializeSourceEditor();

            InitializeViewCommands();

            // initialize custom content
            InitializeContentSources();

            // bring main editor panel to front (this must be here for the sidebar to work!!!!)
            panel.BringToFront();
        }
 public HtmlAlignEditor(CommandManager commandManager)
 {
     // This call is required by the Windows Form Designer.
     InitializeComponent();
     imagePickerAlign.AccessibleName = Res.Get(StringId.Alignment);
     imagePickerAlign.Items.AddRange(new object[] {
         new AlignmentComboItem(Res.Get(StringId.ImgSBAlignInline), ImgAlignment.NONE, ResourceHelper.LoadAssemblyResourceBitmap(BUTTON_IMAGE_PATH + "WrapTextInlineEnabled.png")),
         new AlignmentComboItem(Res.Get(StringId.ImgSBAlignLeft), ImgAlignment.LEFT, ResourceHelper.LoadAssemblyResourceBitmap(BUTTON_IMAGE_PATH + "WrapTextLeftEnabled.png")),
         new AlignmentComboItem(Res.Get(StringId.ImgSBAlignRight), ImgAlignment.RIGHT, ResourceHelper.LoadAssemblyResourceBitmap(BUTTON_IMAGE_PATH + "WrapTextRightEnabled.png")),
         new AlignmentComboItem(Res.Get(StringId.ImgSBAlignCenter), ImgAlignment.CENTER, ResourceHelper.LoadAssemblyResourceBitmap(BUTTON_IMAGE_PATH + "WrapTextCenterEnabled.png"))
         });
 }
        /// <summary>
        /// Displays the editor (if one exists) for an image decorator in a dialog.
        /// </summary>
        /// <param name="imageDecorator"></param>
        /// <param name="ImageInfo"></param>
        /// <param name="applyCallback"></param>
        /// <param name="owner"></param>
        internal static DialogResult ShowImageDecoratorEditorDialog(ImageDecorator imageDecorator, ImagePropertiesInfo ImageInfo, ApplyDecoratorCallback applyCallback, IUndoUnitFactory undoUnitFactory, object state, IImageTargetEditor targetEditor, CommandManager commandManager)
        {
            ImageDecoratorEditor editor = imageDecorator.CreateEditor(commandManager);
            if (editor != null)
            {
                IProperties settings = ImageInfo.ImageDecorators.GetImageDecoratorSettings(imageDecorator);
                editor.LoadEditor(new ImageDecoratorEditorContextImpl(settings, new ApplyDecoratorCallback(applyCallback), ImageInfo, undoUnitFactory, commandManager), state, targetEditor);
                using (ImageDecoratorEditorForm editorForm = new ImageDecoratorEditorForm())
                {
                    editorForm.ImageDecoratorEditor = editor;

                    // for automation
                    editorForm.Name = imageDecorator.Id + "EditorForm";
                    return editorForm.ShowDialog();
                }
            }
            return DialogResult.Abort;
        }
        internal static PushpinContextCommand ShowPushpinContextMenu(Control parent, Point location, CommandManager commandManager)
        {
            Command command;
            using (CommandLoader commandLoader = new CommandLoader(commandManager, PushpinContextMenuIds))
            {
                CommandContextMenuDefinition ccmd = new CommandContextMenuDefinition();
                ccmd.CommandBar = false;
                ccmd.Entries.Add(CommandId.MapEditPushpin, false, false);
                ccmd.Entries.Add(CommandId.MapDeletePushpin, false, false);

                command = CommandContextMenu.ShowModal(
                    commandManager, parent, location, ccmd);
            }

            if (command != null)
                return (PushpinContextCommand)_pushpinCommandIds[Enum.Parse(typeof(CommandId), command.Identifier)];
            else
                return PushpinContextCommand.None;
        }
        public PostPropertiesBandControl(CommandManager commandManager)
        {
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.DoubleBuffer, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.ResizeRedraw, true);

            InitializeComponent();

            categoryContext = new CategoryContext();

            controller = new SharedPropertiesController(this, null, categoryDropDown,
                null, textTags, labelPageOrder, textPageOrder, labelPageParent, comboPageParent, null,
                datePublishDate, fields, categoryContext);

            SimpleTextEditorCommandHelper.UseNativeBehaviors(commandManager,
                textTags, textPageOrder);

            postPropertiesForm = new PostPropertiesForm(commandManager, categoryContext);
            if (components == null)
                components = new Container();
            components.Add(postPropertiesForm);

            postPropertiesForm.Synchronize(controller);

            commandManager.Add(CommandId.PostProperties, PostProperties_Execute);
            commandManager.Add(CommandId.ShowCategoryPopup, ShowCategoryPopup_Execute);

            linkViewAll.KeyDown += (sender, args) =>
                                   {
                                       if (args.KeyValue == ' ')
                                           linkViewAll_LinkClicked(sender, new LinkLabelLinkClickedEventArgs(null));
                                   };

            // WinLive 180287: We don't want to show or use mnemonics on labels in the post properties band because
            // they can steal focus from the canvas.
            linkViewAll.Text = TextHelper.StripAmpersands(Res.Get(StringId.ViewAll));
            linkViewAll.UseMnemonic = false;
            labelPageParent.Text = TextHelper.StripAmpersands(Res.Get(StringId.PropertiesPageParent));
            labelPageParent.UseMnemonic = false;
            labelPageOrder.Text = TextHelper.StripAmpersands(Res.Get(StringId.PropertiesPageOrder));
            labelPageOrder.UseMnemonic = false;
        }
            public SizeCommand(CommandManager commandManager, CommandId widthId, CommandId heightId, int width, int height)
            {
                _widthId = widthId;
                _heightId = heightId;

                sizeValue = new Size(width, height);

                commandManager.BeginUpdate();

                commandManager.Add(
                    new SpinnerCommand(_widthId, MinSize.Width, MaxSize.Width, width, Increment, DecimalPlaces, RepresentativeString, FormatString),
                    command_ExecuteWithArgs);

                commandManager.Add(
                    new SpinnerCommand(_heightId, MinSize.Height, MaxSize.Height, height, Increment, DecimalPlaces, RepresentativeString, FormatString),
                    command_ExecuteWithArgs);

                commandManager.EndUpdate();
            }
        public BlogPostHtmlSourceEditorControl(IBlogPostSpellCheckingContext spellingContext, CommandManager commandManager, IBlogPostImageEditingContext editingContext)
        {
            this.spellingContext = spellingContext;
            this.editingContext = editingContext;
            InitializeComponent();

            sourceControl = new HtmlSourceEditorControl(spellingContext.SpellingChecker, commandManager, editingContext);
            sourceControl.EditorControl.TextChanged += new EventHandler(EditorControl_TextChanged);
            sourceControl.EditorControl.GotFocus += new EventHandler(EditorControl_GotFocus);
            BorderControl borderControl = new BorderControl();
            borderControl.SuppressBottomBorder = true;
            borderControl.Control = sourceControl.EditorControl;
            borderControl.Dock = DockStyle.Fill;
            panelSourceEditor.Controls.Add(borderControl);

            ColorizedResources.Instance.RegisterControlForBackColorUpdates(this);

            textBoxTitle.AccessibleName = Res.Get(StringId.PostEditorTitleRegion);
            sourceControl.EditorControl.AccessibleName = Res.Get(StringId.PostEditorBodyRegion);
        }
        public HtmlMarginEditor(CommandManager commandManager)
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();

            marginCommand = (MarginCommand)commandManager.Get(CommandId.MarginsGroup);

            this.label3.Text = Res.Get(StringId.ImgSBMarginTop);
            this.label4.Text = Res.Get(StringId.ImgSBMarginRight);
            this.label5.Text = Res.Get(StringId.ImgSBMarginLeft);
            this.label6.Text = Res.Get(StringId.ImgSBMarginBottom);

            comboBoxMargins.Initialize();
            comboBoxMargins.SelectedIndexChanged += new EventHandler(comboBoxMargins_SelectedIndexChanged);
            comboBoxMargins.SelectedIndex = 0;
            panelCustomMargin.VisibleChanged += new EventHandler(panelCustomMargin_VisibleChanged);

            comboBoxMargins.AccessibleName = ControlHelper.ToAccessibleName(Res.Get(StringId.ImgSBMargins));

            marginCommand.MarginChanged += new EventHandler(marginCommand_MarginChanged);
        }
        internal static MapContextCommand ShowMapContextMenu(Control parent, Point location, MapContextCommand[] hideCommands, CommandManager commandManager)
        {
            Command returnCommand;
            using (CommandLoader commandLoader = new CommandLoader(commandManager, FilterMapContextMenuCommands(hideCommands)))
            {
                CommandContextMenuDefinition ccmd = new CommandContextMenuDefinition();
                ccmd.CommandBar = false;
                ccmd.Entries.Add(CommandId.MapAddPushpin, false, true);
                ccmd.Entries.Add(CommandId.MapZoomStreetLevel, false, false);
                ccmd.Entries.Add(CommandId.MapZoomCityLevel, false, false);
                ccmd.Entries.Add(CommandId.MapZoomRegionLevel, false, false);
                ccmd.Entries.Add(CommandId.MapCenterMap, false, false);

                returnCommand = CommandContextMenu.ShowModal(
                    commandManager, parent, location, ccmd);
            }

            if (returnCommand != null)
                return (MapContextCommand)_mapCommandIds[Enum.Parse(typeof(CommandId), returnCommand.Identifier)];
            else
                return MapContextCommand.None;
        }
        //ToDo: OLW Spell Checker
        //public BlogPostHtmlEditorControl(IMainFrameWindow mainFrameWindow, IStatusBar statusBar, MshtmlOptions options, IBlogPostImageEditingContext imageEditingContext, IBlogPostSidebarContext sidebarContext, IContentSourceSidebarContext sourceContext, SmartContentResizedListener resizedListener, IBlogPostSpellCheckingContext spellingContext, IImageReferenceFixer referenceFixer, IInternetSecurityManager internetSecurityManager, CommandManager commandManager, TemplateStrategy strategy, IEditingMode editingModeContext)  : base(mainFrameWindow, statusBar, options, internetSecurityManager, commandManager)
        public BlogPostHtmlEditorControl(IMainFrameWindow mainFrameWindow, IStatusBar statusBar, MshtmlOptions options, IBlogPostImageEditingContext imageEditingContext, IBlogPostSidebarContext sidebarContext, IContentSourceSidebarContext sourceContext, SmartContentResizedListener resizedListener, IImageReferenceFixer referenceFixer, IInternetSecurityManager internetSecurityManager, CommandManager commandManager, TemplateStrategy strategy, IEditingMode editingModeContext)
            : base(mainFrameWindow, statusBar, options, internetSecurityManager, commandManager)
        {
            _strategy = strategy;
            _imageEditingContext = imageEditingContext;
            _sidebarContext = sidebarContext;
            _sourceContext = sourceContext;
            _resizedListener = resizedListener;
            //ToDo: OLW Spell Checker
            //_spellingContext = spellingContext;

            //_spellingManager = new SpellingManager(CommandManager);
            _keyBoardHandler = new PostEditorKeyboardHandler(this, imageEditingContext, editingModeContext);
            _referenceFixer = referenceFixer;

            InitializeTableEditingManager();

            InitializeElementBehaviors();

            SelectionChanged += BlogPostHtmlEditorControl_SelectionChanged;
            KeyPress += new HtmlEventHandler(BlogPostHtmlEditorControl_KeyPress);
        }
 public abstract ImageDecoratorEditor CreateEditor(CommandManager commandManager);
 public ImageDecoratorEditor CreateEditor(CommandManager commandManager)
 {
     return new HtmlImageResizeEditor(commandManager);
 }
 public GenericCommandHandler(CommandManager commandManager)
 {
     ParentCommandManager = commandManager;
 }
        public HtmlImageResizeEditor(CommandManager commandManager)
        {
            sizeCommand = new SizeCommand(commandManager, CommandId.FormatImageAdjustWidth, CommandId.FormatImageAdjustHeight, 1, 1);
            sizeCommand.SizeChanged += new EventHandler(imageSizeControl_ImageSizeChanged);

            // This call is required by the Windows Form Designer.
            InitializeComponent();

            //mnemonics are not supported in the sidebar (since they interfere
            //with typing in the editor when displayed, or with the main menu if they
            //conflict.
            imageSizeControl.RemoveMnemonics();
        }
 //ToDo: OLW Spell Checker
 //public HtmlSourceEditorControl(ISpellingChecker spellingChecker, CommandManager commandManager, IBlogPostImageEditingContext editingContext)
 //    : base(spellingChecker, commandManager)
 public HtmlSourceEditorControl(CommandManager commandManager, IBlogPostImageEditingContext editingContext)
     : base(commandManager)
 {
     this.editingContext = editingContext;
 }
 public static MenuItem[] CreateMenuItems(CommandManager commandManager, CommandContextMenuDefinition commandContextMenuDefinition)
 {
     return(CreateMenuItems(commandManager, commandContextMenuDefinition.CommandBar ? MenuType.CommandBarContext : MenuType.Context, commandContextMenuDefinition.Entries));
 }
 public override ImageDecoratorEditor CreateEditor(CommandManager commandManager)
 {
     return null;
 }
 public ImageDecoratorEditor CreateEditor(CommandManager commandManager)
 {
     return new HtmlAltTextEditor();
 }
        /// <summary>
        /// Gets the MenuItem for this MenuDefinitionEntry.
        /// </summary>
        /// <param name="commandManager">The CommandManager to use.</param>
        /// <param name="menuType">The MenuType.</param>
        /// <returns>The menu item for this MenuDefinitionEntry.</returns>
        protected override MenuItem GetMenuItem(CommandManager commandManager, MenuType menuType)
        {
            //	Instantiate the placeholder OwnerDrawMenuItem.
            OwnerDrawMenuItem ownerDrawMenuItem = new OwnerDrawMenuItem(menuType, menuPath);

            //	Build child MenuItems.
            MenuItem[] menuItems = MenuBuilder.CreateMenuItems(commandManager, menuType, Entries);
            if (menuItems != null)
                ownerDrawMenuItem.MenuItems.AddRange(menuItems);

            //	Done.
            return ownerDrawMenuItem;
        }
        public HtmlEditorControl(IMainFrameWindow mainFrameWindow, IStatusBar statusBar, MshtmlOptions options, ISpellingChecker spellingChecker, IInternetSecurityManager internetSecurityManager, CommandManager commandManager)
        {
            _commandManager = commandManager;

            // save reference to main frame window
            _mainFrameWindow = mainFrameWindow;
            _statusBar = statusBar;

            _spellingChecker = spellingChecker;

            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            //initialize the data format handlers for this control
            DataFormatHandlerFactory = new HtmlEditorMarshallingHandler(this);
            MarshalImagesSupported = true;
            MarshalFilesSupported = true;
            MarshalUrlSupported = true;
            MarshalHtmlSupported = true;
            MarshalTextSupported = true;

            // The version host service provider tells MSHTML what feature versions are available (e.g. VML 1.0).
            VersionHostServiceProvider = new VersionHostServiceProvider(new DisableVmlVersionHost());

            // initialize the html editor
            if (_editorCache == null)
            {
                _internetSecurityManager = new InternetSecurityManagerShim(internetSecurityManager);
                // If mainFrameWindow == null, then we are pre-caching mshtml and don't want it to steal focus
                _mshtmlEditor = new MshtmlEditor(this, options, (mainFrameWindow == null));
            }
            else
            {
                _mshtmlEditor = _editorCache.Editor;
                _internetSecurityManager = _editorCache.SecurityManager;
                _internetSecurityManager.SecurityManager = internetSecurityManager;

                _editorCache = null;
                _mshtmlEditor.Active = true;
                _mshtmlEditor.MshtmlControl.ProtectFocus = false;
                _mshtmlEditor.ClearContextMenuHandlers();
                _mshtmlEditor.SetServiceProvider(this);
                _mshtmlEditor.UpdateOptions(options, true);
            }

            _mshtmlOptions = options;
            this.DefaultBlockElement = _mshtmlOptions.UseDivForCarriageReturn
                                           ? (DefaultBlockElement)new DivDefaultBlockElement()
                                           : new ParagraphDefaultBlockElement();

            PostEditorEvent += new MshtmlEditor.EditDesignerEventHandler(HtmlEditorControl_PostEditorEvent);
            HandleClear += new HtmlEditorSelectionOperationEventHandler(TryMoveIntoNextTable);

            // Hook the editor into the stream of the security manager so we
            // can allow our own objects (smart content, image resizing) to load in the editor
            _internetSecurityManager.HandleProcessUrlAction = HandleProcessUrlAction;

            //  Automation uses this to find the editor to automate it
            _mshtmlEditor.Name = "BorderControl";

            // subscribe to key events
            _mshtmlEditor.DocumentComplete += new EventHandler(_mshtmlEditor_DocumentComplete);
            _mshtmlEditor.DocumentEvents.GotFocus += htmlEditor_GotFocus;
            _mshtmlEditor.DocumentEvents.LostFocus += htmlEditor_LostFocus;
            _mshtmlEditor.DocumentEvents.KeyDown += new HtmlEventHandler(DocumentEvents_KeyDown);
            _mshtmlEditor.DocumentEvents.KeyUp += new HtmlEventHandler(DocumentEvents_KeyUp);
            _mshtmlEditor.DocumentEvents.KeyPress += new HtmlEventHandler(DocumentEvents_KeyPress);
            _mshtmlEditor.DocumentEvents.MouseDown += new HtmlEventHandler(DocumentEvents_MouseDown);
            _mshtmlEditor.DocumentEvents.MouseUp += new HtmlEventHandler(DocumentEvents_MouseUp);
            _mshtmlEditor.DocumentEvents.SelectionChanged += new EventHandler(DocumentEvents_SelectionChanged);
            _mshtmlEditor.DisplayChanged += new EventHandler(_mshtmlEditor_DisplayChanged);
            _mshtmlEditor.DocumentEvents.Click += new HtmlEventHandler(DocumentEvents_Click);
            _mshtmlEditor.CommandKey += new KeyEventHandler(_mshtmlEditor_CommandKey);
            _mshtmlEditor.DropTargetHandler = new MshtmlEditor.DropTargetUIHandler(_mshtmlEditor_GetDropTarget);
            _mshtmlEditor.BeforeShowContextMenu += new EventHandler(_mshtmlEditor_BeforeShowContextMenu);
            _mshtmlEditor.MshtmlControl.DLControlFlagsChanged += new EventHandler(_mshtmlControl_DLControlFlagsChanged);
            _mshtmlEditor.TranslateAccelerator += new HtmlEditDesignerEventHandler(_mshtmlEditor_TranslateAccelerator);

            InitDamageServices();

            // notify subclasses that the editor has been created
            OnEditorCreated();
        }
 /// <summary>
 ///	Initializes a new instance of the SecondaryWorkspaceControl class.
 /// </summary>
 public SecondaryWorkspaceControl(CommandManager commandManager) : base(commandManager)
 {
     // This call is required by the Windows.Forms Form Designer.
     InitializeComponent();
 }