コード例 #1
0
        public NetGraphDocumentControl(IDocumentObject document)
        {
            _document = (NetGraphDocument)document;
            _templates = new Dictionary<string, GraphNodeTemplate>();

            AddNodeTemplate(ServerEndpointConfig.NodeName, "SERVER{0}", GraphNodeShape.Ellipse, 100.0f, 100.0f,
                Color.Purple, Color.Black, Color.Red, Color.White, Color.WhiteSmoke, typeof(ServerEndpointConfig));
            AddNodeTemplate(ClientEndpointConfig.NodeName, "CLIENT{0}", GraphNodeShape.Ellipse, 100.0f, 100.0f,
                Color.LightGoldenrodYellow, Color.Black, Color.Red, Color.Black, Color.Black, typeof(ClientEndpointConfig));
            AddNodeTemplate(EditPacketNodeConfig.NodeName, "EDIT{0}", GraphNodeShape.RoundedRectangle, 100.0f, 50.0f,
                Color.Sienna, Color.Black, Color.Red, Color.Black, Color.Black, typeof(EditPacketNodeConfig));
            AddNodeTemplate(LogPacketConfig.NodeName, "LOG{0}", GraphNodeShape.RoundedRectangle, 100.0f, 50.0f,
                Color.Silver, Color.Black, Color.Red, Color.Black, Color.Black, typeof(LogPacketConfig));
            AddNodeTemplate(DirectNodeConfig.NodeName, "NOP{0}", GraphNodeShape.RoundedRectangle, 100.0f, 50.0f,
                Color.SlateBlue, Color.Black, Color.Red, Color.Black, Color.Black, typeof(DirectNodeConfig));
            AddNodeTemplate(DelayNodeConfig.NodeName, "DELAY{0}", GraphNodeShape.RoundedRectangle, 100.0f, 50.0f,
                Color.SlateBlue, Color.Black, Color.Red, Color.Black, Color.Black, typeof(DelayNodeConfig));
            AddNodeTemplate(DynamicNodeConfig.NodeName, "DYN{0}", GraphNodeShape.RoundedRectangle, 100.0f, 50.0f,
                Color.AliceBlue, Color.Black, Color.Red, Color.Black, Color.Black, typeof(DynamicNodeConfig));
            AddNodeTemplate(LibraryNodeConfig.NodeName, "LIB{0}", GraphNodeShape.RoundedRectangle, 100.0f, 50.0f,
                Color.Blue, Color.Black, Color.Red, Color.White, Color.WhiteSmoke, typeof(LibraryNodeConfig));
            AddNodeTemplate(NetGraphContainerConfig.NodeName, "GRAPH{0}", GraphNodeShape.RoundedRectangle, 100.0f, 50.0f,
                Color.Aqua, Color.Black, Color.Red, Color.Black, Color.Black, typeof(NetGraphContainerConfig));
            AddNodeTemplate(DecisionNodeConfig.NodeName, "IF{0}", GraphNodeShape.Rhombus, 100.0f, 80.0f,
                Color.Crimson, Color.Black, Color.Red, Color.Black, Color.Black, typeof(DecisionNodeConfig));
            AddNodeTemplate(SwitchNodeConfig.NodeName, "SWITCH{0}", GraphNodeShape.Rhombus, 100.0f, 80.0f,
                Color.Yellow, Color.Black, Color.Red, Color.Black, Color.Black, typeof(SwitchNodeConfig));
            AddNodeTemplate(SslLayerSectionNodeConfig.NodeName, "SSL{0}", GraphNodeShape.RoundedRectangle, 100.0f, 50.0f,
                Color.BlanchedAlmond, Color.Black, Color.Red, Color.Black, Color.Black, typeof(SslLayerSectionNodeConfig));
            AddNodeTemplate(LayerSectionNodeConfig.NodeName, "LAYER{0}", GraphNodeShape.RoundedRectangle, 100.0f, 50.0f,
                Color.Coral, Color.Black, Color.Red, Color.Black, Color.Black, typeof(LayerSectionNodeConfig));

            InitializeComponent();
            PopulateGraphFromDocument();
        }
コード例 #2
0
        public BinaryDocumentControl(IDocumentObject document)
        {
            _document = (BinaryDocument)document;

            InitializeComponent();
            hexEditorControl.Bytes = _document.Data;
        }
コード例 #3
0
ファイル: TextDocumentControl.cs プロジェクト: michyer/canape
        /// <summary>
        /// 
        /// </summary>
        /// <param name="document"></param>
        public TextDocumentControl(IDocumentObject document)
        {
            _document = (TextDocument)document;

            InitializeComponent();
            textBox.Text = _document.Text;
            Text = _document.Name;
        }
コード例 #4
0
        public ScriptTestDocumentControl(IDocumentObject document)
        {
            _document = document as ScriptTestDocument;

            InitializeComponent();
            graphTestControl.Document = _document;
            textBoxPath.Text = _document.Path;
            comboBoxClassName.Text = _document.ClassName;
        }
コード例 #5
0
        public StateGraphDocumentControl(IDocumentObject document)
        {
            _document = (StateGraphDocument)document;

            InitializeComponent();

            checkGlobalMeta.Checked = _document.GlobalState;
            textBoxMetaName.Text = _document.MetaName;
            BuildComboBox();
            comboDefaultState.Text = _document.DefaultState;

            SetupEntries();
        }
コード例 #6
0
        public AssemblyDocumentControl(IDocumentObject document)
        {
            _document = (AssemblyDocument)document;

            InitializeComponent();
            textBoxPath.Text = _document.OriginalPath ?? "";

            AssemblyName name = _document.GetName();

            if (name != null)
            {
                lblAsmNameValue.Text = name.FullName;
            }
        }
コード例 #7
0
        public NetGraphTestDocumentControl(IDocumentObject document)
        {
            _document = document as NetGraphTestDocument;

            InitializeComponent();
            graphTestControl.Document = _document;
            if (_document.ClientToServer)
            {
                radioClientToServer.Checked = true;
            }
            else
            {
                radioServerToClient.Checked = true;
            }
        }
コード例 #8
0
        public PacketLogDocumentControl(IDocumentObject document)
        {
            _document = (PacketLogDocument)document;

            InitializeComponent();
            logPacketControl.SetPackets(_document.Packets);
            logPacketControl.LogName = _document.Name;
            PacketLogControlConfig config = _document.GetProperty(PACKETLOG_CONFIG) as PacketLogControlConfig;

            if (config != null)
            {
                logPacketControl.Config = config;
            }

            Text = _document.Name;
        }
コード例 #9
0
        public ParserDocumentControl(IDocumentObject document, bool restricted)
        {
            _document = (ParserDocument)document;

            InitializeComponent();
            TreeNode root = new TreeNode(Properties.Resources.ParserDocumentControl_RootNodeName, 6, 6);

            if (!restricted)
            {
                _enumNode = root.Nodes.Add("Enums", Properties.Resources.ParserDocumentControl_EnumsNodeName, FOLDER_OPEN_IMAGE, FOLDER_OPEN_IMAGE);
            }

            _sequenceNode = root.Nodes.Add("Sequences", Properties.Resources.ParserDocumentControl_SequencesNodeName, FOLDER_OPEN_IMAGE, FOLDER_OPEN_IMAGE);
            _parserNode = root.Nodes.Add("Parsers", Properties.Resources.ParserDocumentControl_ParsersNodeName, FOLDER_OPEN_IMAGE, FOLDER_OPEN_IMAGE);
            _scriptNode = root.Nodes.Add("Scripts", Properties.Resources.ParserDocumentControl_ScriptsNodeName, FOLDER_OPEN_IMAGE, FOLDER_OPEN_IMAGE);

            treeViewTypes.Nodes.Add(root);
            sequenceEditorControl.Document = _document;
            if (restricted)
            {
                sequenceEditorControl.SetRestricted();
            }
            enumParserTypeEditorControl.Document = _document;
            _nodeMap = new Dictionary<Guid, TreeNode>();

            foreach (ParserType t in _document.Types)
            {
                AddTreeNode(t, false);
            }

            treeViewTypes.ExpandAll();

            if (restricted)
            {
                addEnumToolStripMenuItem.Visible = false;

            }

            ParserSerializerExtensionManager.Instance.AddToMenu(serializersToolStripMenuItem, ExtensionMenuClicked);
            if (!serializersToolStripMenuItem.HasDropDownItems)
            {
                serializersToolStripMenuItem.Visible = false;
            }
        }
