[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - 2 commits - external/redland filter/source

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Wed Aug 7 21:29:39 UTC 2019


 external/redland/ExternalProject_raptor.mk |    2 
 filter/source/pdf/impdialog.cxx            |  123 ++++++++++++-----------------
 filter/source/pdf/impdialog.hxx            |    4 
 filter/source/pdf/pdfexport.cxx            |    5 -
 4 files changed, 57 insertions(+), 77 deletions(-)

New commits:
commit 76fcd878da1624e73f1eb9d9405485d4faf66edf
Author:     Jan-Marek Glogowski <jan-marek.glogowski at extern.cib.de>
AuthorDate: Wed Jul 31 18:48:30 2019 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Wed Aug 7 23:29:09 2019 +0200

    tdf#126642 always allow PDF/A form export
    
    This generally enables form export for PDF/A. A major problem was
    the saved user setting for UseTaggedPDF, which was overridden by
    the PDF/A export and used to be stored in the user config. At this
    point it was impossible to actually restore the user config for
    the next export, because it contained the overwritten PDF/A value.
    
    So this now guarantees that the user selection is stored, which
    means the underlying filter reading the config has to ignore
    the users UseTaggedPDF setting for PDF/A, which is happening in
    any way. That way it is possible to correctly restore the previous
    user selection after unchecking the PDF/A option.
    
    And the "Create form" frame is kept sensitive, just based on the
    "Create form" checkbox.
    
    Change-Id: I29162b423b2d8de77f549fdaabf0aefebcefa124
    Reviewed-on: https://gerrit.libreoffice.org/76765
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit c864d894a90141f6d73ed80c1035909986b17074)
    Reviewed-on: https://gerrit.libreoffice.org/77092

diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index 14738ff2e723..e19df5f9e0d7 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -72,6 +72,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, Sequence< PropertyValue
     mbReduceImageResolution( false ),
     mnMaxImageResolution( 300 ),
     mbUseTaggedPDF( false ),
+    mbUseTaggedPDFUserSelection( false ),
     mbExportNotes( true ),
     mbViewPDF( false ),
     mbUseReferenceXObject( false ),
@@ -183,7 +184,10 @@ ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, Sequence< PropertyValue
     mbReduceImageResolution = maConfigItem.ReadBool( "ReduceImageResolution", false );
     mnMaxImageResolution = maConfigItem.ReadInt32( "MaxImageResolution", 300 );
 
+    // this is always the user selection, independent from the PDF/A forced selection
     mbUseTaggedPDF = maConfigItem.ReadBool( "UseTaggedPDF", false );
