internal WebBrowserSiteBase(WebBrowserBase h)
 {
     if (h == null)
     {
         throw new ArgumentNullException("h");
     }
     this.host = h;
 }
 internal static WebBrowserContainer FindContainerForControl(WebBrowserBase ctl)
 {
     if (ctl != null)
     {
         if (ctl.container != null)
         {
             return ctl.container;
         }
         if (ctl.ContainingControl != null)
         {
             WebBrowserContainer container = ctl.CreateWebBrowserContainer();
             if (container.RegisterControl(ctl))
             {
                 container.AddControl(ctl);
                 return container;
             }
         }
     }
     return null;
 }
예제 #3
0
 internal static WebBrowserContainer FindContainerForControl(WebBrowserBase ctl)
 {
     if (ctl != null)
     {
         if (ctl.container != null)
         {
             return(ctl.container);
         }
         ScrollableControl f = ctl.ContainingControl;
         if (f != null)
         {
             WebBrowserContainer container = ctl.CreateWebBrowserContainer();
             if (container.RegisterControl(ctl))
             {
                 container.AddControl(ctl);
                 return(container);
             }
         }
     }
     return(null);
 }
 void UnsafeNativeMethods.IPropertyNotifySink.OnChanged(int dispid)
 {
     if (this.Host.NoComponentChangeEvents == 0)
     {
         WebBrowserBase host = this.Host;
         host.NoComponentChangeEvents++;
         try
         {
             this.OnPropertyChanged(dispid);
         }
         catch (Exception)
         {
             throw;
         }
         finally
         {
             WebBrowserBase base2 = this.Host;
             base2.NoComponentChangeEvents--;
         }
     }
 }
        private bool RegisterControl(WebBrowserBase ctl)
        {
            ISite site = ctl.Site;

            if (site != null)
            {
                IContainer container = site.Container;
                if (container != null)
                {
                    if (this.assocContainer != null)
                    {
                        return(container == this.assocContainer);
                    }
                    this.assocContainer = container;
                    IComponentChangeService service = (IComponentChangeService)site.GetService(typeof(IComponentChangeService));
                    if (service != null)
                    {
                        service.ComponentRemoved += new ComponentEventHandler(this.OnComponentRemoved);
                    }
                    return(true);
                }
            }
            return(false);
        }
예제 #6
0
 /// <summary>
 /// Returns an observable sequence wrapping the DragEnter event on the WebBrowserBase instance.
 /// </summary>
 /// <param name="instance">The WebBrowserBase instance to observe.</param>
 /// <returns>An observable sequence wrapping the DragEnter event on the WebBrowserBase instance.</returns>
 public static IObservable <EventPattern <DragEventArgs> > DragEnterObservable(this WebBrowserBase instance)
 {
     return(Observable.FromEventPattern <DragEventHandler, DragEventArgs>(
                handler => instance.DragEnter += handler,
                handler => instance.DragEnter -= handler));
 }
예제 #7
0
        public void HookUp( WebBrowserBase webBrowser )
        {
            if ( webBrowser == null )
            {
                throw new ArgumentNullException( "webBrowser" );
            }

            IOleObject oleObject = (IOleObject)webBrowser.ActiveXInstance;
            int rc = oleObject.SetClientSite( this );
            if ( rc != 0 )
            {
                throw new COMException( ErrorMessages.UnknownComError, rc );
            }
        }
