internal void OnExitEditMode(ActiveXBase <TActiveXClass, TActiveXInterface> control)
 {
     if (this.controlInEditMode == control)
     {
         this.controlInEditMode = null;
     }
 }
 internal void OnUIDeactivate(ActiveXBase <TActiveXClass, TActiveXInterface> site)
 {
     this.siteUIActive = null;
     site.RemoveSelectionHandler();
     site.SetSelectionStyle(ActiveXHelper.SelectionStyle.Selected);
     site.SetEditMode(ActiveXHelper.ActiveXEditMode.None);
 }
            private bool RegisterControl(ActiveXBase <TActiveXClass, TActiveXInterface> ctl)
            {
                ISite site = ctl.Site;

                if (site != null)
                {
                    IContainer container = site.Container;
                    if (container != null)
                    {
                        if (this.associatedContainer != null)
                        {
                            return(container == this.associatedContainer);
                        }
                        this.associatedContainer = container;

                        IComponentChangeService componentChangeService = (IComponentChangeService)site.GetService(typeof(IComponentChangeService));
                        if (componentChangeService != null)
                        {
                            componentChangeService.ComponentRemoved += new ComponentEventHandler(this.OnComponentRemoved);
                        }

                        return(true);
                    }
                }
                return(false);
            }
            private void ListActiveXControls(List <object> list, bool fuseOcx)
            {
                List <Control> components = this.GetComponents();

                if (components != null)
                {
                    foreach (Control component in components)
                    {
                        ActiveXBase <TActiveXClass, TActiveXInterface> activeXbase = component as ActiveXBase <TActiveXClass, TActiveXInterface>;
                        if (activeXbase != null)
                        {
                            if (fuseOcx)
                            {
                                if (activeXbase.activeXInstance != null)
                                {
                                    list.Add(activeXbase.activeXInstance);
                                }
                            }
                            else
                            {
                                list.Add(component);
                            }
                        }
                    }
                }
            }
Ejemplo n.º 5
0
 internal ActiveXSiteBase(ActiveXBase <TActiveXClass, TActiveXInterface> host)
 {
     if (host == null)
     {
         throw new ArgumentNullException("host");
     }
     this.host = host;
 }
 internal void OnInPlaceDeactivate(ActiveXBase <TActiveXClass, TActiveXInterface> site)
 {
     if (this.siteActive == site)
     {
         this.siteActive = null;
         ContainerControl containerControl = this.parent.FindContainerControlInternal();
         if (containerControl != null)
         {
             ContainerControlShim.SetActiveControlInternal(containerControl, null);
         }
     }
 }
            void UnsafeNativeMethods.IOleInPlaceFrame /*IOleInPlaceUIWindow*/.SetActiveObject(UnsafeNativeMethods.IOleInPlaceActiveObject pActiveObject, string pszObjName)
            {
                if (pActiveObject == null)
                {
                    if (this.controlInEditMode != null)
                    {
                        this.controlInEditMode.SetEditMode(ActiveXHelper.ActiveXEditMode.None);
                        this.controlInEditMode = null;
                    }
                    return;
                }

                ActiveXBase <TActiveXClass, TActiveXInterface> activeXBase = null;

                UnsafeNativeMethods.IOleObject oleObject = pActiveObject as UnsafeNativeMethods.IOleObject;
                if (oleObject != null)
                {
                    UnsafeNativeMethods.IOleClientSite oleClientSite = null;
                    try
                    {
                        oleClientSite = oleObject.GetClientSite();
                        ActiveXSiteBase activeXSiteBase = oleClientSite as ActiveXSiteBase;
                        if (activeXSiteBase != null)
                        {
                            activeXBase = activeXSiteBase.Host;
                        }
                    }
                    catch (COMException)
                    {
                    }

                    if (this.controlInEditMode != null)
                    {
                        this.controlInEditMode.SetSelectionStyle(ActiveXHelper.SelectionStyle.Selected);
                        this.controlInEditMode.SetEditMode(ActiveXHelper.ActiveXEditMode.None);
                    }

                    if (activeXBase == null)
                    {
                        this.controlInEditMode = null;
                    }
                    else if (!activeXBase.IsUserMode)
                    {
                        this.controlInEditMode = activeXBase;
                        activeXBase.SetEditMode(ActiveXHelper.ActiveXEditMode.Object);
                        activeXBase.AddSelectionHandler();
                        activeXBase.SetSelectionStyle(ActiveXHelper.SelectionStyle.Active);
                    }
                }
            }
 internal void OnUIActivate(ActiveXBase <TActiveXClass, TActiveXInterface> site)
 {
     if (this.siteUIActive != site)
     {
         if ((this.siteUIActive != null) && (this.siteUIActive != site))
         {
             this.siteUIActive.activeXOleInPlaceObject.UIDeactivate();
         }
         site.AddSelectionHandler();
         this.siteUIActive = site;
         ContainerControl containerControl = site.ContainingControl;
         if ((containerControl != null) && containerControl.Contains(site))
         {
             ContainerControlShim.SetActiveControlInternal(containerControl, site);
         }
     }
 }
 internal static ActiveXContainer FindContainerForControl(ActiveXBase <TActiveXClass, TActiveXInterface> control)
 {
     if (control != null)
     {
         if (control.container != null)
         {
             return(control.container);
         }
         if (control.ContainingControl != null)
         {
             ActiveXContainer container = control.CreateActiveXContainer();
             if (container.RegisterControl(control))
             {
                 container.AddControl(control);
                 return(container);
             }
         }
     }
     return(null);
 }
 internal ActiveXContainer(ActiveXBase <TActiveXClass, TActiveXInterface> parent)
 {
     this.containerCache = new List <Control>();
     this.parent         = parent;
 }
Ejemplo n.º 11
0
 public ActiveXBaseNativeWindow(ActiveXBase <TActiveXClass, TActiveXInterface> activeX)
 {
     this.activeXBase = activeX;
 }