Fix the build with poppler-24.10.0.

Any objections?

Ciao,
        Kili

Index: patches/patch-scribus_plugins_import_pdf_slaoutput_cpp
===================================================================
RCS file: patches/patch-scribus_plugins_import_pdf_slaoutput_cpp
diff -N patches/patch-scribus_plugins_import_pdf_slaoutput_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-scribus_plugins_import_pdf_slaoutput_cpp      22 Oct 2024 
18:08:27 -0000
@@ -0,0 +1,76 @@
+Fix build with poppler-24.10.0. From upstream commits 26325 and 26327.
+
+Index: scribus/plugins/import/pdf/slaoutput.cpp
+--- scribus/plugins/import/pdf/slaoutput.cpp.orig
++++ scribus/plugins/import/pdf/slaoutput.cpp
+@@ -81,6 +81,8 @@ namespace
+       }
+ }
+ 
++#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(24, 10, 0)
++
+ LinkSubmitForm::LinkSubmitForm(Object *actionObj)
+ {
+       if (!actionObj->isDict())
+@@ -97,7 +99,7 @@ LinkSubmitForm::LinkSubmitForm(Object *actionObj)
+                       {
+                               Object obj2 = obj1.dictLookup("F");
+                               if (!obj2.isNull())
+-                                      fileName = obj2.getString()->copy();
++                                      m_url = obj2.getString()->copy();
+                       }
+               }
+       }
+@@ -108,9 +110,11 @@ LinkSubmitForm::LinkSubmitForm(Object *actionObj)
+ 
+ LinkSubmitForm::~LinkSubmitForm()
+ {
+-      delete fileName;
++      delete m_url;
+ }
+ 
++#endif
++
+ LinkImportData::LinkImportData(Object *actionObj)
+ {
+       if (!actionObj->isDict())
+@@ -1078,6 +1082,30 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotW
+                               }
+                       }
+               }
++              else if (Lact->getKind() == actionResetForm)
++              {
++                      ite->annotation().setActionType(4);
++              }
++#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(24, 10, 0)
++              else if (Lact->getKind() == actionSubmitForm)
++              {
++                      const auto* impo = (LinkSubmitForm*) Lact;
++                      if (impo->isOk())
++                      {
++                              ite->annotation().setActionType(3);
++                              
ite->annotation().setAction(UnicodeParsedString(impo->getUrl()));
++                              int fl = impo->getFlags();
++                              if (fl == 0)
++                                      ite->annotation().setHTML(0);
++                              else if (fl == 4)
++                                      ite->annotation().setHTML(1);
++                              else if (fl == 64)
++                                      ite->annotation().setHTML(2);
++                              else if (fl == 512)
++                                      ite->annotation().setHTML(3);
++                      }
++              }
++#endif
+               else if (Lact->getKind() == actionUnknown)
+               {
+                       auto *uno = (LinkUnknown*) Lact;
+@@ -1106,7 +1134,7 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotW
+                                               if (impo->isOk())
+                                               {
+                                                       
ite->annotation().setActionType(3);
+-                                                      
ite->annotation().setAction(UnicodeParsedString(impo->getFileName()));
++                                                      
ite->annotation().setAction(UnicodeParsedString(impo->getUrl()));
+                                                       int fl = 
impo->getFlags();
+                                                       if (fl == 0)
+                                                               
ite->annotation().setHTML(0);
Index: patches/patch-scribus_plugins_import_pdf_slaoutput_h
===================================================================
RCS file: patches/patch-scribus_plugins_import_pdf_slaoutput_h
diff -N patches/patch-scribus_plugins_import_pdf_slaoutput_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-scribus_plugins_import_pdf_slaoutput_h        22 Oct 2024 
18:08:27 -0000
@@ -0,0 +1,40 @@
+Fix build with poppler-24.10.0. From upstream commits 26325 and 26327.
+
+Index: scribus/plugins/import/pdf/slaoutput.h
+--- scribus/plugins/import/pdf/slaoutput.h.orig
++++ scribus/plugins/import/pdf/slaoutput.h
+@@ -56,9 +56,11 @@ for which a new license (GPL+exception) is in place.
+ #include <poppler/splash/SplashGlyphBitmap.h>
+ 
+ //------------------------------------------------------------------------
+-// LinkSubmitData
++// LinkSubmitForm
+ //------------------------------------------------------------------------
+ 
++#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(24, 10, 0)
++
+ class LinkSubmitForm: public LinkAction
+ {
+ public:
+@@ -68,16 +70,18 @@ class LinkSubmitForm: public LinkAction (public)
+       virtual ~LinkSubmitForm();
+ 
+       // Was the LinkImportData created successfully?
+-      GBool isOk() POPPLER_CONST override { return fileName != nullptr; }
++      GBool isOk() POPPLER_CONST override { return m_url != nullptr; }
+       // Accessors.
+       LinkActionKind getKind() POPPLER_CONST override { return actionUnknown; 
}
+-      GooString *getFileName() { return fileName; }
++      GooString *getFileName() { return m_url; }
+       int getFlags() { return m_flags; }
+ 
+ private:
+-      GooString *fileName {nullptr};          // file name
++      GooString *m_url {nullptr};             // URL
+       int m_flags {0};
+ };
++
++#endif
+ 
+ //------------------------------------------------------------------------
+ // LinkImportData

Reply via email to