diff options
-rw-r--r-- | config.h.cmake | 1 | ||||
-rw-r--r-- | kfile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake | 5 | ||||
-rw-r--r-- | kfile-plugins/dependencies/poppler-tqt/poppler-document.cc | 8 | ||||
-rw-r--r-- | kfile-plugins/dependencies/poppler-tqt/poppler-page.cc | 42 |
4 files changed, 36 insertions, 20 deletions
diff --git a/config.h.cmake b/config.h.cmake index 083047f1..81d35102 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -1,6 +1,7 @@ #cmakedefine VERSION "@VERSION@" // poppler-tqt +#cmakedefine HAVE_POPPLER_020 #cmakedefine HAVE_POPPLER_016 // kpdf, kdvi diff --git a/kfile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake b/kfile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake index 2242eed0..eab7a0a9 100644 --- a/kfile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake +++ b/kfile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake @@ -15,4 +15,9 @@ check_cxx_source_compiles(" #include <poppler/PSOutputDev.h> int main(int, char**) { int a; int b; PSOutputDev *psOut = new PSOutputDev(\"test\", (PDFDoc*)0, (XRef*)0, (Catalog*)0, NULL, 0, 0, psModePS, a, b); } " HAVE_POPPLER_016 ) +check_cxx_source_compiles(" + #include <poppler/PSOutputDev.h> + int main(int, char**) { int a; int b; PSOutputDev *psOut = new PSOutputDev(\"test\", (PDFDoc*)0, NULL, 0, 0, psModePS, a, b); } " + HAVE_POPPLER_020 ) tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES ) + diff --git a/kfile-plugins/dependencies/poppler-tqt/poppler-document.cc b/kfile-plugins/dependencies/poppler-tqt/poppler-document.cc index a13fd99a..2e7cc516 100644 --- a/kfile-plugins/dependencies/poppler-tqt/poppler-document.cc +++ b/kfile-plugins/dependencies/poppler-tqt/poppler-document.cc @@ -317,17 +317,19 @@ bool Document::print(const TQString &fileName, TQValueList<int> pageList, double bool Document::print(const TQString &file, TQValueList<int> pageList, double hDPI, double vDPI, int rotate, int paperWidth, int paperHeight) { -#ifdef HAVE_POPPLER_016 +#if defined(HAVE_POPPLER_020) + PSOutputDev *psOut = new PSOutputDev(file.latin1(), &(data->doc), NULL, 1, data->doc.getNumPages(), psModePS, paperWidth, paperHeight); +#elif defined(HAVE_POPPLER_016) PSOutputDev *psOut = new PSOutputDev(file.latin1(), &(data->doc), data->doc.getXRef(), data->doc.getCatalog(), NULL, 1, data->doc.getNumPages(), psModePS, paperWidth, paperHeight); #else PSOutputDev *psOut = new PSOutputDev(file.latin1(), data->doc.getXRef(), data->doc.getCatalog(), NULL, 1, data->doc.getNumPages(), psModePS, paperWidth, paperHeight); #endif - + if (psOut->isOk()) { TQValueList<int>::iterator it; for (it = pageList.begin(); it != pageList.end(); ++it ) data->doc.displayPage(psOut, *it, hDPI, vDPI, rotate, gFalse, gTrue, gTrue); - + delete psOut; return true; } else { diff --git a/kfile-plugins/dependencies/poppler-tqt/poppler-page.cc b/kfile-plugins/dependencies/poppler-tqt/poppler-page.cc index b6be9bd1..3d1e6569 100644 --- a/kfile-plugins/dependencies/poppler-tqt/poppler-page.cc +++ b/kfile-plugins/dependencies/poppler-tqt/poppler-page.cc @@ -88,7 +88,7 @@ TQImage Page::renderToImage(double xres, double yres, bool doLinks) const int bw = output_dev->getBitmap()->getWidth(); int bh = output_dev->getBitmap()->getHeight(); SplashColorPtr dataPtr = output_dev->getBitmap()->getDataPtr(); - + if (TQImage::BigEndian == TQImage::systemByteOrder()) { uchar c; @@ -104,7 +104,7 @@ TQImage Page::renderToImage(double xres, double yres, bool doLinks) const dataPtr[k+2] = c; } } - + // construct a qimage SHARING the raw bitmap data in memory TQImage img( dataPtr, bw, bh, 32, 0, 0, TQImage::IgnoreEndian ); img = img.copy(); @@ -128,8 +128,12 @@ TQString Page::getText(const Rectangle &r) const PDFRectangle *rect; TQString result; ::Page *p; - + +#if defined(HAVE_POPPLER_020) + output_dev = new TextOutputDev(0, gFalse, 0, gFalse, gFalse); +#else output_dev = new TextOutputDev(0, gFalse, gFalse, gFalse); +#endif data->doc->data->doc.displayPageSlice(output_dev, data->index + 1, 72, 72, 0, false, false, false, -1, -1, -1, -1); p = data->doc->data->doc.getCatalog()->getPage(data->index + 1); @@ -157,21 +161,25 @@ TQString Page::getText(const Rectangle &r) const TQValueList<TextBox*> Page::textList() const { TextOutputDev *output_dev; - + TQValueList<TextBox*> output_list; - + +#if defined(HAVE_POPPLER_020) + output_dev = new TextOutputDev(0, gFalse, 0, gFalse, gFalse); +#else output_dev = new TextOutputDev(0, gFalse, gFalse, gFalse); +#endif data->doc->data->doc.displayPageSlice(output_dev, data->index + 1, 72, 72, 0, false, false, false, -1, -1, -1, -1); TextWordList *word_list = output_dev->makeWordList(); - + if (!word_list) { delete output_dev; return output_list; } - + for (int i = 0; i < word_list->getLength(); i++) { TextWord *word = word_list->get(i); GooString *word_str = word->getText(); @@ -179,21 +187,21 @@ TQValueList<TextBox*> Page::textList() const delete word_str; double xMin, yMin, xMax, yMax; word->getBBox(&xMin, &yMin, &xMax, &yMax); - + TextBox* text_box = new TextBox(string, Rectangle(xMin, yMin, xMax, yMax)); - + output_list.append(text_box); } - + delete word_list; delete output_dev; - + return output_list; } PageTransition *Page::getTransition() const { - if (!data->transition) + if (!data->transition) { Object o; PageTransitionParams params; @@ -245,12 +253,12 @@ TQValueList<Link*> Page::links() const for (int i = 0; i < xpdfLinks->getNumLinks(); ++i) { ::Link *xpdfLink = xpdfLinks->getLink(i); - + double left, top, right, bottom; int leftAux, topAux, rightAux, bottomAux; xpdfLink->getRect( &left, &top, &right, &bottom ); TQRect linkArea; - + data->doc->data->m_outputDev->cvtUserToDev( left, top, &leftAux, &topAux ); data->doc->data->m_outputDev->cvtUserToDev( right, bottom, &rightAux, &bottomAux ); linkArea.setLeft(leftAux); @@ -317,7 +325,7 @@ TQValueList<Link*> Page::links() const popplerLink = new LinkAction( linkArea, LinkAction::Presentation ); else if ( !strcmp( name, "Close" ) ) { - // acroread closes the document always, doesnt care whether + // acroread closes the document always, doesnt care whether // its presentation mode or not // popplerLink = new LinkAction( linkArea, LinkAction::EndPresentation ); popplerLink = new LinkAction( linkArea, LinkAction::Close ); @@ -346,7 +354,7 @@ TQValueList<Link*> Page::links() const break; } } - + if (popplerLink) { popplerLinks.append(popplerLink); @@ -355,7 +363,7 @@ TQValueList<Link*> Page::links() const delete xpdfLinks; #endif - + return popplerLinks; } |