コード例 #10
0
        // TODO: Fix this :)
        public ScriptDocumentControl(IDocumentObject document, bool forParserDocument)
        {
            _document = (ScriptDocument)document;
            _currText = _document.Script;

            InitializeComponent();

            Text = _document.Name;

            ScriptDocumentControlConfig config = _document.GetProperty<ScriptDocumentControlConfig>(DOCUMENT_CONFIG_NAME, false);

            UpdateConfig(config ?? DocumentControl.GetConfigItem<ScriptDocumentControlConfig>(GetConfigForEngine(_document.Container.Engine), true));

            LoadFile(_document.Script);

            _forParserDocument = forParserDocument;

            if (!forParserDocument)
            {
                if (this.ParentForm != null)
                {
                    this.ParentForm.FormClosing += new FormClosingEventHandler(ParentForm_FormClosing);
                }
            }

            textEditorControl.ActiveTextAreaControl.Document.UndoStack.OperationPushed +=
                new OperationEventHandler(UndoStack_OperationPushed);
            textEditorControl.ActiveTextAreaControl.Document.UndoStack.ActionUndone += new EventHandler(UndoStack_ActionUndone);
            textEditorControl.ActiveTextAreaControl.Document.UndoStack.ActionRedone += new EventHandler(UndoStack_ActionUndone);

            if (GlobalControlConfig.ScriptEditorFont != null)
            {
                textEditorControl.Font = GlobalControlConfig.ScriptEditorFont;
            }

            if (forParserDocument)
            {
                toolStripButtonSave.Visible = false;
                toolStripButtonOptions.Visible = false;
                toolStripButtonOpenTest.Visible = false;
            }
        }
コード例 #11
0
 public ProjectEventArgs(IDocumentObject document)
 {
     Document = document;
 }
コード例 #12
0
 private TreeNode GetFolderNodeForDocument(IDocumentObject document)
 {
     if ((document is ScriptDocument) || (document is AssemblyDocument))
     {
         return _rootNode.Nodes["scripts"];
     }
     else if (document is NetServiceDocument)
     {
         return _rootNode.Nodes["services"];
     }
     else if (document is NetGraphDocument)
     {
         return _rootNode.Nodes["graphs"];
     }
     else if (document is TestDocument)
     {
         return _rootNode.Nodes["tests"];
     }
     else
     {
         return _rootNode.Nodes["data"];
     }
 }
コード例 #13
0
 private static bool HasDocumentTestType(IDocumentObject document)
 {
     if (document != null)
     {
         return GetDocumentTestType(document) != null;
     }
     else
     {
         return false;
     }
 }
コード例 #14
0
        private static string GetDocumentIconName(IDocumentObject document)
        {
            string iconName = document.DefaultName;

            if ((document is ScriptDocument) && !(document is ParserDocument))
            {
                ScriptDocument doc = (ScriptDocument)document;
                iconName = doc.Container.Engine;
            }

            return iconName;
        }
コード例 #15
0
 protected void OnDocumentDeleted(IDocumentObject document)
 {
     DocumentControl.Close(document);
 }
コード例 #16
0
 public ProjectEventArgs(IDocumentObject document)
 {
     Document = document;
 }
コード例 #17
0
ファイル: Form1.cs プロジェクト: xiefengdaxia/CSharpBigPlugin
 public Form1(IDocumentObject obj)
 {
     InitializeComponent();
     System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;
     _Obj = obj;
 }
コード例 #18
0
ファイル: MainForm.cs プロジェクト: michyer/canape
 /// <summary>
 /// Rename a document form
 /// </summary>
 /// <param name="document">The document to rename</param>
 public void RenameDocumentForm(IDocumentObject document)
 {
     if (InvokeRequired)
     {
         Invoke(new Action<IDocumentObject>(RenameDocumentForm), document);
     }
     else
     {
         if (_entries.ContainsKey(document))
         {
             DockContent win = _entries[document];
             if ((win != null) && !win.IsDisposed)
             {
                 win.Text = document.Name;
             }
         }
     }
 }
コード例 #19
0
ファイル: MainForm.cs プロジェクト: michyer/canape
        /// <summary>
        /// Close a document form
        /// </summary>
        /// <param name="document">The document to close</param>
        public void CloseDocumentForm(IDocumentObject document)
        {
            if (InvokeRequired)
            {
                Invoke(new Action<IDocumentObject>(CloseDocumentForm), document);
            }
            else
            {
                if (_entries.ContainsKey(document))
                {
                    DockContent win = _entries[document];

                    if ((win != null) && (!win.IsDisposed))
                    {
                        win.Close();
                    }
                }
            }
        }
コード例 #20
0
 protected void OnDisplayDocument(IDocumentObject document)
 {
     DocumentControl.Show(document);
 }
コード例 #21
0
 /// <summary>
 /// Gets an icon for the document
 /// </summary>
 /// <param name="document">The document to get the icon for</param>
 /// <returns>Default to null meaning no icon available</returns>
 public virtual Icon GetIconForDocument(IDocumentObject document)
 {
     return(null);
 }
コード例 #22
0
ファイル: XMLReader.cs プロジェクト: CoderZhaoY/Editer
 public void Work(IDocumentObject document)
 {
     throw new NotImplementedException();
 }
コード例 #23
0
 protected void OnDocumentDeleted(IDocumentObject document)
 {
     DocumentControl.Close(document);
 }
コード例 #24
0
 public ScriptDocumentControl(IDocumentObject document)
     : this(document, false)
 {
 }
コード例 #25
0
ファイル: CSPlugin.cs プロジェクト: CoderZhaoY/Editer
 /// <summary>
 /// 插件运行
 /// </summary>
 /// <param name="document"></param>
 public abstract void Work(IDocumentObject document);
コード例 #26
0
ファイル: MainForm.cs プロジェクト: michyer/canape
 /// <summary>
 /// Set the document icon
 /// </summary>
 /// <param name="document">The document to set the icon for</param>
 /// <param name="iconName">The name of the icon</param>
 /// <param name="icon">The icon itself</param>
 public void SetDocumentIcon(IDocumentObject document, string iconName, Icon icon)
 {
     if ((_projectExplorer != null) && !_projectExplorer.IsDisposed)
     {
         _projectExplorer.SetIconForDocument(document, iconName, icon);
     }
 }
コード例 #27
0
 public Class1(IDocumentObject A_0) : base((Document)A_0)
 {
 }
