chart2/qa/extras/charttest.hxx                      |    6 ++++++
 chart2/source/model/main/ChartModel_Persistence.cxx |    7 +++++++
 2 files changed, 13 insertions(+)

New commits:
commit 574eec9036c5f185b3572ba1e0ca9d111eb361dc
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sat Sep 12 17:22:23 2020 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Tue Sep 15 06:09:04 2020 +0200

    tdf#77007: chart must honor its parent's IsEnableSetModified
    
    Regression from commit bb97ecdbcc8d8dafd39e728b21bc68efee4eccbc,
    which had dropped storing chart doc (calling its storeOwn) while
    loading back in 2012, to avoid performance problems when loading
    XLS.
    
    Funnily, in 2013, commit a666862deffa33013d3df3bb62e87c67f9a89948
    was merged, that was expected to solve exactly the same problem as
    this change, by calling storeOwn for charts being loaded; while
    obviously not fixing the problem properly, it seems to had undone
    the effect of the Markus's commit.
    
    The latter commit had a side effect of updating views of modified
    charts while exporting them inside storeOwn, which made respective
    draw pages to be up-to-date right after loading, including those on
    inactive sheets. Now, after this change, this is not so, thus unit
    tests' getChartDocFromSheet was made to update the view explicitly.
    
    Unfortunately, it's not yet possible to revert the change from
    commit a666862deffa33013d3df3bb62e87c67f9a89948, because obviously
    some dependency grew, which makes e.g. testTdf122594 fail if that
    commit is reverted. Given that testTdf122594 has no charts, storing
    the modified objects while loading has much wider side effects than
    was expected by author of a666862deffa33013d3df3bb62e87c67f9a89948.
    
    Change-Id: Iee1b9ef6f4d8c2dfa0a49680c5e2b465f1817a59
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102534
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/chart2/qa/extras/charttest.hxx b/chart2/qa/extras/charttest.hxx
index 156893cd2cb5..bcd1f101189d 100644
--- a/chart2/qa/extras/charttest.hxx
+++ b/chart2/qa/extras/charttest.hxx
@@ -29,6 +29,7 @@
 
 #include <unotools/tempfile.hxx>
 #include <rtl/math.hxx>
+#include <svx/charthelper.hxx>
 
 #include <com/sun/star/chart2/XAnyDescriptionAccess.hpp>
 #include <com/sun/star/chart2/XChartDocument.hpp>
@@ -204,6 +205,11 @@ Reference< lang::XComponent > getChartCompFromSheet( 
sal_Int32 nSheet, uno::Refe
 Reference< chart2::XChartDocument > getChartDocFromSheet( sal_Int32 nSheet, 
uno::Reference< lang::XComponent > const & xComponent )
 {
     uno::Reference< chart2::XChartDocument > xChartDoc ( 
getChartCompFromSheet(nSheet, xComponent), UNO_QUERY_THROW );
+
+    // Update the chart view, so that its draw page is updated and ready for 
the test
+    css::uno::Reference<css::frame::XModel> xModel(xChartDoc, 
css::uno::UNO_QUERY_THROW);
+    ChartHelper::updateChart(xModel);
+
     return xChartDoc;
 }
 
diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx 
b/chart2/source/model/main/ChartModel_Persistence.cxx
index 313b472be0d7..c505da695e73 100644
--- a/chart2/source/model/main/ChartModel_Persistence.cxx
+++ b/chart2/source/model/main/ChartModel_Persistence.cxx
@@ -57,6 +57,7 @@
 #include <vcl/svapp.hxx>
 #include <tools/diagnose_ex.h>
 #include <sal/log.hxx>
+#include <sfx2/objsh.hxx>
 
 #include <algorithm>
 
@@ -668,6 +669,12 @@ sal_Bool SAL_CALL ChartModel::isModified()
 
 void SAL_CALL ChartModel::setModified( sal_Bool bModified )
 {
+    // tdf#77007: honor parent's IsEnableSetModified
+    // Check it before LifeTimeGuard, to avoid deadlocking solar mutex and 
this guard
+    if (auto pParentShell = SfxObjectShell::GetShellFromComponent(getParent());
+        pParentShell && !pParentShell->IsEnableSetModified())
+        return;
+
     apphelper::LifeTimeGuard aGuard(m_aLifeTimeManager);
     if(!aGuard.startApiCall())//@todo ? is this a long lasting call??
         return; //behave passive if already disposed or closed or throw 
exception @todo?
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to