summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2021-03-09 10:47:50 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2021-03-15 10:16:15 +0100
commitb4f38c6b8bbc6ea6a5d9354bfd24e411fc5a51fc (patch)
treef4eb71da090bb7af73d6bbc0e3bc796e889b2eb5 /sc/source
parent9bc6160e0acbc78be998129ea55ed7e4529959fa (diff)
tdf#133487 sc ODF export: reorder flys' ZOrder/z-index...
... so background shapes have lower z-index than foreground shapes, as is recommended by ODF 1.3. Spreadsheets use a different attribute, table:table-background="true" on the shape itself. Change-Id: I98338972c3a1bd116aa1959f3280d5336aec7bf3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112196 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/filter/xml/xmlwrap.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx
index 446ce19e34d8..573f6886539c 100644
--- a/sc/source/filter/xml/xmlwrap.cxx
+++ b/sc/source/filter/xml/xmlwrap.cxx
@@ -54,6 +54,7 @@
#include <sfx2/DocumentMetadataAccess.hxx>
#include <comphelper/documentconstants.hxx>
+#include <xmloff/shapeexport.hxx>
#include <svx/xmleohlp.hxx>
#include <sal/log.hxx>
#include <unotools/saveopt.hxx>
@@ -767,6 +768,25 @@ bool ScXMLImportWrapper::Export(bool bStylesOnly)
if ( pObjSh && xStorage.is() )
{
uno::Reference<frame::XModel> xModel(pObjSh->GetModel());
+ // sorting wants to create undo actions
+ assert(SfxObjectCreateMode::STANDARD != pObjSh->GetCreateMode() || rDoc.GetDrawLayer()->IsUndoEnabled());
+ uno::Reference<drawing::XDrawPagesSupplier> const xDPS(xModel, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> const xDPs(xDPS->getDrawPages());
+ assert(xDPs.is());
+ for (auto i = xDPs->getCount(); 0 < i; )
+ {
+ --i;
+ uno::Reference<drawing::XShapes> const xDP(xDPs->getByIndex(i), uno::UNO_QUERY);
+ assert(xDP.is());
+ xmloff::FixZOrder(xDP,
+ [](uno::Reference<beans::XPropertySet> const& xShape)
+ {
+ sal_Int16 nLayerID(0);
+ xShape->getPropertyValue("LayerID") >>= nLayerID;
+ return SdrLayerID(nLayerID) == SC_LAYER_BACK;
+ });
+ }
+
uno::Reference<task::XStatusIndicator> xStatusIndicator(GetStatusIndicator());
sal_Int32 nProgressRange(1000000);
if(xStatusIndicator.is())