r22703 by jghali - Fix failure to build PDF import plugin with poppler 0.69

scribus-commit scribus-commit at lists.scribus.net
Sat Sep 22 23:11:15 UTC 2018


Author: jghali
Date: Sat Sep 22 23:11:15 2018
New Revision: 22703

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22703
Log:
Fix failure to build PDF import plugin with poppler 0.69

Modified:
    trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp

Modified: trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22703&path=/trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp	Sat Sep 22 23:11:15 2018
@@ -548,10 +548,21 @@
 									}
 									else
 									{
-										GooList *ocgs;
-										int i;
-										ocgs = ocg->getOCGs ();
-										for (i = 0; i < ocgs->getLength (); ++i)
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 69, 0)
+										const auto& ocgs = ocg->getOCGs ();
+										for (const auto& ocg : ocgs)
+										{
+											OptionalContentGroup *oc = ocg.second.get();
+											QString ocgName = UnicodeParsedString(oc->getName());
+											if (!ocgNames.contains(ocgName))
+											{
+												ocgGroups.prepend(oc);
+												ocgNames.append(ocgName);
+											}
+										}
+#else
+										GooList *ocgs = ocg->getOCGs ();
+										for (int i = 0; i < ocgs->getLength (); ++i)
 										{
 											OptionalContentGroup *oc = (OptionalContentGroup *)ocgs->get(i);
 											QString ocgName = UnicodeParsedString(oc->getName());
@@ -561,15 +572,27 @@
 												ocgNames.append(ocgName);
 											}
 										}
+#endif
 									}
 								}
 							}
 							else
 							{
-								GooList *ocgs;
-								int i;
-								ocgs = ocg->getOCGs ();
-								for (i = 0; i < ocgs->getLength (); ++i)
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 69, 0)
+								const auto& ocgs = ocg->getOCGs ();
+								for (const auto& ocg : ocgs)
+								{
+									OptionalContentGroup *oc = ocg.second.get();
+									QString ocgName = UnicodeParsedString(oc->getName());
+									if (!ocgNames.contains(ocgName))
+									{
+										ocgGroups.prepend(oc);
+										ocgNames.append(ocgName);
+									}
+								}
+#else
+								GooList *ocgs = ocg->getOCGs ();
+								for (int i = 0; i < ocgs->getLength (); ++i)
 								{
 									OptionalContentGroup *oc = (OptionalContentGroup *)ocgs->get(i);
 									QString ocgName = UnicodeParsedString(oc->getName());
@@ -579,6 +602,7 @@
 										ocgNames.append(ocgName);
 									}
 								}
+#endif
 							}
 						}
 					}




More information about the scribus-commit mailing list