Commit ec52e46e authored by Carlos Garcia Campos's avatar Carlos Garcia Campos

xpdf303: Create annots with a doc instead of xref + catalog

parent ce5e620f
...@@ -480,7 +480,7 @@ find_annot_movie_for_action (PopplerDocument *document, ...@@ -480,7 +480,7 @@ find_annot_movie_for_action (PopplerDocument *document,
if (annotObj.isDict ()) { if (annotObj.isDict ()) {
Object tmp; Object tmp;
annot = new AnnotMovie (xref, annotObj.getDict(), document->doc->getCatalog (), &tmp); annot = new AnnotMovie (document->doc, annotObj.getDict(), &tmp);
if (!annot->isOk ()) { if (!annot->isOk ()) {
delete annot; delete annot;
annot = NULL; annot = NULL;
......
...@@ -199,7 +199,7 @@ poppler_annot_text_new (PopplerDocument *doc, ...@@ -199,7 +199,7 @@ poppler_annot_text_new (PopplerDocument *doc,
PDFRectangle pdf_rect(rect->x1, rect->y1, PDFRectangle pdf_rect(rect->x1, rect->y1,
rect->x2, rect->y2); rect->x2, rect->y2);
annot = new AnnotText (doc->doc->getXRef(), &pdf_rect, doc->doc->getCatalog()); annot = new AnnotText (doc->doc, &pdf_rect);
return _poppler_annot_text_new (annot); return _poppler_annot_text_new (annot);
} }
...@@ -708,7 +708,7 @@ poppler_annot_markup_set_popup (PopplerAnnotMarkup *poppler_annot, ...@@ -708,7 +708,7 @@ poppler_annot_markup_set_popup (PopplerAnnotMarkup *poppler_annot,
g_return_if_fail (POPPLER_IS_ANNOT_MARKUP (poppler_annot)); g_return_if_fail (POPPLER_IS_ANNOT_MARKUP (poppler_annot));
annot = static_cast<AnnotMarkup *>(POPPLER_ANNOT (poppler_annot)->annot); annot = static_cast<AnnotMarkup *>(POPPLER_ANNOT (poppler_annot)->annot);
popup = new AnnotPopup (annot->getXRef(), &pdf_rect, (Catalog *)NULL); popup = new AnnotPopup (annot->getDoc(), &pdf_rect);
annot->setPopup (popup); annot->setPopup (popup);
} }
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include "Catalog.h" #include "Catalog.h"
#include "Gfx.h" #include "Gfx.h"
#include "Lexer.h" #include "Lexer.h"
#include "PDFDoc.h"
#include "Page.h" #include "Page.h"
#include "Annot.h" #include "Annot.h"
#include "GfxFont.h" #include "GfxFont.h"
...@@ -808,14 +809,14 @@ AnnotAppearanceCharacs::~AnnotAppearanceCharacs() { ...@@ -808,14 +809,14 @@ AnnotAppearanceCharacs::~AnnotAppearanceCharacs() {
// Annot // Annot
//------------------------------------------------------------------------ //------------------------------------------------------------------------
Annot::Annot(XRef *xrefA, PDFRectangle *rectA, Catalog *catalog) { Annot::Annot(PDFDoc *docA, PDFRectangle *rectA) {
Object obj1; Object obj1;
refCnt = 1; refCnt = 1;
flags = flagUnknown; flags = flagUnknown;
type = typeUnknown; type = typeUnknown;
obj1.initArray (xrefA); obj1.initArray (docA->getXRef());
Object obj2; Object obj2;
obj1.arrayAdd (obj2.initReal (rectA->x1)); obj1.arrayAdd (obj2.initReal (rectA->x1));
obj1.arrayAdd (obj2.initReal (rectA->y1)); obj1.arrayAdd (obj2.initReal (rectA->y1));
...@@ -823,26 +824,26 @@ Annot::Annot(XRef *xrefA, PDFRectangle *rectA, Catalog *catalog) { ...@@ -823,26 +824,26 @@ Annot::Annot(XRef *xrefA, PDFRectangle *rectA, Catalog *catalog) {
obj1.arrayAdd (obj2.initReal (rectA->y2)); obj1.arrayAdd (obj2.initReal (rectA->y2));
obj2.free (); obj2.free ();
annotObj.initDict (xrefA); annotObj.initDict (docA->getXRef());
annotObj.dictSet ("Type", obj2.initName ("Annot")); annotObj.dictSet ("Type", obj2.initName ("Annot"));
annotObj.dictSet ("Rect", &obj1); annotObj.dictSet ("Rect", &obj1);
// obj1 is owned by the dict // obj1 is owned by the dict
ref = xrefA->addIndirectObject (&annotObj); ref = docA->getXRef()->addIndirectObject (&annotObj);
initialize (xrefA, annotObj.getDict(), catalog); initialize (docA, annotObj.getDict());
} }
Annot::Annot(XRef *xrefA, Dict *dict, Catalog* catalog) { Annot::Annot(PDFDoc *docA, Dict *dict) {
refCnt = 1; refCnt = 1;
hasRef = false; hasRef = false;
flags = flagUnknown; flags = flagUnknown;
type = typeUnknown; type = typeUnknown;
annotObj.initDict (dict); annotObj.initDict (dict);
initialize (xrefA, dict, catalog); initialize (docA, dict);
} }
Annot::Annot(XRef *xrefA, Dict *dict, Catalog* catalog, Object *obj) { Annot::Annot(PDFDoc *docA, Dict *dict, Object *obj) {
refCnt = 1; refCnt = 1;
if (obj->isRef()) { if (obj->isRef()) {
hasRef = gTrue; hasRef = gTrue;
...@@ -853,16 +854,17 @@ Annot::Annot(XRef *xrefA, Dict *dict, Catalog* catalog, Object *obj) { ...@@ -853,16 +854,17 @@ Annot::Annot(XRef *xrefA, Dict *dict, Catalog* catalog, Object *obj) {
flags = flagUnknown; flags = flagUnknown;
type = typeUnknown; type = typeUnknown;
annotObj.initDict (dict); annotObj.initDict (dict);
initialize (xrefA, dict, catalog); initialize (docA, dict);
} }
void Annot::initialize(XRef *xrefA, Dict *dict, Catalog *catalog) { void Annot::initialize(PDFDoc *docA, Dict *dict) {
Object asObj, obj1, obj2, obj3; Object asObj, obj1, obj2, obj3;
appRef.num = 0; appRef.num = 0;
appRef.gen = 65535; appRef.gen = 65535;
ok = gTrue; ok = gTrue;
xref = xrefA; doc = docA;
xref = doc->getXRef();
appearBuf = NULL; appearBuf = NULL;
fontSize = 0; fontSize = 0;
...@@ -910,7 +912,7 @@ void Annot::initialize(XRef *xrefA, Dict *dict, Catalog *catalog) { ...@@ -910,7 +912,7 @@ void Annot::initialize(XRef *xrefA, Dict *dict, Catalog *catalog) {
if (dict->lookupNF("P", &obj1)->isRef()) { if (dict->lookupNF("P", &obj1)->isRef()) {
Ref ref = obj1.getRef(); Ref ref = obj1.getRef();
page = catalog ? catalog->findPage (ref.num, ref.gen) : -1; page = doc->getCatalog()->findPage (ref.num, ref.gen);
} else { } else {
page = 0; page = 0;
} }
...@@ -1002,7 +1004,7 @@ void Annot::initialize(XRef *xrefA, Dict *dict, Catalog *catalog) { ...@@ -1002,7 +1004,7 @@ void Annot::initialize(XRef *xrefA, Dict *dict, Catalog *catalog) {
} }
obj1.free(); obj1.free();
optContentConfig = catalog ? catalog->getOptContentConfig() : NULL; optContentConfig = doc->getCatalog()->getOptContentConfig();
dict->lookupNF("OC", &oc); dict->lookupNF("OC", &oc);
if (!oc.isRef() && !oc.isNull()) { if (!oc.isRef() && !oc.isNull()) {
error (errSyntaxError, -1, "Annotation OC value not null or dict: {0:d}", oc.getType()); error (errSyntaxError, -1, "Annotation OC value not null or dict: {0:d}", oc.getType());
...@@ -1355,27 +1357,27 @@ void Annot::draw(Gfx *gfx, GBool printing) { ...@@ -1355,27 +1357,27 @@ void Annot::draw(Gfx *gfx, GBool printing) {
// AnnotPopup // AnnotPopup
//------------------------------------------------------------------------ //------------------------------------------------------------------------
AnnotPopup::AnnotPopup(XRef *xrefA, PDFRectangle *rect, Catalog *catalog) : AnnotPopup::AnnotPopup(PDFDoc *docA, PDFRectangle *rect) :
Annot(xrefA, rect, catalog) { Annot(docA, rect) {
Object obj1; Object obj1;
type = typePopup; type = typePopup;
annotObj.dictSet ("Subtype", obj1.initName ("Popup")); annotObj.dictSet ("Subtype", obj1.initName ("Popup"));
initialize (xrefA, annotObj.getDict(), catalog); initialize (docA, annotObj.getDict());
} }
AnnotPopup::AnnotPopup(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) : AnnotPopup::AnnotPopup(PDFDoc *docA, Dict *dict, Object *obj) :
Annot(xrefA, dict, catalog, obj) { Annot(docA, dict, obj) {
type = typePopup; type = typePopup;
initialize(xrefA, dict, catalog); initialize(docA, dict);
} }
AnnotPopup::~AnnotPopup() { AnnotPopup::~AnnotPopup() {
parent.free(); parent.free();
} }
void AnnotPopup::initialize(XRef *xrefA, Dict *dict, Catalog *catalog) { void AnnotPopup::initialize(PDFDoc *docA, Dict *dict) {
Object obj1; Object obj1;
if (!dict->lookupNF("Parent", &parent)->isRef()) { if (!dict->lookupNF("Parent", &parent)->isRef()) {
...@@ -1412,14 +1414,14 @@ void AnnotPopup::setOpen(GBool openA) { ...@@ -1412,14 +1414,14 @@ void AnnotPopup::setOpen(GBool openA) {
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// AnnotMarkup // AnnotMarkup
//------------------------------------------------------------------------ //------------------------------------------------------------------------
AnnotMarkup::AnnotMarkup(XRef *xrefA, PDFRectangle *rect, Catalog *catalog) : AnnotMarkup::AnnotMarkup(PDFDoc *docA, PDFRectangle *rect) :
Annot(xrefA, rect, catalog) { Annot(docA, rect) {
initialize(xrefA, annotObj.getDict(), catalog, &annotObj); initialize(docA, annotObj.getDict(), &annotObj);
} }
AnnotMarkup::AnnotMarkup(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) : AnnotMarkup::AnnotMarkup(PDFDoc *docA, Dict *dict, Object *obj) :
Annot(xrefA, dict, catalog, obj) { Annot(docA, dict, obj) {
initialize(xrefA, dict, catalog, obj); initialize(docA, dict, obj);
} }
AnnotMarkup::~AnnotMarkup() { AnnotMarkup::~AnnotMarkup() {
...@@ -1436,7 +1438,7 @@ AnnotMarkup::~AnnotMarkup() { ...@@ -1436,7 +1438,7 @@ AnnotMarkup::~AnnotMarkup() {
delete subject; delete subject;
} }
void AnnotMarkup::initialize(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) { void AnnotMarkup::initialize(PDFDoc *docA, Dict *dict, Object *obj) {
Object obj1; Object obj1;
if (dict->lookup("T", &obj1)->isString()) { if (dict->lookup("T", &obj1)->isString()) {
...@@ -1447,7 +1449,7 @@ void AnnotMarkup::initialize(XRef *xrefA, Dict *dict, Catalog *catalog, Object * ...@@ -1447,7 +1449,7 @@ void AnnotMarkup::initialize(XRef *xrefA, Dict *dict, Catalog *catalog, Object *
obj1.free(); obj1.free();
if (dict->lookup("Popup", &obj1)->isDict()) { if (dict->lookup("Popup", &obj1)->isDict()) {
popup = new AnnotPopup(xrefA, obj1.getDict(), catalog, obj); popup = new AnnotPopup(docA, obj1.getDict(), obj);
} else { } else {
popup = NULL; popup = NULL;
} }
...@@ -1553,30 +1555,30 @@ void AnnotMarkup::setOpacity(double opacityA) { ...@@ -1553,30 +1555,30 @@ void AnnotMarkup::setOpacity(double opacityA) {
// AnnotText // AnnotText
//------------------------------------------------------------------------ //------------------------------------------------------------------------
AnnotText::AnnotText(XRef *xrefA, PDFRectangle *rect, Catalog *catalog) : AnnotText::AnnotText(PDFDoc *docA, PDFRectangle *rect) :
AnnotMarkup(xrefA, rect, catalog) { AnnotMarkup(docA, rect) {
Object obj1; Object obj1;
type = typeText; type = typeText;
flags |= flagNoZoom | flagNoRotate; flags |= flagNoZoom | flagNoRotate;
annotObj.dictSet ("Subtype", obj1.initName ("Text")); annotObj.dictSet ("Subtype", obj1.initName ("Text"));
initialize (xrefA, catalog, annotObj.getDict()); initialize (docA, annotObj.getDict());
} }
AnnotText::AnnotText(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) : AnnotText::AnnotText(PDFDoc *docA, Dict *dict, Object *obj) :
AnnotMarkup(xrefA, dict, catalog, obj) { AnnotMarkup(docA, dict, obj) {
type = typeText; type = typeText;
flags |= flagNoZoom | flagNoRotate; flags |= flagNoZoom | flagNoRotate;
initialize (xrefA, catalog, dict); initialize (docA, dict);
} }
AnnotText::~AnnotText() { AnnotText::~AnnotText() {
delete icon; delete icon;
} }
void AnnotText::initialize(XRef *xrefA, Catalog *catalog, Dict *dict) { void AnnotText::initialize(PDFDoc *docA, Dict *dict) {
Object obj1; Object obj1;
if (dict->lookup("Open", &obj1)->isBool()) if (dict->lookup("Open", &obj1)->isBool())
...@@ -1996,20 +1998,20 @@ void AnnotText::draw(Gfx *gfx, GBool printing) { ...@@ -1996,20 +1998,20 @@ void AnnotText::draw(Gfx *gfx, GBool printing) {
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// AnnotLink // AnnotLink
//------------------------------------------------------------------------ //------------------------------------------------------------------------
AnnotLink::AnnotLink(XRef *xrefA, PDFRectangle *rect, Catalog *catalog) : AnnotLink::AnnotLink(PDFDoc *docA, PDFRectangle *rect) :
Annot(xrefA, rect, catalog) { Annot(docA, rect) {
Object obj1; Object obj1;
type = typeLink; type = typeLink;
annotObj.dictSet ("Subtype", obj1.initName ("Link")); annotObj.dictSet ("Subtype", obj1.initName ("Link"));
initialize (xrefA, catalog, annotObj.getDict()); initialize (docA, annotObj.getDict());
} }
AnnotLink::AnnotLink(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) : AnnotLink::AnnotLink(PDFDoc *docA, Dict *dict, Object *obj) :
Annot(xrefA, dict, catalog, obj) { Annot(docA, dict, obj) {
type = typeLink; type = typeLink;
initialize (xrefA, catalog, dict); initialize (docA, dict);
} }
AnnotLink::~AnnotLink() { AnnotLink::~AnnotLink() {
...@@ -2022,7 +2024,7 @@ AnnotLink::~AnnotLink() { ...@@ -2022,7 +2024,7 @@ AnnotLink::~AnnotLink() {
delete quadrilaterals; delete quadrilaterals;
} }
void AnnotLink::initialize(XRef *xrefA, Catalog *catalog, Dict *dict) { void AnnotLink::initialize(PDFDoc *docA, Dict *dict) {
Object obj1; Object obj1;
action = NULL; action = NULL;
...@@ -2034,7 +2036,7 @@ void AnnotLink::initialize(XRef *xrefA, Catalog *catalog, Dict *dict) { ...@@ -2034,7 +2036,7 @@ void AnnotLink::initialize(XRef *xrefA, Catalog *catalog, Dict *dict) {
} else { } else {
obj1.free(); obj1.free();
if (dict->lookup("A", &obj1)->isDict()) { if (dict->lookup("A", &obj1)->isDict()) {
action = LinkAction::parseAction(&obj1, catalog->getBaseURI()); action = LinkAction::parseAction(&obj1, doc->getCatalog()->getBaseURI());
} }
} }
obj1.free(); obj1.free();
...@@ -2089,8 +2091,8 @@ void AnnotLink::draw(Gfx *gfx, GBool printing) { ...@@ -2089,8 +2091,8 @@ void AnnotLink::draw(Gfx *gfx, GBool printing) {
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// AnnotFreeText // AnnotFreeText
//------------------------------------------------------------------------ //------------------------------------------------------------------------
AnnotFreeText::AnnotFreeText(XRef *xrefA, PDFRectangle *rect, GooString *da, Catalog *catalog) : AnnotFreeText::AnnotFreeText(PDFDoc *docA, PDFRectangle *rect, GooString *da) :
AnnotMarkup(xrefA, rect, catalog) { AnnotMarkup(docA, rect) {
Object obj1; Object obj1;
type = typeFreeText; type = typeFreeText;
...@@ -2101,13 +2103,13 @@ AnnotFreeText::AnnotFreeText(XRef *xrefA, PDFRectangle *rect, GooString *da, Cat ...@@ -2101,13 +2103,13 @@ AnnotFreeText::AnnotFreeText(XRef *xrefA, PDFRectangle *rect, GooString *da, Cat
obj2.initString (da->copy()); obj2.initString (da->copy());
annotObj.dictSet("DA", &obj2); annotObj.dictSet("DA", &obj2);
initialize (xrefA, catalog, annotObj.getDict()); initialize (docA, annotObj.getDict());
} }
AnnotFreeText::AnnotFreeText(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) : AnnotFreeText::AnnotFreeText(PDFDoc *docA, Dict *dict, Object *obj) :
AnnotMarkup(xrefA, dict, catalog, obj) { AnnotMarkup(docA, dict, obj) {
type = typeFreeText; type = typeFreeText;
initialize(xrefA, catalog, dict); initialize(docA, dict);
} }
AnnotFreeText::~AnnotFreeText() { AnnotFreeText::~AnnotFreeText() {
...@@ -2126,7 +2128,7 @@ AnnotFreeText::~AnnotFreeText() { ...@@ -2126,7 +2128,7 @@ AnnotFreeText::~AnnotFreeText() {
delete rectangle; delete rectangle;
} }
void AnnotFreeText::initialize(XRef *xrefA, Catalog *catalog, Dict *dict) { void AnnotFreeText::initialize(PDFDoc *docA, Dict *dict) {
Object obj1; Object obj1;
if (dict->lookup("DA", &obj1)->isString()) { if (dict->lookup("DA", &obj1)->isString()) {
...@@ -2224,28 +2226,28 @@ void AnnotFreeText::initialize(XRef *xrefA, Catalog *catalog, Dict *dict) { ...@@ -2224,28 +2226,28 @@ void AnnotFreeText::initialize(XRef *xrefA, Catalog *catalog, Dict *dict) {
// AnnotLine // AnnotLine
//------------------------------------------------------------------------ //------------------------------------------------------------------------
AnnotLine::AnnotLine(XRef *xrefA, PDFRectangle *rect, PDFRectangle *lRect, Catalog *catalog) : AnnotLine::AnnotLine(PDFDoc *docA, PDFRectangle *rect, PDFRectangle *lRect) :
AnnotMarkup(xrefA, rect, catalog) { AnnotMarkup(docA, rect) {
Object obj1; Object obj1;
type = typeLine; type = typeLine;
annotObj.dictSet ("Subtype", obj1.initName ("Line")); annotObj.dictSet ("Subtype", obj1.initName ("Line"));
Object obj2, obj3; Object obj2, obj3;
obj2.initArray (xrefA); obj2.initArray (doc->getXRef());
obj2.arrayAdd (obj3.initReal (lRect->x1)); obj2.arrayAdd (obj3.initReal (lRect->x1));
obj2.arrayAdd (obj3.initReal (lRect->y1)); obj2.arrayAdd (obj3.initReal (lRect->y1));
obj2.arrayAdd (obj3.initReal (lRect->x2)); obj2.arrayAdd (obj3.initReal (lRect->x2));
obj2.arrayAdd (obj3.initReal (lRect->y2)); obj2.arrayAdd (obj3.initReal (lRect->y2));
annotObj.dictSet ("L", &obj2); annotObj.dictSet ("L", &obj2);
initialize (xrefA, catalog, annotObj.getDict()); initialize (docA, annotObj.getDict());
} }
AnnotLine::AnnotLine(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) : AnnotLine::AnnotLine(PDFDoc *docA, Dict *dict, Object *obj) :
AnnotMarkup(xrefA, dict, catalog, obj) { AnnotMarkup(docA, dict, obj) {
type = typeLine; type = typeLine;
initialize(xrefA, catalog, dict); initialize(docA, dict);
} }
AnnotLine::~AnnotLine() { AnnotLine::~AnnotLine() {
...@@ -2259,7 +2261,7 @@ AnnotLine::~AnnotLine() { ...@@ -2259,7 +2261,7 @@ AnnotLine::~AnnotLine() {
delete measure; delete measure;
} }
void AnnotLine::initialize(XRef *xrefA, Catalog *catalog, Dict *dict) { void AnnotLine::initialize(PDFDoc *docA, Dict *dict) {
Object obj1; Object obj1;
if (dict->lookup("L", &obj1)->isArray() && obj1.arrayGetLength() == 4) { if (dict->lookup("L", &obj1)->isArray() && obj1.arrayGetLength() == 4) {
...@@ -2475,9 +2477,9 @@ void AnnotLine::draw(Gfx *gfx, GBool printing) { ...@@ -2475,9 +2477,9 @@ void AnnotLine::draw(Gfx *gfx, GBool printing) {
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// AnnotTextMarkup // AnnotTextMarkup
//------------------------------------------------------------------------ //------------------------------------------------------------------------
AnnotTextMarkup::AnnotTextMarkup(XRef *xrefA, PDFRectangle *rect, AnnotSubtype subType, AnnotTextMarkup::AnnotTextMarkup(PDFDoc *docA, PDFRectangle *rect, AnnotSubtype subType,
AnnotQuadrilaterals *quadPoints, Catalog *catalog) : AnnotQuadrilaterals *quadPoints) :
AnnotMarkup(xrefA, rect, catalog) { AnnotMarkup(docA, rect) {
Object obj1; Object obj1;
switch (subType) { switch (subType) {
...@@ -2498,7 +2500,7 @@ AnnotTextMarkup::AnnotTextMarkup(XRef *xrefA, PDFRectangle *rect, AnnotSubtype s ...@@ -2498,7 +2500,7 @@ AnnotTextMarkup::AnnotTextMarkup(XRef *xrefA, PDFRectangle *rect, AnnotSubtype s
} }
Object obj2; Object obj2;
obj2.initArray (xrefA); obj2.initArray (doc->getXRef());
for (int i = 0; i < quadPoints->getQuadrilateralsLength(); ++i) { for (int i = 0; i < quadPoints->getQuadrilateralsLength(); ++i) {
Object obj3; Object obj3;
...@@ -2515,17 +2517,17 @@ AnnotTextMarkup::AnnotTextMarkup(XRef *xrefA, PDFRectangle *rect, AnnotSubtype s ...@@ -2515,17 +2517,17 @@ AnnotTextMarkup::AnnotTextMarkup(XRef *xrefA, PDFRectangle *rect, AnnotSubtype s
annotObj.dictSet ("QuadPoints", &obj2); annotObj.dictSet ("QuadPoints", &obj2);
initialize(xrefA, catalog, annotObj.getDict()); initialize(docA, annotObj.getDict());
} }
AnnotTextMarkup::AnnotTextMarkup(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) : AnnotTextMarkup::AnnotTextMarkup(PDFDoc *docA, Dict *dict, Object *obj) :
AnnotMarkup(xrefA, dict, catalog, obj) { AnnotMarkup(docA, dict, obj) {
// the real type will be read in initialize() // the real type will be read in initialize()
type = typeHighlight; type = typeHighlight;
initialize(xrefA, catalog, dict); initialize(docA, dict);
} }
void AnnotTextMarkup::initialize(XRef *xrefA, Catalog *catalog, Dict *dict) { void AnnotTextMarkup::initialize(PDFDoc *docA, Dict *dict) {
Object obj1; Object obj1;
if (dict->lookup("Subtype", &obj1)->isName()) { if (dict->lookup("Subtype", &obj1)->isName()) {
...@@ -2691,18 +2693,18 @@ void AnnotTextMarkup::draw(Gfx *gfx, GBool printing) { ...@@ -2691,18 +2693,18 @@ void AnnotTextMarkup::draw(Gfx *gfx, GBool printing) {
// AnnotWidget // AnnotWidget
//------------------------------------------------------------------------ //------------------------------------------------------------------------
AnnotWidget::AnnotWidget(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) : AnnotWidget::AnnotWidget(PDFDoc *docA, Dict *dict, Object *obj) :
Annot(xrefA, dict, catalog, obj) { Annot(docA, dict, obj) {
type = typeWidget; type = typeWidget;
field = NULL; field = NULL;
initialize(xrefA, catalog, dict); initialize(docA, dict);
} }
AnnotWidget::AnnotWidget(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj, FormField *fieldA) : AnnotWidget::AnnotWidget(PDFDoc *docA, Dict *dict, Object *obj, FormField *fieldA) :
Annot(xrefA, dict, catalog, obj) { Annot(docA, dict, obj) {
type = typeWidget; type = typeWidget;
field = fieldA; field = fieldA;
initialize(xrefA, catalog, dict); initialize(docA, dict);
} }
AnnotWidget::~AnnotWidget() { AnnotWidget::~AnnotWidget() {
...@@ -2719,10 +2721,10 @@ AnnotWidget::~AnnotWidget() { ...@@ -2719,10 +2721,10 @@ AnnotWidget::~AnnotWidget() {
delete parent; delete parent;
} }
void AnnotWidget::initialize(XRef *xrefA, Catalog *catalog, Dict *dict) { void AnnotWidget::initialize(PDFDoc *docA, Dict *dict) {
Object obj1; Object obj1;
form = catalog->getForm(); form = doc->getCatalog()->getForm();
if(dict->lookup("H", &obj1)->isName()) { if(dict->lookup("H", &obj1)->isName()) {
const char *modeName = obj1.getName(); const char *modeName = obj1.getName();
...@@ -2750,7 +2752,7 @@ void AnnotWidget::initialize(XRef *xrefA, Catalog *catalog, Dict *dict) { ...@@ -2750,7 +2752,7 @@ void AnnotWidget::initialize(XRef *xrefA, Catalog *catalog, Dict *dict) {
action = NULL; action = NULL;
if(dict->lookup("A", &obj1)->isDict()) { if(dict->lookup("A", &obj1)->isDict()) {
action = LinkAction::parseAction(&obj1, catalog->getBaseURI()); action = LinkAction::parseAction(&obj1, doc->getCatalog()->getBaseURI());
} }
obj1.free(); obj1.free();
...@@ -3885,8 +3887,8 @@ void AnnotWidget::draw(Gfx *gfx, GBool printing) { ...@@ -3885,8 +3887,8 @@ void AnnotWidget::draw(Gfx *gfx, GBool printing) {
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// AnnotMovie // AnnotMovie
//------------------------------------------------------------------------ //------------------------------------------------------------------------
AnnotMovie::AnnotMovie(XRef *xrefA, PDFRectangle *rect, Movie *movieA, Catalog *catalog) : AnnotMovie::AnnotMovie(PDFDoc *docA, PDFRectangle *rect, Movie *movieA) :
Annot(xrefA, rect, catalog) { Annot(docA, rect) {
Object obj1; Object obj1;
type = typeMovie; type = typeMovie;
...@@ -3895,13 +3897,13 @@ AnnotMovie::AnnotMovie(XRef *xrefA, PDFRectangle *rect, Movie *movieA, Catalog * ...@@ -3895,13 +3897,13 @@ AnnotMovie::AnnotMovie(XRef *xrefA, PDFRectangle *rect, Movie *movieA, Catalog *
movie = movieA->copy(); movie = movieA->copy();
// TODO: create movie dict from movieA // TODO: create movie dict from movieA
initialize(xrefA, catalog, annotObj.getDict()); initialize(docA, annotObj.getDict());
} }
AnnotMovie::AnnotMovie(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) : AnnotMovie::AnnotMovie(PDFDoc *docA, Dict *dict, Object *obj) :
Annot(xrefA, dict, catalog, obj) { Annot(docA, dict, obj) {
type = typeMovie; type = typeMovie;
initialize(xrefA, catalog, dict); initialize(docA, dict);
} }
AnnotMovie::~AnnotMovie() { AnnotMovie::~AnnotMovie() {
...@@ -3910,7 +3912,7 @@ AnnotMovie::~AnnotMovie() { ...@@ -3910,7 +3912,7 @@ AnnotMovie::~AnnotMovie() {
delete movie; delete movie;
} }
void AnnotMovie::initialize(XRef *xrefA, Catalog *catalog, Dict* dict) { void AnnotMovie::initialize(PDFDoc *docA, Dict* dict) {
Object obj1; Object obj1;
if (dict->lookup("T", &obj1)->isString()) { if (dict->lookup("T", &obj1)->isString()) {
...@@ -4036,20 +4038,20 @@ void AnnotMovie::draw(Gfx *gfx, GBool printing) { ...@@ -4036,20 +4038,20 @@ void AnnotMovie::draw(Gfx *gfx, GBool printing) {
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// AnnotScreen // AnnotScreen
//------------------------------------------------------------------------ //------------------------------------------------------------------------
AnnotScreen::AnnotScreen(XRef *xrefA, PDFRectangle *rect, Catalog *catalog) : AnnotScreen::AnnotScreen(PDFDoc *docA, PDFRectangle *rect) :
Annot(xrefA, rect, catalog) { Annot(docA, rect) {
Object obj1; Object obj1