/// <summary> /// Initializes a new instance of the <see cref="TableOfContents"/> class. /// </summary> /// <param name="textDocument">The text document.</param> /// <param name="styleName">Name of the style.</param> /// <param name="useHyperlinks">if set to <c>true</c> [use hyperlinks].</param> /// <param name="protectChanges">if set to <c>true</c> [protect changes].</param> /// <param name="textName">Title for the Table of content e.g. Table of Content</param> public TableOfContents(TextDocument textDocument, string styleName, bool useHyperlinks, bool protectChanges, string textName) { this.Document = textDocument; this.UseHyperlinks = useHyperlinks; this.NewXmlNode(styleName, protectChanges, textName); this.Style = new SectionStyle(this, styleName); this.Document.Styles.Add(this.Style); this.TableOfContentsSource = new TableOfContentsSource(this); this.TableOfContentsSource.InitStandardTableOfContentStyle(); this.Node.AppendChild(this.TableOfContentsSource.Node); this.CreateIndexBody(); this.CreateTitlePargraph(); this.InsertContentStyle(); this.SetOutlineStyle(); this.RegisterEvents(); }
/// <summary> /// Initializes a new instance of the <see cref="TableOfContents"/> class. /// </summary> /// <param name="textDocument">The text document.</param> /// <param name="styleName">Name of the style.</param> /// <param name="useHyperlinks">if set to <c>true</c> [use hyperlinks].</param> /// <param name="protectChanges">if set to <c>true</c> [protect changes].</param> /// <param name="textName">Title for the Table of content e.g. Table of Content</param> public TableOfContents(IDocument textDocument, string styleName, bool useHyperlinks, bool protectChanges, string textName) { Document = textDocument; UseHyperlinks = useHyperlinks; Node = new XElement(Ns.Text + "table-of-content"); Node.SetAttributeValue(Ns.Text + "style-name", styleName); Node.SetAttributeValue(Ns.Text + "protected", Convert.ToString(protectChanges).ToLower()); Node.SetAttributeValue(Ns.Text + "use-outline-level", "true"); Node.SetAttributeValue(Ns.Text + "name", textName ?? "Table of Contents1"); Style = new SectionStyle(this, styleName); Document.Styles.Add(Style); TableOfContentsSource = new TableOfContentsSource(this); TableOfContentsSource.InitStandardTableOfContentStyle(); Node.Add(TableOfContentsSource.Node); CreateIndexBody(); CreateTitlePargraph(); InsertContentStyle(); SetOutlineStyle(); RegisterEvents(); }
/// <summary> /// Initializes a new instance of the <see cref="TableOfContents"/> class. /// </summary> /// <param name="textDocument">The text document.</param> /// <param name="styleName">Name of the style.</param> /// <param name="useHyperlinks">if set to <c>true</c> [use hyperlinks].</param> /// <param name="protectChanges">if set to <c>true</c> [protect changes].</param> /// <param name="textName">Title for the Table of content e.g. Table of Content</param> public TableOfContents(TextDocument textDocument, string styleName, bool useHyperlinks, bool protectChanges, string textName) { this.Document = textDocument; this.UseHyperlinks = useHyperlinks; this.NewXmlNode(styleName, protectChanges, textName); this.Style = new SectionStyle(this, styleName); this.Document.Styles.Add(this.Style); this.TableOfContentsSource = new TableOfContentsSource(this); this.TableOfContentsSource.InitStandardTableOfContentStyle(); this.Node.AppendChild(this.TableOfContentsSource.Node); this.CreateIndexBody(); this.CreateTitlePargraph(); this.InsertContentStyle(); this.SetOutlineStyle(); this.RegisterEvents(); }