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,
if (annotObj.isDict ()) {
Object tmp;
annot = new AnnotMovie (xref, annotObj.getDict(), document->doc->getCatalog (), &tmp);
annot = new AnnotMovie (document->doc, annotObj.getDict(), &tmp);
if (!annot->isOk ()) {
delete annot;
annot = NULL;
......
......@@ -199,7 +199,7 @@ poppler_annot_text_new (PopplerDocument *doc,
PDFRectangle pdf_rect(rect->x1, rect->y1,
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);
}
......@@ -708,7 +708,7 @@ poppler_annot_markup_set_popup (PopplerAnnotMarkup *poppler_annot,
g_return_if_fail (POPPLER_IS_ANNOT_MARKUP (poppler_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);
}
......
......@@ -47,6 +47,7 @@
#include "Catalog.h"
#include "Gfx.h"
#include "Lexer.h"
#include "PDFDoc.h"
#include "Page.h"
#include "Annot.h"
#include "GfxFont.h"
......@@ -808,14 +809,14 @@ AnnotAppearanceCharacs::~AnnotAppearanceCharacs() {
// Annot
//------------------------------------------------------------------------
Annot::Annot(XRef *xrefA, PDFRectangle *rectA, Catalog *catalog) {
Annot::Annot(PDFDoc *docA, PDFRectangle *rectA) {
Object obj1;
refCnt = 1;
flags = flagUnknown;
type = typeUnknown;
obj1.initArray (xrefA);
obj1.initArray (docA->getXRef());
Object obj2;
obj1.arrayAdd (obj2.initReal (rectA->x1));
obj1.arrayAdd (obj2.initReal (rectA->y1));
......@@ -823,26 +824,26 @@ Annot::Annot(XRef *xrefA, PDFRectangle *rectA, Catalog *catalog) {
obj1.arrayAdd (obj2.initReal (rectA->y2));
obj2.free ();
annotObj.initDict (xrefA);
annotObj.initDict (docA->getXRef());
annotObj.dictSet ("Type", obj2.initName ("Annot"));
annotObj.dictSet ("Rect", &obj1);
// 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;
hasRef = false;
flags = flagUnknown;
type = typeUnknown;
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;
if (obj->isRef()) {
hasRef = gTrue;
......@@ -853,16 +854,17 @@ Annot::Annot(XRef *xrefA, Dict *dict, Catalog* catalog, Object *obj) {
flags = flagUnknown;
type = typeUnknown;
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;
appRef.num = 0;
appRef.gen = 65535;
ok = gTrue;
xref = xrefA;
doc = docA;
xref = doc->getXRef();
appearBuf = NULL;
fontSize = 0;
......@@ -910,7 +912,7 @@ void Annot::initialize(XRef *xrefA, Dict *dict, Catalog *catalog) {
if (dict->lookupNF("P", &obj1)->isRef()) {
Ref ref = obj1.getRef();
page = catalog ? catalog->findPage (ref.num, ref.gen) : -1;
page = doc->getCatalog()->findPage (ref.num, ref.gen);
} else {
page = 0;
}
......@@ -1002,7 +1004,7 @@ void Annot::initialize(XRef *xrefA, Dict *dict, Catalog *catalog) {
}
obj1.free();
optContentConfig = catalog ? catalog->getOptContentConfig() : NULL;
optContentConfig = doc->getCatalog()->getOptContentConfig();
dict->lookupNF("OC", &oc);
if (!oc.isRef() && !oc.isNull()) {
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) {
// AnnotPopup
//------------------------------------------------------------------------
AnnotPopup::AnnotPopup(XRef *xrefA, PDFRectangle *rect, Catalog *catalog) :
Annot(xrefA, rect, catalog) {
AnnotPopup::AnnotPopup(PDFDoc *docA, PDFRectangle *rect) :
Annot(docA, rect) {
Object obj1;
type = typePopup;
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) :
Annot(xrefA, dict, catalog, obj) {
AnnotPopup::AnnotPopup(PDFDoc *docA, Dict *dict, Object *obj) :
Annot(docA, dict, obj) {
type = typePopup;
initialize(xrefA, dict, catalog);
initialize(docA, dict);
}
AnnotPopup::~AnnotPopup() {
parent.free();
}
void AnnotPopup::initialize(XRef *xrefA, Dict *dict, Catalog *catalog) {
void AnnotPopup::initialize(PDFDoc *docA, Dict *dict) {
Object obj1;
if (!dict->lookupNF("Parent", &parent)->isRef()) {
......@@ -1412,14 +1414,14 @@ void AnnotPopup::setOpen(GBool openA) {
//------------------------------------------------------------------------
// AnnotMarkup
//------------------------------------------------------------------------
AnnotMarkup::AnnotMarkup(XRef *xrefA, PDFRectangle *rect, Catalog *catalog) :
Annot(xrefA, rect, catalog) {
initialize(xrefA, annotObj.getDict(), catalog, &annotObj);
AnnotMarkup::AnnotMarkup(PDFDoc *docA, PDFRectangle *rect) :
Annot(docA, rect) {
initialize(docA, annotObj.getDict(), &annotObj);
}
AnnotMarkup::AnnotMarkup(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) :
Annot(xrefA, dict, catalog, obj) {
initialize(xrefA, dict, catalog, obj);
AnnotMarkup::AnnotMarkup(PDFDoc *docA, Dict *dict, Object *obj) :
Annot(docA, dict, obj) {
initialize(docA, dict, obj);
}
AnnotMarkup::~AnnotMarkup() {
......@@ -1436,7 +1438,7 @@ AnnotMarkup::~AnnotMarkup() {
delete subject;
}
void AnnotMarkup::initialize(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) {
void AnnotMarkup::initialize(PDFDoc *docA, Dict *dict, Object *obj) {
Object obj1;
if (dict->lookup("T", &obj1)->isString()) {
......@@ -1447,7 +1449,7 @@ void AnnotMarkup::initialize(XRef *xrefA, Dict *dict, Catalog *catalog, Object *
obj1.free();
if (dict->lookup("Popup", &obj1)->isDict()) {
popup = new AnnotPopup(xrefA, obj1.getDict(), catalog, obj);
popup = new AnnotPopup(docA, obj1.getDict(), obj);
} else {
popup = NULL;
}
......@@ -1553,30 +1555,30 @@ void AnnotMarkup::setOpacity(double opacityA) {
// AnnotText
//------------------------------------------------------------------------
AnnotText::AnnotText(XRef *xrefA, PDFRectangle *rect, Catalog *catalog) :
AnnotMarkup(xrefA, rect, catalog) {
AnnotText::AnnotText(PDFDoc *docA, PDFRectangle *rect) :
AnnotMarkup(docA, rect) {
Object obj1;
type = typeText;
flags |= flagNoZoom | flagNoRotate;
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) :
AnnotMarkup(xrefA, dict, catalog, obj) {
AnnotText::AnnotText(PDFDoc *docA, Dict *dict, Object *obj) :
AnnotMarkup(docA, dict, obj) {
type = typeText;
flags |= flagNoZoom | flagNoRotate;
initialize (xrefA, catalog, dict);
initialize (docA, dict);
}
AnnotText::~AnnotText() {
delete icon;
}
void AnnotText::initialize(XRef *xrefA, Catalog *catalog, Dict *dict) {
void AnnotText::initialize(PDFDoc *docA, Dict *dict) {
Object obj1;
if (dict->lookup("Open", &obj1)->isBool())
......@@ -1996,20 +1998,20 @@ void AnnotText::draw(Gfx *gfx, GBool printing) {
//------------------------------------------------------------------------
// AnnotLink
//------------------------------------------------------------------------
AnnotLink::AnnotLink(XRef *xrefA, PDFRectangle *rect, Catalog *catalog) :
Annot(xrefA, rect, catalog) {
AnnotLink::AnnotLink(PDFDoc *docA, PDFRectangle *rect) :
Annot(docA, rect) {
Object obj1;
type = typeLink;
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) :
Annot(xrefA, dict, catalog, obj) {
AnnotLink::AnnotLink(PDFDoc *docA, Dict *dict, Object *obj) :
Annot(docA, dict, obj) {
type = typeLink;
initialize (xrefA, catalog, dict);
initialize (docA, dict);
}
AnnotLink::~AnnotLink() {
......@@ -2022,7 +2024,7 @@ AnnotLink::~AnnotLink() {
delete quadrilaterals;
}
void AnnotLink::initialize(XRef *xrefA, Catalog *catalog, Dict *dict) {
void AnnotLink::initialize(PDFDoc *docA, Dict *dict) {
Object obj1;
action = NULL;
......@@ -2034,7 +2036,7 @@ void AnnotLink::initialize(XRef *xrefA, Catalog *catalog, Dict *dict) {
} else {
obj1.free();
if (dict->lookup("A", &obj1)->isDict()) {
action = LinkAction::parseAction(&obj1, catalog->getBaseURI());
action = LinkAction::parseAction(&obj1, doc->getCatalog()->getBaseURI());
}
}
obj1.free();
......@@ -2089,8 +2091,8 @@ void AnnotLink::draw(Gfx *gfx, GBool printing) {
//------------------------------------------------------------------------
// AnnotFreeText
//------------------------------------------------------------------------
AnnotFreeText::AnnotFreeText(XRef *xrefA, PDFRectangle *rect, GooString *da, Catalog *catalog) :
AnnotMarkup(xrefA, rect, catalog) {
AnnotFreeText::AnnotFreeText(PDFDoc *docA, PDFRectangle *rect, GooString *da) :
AnnotMarkup(docA, rect) {
Object obj1;
type = typeFreeText;
......@@ -2101,13 +2103,13 @@ AnnotFreeText::AnnotFreeText(XRef *xrefA, PDFRectangle *rect, GooString *da, Cat
obj2.initString (da->copy());
annotObj.dictSet("DA", &obj2);
initialize (xrefA, catalog, annotObj.getDict());
initialize (docA, annotObj.getDict());
}
AnnotFreeText::AnnotFreeText(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) :
AnnotMarkup(xrefA, dict, catalog, obj) {
AnnotFreeText::AnnotFreeText(PDFDoc *docA, Dict *dict, Object *obj) :
AnnotMarkup(docA, dict, obj) {
type = typeFreeText;
initialize(xrefA, catalog, dict);
initialize(docA, dict);
}
AnnotFreeText::~AnnotFreeText() {
......@@ -2126,7 +2128,7 @@ AnnotFreeText::~AnnotFreeText() {
delete rectangle;
}
void AnnotFreeText::initialize(XRef *xrefA, Catalog *catalog, Dict *dict) {
void AnnotFreeText::initialize(PDFDoc *docA, Dict *dict) {
Object obj1;
if (dict->lookup("DA", &obj1)->isString()) {
......@@ -2224,28 +2226,28 @@ void AnnotFreeText::initialize(XRef *xrefA, Catalog *catalog, Dict *dict) {
// AnnotLine
//------------------------------------------------------------------------
AnnotLine::AnnotLine(XRef *xrefA, PDFRectangle *rect, PDFRectangle *lRect, Catalog *catalog) :
AnnotMarkup(xrefA, rect, catalog) {
AnnotLine::AnnotLine(PDFDoc *docA, PDFRectangle *rect, PDFRectangle *lRect) :
AnnotMarkup(docA, rect) {
Object obj1;
type = typeLine;
annotObj.dictSet ("Subtype", obj1.initName ("Line"));
Object obj2, obj3;
obj2.initArray (xrefA);
obj2.initArray (doc->getXRef());
obj2.arrayAdd (obj3.initReal (lRect->x1));
obj2.arrayAdd (obj3.initReal (lRect->y1));
obj2.arrayAdd (obj3.initReal (lRect->x2));
obj2.arrayAdd (obj3.initReal (lRect->y2));
annotObj.dictSet ("L", &obj2);
initialize (xrefA, catalog, annotObj.getDict());
initialize (docA, annotObj.getDict());
}
AnnotLine::AnnotLine(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) :
AnnotMarkup(xrefA, dict, catalog, obj) {
AnnotLine::AnnotLine(PDFDoc *docA, Dict *dict, Object *obj) :
AnnotMarkup(docA, dict, obj) {
type = typeLine;
initialize(xrefA, catalog, dict);
initialize(docA, dict);
}
AnnotLine::~AnnotLine() {
......@@ -2259,7 +2261,7 @@ AnnotLine::~AnnotLine() {
delete measure;
}
void AnnotLine::initialize(XRef *xrefA, Catalog *catalog, Dict *dict) {
void AnnotLine::initialize(PDFDoc *docA, Dict *dict) {
Object obj1;
if (dict->lookup("L", &obj1)->isArray() && obj1.arrayGetLength() == 4) {
......@@ -2475,9 +2477,9 @@ void AnnotLine::draw(Gfx *gfx, GBool printing) {
//------------------------------------------------------------------------
// AnnotTextMarkup
//------------------------------------------------------------------------
AnnotTextMarkup::AnnotTextMarkup(XRef *xrefA, PDFRectangle *rect, AnnotSubtype subType,
AnnotQuadrilaterals *quadPoints, Catalog *catalog) :
AnnotMarkup(xrefA, rect, catalog) {
AnnotTextMarkup::AnnotTextMarkup(PDFDoc *docA, PDFRectangle *rect, AnnotSubtype subType,
AnnotQuadrilaterals *quadPoints) :
AnnotMarkup(docA, rect) {
Object obj1;
switch (subType) {
......@@ -2498,7 +2500,7 @@ AnnotTextMarkup::AnnotTextMarkup(XRef *xrefA, PDFRectangle *rect, AnnotSubtype s
}
Object obj2;
obj2.initArray (xrefA);
obj2.initArray (doc->getXRef());
for (int i = 0; i < quadPoints->getQuadrilateralsLength(); ++i) {
Object obj3;
......@@ -2515,17 +2517,17 @@ AnnotTextMarkup::AnnotTextMarkup(XRef *xrefA, PDFRectangle *rect, AnnotSubtype s
annotObj.dictSet ("QuadPoints", &obj2);
initialize(xrefA, catalog, annotObj.getDict());
initialize(docA, annotObj.getDict());
}
AnnotTextMarkup::AnnotTextMarkup(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) :
AnnotMarkup(xrefA, dict, catalog, obj) {
AnnotTextMarkup::AnnotTextMarkup(PDFDoc *docA, Dict *dict, Object *obj) :
AnnotMarkup(docA, dict, obj) {
// the real type will be read in initialize()
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;
if (dict->lookup("Subtype", &obj1)->isName()) {
......@@ -2691,18 +2693,18 @@ void AnnotTextMarkup::draw(Gfx *gfx, GBool printing) {
// AnnotWidget
//------------------------------------------------------------------------
AnnotWidget::AnnotWidget(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) :
Annot(xrefA, dict, catalog, obj) {
AnnotWidget::AnnotWidget(PDFDoc *docA, Dict *dict, Object *obj) :
Annot(docA, dict, obj) {
type = typeWidget;
field = NULL;
initialize(xrefA, catalog, dict);
initialize(docA, dict);
}
AnnotWidget::AnnotWidget(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj, FormField *fieldA) :
Annot(xrefA, dict, catalog, obj) {
AnnotWidget::AnnotWidget(PDFDoc *docA, Dict *dict, Object *obj, FormField *fieldA) :
Annot(docA, dict, obj) {
type = typeWidget;
field = fieldA;
initialize(xrefA, catalog, dict);
initialize(docA, dict);
}
AnnotWidget::~AnnotWidget() {
......@@ -2719,10 +2721,10 @@ AnnotWidget::~AnnotWidget() {
delete parent;
}
void AnnotWidget::initialize(XRef *xrefA, Catalog *catalog, Dict *dict) {
void AnnotWidget::initialize(PDFDoc *docA, Dict *dict) {
Object obj1;
form = catalog->getForm();
form = doc->getCatalog()->getForm();
if(dict->lookup("H", &obj1)->isName()) {
const char *modeName = obj1.getName();
......@@ -2750,7 +2752,7 @@ void AnnotWidget::initialize(XRef *xrefA, Catalog *catalog, Dict *dict) {
action = NULL;
if(dict->lookup("A", &obj1)->isDict()) {
action = LinkAction::parseAction(&obj1, catalog->getBaseURI());
action = LinkAction::parseAction(&obj1, doc->getCatalog()->getBaseURI());
}
obj1.free();
......@@ -3885,8 +3887,8 @@ void AnnotWidget::draw(Gfx *gfx, GBool printing) {
//------------------------------------------------------------------------
// AnnotMovie
//------------------------------------------------------------------------
AnnotMovie::AnnotMovie(XRef *xrefA, PDFRectangle *rect, Movie *movieA, Catalog *catalog) :
Annot(xrefA, rect, catalog) {
AnnotMovie::AnnotMovie(PDFDoc *docA, PDFRectangle *rect, Movie *movieA) :
Annot(docA, rect) {
Object obj1;
type = typeMovie;
......@@ -3895,13 +3897,13 @@ AnnotMovie::AnnotMovie(XRef *xrefA, PDFRectangle *rect, Movie *movieA, Catalog *
movie = movieA->copy();
// 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) :
Annot(xrefA, dict, catalog, obj) {
AnnotMovie::AnnotMovie(PDFDoc *docA, Dict *dict, Object *obj) :
Annot(docA, dict, obj) {
type = typeMovie;
initialize(xrefA, catalog, dict);
initialize(docA, dict);
}
AnnotMovie::~AnnotMovie() {
......@@ -3910,7 +3912,7 @@ AnnotMovie::~AnnotMovie() {
delete movie;
}
void AnnotMovie::initialize(XRef *xrefA, Catalog *catalog, Dict* dict) {
void AnnotMovie::initialize(PDFDoc *docA, Dict* dict) {
Object obj1;
if (dict->lookup("T", &obj1)->isString()) {
......@@ -4036,20 +4038,20 @@ void AnnotMovie::draw(Gfx *gfx, GBool printing) {
//------------------------------------------------------------------------
// AnnotScreen
//------------------------------------------------------------------------
AnnotScreen::AnnotScreen(XRef *xrefA, PDFRectangle *rect, Catalog *catalog) :
Annot(xrefA, rect, catalog) {
AnnotScreen::AnnotScreen(PDFDoc *docA, PDFRectangle *rect) :
Annot(docA, rect) {
Object obj1;
type = typeScreen;
annotObj.dictSet ("Subtype", obj1.initName ("Screen"));
initialize(xrefA, catalog, annotObj.getDict());
initialize(docA, annotObj.getDict());
}
AnnotScreen::AnnotScreen(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) :
Annot(xrefA, dict, catalog, obj) {
AnnotScreen::AnnotScreen(PDFDoc *docA, Dict *dict, Object *obj) :
Annot(docA, dict, obj) {
type = typeScreen;
initialize(xrefA, catalog, dict);
initialize(docA, dict);
}
AnnotScreen::~AnnotScreen() {
......@@ -4063,7 +4065,7 @@ AnnotScreen::~AnnotScreen() {
additionAction.free();
}
void AnnotScreen::initialize(XRef *xrefA, Catalog *catalog, Dict* dict) {
void AnnotScreen::initialize(PDFDoc *docA, Dict* dict) {
Object obj1;
title = NULL;
......@@ -4074,7 +4076,7 @@ void AnnotScreen::initialize(XRef *xrefA, Catalog *catalog, Dict* dict) {
action = NULL;
if (dict->lookup("A", &obj1)->isDict()) {
action = LinkAction::parseAction(&obj1, catalog->getBaseURI());
action = LinkAction::parseAction(&obj1, doc->getCatalog()->getBaseURI());
if (action->getKind() == actionRendition && page == 0) {
error (errSyntaxError, -1, "Invalid Rendition action: associated screen annotation without P");
delete action;
......@@ -4097,26 +4099,26 @@ void AnnotScreen::initialize(XRef *xrefA, Catalog *catalog, Dict* dict) {
//------------------------------------------------------------------------
// AnnotStamp
//------------------------------------------------------------------------
AnnotStamp::AnnotStamp(XRef *xrefA, PDFRectangle *rect, Catalog *catalog) :
AnnotMarkup(xrefA, rect, catalog) {
AnnotStamp::AnnotStamp(PDFDoc *docA, PDFRectangle *rect) :
AnnotMarkup(docA, rect) {
Object obj1;
type = typeStamp;
annotObj.dictSet ("Subtype", obj1.initName ("Stamp"));
initialize(xrefA, catalog, annotObj.getDict());
initialize(docA, annotObj.getDict());
}
AnnotStamp::AnnotStamp(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) :
AnnotMarkup(xrefA, dict, catalog, obj) {
AnnotStamp::AnnotStamp(PDFDoc *docA, Dict *dict, Object *obj) :
AnnotMarkup(docA, dict, obj) {
type = typeStamp;
initialize(xrefA, catalog, dict);
initialize(docA, dict);
}
AnnotStamp::~AnnotStamp() {
delete icon;
}
void AnnotStamp::initialize(XRef *xrefA, Catalog *catalog, Dict* dict) {
void AnnotStamp::initialize(PDFDoc *docA, Dict* dict) {
Object obj1;
if (dict->lookup("Name", &obj1)->isName()) {
......@@ -4131,8 +4133,8 @@ void AnnotStamp::initialize(XRef *xrefA, Catalog *catalog, Dict* dict) {
//------------------------------------------------------------------------
// AnnotGeometry
//------------------------------------------------------------------------
AnnotGeometry::AnnotGeometry(XRef *xrefA, PDFRectangle *rect, AnnotSubtype subType, Catalog *catalog) :
AnnotMarkup(xrefA, rect, catalog) {
AnnotGeometry::AnnotGeometry(PDFDoc *docA, PDFRectangle *rect, AnnotSubtype subType) :
AnnotMarkup(docA, rect) {
Object obj1;
switch (subType) {
......@@ -4146,14 +4148,14 @@ AnnotGeometry::AnnotGeometry(XRef *xrefA, PDFRectangle *rect, AnnotSubtype subTy
assert (0 && "Invalid subtype for AnnotGeometry\n");
}
initialize(xrefA, catalog, annotObj.getDict());
initialize(docA, annotObj.getDict());
}
AnnotGeometry::AnnotGeometry(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) :
AnnotMarkup(xrefA, dict, catalog, obj) {
AnnotGeometry::AnnotGeometry(PDFDoc *docA, Dict *dict, Object *obj) :
AnnotMarkup(docA, dict, obj) {
// the real type will be read in initialize()
type = typeSquare;
initialize(xrefA, catalog, dict);
initialize(docA, dict);
}
AnnotGeometry::~AnnotGeometry() {
......@@ -4162,7 +4164,7 @@ AnnotGeometry::~AnnotGeometry() {
delete geometryRect;
}
void AnnotGeometry::initialize(XRef *xrefA, Catalog *catalog, Dict* dict) {
void AnnotGeometry::initialize(PDFDoc *docA, Dict* dict) {
Object obj1;
if (dict->lookup("Subtype", &obj1)->isName()) {
......@@ -4326,9 +4328,8 @@ void AnnotGeometry::draw(Gfx *gfx, GBool printing) {
//------------------------------------------------------------------------
// AnnotPolygon
//------------------------------------------------------------------------
AnnotPolygon::AnnotPolygon(XRef *xrefA, PDFRectangle *rect, AnnotSubtype subType,
AnnotPath *path, Catalog *catalog) :
AnnotMarkup(xrefA, rect, catalog) {
AnnotPolygon::AnnotPolygon(PDFDoc *docA, PDFRectangle *rect, AnnotSubtype subType, AnnotPath *path) :
AnnotMarkup(docA, rect) {
Object obj1;
switch (subType) {
......@@ -4343,7 +4344,7 @@ AnnotPolygon::AnnotPolygon(XRef *xrefA, PDFRectangle *rect, AnnotSubtype subType
}
Object obj2;
obj2.initArray (xrefA);
obj2.initArray (doc->getXRef());
for (int i = 0; i < path->getCoordsLength(); ++i) {
Object obj3;
......@@ -4354,14 +4355,14 @@ AnnotPolygon::AnnotPolygon(XRef *xrefA, PDFRectangle *rect, AnnotSubtype subType
annotObj.dictSet ("Vertices", &obj2);
initialize(xrefA, catalog, annotObj.getDict());
initialize(docA, annotObj.getDict());
}
AnnotPolygon::AnnotPolygon(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) :
AnnotMarkup(xrefA, dict, catalog, obj) {
AnnotPolygon::AnnotPolygon(PDFDoc *docA, Dict *dict, Object *obj) :
AnnotMarkup(docA, dict, obj) {
// the real type will be read in initialize()
type = typePolygon;
initialize(xrefA, catalog, dict);
initialize(docA, dict);
}
AnnotPolygon::~AnnotPolygon() {
......@@ -4374,7 +4375,7 @@ AnnotPolygon::~AnnotPolygon() {
delete borderEffect;
}
void AnnotPolygon::initialize(XRef *xrefA, Catalog *catalog, Dict* dict) {
void AnnotPolygon::initialize(PDFDoc *docA, Dict* dict) {
Object obj1;
if (dict->lookup("Subtype", &obj1)->isName()) {
......@@ -4449,27 +4450,27 @@ void AnnotPolygon::initialize(XRef *xrefA, Catalog *catalog, Dict* dict) {
//------------------------------------------------------------------------
// AnnotCaret
//------------------------------------------------------------------------
AnnotCaret::AnnotCaret(XRef *xrefA, PDFRectangle *rect, Catalog *catalog) :
AnnotMarkup(xrefA, rect, catalog) {
AnnotCaret::AnnotCaret(PDFDoc *docA, PDFRectangle *rect) :
AnnotMarkup(docA, rect) {
Object obj1;
type = typeCaret;
annotObj.dictSet ("Subtype", obj1.initName ("Caret"));
initialize(xrefA, catalog, annotObj.getDict());
initialize(docA, annotObj.getDict());
}
AnnotCaret::AnnotCaret(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) :
AnnotMarkup(xrefA, dict, catalog, obj) {
AnnotCaret::AnnotCaret(PDFDoc *docA, Dict *dict, Object *obj) :
AnnotMarkup(docA, dict, obj) {
type = typeCaret;
initialize(xrefA, catalog, dict);
initialize(docA, dict);
}
AnnotCaret::~AnnotCaret() {
delete caretRect;
}
void AnnotCaret::initialize(XRef *xrefA, Catalog *catalog, Dict* dict) {
void AnnotCaret::initialize(PDFDoc *docA, Dict* dict) {
Object obj1;
symbol = symbolNone;
......@@ -4495,8 +4496,8 @@ void AnnotCaret::initialize(XRef *xrefA, Catalog *catalog, Dict* dict) {
//------------------------------------------------------------------------
// AnnotInk
//------------------------------------------------------------------------
AnnotInk::AnnotInk(XRef *xrefA, PDFRectangle *rect, AnnotPath **paths, int n_paths, Catalog *catalog) :
AnnotMarkup(xrefA, rect, catalog) {
AnnotInk::AnnotInk(PDFDoc *docA, PDFRectangle *rect, AnnotPath **paths, int n_paths) :
AnnotMarkup(docA, rect) {
Object obj1;
type = typeInk;
......@@ -4504,12 +4505,12 @@ AnnotInk::AnnotInk(XRef *xrefA, PDFRectangle *rect, AnnotPath **paths, int n_pat