1 //========================================================================
2 //
3 // Outline.h
4 //
5 // Copyright 2002-2013 Glyph & Cog, LLC
6 //
7 //========================================================================
8 
9 #ifndef OUTLINE_H
10 #define OUTLINE_H
11 
12 #include <aconf.h>
13 
14 #ifdef USE_GCC_PRAGMAS
15 #pragma interface
16 #endif
17 
18 #include "Object.h"
19 #include "CharTypes.h"
20 
21 class GString;
22 class GList;
23 class XRef;
24 class LinkAction;
25 class TextString;
26 
27 //------------------------------------------------------------------------
28 
29 class Outline {
30 public:
31 
32   Outline(Object *outlineObj, XRef *xref);
33   ~Outline();
34 
getItems()35   GList *getItems() { return items; }
36 
37 private:
38 
39   GList *items;			// NULL if document has no outline
40 				//   [OutlineItem]
41 };
42 
43 //------------------------------------------------------------------------
44 
45 class OutlineItem {
46 public:
47 
48   OutlineItem(Object *itemRefA, Dict *dict, OutlineItem *parentA, XRef *xrefA);
49   ~OutlineItem();
50 
51   static GList *readItemList(Object *firstItemRef, Object *lastItemRef,
52 			     OutlineItem *parentA, XRef *xrefA);
53 
54   void open();
55   void close();
56 
57   Unicode *getTitle();
58   int getTitleLength();
getTitleTextString()59   TextString *getTitleTextString() { return title; }
getAction()60   LinkAction *getAction() { return action; }
isOpen()61   GBool isOpen() { return startsOpen; }
hasKids()62   GBool hasKids() { return firstRef.isRef(); }
getKids()63   GList *getKids() { return kids; }
64 
65 private:
66 
67   XRef *xref;
68   TextString *title;		// may be NULL
69   LinkAction *action;
70   Object itemRef;
71   Object firstRef;
72   Object lastRef;
73   Object nextRef;
74   GBool startsOpen;
75   GList *kids;			// NULL unless this item is open [OutlineItem]
76   OutlineItem *parent;
77 };
78 
79 #endif
80