+    mbUseTaggedPDFUserSelection = mbUseTaggedPDF;
+
     mnPDFTypeSelection =  maConfigItem.ReadInt32( "SelectPdfVersion", 0 );
     if ( mbIsPresentation )
     {
@@ -202,8 +206,8 @@ ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, Sequence< PropertyValue
     mbIsExportPlaceholders = maConfigItem.ReadBool( "ExportPlaceholders", false );
     mbAddStream = maConfigItem.ReadBool( "IsAddStream", false );
 
-    mnFormsType = maConfigItem.ReadInt32( "FormsType", 0 );
     mbExportFormFields = maConfigItem.ReadBool( "ExportFormFields", true );
+    mnFormsType = maConfigItem.ReadInt32( "FormsType", 0 );
     if ( ( mnFormsType < 0 ) || ( mnFormsType > 3 ) )
         mnFormsType = 0;
     mbAllowDuplicateFieldNames = maConfigItem.ReadBool( "AllowDuplicateFieldNames", false );
@@ -365,7 +369,9 @@ Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData()
     maConfigItem.WriteBool( "ReduceImageResolution", mbReduceImageResolution );
     maConfigItem.WriteInt32("MaxImageResolution", mnMaxImageResolution );
 
-    maConfigItem.WriteBool( "UseTaggedPDF", mbUseTaggedPDF );
+    // always write the user selection, never the overridden PDF/A value
+    const bool bIsPDFA = (1 == mnPDFTypeSelection) || (2 == mnPDFTypeSelection);
+    maConfigItem.WriteBool("UseTaggedPDF", bIsPDFA ? mbUseTaggedPDFUserSelection : mbUseTaggedPDF);
     maConfigItem.WriteInt32("SelectPdfVersion", mnPDFTypeSelection );
 
     if ( mbIsPresentation )
@@ -445,8 +451,7 @@ Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData()
 
 ImpPDFTabGeneralPage::ImpPDFTabGeneralPage(TabPageParent pParent, const SfxItemSet& rCoreSet)
     : SfxTabPage(pParent, "filter/ui/pdfgeneralpage.ui", "PdfGeneralPage", &rCoreSet)
-    , mbTaggedPDFUserSelection(false)
-    , mbExportFormFieldsUserSelection(false)
+    , mbUseTaggedPDFUserSelection(false)
     , mbIsPresentation(false)
     , mbIsSpreadsheet(false)
     , mbIsWriter(false)
@@ -534,47 +539,34 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem(ImpPDFTabDialog* pParent)
     mxFtWatermark->set_sensitive(false );
     mxEdWatermark->set_sensitive( false );
     mxCbPDFA->connect_toggled(LINK(this, ImpPDFTabGeneralPage, ToggleExportPDFAHdl));
-    mxRbPDFA1b->connect_toggled(LINK(this, ImpPDFTabGeneralPage, ToggleExportPDFAHdl));
-    mxRbPDFA2b->connect_toggled(LINK(this, ImpPDFTabGeneralPage, ToggleExportPDFAHdl));
+
+    const bool bIsPDFA = (1 == pParent->mnPDFTypeSelection) || (2 == pParent->mnPDFTypeSelection);
+    mxCbPDFA->set_active(bIsPDFA);
     switch( pParent->mnPDFTypeSelection )
     {
-    default:
-        // PDF 1.5
-        mxCbPDFA->set_active( false );
-        mxRbPDFA1b->set_active( false );
-        mxRbPDFA2b->set_active( true );
-        break;
-    case 1:
-        // PDF A-1b
-        mxCbPDFA->set_active(true);
+    case 1: // PDF/A-1
         mxRbPDFA1b->set_active(true);
         mxRbPDFA2b->set_active(false);
         break;
-    case 2:
-        // PDF A-2b
-        mxCbPDFA->set_active(true);
-        mxRbPDFA2b->set_active(true);
+    case 2: // PDF/A-2
+    default: // PDF 1.x
         mxRbPDFA1b->set_active(false);
+        mxRbPDFA2b->set_active(true);
         break;
     }
+    // the ToggleExportPDFAHdl handler will read or write the *UserSelection based
+    // on the mxCbPDFA (= bIsPDFA) state, so we have to prepare the correct input state.
+    if (bIsPDFA)
+        mxCbTaggedPDF->set_active(pParent->mbUseTaggedPDFUserSelection);
+    else
+        mbUseTaggedPDFUserSelection = pParent->mbUseTaggedPDFUserSelection;
     ToggleExportPDFAHdl( *mxCbPDFA );
 
+    mxCbExportFormFields->set_active(pParent->mbExportFormFields);
     mxCbExportFormFields->connect_toggled( LINK( this, ImpPDFTabGeneralPage, ToggleExportFormFieldsHdl ) );
 
-    // get the form values, for use with PDF/A-1 selection interface
-    mbTaggedPDFUserSelection = pParent->mbUseTaggedPDF;
-    mbExportFormFieldsUserSelection = pParent->mbExportFormFields;
-
-    if( !mxCbPDFA->get_active() )
-    {
-        // the value for PDF/A set by the ToggleExportPDFAHdl method called before
-        mxCbTaggedPDF->set_active( mbTaggedPDFUserSelection  );
-        mxCbExportFormFields->set_active( mbExportFormFieldsUserSelection );
-    }
-
     mxLbFormsFormat->set_active(static_cast<sal_uInt16>(pParent->mnFormsType));
     mxCbAllowDuplicateFieldNames->set_active( pParent->mbAllowDuplicateFieldNames );
-    mxFormsFrame->set_sensitive( pParent->mbExportFormFields );
 
     mxCbExportBookmarks->set_active( pParent->mbExportBookmarks );
 
@@ -666,20 +658,18 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* pParent )
     }
 
     pParent->mnPDFTypeSelection = 0;
