diff --git a/kdegraphics-4.0.2-poppler07.patch b/kdegraphics-4.0.2-poppler07.patch new file mode 100644 index 0000000..c421cb8 --- /dev/null +++ b/kdegraphics-4.0.2-poppler07.patch @@ -0,0 +1,164 @@ +Index: okular/generators/poppler/generator_pdf.cpp +=================================================================== +--- okular/generators/poppler/generator_pdf.cpp (revision 784723) ++++ okular/generators/poppler/generator_pdf.cpp (revision 784736) +@@ -1,5 +1,5 @@ + /*************************************************************************** +- * Copyright (C) 2004-2006 by Albert Astals Cid * ++ * Copyright (C) 2004-2008 by Albert Astals Cid * + * Copyright (C) 2004 by Enrico Ros * + * * + * This program is free software; you can redistribute it and/or modify * +@@ -820,7 +820,11 @@ + userMutex()->unlock(); + if ( genTextPage ) + { ++#ifdef HAVE_POPPLER_0_7 ++ QList textList = p->textList(); ++#else + QList textList = p->textList((Poppler::Page::Rotation)request->page()->orientation()); ++#endif + page->setTextPage( abstractTextPage(textList, page->height(), page->width(), request->page()->orientation()) ); + qDeleteAll(textList); + } +@@ -839,12 +843,21 @@ + // build a TextList... + Poppler::Page *pp = pdfdoc->page( page->number() ); + userMutex()->lock(); ++#ifdef HAVE_POPPLER_0_7 ++ QList textList = pp->textList(); ++#else + QList textList = pp->textList((Poppler::Page::Rotation)page->orientation()); ++#endif + userMutex()->unlock(); + delete pp; + ++#ifdef HAVE_POPPLER_0_7 ++ const double pageWidth = page->width(); ++ const double pageHeight = page->height(); ++#else + const double pageWidth = ( page->rotation() % 2 ? page->height() : page->width() ); + const double pageHeight = ( page->rotation() % 2 ? page->width() : page->height() ); ++#endif + + Okular::TextPage *tp = abstractTextPage(textList, pageHeight, pageWidth, (Poppler::Page::Rotation)page->orientation()); + qDeleteAll(textList); +@@ -875,7 +888,7 @@ + + #ifdef HAVE_POPPLER_0_6 + +-#if POPPLER_HAVE_PSCONVERTER_SETOUTPUTDEVICE ++#ifdef HAVE_POPPLER_0_7 + tf.setAutoRemove(false); + #else + tf.close(); +@@ -891,7 +904,7 @@ + + Poppler::PSConverter *psConverter = pdfdoc->psConverter(); + +-#if POPPLER_HAVE_PSCONVERTER_SETOUTPUTDEVICE ++#ifdef HAVE_POPPLER_0_7 + psConverter->setOutputDevice(&tf); + #else + psConverter->setOutputFileName(tempfilename); +@@ -1099,6 +1112,38 @@ + int charCount=0; + int j; + QString s; ++#ifdef HAVE_POPPLER_0_7 ++ foreach (Poppler::TextBox *word, text) ++ { ++ charCount=word->text().length(); ++ next=word->nextWord(); ++ for (j = 0; j < charCount; j++) ++ { ++ s = word->text().at(j); ++ QRectF charBBox = word->charBoundingBox(j); ++ append(ktp, (j==charCount-1 && !next ) ? (s + '\n') : s, ++ charBBox.left()/width, ++ charBBox.bottom()/height, ++ charBBox.right()/width, ++ charBBox.top()/height); ++ } ++ ++ if ( word->hasSpaceAfter() && next ) ++ { ++ // TODO Check with a document with vertical text ++ // probably won't work and we will need to do comparisons ++ // between wordBBox and nextWordBBox to see if they are ++ // vertically or horizontally aligned ++ QRectF wordBBox = word->boundingBox(); ++ QRectF nextWordBBox = next->boundingBox(); ++ append(ktp, " ", ++ wordBBox.right()/width, ++ wordBBox.bottom()/height, ++ nextWordBBox.left()/width, ++ wordBBox.top()/height); ++ } ++ } ++#else + Okular::NormalizedRect * wordRect = new Okular::NormalizedRect; + + rot = rot % 4; +@@ -1208,6 +1253,7 @@ + } + } + delete wordRect; ++#endif + return ktp; + } + +@@ -1775,7 +1821,11 @@ + + if ( genTextPage ) + { ++#ifdef HAVE_POPPLER_0_7 ++ d->m_textList = pp->textList(); ++#else + d->m_textList = pp->textList((Poppler::Page::Rotation)d->currentRequest->page()->orientation()); ++#endif + } + delete pp; + +Index: okular/generators/poppler/config-okular-poppler.h.cmake +=================================================================== +--- okular/generators/poppler/config-okular-poppler.h.cmake (revision 784723) ++++ okular/generators/poppler/config-okular-poppler.h.cmake (revision 784736) +@@ -1,5 +1,5 @@ + /* Defined if we have the 0.6 version of the Poppler library */ + #cmakedefine HAVE_POPPLER_0_6 1 + +-/* Defined if Poppler::PSConverter has setOutputDevice */ +-#define POPPLER_HAVE_PSCONVERTER_SETOUTPUTDEVICE ${_POPPLER_HAVE_PSCONVERTER_SETOUTPUTDEVICE} ++/* Defined if we have the 0.7 version of the Poppler library */ ++#cmakedefine HAVE_POPPLER_0_7 1 +Index: okular/generators/poppler/CMakeLists.txt +=================================================================== +--- okular/generators/poppler/CMakeLists.txt (revision 784723) ++++ okular/generators/poppler/CMakeLists.txt (revision 784736) +@@ -1,20 +1,18 @@ + +-# check for Poppler::PSConverter::setOutputDevice() ++# check for Poppler::FormFieldButton as "0.7 check" + set(CMAKE_REQUIRED_INCLUDES ${POPPLER_INCLUDE_DIR} ${QT_INCLUDE_DIR}) + set(CMAKE_REQUIRED_LIBRARIES ${POPPLER_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTXML_LIBRARY}) + check_cxx_source_compiles(" + #include ++#include + int main() + { +- Poppler::Document * doc = Poppler::Document::load(\"foo\"); +- Poppler::PSConverter * psconv = doc->psConverter(); +- psconv->setOutputDevice( 0 ); ++ Poppler::FormFieldButton * button = 0; ++ button->buttonType(); + return 0; + } +-" POPPLER_HAVE_PSCONVERTER_SETOUTPUTDEVICE) +-macro_bool_to_01(POPPLER_HAVE_PSCONVERTER_SETOUTPUTDEVICE _POPPLER_HAVE_PSCONVERTER_SETOUTPUTDEVICE) ++" HAVE_POPPLER_0_7) + +- + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/config-okular-poppler.h.cmake + ${CMAKE_CURRENT_BINARY_DIR}/config-okular-poppler.h diff --git a/kdegraphics.spec b/kdegraphics.spec index 209b9c2..2f59dfe 100644 --- a/kdegraphics.spec +++ b/kdegraphics.spec @@ -4,7 +4,7 @@ Summary: K Desktop Environment - Graphics Applications Epoch: 7 Version: 4.0.2 -Release: 3%{?dist} +Release: 4%{?dist} Name: kdegraphics Obsoletes: kdegraphics4 < %{version}-%{release} @@ -18,6 +18,11 @@ Source0: ftp://ftp.kde.org/pub/kde/unstable/%{version}/src/kdegraphics-%{ Patch0: kdegraphics-4.0.1-system-libspectre.patch # necessary CMakeLists.txt changes missing in the above commit Patch1: kdegraphics-4.0.1-system-libspectre-cmake.patch +# support for poppler 0.7 backported from the KDE 4.0 branch: +# http://websvn.kde.org/?view=rev&revision=784724 +# http://websvn.kde.org/?view=rev&revision=784736 +# (Older poppler versions are still supported, so no need to apply this conditionally.) +Patch2: kdegraphics-4.0.2-poppler07.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: kde-filesystem >= 4 @@ -91,6 +96,8 @@ rm -rf okular/generators/spectre/libspectre %patch1 -p1 %endif +%patch2 -p1 -b .poppler07 + %build @@ -166,6 +173,9 @@ rm -rf %{buildroot} %changelog +* Thu Mar 20 2008 Kevin Kofler 4.0.2-4 +- backport patch to support poppler 0.7 from KDE 4.0.3 + * Wed Mar 19 2008 Rex Dieter 4.0.2-3 - respin (poppler)