filter/source/pdf/impdialog.cxx                            |    4 +-
 filter/source/pdf/pdfexport.cxx                            |    2 -
 filter/source/pdf/pdffilter.cxx                            |    2 -
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |    2 -
 sc/qa/uitest/calc_tests4/exportToPDF.py                    |    4 +-
 sd/qa/uitest/impress_tests/exportToPDF.py                  |    4 +-
 sw/qa/core/text/itrform2.cxx                               |    4 ++
 sw/qa/core/text/text.cxx                                   |   11 +++++
 sw/qa/inc/swmodeltestbase.hxx                              |   14 +++++++
 sw/qa/uitest/writer_tests4/exportToPDF.py                  |    4 +-
 sw/qa/unit/swmodeltestbase.cxx                             |   15 +++++++
 vcl/CppunitTest_vcl_pdfexport.mk                           |    4 ++
 vcl/qa/cppunit/pdfexport/pdfexport.cxx                     |   25 +++++++++----
 vcl/qa/cppunit/pdfexport/pdfexport2.cxx                    |   20 ++++++++--
 14 files changed, 93 insertions(+), 22 deletions(-)

New commits:
commit 35288ca649d2110bad849468298860f8126e6b95
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Tue Jul 30 08:28:16 2024 +0200
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Jul 31 14:30:54 2024 +0200

    tdf#153040 PDF export: disable export of form fields as PDF forms by default
    
    Open <https://bugs.documentfoundation.org/attachment.cgi?id=195586>,
    notice that from "bbb", the middle "b" is bold, export to PDF, none of
    the "b"s are bold.
    
    The reason for this is that by default we map form controls and content
    controls to fillable PDF forms, which can only contain plain text.
    
    Fix the problem by defaulting to not exporting form controls / content
    controls to PDF forms: most users just want a PDF that is close to what
    they saw in the edit window -- and the ones who want a fillable PDF form
    can still opt in. Once the UI checkbox is enabled, we even remember
    that.
    
    Based on <https://gerrit.libreoffice.org/c/core/+/152622>, thanks
    Justin!
    
    (cherry picked from commit 159d823c7b7502ee07d897d74c4e74c6e1873596)
    
    Conflicts:
            filter/source/pdf/impdialog.cxx
            filter/source/pdf/pdffilter.cxx
            vcl/qa/cppunit/pdfexport/pdfexport.cxx
            vcl/qa/cppunit/pdfexport/pdfexport2.cxx
    
    Change-Id: Iddb75d1dbd969045321e139154f254c059eebf16
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171305
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index c4e133297e95..a96188fb2da6 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -80,7 +80,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, const 
Sequence< Property
     mbIsExportPlaceholders( false ),
     mbAddStream( false ),
     mnFormsType( 0 ),
-    mbExportFormFields( true ),
+    mbExportFormFields( false ),
     mbAllowDuplicateFieldNames( false ),
     mbExportBookmarks( true ),
     mbExportHiddenSlides ( false ),
@@ -213,7 +213,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, 
const Sequence< Property
     mbIsExportPlaceholders = maConfigItem.ReadBool( "ExportPlaceholders", 
false );
     mbAddStream = maConfigItem.ReadBool( "IsAddStream", false );
 
