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 | 3 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 | 42 ++++++++----- vcl/qa/cppunit/pdfexport/pdfexport2.cxx | 28 ++++++-- 14 files changed, 107 insertions(+), 32 deletions(-)
New commits: commit 81c883cf116bd8cd6e0901f5813c20783fa6051e Author: Miklos Vajna <[email protected]> AuthorDate: Tue Jul 30 08:28:16 2024 +0200 Commit: Xisco Fauli <[email protected]> CommitDate: Thu Aug 1 08:26:24 2024 +0200 tdf#162009 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! Change-Id: Iddb75d1dbd969045321e139154f254c059eebf16 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171226 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Jenkins Signed-off-by: Xisco Fauli <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171310 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171335 diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx index c7149b0ca534..5daf87cbeff7 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 ), @@ -211,7 +211,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 7d07f8182bdc..346dd8f20f9a 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -405,7 +405,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 53aa213ac80d..32b4e304e9f4 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 a635ee60a5d0..d785bcdda109 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 429e28df4f0d..19941bd16a75 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 c9f9e3a9adcc..790e27ed45f1 100644 --- a/sw/qa/core/text/itrform2.cxx +++ b/sw/qa/core/text/itrform2.cxx @@ -200,6 +200,7 @@ CPPUNIT_TEST_FIXTURE(Test, testCheckedCheckboxContentControlPDF) if (!pPDFium) return; + SwExportFormFieldsGuard g; // Given a file with a checked checkbox content control: createSwDoc(); SwDoc* pDoc = getSwDoc(); @@ -236,6 +237,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(); @@ -268,6 +270,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); 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 ef628d4eea68..7dab4f13db59 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 aca25cabc1f6..700a9a69b932 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> @@ -44,8 +45,7 @@ public: } void saveAsPDF(std::u16string_view rFile); - void load(std::u16string_view rFile, vcl::filter::PDFDocument& rDocument, - bool bUseTaggedPDF = true); + void load(std::u16string_view rFile, vcl::filter::PDFDocument& rDocument); }; void PdfExportTest::saveAsPDF(std::u16string_view rFile) @@ -56,13 +56,9 @@ void PdfExportTest::saveAsPDF(std::u16string_view rFile) xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); } -void PdfExportTest::load(std::u16string_view rFile, vcl::filter::PDFDocument& rDocument, - bool bUseTaggedPDF) +void PdfExportTest::load(std::u16string_view rFile, vcl::filter::PDFDocument& rDocument) { - aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export"); - uno::Sequence<beans::PropertyValue> aFilterData( - comphelper::InitPropertySequence({ { "UseTaggedPDF", uno::Any(bUseTaggedPDF) } })); - aMediaDescriptor["FilterData"] <<= aFilterData; + aMediaDescriptor[u"FilterName"_ustr] <<= u"writer_pdf_Export"_ustr; saveAsPDF(rFile); // Parse the export result. @@ -311,7 +307,11 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106206) CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf127217) { // Import the bugdoc and export as PDF. - aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export"); + aMediaDescriptor[u"FilterName"_ustr] <<= u"writer_pdf_Export"_ustr; + 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. @@ -549,7 +549,11 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107018) CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf148706) { // Import the bugdoc and export as PDF. - aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export"); + aMediaDescriptor[u"FilterName"_ustr] <<= u"writer_pdf_Export"_ustr; + 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. @@ -840,8 +844,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testAlternativeText) CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf105972) { vcl::filter::PDFDocument aDocument; + uno::Sequence<beans::PropertyValue> aFilterData(comphelper::InitPropertySequence({ + { "ExportFormFields", uno::Any(true) }, + })); + aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData; // Loading fails with tagged PDF enabled - load(u"tdf105972.fodt", aDocument, false); + load(u"tdf105972.fodt", aDocument); // The document has one page. std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); @@ -905,8 +913,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf105972) CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf148442) { vcl::filter::PDFDocument aDocument; + uno::Sequence<beans::PropertyValue> aFilterData(comphelper::InitPropertySequence({ + { "ExportFormFields", uno::Any(true) }, + })); + aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData; // Loading fails with tagged PDF enabled - load(u"tdf148442.odt", aDocument, false); + load(u"tdf148442.odt", aDocument); // The document has one page. std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); @@ -975,8 +987,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf148442) CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf118244_radioButtonGroup) { vcl::filter::PDFDocument aDocument; + uno::Sequence<beans::PropertyValue> aFilterData(comphelper::InitPropertySequence({ + { "ExportFormFields", uno::Any(true) }, + })); + aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData; // Loading fails with tagged PDF enabled - load(u"tdf118244_radioButtonGroup.odt", aDocument, false); + load(u"tdf118244_radioButtonGroup.odt", aDocument); // 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 7da0dbc62f70..d370a36dc228 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx @@ -808,7 +808,11 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testMultiPagePDF) CPPUNIT_TEST_FIXTURE(PdfExportTest2, testFormFontName) { // Import the bugdoc and export as PDF. - aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export"); + aMediaDescriptor[u"FilterName"_ustr] <<= u"writer_pdf_Export"_ustr; + 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,9 +2793,11 @@ 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) } })); - aMediaDescriptor["FilterData"] <<= aFilterData; + uno::Sequence<beans::PropertyValue> aFilterData(comphelper::InitPropertySequence({ + { "PDFUACompliance", uno::Any(true) }, + { "ExportFormFields", uno::Any(true) }, + })); + aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData; saveAsPDF(u"PDF_export_with_formcontrol.fodt"); vcl::filter::PDFDocument aDocument; @@ -3743,9 +3749,11 @@ 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) } })); - aMediaDescriptor["FilterData"] <<= aFilterData; + uno::Sequence<beans::PropertyValue> aFilterData(comphelper::InitPropertySequence({ + { "PDFUACompliance", uno::Any(true) }, + { "ExportFormFields", uno::Any(true) }, + })); + aMediaDescriptor[u"FilterData"_ustr] <<= aFilterData; saveAsPDF(u"formcontrol.fodt"); @@ -4644,7 +4652,11 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testRexportResourceItemReference) CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf152246) { // Import the bugdoc and export as PDF. - aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export"); + aMediaDescriptor[u"FilterName"_ustr] <<= u"writer_pdf_Export"_ustr; + 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.
