summarylogtreecommitdiffstats
path: root/fix-15289-2.patch
blob: 8e5d65a270d52f09530c6305b53c15956a8fbf3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
From 7d4ceeb5cac32287769e3c0238699e0b3e56c24d Mon Sep 17 00:00:00 2001
From: Jean Ghali <jghali@libertysurf.fr>
Date: Wed, 2 May 2018 14:22:50 +0000
Subject: [PATCH] #15289: FTBFS when using poppler 0.64.0

git-svn-id: svn://scribus.net/trunk/Scribus@22513 11d20701-8431-0410-a711-e3c959e3b870
---
 scribus/plugins/import/pdf/slaoutput.cpp | 42 +++++++++++++++++---------------
 scribus/plugins/import/pdf/slaoutput.h   | 26 +++++++++++++++-----
 2 files changed, 42 insertions(+), 26 deletions(-)

diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp
index 257deb30c6..96847508ba 100644
--- a/scribus/plugins/import/pdf/slaoutput.cpp
+++ b/scribus/plugins/import/pdf/slaoutput.cpp
@@ -6,7 +6,7 @@ for which a new license (GPL+exception) is in place.
 */
 
 #include "slaoutput.h"
-#include <poppler/cpp/poppler-version.h>
+
 #include <poppler/GlobalParams.h>
 #include <poppler/poppler-config.h>
 #include <poppler/FileSpec.h>
@@ -20,12 +20,6 @@ for which a new license (GPL+exception) is in place.
 #include "util_math.h"
 #include <tiffio.h>
 