-    mbExportFormFields = maConfigItem.ReadBool( "ExportFormFields", true );
+    mbExportFormFields = maConfigItem.ReadBool( "ExportFormFields", false );
     mnFormsType = maConfigItem.ReadInt32( "FormsType", 0 );
     if ( ( mnFormsType < 0 ) || ( mnFormsType > 3 ) )
         mnFormsType = 0;
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index 1459590b2f23..f2874f5b8e94 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -406,7 +406,7 @@ bool PDFExport::Export( const OUString& rFile, const 
Sequence< PropertyValue >&
             bool bExportNotesPages = false;
             bool bExportOnlyNotesPages = false;
             bool bUseTransitionEffects = true;
-            bool bExportFormFields = true;
+            bool bExportFormFields = false;
             sal_Int32 nFormsFormat = 0;
             bool bAllowDuplicateFieldNames = false;
             bool bHideViewerToolbar = false;
diff --git a/filter/source/pdf/pdffilter.cxx b/filter/source/pdf/pdffilter.cxx
index dcfc918bbdd0..bac2468600a7 100644
--- a/filter/source/pdf/pdffilter.cxx
+++ b/filter/source/pdf/pdffilter.cxx
@@ -110,7 +110,7 @@ bool PDFFilter::implExport( const Sequence< PropertyValue 
>& rDescriptor )
         aCfgItem.ReadBool(  "ExportOnlyNotesPages", false );
         aCfgItem.ReadBool(  "UseTransitionEffects", true );
         aCfgItem.ReadBool(  "IsSkipEmptyPages", false );
-        aCfgItem.ReadBool(  "ExportFormFields", true );
+        aCfgItem.ReadBool(  "ExportFormFields", false );
         aCfgItem.ReadInt32( "FormsType", 0 );
         aCfgItem.ReadBool(  "HideViewerToolbar", false );
         aCfgItem.ReadBool(  "HideViewerMenubar", false );
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index a6f613798ff0..4c4826e97904 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -4670,7 +4670,7 @@
               <desc>Specifies whether form fields are exported as widgets or
               only their fixed print representation is exported.</desc>
             </info>
-            <value>true</value>
+            <value>false</value>
           </prop>
           <prop oor:name="FormsType" oor:type="xs:int" oor:nillable="false">
             <info>
diff --git a/sc/qa/uitest/calc_tests4/exportToPDF.py 
b/sc/qa/uitest/calc_tests4/exportToPDF.py
index 777d9899e421..a2cd0e55a451 100644
--- a/sc/qa/uitest/calc_tests4/exportToPDF.py
+++ b/sc/qa/uitest/calc_tests4/exportToPDF.py
@@ -35,13 +35,13 @@ class exportToPDF(UITestCase):
                 with 
self.ui_test.execute_dialog_through_command('.uno:ExportToPDF', 
close_button="") as xDialog:
 
                     selectedChildren = ['bookmarks', 'display', 'effects', 
'enablea11y',
-                                        'enablecopy', 'exporturl', 'forms', 
'reduceresolution', 'tagged']
+                                        'enablecopy', 'exporturl', 
'reduceresolution', 'tagged']
 
                     for child in selectedChildren:
                         self.assertEqual("true", 
get_state_as_dict(xDialog.getChild(child))['Selected'])
 
                     nonSelectedChildren = ['allowdups', 'center', 'comments', 
'convert', 'embed', 'emptypages', 'export', 'exportplaceholders',
-                            'firstonleft', 'hiddenpages', 'menubar', 'notes', 
'onlynotes', 'open', 'pdfa', 'pdfua', 'resize', 'singlepagesheets',
+                            'firstonleft', 'forms', 'hiddenpages', 'menubar', 
'notes', 'onlynotes', 'open', 'pdfa', 'pdfua', 'resize', 'singlepagesheets',
                             'toolbar', 'usereferencexobject', 'viewpdf', 
'watermark', 'window']
 
                     for child in nonSelectedChildren:
diff --git a/sd/qa/uitest/impress_tests/exportToPDF.py 
b/sd/qa/uitest/impress_tests/exportToPDF.py
index e654f608947b..2a521670209c 100644
--- a/sd/qa/uitest/impress_tests/exportToPDF.py
+++ b/sd/qa/uitest/impress_tests/exportToPDF.py
@@ -37,13 +37,13 @@ class exportToPDF(UITestCase):
                 with 
