[poppler] 4 commits - qt4/src

Pino Toscano pino at kemper.freedesktop.org
Thu Feb 7 16:39:35 PST 2008


 qt4/src/CMakeLists.txt                   |    1 
 qt4/src/Makefile.am                      |    1 
 qt4/src/poppler-document.cc              |   11 ---
 qt4/src/poppler-embeddedfile.cc          |    3 
 qt4/src/poppler-form.cc                  |   19 ------
 qt4/src/poppler-link-extractor-private.h |    2 
 qt4/src/poppler-link-extractor.cc        |    7 +-
 qt4/src/poppler-page-private.h           |    6 +
 qt4/src/poppler-private.cc               |   95 +++++++++++++++++++++++++++++++
 qt4/src/poppler-private.h                |   52 +++-------------
 qt4/src/poppler-qt4.h                    |    2 
 qt4/src/poppler-sound.cc                 |    4 -
 12 files changed, 126 insertions(+), 77 deletions(-)

New commits:
commit 1aeba15b5eb9b30943259824678ebc9e4f56e870
Merge: a489063... 22d10c1...
Author: Pino Toscano <pino at kde.org>
Date:   Fri Feb 8 01:39:16 2008 +0100

    Merge branch 'master' of ssh://pino@git.freedesktop.org/git/poppler/poppler

commit a4890637a2c2ab1623311d9a6920e82131c2597c
Author: Pino Toscano <pino at kde.org>
Date:   Fri Feb 8 01:36:56 2008 +0100

    Move QStringToUnicodeGooString() and QStringToGooString() to the private module.