コード例 #28
0
ファイル: MainForm.cs プロジェクト: michyer/canape
 /// <summary>
 /// Show a document object in a form
 /// </summary>
 /// <param name="document">The document to show</param>
 public void ShowDocumentForm(IDocumentObject document)
 {
     if (InvokeRequired)
     {
         Invoke(new Action<IDocumentObject>(ShowDocumentForm), document);
     }
     else
     {
         try
         {
             if ((!_entries.ContainsKey(document)) || (_entries[document].IsDisposed))
             {
                 _entries[document] = (DockContent)new DocumentForm(document);
                 _entries[document].Show(dockPanel, DockState.Document);
             }
             else
             {
                 _entries[document].Show();
             }
         }
         catch (ArgumentException ex)
         {
             MessageBox.Show(this, ex.Message,
                 Properties.Resources.MessageBox_ErrorString,
                 MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
コード例 #29
0
 protected void OnDisplayDocument(IDocumentObject document)
 {
     DocumentControl.Show(document);
 }
コード例 #30
0
 private void method_6(IDocumentObject A_0)
 {
     if (A_0 is Paragraph)
     {
         foreach (ParagraphBase base2 in (A_0 as Paragraph).Items)
         {
             if (base2 is BookmarkStart)
             {
                 Bookmark bookmark2 = base.Document.Bookmarks.FindByName((base2 as BookmarkStart).Name);
                 if (bookmark2 != null)
                 {
                     if (bookmark2.BookmarkStart != null)
                     {
                         bookmark2.BookmarkStart.bool_9 = true;
                     }
                     if (bookmark2.BookmarkEnd != null)
                     {
                         bookmark2.BookmarkEnd.bool_9 = true;
                     }
                     base.Document.Bookmarks.InnerList.Remove(bookmark2);
                 }
             }
             else if (base2 is TextBox)
             {
                 foreach (BodyRegion region in (base2 as TextBox).Body.Items)
                 {
                     this.method_6(region);
                 }
             }
         }
     }
     else if (A_0 is Table)
     {
         foreach (TableRow row in (A_0 as Table).Rows)
         {
             foreach (TableCell cell in row.Cells)
             {
                 foreach (BodyRegion region2 in cell.Items)
                 {
                     this.method_6(region2);
                 }
             }
         }
     }
     else if (A_0 is BookmarkStart)
     {
         Bookmark bookmark = base.Document.Bookmarks.FindByName((A_0 as BookmarkStart).Name);
         if (bookmark != null)
         {
             if (bookmark.BookmarkStart != null)
             {
                 bookmark.BookmarkStart.bool_9 = true;
             }
             if (bookmark.BookmarkEnd != null)
             {
                 bookmark.BookmarkEnd.bool_9 = true;
             }
             base.Document.Bookmarks.InnerList.Remove(bookmark);
         }
     }
 }
コード例 #31
0
 protected void OnDocumentRenamed(IDocumentObject document)
 {
     DocumentControl.Rename(document);
 }
コード例 #32
0
 private void method_7(IDocumentObject A_0)
 {
     if (A_0 is Paragraph)
     {
         foreach (ParagraphBase base2 in (A_0 as Paragraph).Items)
         {
             if (base2 is PermissionStart)
             {
                 Permission permission2 = base.Document.Permissions.FindById((base2 as PermissionStart).Id);
                 if (permission2 != null)
                 {
                     if (permission2.PermissionStart != null)
                     {
                         permission2.PermissionStart.bool_8 = true;
                     }
                     if (permission2.PermissionEnd != null)
                     {
                         permission2.PermissionEnd.bool_8 = true;
                     }
                     base.Document.Permissions.InnerList.Remove(permission2);
                 }
             }
             else if (base2 is TextBox)
             {
                 foreach (BodyRegion region in (base2 as TextBox).Body.Items)
                 {
                     this.method_7(region);
                 }
             }
         }
     }
     else if (A_0 is Table)
     {
         foreach (TableRow row in (A_0 as Table).Rows)
         {
             foreach (TableCell cell in row.Cells)
             {
                 foreach (BodyRegion region2 in cell.Items)
                 {
                     this.method_7(region2);
                 }
             }
         }
     }
     else if (A_0 is PermissionStart)
     {
         Permission permission = base.Document.Permissions.FindById((A_0 as PermissionStart).Id);
         if (permission != null)
         {
             if (permission.PermissionStart != null)
             {
                 permission.PermissionStart.bool_8 = true;
             }
             if (permission.PermissionEnd != null)
             {
                 permission.PermissionEnd.bool_8 = true;
             }
             base.Document.Permissions.InnerList.Remove(permission);
         }
     }
 }
コード例 #33
0
        private static Type GetDocumentTestType(IDocumentObject document)
        {
            object[] attrs = document.GetType().GetCustomAttributes(typeof(TestDocumentTypeAttribute), true);

            if (attrs.Length > 0)
            {
                return ((TestDocumentTypeAttribute)attrs[0]).DocumentType;
            }
            else
            {
                return null;
            }
        }
コード例 #34
0
 public bool Contains(IDocumentObject entity)
 {
     return(base.InnerList.Contains(entity));
 }
コード例 #35
0
        private void AddEntryToTree(IDocumentObject document)
        {
            if (InvokeRequired)
            {
                Invoke(new Action<IDocumentObject>(AddEntryToTree), document);
            }
            else
            {
                TreeNode node = GetFolderNodeForDocument(document).Nodes.Add(document.Name);
                Icon icon = GetIconForDocument(document);
                if (icon != null)
                {
                    string iconName = GetDocumentIconName(document);

                    if (!imageListIcons.Images.ContainsKey(iconName))
                    {
                        imageListIcons.Images.Add(iconName, icon);
                    }
                    node.ImageKey = iconName;
                    node.SelectedImageKey = iconName;
                }
                else
                {
                    node.SelectedImageIndex = 1;
                    node.ImageIndex = 1;
                }

                node.Tag = document;
                _documentToNode[document.Uuid] = node;
                node.EnsureVisible();
            }
        }
コード例 #36
0
 public int IndexOf(IDocumentObject entity)
 {
     return(base.InnerList.IndexOf(entity));
 }
コード例 #37
0
        private Icon GetIconForDocument(IDocumentObject document)
        {
            Type docType = document.GetType();

            // Query factories for an Icon first
            foreach (var ext in DocumentFactoryManager.Instance.GetExtensions())
            {
                IDocumentFactory factory = GetFactory(ext.ExtensionType);
                Icon ret = factory.GetIconForDocument(document);
                if (ret != null)
                {
                    return ret;
                }
            }

            // No extension icon, go for defaults
            if (document is NetGraphDocument)
            {
                return Properties.Resources.NetGraphIcon;
            }
            else if (document is ParserDocument)
            {
                return Properties.Resources.ParserComponent;
            }
            else if (document is AssemblyDocument)
            {
                return Properties.Resources.Assembly_ProjectEntry;
            }
            else if (document is ScriptDocument)
            {
                ScriptDocument doc = (ScriptDocument)document;

                switch (doc.Container.Engine)
                {
                    case "csharp": return Properties.Resources.CSScriptIcon;
                    case "python": return Properties.Resources.PythonScriptIcon;
                    case "visualbasic": return Properties.Resources.VBScriptIcon;
                    case "fsharp": return Properties.Resources.CSScriptIcon;
                }

                return Properties.Resources.ScriptIcon;
            }
            else if (document is NetServiceDocument)
            {
                return Properties.Resources.Network_Map;
            }
            else if (document is TextDocument)
            {
                return Properties.Resources.textdoc;
            }
            else if (document is TestDocument)
            {
                return Properties.Resources.otheroptions;
            }

            return Properties.Resources.UtilityText;
        }
コード例 #38
0
 internal void method_24(IDocumentObject A_0)
 {
     base.InnerList.Remove(A_0);
 }
コード例 #39
0
        public void SetIconForDocument(IDocumentObject document, string iconName, Icon icon)
        {
            if (_documentToNode.ContainsKey(document.Uuid))
            {
                TreeNode node = _documentToNode[document.Uuid];

                if (iconName == null)
                {
                    iconName = GetDocumentIconName(document);
                }

                if (!imageListIcons.Images.ContainsKey(iconName))
                {
                    imageListIcons.Images.Add(iconName, icon);
                }

                node.ImageKey = iconName;
                node.SelectedImageKey = iconName;
            }
        }
コード例 #40
0
ファイル: DocumentForm.cs プロジェクト: wflk/canape
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="document">The document to display</param>
 public DocumentForm(IDocumentObject document)
     : this(document.Name, GetControlForDocument(document))
 {
 }
コード例 #41
0
ファイル: CANAPEProject.cs プロジェクト: tyranid/canape
 private void GenerateName(IDocumentObject document)
 {
     document.Name = GenerateName(document.DefaultName);
 }
コード例 #42
0
    private void method_116()
    {
        Borders borders = this.paragraph_0.Format.Borders;

        if (!borders.NoBorder && !this.paragraph_0.SectionEndMark)
        {
            Class372 class1 = base.Interface22.imethod_0();
            class1.method_5(class1.method_4() + (borders.Top.LineWidth + borders.Top.Space));
            if (borders.Bottom.Shadow)
            {
                Class372 class2 = base.Interface22.imethod_0();
                class2.method_13(class2.method_12() + ((borders.Bottom.LineWidth * 2f) + borders.Bottom.Space));
            }
            else
            {
                Class372 class3 = base.Interface22.imethod_0();
                class3.method_13(class3.method_12() + (borders.Bottom.LineWidth + borders.Bottom.Space));
            }
        }
        if (((this.paragraph_0.PreviousSibling is Paragraph) && ((this.paragraph_0.PreviousSibling as Paragraph).Format.Borders.Bottom.BorderType != BorderStyle.Cleared)) && (((this.paragraph_0.PreviousSibling as Paragraph).Format.Borders.Bottom.BorderType != BorderStyle.None) && ((this.paragraph_0.PreviousSibling as Paragraph).Format.Borders.Bottom.LineWidth > 0f)))
        {
            Class372 class4 = base.Interface22.imethod_0();
            class4.method_5(class4.method_4() + (this.paragraph_0.PreviousSibling as Paragraph).Format.Borders.Bottom.LineWidth);
        }
        if (!borders.NoBorder)
        {
            if (borders.Bottom.BorderType != BorderStyle.None)
            {
                base.Interface22.imethod_0().method_15(borders.Bottom.Space);
            }
            if (borders.Top.BorderType != BorderStyle.None)
            {
                base.Interface22.imethod_0().method_7(borders.Top.Space);
            }
            IDocumentObject previousSibling = this.paragraph_0.PreviousSibling;
            if ((previousSibling == null) && (borders.Top.BorderType != BorderStyle.None))
            {
                base.method_50(true);
            }
            else
            {
                if ((!(previousSibling is Paragraph) && (this.paragraph_0.Owner is SDTContent)) && (this.paragraph_0.Owner.Owner is StructureDocumentTag))
                {
                    ICompositeObject owner = this.paragraph_0.Owner.Owner.Owner as ICompositeObject;
                    int index = owner.ChildObjects.IndexOf(this.paragraph_0.Owner.Owner);
                    if ((index >= 1) && (index <= (owner.ChildObjects.Count - 1)))
                    {
                        previousSibling = owner.ChildObjects[index - 1];
                    }
                    else
                    {
                        previousSibling = null;
                    }
                }
                if (previousSibling is StructureDocumentTag)
                {
                    previousSibling = (previousSibling as StructureDocumentTag).ChildObjects.LastItem;
                }
                if (previousSibling is Paragraph)
                {
                    Paragraph       paragraph2 = previousSibling as Paragraph;
                    ParagraphFormat format     = this.paragraph_0.method_93();
                    ParagraphFormat format2    = paragraph2.method_93();
                    Borders         borders2   = !paragraph2.Format.Borders.NoBorder ? paragraph2.Format.Borders : ((((paragraph2.ParaStyle == null) || (paragraph2.ParaStyle.ParagraphFormat == null)) || paragraph2.ParaStyle.ParagraphFormat.Borders.NoBorder) ? null : paragraph2.ParaStyle.ParagraphFormat.Borders);
                    if (borders2 != null)
                    {
                        if (borders2.NoBorder && (borders.Top.BorderType != BorderStyle.None))
                        {
                            base.method_50(true);
                        }
                        else if (!borders2.NoBorder && ((!format.method_68(format2) || !format.method_69(format2)) || (((borders2.Bottom.BorderType == BorderStyle.None) || !borders2.Bottom.method_57(borders.Top)) && (!borders2.Bottom.method_57(borders.Bottom) || !borders2.Top.method_57(borders.Top)))))
                        {
                            base.method_50(true);
                        }
                    }
                    else if ((borders2 == null) && (borders.Top.BorderType != BorderStyle.None))
                    {
                        base.method_50(true);
                    }
                }
            }
            IDocumentObject nextSibling = this.paragraph_0.NextSibling;
            if ((nextSibling == null) && (borders.Bottom.BorderType != BorderStyle.None))
            {
                base.method_48(true);
            }
            else
            {
                if ((!(nextSibling is Paragraph) && (this.paragraph_0.Owner is SDTContent)) && (this.paragraph_0.Owner.Owner is StructureDocumentTag))
                {
                    ICompositeObject obj2 = this.paragraph_0.Owner.Owner.Owner as ICompositeObject;
                    int num = obj2.ChildObjects.IndexOf(this.paragraph_0.Owner.Owner);
                    if ((num >= 0) && (num <= (obj2.ChildObjects.Count - 2)))
                    {
                        nextSibling = obj2.ChildObjects[num + 1];
                    }
                    else
                    {
                        nextSibling = null;
                    }
                }
                if (nextSibling is StructureDocumentTag)
                {
                    nextSibling = (nextSibling as StructureDocumentTag).ChildObjects.FirstItem;
                }
                if (nextSibling is Paragraph)
                {
                    Paragraph       paragraph = nextSibling as Paragraph;
                    ParagraphFormat format3   = this.paragraph_0.method_93();
                    ParagraphFormat format4   = paragraph.method_93();
                    Borders         borders3  = !paragraph.Format.Borders.NoBorder ? paragraph.Format.Borders : ((((paragraph.ParaStyle == null) || (paragraph.ParaStyle.ParagraphFormat == null)) || paragraph.ParaStyle.ParagraphFormat.Borders.NoBorder) ? null : paragraph.ParaStyle.ParagraphFormat.Borders);
                    if (borders3 != null)
                    {
                        if (borders3.NoBorder && (borders.Bottom.BorderType != BorderStyle.None))
                        {
                            base.method_48(true);
                        }
                        else if (!borders3.NoBorder && ((!format3.method_68(format4) || !format3.method_69(format4)) || (((borders3.Top.BorderType == BorderStyle.None) || !borders3.Top.method_57(borders.Bottom)) && (!borders3.Bottom.method_57(borders.Bottom) || !borders3.Top.method_57(borders.Top)))))
                        {
                            base.method_48(true);
                        }
                    }
                    else if ((borders3 == null) && (borders.Bottom.BorderType != BorderStyle.None))
                    {
                        base.method_48(true);
                    }
                }
            }
        }
        if (!base.method_49())
        {
            base.Interface22.imethod_0().method_5(0.0);
            base.Interface22.imethod_0().method_7(0f);
        }
        if (!base.method_47())
        {
            base.Interface22.imethod_0().method_13(0.0);
            base.Interface22.imethod_0().method_15(0f);
        }
    }
コード例 #43
0
ファイル: ParserDocumentControl.cs プロジェクト: wflk/canape
 public ParserDocumentControl(IDocumentObject document)
     : this(document, false)
 {
 }
コード例 #44
0
ファイル: ProjectExplorer.cs プロジェクト: michyer/canape
 public void SetIconForDocument(IDocumentObject doc, string iconName, Icon icon)
 {
     projectExplorerControl.SetIconForDocument(doc, iconName, icon);
 }
コード例 #45
0
        internal Table method_78(Interface30 A_0)
        {
            int  num   = 7;
            bool flag  = this.table_0 is Class7;
            bool flag2 = base.method_1() != null;

            if (!flag || flag2)
            {
                this.table_0 = new Class7(this);
                this.table_0.ResetCells(1, 1);
            }
            this.table_0.method_0(base.Owner);
            TableRow  row          = this.table_0.Rows[0];
            TableCell cell         = row.Cells[0];
            float     left         = 0f;
            float     top          = 0f;
            float     bottom       = 0f;
            float     right        = 0f;
            float     width        = 0f;
            float     height       = 0f;
            float     num2         = 0f;
            float     clientHeight = 0f;
            bool      flag4        = true;

            if (base.Owner != null)
            {
                for (IDocumentObject obj2 = base.Owner; !(obj2 is Section); obj2 = obj2.Owner)
                {
                    if (((obj2 is Table) && this.Format.IsAllowInCell) && !(obj2 as Table).IsSDTTable)
                    {
                        this.table_0.IsTextBoxInTable = true;
                        break;
                    }
                    if (obj2.Owner == null)
                    {
                        break;
                    }
                }
                if (A_0.imethod_0().method_28().method_30() != null)
                {
                    Section section = A_0.imethod_0().method_28().method_30() as Section;
                    left   = section.PageSetup.Margins.Left;
                    top    = section.PageSetup.Margins.Top;
                    bottom = section.PageSetup.Margins.Bottom;
                    right  = section.PageSetup.Margins.Right;
                    float footerDistance = section.PageSetup.FooterDistance;
                    float headerDistance = section.PageSetup.HeaderDistance;
                    height       = section.PageSetup.PageSize.Height;
                    width        = section.PageSetup.PageSize.Width;
                    num2         = (A_0.imethod_0().method_135() || (section.Columns.Count <= 0)) ? section.PageSetup.ClientWidth : section.Columns[A_0.imethod_3().Interface30.imethod_4()].Width;
                    clientHeight = section.PageSetup.ClientHeight;
                    if (section.Columns.Count > 1)
                    {
                        flag4 = false;
                    }
                }
            }
            if (this.Format.WidthPercent > 0f)
            {
                float num9 = 0f;
                switch (this.Format.RelationWidth)
                {
                case HorizontalOrigin.Margin:
                    num9 = (num2 * this.Format.WidthPercent) / 100f;
                    break;

                case HorizontalOrigin.Page:
                    num9 = (width * this.Format.WidthPercent) / 100f;
                    break;
                }
                if (((num9 != 0f) && (this.Format.Width != num9)) && (((this.Format.LayoutFlowAlt == TextDirection.TopToBottom) || (this.Format.LayoutFlowAlt == TextDirection.TopToBottomRotated)) || !base.ShapePr.HasKey(0x1023)))
                {
                    this.Format.Width = num9;
                }
            }
            if (this.Format.HeightPercent > 0f)
            {
                float num5 = 0f;
                switch (this.Format.RelationHeight)
                {
                case VerticalOrigin.Margin:
                    num5 = (clientHeight * this.Format.HeightPercent) / 100f;
                    break;

                case VerticalOrigin.Page:
                    num5 = (height * this.Format.HeightPercent) / 100f;
                    break;
                }
                if ((num5 != 0f) && (this.Format.Width != num5))
                {
                    this.Format.Height = num5;
                }
            }
            Color fillColor = new Color();

            if (this.Format.Opacity > 0f)
            {
                fillColor = this.Format.FillColor;
            }
            row.Height = this.Format.Height;
            cell.CellFormat.TextDirection = this.Format.LayoutFlowAlt;
            if (!this.Format.NoLine && (base.ShapeType == ShapeType.TextBox))
            {
                cell.CellFormat.Borders.LineWidth  = this.Format.LineWidth;
                cell.CellFormat.Borders.Color      = this.Format.LineColor;
                cell.CellFormat.Borders.BorderType = this.method_81(this.Format.LineStyle);
            }
            else
            {
                cell.CellFormat.Borders.BorderType = BorderStyle.None;
            }
            if (this.Format.TextWrappingStyle == TextWrappingStyle.Inline)
            {
                goto Label_1240;
            }
            switch (this.Format.VerticalOrigin)
            {
            case VerticalOrigin.Margin:
                this.table_0.TableFormat.Positioning.VertRelationTo = VerticalRelation.Margin;
                switch (this.Format.VerticalAlignment)
                {
                case ShapeVerticalAlignment.None:
                    if (Math.Abs(this.Format.TopPercent) != 0f)
                    {
                        this.table_0.TableFormat.Positioning.VertPositionEx = clientHeight * (this.Format.TopPercent / 100f);
                    }
                    else if (this.Format.VerticalPosition != 0f)
                    {
                        this.table_0.TableFormat.Positioning.VertPositionEx = this.Format.VerticalPosition;
                    }
                    else
                    {
                        this.table_0.TableFormat.Positioning.VertPositionAbs = VerticalPosition.None;
                    }
                    goto Label_0995;

                case ShapeVerticalAlignment.Top:
                    if (Math.Abs(this.Format.TopPercent) != 0f)
                    {
                        this.table_0.TableFormat.Positioning.VertPositionEx = top * (this.Format.TopPercent / 100f);
                    }
                    else if (this.Format.VerticalPosition != 0f)
                    {
                        this.table_0.TableFormat.Positioning.VertPositionEx = this.Format.VerticalPosition;
                    }
                    else
                    {
                        this.table_0.TableFormat.Positioning.VertPositionAbs = VerticalPosition.Top;
                    }
                    goto Label_0995;

                case ShapeVerticalAlignment.Center:
                    if (Math.Abs(this.Format.TopPercent) != 0f)
                    {
                        this.table_0.TableFormat.Positioning.VertPositionEx = (clientHeight / 2f) * (this.Format.TopPercent / 100f);
                    }
                    else if (this.Format.VerticalPosition != 0f)
                    {
                        this.table_0.TableFormat.Positioning.VertPositionEx = (clientHeight - this.Format.Height) / 2f;
                    }
                    else
                    {
                        this.table_0.TableFormat.Positioning.VertPositionAbs = VerticalPosition.Center;
                    }
                    goto Label_0995;

                case ShapeVerticalAlignment.Bottom:
                    if (Math.Abs(this.Format.TopPercent) != 0f)
                    {
                        this.table_0.TableFormat.Positioning.VertPositionEx = ((clientHeight - this.Format.InternalMargin.Bottom) - bottom) * (this.Format.TopPercent / 100f);
                    }
                    else if (this.Format.VerticalPosition != 0f)
                    {
                        this.table_0.TableFormat.Positioning.VertPositionEx = clientHeight - this.Format.Height;
                    }
                    else
                    {
                        this.table_0.TableFormat.Positioning.VertPositionAbs = VerticalPosition.Bottom;
                    }
                    goto Label_0995;
                }
                break;

            case VerticalOrigin.Page:
                this.table_0.TableFormat.Positioning.VertRelationTo = VerticalRelation.Page;
                switch (this.Format.VerticalAlignment)
                {
                case ShapeVerticalAlignment.None:
                    if (Math.Abs(this.Format.TopPercent) != 0f)
                    {
                        this.table_0.TableFormat.Positioning.VertPositionEx = height * (this.Format.TopPercent / 100f);
                    }
                    else
                    {
                        this.table_0.TableFormat.Positioning.VertPositionEx = this.Format.VerticalPosition;
                    }
                    goto Label_0995;

                case ShapeVerticalAlignment.Top:
                {
                    RowFormat.TablePositioning positioning = this.table_0.TableFormat.Positioning;
                    positioning.VertPositionEx -= this.Format.InternalMargin.Top;
                    goto Label_0995;
                }

                case ShapeVerticalAlignment.Center:
                    this.table_0.TableFormat.Positioning.VertPositionEx = (height - this.Format.Height) / 2f;
                    goto Label_0995;

                case ShapeVerticalAlignment.Bottom:
                    this.table_0.TableFormat.Positioning.VertPositionEx = (height - this.Format.Height) - this.Format.InternalMargin.Bottom;
                    goto Label_0995;
                }
                break;

            case VerticalOrigin.Paragraph:
            case VerticalOrigin.Line:
                this.table_0.TableFormat.Positioning.VertRelationTo = VerticalRelation.Paragraph;
                this.table_0.TableFormat.Positioning.VertPositionEx = this.Format.VerticalPosition;
                break;

            case VerticalOrigin.TopMarginArea:
                this.table_0.TableFormat.Positioning.VertRelationTo = VerticalRelation.Page;
                if (this.Format.VerticalAlignment == ShapeVerticalAlignment.None)
                {
                    if (Math.Abs(this.Format.TopPercent) == 0f)
                    {
                        this.table_0.TableFormat.Positioning.VertPositionEx = this.Format.VerticalPosition;
                        break;
                    }
                    this.table_0.TableFormat.Positioning.VertPositionEx = height * (this.Format.TopPercent / 100f);
                }
                break;

            default:
                if (this.table_0.TableFormat.Positioning.VertPositionEx == 0f)
                {
                    this.table_0.TableFormat.Positioning.VertPositionEx = this.Format.VerticalPosition;
                }
                break;
            }
Label_0995:
            switch (this.Format.HorizontalOrigin)
            {
            case HorizontalOrigin.Margin:
                this.table_0.TableFormat.Positioning.HorizRelationTo  = HorizontalRelation.Margin;
                this.table_0.TableFormat.Positioning.HorizPositionAbs = HorizontalPosition.Left;
                switch (this.Format.HorizontalAlignment)
                {
                case ShapeHorizontalAlignment.None:
                    if (Math.Abs(this.Format.LeftPercent) != 0f)
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = num2 * (this.Format.LeftPercent / 100f);
                    }
                    else
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = this.Format.HorizontalPosition;
                    }
                    break;

                case ShapeHorizontalAlignment.Left:
                    if (Math.Abs(this.Format.LeftPercent) != 0f)
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = (left - this.Format.InternalMargin.Left) * (this.Format.LeftPercent / 100f);
                    }
                    else
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = this.table_0.TableFormat.LeftIndent - this.Format.InternalMargin.Left;
                    }
                    break;

                case ShapeHorizontalAlignment.Center:
                    if (Math.Abs(this.Format.LeftPercent) != 0f)
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = (num2 / 2f) * (this.Format.LeftPercent / 100f);
                    }
                    else
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = (num2 - this.Format.Width) / 2f;
                    }
                    break;

                case ShapeHorizontalAlignment.Right:
                    if (Math.Abs(this.Format.LeftPercent) != 0f)
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = (num2 - this.Format.InternalMargin.Right) * (this.Format.LeftPercent / 100f);
                    }
                    else
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = (num2 - this.Format.Width) - this.Format.InternalMargin.Right;
                    }
                    break;
                }
                goto Label_11AF;

            case HorizontalOrigin.Page:
                this.table_0.TableFormat.Positioning.HorizRelationTo = HorizontalRelation.Page;
                switch (this.Format.HorizontalAlignment)
                {
                case ShapeHorizontalAlignment.None:
                    if (Math.Abs(this.Format.LeftPercent) != 0f)
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = width * (this.Format.LeftPercent / 100f);
                    }
                    else
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = this.Format.HorizontalPosition;
                    }
                    break;

                case ShapeHorizontalAlignment.Left:
                    this.table_0.TableFormat.Positioning.HorizPositionEx = 0f;
                    break;

                case ShapeHorizontalAlignment.Center:
                    this.table_0.TableFormat.Positioning.HorizPositionEx = (width - this.Format.Width) / 2f;
                    break;

                case ShapeHorizontalAlignment.Right:
                    this.table_0.TableFormat.Positioning.HorizPositionEx = width - this.Format.Width;
                    break;
                }
                goto Label_11AF;

            case HorizontalOrigin.Column:
                this.table_0.TableFormat.Positioning.HorizRelationTo = HorizontalRelation.Column;
                switch (this.Format.HorizontalAlignment)
                {
                case ShapeHorizontalAlignment.None:
                    this.table_0.TableFormat.Positioning.HorizPositionEx = this.Format.HorizontalPosition;
                    break;

                case ShapeHorizontalAlignment.Left:
                    this.table_0.TableFormat.Positioning.HorizPositionEx = this.table_0.TableFormat.LeftIndent - this.Format.InternalMargin.Left;
                    break;

                case ShapeHorizontalAlignment.Center:
                    this.table_0.TableFormat.Positioning.HorizPositionEx = (num2 - this.Format.Width) / 2f;
                    break;

                case ShapeHorizontalAlignment.Right:
                    this.table_0.TableFormat.Positioning.HorizPositionEx = (num2 - this.Format.Width) - this.Format.InternalMargin.Right;
                    break;
                }
                goto Label_11AF;

            case HorizontalOrigin.LeftMarginArea:
                this.table_0.TableFormat.Positioning.HorizRelationTo = HorizontalRelation.Margin;
                switch (this.Format.HorizontalAlignment)
                {
                case ShapeHorizontalAlignment.None:
                    this.table_0.TableFormat.Positioning.HorizRelationTo = HorizontalRelation.Page;
                    if (Math.Abs(this.Format.LeftPercent) == 0f)
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = this.Format.HorizontalPosition;
                        break;
                    }
                    this.table_0.TableFormat.Positioning.HorizPositionEx = width * (this.Format.LeftPercent / 100f);
                    break;

                case ShapeHorizontalAlignment.Left:
                    if (Math.Abs(this.Format.LeftPercent) == 0f)
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = -(left - this.Format.InternalMargin.Left);
                        break;
                    }
                    this.table_0.TableFormat.Positioning.HorizPositionEx = -(left - this.Format.InternalMargin.Left) * (this.Format.LeftPercent / 100f);
                    break;

                case ShapeHorizontalAlignment.Center:
                    if (Math.Abs(this.Format.LeftPercent) == 0f)
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = -(left - this.Format.Width) / 2f;
                        break;
                    }
                    this.table_0.TableFormat.Positioning.HorizPositionEx = -(left / 2f) * (this.Format.LeftPercent / 100f);
                    break;

                case ShapeHorizontalAlignment.Right:
                    if (Math.Abs(this.Format.LeftPercent) == 0f)
                    {
                        this.table_0.TableFormat.Positioning.HorizPositionEx = -(this.Format.Width + this.Format.InternalMargin.Right);
                        break;
                    }
                    this.table_0.TableFormat.Positioning.HorizPositionEx = -(left - this.Format.InternalMargin.Right) * (this.Format.LeftPercent / 100f);
                    break;
                }
                goto Label_11AF;

            case HorizontalOrigin.RightMarginArea:
                this.table_0.TableFormat.Positioning.HorizRelationTo  = HorizontalRelation.Margin;
                this.table_0.TableFormat.Positioning.HorizPositionAbs = HorizontalPosition.Left;
                switch (this.Format.HorizontalAlignment)
                {
                case ShapeHorizontalAlignment.None:
                    this.table_0.TableFormat.Positioning.HorizPositionEx = num2 + this.Format.HorizontalPosition;
                    break;

                case ShapeHorizontalAlignment.Left:
                    this.table_0.TableFormat.Positioning.HorizPositionEx = num2;
                    break;

                case ShapeHorizontalAlignment.Center:
                    this.table_0.TableFormat.Positioning.HorizPositionEx = num2 + ((right - this.Format.Width) / 2f);
                    break;

                case ShapeHorizontalAlignment.Right:
                    this.table_0.TableFormat.Positioning.HorizPositionEx = (num2 + right) - this.Format.Width;
                    break;
                }
                goto Label_11AF;
            }
            if (this.table_0.TableFormat.Positioning.VertPositionEx == 0f)
            {
                this.table_0.TableFormat.Positioning.VertPositionEx = this.Format.VerticalPosition;
            }
