filter/source/pdf/impdialog.cxx |   24 +++++++++++++++++++++++-
 filter/source/pdf/impdialog.hxx |    1 +
 2 files changed, 24 insertions(+), 1 deletion(-)

New commits:
commit 38b3e766f23e6201b3dff6568840b26005e7e612
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Mon Mar 13 20:46:15 2023 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Mar 16 11:44:54 2023 +0000

    filter: PDF export dialog: always enable Outlines for PDF/UA
    
    This is not a hard requirement, but why not prevent this pitfall
    at least in the dialog:
    
      7.17 Navigation
      A document should include a document outline that matches the reading
      order and level of navigational targets (ISO 32000-1:2008, 12.3.3).
    
    Change-Id: I06533123cdfe5fe1c79180d6ebd4e961b25a63b6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148818
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit e564e4d14367ae5c8e6b1f7a76f69113fea660e6)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148857
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index 774e378be192..360b9702a17f 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -197,6 +197,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, 
const Sequence< Property
     mbViewPDF = maConfigItem.ReadBool( "ViewPDFAfterExport", false );
 
     mbExportBookmarks = maConfigItem.ReadBool( "ExportBookmarks", true );
+    mbExportBookmarksUserSelection = mbExportBookmarks;
     if ( mbIsPresentation )
         mbExportHiddenSlides = maConfigItem.ReadBool( "ExportHiddenSlides", 
false );
     if ( mbIsSpreadsheet )
@@ -613,6 +614,7 @@ void 
ImpPDFTabGeneralPage::SetFilterConfigItem(ImpPDFTabDialog* pParent)
         mxCbTaggedPDF->set_active(pParent->mbUseTaggedPDFUserSelection);
     else
         mbUseTaggedPDFUserSelection = pParent->mbUseTaggedPDFUserSelection;
+    mxCbExportBookmarks->set_active(pParent->mbExportBookmarksUserSelection);
     TogglePDFVersionOrUniversalAccessibilityHandle(*mxCbPDFA);
 
     mxCbExportFormFields->set_active(pParent->mbExportFormFields);
@@ -622,7 +624,6 @@ void 
ImpPDFTabGeneralPage::SetFilterConfigItem(ImpPDFTabDialog* pParent)
     mxCbAllowDuplicateFieldNames->set_active( 
pParent->mbAllowDuplicateFieldNames );
     mxFormsFrame->set_sensitive(pParent->mbExportFormFields);
 
-    mxCbExportBookmarks->set_active( pParent->mbExportBookmarks );
 
     mxCbExportNotes->set_active( pParent->mbExportNotes );
     mxCbExportNotesInMargin->set_active( pParent->mbExportNotesInMargin );
@@ -747,6 +748,10 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( 
ImpPDFTabDialog* pParent )
 
     if (!bIsPDFA && !bIsPDFUA)
         mbUseTaggedPDFUserSelection = pParent->mbUseTaggedPDF;
+    if (!bIsPDFUA)
+    {
+        pParent->mbExportBookmarksUserSelection = pParent->mbExportBookmarks;
+    }
 
     pParent->mbUseTaggedPDFUserSelection = mbUseTaggedPDFUserSelection;
     pParent->mbExportFormFields = mxCbExportFormFields->get_active();
@@ -883,6 +888,23 @@ IMPL_LINK_NOARG(ImpPDFTabGeneralPage, 
TogglePDFVersionOrUniversalAccessibilityHa
         mxCbTaggedPDF->set_active(mbUseTaggedPDFUserSelection);
     }
 
+    if (bIsPDFUA)
+    {
+        if (mxCbExportBookmarks->get_sensitive())
+        {
+            if (mpParent)
+            {
+                mpParent->mbExportBookmarksUserSelection = 
mxCbExportBookmarks->get_active();
+            }
+            mxCbExportBookmarks->set_active(true);
+        }
+    }
+    else if (mpParent)
+    {
+        
mxCbExportBookmarks->set_active(mpParent->mbExportBookmarksUserSelection);
+    }
+    mxCbExportBookmarks->set_sensitive(!bIsPDFUA);
+
     // PDF/A doesn't allow launch action, so enable/disable the selection on 
the Link page
     ImpPDFTabLinksPage* pLinksPage = mpParent ? mpParent->getLinksPage() : 
nullptr;
     if (pLinksPage)
diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx
index 828422bdc63e..6d9a91dac81b 100644
--- a/filter/source/pdf/impdialog.hxx
+++ b/filter/source/pdf/impdialog.hxx
@@ -96,6 +96,7 @@ class ImpPDFTabDialog final : public SfxTabDialogController
     bool                        mbExportFormFields;
     bool                        mbAllowDuplicateFieldNames;
     bool                        mbExportBookmarks;
+    bool                        mbExportBookmarksUserSelection = true;
     bool                        mbExportHiddenSlides;
     bool                        mbSinglePageSheets;
     sal_Int32                   mnOpenBookmarkLevels;

Reply via email to