Exemplo n.º 1
0
        static void PrintEntry(TableOfContents toc,
			       IDocumentConsumer doc,
			       int ent, int depth, int depthLimit)
        {
            if ((depthLimit >= 0) && (depth > depthLimit))
            return;

            doc.PushBlock(new Block() {
            Indent = depth
            });

            doc.PushFragment(new Fragment() {
            Attr = Fragment.Attributes.Heading,
            Text = toc.GetName(ent),
            Linkref = toc.GetLinkref(ent)
            });

            for (int i = toc.FirstChild(ent); i >= 0; i = toc.NextSibling(i))
            PrintEntry(toc, doc, i, depth + 1, depthLimit);
        }
Exemplo n.º 2
0
        public static void PrintToc(TableOfContents toc,
				    IDocumentConsumer doc,
				    int depthLimit = -1)
        {
            doc.PushBlock(new Block());
            doc.PushFragment(new Fragment() {
            Attr = Fragment.Attributes.Heading,
            Text = toc.Title
            });

            for (int i = toc.FirstRoot(); i >= 0; i = toc.NextSibling(i))
            PrintEntry(toc, doc, i, 0, depthLimit);

            doc.Close();
        }