예제 #8
0
 private bool RegisterControl(WebBrowserBase ctl) {
     ISite site = ctl.Site;
     if (site != null) {
         IContainer cont = site.Container;
         if (cont != null) {
             if (assocContainer != null) {
                 return cont == assocContainer;
             }
             else {
                 assocContainer = cont;
                 IComponentChangeService ccs = (IComponentChangeService)site.GetService(typeof(IComponentChangeService));
                 if (ccs != null) {
                     ccs.ComponentRemoved += new ComponentEventHandler(this.OnComponentRemoved);
                 }
                 return true;
             }
         }
     }
     return false;
 }
 private bool RegisterControl(WebBrowserBase ctl)
 {
     ISite site = ctl.Site;
     if (site != null)
     {
         IContainer container = site.Container;
         if (container != null)
         {
             if (this.assocContainer != null)
             {
                 return (container == this.assocContainer);
             }
             this.assocContainer = container;
             IComponentChangeService service = (IComponentChangeService) site.GetService(typeof(IComponentChangeService));
             if (service != null)
             {
                 service.ComponentRemoved += new ComponentEventHandler(this.OnComponentRemoved);
             }
             return true;
         }
     }
     return false;
 }
 internal void OnUIActivate(WebBrowserBase site)
 {
     if (this.siteUIActive != site)
     {
         if ((this.siteUIActive != null) && (this.siteUIActive != site))
         {
             this.siteUIActive.AXInPlaceObject.UIDeactivate();
         }
         site.AddSelectionHandler();
         this.siteUIActive = site;
         ContainerControl containingControl = site.ContainingControl;
         if ((containingControl != null) && containingControl.Contains(site))
         {
             containingControl.SetActiveControlInternal(site);
         }
     }
 }
 internal void OnExitEditMode(WebBrowserBase ctl)
 {
     if (this.ctlInEditMode == ctl)
     {
         this.ctlInEditMode = null;
     }
 }
예제 #12
0
 //
 // The constructor takes an WebBrowserBase as a parameter, so unfortunately,
 // this cannot be used as a standalone site. It has to be used in conjunction
 // with WebBrowserBase. Perhaps we can change it in future.
 //
 internal WebBrowserSiteBase(WebBrowserBase h)
 {
     host = h ?? throw new ArgumentNullException(nameof(h));
 }
예제 #13
0
 /// <summary>
 /// Returns an observable sequence wrapping the MouseDoubleClick event on the WebBrowserBase instance.
 /// </summary>
 /// <param name="instance">The WebBrowserBase instance to observe.</param>
 /// <returns>An observable sequence wrapping the MouseDoubleClick event on the WebBrowserBase instance.</returns>
 public static IObservable <EventPattern <MouseEventArgs> > MouseDoubleClickObservable(this WebBrowserBase instance)
 {
     return(Observable.FromEventPattern <MouseEventHandler, MouseEventArgs>(
                handler => instance.MouseDoubleClick += handler,
                handler => instance.MouseDoubleClick -= handler));
 }
예제 #14
0
        int UnsafeNativeMethods.IOleInPlaceFrame.SetActiveObject(UnsafeNativeMethods.IOleInPlaceActiveObject pActiveObject, string pszObjName) {
            if (pActiveObject == null) {
                if (ctlInEditMode != null) {
                    ctlInEditMode.SetEditMode(WebBrowserHelper.AXEditMode.None);
                    ctlInEditMode = null;
                }
                return NativeMethods.S_OK;
            }
            WebBrowserBase ctl = null;
            UnsafeNativeMethods.IOleObject oleObject = pActiveObject as UnsafeNativeMethods.IOleObject;
            if (oleObject != null) {
                UnsafeNativeMethods.IOleClientSite clientSite = null;
                try {
                    clientSite = oleObject.GetClientSite();
                    WebBrowserSiteBase webBrowserSiteBase = clientSite as WebBrowserSiteBase;
                    if (webBrowserSiteBase != null)
                    {
                        ctl = webBrowserSiteBase.GetAXHost();
                    }
                }
                catch (COMException t) {
                    Debug.Fail(t.ToString());
                }
                if (ctlInEditMode != null) {
                    Debug.Fail("control " + ctlInEditMode.ToString() + " did not reset its edit mode to null");
                    ctlInEditMode.SetSelectionStyle(WebBrowserHelper.SelectionStyle.Selected);
                    ctlInEditMode.SetEditMode(WebBrowserHelper.AXEditMode.None);
                }
                
                if (ctl == null) {
                    ctlInEditMode = null;
                }
                else {
                    if (!ctl.IsUserMode) {
                        ctlInEditMode = ctl;
                        ctl.SetEditMode(WebBrowserHelper.AXEditMode.Object);
                        ctl.AddSelectionHandler();
                        ctl.SetSelectionStyle(WebBrowserHelper.SelectionStyle.Active);
                    }
                }
            }

            return NativeMethods.S_OK;
        }