Label_11AF:
            this.table_0.TableFormat.method_53(true);
            this.table_0.TableFormat.Positioning.DistanceFromBottom = this.Format.WrapDistanceBottom;
            this.table_0.TableFormat.Positioning.DistanceFromLeft   = this.Format.WrapDistanceLeft;
            this.table_0.TableFormat.Positioning.DistanceFromRight  = this.Format.WrapDistanceRight;
            this.table_0.TableFormat.Positioning.DistanceFromTop    = this.Format.WrapDistanceTop;
Label_1240:
            if ((this.Format.IsInGroupShape || this.Format.IsInShape) && (this.ShapeInfo != null))
            {
                this.table_0.TableFormat.method_53(true);
            }
            if (((this.Format.HorizontalOrigin == HorizontalOrigin.Column) && flag4) && !this.table_0.IsTextBoxInTable)
            {
                RowFormat.TablePositioning positioning2 = this.table_0.TableFormat.Positioning;
                positioning2.HorizPositionEx += left;
                this.table_0.TableFormat.Positioning.HorizRelationTo = HorizontalRelation.Page;
            }
            if (!this.Format.IsInShape)
            {
                cell.CellFormat.BackColor = fillColor;
            }
            if (base.ShapeType == ShapeType.TextBox)
            {
                if (this.Format.FillEfects.Type == BackgroundType.NoBackground)
                {
                    if (this.Format.TextWrappingStyle == TextWrappingStyle.InFrontOfText)
                    {
                        fillColor = this.Format.FillColor;
                    }
                    else
                    {
                        fillColor = Color.Transparent;
                    }
                }
                else if (this.Format.FillEfects.Type == BackgroundType.Gradient)
                {
                    fillColor = this.Format.FillEfects.Gradient.Color2;
                    cell.CellFormat.TextureStyle = TextureStyle.Texture30Percent;
                }
                if (!this.Format.IsInShape)
                {
                    this.table_0.TableFormat.BackColor = fillColor;
                    cell.CellFormat.BackColor          = fillColor;
                }
            }
            this.table_0.TableFormat.LayoutType      = LayoutType.Fixed;
            this.table_0.TableFormat.Paddings.Left   = this.Format.InternalMargin.Left;
            this.table_0.TableFormat.Paddings.Right  = this.Format.InternalMargin.Right;
            this.table_0.TableFormat.Paddings.Top    = this.Format.InternalMargin.Top;
            this.table_0.TableFormat.Paddings.Bottom = this.Format.InternalMargin.Bottom;
            if (!this.Format.IsFitShapeToText || (this.Format.TextBoxWrapMode != TextBoxWrapMode.None))
            {
                cell.Width = this.Format.Width;
                goto Label_150E;
            }
            cell.CellWidthType = CellWidthType.Auto;
            bool flag3 = true;

            using (IEnumerator enumerator = this.ChildObjects.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    DocumentObject current = (DocumentObject)enumerator.Current;
                    if ((current is Paragraph) && (current as Paragraph).Text.Contains(BookmarkStart.b("␬", num)))
                    {
                        goto Label_14AE;
                    }
                }
                goto Label_14C8;
