public HtmlSourceEditorControl(ISpellingChecker spellingChecker, 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; }
private static BitArray GetBitArray(ISpellingChecker spellingChecker) { var field = typeof(SpellingChecker).GetField("_bits", BindingFlags.NonPublic | BindingFlags.Instance); Contract.Assert(field != null); return field.GetValue(spellingChecker) as BitArray; }
public void Initialize(ISpellingChecker spellingChecker, MshtmlControl mshtmlControl, IHTMLDocument2 htmlDocument, ReplaceWord replaceWordFunction, MarkupRangeFilter filter, DamageFunction damageFunction) { _spellingChecker = spellingChecker; _mshtmlControl = mshtmlControl; _htmlDocument = htmlDocument; _filter = filter; _replaceWordFunction = replaceWordFunction; _damageFunction = damageFunction; }
public SpellingHighlighter(ISpellingChecker spellingChecker, IHighlightRenderingServicesRaw highlightRenderingServices, IDisplayServicesRaw displayServices, IMarkupServicesRaw markupServices, IHTMLDocument4 htmlDocument) { _spellingChecker = spellingChecker; _highlightRenderingServices = highlightRenderingServices; _displayServices = displayServices; _markupServicesRaw = markupServices; _markupServices = new MshtmlMarkupServices(_markupServicesRaw); _htmlDocument = htmlDocument; _tracker = new HighlightSegmentTracker(); //the timer to handle interleaving of spell ghecking _timer = new SpellingTimer(TIMER_INTERVAL); _timer.Start(); _timer.Tick += new EventHandler(_timer_Tick); _workerQueue = new Queue(); }
public SpellingHighlighter(ISpellingChecker spellingChecker, IHighlightRenderingServicesRaw highlightRenderingServices, IDisplayServicesRaw displayServices, IMarkupServicesRaw markupServices, IHTMLDocument4 htmlDocument) { _spellingChecker = spellingChecker; _highlightRenderingServices = highlightRenderingServices; _displayServices = displayServices; _markupServicesRaw = markupServices; _markupServices = new MshtmlMarkupServices(_markupServicesRaw); _htmlDocument = htmlDocument; _tracker = new HighlightSegmentTracker(); //the timer to handle interleaving of spell checking _timer = new SpellingTimer(TIMER_INTERVAL); _timer.Start(); _timer.Tick += new EventHandler(_timer_Tick); _workerQueue = new Queue(); }
/// <summary> /// Initialize spell-checker form /// </summary> public SpellCheckerForm(ISpellingChecker spellingChecker, IWin32Window owner, bool provideIgnoreOnce) { // // Required for Windows Form Designer support // InitializeComponent(); buttonAdd.Text = Res.Get(StringId.SpellAdd); buttonCancel.Text = Res.Get(StringId.CancelButton); labelNotInDictionary.Text = Res.Get(StringId.SpellNotInDict); labelChangeTo.Text = Res.Get(StringId.SpellChange); labelSuggestions.Text = Res.Get(StringId.SpellOptions); buttonIgnore.Text = Res.Get(StringId.SpellIgnore); buttonIgnoreAll.Text = Res.Get(StringId.SpellIgnoreAll); buttonChangeAll.Text = Res.Get(StringId.SpellChangeAll); buttonChange.Text = Res.Get(StringId.SpellChangeWord); Text = Res.Get(StringId.SpellText); // if we aren't providing an ignore-once option then Ignore now means // Ignore All (simpler for users). To effect this we need to eliminate // the "Ignore" button, rename the "Ignore All" button to "Ignore", and // move around other controls as appropriate if (!provideIgnoreOnce) { // hide Ignore button and replace it with Ignore All button // renamed as generic "Ignore" buttonIgnore.Visible = false; // fixup UI by moving around buttons buttonIgnoreAll.Top = buttonIgnore.Top; int offset = buttonChange.Top - textBoxChangeTo.Top + 1; buttonChange.Top -= offset; buttonChangeAll.Top -= offset; buttonAdd.Top -= offset; } // keep reference to spell-checking interface this.spellingChecker = spellingChecker; this.owner = owner; }
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(); }
public HtmlSourceEditorControl(ISpellingChecker spellingChecker, CommandManager commandManager, IBlogPostImageEditingContext editingContext) : base(spellingChecker, commandManager) { this.editingContext = editingContext; }
/// <summary> /// Initialize spell-checker form /// </summary> public SpellCheckerForm(ISpellingChecker spellingChecker, IWin32Window owner) : this(spellingChecker, owner, false) { }