예제 #15
0
 internal void OnExitEditMode(WebBrowserBase ctl) {
     Debug.Assert(ctlInEditMode == null || ctlInEditMode == ctl, "who is exiting edit mode?");
     if (ctlInEditMode == ctl) {
         ctlInEditMode = null;
     }
 }
예제 #16
0
 internal void OnInPlaceDeactivate(WebBrowserBase site) {
     if (siteActive == site) {
         siteActive = null;
         ContainerControl parentContainer = parent.FindContainerControlInternal();
         if (parentContainer != null) {
             parentContainer.SetActiveControlInternal(null);
         }
     }
 }
예제 #17
0
        internal void OnUIDeactivate(WebBrowserBase site) {
#if DEBUG
            if (siteUIActive != null) {
                Debug.Assert(siteUIActive == site, "deactivating when not active...");
            }
#endif // DEBUG

            siteUIActive = null;
            site.RemoveSelectionHandler();
            site.SetSelectionStyle(WebBrowserHelper.SelectionStyle.Selected);
            site.SetEditMode(WebBrowserHelper.AXEditMode.None);
        }
예제 #18
0
        internal void OnUIActivate(WebBrowserBase site) {
            // The ShDocVw control repeatedly calls OnUIActivate() with the same
            // site. This causes the assert below to fire.
            //
            if (siteUIActive == site)
                return;

            if (siteUIActive != null && siteUIActive != site) {
                WebBrowserBase tempSite = siteUIActive;
                tempSite.AXInPlaceObject.UIDeactivate();
            }
            site.AddSelectionHandler();
            Debug.Assert(siteUIActive == null, "Object did not call OnUIDeactivate");
            siteUIActive = site;
            ContainerControl f = site.ContainingControl;
            if (f != null && f.Contains(site)) {
                f.SetActiveControlInternal(site);
            }
        }
예제 #19
0
 public WebBrowserBaseNativeWindow(WebBrowserBase ax)
 {
     WebBrowserBase = ax;
 }
예제 #20
0
 /// <summary>
 /// Returns an observable sequence wrapping the GiveFeedback event on the WebBrowserBase instance.
 /// </summary>
 /// <param name="instance">The WebBrowserBase instance to observe.</param>
 /// <returns>An observable sequence wrapping the GiveFeedback event on the WebBrowserBase instance.</returns>
 public static IObservable <EventPattern <GiveFeedbackEventArgs> > GiveFeedbackObservable(this WebBrowserBase instance)
 {
     return(Observable.FromEventPattern <GiveFeedbackEventHandler, GiveFeedbackEventArgs>(
                handler => instance.GiveFeedback += handler,
                handler => instance.GiveFeedback -= handler));
 }
예제 #21
0
 /// <summary>
 /// Returns an observable sequence wrapping the BackColorChanged event on the WebBrowserBase instance.
 /// </summary>
 /// <param name="instance">The WebBrowserBase instance to observe.</param>
 /// <returns>An observable sequence wrapping the BackColorChanged event on the WebBrowserBase instance.</returns>
 public static IObservable <EventPattern <EventArgs> > BackColorChangedObservable(this WebBrowserBase instance)
 {
     return(Observable.FromEventPattern <EventHandler, EventArgs>(
                handler => instance.BackColorChanged += handler,
                handler => instance.BackColorChanged -= handler));
 }
예제 #22
0
 /// <summary>
 /// Returns an observable sequence wrapping the HelpRequested event on the WebBrowserBase instance.
 /// </summary>
 /// <param name="instance">The WebBrowserBase instance to observe.</param>
 /// <returns>An observable sequence wrapping the HelpRequested event on the WebBrowserBase instance.</returns>
 public static IObservable <EventPattern <HelpEventArgs> > HelpRequestedObservable(this WebBrowserBase instance)
 {
     return(Observable.FromEventPattern <HelpEventHandler, HelpEventArgs>(
                handler => instance.HelpRequested += handler,
                handler => instance.HelpRequested -= handler));
 }
 internal WebBrowserContainer(WebBrowserBase parent)
 {
     this.parent = parent;
 }