Label_14AE:
                flag3 = false;
            }
Label_14C8:
            if (flag3)
            {
                cell.Width = 0f;
                this.table_0.TableFormat.LayoutType = LayoutType.AutoFit;
                this.table_0.PreferredTableWidth.method_52(FtsWidth.Auto);
            }
Label_150E:
            cell.CellFormat.VerticalAlignment = this.method_80(this.Format.TextAnchor);
            if (this.Format.IsFitShapeToText)
            {
                this.table_0.Rows[0].HeightType = TableRowHeightType.AtLeast;
            }
            else
            {
                this.table_0.Rows[0].HeightType = TableRowHeightType.Exactly;
            }
            if (!flag || flag2)
            {
                int num4  = 0;
                int count = this.Body.Items.Count;
                while (num4 < count)
                {
                    BodyRegion region = this.Body.Items[num4];
                    if ((region.DocumentObjectType == Spire.Doc.Documents.DocumentObjectType.Paragraph) && (region as Paragraph).HasSDTInlineItem)
                    {
                        Paragraph entity = region.Clone() as Paragraph;
                        entity.Items.Clear();
                        int num10 = 0;
                        int num11 = (region as Paragraph).Items.Count;
                        while (num10 < num11)
                        {
                            DocumentObject obj3 = (region as Paragraph).Items[num10];
                            if (obj3 is StructureDocumentTagInline)
                            {
                                foreach (DocumentObject obj4 in (obj3 as StructureDocumentTagInline).SDTContent.Items)
                                {
                                    entity.Items.Add(obj4.Clone());
                                }
                                entity.bool_6 = false;
                            }
                            else
                            {
                                entity.Items.Add(obj3.Clone());
                            }
                            num10++;
                        }
                        cell.Items.Add(entity);
                    }
                    else
                    {
                        cell.Items.Add(region.Clone());
                    }
                    num4++;
                }
            }
            if (this.Format.IsInShape && (this.ShapeInfo != null))
            {
                this.Format.StartPoint = this.ShapeInfo.StartPoint;
            }
            return(this.table_0);
        }
