filter/source/svg/svgfilter.cxx | 33 ++++++++++++++++++++------------- sfx2/source/doc/objstor.cxx | 13 +++++++++++++ 2 files changed, 33 insertions(+), 13 deletions(-)
New commits: commit 01e4b2008da867ed85982cfb0b62ee1be51ae741 Author: Mike Kaganski <[email protected]> AuthorDate: Tue Dec 2 17:17:22 2025 +0500 Commit: Xisco Fauli <[email protected]> CommitDate: Wed Jan 28 16:59:33 2026 +0100 tdf#168054: Export all ODG pages to SVG from command line by default Regression from commit 58ba249df589b0c9f91667f2938bfa18d2a1ce61, which fixed obtaining controller, including command line scenario. Before it, no controller was found, and mSelectedPages was empty after a call to fillDrawImpressSelectedPages. Now the document's controller is found, and that puts the first page as the selection into mSelectedPages. This change uses ConversionRequestOrigin property, added to medium in DispatchWatcher::executeDispatchRequests, to detect that the export is initiated from command line. In that case, it is assumed that all pages should be exported. I don't really know why the behavior restored in this change is wanted. The result is all pages' objects overlapped. Even though SVG markup has the pages in separate 'g' elements, it doesn't look reasonable to have this result by default. Yet, as it was a pre-existing behavior, let's keep it this way for now. Change-Id: I6d6923e627df4282c61342210ee7d762ea08e2b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195003 Reviewed-by: Mike Kaganski <[email protected]> Tested-by: Jenkins (cherry picked from commit b152ca62b9fdb4a667440ae20e96612dcc12191e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195050 Reviewed-by: Xisco Fauli <[email protected]> diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx index b50c1c12d7f9..40ddc32cb4ee 100644 --- a/filter/source/svg/svgfilter.cxx +++ b/filter/source/svg/svgfilter.cxx @@ -456,19 +456,26 @@ bool SVGFilter::filterImpressOrDraw( const Sequence< PropertyValue >& rDescripto bool bPageProvided = comphelper::LibreOfficeKit::isActive(); sal_Int32 nPageToExport = -1; - for( const PropertyValue& rProp : rDescriptor ) + comphelper::SequenceAsHashMap args(rDescriptor); + if (args.contains(u"ConversionRequestOrigin"_ustr)) { - if (rProp.Name == "SelectionOnly") - { - // #i124608# extract single selection wanted from dialog return values - rProp.Value >>= bSelectionOnly; - bPageProvided = false; - } - else if (rProp.Name == "PagePos") - { - rProp.Value >>= nPageToExport; + // when invoked from command line, default to exporting everything (-1) + if (args[u"ConversionRequestOrigin"_ustr] == u"CommandLine"_ustr) bPageProvided = true; - } + } + + if (args.contains(u"PagePos"_ustr)) + { + args[u"PagePos"_ustr] >>= nPageToExport; + bPageProvided = true; + } + + if (args.contains(u"SelectionOnly"_ustr)) + { + // #i124608# extract single selection wanted from dialog return values + args[u"SelectionOnly"_ustr] >>= bSelectionOnly; + if (bSelectionOnly) + bPageProvided = false; } uno::Reference<frame::XController > xController; @@ -495,12 +502,12 @@ bool SVGFilter::filterImpressOrDraw( const Sequence< PropertyValue >& rDescripto sal_Int32 i; for( i = 0; i < nDPCount; ++i ) { - if( nPageToExport != -1 && nPageToExport == i ) + if (nPageToExport == i) { uno::Reference< drawing::XDrawPage > xDrawPage( xDrawPages->getByIndex( i ), uno::UNO_QUERY ); mSelectedPages.push_back(xDrawPage); } - else + else if (nPageToExport == -1) { uno::Reference< drawing::XDrawPage > xDrawPage( xDrawPages->getByIndex( i ), uno::UNO_QUERY ); Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY ); diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index bde35636ad63..d42275fd08ff 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -2831,6 +2831,7 @@ bool SfxObjectShell::ExportTo( SfxMedium& rMedium ) bool bHasFilterName = false; bool bIsRedactMode = false; bool bIsPreview = false; + std::optional<OUString> oConversionRequestOrigin; sal_Int32 nEnd = aOldArgs.getLength(); for ( sal_Int32 i = 0; i < nEnd; i++ ) @@ -2853,6 +2854,11 @@ bool SfxObjectShell::ExportTo( SfxMedium& rMedium ) { if( rMediumArgs[i].Name == "IsPreview" ) rMediumArgs[i].Value >>= bIsPreview; + else if (rMediumArgs[i].Name == "ConversionRequestOrigin") + { + if (OUString s; rMediumArgs[i].Value >>= s) + oConversionRequestOrigin = s; + } } // FIXME: Handle this inside TransformItems() @@ -2907,6 +2913,13 @@ bool SfxObjectShell::ExportTo( SfxMedium& rMedium ) pArgs[nEnd-1].Name = "IsPreview"; pArgs[nEnd-1].Value <<= bIsPreview; } + if (oConversionRequestOrigin) + { + aArgs.realloc( ++nEnd ); + auto pArgs = aArgs.getArray(); + pArgs[nEnd-1].Name = u"ConversionRequestOrigin"_ustr; + pArgs[nEnd-1].Value <<= *oConversionRequestOrigin; + } return xFilter->filter( aArgs ); }