예제 #24
0
 /// <summary>
 /// Returns an observable sequence wrapping the Paint event on the WebBrowserBase instance.
 /// </summary>
 /// <param name="instance">The WebBrowserBase instance to observe.</param>
 /// <returns>An observable sequence wrapping the Paint event on the WebBrowserBase instance.</returns>
 public static IObservable <EventPattern <PaintEventArgs> > PaintObservable(this WebBrowserBase instance)
 {
     return(Observable.FromEventPattern <PaintEventHandler, PaintEventArgs>(
                handler => instance.Paint += handler,
                handler => instance.Paint -= handler));
 }
 internal void OnInPlaceDeactivate(WebBrowserBase site)
 {
     if (this.siteActive == site)
     {
         this.siteActive = null;
         ContainerControl control = this.parent.FindContainerControlInternal();
         if (control != null)
         {
             control.SetActiveControlInternal(null);
         }
     }
 }
예제 #26
0
 /// <summary>
 /// Returns an observable sequence wrapping the QueryContinueDrag event on the WebBrowserBase instance.
 /// </summary>
 /// <param name="instance">The WebBrowserBase instance to observe.</param>
 /// <returns>An observable sequence wrapping the QueryContinueDrag event on the WebBrowserBase instance.</returns>
 public static IObservable <EventPattern <QueryContinueDragEventArgs> > QueryContinueDragObservable(this WebBrowserBase instance)
 {
     return(Observable.FromEventPattern <QueryContinueDragEventHandler, QueryContinueDragEventArgs>(
                handler => instance.QueryContinueDrag += handler,
                handler => instance.QueryContinueDrag -= handler));
 }
 internal void OnUIDeactivate(WebBrowserBase site)
 {
     this.siteUIActive = null;
     site.RemoveSelectionHandler();
     site.SetSelectionStyle(WebBrowserHelper.SelectionStyle.Selected);
     site.SetEditMode(WebBrowserHelper.AXEditMode.None);
 }
예제 #28
0
 /// <summary>
 /// Returns an observable sequence wrapping the QueryAccessibilityHelp event on the WebBrowserBase instance.
 /// </summary>
 /// <param name="instance">The WebBrowserBase instance to observe.</param>
 /// <returns>An observable sequence wrapping the QueryAccessibilityHelp event on the WebBrowserBase instance.</returns>
 public static IObservable <EventPattern <QueryAccessibilityHelpEventArgs> > QueryAccessibilityHelpObservable(this WebBrowserBase instance)
 {
     return(Observable.FromEventPattern <QueryAccessibilityHelpEventHandler, QueryAccessibilityHelpEventArgs>(
                handler => instance.QueryAccessibilityHelp += handler,
                handler => instance.QueryAccessibilityHelp -= handler));
 }
 int UnsafeNativeMethods.IOleInPlaceFrame.SetActiveObject(UnsafeNativeMethods.IOleInPlaceActiveObject pActiveObject, string pszObjName)
 {
     if (pActiveObject == null)
     {
         if (this.ctlInEditMode != null)
         {
             this.ctlInEditMode.SetEditMode(WebBrowserHelper.AXEditMode.None);
             this.ctlInEditMode = null;
         }
         return 0;
     }
     WebBrowserBase aXHost = null;
     UnsafeNativeMethods.IOleObject obj2 = pActiveObject as UnsafeNativeMethods.IOleObject;
     if (obj2 != null)
     {
         try
         {
             WebBrowserSiteBase clientSite = obj2.GetClientSite() as WebBrowserSiteBase;
             if (clientSite != null)
             {
                 aXHost = clientSite.GetAXHost();
             }
         }
         catch (COMException)
         {
         }
         if (this.ctlInEditMode != null)
         {
             this.ctlInEditMode.SetSelectionStyle(WebBrowserHelper.SelectionStyle.Selected);
             this.ctlInEditMode.SetEditMode(WebBrowserHelper.AXEditMode.None);
         }
         if (aXHost == null)
         {
             this.ctlInEditMode = null;
         }
         else if (!aXHost.IsUserMode)
         {
             this.ctlInEditMode = aXHost;
             aXHost.SetEditMode(WebBrowserHelper.AXEditMode.Object);
             aXHost.AddSelectionHandler();
             aXHost.SetSelectionStyle(WebBrowserHelper.SelectionStyle.Active);
         }
     }
     return 0;
 }
