diff options
author | Martin Kretzschmar <mkretzschmar@src.gnome.org> | 2003-03-31 21:08:43 (GMT) |
---|---|---|
committer | Martin Kretzschmar <mkretzschmar@src.gnome.org> | 2003-03-31 21:08:43 (GMT) |
commit | 64676031423465996e83c4a685290f0c3d97a249 (patch) | |
tree | cef578bc8c300722abb3fe1693181e68895a94a7 /pdf/xpdf/PDFDoc.cc | |
parent | 28c37dbcf87665a4ccec58bef9ef8ff0697022dd (diff) |
kill traces of ltk, incorporate new sources
* xpdf/Makefile.am: kill traces of ltk, incorporate new sources
* Makefile.am, configure.in: don't build the ltk subdir
* ANNOUNCE, CHANGES, ChangeLog, README, aconf-dj.h, aconf-win32.h,
dj_make.bat, ms_make.bat, vms_make.com: update
* xpdf/LTKOutputDev.cc, xpdf/LTKOutputDev.h, xpdf/postscript.xbm,
xpdf/xpdf-flip.ltk, xpdf/xpdf-ltk.h, xpdf/xpdf-top.ltk,
xpdf/xpdf.ltk: remove.
* xpdf/Annot.cc, xpdf/Annot.h, xpdf/Array.cc, xpdf/Array.h,
xpdf/BuiltinFont.cc, xpdf/BuiltinFont.h,
xpdf/BuiltinFontTables.cc, xpdf/CMap.cc, xpdf/CMap.h,
xpdf/Catalog.cc, xpdf/Catalog.h, xpdf/CharCodeToUnicode.cc,
xpdf/CharCodeToUnicode.h, xpdf/Decrypt.cc, xpdf/Decrypt.h,
xpdf/Dict.cc, xpdf/Dict.h, xpdf/Error.cc, xpdf/Error.h,
xpdf/FTFont.cc, xpdf/FTFont.h, xpdf/FontFile.cc, xpdf/FontFile.h,
xpdf/Function.cc, xpdf/Function.h, xpdf/Gfx.cc, xpdf/Gfx.h,
xpdf/GfxFont.cc, xpdf/GfxFont.h, xpdf/GfxState.cc,
xpdf/GfxState.h, xpdf/GlobalParams.cc, xpdf/GlobalParams.h,
xpdf/ImageOutputDev.cc, xpdf/ImageOutputDev.h, xpdf/Lexer.cc,
xpdf/Lexer.h, xpdf/Link.cc, xpdf/Link.h, xpdf/NameToCharCode.cc,
xpdf/NameToCharCode.h, xpdf/NameToUnicodeTable.h, xpdf/Object.cc,
xpdf/Object.h, xpdf/OutputDev.cc, xpdf/OutputDev.h,
xpdf/PBMOutputDev.cc, xpdf/PBMOutputDev.h, xpdf/PDFDoc.cc,
xpdf/PDFDoc.h, xpdf/PSOutputDev.cc, xpdf/PSOutputDev.h,
xpdf/PSTokenizer.cc, xpdf/PSTokenizer.h, xpdf/Page.cc,
xpdf/Page.h, xpdf/Parser.cc, xpdf/Parser.h, xpdf/SFont.cc,
xpdf/SFont.h, xpdf/Stream.cc, xpdf/Stream.h, xpdf/T1Font.cc,
xpdf/T1Font.h, xpdf/TTFont.cc, xpdf/TTFont.h,
xpdf/TextOutputDev.cc, xpdf/TextOutputDev.h, xpdf/UnicodeMap.cc,
xpdf/UnicodeMap.h, xpdf/XOutputDev.cc, xpdf/XOutputDev.h,
xpdf/XRef.cc, xpdf/XRef.h, xpdf/config.h, xpdf/pdffonts.cc,
xpdf/pdfimages.cc, xpdf/pdfinfo.cc, xpdf/pdftopbm.cc,
xpdf/pdftops.cc, xpdf/pdftotext.cc, xpdf/vms_make.com,
xpdf/xpdf.cc: update.
* goo/GHash.cc, goo/GHash.h, goo/GList.cc, goo/GList.h,
goo/GString.cc, goo/GString.h: mostly Mac OS X gcc fixage.
* doc/pdffonts.1, doc/pdffonts.cat, doc/pdffonts.hlp,
doc/pdfimages.1, doc/pdfimages.cat, doc/pdfimages.hlp,
doc/pdfinfo.1, doc/pdfinfo.cat, doc/pdfinfo.hlp, doc/pdftopbm.1,
doc/pdftopbm.cat, doc/pdftopbm.hlp, doc/pdftops.1,
doc/pdftops.cat, doc/pdftops.hlp, doc/pdftotext.1,
doc/pdftotext.cat, doc/pdftotext.hlp, doc/xpdf.1, doc/xpdf.cat,
doc/xpdf.hlp, doc/xpdfrc.5, doc/xpdfrc.cat, doc/xpdfrc.hlp:
update docs.
Diffstat (limited to 'pdf/xpdf/PDFDoc.cc')
-rw-r--r-- | pdf/xpdf/PDFDoc.cc | 77 |
1 files changed, 59 insertions, 18 deletions
diff --git a/pdf/xpdf/PDFDoc.cc b/pdf/xpdf/PDFDoc.cc index f3b7f79..ff6cefa 100644 --- a/pdf/xpdf/PDFDoc.cc +++ b/pdf/xpdf/PDFDoc.cc @@ -6,11 +6,12 @@ // //======================================================================== -#ifdef __GNUC__ +#include <aconf.h> + +#ifdef USE_GCC_PRAGMAS #pragma implementation #endif -#include <aconf.h> #include <locale.h> #include <stdio.h> #include <stdlib.h> @@ -18,6 +19,7 @@ #include <string.h> #include "GString.h" #include "config.h" +#include "GlobalParams.h" #include "Page.h" #include "Catalog.h" #include "Stream.h" @@ -28,6 +30,9 @@ #include "ErrorCodes.h" #include "Lexer.h" #include "Parser.h" +#ifndef DISABLE_OUTLINE +#include "Outline.h" +#endif #include "PDFDoc.h" //------------------------------------------------------------------------ @@ -40,9 +45,9 @@ //------------------------------------------------------------------------ PDFDoc::PDFDoc(GString *fileNameA, GString *ownerPassword, - GString *userPassword, GBool printCommandsA) { + GString *userPassword) { Object obj; - GString *fileName2; + GString *fileName1, *fileName2; ok = gFalse; errCode = errNone; @@ -52,19 +57,24 @@ PDFDoc::PDFDoc(GString *fileNameA, GString *ownerPassword, xref = NULL; catalog = NULL; links = NULL; - printCommands = printCommandsA; +#ifndef DISABLE_OUTLINE + outline = NULL; +#endif - // try to open file fileName = fileNameA; + fileName1 = fileName; + + + // try to open file fileName2 = NULL; #ifdef VMS - if (!(file = fopen(fileName->getCString(), "rb", "ctx=stm"))) { - error(-1, "Couldn't open file '%s'", fileName->getCString()); + if (!(file = fopen(fileName1->getCString(), "rb", "ctx=stm"))) { + error(-1, "Couldn't open file '%s'", fileName1->getCString()); errCode = errOpenFile; return; } #else - if (!(file = fopen(fileName->getCString(), "rb"))) { + if (!(file = fopen(fileName1->getCString(), "rb"))) { fileName2 = fileName->copy(); fileName2->lowerCase(); if (!(file = fopen(fileName2->getCString(), "rb"))) { @@ -88,7 +98,7 @@ PDFDoc::PDFDoc(GString *fileNameA, GString *ownerPassword, } PDFDoc::PDFDoc(BaseStream *strA, GString *ownerPassword, - GString *userPassword, GBool printCommandsA) { + GString *userPassword) { ok = gFalse; errCode = errNone; fileName = NULL; @@ -97,7 +107,9 @@ PDFDoc::PDFDoc(BaseStream *strA, GString *ownerPassword, xref = NULL; catalog = NULL; links = NULL; - printCommands = printCommandsA; +#ifndef DISABLE_OUTLINE + outline = NULL; +#endif ok = setup(ownerPassword, userPassword); } @@ -114,18 +126,28 @@ GBool PDFDoc::setup(GString *ownerPassword, GString *userPassword) { } // read catalog - catalog = new Catalog(xref, printCommands); + catalog = new Catalog(xref); if (!catalog->isOk()) { error(-1, "Couldn't read page catalog"); errCode = errBadCatalog; return gFalse; } +#ifndef DISABLE_OUTLINE + // read outline + outline = new Outline(catalog->getOutline(), xref); +#endif + // done return gTrue; } PDFDoc::~PDFDoc() { +#ifndef DISABLE_OUTLINE + if (outline) { + delete outline; + } +#endif if (catalog) { delete catalog; } @@ -182,10 +204,12 @@ void PDFDoc::checkHeader() { } void PDFDoc::displayPage(OutputDev *out, int page, double zoom, - int rotate, GBool doLinks) { + int rotate, GBool doLinks, + GBool (*abortCheckCbk)(void *data), + void *abortCheckCbkData) { Page *p; - if (printCommands) { + if (globalParams->getPrintCommands()) { printf("***** page %d *****\n", page); } p = catalog->getPage(page); @@ -195,21 +219,38 @@ void PDFDoc::displayPage(OutputDev *out, int page, double zoom, links = NULL; } getLinks(p); - p->display(out, zoom, rotate, links, catalog); + p->display(out, zoom, rotate, links, catalog, + abortCheckCbk, abortCheckCbkData); } else { - p->display(out, zoom, rotate, NULL, catalog); + p->display(out, zoom, rotate, NULL, catalog, + abortCheckCbk, abortCheckCbkData); } } void PDFDoc::displayPages(OutputDev *out, int firstPage, int lastPage, - int zoom, int rotate, GBool doLinks) { + int zoom, int rotate, GBool doLinks, + GBool (*abortCheckCbk)(void *data), + void *abortCheckCbkData) { int page; for (page = firstPage; page <= lastPage; ++page) { - displayPage(out, page, zoom, rotate, doLinks); + displayPage(out, page, zoom, rotate, doLinks, + abortCheckCbk, abortCheckCbkData); } } +void PDFDoc::displayPageSlice(OutputDev *out, int page, double zoom, + int rotate, int sliceX, int sliceY, + int sliceW, int sliceH, + GBool (*abortCheckCbk)(void *data), + void *abortCheckCbkData) { + Page *p; + + p = catalog->getPage(page); + p->displaySlice(out, zoom, rotate, sliceX, sliceY, sliceW, sliceH, + NULL, catalog, abortCheckCbk, abortCheckCbkData); +} + GBool PDFDoc::isLinearized() { Parser *parser; Object obj1, obj2, obj3, obj4, obj5; |