-    if( mxCbPDFA->get_active() )
+    pParent->mbUseTaggedPDF = mxCbTaggedPDF->get_active();
+
+    const bool bIsPDFA = mxCbPDFA->get_active();
+    if (bIsPDFA)
     {
         pParent->mnPDFTypeSelection = 2;
         if( mxRbPDFA1b->get_active() )
             pParent->mnPDFTypeSelection = 1;
-
-        pParent->mbUseTaggedPDF =  mbTaggedPDFUserSelection;
-        pParent->mbExportFormFields = mbExportFormFieldsUserSelection;
     }
     else
-    {
-        pParent->mbUseTaggedPDF =  mxCbTaggedPDF->get_active();
-        pParent->mbExportFormFields = mxCbExportFormFields->get_active();
-    }
+        mbUseTaggedPDFUserSelection = pParent->mbUseTaggedPDF;
+    pParent->mbUseTaggedPDFUserSelection = mbUseTaggedPDFUserSelection;
 
     if( mxCbWatermark->get_active() )
         pParent->maWatermarkText = mxEdWatermark->get_text();
@@ -781,51 +771,42 @@ IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleAddStreamHdl, weld::ToggleButton&, v
 
 IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleExportPDFAHdl, weld::ToggleButton&, void)
 {
+    const bool bIsPDFA = mxCbPDFA->get_active();
+
     // set the security page status (and its controls as well)
     ImpPDFTabSecurityPage* pSecPage = mpParent ? mpParent->getSecurityPage() : nullptr;
     if (pSecPage)
-        pSecPage->ImplPDFASecurityControl(!mxCbPDFA->get_active());
+        pSecPage->ImplPDFASecurityControl(!bIsPDFA);
+
+    mxCbTaggedPDF->set_sensitive(!bIsPDFA);
+    mxRbPDFA1b->set_sensitive(bIsPDFA);
+    mxRbPDFA2b->set_sensitive(bIsPDFA);
 
-    // PDF/A-1 needs tagged PDF, so force disable the control, will be forced in pdfexport.
-    bool bPDFA1Sel = mxCbPDFA->get_active();
-    mxFormsFrame->set_sensitive(bPDFA1Sel);
-    if(bPDFA1Sel)
+    if (bIsPDFA)
     {
-        // store the values of subordinate controls
-        mbTaggedPDFUserSelection = mxCbTaggedPDF->get_active();
+        // store the users selection of subordinate controls and set required PDF/A values
+        mbUseTaggedPDFUserSelection = mxCbTaggedPDF->get_active();
         mxCbTaggedPDF->set_active(true);
-        mxCbTaggedPDF->set_sensitive(false);
-        mbExportFormFieldsUserSelection = mxCbExportFormFields->get_active();
-        mxCbExportFormFields->set_active(false);
-        mxCbExportFormFields->set_sensitive(false);
-        mxRbPDFA1b->set_sensitive(true);
-        mxRbPDFA2b->set_sensitive(true);
+
+        // if a password was set, inform the user that this will not be used
+        if (pSecPage && pSecPage->hasPassword())
+        {
+            std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xContainer.get(),
+                                                      VclMessageType::Warning, VclButtonsType::Ok,
+                                                      PDFFilterResId(STR_WARN_PASSWORD_PDFA)));
+            xBox->run();
+        }
     }
     else
     {
-        // retrieve the values of subordinate controls
-        mxCbTaggedPDF->set_sensitive(false);
-        mxCbTaggedPDF->set_sensitive(true);
-        mxCbTaggedPDF->set_active(mbTaggedPDFUserSelection);
-        mxCbExportFormFields->set_active(mbExportFormFieldsUserSelection);
-        mxRbPDFA1b->set_sensitive(false);
-        mxRbPDFA2b->set_sensitive(false);
+        // restore the users values of subordinate controls
+        mxCbTaggedPDF->set_active(mbUseTaggedPDFUserSelection);
     }
 
-    // PDF/A-2 doesn't allow launch action, so enable/disable the selection on
-    // Link page
+    // PDF/A doesn't allow launch action, so enable/disable the selection on the Link page
     ImpPDFTabLinksPage* pLinksPage = mpParent ? mpParent->getLinksPage() : nullptr;
     if (pLinksPage)