-#define POPPLER_VERSION_ENCODE(major, minor, micro) (	\
-	  ((major) * 10000)				\
-	+ ((minor) *   100)				\
-	+ ((micro) *     1))
-#define POPPLER_ENCODED_VERSION POPPLER_VERSION_ENCODE(POPPLER_VERSION_MAJOR, POPPLER_VERSION_MINOR, POPPLER_VERSION_MICRO)
-
 LinkSubmitForm::LinkSubmitForm(Object *actionObj)
 {
 	Object obj1, obj2, obj3;
@@ -44,7 +38,7 @@ LinkSubmitForm::LinkSubmitForm(Object *actionObj)
 				{
 					if (obj3.isName())
 					{
-						char *name = obj3.getName();
+						POPPLER_CONST char *name = obj3.getName();
 						if (!strcmp(name, "URL"))
 						{
 							obj2 = obj1.dictLookup("F");
@@ -508,8 +502,8 @@ bool SlaOutputDev::handleLinkAnnot(Annot* annota, double xCoor, double yCoor, do
 	QString fileName = "";
 	if (act->getKind() == actionGoTo)
 	{
-		LinkGoTo *gto = (LinkGoTo*)act;
-		LinkDest *dst = gto->getDest();
+		LinkGoTo *gto = (LinkGoTo*) act;
+		POPPLER_CONST LinkDest *dst = gto->getDest();
 		if (dst)
 		{
 			if (dst->getKind() == destXYZ)
@@ -528,7 +522,7 @@ bool SlaOutputDev::handleLinkAnnot(Annot* annota, double xCoor, double yCoor, do
 		}
 		else
 		{
-			GooString *ndst = gto->getNamedDest();
+			POPPLER_CONST GooString *ndst = gto->getNamedDest();
 			if (ndst)
 			{
 				LinkDest *dstn = pdfDoc->findDest(ndst);
@@ -555,7 +549,7 @@ bool SlaOutputDev::handleLinkAnnot(Annot* annota, double xCoor, double yCoor, do
 	{
 		LinkGoToR *gto = (LinkGoToR*)act;
 		fileName = UnicodeParsedString(gto->getFileName());
-		LinkDest *dst = gto->getDest();
+		POPPLER_CONST LinkDest *dst = gto->getDest();
 		if (dst)
 		{
 			if (dst->getKind() == destXYZ)
@@ -568,7 +562,7 @@ bool SlaOutputDev::handleLinkAnnot(Annot* annota, double xCoor, double yCoor, do
 		}
 		else
 		{
-			GooString *ndst = gto->getNamedDest();
+			POPPLER_CONST GooString *ndst = gto->getNamedDest();
 			if (ndst)
 			{
 				LinkDest *dstn = pdfDoc->findDest(ndst);
@@ -709,7 +703,7 @@ bool SlaOutputDev::handleWidgetAnnot(Annot* annota, double xCoor, double yCoor,
 			bool bgFound = false;
 			if (achar)
 			{
-				AnnotColor *bgCol = achar->getBackColor();
+				POPPLER_CONST AnnotColor *bgCol = achar->getBackColor();
 				if (bgCol)
 				{
 					bgFound = true;
@@ -717,7 +711,7 @@ bool SlaOutputDev::handleWidgetAnnot(Annot* annota, double xCoor, double yCoor,
 				}
 				else
 					CurrColorFill = CommonStrings::None;
-				AnnotColor *fgCol = achar->getBorderColor();
+				POPPLER_CONST AnnotColor *fgCol = achar->getBorderColor();
 				if (fgCol)
 				{
 					fgFound = true;
@@ -1054,7 +1048,7 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano)
 			int xco = 0;
 			int yco = 0;
 			LinkGoTo *gto = (LinkGoTo*)Lact;
-			LinkDest *dst = gto->getDest();
+			POPPLER_CONST LinkDest *dst = gto->getDest();
 			if (dst)
 			{
 				if (dst->getKind() == destXYZ)
@@ -1075,7 +1069,7 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano)
 			}
 			else
 			{
-				GooString *ndst = gto->getNamedDest();
+				POPPLER_CONST GooString *ndst = gto->getNamedDest();
 				if (ndst)
 				{
 					LinkDest *dstn = pdfDoc->findDest(ndst);
@@ -1107,7 +1101,7 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano)
 			int yco = 0;
 			LinkGoToR *gto = (LinkGoToR*)Lact;
 			QString fileName = UnicodeParsedString(gto->getFileName());
-			LinkDest *dst = gto->getDest();
+			POPPLER_CONST LinkDest *dst = gto->getDest();
 			if (dst)
 			{
 				if (dst->getKind() == destXYZ)
@@ -1123,7 +1117,7 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano)
 			}
 			else
 			{
-				GooString *ndst = gto->getNamedDest();
+				POPPLER_CONST GooString *ndst = gto->getNamedDest();
 				if (ndst)
 				{
 					LinkDest *dstn = pdfDoc->findDest(ndst);
@@ -3001,6 +2995,14 @@ void SlaOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int widt
 	if ((mm.type() == QTransform::TxShear) || (mm.type() == QTransform::TxRotate))
 	{
 		ite->setImageRotation(-tline.angle());
+		/*QTransform rotMat;
+		rotMat.rotate(tline.angle());
+		QTransform imgMat = m_ctm * rotMat.inverted();
+		double scaleX = sqrt(imgMat.m11() * imgMat.m11() + imgMat.m12() * imgMat.m12());
+		double scaleY = sqrt(imgMat.m21() * imgMat.m21() + imgMat.m22() * imgMat.m22());
+		imgMat.scale(1.0 / scaleX, 1.0 / scaleY);
+		if (!imgMat.isIdentity())
+			img = img.transformed(imgMat);*/
 	}
 	else
 	{
@@ -4031,7 +4033,7 @@ QString SlaOutputDev::getColor(GfxColorSpace *color_space, GfxColor *color, int
 	return fNam;
 }
 
-QString SlaOutputDev::getAnnotationColor(AnnotColor *color)
+QString SlaOutputDev::getAnnotationColor(const AnnotColor *color)
 {
 	QString fNam;
 	QString namPrefix = "FromPDF";
diff --git a/scribus/plugins/import/pdf/slaoutput.h b/scribus/plugins/import/pdf/slaoutput.h
index 6698c030e0..7317cae210 100644
--- a/scribus/plugins/import/pdf/slaoutput.h
+++ b/scribus/plugins/import/pdf/slaoutput.h
@@ -26,6 +26,7 @@ for which a new license (GPL+exception) is in place.
 #include "selection.h"
 #include "vgradient.h"
 
+#include <poppler/cpp/poppler-version.h>
 #include <poppler/goo/gtypes.h>
 #include <poppler/Object.h>
 #include <poppler/OutputDev.h>
@@ -49,6 +50,18 @@ for which a new license (GPL+exception) is in place.
 #include <poppler/splash/SplashPath.h>
 #include <poppler/splash/SplashGlyphBitmap.h>
 
+#define POPPLER_VERSION_ENCODE(major, minor, micro) (	\
+	  ((major) * 10000)				\
+	+ ((minor) *   100)				\
+	+ ((micro) *     1))
+#define POPPLER_ENCODED_VERSION POPPLER_VERSION_ENCODE(POPPLER_VERSION_MAJOR, POPPLER_VERSION_MINOR, POPPLER_VERSION_MICRO)
+
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 64, 0)
+#define POPPLER_CONST const
+#else
+#define POPPLER_CONST
+#endif
+
 //------------------------------------------------------------------------
 // LinkSubmitData
 //------------------------------------------------------------------------
@@ -61,9 +74,9 @@ class LinkSubmitForm: public LinkAction
 	// Destructor.
 	virtual ~LinkSubmitForm();
 	// Was the LinkImportData created successfully?
-	virtual GBool isOk() { return fileName != NULL; }
+	virtual GBool isOk() POPPLER_CONST { return fileName != NULL; }
 	// Accessors.
-	virtual LinkActionKind getKind() { return actionUnknown; }
+	virtual LinkActionKind getKind() POPPLER_CONST { return actionUnknown; }
 	GooString *getFileName() { return fileName; }
 	int getFlags() { return m_flags; }
 private:
@@ -83,9 +96,9 @@ class LinkImportData: public LinkAction
 	// Destructor.
 	virtual ~LinkImportData();
 	// Was the LinkImportData created successfully?
-	virtual GBool isOk() { return fileName != NULL; }
+	virtual GBool isOk() POPPLER_CONST { return fileName != NULL; }
 	// Accessors.
-	virtual LinkActionKind getKind() { return actionUnknown; }
+	virtual LinkActionKind getKind() POPPLER_CONST { return actionUnknown; }
 	GooString *getFileName() { return fileName; }
 private:
 	GooString *fileName;		// file name
@@ -98,7 +111,7 @@ class SplashOutFontFileID: public SplashFontFileID
 {
 public:
 
-	SplashOutFontFileID(Ref *rA) { r = *rA; }
+	SplashOutFontFileID(const Ref *rA) { r = *rA; }
 	~SplashOutFontFileID() {}
 	GBool matches(SplashFontFileID *id)
 	{
@@ -146,6 +159,7 @@ class SlaOutputDev : public OutputDev
 public:
 	SlaOutputDev(ScribusDoc* doc, QList<PageItem*> *Elements, QStringList *importedColors, int flags);
 	virtual ~SlaOutputDev();
+
 	LinkAction* SC_getAction(AnnotWidget *ano);
 	LinkAction* SC_getAdditionalAction(const char *key, AnnotWidget *ano);
 	static GBool annotations_callback(Annot *annota, void *user_data);
@@ -261,7 +275,7 @@ class SlaOutputDev : public OutputDev
 private:
 	void getPenState(GfxState *state);
 	QString getColor(GfxColorSpace *color_space, GfxColor *color, int *shade);
-	QString getAnnotationColor(AnnotColor *color);
+	QString getAnnotationColor(const AnnotColor *color);
 	QString convertPath(GfxPath *path);
 	int getBlendMode(GfxState *state);
 	void applyMask(PageItem *ite);