Browse Source

Add support fo Poppler >= 0.76

Follow Catalog::find_page argments change and GooList removal.

Signed-off-by: OBATA Akio <obache@wizdas.com>
pull/9/head
OBATA Akio 1 month ago
parent
commit
e7a848c7aa

+ 1
- 0
config.h.cmake View File

@@ -1,6 +1,7 @@
1 1
 #cmakedefine VERSION "@VERSION@"
2 2
 
3 3
 // poppler-tqt
4
+#cmakedefine HAVE_POPPLER_076
4 5
 #cmakedefine HAVE_POPPLER_072
5 6
 #cmakedefine HAVE_POPPLER_071
6 7
 #cmakedefine HAVE_POPPLER_070

+ 1
- 1
tdefile-plugins/dependencies/poppler-tqt/ConfigureChecks.cmake View File

@@ -24,7 +24,7 @@ check_cxx_source_compiles("
24 24
   HAVE_POPPLER_030 )
25 25
 tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
26 26
 
27
-foreach( _poppler_ver 0.58 0.64 0.70 0.71 0.72 )
27
+foreach( _poppler_ver 0.58 0.64 0.70 0.71 0.72 0.76 )
28 28
   string( REPLACE "." "" _poppler_str "${_poppler_ver}" )
29 29
   if( NOT DEFINED HAVE_POPPLER_${_poppler_str} )
30 30
     message( STATUS "Performing Test HAVE_POPPLER_${_poppler_str}" )

+ 22
- 11
tdefile-plugins/dependencies/poppler-tqt/poppler-document.cc View File

@@ -127,23 +127,34 @@ TQValueList<FontInfo> Document::fonts() const
127 127
 
128 128
 bool Document::scanForFonts( int numPages, TQValueList<FontInfo> *fontList ) const