コード例 #46
0
ファイル: DocumentForm.cs プロジェクト: michyer/canape
        /// <summary>
        /// 
        /// </summary>
        /// <param name="document"></param>
        /// <returns></returns>
        private static Control GetControlForDocument(IDocumentObject document)
        {
            foreach (var ext in DocumentEditorManager.Instance.GetExtensions().Where(e => !e.ExtensionAttribute.SubControl))
            {
                if (ext.ExtensionAttribute.DocumentType == document.GetType())
                {
                    return (Control)Activator.CreateInstance(ext.ExtensionType, document);
                }
            }

            if (document is NetServiceDocument)
            {
                return new NetServiceDocumentControl((NetServiceDocument)document);
            }
            else if (document is StateGraphDocument)
            {
                return new StateGraphDocumentControl(document);
            }
            else if (document is NetGraphDocument)
            {
                return new NetGraphDocumentControl((NetGraphDocument)document);
            }
            else if (document is TextDocument)
            {
                return new TextDocumentControl(document);
            }
            else if (document is PacketLogDocument)
            {
                return new PacketLogDocumentControl(document);
            }
            else if (document is ParserDocument)
            {
                return new ParserDocumentControl(document);
            }
            else if (document is AssemblyDocument)
            {
                return new AssemblyDocumentControl(document);
            }
            else if (document is ScriptDocument)
            {
                return new ScriptDocumentControl(document);
            }
            else if (document is ScriptTestDocument)
            {
                return new ScriptTestDocumentControl(document);
            }
            else if (document is NetGraphTestDocument)
            {
                return new NetGraphTestDocumentControl(document);
            }
            else if (document is BinaryDocument)
            {
                return new BinaryDocumentControl(document);
            }
            else if (document is PacketLogDiffDocument)
            {
                return new PacketLogDiffDocumentControl((PacketLogDiffDocument)document);
            }
            else
            {
                throw new ArgumentException(
                    String.Format(CANAPE.Properties.Resources.DocumentForm_NoRegisteredEditor, document.Name));
            }
        }
