Commit 38ebe8c5 authored by Albert Astals Cid's avatar Albert Astals Cid

xpdf303: Page functions do not need Catalog * anymore

parent 7d794f64
......@@ -2514,7 +2514,7 @@ poppler_document_get_form_field (PopplerDocument *document,
if (!page)
return NULL;
widgets = page->getFormWidgets (document->doc->getCatalog ());
widgets = page->getFormWidgets ();
if (!widgets)
return NULL;
......
......@@ -270,7 +270,6 @@ poppler_page_get_text_page (PopplerPage *page)
gTrue, /* Crop */
-1, -1, -1, -1,
gFalse, /* printing */
page->document->doc->getCatalog (),
NULL, NULL, NULL, NULL);
page->page->display(gfx);
text_dev->endPage();
......@@ -354,7 +353,6 @@ _poppler_page_render (PopplerPage *page,
-1, -1,
-1, -1,
printing,
page->document->doc->getCatalog (),
NULL, NULL,
printing ? poppler_print_annot_cb : NULL,
printing ? GINT_TO_POINTER ((gint)print_flags) : NULL);
......@@ -926,7 +924,6 @@ poppler_page_get_image_output_dev (PopplerPage *page,
gTrue, /* Crop */
-1, -1, -1, -1,
gFalse, /* printing */
page->document->doc->getCatalog (),
NULL, NULL, NULL, NULL);
page->page->display(gfx);
delete gfx;
......@@ -1139,7 +1136,7 @@ poppler_page_get_link_mapping (PopplerPage *page)
g_return_val_if_fail (POPPLER_IS_PAGE (page), NULL);
links = new Links (page->page->getAnnots (page->document->doc->getCatalog ()));
links = new Links (page->page->getAnnots ());
if (links == NULL)
return NULL;
......@@ -1243,7 +1240,7 @@ poppler_page_get_form_field_mapping (PopplerPage *page)
g_return_val_if_fail (POPPLER_IS_PAGE (page), NULL);
forms = page->page->getFormWidgets (page->document->doc->getCatalog ());
forms = page->page->getFormWidgets ();
if (forms == NULL)
return NULL;
......@@ -1310,7 +1307,7 @@ poppler_page_get_annot_mapping (PopplerPage *page)
g_return_val_if_fail (POPPLER_IS_PAGE (page), NULL);
annots = page->page->getAnnots (page->document->doc->getCatalog ());
annots = page->page->getAnnots ();
if (!annots)
return NULL;
......@@ -1427,7 +1424,7 @@ poppler_page_add_annot (PopplerPage *page,
g_return_if_fail (POPPLER_IS_PAGE (page));
g_return_if_fail (POPPLER_IS_ANNOT (annot));
page->page->addAnnot (annot->annot, page->document->doc->getCatalog ());
page->page->addAnnot (annot->annot);
}
/* PopplerRectangle type */
......
......@@ -74,7 +74,7 @@ GooList *FontInfoScanner::scan(int nPages) {
if ((resDict = page->getResourceDict())) {
scanFonts(resDict, result);
}
annots = page->getAnnots(doc->getCatalog());
annots = page->getAnnots();
for (int i = 0; i < annots->getNumAnnots(); ++i) {
if (annots->getAnnot(i)->getAppearance(&obj1)->isStream()) {
obj1.streamGetDict()->lookup("Resources", &obj2);
......
......@@ -128,7 +128,7 @@ public:
virtual GBool checkPageSlice(Page *page, double hDPI, double vDPI,
int rotate, GBool useMediaBox, GBool crop,
int sliceX, int sliceY, int sliceW, int sliceH,
GBool printing, Catalog * catalog,
GBool printing,
GBool (* abortCheckCbk)(void *data) = NULL,
void * abortCheckCbkData = NULL)
{ return gTrue; }
......@@ -305,7 +305,7 @@ public:
virtual void clearSoftMask(GfxState * /*state*/) {}
//----- links
virtual void processLink(AnnotLink * /*link*/, Catalog * /*catalog*/) {}
virtual void processLink(AnnotLink * /*link*/) {}
#if 1 //~tmp: turn off anti-aliasing temporarily
virtual GBool getVectorAntialias() { return gFalse; }
......
......@@ -431,7 +431,7 @@ void PDFDoc::displayPage(OutputDev *out, int page,
if (getPage(page))
getPage(page)->display(out, hDPI, vDPI,
rotate, useMediaBox, crop, printing, catalog,
rotate, useMediaBox, crop, printing,
abortCheckCbk, abortCheckCbkData,
annotDisplayDecideCbk, annotDisplayDecideCbkData);
......@@ -465,7 +465,7 @@ void PDFDoc::displayPageSlice(OutputDev *out, int page,
getPage(page)->displaySlice(out, hDPI, vDPI,
rotate, useMediaBox, crop,
sliceX, sliceY, sliceW, sliceH,
printing, catalog,
printing,
abortCheckCbk, abortCheckCbkData,
annotDisplayDecideCbk, annotDisplayDecideCbkData);
}
......@@ -475,12 +475,12 @@ Links *PDFDoc::getLinks(int page) {
if (!p) {
return new Links (NULL);
}
return p->getLinks(catalog);
return p->getLinks();
}
void PDFDoc::processLinks(OutputDev *out, int page) {
if (getPage(page))
getPage(page)->processLinks(out, catalog);
getPage(page)->processLinks(out);
}
Linearization *PDFDoc::getLinearization()
......
......@@ -2980,7 +2980,7 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
int rotateA, GBool useMediaBox, GBool crop,
int sliceX, int sliceY,
int sliceW, int sliceH,
GBool printing, Catalog *catalog,
GBool printing,
GBool (*abortCheckCbk)(void *data),
void *abortCheckCbkData) {
#if HAVE_SPLASH
......@@ -3008,7 +3008,7 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
scan = new PreScanOutputDev(doc);
page->displaySlice(scan, 72, 72, rotateA, useMediaBox, crop,
sliceX, sliceY, sliceW, sliceH,
printing, catalog, abortCheckCbk, abortCheckCbkData);
printing, abortCheckCbk, abortCheckCbkData);
rasterize = scan->usesTransparency() || scan->hasLevel1PSBug();
delete scan;
} else {
......@@ -3046,7 +3046,7 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
page->displaySlice(splashOut, splashDPI, splashDPI, rotateA,
useMediaBox, crop,
sliceX, sliceY, sliceW, sliceH,
printing, catalog, abortCheckCbk, abortCheckCbkData);
printing, abortCheckCbk, abortCheckCbkData);
// start the PS page
page->makeBox(splashDPI, splashDPI, rotateA, useMediaBox, gFalse,
......
......@@ -163,7 +163,7 @@ public:
virtual GBool checkPageSlice(Page *page, double hDPI, double vDPI,
int rotate, GBool useMediaBox, GBool crop,
int sliceX, int sliceY, int sliceW, int sliceH,
GBool printing, Catalog *catalog,
GBool printing,
GBool (*abortCheckCbk)(void *data) = NULL,
void *abortCheckCbkData = NULL);
......
......@@ -346,17 +346,17 @@ Page::~Page() {
actions.free();
}
Annots *Page::getAnnots(Catalog *catalog) {
Annots *Page::getAnnots() {
if (!annots) {
Object obj;
annots = new Annots(xref, catalog, getAnnots(&obj));
annots = new Annots(xref, doc->getCatalog(), getAnnots(&obj));
obj.free();
}
return annots;
}
void Page::addAnnot(Annot *annot, Catalog *catalog) {
void Page::addAnnot(Annot *annot) {
Object obj1;
Object tmp;
Ref annotRef = annot->getRef ();
......@@ -364,7 +364,7 @@ void Page::addAnnot(Annot *annot, Catalog *catalog) {
// Make sure we have annots before adding the new one
// even if it's an empty list so that we can safely
// call annots->appendAnnot(annot)
getAnnots(catalog);
getAnnots();
if (annotsObj.isNull()) {
Ref annotsRef;
......@@ -396,22 +396,22 @@ void Page::addAnnot(Annot *annot, Catalog *catalog) {
annot->setPage(&pageRef, num);
}
Links *Page::getLinks(Catalog *catalog) {
return new Links(getAnnots(catalog));
Links *Page::getLinks() {
return new Links(getAnnots());
}
FormPageWidgets *Page::getFormWidgets(Catalog *catalog) {
return new FormPageWidgets(getAnnots(catalog), num, catalog->getForm());
FormPageWidgets *Page::getFormWidgets() {
return new FormPageWidgets(getAnnots(), num, doc->getCatalog()->getForm());
}
void Page::display(OutputDev *out, double hDPI, double vDPI,
int rotate, GBool useMediaBox, GBool crop,
GBool printing, Catalog *catalog,
GBool printing,
GBool (*abortCheckCbk)(void *data),
void *abortCheckCbkData,
GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data),
void *annotDisplayDecideCbkData) {
displaySlice(out, hDPI, vDPI, rotate, useMediaBox, crop, -1, -1, -1, -1, printing, catalog,
displaySlice(out, hDPI, vDPI, rotate, useMediaBox, crop, -1, -1, -1, -1, printing,
abortCheckCbk, abortCheckCbkData,
annotDisplayDecideCbk, annotDisplayDecideCbkData);
}
......@@ -419,7 +419,7 @@ void Page::display(OutputDev *out, double hDPI, double vDPI,
Gfx *Page::createGfx(OutputDev *out, double hDPI, double vDPI,
int rotate, GBool useMediaBox, GBool crop,
int sliceX, int sliceY, int sliceW, int sliceH,
GBool printing, Catalog *catalog,
GBool printing,
GBool (*abortCheckCbk)(void *data),
void *abortCheckCbkData,
GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data),
......@@ -458,7 +458,7 @@ Gfx *Page::createGfx(OutputDev *out, double hDPI, double vDPI,
void Page::displaySlice(OutputDev *out, double hDPI, double vDPI,
int rotate, GBool useMediaBox, GBool crop,
int sliceX, int sliceY, int sliceW, int sliceH,
GBool printing, Catalog *catalog,
GBool printing,
GBool (*abortCheckCbk)(void *data),
void *abortCheckCbkData,
GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data),
......@@ -470,14 +470,14 @@ void Page::displaySlice(OutputDev *out, double hDPI, double vDPI,
if (!out->checkPageSlice(this, hDPI, vDPI, rotate, useMediaBox, crop,
sliceX, sliceY, sliceW, sliceH,
printing, catalog,
printing,
abortCheckCbk, abortCheckCbkData)) {
return;
}
gfx = createGfx(out, hDPI, vDPI, rotate, useMediaBox, crop,
sliceX, sliceY, sliceW, sliceH,
printing, catalog,
printing,
abortCheckCbk, abortCheckCbkData,
annotDisplayDecideCbk, annotDisplayDecideCbkData);
......@@ -490,7 +490,7 @@ void Page::displaySlice(OutputDev *out, double hDPI, double vDPI,
obj.free();
// draw annotations
annotList = getAnnots(catalog);
annotList = getAnnots();
if (annotList->getNumAnnots() > 0) {
if (globalParams->getPrintCommands()) {
......@@ -688,13 +688,13 @@ void Page::makeBox(double hDPI, double vDPI, int rotate,
}
}
void Page::processLinks(OutputDev *out, Catalog *catalog) {
void Page::processLinks(OutputDev *out) {
Links *links;
int i;
links = getLinks(catalog);
links = getLinks();
for (i = 0; i < links->getNumLinks(); ++i) {
out->processLink(links->getLink(i), catalog);
out->processLink(links->getLink(i));
}
delete links;
}
......
......@@ -166,13 +166,13 @@ public:
// Get annotations array.
Object *getAnnots(Object *obj) { return annotsObj.fetch(xref, obj); }
// Add a new annotation to the page
void addAnnot(Annot *annot, Catalog *catalog);
void addAnnot(Annot *annot);
// Return a list of links.
Links *getLinks(Catalog *catalog);
Links *getLinks();
// Return a list of annots. Ownership is transferred to the caller.
Annots *getAnnots(Catalog *catalog);
Annots *getAnnots();
// Get contents.
Object *getContents(Object *obj) { return contents.fetch(xref, obj); }
......@@ -185,7 +185,7 @@ public:
Object *getTrans(Object *obj) { return trans.fetch(xref, obj); }
// Get form.
FormPageWidgets *getFormWidgets(Catalog *catalog);
FormPageWidgets *getFormWidgets();
// Get duration, the maximum length of time, in seconds,
// that the page is displayed before the presentation automatically
......@@ -198,7 +198,7 @@ public:
Gfx *createGfx(OutputDev *out, double hDPI, double vDPI,
int rotate, GBool useMediaBox, GBool crop,
int sliceX, int sliceY, int sliceW, int sliceH,
GBool printing, Catalog *catalog,
GBool printing,
GBool (*abortCheckCbk)(void *data),
void *abortCheckCbkData,
GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data),
......@@ -207,7 +207,7 @@ public:
// Display a page.
void display(OutputDev *out, double hDPI, double vDPI,
int rotate, GBool useMediaBox, GBool crop,
GBool printing, Catalog *catalog,
GBool printing,
GBool (*abortCheckCbk)(void *data) = NULL,
void *abortCheckCbkData = NULL,
GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = NULL,
......@@ -217,7 +217,7 @@ public:
void displaySlice(OutputDev *out, double hDPI, double vDPI,
int rotate, GBool useMediaBox, GBool crop,
int sliceX, int sliceY, int sliceW, int sliceH,
GBool printing, Catalog *catalog,
GBool printing,
GBool (*abortCheckCbk)(void *data) = NULL,
void *abortCheckCbkData = NULL,
GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = NULL,
......@@ -230,7 +230,7 @@ public:
double sliceX, double sliceY, double sliceW, double sliceH,
PDFRectangle *box, GBool *crop);
void processLinks(OutputDev *out, Catalog *catalog);
void processLinks(OutputDev *out);
// Get the page's default CTM.
void getDefaultCTM(double *ctm, double hDPI, double vDPI,
......
......@@ -5351,7 +5351,7 @@ void TextOutputDev::eoFill(GfxState *state) {
fill(state);
}
void TextOutputDev::processLink(AnnotLink *link, Catalog * /*catalog*/) {
void TextOutputDev::processLink(AnnotLink *link) {
double x1, y1, x2, y2;
int xMin, yMin, xMax, yMax, x, y;
......
......@@ -731,7 +731,7 @@ public:
virtual void eoFill(GfxState *state);
//----- link borders
virtual void processLink(AnnotLink *link, Catalog *catalog);
virtual void processLink(AnnotLink *link);
//----- special access
......
......@@ -40,7 +40,7 @@ class LinkExtractorOutputDev : public OutputDev
virtual GBool upsideDown() { return gFalse; }
virtual GBool useDrawChar() { return gFalse; }
virtual GBool interpretType3Chars() { return gFalse; }
virtual void processLink(::AnnotLink *link, Catalog *catalog);
virtual void processLink(::AnnotLink *link);
// our stuff
QList< Link* > links();
......
......@@ -49,7 +49,7 @@ LinkExtractorOutputDev::~LinkExtractorOutputDev()
qDeleteAll(m_links);
}
void LinkExtractorOutputDev::processLink(::AnnotLink *link, Catalog *catalog)
void LinkExtractorOutputDev::processLink(::AnnotLink *link)
{
if (!link->isOk())
return;
......@@ -71,7 +71,7 @@ void LinkExtractorOutputDev::processLink(::AnnotLink *link, Catalog *catalog)
{
m_links.append(popplerLink);
}
OutputDev::processLink(link, catalog);
OutputDev::processLink(link);
}
QList< Link* > LinkExtractorOutputDev::links()
......
......@@ -555,7 +555,7 @@ QList<Link*> Page::links() const
QList<Annotation*> Page::annotations() const
{
::Page *pdfPage = m_page->page;
Annots* annots = pdfPage->getAnnots(m_page->parentDoc->doc->getCatalog());
Annots* annots = pdfPage->getAnnots();
const uint numAnnotations = annots->getNumAnnots();
if ( numAnnotations == 0 )
{
......@@ -1309,7 +1309,7 @@ QList<FormField*> Page::formFields() const
{
QList<FormField*> fields;
::Page *p = m_page->page;
::FormPageWidgets * form = p->getFormWidgets(m_page->parentDoc->doc->getCatalog());
::FormPageWidgets * form = p->getFormWidgets();
int formcount = form->getNumWidgets();
for (int i = 0; i < formcount; ++i)
{
......
......@@ -1009,13 +1009,14 @@ void HtmlOutputDev::doFrame(int firstPage){
fclose(fContentsFrame);
}
HtmlOutputDev::HtmlOutputDev(char *fileName, char *title,
HtmlOutputDev::HtmlOutputDev(Catalog *catalogA, char *fileName, char *title,
char *author, char *keywords, char *subject, char *date,
char *extension,
GBool rawOrder, int firstPage, GBool outline)
{
const char *htmlEncoding;
catalog = catalogA;
fContentsFrame = NULL;
docTitle = new GooString(title);
pages = NULL;
......@@ -1191,7 +1192,7 @@ void HtmlOutputDev::startPage(int pageNum, GfxState *state) {
void HtmlOutputDev::endPage() {
Links *linksList = docPage->getLinks(catalog);
Links *linksList = docPage->getLinks();
for (int i = 0; i < linksList->getNumLinks(); ++i)
{
doProcessLink(linksList->getLink(i));
......@@ -1416,13 +1417,13 @@ void HtmlOutputDev::doProcessLink(AnnotLink* link){
cvtUserToDev(_x2,_y2,&x2,&y2);
GooString* _dest=getLinkDest(link,catalog);
GooString* _dest=getLinkDest(link);
HtmlLink t((double) x1,(double) y2,(double) x2,(double) y1,_dest);
pages->AddLink(t);
delete _dest;
}
GooString* HtmlOutputDev::getLinkDest(AnnotLink *link,Catalog* catalog){
GooString* HtmlOutputDev::getLinkDest(AnnotLink *link){
char *p;
if (!link->getAction())
return new GooString();
......
......@@ -220,7 +220,7 @@ public:
// 8-bit ISO Latin-1. <useASCII7> should also be set for Japanese
// (EUC-JP) text. If <rawOrder> is true, the text is kept in content
// stream order.
HtmlOutputDev(char *fileName, char *title,
HtmlOutputDev(Catalog *catalogA, char *fileName, char *title,
char *author,
char *keywords,
char *subject,
......@@ -257,12 +257,11 @@ public:
virtual GBool checkPageSlice(Page *page, double hDPI, double vDPI,
int rotate, GBool useMediaBox, GBool crop,
int sliceX, int sliceY, int sliceW, int sliceH,
GBool printing, Catalog * catalogA,
GBool printing,
GBool (* abortCheckCbk)(void *data) = NULL,
void * abortCheckCbkData = NULL)
{
docPage = page;
catalog = catalogA;
return gTrue;
}
......@@ -305,7 +304,7 @@ private:
// recognized
static const char* mapEncodingToHtml(GooString* encoding);
void doProcessLink(AnnotLink *link);
GooString* getLinkDest(AnnotLink *link,Catalog *catalog);
GooString* getLinkDest(AnnotLink *link);
void dumpMetaVars(FILE *);
void doFrame(int firstPage);
GBool newOutlineLevel(FILE *output, Object *node, Catalog* catalog, int level = 1);
......
......@@ -370,7 +370,7 @@ int main(int argc, char *argv[]) {
rawOrder = singleHtml;
// write text file
htmlOut = new HtmlOutputDev(htmlFileName->getCString(),
htmlOut = new HtmlOutputDev(doc->getCatalog(), htmlFileName->getCString(),
docTitle->getCString(),
author ? author->getCString() : NULL,
keywords ? keywords->getCString() : NULL,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment