include/xmloff/xmlexp.hxx | 4 ++++ xmloff/source/core/xmlexp.cxx | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+)
New commits: commit c75b7dc31a9329b38c8db9d796df2e6f62bc2209 Author: Caolán McNamara <[email protected]> AuthorDate: Fri Sep 12 15:10:57 2025 +0100 Commit: Miklos Vajna <[email protected]> CommitDate: Tue Sep 16 14:51:37 2025 +0200 add FilterOptions to ODF export support Json string here like pdf export does. Just one property initially so extract the single thing supported as now to a bool in the Impl. Change-Id: I59d94a9147595a55236847c2f450b3c11c60e5ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190966 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> diff --git a/include/xmloff/xmlexp.hxx b/include/xmloff/xmlexp.hxx index 9ac58acbe00c..77cccf765527 100644 --- a/include/xmloff/xmlexp.hxx +++ b/include/xmloff/xmlexp.hxx @@ -555,6 +555,10 @@ public: // Written OpenDocument file format doesn't fit to the created text document (#i69627#) bool writeOutlineStyleAsNormalListStyle() const; + // Decompose embedded PDFs to equivalent ODF, requires pdfium support to be enabled + // to do anything useful. + bool decomposePDF() const; + css::uno::Reference< css::embed::XStorage > const & GetTargetStorage() const; /// returns value of ODF version attribute diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index a5524b33f416..9475b1ac6e30 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -32,6 +32,7 @@ #include <tools/urlobj.hxx> #include <vcl/graph.hxx> #include <comphelper/genericpropertyset.hxx> +#include <comphelper/propertysequence.hxx> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/document/XEmbeddedObjectResolver.hpp> @@ -102,6 +103,8 @@ #include <comphelper/xmltools.hxx> #include <comphelper/graphicmimetype.hxx> +#include <boost/property_tree/json_parser.hpp> + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::frame; @@ -244,6 +247,8 @@ public: OUString msPackageURIScheme; // Written OpenDocument file format doesn't fit to the created text document (#i69627#) bool mbOutlineStyleAsNormalListStyle; + // Decompose embedded PDF pages into equivalent ODF representation during export + bool mbDecomposePDF; uno::Reference< embed::XStorage > mxTargetStorage; @@ -278,6 +283,7 @@ SvXMLExport_Impl::SvXMLExport_Impl() : mxUriReferenceFactory( uri::UriReferenceFactory::create(comphelper::getProcessComponentContext()) ), // Written OpenDocument file format doesn't fit to the created text document (#i69627#) mbOutlineStyleAsNormalListStyle( false ), + mbDecomposePDF( false ), mDepth( 0 ), mbExportTextNumberElement( false ), mbNullDateInitialized( false ) @@ -788,6 +794,8 @@ sal_Bool SAL_CALL SvXMLExport::filter( const uno::Sequence< beans::PropertyValue } } + OUString aFilterOptions; + for( const auto& rProp : aDescriptor ) { const OUString& rPropName = rProp.Name; @@ -808,8 +816,27 @@ sal_Bool SAL_CALL SvXMLExport::filter( const uno::Sequence< beans::PropertyValue if (!(rValue >>= msImgFilterName)) return false; } + else if (rPropName == "FilterOptions") + rValue >>= aFilterOptions; + } + if (aFilterOptions.startsWith("{")) + { + try + { + std::vector<beans::PropertyValue> aFilterData = comphelper::JsonToPropertyValues(aFilterOptions.toUtf8()); + for (const PropertyValue& rProp : aFilterData) + { + if (rProp.Name == "DecomposePDF") + rProp.Value >>= mpImpl->mbDecomposePDF; + } + } + catch (const boost::property_tree::json_parser::json_parser_error& e) + { + SAL_WARN("xmloff.core", "error parsing FilterOptions: " << e.message()); + } + } exportDoc( meClass ); } @@ -2322,6 +2349,11 @@ bool SvXMLExport::writeOutlineStyleAsNormalListStyle() const return mpImpl->mbOutlineStyleAsNormalListStyle; } +bool SvXMLExport::decomposePDF() const +{ + return mpImpl->mbDecomposePDF; +} + uno::Reference< embed::XStorage > const & SvXMLExport::GetTargetStorage() const { return mpImpl->mxTargetStorage;
