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; }
/// <summary> /// Create the MSHTML control and add it to our client area /// </summary> private void InitializeMshtmlControl(IServiceProviderRaw serviceProvider, MshtmlOptions mshtmlOptions, bool protectFocus) { UpdateOptions(mshtmlOptions, true); // initialize mshtml control mshtmlControl = new MshtmlControl(serviceProvider, protectFocus); mshtmlControl.InstallDocHostUIHandler(this); mshtmlControl.SetDLControlFlags(mshtmlOptions.DLCTLOptions); mshtmlControl.Init(); mshtmlControl.SetEditMode(true); // get a reference to the htmlDocument htmlDocument = mshtmlControl.HTMLDocument; /// Hook Mshtml document GotFocus so we can notify .NET when our control /// gets focus (allows Enter and Leave events to be fired correctly so /// that commands can be managed correctly) mshtmlControl.DocumentEvents.GotFocus += new EventHandler(DocumentEvents_GotFocus); // add the control to our client area mshtmlControl.Dock = DockStyle.Fill; Controls.Add(mshtmlControl); }
/// <summary> /// Initialize word range for the entire body of the document /// </summary> /// <param name="mshtml">mshtml control</param> public MshtmlWordRange(MshtmlControl mshtmlControl) : this(mshtmlControl.HTMLDocument, false, null, null) { }