self.ui_test.execute_dialog_through_command('.uno:ExportToPDF', 
close_button="") as xDialog:
 
                     selectedChildren = ['bookmarks', 'display', 'effects', 
'enablea11y',
-                                        'enablecopy', 'exporturl', 'forms', 
'reduceresolution', 'tagged']
+                                        'enablecopy', 'exporturl', 
'reduceresolution', 'tagged']
 
                     for child in selectedChildren:
                         self.assertEqual("true", 
get_state_as_dict(xDialog.getChild(child))['Selected'])
 
                     nonSelectedChildren = ['allowdups', 'center', 'comments', 
'convert', 'embed', 'emptypages', 'export', 'exportplaceholders',
-                            'firstonleft', 'hiddenpages', 'menubar', 'notes', 
'onlynotes', 'open', 'pdfa', 'pdfua', 'resize', 'singlepagesheets',
+                            'firstonleft', 'forms', 'hiddenpages', 'menubar', 
'notes', 'onlynotes', 'open', 'pdfa', 'pdfua', 'resize', 'singlepagesheets',
                             'toolbar', 'usereferencexobject', 'viewpdf', 
'watermark', 'window']
 
                     for child in nonSelectedChildren:
diff --git a/sw/qa/core/text/itrform2.cxx b/sw/qa/core/text/itrform2.cxx
index ec375020c72c..8ee3ecdb805b 100644
--- a/sw/qa/core/text/itrform2.cxx
+++ b/sw/qa/core/text/itrform2.cxx
@@ -204,6 +204,7 @@ CPPUNIT_TEST_FIXTURE(Test, 
testCheckedCheckboxContentControlPDF)
     if (!pPDFium)
         return;
 
+    SwExportFormFieldsGuard g;
     // Given a file with a checked checkbox content control:
     createSwDoc();
     SwDoc* pDoc = getSwDoc();
@@ -240,6 +241,7 @@ CPPUNIT_TEST_FIXTURE(Test, testContentControlPDFFontColor)
     if (!pPDFium)
         return;
 
+    SwExportFormFieldsGuard g;
     // Given a document with a custom orange font color and a content control:
     createSwDoc();
     SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
@@ -272,6 +274,7 @@ CPPUNIT_TEST_FIXTURE(Test, 
testContentControlPDFDropDownText)
     if (!pPDFium)
         return;
 
+    SwExportFormFieldsGuard g;
     // Given a document with a dropdown: custom default text and 3 items:
     createSwDoc();
     uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, 
uno::UNO_QUERY);
@@ -336,6 +339,7 @@ CPPUNIT_TEST_FIXTURE(Test, testContentControlPDFComments)
 
     // When exporting to PDF, exporting notes in master (and not as widgets):
     uno::Sequence<beans::PropertyValue> aFilterData = {
+        comphelper::makePropertyValue(u"ExportFormFields"_ustr, true),
         comphelper::makePropertyValue(u"ExportNotes"_ustr, false),
         comphelper::makePropertyValue(u"ExportNotesInMargin"_ustr, true),
     };
diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index 722ca5ccd1d0..841262e07268 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -180,6 +180,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf159903)
 
 CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf159336)
 {
+    SwExportFormFieldsGuard g;
     createSwDoc("tdf159336.odt");
     save("writer_pdf_Export");
 
@@ -1002,6 +1003,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testContentControlPDF)
     if (!pPDFium)
         return;
 
+    SwExportFormFieldsGuard g;
     // Given a file with a content control:
     createSwDoc();
     SwDoc* pDoc = getSwDoc();
@@ -1049,6 +1051,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testContentControlPlaceholderPDF)
     if (!pPDFium)
         return;
 
+    SwExportFormFieldsGuard g;
     // Given a file with a content control, in placeholder mode:
     createSwDoc();
     SwDoc* pDoc = getSwDoc();
@@ -1077,6 +1080,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testCheckboxContentControlPDF)
     if (!pPDFium)
         return;
 
+    SwExportFormFieldsGuard g;
     // Given a file with a checkbox content control:
     createSwDoc();
     SwDoc* pDoc = getSwDoc();
@@ -1107,6 +1111,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testDropdownContentControlPDF)
     if (!pPDFium)
         return;
 
+    SwExportFormFieldsGuard g;
     // Given a file with a dropdown content control:
     createSwDoc();
     SwDoc* pDoc = getSwDoc();
@@ -1137,6 +1142,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testDropdownContentControlPDF2)
     if (!pPDFium)
         return;
 
+    SwExportFormFieldsGuard g;
     createSwDoc("tdf153040.docx");
 
     save("writer_pdf_Export");
