rpms/kdegraphics/devel kdegraphics-4.0.2-poppler07.patch,NONE,1.1
Kevin Kofler (kkofler)
fedora-extras-commits at redhat.com
Thu Mar 20 00:24:24 UTC 2008
Author: kkofler
Update of /cvs/pkgs/rpms/kdegraphics/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv15389/devel
Added Files:
kdegraphics-4.0.2-poppler07.patch
Log Message:
* Thu Mar 20 2008 Kevin Kofler <Kevin at tigcc.ticalc.org> 4.0.2-4
- backport patch to support poppler 0.7 from KDE 4.0.3
kdegraphics-4.0.2-poppler07.patch:
--- NEW FILE kdegraphics-4.0.2-poppler07.patch ---
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 <tsdgeos at terra.es> *
+ * Copyright (C) 2004-2008 by Albert Astals Cid <tsdgeos at terra.es> *
* Copyright (C) 2004 by Enrico Ros <eros.kde at email.it> *
* *
* 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<Poppler::TextBox*> textList = p->textList();
+#else
QList<Poppler::TextBox*> 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<Poppler::TextBox*> textList = pp->textList();
+#else
QList<Poppler::TextBox*> 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 <poppler-qt4.h>
+#include <poppler-form.h>
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
More information about the fedora-extras-commits
mailing list