private static DockContent GetMdiForm(System.Xml.XmlDocument doc, bool valid)
        {
            IXEditNetProfile prof = ProfileProvider.GetProfile(doc);

            UserControl userControl = null;

            if (prof != null)
            {
                userControl = prof.GetEditorRegion(doc);
            }

            if (userControl == null)
            {
                userControl = new XEditNetDefaultEditorRegion();
            }

            IXEditNetEditorRegion r = userControl as IXEditNetEditorRegion;

            if (r == null)
            {
                throw new InvalidOperationException("User control returned by profile does not implement " + typeof(IXEditNetEditorRegion));
            }

            if (prof != null && prof.Info.Stylesheet != null && prof.Info.Stylesheet.Length > 0)
            {
                r.Editor.SetStylesheet(prof.Info.Stylesheet);
            }

            r.Editor.Attach(doc, valid);
            XEditNetChildForm2 form = new XEditNetChildForm2(userControl);

            return(form);
        }
        public void childForm_Activated(object sender, EventArgs e)
        {
            XEditNetChildForm2 form = sender as XEditNetChildForm2;

            if (sender != null)
            {
                IXEditNetEditorRegion r = form.EditorRegion;
                if (currentRegion != null)
                {
                    currentRegion.Editor.InsertElementActivated -= new XEditNet.InterfaceActivationEventHandler(InsertElementActivated);
                    currentRegion.Editor.ChangeElementActivated -= new XEditNet.InterfaceActivationEventHandler(ChangeElementActivated);
                }

                r.Editor.InsertElementActivated += new XEditNet.InterfaceActivationEventHandler(InsertElementActivated);
                r.Editor.ChangeElementActivated += new XEditNet.InterfaceActivationEventHandler(ChangeElementActivated);

                foreach (WidgetPanel p in panels.Values)
                {
                    p.Nested.Editor = r.Editor;
                }

                currentRegion = r;
            }
        }
        private static DockContent GetMdiForm(System.Xml.XmlDocument doc, bool valid)
        {
            IXEditNetProfile prof = ProfileProvider.GetProfile(doc);

            UserControl userControl = null;

            if (prof != null)
                userControl = prof.GetEditorRegion(doc);

            if (userControl == null)
                userControl = new XEditNetDefaultEditorRegion();

            IXEditNetEditorRegion r = userControl as IXEditNetEditorRegion;
            if (r == null)
                throw new InvalidOperationException("User control returned by profile does not implement " + typeof(IXEditNetEditorRegion));

            if (prof != null && prof.Info.Stylesheet != null && prof.Info.Stylesheet.Length > 0)
                r.Editor.SetStylesheet(prof.Info.Stylesheet);

            r.Editor.Attach(doc, valid);
            XEditNetChildForm2 form = new XEditNetChildForm2(userControl);

            return form;
        }