@@ -1161,6 +1167,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testDateContentControlPDF)
     if (!pPDFium)
         return;
 
+    SwExportFormFieldsGuard g;
     // Given a file with a date content control:
     createSwDoc();
     SwDoc* pDoc = getSwDoc();
@@ -1194,6 +1201,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testContentControlPDFFont)
     if (!pPDFium)
         return;
 
+    SwExportFormFieldsGuard g;
     // Given a document with a custom 24pt font size and a content control:
     createSwDoc();
     SwDoc* pDoc = getSwDoc();
@@ -1226,6 +1234,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testComboContentControlPDF)
     if (!pPDFium)
         return;
 
+    SwExportFormFieldsGuard g;
     // Given a file with a combo box content control:
     createSwDoc();
     SwDoc* pDoc = getSwDoc();
@@ -1257,6 +1266,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testRichContentControlPDF)
     if (!pPDFium)
         return;
 
+    SwExportFormFieldsGuard g;
     // Given a file with a rich content control, its value set to 
"xxx<b>yyy</b>":
     createSwDoc();
     SwDoc* pDoc = getSwDoc();
@@ -1293,6 +1303,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testPlaceholderFieldPDF)
     if (!pPDFium)
         return;
 
+    SwExportFormFieldsGuard g;
     // Given a file with a text-type placeholder field:
     createSwDoc("placeholder.fodt");
 
diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx
index 669fd6dea4ea..c2941b662957 100644
--- a/sw/qa/inc/swmodeltestbase.hxx
+++ b/sw/qa/inc/swmodeltestbase.hxx
@@ -77,6 +77,10 @@
     void TestName::verify()
 
 class SwXTextDocument;
+namespace comphelper
+{
+class ConfigurationChanges;
+}
 namespace vcl
 {
 namespace pdf
@@ -85,6 +89,16 @@ class PDFiumDocument;
 }
 }
 
+/// Temporarily enables the ExportFormFields setting.
+class SWQAHELPER_DLLPUBLIC SwExportFormFieldsGuard
+{
+    std::shared_ptr<comphelper::ConfigurationChanges> m_pBatch;
+    bool m_bValue;
+public:
+    SwExportFormFieldsGuard();
+    ~SwExportFormFieldsGuard();
+};
+
 /// Base class for filter tests loading or roundtripping a document, then 
asserting the document model.
 class SWQAHELPER_DLLPUBLIC SwModelTestBase : public UnoApiXmlTest
 {
diff --git a/sw/qa/uitest/writer_tests4/exportToPDF.py 
b/sw/qa/uitest/writer_tests4/exportToPDF.py
index a075e6a4c773..1d85ebd6d1a8 100644
--- a/sw/qa/uitest/writer_tests4/exportToPDF.py
+++ b/sw/qa/uitest/writer_tests4/exportToPDF.py
@@ -33,13 +33,13 @@ class exportToPDF(UITestCase):
                 with 
self.ui_test.execute_dialog_through_command('.uno:ExportToPDF', 
close_button="") as xDialog:
 
                     selectedChildren = ['bookmarks', 'display', 'effects', 
'enablea11y',
-                                        'enablecopy', 'exporturl', 'forms', 
'reduceresolution', 'tagged']
+                                        'enablecopy', 'exporturl', 
'reduceresolution', 'tagged']
 
                     for child in selectedChildren:
                         self.assertEqual("true", 
get_state_as_dict(xDialog.getChild(child))['Selected'])
 
                     nonSelectedChildren = ['allowdups', 'center', 'comments', 
'convert', 'embed', 'emptypages', 'export', 'exportplaceholders',
-                            'firstonleft', 'hiddenpages', 'menubar', 'notes', 
'onlynotes', 'open', 'pdfa', 'pdfua', 'resize', 'singlepagesheets',
+                            'firstonleft', 'forms', 'hiddenpages', 'menubar', 
'notes', 'onlynotes', 'open', 'pdfa', 'pdfua', 'resize', 'singlepagesheets',
                             'toolbar', 'usereferencexobject', 'viewpdf', 
'watermark', 'window']
 
                     for child in nonSelectedChildren:
diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx
index 730ece0596b8..d3e7b53d2946 100644
--- a/sw/qa/unit/swmodeltestbase.cxx
+++ b/sw/qa/unit/swmodeltestbase.cxx
@@ -25,6 +25,7 @@
 #include <vcl/scheduler.hxx>
 #include <comphelper/configuration.hxx>
 #include <officecfg/Office/Writer.hxx>
+#include <officecfg/Office/Common.hxx>
 
 #include <IDocumentLayoutAccess.hxx>
 #include <docsh.hxx>
@@ -591,4 +592,18 @@ void SwModelTestBase::emulateTyping(SwXTextDocument& 
rTextDoc, const std::u16str
     }
 }
 
+SwExportFormFieldsGuard::SwExportFormFieldsGuard()
+{
+    m_pBatch = comphelper::ConfigurationChanges::create();
+    m_bValue = 
officecfg::Office::Common::Filter::PDF::Export::ExportFormFields::get();
+    
officecfg::Office::Common::Filter::PDF::Export::ExportFormFields::set(true, 
m_pBatch);
+    m_pBatch->commit();
+}
+
+SwExportFormFieldsGuard::~SwExportFormFieldsGuard()
+{
+    
officecfg::Office::Common::Filter::PDF::Export::ExportFormFields::set(m_bValue, 
m_pBatch);
+    m_pBatch->commit();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/CppunitTest_vcl_pdfexport.mk b/vcl/CppunitTest_vcl_pdfexport.mk
index 33716f5dad36..e04d9d437480 100644
--- a/vcl/CppunitTest_vcl_pdfexport.mk
+++ b/vcl/CppunitTest_vcl_pdfexport.mk
@@ -42,6 +42,10 @@ $(eval $(call gb_CppunitTest_use_vcl,vcl_pdfexport))
 
 $(eval $(call gb_CppunitTest_use_rdb,vcl_pdfexport,services))
 
+$(eval $(call gb_CppunitTest_use_custom_headers,vcl_pdfexport,\
+       officecfg/registry \
+))
+
 $(eval $(call gb_CppunitTest_use_configuration,vcl_pdfexport))
 
 # assert if font/glyph fallback occurs
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index e9a8530c3cce..1b962d6aae79 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -24,6 +24,7 @@
 #include <vcl/filter/pdfdocument.hxx>
 #include <tools/zcodec.hxx>
 #include <o3tl/string_view.hxx>
+#include <officecfg/Office/Common.hxx>
 
 #include <vcl/filter/PDFiumLibrary.hxx>
 
@@ -45,7 +46,7 @@ public:
 
     void saveAsPDF(std::u16string_view rFile);
     void load(std::u16string_view rFile, vcl::filter::PDFDocument& rDocument,
-              bool bUseTaggedPDF = true);
+              bool bUseTaggedPDF = true, bool bUseExportFormFields = false);
 };
 
 void PdfExportTest::saveAsPDF(std::u16string_view rFile)
