summaryrefslogtreecommitdiff
path: root/poppler
diff options
context:
space:
mode:
Diffstat (limited to 'poppler')
-rw-r--r--poppler/CairoFontEngine.cc28
-rw-r--r--poppler/CairoFontEngine.h13
-rw-r--r--poppler/CairoOutputDev.cc12
-rw-r--r--poppler/CairoOutputDev.h6
-rw-r--r--poppler/Catalog.cc8
-rw-r--r--poppler/Catalog.h4
-rw-r--r--poppler/Gfx.cc15
-rw-r--r--poppler/Gfx.h6
-rw-r--r--poppler/PDFDoc.cc6
-rw-r--r--poppler/PSOutputDev.cc29
-rw-r--r--poppler/PSOutputDev.h9
-rw-r--r--poppler/Page.cc8
-rw-r--r--poppler/Page.h4
-rw-r--r--poppler/PreScanOutputDev.cc6
-rw-r--r--poppler/PreScanOutputDev.h4
-rw-r--r--poppler/SplashOutputDev.cc13
-rw-r--r--poppler/SplashOutputDev.h5
17 files changed, 92 insertions, 84 deletions
diff --git a/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc
index 90407fa2..889b073a 100644
--- a/poppler/CairoFontEngine.cc
+++ b/poppler/CairoFontEngine.cc
@@ -565,8 +565,7 @@ static const cairo_user_data_key_t type3_font_key = {0};
typedef struct _type3_font_info {
GfxFont *font;
- XRef *xref;
- Catalog *catalog;
+ PDFDoc *doc;
CairoFontEngine *fontEngine;
GBool printing;
} type3_font_info_t;
@@ -631,8 +630,8 @@ _render_type3_glyph (cairo_scaled_font_t *scaled_font,
box.y1 = mat[1];
box.x2 = mat[2];
box.y2 = mat[3];
- gfx = new Gfx(info->xref, output_dev, resDict, info->catalog, &box, NULL);
- output_dev->startDoc(info->xref, info->catalog, info->fontEngine);
+ gfx = new Gfx(info->doc, output_dev, resDict, &box, NULL);
+ output_dev->startDoc(info->doc, info->fontEngine);
output_dev->startPage (1, gfx->getState());
output_dev->setInType3Char(gTrue);
gfx->display(charProcs->getVal(glyph, &charProc));
@@ -660,8 +659,8 @@ _render_type3_glyph (cairo_scaled_font_t *scaled_font,
}
-CairoType3Font *CairoType3Font::create(GfxFont *gfxFont, XRef *xref,
- Catalog *catalog, CairoFontEngine *fontEngine,
+CairoType3Font *CairoType3Font::create(GfxFont *gfxFont, PDFDoc *doc,
+ CairoFontEngine *fontEngine,
GBool printing) {
Object refObj, strObj;
type3_font_info_t *info;
@@ -681,8 +680,7 @@ CairoType3Font *CairoType3Font::create(GfxFont *gfxFont, XRef *xref,
cairo_user_font_face_set_render_glyph_func (font_face, _render_type3_glyph);
gfxFont->incRefCnt();
info->font = gfxFont;
- info->xref = xref;
- info->catalog = catalog;
+ info->doc = doc;
info->fontEngine = fontEngine;
info->printing = printing;
@@ -702,12 +700,11 @@ CairoType3Font *CairoType3Font::create(GfxFont *gfxFont, XRef *xref,
}
}
- return new CairoType3Font(ref, xref, catalog, font_face, codeToGID, codeToGIDLen, printing);
+ return new CairoType3Font(ref, doc, font_face, codeToGID, codeToGIDLen, printing);
}
CairoType3Font::CairoType3Font(Ref ref,
- XRef *xref,
- Catalog *catalog,
+ PDFDoc *doc,
cairo_font_face_t *cairo_font_face,
int *codeToGID,
Guint codeToGIDLen,
@@ -717,8 +714,7 @@ CairoType3Font::CairoType3Font(Ref ref,
codeToGIDLen,
gFalse,
printing),
- xref(xref),
- catalog(catalog) { }
+ doc(doc) { }
CairoType3Font::~CairoType3Font() { }
@@ -757,7 +753,7 @@ CairoFontEngine::~CairoFontEngine() {
}
CairoFont *
-CairoFontEngine::getFont(GfxFont *gfxFont, XRef *xref, Catalog *catalog, GBool printing) {
+CairoFontEngine::getFont(GfxFont *gfxFont, PDFDoc *doc, GBool printing) {
int i, j;
Ref ref;
CairoFont *font;
@@ -778,9 +774,9 @@ CairoFontEngine::getFont(GfxFont *gfxFont, XRef *xref, Catalog *catalog, GBool p
fontType = gfxFont->getType();
if (fontType == fontType3)
- font = CairoType3Font::create (gfxFont, xref, catalog, this, printing);
+ font = CairoType3Font::create (gfxFont, doc, this, printing);
else
- font = CairoFreeTypeFont::create (gfxFont, xref, lib, useCIDs);
+ font = CairoFreeTypeFont::create (gfxFont, doc->getXRef(), lib, useCIDs);
//XXX: if font is null should we still insert it into the cache?
if (fontCache[cairoFontCacheSize - 1]) {
diff --git a/poppler/CairoFontEngine.h b/poppler/CairoFontEngine.h
index 74e9aade..63353489 100644
--- a/poppler/CairoFontEngine.h
+++ b/poppler/CairoFontEngine.h
@@ -36,7 +36,7 @@
#include <cairo-ft.h>
#include "GfxFont.h"
-#include "Catalog.h"
+#include "PDFDoc.h"
class CairoFontEngine;
@@ -83,20 +83,19 @@ private:
class CairoType3Font : public CairoFont {
public:
- static CairoType3Font *create(GfxFont *gfxFont, XRef *xref,
- Catalog *catalog, CairoFontEngine *fontEngine,
+ static CairoType3Font *create(GfxFont *gfxFont, PDFDoc *doc,
+ CairoFontEngine *fontEngine,
GBool printing);
virtual ~CairoType3Font();
virtual GBool matches(Ref &other, GBool printing);
private:
- CairoType3Font(Ref ref, XRef *xref, Catalog *catalog,
+ CairoType3Font(Ref ref, PDFDoc *doc,
cairo_font_face_t *cairo_font_face,
int *codeToGID, Guint codeToGIDLen,
GBool printing);
- XRef *xref;
- Catalog *catalog;
+ PDFDoc *doc;
};
//------------------------------------------------------------------------
@@ -114,7 +113,7 @@ public:
CairoFontEngine(FT_Library libA);
~CairoFontEngine();
- CairoFont *getFont(GfxFont *gfxFont, XRef *xref, Catalog *catalog, GBool printing);
+ CairoFont *getFont(GfxFont *gfxFont, PDFDoc *doc, GBool printing);
private:
CairoFont *fontCache[cairoFontCacheSize];
diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index 00a0a5be..ba29f0bc 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -115,8 +115,7 @@ FT_Library CairoOutputDev::ft_lib;
GBool CairoOutputDev::ft_lib_initialized = gFalse;
CairoOutputDev::CairoOutputDev() {
- xref = NULL;
- catalog = NULL;
+ doc = NULL;
if (!ft_lib_initialized) {
FT_Init_FreeType(&ft_lib);
@@ -219,10 +218,9 @@ void CairoOutputDev::setTextPage(TextPage *text)
}
}
-void CairoOutputDev::startDoc(XRef *xrefA, Catalog *catalogA,
+void CairoOutputDev::startDoc(PDFDoc *docA,
CairoFontEngine *parentFontEngine) {
- xref = xrefA;
- catalog = catalogA;
+ doc = docA;
if (parentFontEngine) {
fontEngine = parentFontEngine;
} else {
@@ -595,7 +593,7 @@ void CairoOutputDev::updateFont(GfxState *state) {
if (text)
text->updateFont(state);
- currentFont = fontEngine->getFont (state->getFont(), xref, catalog, printing);
+ currentFont = fontEngine->getFont (state->getFont(), doc, printing);
if (!currentFont)
return;
@@ -794,7 +792,7 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Catalog *cat, Object *s
box.x2 = bbox[2]; box.y2 = bbox[3];
strokePathTmp = strokePathClip;
strokePathClip = NULL;
- gfx = new Gfx(xref, this, resDict, catalog, &box, NULL);
+ gfx = new Gfx(doc, this, resDict, &box, NULL);
gfx->display(str);
delete gfx;
strokePathClip = strokePathTmp;
diff --git a/poppler/CairoOutputDev.h b/poppler/CairoOutputDev.h
index effa9ddd..722ce97e 100644
--- a/poppler/CairoOutputDev.h
+++ b/poppler/CairoOutputDev.h
@@ -40,6 +40,7 @@
#include "TextOutputDev.h"
#include "GfxState.h"
+class PDFDoc;
class GfxState;
class GfxPath;
class Gfx8BitFont;
@@ -259,7 +260,7 @@ public:
//----- special access
// Called to indicate that a new PDF document has been loaded.
- void startDoc(XRef *xrefA, Catalog *catalogA, CairoFontEngine *fontEngine = NULL);
+ void startDoc(PDFDoc *docA, CairoFontEngine *fontEngine = NULL);
GBool isReverseVideo() { return gFalse; }
@@ -305,8 +306,7 @@ protected:
double miter;
} *strokePathClip;
- XRef *xref; // xref table for current document
- Catalog *catalog;
+ PDFDoc *doc; // the current document
static FT_Library ft_lib;
static GBool ft_lib_initialized;
diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc
index c6c77eb0..fd418b0a 100644
--- a/poppler/Catalog.cc
+++ b/poppler/Catalog.cc
@@ -40,6 +40,7 @@
#include <stdlib.h>
#include "goo/gmem.h"
#include "Object.h"
+#include "PDFDoc.h"
#include "XRef.h"
#include "Array.h"
#include "Dict.h"
@@ -57,13 +58,14 @@
// Catalog
//------------------------------------------------------------------------
-Catalog::Catalog(XRef *xrefA) {
+Catalog::Catalog(PDFDoc *docA) {
Object catDict, pagesDict, pagesDictRef;
Object obj, obj2;
Object optContentProps;
ok = gTrue;
- xref = xrefA;
+ doc = docA;
+ xref = doc->getXRef();
pages = NULL;
pageRefs = NULL;
numPages = -1;
@@ -355,7 +357,7 @@ GBool Catalog::cachePageTree(int page)
kids.free();
if (kid.isDict("Page") || (kid.isDict() && !kid.getDict()->hasKey("Kids"))) {
PageAttrs *attrs = new PageAttrs(attrsList->back(), kid.getDict());
- Page *p = new Page(xref, lastCachedPage+1, kid.getDict(),
+ Page *p = new Page(doc, lastCachedPage+1, kid.getDict(),
kidRef.getRef(), attrs, form);
if (!p->isOk()) {
error(errSyntaxError, -1, "Failed to create page (page {0:d})", lastCachedPage+1);
diff --git a/poppler/Catalog.h b/poppler/Catalog.h
index 41be3b6f..cdb1f137 100644
--- a/poppler/Catalog.h
+++ b/poppler/Catalog.h
@@ -37,6 +37,7 @@
#include <vector>
+class PDFDoc;
class XRef;
class Object;
class Page;
@@ -93,7 +94,7 @@ class Catalog {
public:
// Constructor.
- Catalog(XRef *xrefA);
+ Catalog(PDFDoc *docA);
// Destructor.
~Catalog();
@@ -185,6 +186,7 @@ private:
// Get page label info.
PageLabelInfo *getPageLabelInfo();
+ PDFDoc *doc;
XRef *xref; // the xref table for this PDF file
Page **pages; // array of pages
Ref *pageRefs; // object ID for each page
diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index 23fe9308..11c86c9d 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -56,6 +56,7 @@
#include "GlobalParams.h"
#include "CharTypes.h"
#include "Object.h"
+#include "PDFDoc.h"
#include "Array.h"
#include "Dict.h"
#include "Stream.h"
@@ -525,7 +526,7 @@ GBool GfxResources::lookupGStateNF(char *name, Object *obj) {
// Gfx
//------------------------------------------------------------------------
-Gfx::Gfx(XRef *xrefA, OutputDev *outA, int pageNum, Dict *resDict, Catalog *catalogA,
+Gfx::Gfx(PDFDoc *docA, OutputDev *outA, int pageNum, Dict *resDict,
double hDPI, double vDPI, PDFRectangle *box,
PDFRectangle *cropBox, int rotate,
GBool (*abortCheckCbkA)(void *data),
@@ -536,8 +537,9 @@ Gfx::Gfx(XRef *xrefA, OutputDev *outA, int pageNum, Dict *resDict, Catalog *cata
{
int i;
- xref = xrefA;
- catalog = catalogA;
+ doc = docA;
+ xref = doc->getXRef();
+ catalog = doc->getCatalog();
subPage = gFalse;
printCommands = globalParams->getPrintCommands();
profileCommands = globalParams->getProfileCommands();
@@ -581,7 +583,7 @@ Gfx::Gfx(XRef *xrefA, OutputDev *outA, int pageNum, Dict *resDict, Catalog *cata
}
}
-Gfx::Gfx(XRef *xrefA, OutputDev *outA, Dict *resDict, Catalog *catalogA,
+Gfx::Gfx(PDFDoc *docA, OutputDev *outA, Dict *resDict,
PDFRectangle *box, PDFRectangle *cropBox,
GBool (*abortCheckCbkA)(void *data),
void *abortCheckCbkDataA)
@@ -591,8 +593,9 @@ Gfx::Gfx(XRef *xrefA, OutputDev *outA, Dict *resDict, Catalog *catalogA,
{
int i;
- xref = xrefA;
- catalog = catalogA;
+ doc = docA;
+ xref = doc->getXRef();
+ catalog = doc->getCatalog();
subPage = gTrue;
printCommands = globalParams->getPrintCommands();
profileCommands = globalParams->getProfileCommands();
diff --git a/poppler/Gfx.h b/poppler/Gfx.h
index 9cca8bd0..2db341b3 100644
--- a/poppler/Gfx.h
+++ b/poppler/Gfx.h
@@ -44,6 +44,7 @@
#include <vector>
class GooString;
+class PDFDoc;
class XRef;
class Array;
class Stream;
@@ -143,14 +144,14 @@ class Gfx {
public:
// Constructor for regular output.
- Gfx(XRef *xrefA, OutputDev *outA, int pageNum, Dict *resDict, Catalog *catalog,
+ Gfx(PDFDoc *docA, OutputDev *outA, int pageNum, Dict *resDict,
double hDPI, double vDPI, PDFRectangle *box,
PDFRectangle *cropBox, int rotate,
GBool (*abortCheckCbkA)(void *data) = NULL,
void *abortCheckCbkDataA = NULL);
// Constructor for a sub-page object.
- Gfx(XRef *xrefA, OutputDev *outA, Dict *resDict, Catalog *catalog,
+ Gfx(PDFDoc *docA, OutputDev *outA, Dict *resDict,
PDFRectangle *box, PDFRectangle *cropBox,
GBool (*abortCheckCbkA)(void *data) = NULL,
void *abortCheckCbkDataA = NULL);
@@ -189,6 +190,7 @@ public:
private:
+ PDFDoc *doc;
XRef *xref; // the xref table for this PDF file
Catalog *catalog; // the Catalog for this PDF file
OutputDev *out; // output device
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index 3139ab2b..62039eff 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -256,7 +256,7 @@ GBool PDFDoc::setup(GooString *ownerPassword, GooString *userPassword) {
}
// read catalog
- catalog = new Catalog(xref);
+ catalog = new Catalog(this);
if (catalog && !catalog->isOk()) {
if (!wasReconstructed)
{
@@ -264,7 +264,7 @@ GBool PDFDoc::setup(GooString *ownerPassword, GooString *userPassword) {
delete catalog;
delete xref;
xref = new XRef(str, 0, 0, NULL, true);
- catalog = new Catalog(xref);
+ catalog = new Catalog(this);
}
if (catalog && !catalog->isOk()) {
@@ -1490,7 +1490,7 @@ Page *PDFDoc::parsePage(int page)
}
pageDict = obj.getDict();
- p = new Page(xref, page, pageDict, pageRef,
+ p = new Page(this, page, pageDict, pageRef,
new PageAttrs(NULL, pageDict), catalog->getForm());
obj.free();
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index d8ec2955..e64f278e 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -994,7 +994,7 @@ static void outputToFile(void *stream, const char *data, int len) {
fwrite(data, 1, len, (FILE *)stream);
}
-PSOutputDev::PSOutputDev(const char *fileName, PDFDoc *doc, XRef *xrefA, Catalog *catalog,
+PSOutputDev::PSOutputDev(const char *fileName, PDFDoc *doc,
char *psTitle,
int firstPage, int lastPage, PSOutMode modeA,
int paperWidthA, int paperHeightA, GBool duplexA,
@@ -1055,7 +1055,7 @@ PSOutputDev::PSOutputDev(const char *fileName, PDFDoc *doc, XRef *xrefA, Catalog
}
init(outputToFile, f, fileTypeA, psTitle,
- doc, xrefA, catalog, firstPage, lastPage, modeA,
+ doc, firstPage, lastPage, modeA,
imgLLXA, imgLLYA, imgURXA, imgURYA, manualCtrlA,
paperWidthA, paperHeightA, duplexA);
}
@@ -1063,7 +1063,6 @@ PSOutputDev::PSOutputDev(const char *fileName, PDFDoc *doc, XRef *xrefA, Catalog
PSOutputDev::PSOutputDev(PSOutputFunc outputFuncA, void *outputStreamA,
char *psTitle,
PDFDoc *doc,
- XRef *xrefA, Catalog *catalog,
int firstPage, int lastPage, PSOutMode modeA,
int paperWidthA, int paperHeightA, GBool duplexA,
int imgLLXA, int imgLLYA, int imgURXA, int imgURYA,
@@ -1091,17 +1090,18 @@ PSOutputDev::PSOutputDev(PSOutputFunc outputFuncA, void *outputStreamA,
forceRasterize = forceRasterizeA;
init(outputFuncA, outputStreamA, psGeneric, psTitle,
- doc, xrefA, catalog, firstPage, lastPage, modeA,
+ doc, firstPage, lastPage, modeA,
imgLLXA, imgLLYA, imgURXA, imgURYA, manualCtrlA,
paperWidthA, paperHeightA, duplexA);
}
void PSOutputDev::init(PSOutputFunc outputFuncA, void *outputStreamA,
- PSFileType fileTypeA, char *pstitle, PDFDoc *doc, XRef *xrefA, Catalog *catalog,
+ PSFileType fileTypeA, char *pstitle, PDFDoc *docA,
int firstPage, int lastPage, PSOutMode modeA,
int imgLLXA, int imgLLYA, int imgURXA, int imgURYA,
GBool manualCtrlA, int paperWidthA, int paperHeightA,
GBool duplexA) {
+ Catalog *catalog;
PDFRectangle *box;
// initialize
@@ -1110,8 +1110,9 @@ void PSOutputDev::init(PSOutputFunc outputFuncA, void *outputStreamA,
outputFunc = outputFuncA;
outputStream = outputStreamA;
fileType = fileTypeA;
- m_catalog = catalog;
- xref = xrefA;
+ doc = docA;
+ xref = doc->getXRef();
+ catalog = doc->getCatalog();
level = globalParams->getPSLevel();
mode = modeA;
paperWidth = paperWidthA;
@@ -2621,7 +2622,7 @@ void PSOutputDev::setupType3Font(GfxFont *font, GooString *psName,
box.y1 = m[1];
box.x2 = m[2];
box.y2 = m[3];
- gfx = new Gfx(xref, this, resDict, m_catalog, &box, NULL);
+ gfx = new Gfx(doc, this, resDict, &box, NULL);
inType3Char = gTrue;
for (i = 0; i < charProcs->getLength(); ++i) {
t3Cacheable = gFalse;
@@ -2965,7 +2966,7 @@ void PSOutputDev::setupForm(Ref id, Object *strObj) {
box.y1 = bbox[1];
box.x2 = bbox[2];
box.y2 = bbox[3];
- gfx = new Gfx(xref, this, resDict, m_catalog, &box, &box);
+ gfx = new Gfx(doc, this, resDict, &box, &box);
gfx->display(strObj);
delete gfx;
@@ -3004,7 +3005,7 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
int compCyan;
if (!forceRasterize) {
- scan = new PreScanOutputDev(xref);
+ scan = new PreScanOutputDev(doc);
page->displaySlice(scan, 72, 72, rotateA, useMediaBox, crop,
sliceX, sliceY, sliceW, sliceH,
printing, catalog, abortCheckCbk, abortCheckCbkData);
@@ -3037,7 +3038,7 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
splashOut = new SplashOutputDev(splashModeRGB8, 1, gFalse,
paperColor, gTrue, gFalse);
}
- splashOut->startDoc(xref);
+ splashOut->startDoc(doc);
splashDPI = globalParams->getSplashResolution();
if (splashDPI < 1.0) {
splashDPI = defaultSplashDPI;
@@ -3414,7 +3415,7 @@ void PSOutputDev::startPage(int pageNum, GfxState *state) {
if (mode == psModePS || mode == psModePSOrigPageSizes) {
GooString pageLabel;
- const GBool gotLabel = m_catalog->indexToLabel(pageNum -1, &pageLabel);
+ const GBool gotLabel = doc->getCatalog()->indexToLabel(pageNum -1, &pageLabel);
if (gotLabel) {
// See bug13338 for why we try to avoid parentheses...
GBool needParens;
@@ -4043,7 +4044,7 @@ GBool PSOutputDev::tilingPatternFillL1(GfxState *state, Catalog *cat, Object *st
box.y1 = bbox[1];
box.x2 = bbox[2];
box.y2 = bbox[3];
- gfx = new Gfx(xref, this, resDict, m_catalog, &box, NULL);
+ gfx = new Gfx(doc, this, resDict, &box, NULL);
writePS("/x {\n");
if (paintType == 2) {
writePSFmt("{0:.6g} 0 {1:.6g} {2:.6g} {3:.6g} {4:.6g} setcachedevice\n",
@@ -4098,7 +4099,7 @@ GBool PSOutputDev::tilingPatternFillL2(GfxState *state, Catalog *cat, Object *st
box.y1 = bbox[1];
box.x2 = bbox[2];
box.y2 = bbox[3];
- gfx = new Gfx(xref, this, resDict, m_catalog, &box, NULL);
+ gfx = new Gfx(doc, this, resDict, &box, NULL);
inType3Char = gTrue;
gfx->display(str);
inType3Char = gFalse;
diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h
index 3de590db..83aeb84a 100644
--- a/poppler/PSOutputDev.h
+++ b/poppler/PSOutputDev.h
@@ -78,7 +78,7 @@ class PSOutputDev: public OutputDev {
public:
// Open a PostScript output file, and write the prolog.
- PSOutputDev(const char *fileName, PDFDoc *doc, XRef *xrefA, Catalog *catalog,
+ PSOutputDev(const char *fileName, PDFDoc *docA,
char *psTitle,
int firstPage, int lastPage, PSOutMode modeA,
int paperWidthA = -1, int paperHeightA = -1,
@@ -91,8 +91,7 @@ public:
// Open a PSOutputDev that will write to a generic stream.
PSOutputDev(PSOutputFunc outputFuncA, void *outputStreamA,
char *psTitle,
- PDFDoc *doc,
- XRef *xrefA, Catalog *catalog,
+ PDFDoc *docA,
int firstPage, int lastPage, PSOutMode modeA,
int paperWidthA = -1, int paperHeightA = -1,
GBool duplexA = gTrue,
@@ -288,7 +287,7 @@ public:
private:
void init(PSOutputFunc outputFuncA, void *outputStreamA,
- PSFileType fileTypeA, char *pstitle, PDFDoc *doc, XRef *xrefA, Catalog *catalog,
+ PSFileType fileTypeA, char *pstitle, PDFDoc *doc,
int firstPage, int lastPage, PSOutMode modeA,
int imgLLXA, int imgLLYA, int imgURXA, int imgURYA,
GBool manualCtrlA, int paperWidthA, int paperHeightA,
@@ -394,8 +393,8 @@ private:
void (*overlayCbk)(PSOutputDev *psOut, void *data);
void *overlayCbkData;
+ PDFDoc *doc;
XRef *xref; // the xref table for this PDF file
- Catalog *m_catalog; // the catalog for this PDF file
Ref *fontIDs; // list of object IDs of all used fonts
int fontIDLen; // number of entries in fontIDs array
diff --git a/poppler/Page.cc b/poppler/Page.cc
index 95469f65..486ab456 100644
--- a/poppler/Page.cc
+++ b/poppler/Page.cc
@@ -42,6 +42,7 @@
#include "Object.h"
#include "Array.h"
#include "Dict.h"
+#include "PDFDoc.h"
#include "XRef.h"
#include "Link.h"
#include "OutputDev.h"
@@ -255,11 +256,12 @@ GBool PageAttrs::readBox(Dict *dict, const char *key, PDFRectangle *box) {
// Page
//------------------------------------------------------------------------
-Page::Page(XRef *xrefA, int numA, Dict *pageDict, Ref pageRefA, PageAttrs *attrsA, Form *form) {
+Page::Page(PDFDoc *docA, int numA, Dict *pageDict, Ref pageRefA, PageAttrs *attrsA, Form *form) {
Object tmp;
ok = gTrue;
- xref = xrefA;
+ doc = docA;
+ xref = doc->getXRef();
num = numA;
duration = -1;
annots = NULL;
@@ -446,7 +448,7 @@ Gfx *Page::createGfx(OutputDev *out, double hDPI, double vDPI,
printf("***** Rotate = %d\n", attrs->getRotate());
}
- gfx = new Gfx(xref, out, num, attrs->getResourceDict(), catalog,
+ gfx = new Gfx(doc, out, num, attrs->getResourceDict(),
hDPI, vDPI, &box, crop ? cropBox : (PDFRectangle *)NULL,
rotate, abortCheckCbk, abortCheckCbkData);
diff --git a/poppler/Page.h b/poppler/Page.h
index ced11c08..40e4fdd0 100644
--- a/poppler/Page.h
+++ b/poppler/Page.h
@@ -35,6 +35,7 @@
#include "Object.h"
class Dict;
+class PDFDoc;
class XRef;
class OutputDev;
class Links;
@@ -127,7 +128,7 @@ class Page {
public:
// Constructor.
- Page(XRef *xrefA, int numA, Dict *pageDict, Ref pageRefA, PageAttrs *attrsA, Form *form);
+ Page(PDFDoc *docA, int numA, Dict *pageDict, Ref pageRefA, PageAttrs *attrsA, Form *form);
// Destructor.
~Page();
@@ -237,6 +238,7 @@ public:
private:
+ PDFDoc *doc;
XRef *xref; // the xref table for this PDF file
Object pageObj; // page dictionary
Ref pageRef; // page reference
diff --git a/poppler/PreScanOutputDev.cc b/poppler/PreScanOutputDev.cc
index f8df6a1d..b82828d6 100644
--- a/poppler/PreScanOutputDev.cc
+++ b/poppler/PreScanOutputDev.cc
@@ -43,9 +43,9 @@
// PreScanOutputDev
//------------------------------------------------------------------------
-PreScanOutputDev::PreScanOutputDev(XRef *xrefA) {
+PreScanOutputDev::PreScanOutputDev(PDFDoc *docA) {
level = globalParams->getPSLevel();
- xref = xrefA;
+ doc = docA;
clearStats();
}
@@ -90,7 +90,7 @@ GBool PreScanOutputDev::tilingPatternFill(GfxState *state, Catalog *catalog, Obj
Gfx *gfx;
box.x1 = bbox[0]; box.y1 = bbox[1];
box.x2 = bbox[2]; box.y2 = bbox[3];
- gfx = new Gfx(xref, this, resDict, catalog, &box, NULL);
+ gfx = new Gfx(doc, this, resDict, &box, NULL);
gfx->display(str);
delete gfx;
return gTrue;
diff --git a/poppler/PreScanOutputDev.h b/poppler/PreScanOutputDev.h
index 464fbbf2..d94afaac 100644
--- a/poppler/PreScanOutputDev.h
+++ b/poppler/PreScanOutputDev.h
@@ -45,7 +45,7 @@ class PreScanOutputDev: public OutputDev {
public:
// Constructor.
- PreScanOutputDev(XRef *xrefA);
+ PreScanOutputDev(PDFDoc *docA);
// Destructor.
virtual ~PreScanOutputDev();
@@ -159,7 +159,7 @@ private:
void check(GfxColorSpace *colorSpace, GfxColor *color,
double opacity, GfxBlendMode blendMode);
- XRef *xref;
+ PDFDoc *doc;
GBool mono;
GBool gray;
GBool transparency;
diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index 2263753d..9fc0656b 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -51,6 +51,7 @@
#include "Gfx.h"
#include "GfxFont.h"
#include "Page.h"
+#include "PDFDoc.h"
#include "Link.h"
#include "CharCodeToUnicode.h"
#include "FontEncodingTables.h"
@@ -1340,7 +1341,7 @@ SplashOutputDev::SplashOutputDev(SplashColorMode colorModeA,
}
keepAlphaChannel = paperColorA == NULL;
- xref = NULL;
+ doc = NULL;
bitmap = new SplashBitmap(1, 1, bitmapRowPad, colorMode,
colorMode != splashModeMono1, bitmapTopDown);
@@ -1427,10 +1428,10 @@ SplashOutputDev::~SplashOutputDev() {
}
}
-void SplashOutputDev::startDoc(XRef *xrefA) {
+void SplashOutputDev::startDoc(PDFDoc *docA) {
int i;
- xref = xrefA;
+ doc = docA;
if (fontEngine) {
delete fontEngine;
}
@@ -1771,7 +1772,7 @@ void SplashOutputDev::doUpdateFont(GfxState *state) {
// if there is an embedded font, write it to disk
if (gfxFont->getEmbeddedFontID(&embRef)) {
- tmpBuf = gfxFont->readEmbFontFile(xref, &tmpBufLen);
+ tmpBuf = gfxFont->readEmbFontFile(doc->getXRef(), &tmpBufLen);
if (! tmpBuf)
goto err2;
@@ -3150,7 +3151,7 @@ void SplashOutputDev::drawMaskedImage(GfxState *state, Object *ref,
if (maskWidth > width || maskHeight > height) {
decodeLow.initInt(maskInvert ? 0 : 1);
decodeHigh.initInt(maskInvert ? 1 : 0);
- maskDecode.initArray(xref);
+ maskDecode.initArray(doc->getXRef());
maskDecode.arrayAdd(&decodeLow);
maskDecode.arrayAdd(&decodeHigh);
maskColorMap = new GfxImageColorMap(1, &maskDecode,
@@ -3901,7 +3902,7 @@ GBool SplashOutputDev::tilingPatternFill(GfxState *state, Catalog *catalog, Obje
box.x1 = bbox[0]; box.y1 = bbox[1];
box.x2 = bbox[2]; box.y2 = bbox[3];
- gfx = new Gfx(xref, this, resDict, catalog, &box, NULL);
+ gfx = new Gfx(doc, this, resDict, &box, NULL);
// set pattern transformation matrix
gfx->getState()->setCTM(m1.m[0], m1.m[1], m1.m[2], m1.m[3], m1.m[4], m1.m[5]);
updateCTM(gfx->getState(), m1.m[0], m1.m[1], m1.m[2], m1.m[3], m1.m[4], m1.m[5]);
diff --git a/poppler/SplashOutputDev.h b/poppler/SplashOutputDev.h
index f19c5425..49f2b12a 100644
--- a/poppler/SplashOutputDev.h
+++ b/poppler/SplashOutputDev.h
@@ -40,6 +40,7 @@
#include "OutputDev.h"
#include "GfxState.h"
+class PDFDoc;
class Gfx8BitFont;
class SplashBitmap;
class Splash;
@@ -345,7 +346,7 @@ public:
//----- special access
// Called to indicate that a new PDF document has been loaded.
- void startDoc(XRef *xrefA);
+ void startDoc(PDFDoc *docA);
void setPaperColor(SplashColorPtr paperColorA);
@@ -417,7 +418,7 @@ private:
SplashColor paperColor; // paper color
SplashScreenParams screenParams;
- XRef *xref; // xref table for current document
+ PDFDoc *doc; // the current document
SplashBitmap *bitmap;
Splash *splash;