コード例 #47
0
 public ParserDocumentControl(IDocumentObject document)
     : this(document, false)
 {
 }
コード例 #48
0
 protected void OnDocumentRenamed(IDocumentObject document)
 {
     DocumentControl.Rename(document);
 }
コード例 #49
0
ファイル: DocumentForm.cs プロジェクト: wflk/canape
        /// <summary>
        ///
        /// </summary>
        /// <param name="document"></param>
        /// <returns></returns>
        private static Control GetControlForDocument(IDocumentObject document)
        {
            foreach (var ext in DocumentEditorManager.Instance.GetExtensions().Where(e => !e.ExtensionAttribute.SubControl))
            {
                if (ext.ExtensionAttribute.DocumentType == document.GetType())
                {
                    return((Control)Activator.CreateInstance(ext.ExtensionType, document));
                }
            }

            if (document is NetServiceDocument)
            {
                return(new NetServiceDocumentControl((NetServiceDocument)document));
            }
            else if (document is StateGraphDocument)
            {
                return(new StateGraphDocumentControl(document));
            }
            else if (document is NetGraphDocument)
            {
                return(new NetGraphDocumentControl((NetGraphDocument)document));
            }
            else if (document is TextDocument)
            {
                return(new TextDocumentControl(document));
            }
            else if (document is PacketLogDocument)
            {
                return(new PacketLogDocumentControl(document));
            }
            else if (document is ParserDocument)
            {
                return(new ParserDocumentControl(document));
            }
            else if (document is AssemblyDocument)
            {
                return(new AssemblyDocumentControl(document));
            }
            else if (document is ScriptDocument)
            {
                return(new ScriptDocumentControl(document));
            }
            else if (document is ScriptTestDocument)
            {
                return(new ScriptTestDocumentControl(document));
            }
            else if (document is NetGraphTestDocument)
            {
                return(new NetGraphTestDocumentControl(document));
            }
            else if (document is BinaryDocument)
            {
                return(new BinaryDocumentControl(document));
            }
            else if (document is PacketLogDiffDocument)
            {
                return(new PacketLogDiffDocumentControl((PacketLogDiffDocument)document));
            }
            else
            {
                throw new ArgumentException(
                          String.Format(CANAPE.Properties.Resources.DocumentForm_NoRegisteredEditor, document.Name));
            }
        }
