summaryrefslogtreecommitdiff
path: root/fitz/doc_outline.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2011-11-10 01:52:40 +0100
committerTor Andersson <tor.andersson@artifex.com>2011-11-10 01:52:40 +0100
commit97d00440c043b712a2d16134e3b52850c7b36d47 (patch)
treee7b838f3b7c714037bb238b0c4d17ab4aaa3e0ed /fitz/doc_outline.c
parentc445538b312a45435df87086eed2e19b68ed5bc1 (diff)
downloadmupdf-97d00440c043b712a2d16134e3b52850c7b36d47.tar.xz
Add XPS outline parsing and move outline data struct to fz_outline.
Diffstat (limited to 'fitz/doc_outline.c')
-rw-r--r--fitz/doc_outline.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/fitz/doc_outline.c b/fitz/doc_outline.c
new file mode 100644
index 00000000..ea3906ac
--- /dev/null
+++ b/fitz/doc_outline.c
@@ -0,0 +1,49 @@
+#include "fitz.h"
+
+void
+fz_free_outline(fz_outline *outline)
+{
+ while (outline)
+ {
+ fz_outline *next = outline->next;
+ fz_free_outline(outline->down);
+ fz_free(outline->title);
+ fz_free(outline);
+ outline = next;
+ }
+}
+
+void
+fz_debug_outline_xml(fz_outline *outline, int level)
+{
+ while (outline)
+ {
+ printf("<outline title=\"%s\" page=\"%d\"", outline->title, outline->page);
+ if (outline->down)
+ {
+ printf(">\n");
+ fz_debug_outline_xml(outline->down, level + 1);
+ printf("</outline>\n");
+ }
+ else
+ {
+ printf(" />\n");
+ }
+ outline = outline->next;
+ }
+}
+
+void
+fz_debug_outline(fz_outline *outline, int level)
+{
+ int i;
+ while (outline)
+ {
+ for (i = 0; i < level; i++)
+ putchar('\t');
+ printf("%s\t%d\n", outline->title, outline->page);
+ if (outline->down)
+ fz_debug_outline(outline->down, level + 1);
+ outline = outline->next;
+ }
+}