sw/source/filter/ww8/docxexport.cxx |    7 +++++++
 1 file changed, 7 insertions(+)

New commits:
commit 346bc3661bfde0c4e000716601a26f91e0bd523f
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Mon Jul 20 14:10:51 2020 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Mon Jul 20 22:44:59 2020 +0200

    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.kagan...@collabora.com>

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 );
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to