コード例 #50
0
ファイル: Form1.cs プロジェクト: xiefengdaxia/CSharpBigPlugin
 public Form1(IDocumentObject obj)
 {
     InitializeComponent();
     _Obj = obj;
 }
コード例 #51
0
ファイル: CANAPEProject.cs プロジェクト: tyranid/canape
 internal DocumentEventArgs(IDocumentObject document)
 {
     Document = document;
 }
コード例 #52
0
        private void netEditor_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                GraphNode node = netEditor.SelectedObject as GraphNode;

                if (node != null)
                {
                    BaseNodeConfig config = (BaseNodeConfig)node.Tag;

                    PropertyDescriptorCollection coll = TypeDescriptor.GetProperties(config);

                    foreach (PropertyDescriptor desc in coll)
                    {
                        if (typeof(IDocumentObject).IsAssignableFrom(desc.PropertyType))
                        {
                            object o = config;
                            ICustomTypeDescriptor custom = config as ICustomTypeDescriptor;
                            if (custom != null)
                            {
                                o = custom.GetPropertyOwner(desc);
                            }

                            IDocumentObject document = (IDocumentObject)desc.GetValue(o);
                            if (document == null)
                            {
                                if (MessageBox.Show(this, Resources.ResourceManager.GetString("NetGraphDocumentControl_NoDocumentSet", GeneralUtils.GetCurrentCulture()),
                                                    Resources.ResourceManager.GetString("NetGraphDocumentControl_NoDocumentSetCaption", GeneralUtils.GetCurrentCulture()),
                                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                                {
                                    // Create document
                                    if (desc.PropertyType == typeof(ScriptDocument))
                                    {
                                        using (SelectScriptTemplateForm frm = new SelectScriptTemplateForm())
                                        {
                                            if (frm.ShowDialog(this) == DialogResult.OK)
                                            {
                                                ScriptDocument script = CANAPEProject.CurrentProject.CreateDocument <ScriptDocument>(frm.Template.TypeName);
                                                script.Script = frm.Template.GetText();
                                                document      = script;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        document = CANAPEProject.CurrentProject.CreateDocument(desc.PropertyType);
                                    }
                                }
                            }

                            if (document != null)
                            {
                                DocumentControl.Show(document);
                                desc.SetValue(o, document);

                                // Reset selected objects
                                propertyGrid.SelectedObjects = propertyGrid.SelectedObjects;
                            }

                            break;
                        }
                    }
                }
            }
        }
コード例 #53
0
    private void method_117()
    {
        IDocumentObject owner = this.paragraph_0.Owner;

        while (owner != null)
        {
            if (owner.DocumentObjectType == DocumentObjectType.Body)
            {
                break;
            }
            owner = owner.Owner;
        }
        Body       body            = owner as Body;
        bool       flag            = false;
        bool       pageBreakBefore = false;
        IParagraph nextSibling     = null;

        if (body != null)
        {
            bool     isEndOfSection = this.paragraph_0.IsEndOfSection;
            ISection section        = body.method_2();
            int      index          = this.method_108().Sections.IndexOf(section);
            ISection section2       = ((index + 1) < this.paragraph_0.Document.Sections.Count) ? this.method_108().Sections[index + 1] : null;
            if (section2 != null)
            {
                if (flag = isEndOfSection && ((((section2.BreakCode == SectionBreakType.NewPage) || (section2.BreakCode == SectionBreakType.Oddpage)) || (section2.BreakCode == SectionBreakType.EvenPage)) || (section2.BreakCode == SectionBreakType.NoBreak)))
                {
                    base.method_30(flag);
                    base.method_64(section2.BreakCode);
                }
                else if ((isEndOfSection && (section2.BreakCode == SectionBreakType.NewColumn)) && ((section != null) && ((section as Section).SectPr.method_116() == 1)))
                {
                    base.method_30(true);
                    flag = true;
                    base.method_64(SectionBreakType.NewPage);
                }
            }
            if (!this.paragraph_0.IsInCell)
            {
                if ((this.paragraph_0.NextSibling is Table) && ((this.paragraph_0.NextSibling as Table).Rows[0].Cells[0].Paragraphs.Count > 0))
                {
                    nextSibling = (this.paragraph_0.NextSibling as Table).Rows[0].Cells[0].Paragraphs[0];
                }
                else if (this.paragraph_0.NextSibling is Paragraph)
                {
                    nextSibling = this.paragraph_0.NextSibling as Paragraph;
                }
                else if (this.paragraph_0.NextSibling is StructureDocumentTag)
                {
                    DocumentObject firstItem = (this.paragraph_0.NextSibling as StructureDocumentTag).ChildObjects.FirstItem;
                    if (firstItem is Paragraph)
                    {
                        nextSibling = firstItem as Paragraph;
                    }
                    else if ((firstItem is Table) && ((firstItem as Table).Rows[0].Cells[0].Paragraphs.Count > 0))
                    {
                        nextSibling = (firstItem as Table).Rows[0].Cells[0].Paragraphs[0];
                    }
                }
                else if (((this.paragraph_0.NextSibling == null) && (body.Owner != null)) && (body.Owner is StructureDocumentTag))
                {
                    IDocumentObject obj4 = body.Owner.NextSibling;
                    if (obj4 is Paragraph)
                    {
                        nextSibling = obj4 as Paragraph;
                    }
                    else if ((obj4 is Table) && ((obj4 as Table).Rows[0].Cells[0].Paragraphs.Count > 0))
                    {
                        nextSibling = (obj4 as Table).Rows[0].Cells[0].Paragraphs[0];
                    }
                }
                else if (((this.paragraph_0.NextSibling == null) && (body.Owner != null)) && ((body.Owner is Section) && (body.Owner.NextSibling is Section)))
                {
                    Body body2 = (body.Owner.NextSibling as Section).Body;
                    if (body2.Items.Count > 0)
                    {
                        if (body2.Items[0] is Paragraph)
                        {
                            nextSibling = body2.Items[0] as Paragraph;
                        }
                        else if ((body2.Items[0] is Table) && ((body2.Items[0] as Table).Rows[0].Cells[0].Paragraphs.Count > 0))
                        {
                            nextSibling = (body2.Items[0] as Table).Rows[0].Cells[0].Paragraphs[0];
                        }
                    }
                }
                if (nextSibling != null)
                {
                    pageBreakBefore = nextSibling.Format.PageBreakBefore;
                    if (flag && pageBreakBefore)
                    {
                        base.method_30(false);
                    }
                }
            }
        }
        base.method_32(this.paragraph_0.Format.PageBreakAfter);
        base.method_34(pageBreakBefore);
        base.method_38(((base.method_31() || pageBreakBefore) || this.paragraph_0.Format.IsColumnBreakAfter) || flag);
    }
コード例 #54
0
 public ScriptDocumentControl(IDocumentObject document)
     : this(document, false)
 {
 }
コード例 #55
0
ファイル: GuiUtils.cs プロジェクト: michyer/canape
        static void AddPacketsToDocument(IDocumentObject doc, LogPacket[] packets)
        {
            PacketLogDocument packetLog = doc as PacketLogDocument;
            TestDocument testDoc = doc as TestDocument;

            if (packetLog != null)
            {
                foreach (LogPacket packet in packets)
                {
                    packetLog.AddPacket((LogPacket)packet.Clone());
                }
            }
            else if (testDoc != null)
            {
                IEnumerable<LogPacket> newPackets = packets.Select(p => (LogPacket)p.Clone());
                testDoc.AddRangeInputPacket(newPackets);
            }
        }
コード例 #56
0
 internal int method_13(IDocumentObject A_0)
 {
     return(this.ChildObjects.Add(A_0));
 }