summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2020-07-20 14:10:51 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2020-07-20 22:44:59 +0200
commit346bc3661bfde0c4e000716601a26f91e0bd523f (patch)
treeb245b959ad17a67e7cf6f68344ee7f2fc8c3afb5 /sw
parent09974c595adf81fde90dfa27ccac771d1f0ecfff (diff)
tdf#134973: restore unmodified status of chart on export
Upon first save, the chart model may get modified during export when accessing subtitle which gets created when not yet existing. That modified state hadn't been reset previously, when the save was done in the DocxAttributeOutput::WritePostponedChart. Prior to 129f55097f926661f00919329fb28c6a85ecebbb, because of double insertion of the same object, EmbeddedObjectContainer::StoreChildren stored the duplicate of the chart again (after the "modification" happened in DocxAttributeOutput::WritePostponedChart), and reset the status in ChartModel::impl_store. The mentioned commit made the old problem manifest itself. Change-Id: Ib6b11bf85fcef93c6d86f7ab5c0e4b0d6508860c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99044 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/docxexport.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index c5f9d5d4eb42..caaacf7a0024 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -35,6 +35,7 @@
#include <com/sun/star/awt/XControlModel.hpp>
#include <com/sun/star/sdb/CommandType.hpp>
#include <com/sun/star/text/XTextFieldsSupplier.hpp>
+#include <com/sun/star/util/XModifiable.hpp>
#include <oox/token/namespaces.hxx>
#include <oox/token/tokens.hxx>
@@ -383,7 +384,13 @@ OString DocxExport::OutputChart( uno::Reference< frame::XModel > const & xModel,
"application/vnd.openxmlformats-officedocument.drawingml.chart+xml" );
oox::drawingml::ChartExport aChartExport(XML_w, pChartFS, xModel, m_pFilter, oox::drawingml::DOCUMENT_DOCX);
+ css::uno::Reference<css::util::XModifiable> xModifiable(xModel, css::uno::UNO_QUERY);
+ const bool bOldModified = xModifiable && xModifiable->isModified();
aChartExport.ExportContent();
+ if (!bOldModified && xModifiable && xModifiable->isModified())
+ // tdf#134973: the model could get modified: e.g., calling XChartDocument::getSubTitle(),
+ // which creates the object if absent, and sets the modified state.
+ xModifiable->setModified(bOldModified);
return OUStringToOString( sId, RTL_TEXTENCODING_UTF8 );
}