@@ -57,11 +58,13 @@ void PdfExportTest::saveAsPDF(std::u16string_view rFile)
 }
 
 void PdfExportTest::load(std::u16string_view rFile, vcl::filter::PDFDocument& 
rDocument,
-                         bool bUseTaggedPDF)
+                         bool bUseTaggedPDF, bool bUseExportFormFields)
 {
     aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export");
-    uno::Sequence<beans::PropertyValue> aFilterData(
-        comphelper::InitPropertySequence({ { "UseTaggedPDF", 
uno::Any(bUseTaggedPDF) } }));
+    uno::Sequence<beans::PropertyValue> 
aFilterData(comphelper::InitPropertySequence({
+        { "UseTaggedPDF", uno::Any(bUseTaggedPDF) },
+        { "ExportFormFields", uno::Any(bUseExportFormFields) },
+    }));
     aMediaDescriptor["FilterData"] <<= aFilterData;
     saveAsPDF(rFile);
 
@@ -312,6 +315,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf127217)
 {
     // Import the bugdoc and export as PDF.
     aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export");
+    uno::Sequence<beans::PropertyValue> 
aFilterData(comphelper::InitPropertySequence({
+        { "ExportFormFields", uno::Any(true) },
+    }));
+    aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData;
     saveAsPDF(u"tdf127217.odt");
 
     // Parse the export result with pdfium.
@@ -550,6 +557,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf148706)
 {
     // Import the bugdoc and export as PDF.
     aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export");
+    uno::Sequence<beans::PropertyValue> 
aFilterData(comphelper::InitPropertySequence({
+        { "ExportFormFields", uno::Any(true) },
+    }));
+    aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData;
     saveAsPDF(u"tdf148706.odt");
 
     // Parse the export result with pdfium.
@@ -841,7 +852,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf105972)
 {
     vcl::filter::PDFDocument aDocument;
     // Loading fails with tagged PDF enabled
-    load(u"tdf105972.fodt", aDocument, false);
+    load(u"tdf105972.fodt", aDocument, false, /*bUseExportFormFields=*/true);
 
     // The document has one page.
     std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
@@ -906,7 +917,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf148442)
 {
     vcl::filter::PDFDocument aDocument;
     // Loading fails with tagged PDF enabled
-    load(u"tdf148442.odt", aDocument, false);
+    load(u"tdf148442.odt", aDocument, false, /*bUseExportFormFields=*/true);
 
     // The document has one page.
     std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
@@ -976,7 +987,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, 
testTdf118244_radioButtonGroup)
 {
     vcl::filter::PDFDocument aDocument;
     // Loading fails with tagged PDF enabled
-    load(u"tdf118244_radioButtonGroup.odt", aDocument, false);
+    load(u"tdf118244_radioButtonGroup.odt", aDocument, false, 
/*bUseExportFormFields=*/true);
 
     // The document has one page.
     std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages();
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx
index 66c1f02b1e12..5a0de55f0681 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx
@@ -809,6 +809,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testFormFontName)
 {
     // Import the bugdoc and export as PDF.
     aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export");
+    uno::Sequence<beans::PropertyValue> 
aFilterData(comphelper::InitPropertySequence({
+        { "ExportFormFields", uno::Any(true) },
+    }));
+    aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData;
     saveAsPDF(u"form-font-name.odt");
 
     // Parse the export result with pdfium.
@@ -2789,8 +2793,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157397)
     aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export");
 
     // Enable PDF/UA
-    uno::Sequence<beans::PropertyValue> aFilterData(
-        comphelper::InitPropertySequence({ { "PDFUACompliance", uno::Any(true) 
} }));
+    uno::Sequence<beans::PropertyValue> 
aFilterData(comphelper::InitPropertySequence({
+        { "PDFUACompliance", uno::Any(true) },
+        { "ExportFormFields", uno::Any(true) },
+    }));
     aMediaDescriptor["FilterData"] <<= aFilterData;
     saveAsPDF(u"PDF_export_with_formcontrol.fodt");
 
@@ -3743,8 +3749,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, 
testFormControlAnnot)
     aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export");
 
     // Enable PDF/UA
-    uno::Sequence<beans::PropertyValue> aFilterData(
-        comphelper::InitPropertySequence({ { "PDFUACompliance", uno::Any(true) 
} }));
+    uno::Sequence<beans::PropertyValue> 
aFilterData(comphelper::InitPropertySequence({
+        { "PDFUACompliance", uno::Any(true) },
+        { "ExportFormFields", uno::Any(true) },
+    }));
     aMediaDescriptor["FilterData"] <<= aFilterData;
 
     saveAsPDF(u"formcontrol.fodt");
@@ -4645,6 +4653,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf152246)
 {
     // Import the bugdoc and export as PDF.
     aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export");
+    uno::Sequence<beans::PropertyValue> 
aFilterData(comphelper::InitPropertySequence({
+        { "ExportFormFields", uno::Any(true) },
+    }));
+    aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData;
     saveAsPDF(u"content-control-rtl.docx");
 
     // Parse the export result.

Reply via email to