1 //========================================================================
5 // Copyright 1999-2005 Emmanuel Lesueur
7 //========================================================================
10 #pragma implementation
21 //------------------------------------------------------------------------
23 //------------------------------------------------------------------------
30 //------------------------------------------------------------------------
32 //------------------------------------------------------------------------
34 OutlineTree::~OutlineTree() {
43 void OutlineTree::addChild(Outline
*outline
) {
47 beg
= (Outline
**)greallocn(beg
, sz
+ 16, sizeof(*beg
));
54 OutlineTree
*OutlineTree::read(Object
*root
) {
57 OutlineTree
*tree
= NULL
;
58 if (root
->dictLookup("First", &outline
)->isDict()) {
60 GBool opened
= gFalse
;
62 if (root
->dictLookup("Count", &obj
)->isInt() && obj
.getInt() > 0)
65 tree
= new OutlineTree(opened
);
68 Action
*action
= NULL
;
69 if (!outline
.dictLookup("Dest", &obj
)->isNull())
70 action
= new ActionGoTo(new Destination(&obj
));
73 if (outline
.dictLookup("A", &obj
)->isDict())
74 action
= Action::makeAction(&obj
);
77 outline
.dictLookup("Title", &obj
);
79 tree
->addChild(new Outline(obj
.getString(), action
, read(&outline
)));
81 error(-1, "Bad outline title.");
85 outline
.dictLookup("Next", &obj
);