-        pLinksPage->ImplPDFALinkControl(!mxCbPDFA->get_active());
-
-    // if a password was set, inform the user that this will not be used in PDF/A case
-    if( mxCbPDFA->get_active() && pSecPage && pSecPage->hasPassword() )
-    {
-        std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xContainer.get(),
-                                                  VclMessageType::Warning, VclButtonsType::Ok,
-                                                  PDFFilterResId(STR_WARN_PASSWORD_PDFA)));
-        xBox->run();
-    }
+        pLinksPage->ImplPDFALinkControl(!bIsPDFA);
 }
 
 /// The option features tab page
diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx
index 9f9b8e38c33f..c1a9543d09d5 100644
--- a/filter/source/pdf/impdialog.hxx
+++ b/filter/source/pdf/impdialog.hxx
@@ -73,6 +73,7 @@ class ImpPDFTabDialog final : public SfxTabDialogController
     bool                        mbReduceImageResolution;
     sal_Int32                   mnMaxImageResolution;
     bool                        mbUseTaggedPDF;
+    bool                        mbUseTaggedPDFUserSelection;
     sal_Int32                   mnPDFTypeSelection;
     bool                        mbExportNotes;
     bool                        mbViewPDF;
@@ -164,8 +165,7 @@ class ImpPDFTabGeneralPage : public SfxTabPage
 {
     friend class ImpPDFTabLinksPage;
 
-    bool                         mbTaggedPDFUserSelection;
-    bool                         mbExportFormFieldsUserSelection;
+    bool                         mbUseTaggedPDFUserSelection;
     bool                         mbIsPresentation;
     bool                         mbIsSpreadsheet;
     bool                         mbIsWriter;
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index bae05fe1c394..175cc4150c4e 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -599,15 +599,14 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
             case 1:
                 aContext.Version    = vcl::PDFWriter::PDFVersion::PDF_A_1;
                 mbUseTaggedPDF = true;          // force the tagged PDF as well
-                mbExportFormFields = false;     // force disabling of form conversion
-                mbRemoveTransparencies = true;  // PDF/A does not allow transparencies
+                mbRemoveTransparencies = true;  // does not allow transparencies
                 mbEncrypt = false;              // no encryption
                 xEnc.clear();
                 break;
             case 2:
                 aContext.Version    = vcl::PDFWriter::PDFVersion::PDF_A_2;
                 mbUseTaggedPDF = true;          // force the tagged PDF as well
-                mbRemoveTransparencies = false; // PDF/A-2 does allow transparencies
+                mbRemoveTransparencies = false; // does allow transparencies
                 mbEncrypt = false;              // no encryption
                 xEnc.clear();
                 break;
commit a70f0251b98d7d06d27b0f72f3877ea77b659d80
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed Aug 7 12:24:09 2019 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Wed Aug 7 23:28:52 2019 +0200

    redland/raptor: use system xml2-config only on MacOSX
    
    On Fedora 30, we get:
    
    instdir/program/libraptor2-lo.so.0 has suspicious NEEDED: liblzma.so.5
    
    Because:
    > xml2-config --libs
    -lxml2 -lz -llzma -lm -ldl
    
    However:
    > pkg-config --libs libxml-2.0
    -lxml2
    
    So prefer pkg-config for system libxml2, except on MacOSX, where
    people claim that pkg-config leads to disaster.
    
    Change-Id: I29ffd2ced769d7111c4de17de53082db2e2ba326
    Reviewed-on: https://gerrit.libreoffice.org/77093
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    (cherry picked from commit 1067c32964e4e0754d2d926e1319b4060ded93f5)
    Reviewed-on: https://gerrit.libreoffice.org/77099
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/external/redland/ExternalProject_raptor.mk b/external/redland/ExternalProject_raptor.mk
index 3277f8797460..4309df17b246 100644
--- a/external/redland/ExternalProject_raptor.mk
+++ b/external/redland/ExternalProject_raptor.mk
@@ -36,7 +36,7 @@ $(call gb_ExternalProject_get_state_target,raptor,build):
 			, \
 				--enable-shared --disable-static \
 			) \
-			$(if $(SYSTEM_LIBXML),,--with-xml2-config=$(call gb_UnpackedTarball_get_dir,libxml2)/xml2-config) \
+			$(if $(SYSTEM_LIBXML),$(if $(filter-out MACOSX,$(OS)),--without-xml2-config),--with-xml2-config=$(call gb_UnpackedTarball_get_dir,libxml2)/xml2-config) \
 		&& $(MAKE) \
 	)
 


More information about the Libreoffice-commits mailing list