diff --git a/qt4/src/poppler-document.cc b/qt4/src/poppler-document.cc
index 428a2cc..f5f3c90 100644
--- a/qt4/src/poppler-document.cc
+++ b/qt4/src/poppler-document.cc
@@ -35,16 +35,6 @@
 
 namespace Poppler {
 
-  static GooString *QStringToGooString(const QString &s) {
-      int len = s.length();
-      char *cstring = (char *)gmallocn(s.length(), sizeof(char));
-      for (int i = 0; i < len; ++i)
-        cstring[i] = s.at(i).unicode();
-      GooString *ret = new GooString(cstring, len);
-      gfree(cstring);
-      return ret;
-  }
-
   int DocumentData::count = 0;
 
   Document *Document::load(const QString &filePath, const QByteArray &ownerPassword,
diff --git a/qt4/src/poppler-form.cc b/qt4/src/poppler-form.cc
index 50750f0..7f90840 100644
--- a/qt4/src/poppler-form.cc
+++ b/qt4/src/poppler-form.cc
@@ -31,21 +31,6 @@
 
 namespace Poppler {
 
-static GooString *QStringToUnicodeGooString(const QString &s) {
-    int len = s.length() * 2 + 2;
-    char *cstring = (char *)gmallocn(len, sizeof(char));
-    cstring[0] = 0xfe;
-    cstring[1] = 0xff;
-    for (int i = 0; i < s.length(); ++i)
-    {
-      cstring[2+i*2] = s.at(i).row();
-      cstring[3+i*2] = s.at(i).cell();
-    }
-    GooString *ret = new GooString(cstring, len);
-    gfree(cstring);
-    return ret;
-}
-
 FormField::FormField(FormFieldData &dd)
   : m_formData(&dd)
 {
diff --git a/qt4/src/poppler-private.cc b/qt4/src/poppler-private.cc
index e56b797..7d4458a 100644
--- a/qt4/src/poppler-private.cc
+++ b/qt4/src/poppler-private.cc
@@ -67,4 +67,29 @@ namespace Poppler {
         }
         return result;
     }
+
+    GooString *QStringToUnicodeGooString(const QString &s) {
+        int len = s.length() * 2 + 2;
+        char *cstring = (char *)gmallocn(len, sizeof(char));
+        cstring[0] = 0xfe;
+        cstring[1] = 0xff;
+        for (int i = 0; i < s.length(); ++i)
+        {
+            cstring[2+i*2] = s.at(i).row();
+            cstring[3+i*2] = s.at(i).cell();
+        }
+        GooString *ret = new GooString(cstring, len);
+        gfree(cstring);
+        return ret;
+    }
+
+    GooString *QStringToGooString(const QString &s) {
+        int len = s.length();
+        char *cstring = (char *)gmallocn(s.length(), sizeof(char));
+        for (int i = 0; i < len; ++i)
+            cstring[i] = s.at(i).unicode();
+        GooString *ret = new GooString(cstring, len);
+        gfree(cstring);
+        return ret;
+    }
 }
diff --git a/qt4/src/poppler-private.h b/qt4/src/poppler-private.h
index 222cd6e..27a4b6f 100644
--- a/qt4/src/poppler-private.h
+++ b/qt4/src/poppler-private.h
@@ -49,6 +49,10 @@ namespace Poppler {
 
     QString UnicodeParsedString(GooString *s1);
 
+    GooString *QStringToUnicodeGooString(const QString &s);
+
+    GooString *QStringToGooString(const QString &s);
+
 
     class LinkDestinationData
     {
commit 5e44241c4976b819f7be6badd2d183fbfb8ee6de
Author: Pino Toscano <pino at kde.org>
Date:   Fri Feb 8 01:30:07 2008 +0100

    Move the string functions implementation in a .cc file.

diff --git a/qt4/src/CMakeLists.txt b/qt4/src/CMakeLists.txt
index 31a31fa..29ef8e5 100644
--- a/qt4/src/CMakeLists.txt
+++ b/qt4/src/CMakeLists.txt
@@ -17,6 +17,7 @@ set(poppler_qt4_SRCS
   poppler-page.cc
   poppler-base-converter.cc
   poppler-pdf-converter.cc
+  poppler-private.cc
   poppler-ps-converter.cc
   poppler-qiodeviceoutstream.cc
   poppler-sound.cc
diff --git a/qt4/src/Makefile.am b/qt4/src/Makefile.am
index f8b3e68..abf756d 100644
--- a/qt4/src/Makefile.am
+++ b/qt4/src/Makefile.am
@@ -32,6 +32,7 @@ libpoppler_qt4_la_SOURCES =			\
 	poppler-ps-converter.cc			\
 	poppler-pdf-converter.cc		\
 	poppler-qiodeviceoutstream.cc		\
+	poppler-private.cc			\
 	poppler-annotation-helper.h		\
 	poppler-page-private.h			\
 	poppler-link-extractor-private.h	\
diff --git a/qt4/src/poppler-private.cc b/qt4/src/poppler-private.cc
new file mode 100644
index 0000000..e56b797
--- /dev/null
+++ b/qt4/src/poppler-private.cc
@@ -0,0 +1,70 @@
+/* poppler-private.cc: qt interface to poppler
+ * Copyright (C) 2005, Net Integration Technologies, Inc.
+ * Copyright (C) 2006 by Albert Astals Cid <aacid at kde.org>
+ * Inspired on code by
+ * Copyright (C) 2004 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
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "poppler-private.h"
+
+namespace Poppler {
+
+    QString unicodeToQString(Unicode* u, int len) {
+        QString ret;
+        ret.resize(len);
+        QChar* qch = (QChar*) ret.unicode();
+        for (;len;--len)
+          *qch++ = (QChar) *u++;
+        return ret;
+    }
+
+    QString UnicodeParsedString(GooString *s1) {
+        if ( !s1 || s1->getLength() == 0 )
+            return QString();
+
+        GBool isUnicode;
+        int i;
+        Unicode u;
+        QString result;
+        if ( ( s1->getChar(0) & 0xff ) == 0xfe && ( s1->getLength() > 1 && ( s1->getChar(1) & 0xff ) == 0xff ) )
+        {
+            isUnicode = gTrue;
+            i = 2;
+        }
+        else
+        {
+            isUnicode = gFalse;
+            i = 0;
+        }
+        while ( i < s1->getLength() )
+        {
+            if ( isUnicode )
+            {
+                u = ( ( s1->getChar(i) & 0xff ) << 8 ) | ( s1->getChar(i+1) & 0xff );
+                i += 2;
+            }
+            else
+            {
+                u = s1->getChar(i) & 0xff;
+                ++i;
+            }
+            result += unicodeToQString( &u, 1 );
+        }
+        return result;
+    }
+}
diff --git a/qt4/src/poppler-private.h b/qt4/src/poppler-private.h
index 658dc30..222cd6e 100644
--- a/qt4/src/poppler-private.h
+++ b/qt4/src/poppler-private.h
@@ -38,54 +38,16 @@
 #include <SplashOutputDev.h>
 #endif
 
+#include "poppler-qt4.h"
+
 class FormWidget;
 
 namespace Poppler {
 
     /* borrowed from kpdf */
-    static QString unicodeToQString(Unicode* u, int len) {
-        QString ret;
-        ret.resize(len);
-        QChar* qch = (QChar*) ret.unicode();
-        for (;len;--len)
-          *qch++ = (QChar) *u++;
-        return ret;
-    }
-
-    static QString UnicodeParsedString(GooString *s1) {
-        if ( !s1 || s1->getLength() == 0 )
-            return QString();
+    QString unicodeToQString(Unicode* u, int len);
 
-        GBool isUnicode;
-        int i;
-        Unicode u;
-        QString result;
-        if ( ( s1->getChar(0) & 0xff ) == 0xfe && ( s1->getLength() > 1 && ( s1->getChar(1) & 0xff ) == 0xff ) )
-        {
-            isUnicode = gTrue;
-            i = 2;
-        }
-        else
-        {
-            isUnicode = gFalse;
-            i = 0;
-        }
-        while ( i < s1->getLength() )
-        {
-            if ( isUnicode )
-            {
-                u = ( ( s1->getChar(i) & 0xff ) << 8 ) | ( s1->getChar(i+1) & 0xff );
-                i += 2;
-            }
-            else
-            {
-                u = s1->getChar(i) & 0xff;
-                ++i;
-            }
-            result += unicodeToQString( &u, 1 );
-        }
-        return result;
-    }
+    QString UnicodeParsedString(GooString *s1);
 
 
     class LinkDestinationData
commit 124d92139241ad95da559d22af48254b45ac4a2e
Author: Pino Toscano <pino at kde.org>
Date:   Fri Feb 8 01:07:43 2008 +0100

    Include own header first, remove extra includes.

diff --git a/qt4/src/poppler-document.cc b/qt4/src/poppler-document.cc
index 65520e6..428a2cc 100644
--- a/qt4/src/poppler-document.cc
+++ b/qt4/src/poppler-document.cc
@@ -29,7 +29,6 @@
 
 #include <QtCore/QDebug>
 #include <QtCore/QFile>
-#include <QtGui/QImage>
 #include <QtCore/QByteArray>
 
 #include "poppler-private.h"
diff --git a/qt4/src/poppler-embeddedfile.cc b/qt4/src/poppler-embeddedfile.cc
index 190418c..5761c46 100644
--- a/qt4/src/poppler-embeddedfile.cc
+++ b/qt4/src/poppler-embeddedfile.cc
@@ -17,6 +17,8 @@
  * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+#include "poppler-qt4.h"
+
 #include <QtCore/QString>
 #include <QtCore/QDateTime>
 
@@ -24,7 +26,6 @@
 #include "Stream.h"
 #include "Catalog.h"
 
-#include "poppler-qt4.h"
 #include "poppler-private.h"
 
 namespace Poppler
diff --git a/qt4/src/poppler-form.cc b/qt4/src/poppler-form.cc
index 7d86b02..50750f0 100644
--- a/qt4/src/poppler-form.cc
+++ b/qt4/src/poppler-form.cc
@@ -16,8 +16,10 @@
  * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#include <poppler-qt4.h>
+#include "poppler-qt4.h"
+
 #include <QtCore/QSizeF>
+
 #include <Form.h>
 #include <Object.h>
 
diff --git a/qt4/src/poppler-link-extractor-private.h b/qt4/src/poppler-link-extractor-private.h
index ba6b0fc..03d93e0 100644
--- a/qt4/src/poppler-link-extractor-private.h
+++ b/qt4/src/poppler-link-extractor-private.h
@@ -19,6 +19,7 @@
 #ifndef _POPPLER_LINK_EXTRACTOR_H_
 #define _POPPLER_LINK_EXTRACTOR_H_
 
+#include <Object.h>
 #include <OutputDev.h>
 
 #include <QtCore/QList>
@@ -26,6 +27,7 @@
 namespace Poppler
 {
 
+class Link;
 class PageData;
 
 class LinkExtractorOutputDev : public OutputDev
diff --git a/qt4/src/poppler-link-extractor.cc b/qt4/src/poppler-link-extractor.cc
index 101f62f..bcce8cd 100644
--- a/qt4/src/poppler-link-extractor.cc
+++ b/qt4/src/poppler-link-extractor.cc
@@ -16,12 +16,15 @@
  * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+#include "poppler-link-extractor-private.h"
+
+#include <GfxState.h>
+#include <Link.h>
 #include <Object.h>
+#include <Page.h>
 
 #include "poppler-qt4.h"
-#include "poppler-link-extractor-private.h"
 #include "poppler-page-private.h"
-#include "poppler-private.h"
 
 namespace Poppler
 {
diff --git a/qt4/src/poppler-page-private.h b/qt4/src/poppler-page-private.h
index 1545790..dd79306 100644
--- a/qt4/src/poppler-page-private.h
+++ b/qt4/src/poppler-page-private.h
@@ -19,13 +19,17 @@
 #ifndef _POPPLER_PAGE_PRIVATE_H_
 #define _POPPLER_PAGE_PRIVATE_H_
 
-#include "poppler-private.h"
+class QRectF;
 
+class LinkAction;
 class Page;
 
 namespace Poppler
 {
 
+class DocumentData;
+class PageTransition;
+
 class PageData {
 public:
   Link* convertLinkActionToLink(::LinkAction * a, const QRectF &linkArea);
diff --git a/qt4/src/poppler-private.h b/qt4/src/poppler-private.h
index 3c46e58..658dc30 100644
--- a/qt4/src/poppler-private.h
+++ b/qt4/src/poppler-private.h
@@ -23,6 +23,9 @@
 #ifndef _POPPLER_PRIVATE_H_
 #define _POPPLER_PRIVATE_H_
 
+#include <QtCore/QVariant>
+#include <QtCore/QVector>
+
 #include <config.h>
 #include <GfxState.h>
 #include <GlobalParams.h>
@@ -34,7 +37,6 @@
 #if defined(HAVE_SPLASH)
 #include <SplashOutputDev.h>
 #endif
-#include <QtCore/QVariant>
 
 class FormWidget;
 
diff --git a/qt4/src/poppler-qt4.h b/qt4/src/poppler-qt4.h
index 8714344..7ab3a32 100644
--- a/qt4/src/poppler-qt4.h
+++ b/qt4/src/poppler-qt4.h
@@ -27,8 +27,6 @@
 #include <QtCore/QByteArray>
 #include <QtCore/QDateTime>
 #include <QtCore/QSet>
-#include <QtCore/QVector>
-#include <QtGui/QPixmap>
 #include <QtXml/QDomDocument>
 
 class EmbFile;
diff --git a/qt4/src/poppler-sound.cc b/qt4/src/poppler-sound.cc
index f858080..b2e9838 100644
--- a/qt4/src/poppler-sound.cc
+++ b/qt4/src/poppler-sound.cc
@@ -16,12 +16,12 @@
  * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+#include "poppler-qt4.h"
+
 #include "Object.h"
 #include "Stream.h"
 #include "Sound.h"
 
-#include "poppler-qt4.h"
-
 namespace Poppler
 {
 


More information about the poppler mailing list