129 129
 {
130
-  GooList *items = data->m_fontInfoScanner->scan( numPages );
130
+  FONTS_LIST_TYPE *items = data->m_fontInfoScanner->scan( numPages );
131 131
 
132 132
   if ( NULL == items )
133 133
     return false;
134 134
 
135
-  for ( int i = 0; i < items->getLength(); ++i ) {
135
+  for ( int i = 0; i < FONTS_LIST_LENGTH(items); ++i ) {
136 136
     TQString fontName;
137
-    if (((::FontInfo*)items->get(i))->getName())
138
-      fontName = ((::FontInfo*)items->get(i))->getName()->GOO_GET_CSTR();
137
+    ::FontInfo *fontInfo =
138
+#if defined(HAVE_POPPLER_076)
139
+      (*items)[i];
140
+#else
141
+      (::FontInfo*)items->get(i);
142
+#endif
143
+    if (fontInfo->getName())
144
+      fontName = fontInfo->getName()->GOO_GET_CSTR();
139 145
 
140 146
     FontInfo font(fontName,
141
-                  ((::FontInfo*)items->get(i))->getEmbedded(),
142
-                  ((::FontInfo*)items->get(i))->getSubset(),
143
-                  (Poppler::FontInfo::Type)((::FontInfo*)items->get(i))->getType());
147
+                  fontInfo->getEmbedded(),
148
+                  fontInfo->getSubset(),
149
+                  (Poppler::FontInfo::Type)(fontInfo->getType()));
144 150
     fontList->append(font);
145 151
   }
146
-# if defined(HAVE_POPPLER_070)
152
+# if defined(HAVE_POPPLER_076)
153
+  for (auto entry : *items) {
154
+    delete entry;
155
+  }
156
+  delete items;
157
+# elif defined(HAVE_POPPLER_070)
147 158
   deleteGooList<::FontInfo>(items);
148 159
 # else
149 160
   deleteGooList(items, ::FontInfo);
@@ -324,12 +335,12 @@ TQDomDocument *Document::toc() const
324 335
   if ( !outline )
325 336
     return NULL;
326 337
 
327
-  CONST_064 GooList * items = outline->getItems();
328
-  if ( !items || items->getLength() < 1 )
338
+  OUTLINE_ITEMS_TYPE * items = outline->getItems();
339
+  if ( !items || OUTLINE_ITEMS_LENGTH(items) < 1 )
329 340
     return NULL;
330 341
 
331 342
   TQDomDocument *toc = new TQDomDocument();
332
-  if ( items->getLength() > 0 )
343
+  if ( OUTLINE_ITEMS_LENGTH(items) > 0 )
333 344
     data->addTocChildren( toc, toc, items );
334 345
 
335 346
   return toc;

+ 1
- 1
tdefile-plugins/dependencies/poppler-tqt/poppler-link.cc View File

@@ -53,7 +53,7 @@ namespace Poppler {
53 53
 		else
54 54
 		{
55 55
 			Ref ref = ld->getPageRef();
56
-			m_pageNum = data.doc->doc.findPage( ref.num, ref.gen );
56
+			m_pageNum = data.doc->doc.findPage(FIND_PAGE_ARGS(ref));
57 57
 		}
58 58
 		double left = ld->getLeft();
59 59
 		double bottom = ld->getBottom();

+ 9
- 4
tdefile-plugins/dependencies/poppler-tqt/poppler-private.cc View File

@@ -86,13 +86,18 @@ GooString *TQStringToGooString(const TQString &s)
86 86
 }
87 87
 
88 88
 
89
-void DocumentData::addTocChildren( TQDomDocument * docSyn, TQDomNode * parent, CONST_064 GooList * items )
89
+void DocumentData::addTocChildren( TQDomDocument * docSyn, TQDomNode * parent, OUTLINE_ITEMS_TYPE * items )
90 90
 {
91
-    int numItems = items->getLength();
91
+    int numItems = OUTLINE_ITEMS_LENGTH(items);
92 92
     for ( int i = 0; i < numItems; ++i )
93 93
     {
94 94
         // iterate over every object in 'items'
95
-        OutlineItem * outlineItem = (OutlineItem *)items->get( i );
95
+        OutlineItem * outlineItem =
96
+#ifdef HAVE_POPPLER_076
97
+		(*items)[i];
98
+#else
99
+		(OutlineItem *)items->get( i );
100
+#endif
96 101
 
97 102
         // 1. create element using outlineItem's title as tagName
98 103
         TQString name;
@@ -138,7 +143,7 @@ void DocumentData::addTocChildren( TQDomDocument * docSyn, TQDomNode * parent, C
138 143
 
139 144
         // 3. recursively descend over children
140 145
         outlineItem->open();
141
-        CONST_064 GooList * children = outlineItem->getKids();
146
+        OUTLINE_ITEMS_TYPE * children = outlineItem->getKids();
142 147
         if ( children )
143 148
             addTocChildren( docSyn, &item, children );
144 149
     }

+ 16
- 1
tdefile-plugins/dependencies/poppler-tqt/poppler-private.h View File

@@ -49,6 +49,21 @@ class SplashOutputDev;
49 49
 #else
50 50
 #define GOO_GET_CSTR getCString
51 51
 #endif
52
+#if defined(HAVE_POPPLER_076)
53
+#include <vector>
54
+class OutlineItem;
55
+#define OUTLINE_ITEMS_TYPE const std::vector<OutlineItem*>
56
+#define OUTLINE_ITEMS_LENGTH(goo) goo->size()
57
+#define FONTS_LIST_TYPE std::vector<::FontInfo*>
58
+#define FONTS_LIST_LENGTH(goo) goo->size()
59
+#define FIND_PAGE_ARGS(ref)	ref
60
+#else
61
+#define OUTLINE_ITEMS_TYPE CONST_064 GooList
62
+#define OUTLINE_ITEMS_LENGTH(goo) goo->getLength()
63
+#define FONTS_LIST_TYPE GooList
64
+#define FONTS_LIST_LENGTH(goo) goo->getLength()
65
+#define FIND_PAGE_ARGS(ref)	ref.num, ref.gen
66
+#endif
52 67
 
53 68
 namespace Poppler {
54 69
     
@@ -99,7 +114,7 @@ class DocumentData {
99 114
         return m_outputDev;
100 115
     }
101 116
 
102
-    void addTocChildren( TQDomDocument * docSyn, TQDomNode * parent, CONST_064 GooList * items );
117
+    void addTocChildren( TQDomDocument * docSyn, TQDomNode * parent, OUTLINE_ITEMS_TYPE * items );
103 118
 
104 119
   class PDFDoc doc;
105 120
   bool locked;

Loading…
Cancel
Save