예제 #30
0
 /// <summary>
 /// Returns an observable sequence wrapping the KeyUp event on the WebBrowserBase instance.
 /// </summary>
 /// <param name="instance">The WebBrowserBase instance to observe.</param>
 /// <returns>An observable sequence wrapping the KeyUp event on the WebBrowserBase instance.</returns>
 public static IObservable <EventPattern <KeyEventArgs> > KeyUpObservable(this WebBrowserBase instance)
 {
     return(Observable.FromEventPattern <KeyEventHandler, KeyEventArgs>(
                handler => instance.KeyUp += handler,
                handler => instance.KeyUp -= handler));
 }
예제 #31
0
 internal WebBrowserSiteBase(WebBrowserBase h)
 {
     host = h.OrThrowIfNull();
 }
예제 #32
0
 /// <summary>
 /// Returns an observable sequence wrapping the Layout event on the WebBrowserBase instance.
 /// </summary>
 /// <param name="instance">The WebBrowserBase instance to observe.</param>
 /// <returns>An observable sequence wrapping the Layout event on the WebBrowserBase instance.</returns>
 public static IObservable <EventPattern <LayoutEventArgs> > LayoutObservable(this WebBrowserBase instance)
 {
     return(Observable.FromEventPattern <LayoutEventHandler, LayoutEventArgs>(
                handler => instance.Layout += handler,
                handler => instance.Layout -= handler));
 }
예제 #33
0
 public WebBrowserBaseNativeWindow(WebBrowserBase ax) {
     this.WebBrowserBase = ax;
 }
예제 #34
0
 /// <summary>
 /// Returns an observable sequence wrapping the Leave event on the WebBrowserBase instance.
 /// </summary>
 /// <param name="instance">The WebBrowserBase instance to observe.</param>
 /// <returns>An observable sequence wrapping the Leave event on the WebBrowserBase instance.</returns>
 public static IObservable <EventPattern <EventArgs> > LeaveObservable(this WebBrowserBase instance)
 {
     return(Observable.FromEventPattern <EventHandler, EventArgs>(
                handler => instance.Leave += handler,
                handler => instance.Leave -= handler));
 }
예제 #35
0
 /// <summary>
 /// Returns an observable sequence wrapping the MouseHover event on the WebBrowserBase instance.
 /// </summary>
 /// <param name="instance">The WebBrowserBase instance to observe.</param>
 /// <returns>An observable sequence wrapping the MouseHover event on the WebBrowserBase instance.</returns>
 public static IObservable <EventPattern <EventArgs> > MouseHoverObservable(this WebBrowserBase instance)
 {
     return(Observable.FromEventPattern <EventHandler, EventArgs>(
                handler => instance.MouseHover += handler,
                handler => instance.MouseHover -= handler));
 }
예제 #36
0
 /// <summary>
 /// Returns an observable sequence wrapping the ChangeUICues event on the WebBrowserBase instance.
 /// </summary>
 /// <param name="instance">The WebBrowserBase instance to observe.</param>
 /// <returns>An observable sequence wrapping the ChangeUICues event on the WebBrowserBase instance.</returns>
 public static IObservable <EventPattern <UICuesEventArgs> > ChangeUICuesObservable(this WebBrowserBase instance)
 {
     return(Observable.FromEventPattern <UICuesEventHandler, UICuesEventArgs>(
                handler => instance.ChangeUICues += handler,
                handler => instance.ChangeUICues -= handler));
 }
예제 #37
0
 internal WebBrowserContainer(WebBrowserBase parent)
 {
     this.parent = parent;
 }
 public override void Initialize(IComponent component)
 {
     base.Initialize(component);
     base.AutoResizeHandles = true;
     this.webBrowserBase = (WebBrowserBase) component;
 }