summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-10-16 15:22:17 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-10-16 18:27:49 +0200
commitf26bf09a0e93449ea85269a09a8a073a20903349 (patch)
tree0e7071c1bfd3c5f5fe4adb47a81cdf2b037db28c /chart2
parent6506279e3bed2284ce0ec9a0957a0201eb0d72ae (diff)
tdf#141892: Set chart view to dirty state after loading
Previously, ChartViewHelper::setViewToDirtyState was only called in ChartModel::impl_notifyModifiedListeners during the load process of inline charts; after commit 574eec9036c5f185b3572ba1e0ca9d111eb361dc, the chart doesn't set its modified state when loading, and thus the view did not get notified about the necessary updates. This change introduces a hidden property in ChartDocumentWrapper, named 'ODFImport_UpdateView', which is set in SchXMLImport dtor to force the notification after the loading. Change-Id: Id9d82f16d233d2172cd6808a8498822e13b21b21 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158051 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx15
-rw-r--r--chart2/source/controller/inc/ChartDocumentWrapper.hxx4
-rw-r--r--chart2/source/inc/ChartViewHelper.hxx14
-rw-r--r--chart2/source/tools/ChartViewHelper.cxx10
4 files changed, 38 insertions, 5 deletions
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
index 70c9ace455b9..ea01ae000b65 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -19,6 +19,7 @@
#include <ChartDocumentWrapper.hxx>
#include <ChartView.hxx>
+#include <ChartViewHelper.hxx>
#include <ChartTypeManager.hxx>
#include <ChartTypeTemplate.hxx>
#include <servicenames.hxx>
@@ -1366,6 +1367,20 @@ void ChartDocumentWrapper::_disposing( const lang::EventObject& rSource )
m_xChartView.clear();
}
+// ____ XPropertySet ____
+void SAL_CALL ChartDocumentWrapper::setPropertyValue(const OUString& rPropertyName, const css::uno::Any& rValue)
+{
+ if (rPropertyName == u"ODFImport_UpdateView")
+ {
+ // A hack used at load time to notify the view that it needs an update
+ // See SchXMLImport::~SchXMLImport
+ if (auto xChartModel = rValue.query<css::chart2::XChartDocument>())
+ ChartViewHelper::setViewToDirtyState_UNO(xChartModel);
+ return;
+ }
+ ChartDocumentWrapper_Base::setPropertyValue(rPropertyName, rValue);
+}
+
// WrappedPropertySet
Reference< beans::XPropertySet > ChartDocumentWrapper::getInnerPropertySet()
{
diff --git a/chart2/source/controller/inc/ChartDocumentWrapper.hxx b/chart2/source/controller/inc/ChartDocumentWrapper.hxx
index 04f76d705b6b..a5bded3c8fb7 100644
--- a/chart2/source/controller/inc/ChartDocumentWrapper.hxx
+++ b/chart2/source/controller/inc/ChartDocumentWrapper.hxx
@@ -139,6 +139,10 @@ protected:
virtual std::vector< std::unique_ptr<WrappedProperty> > createWrappedProperties() override;
virtual css::uno::Reference< css::beans::XPropertySet > getInnerPropertySet() override;
+ // ____ XPropertySet ____
+ virtual void SAL_CALL setPropertyValue(const OUString& rPropertyName,
+ const css::uno::Any& rValue) override;
+
private: //methods
void impl_resetAddIn();
diff --git a/chart2/source/inc/ChartViewHelper.hxx b/chart2/source/inc/ChartViewHelper.hxx
index 06fef6a1ff9b..be70dd9fecb4 100644
--- a/chart2/source/inc/ChartViewHelper.hxx
+++ b/chart2/source/inc/ChartViewHelper.hxx
@@ -21,14 +21,22 @@
#include "charttoolsdllapi.hxx"
#include <rtl/ref.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
+namespace com::sun::star::chart2
+{
+class XChartDocument;
+}
+
namespace chart
{
class ChartModel;
-class OOO_DLLPUBLIC_CHARTTOOLS ChartViewHelper
+namespace ChartViewHelper
{
-public:
- static void setViewToDirtyState(const rtl::Reference<::chart::ChartModel>& xChartModel);
+OOO_DLLPUBLIC_CHARTTOOLS void setViewToDirtyState(const rtl::Reference<ChartModel>& xChartModel);
+OOO_DLLPUBLIC_CHARTTOOLS void
+setViewToDirtyState_UNO(const css::uno::Reference<css::chart2::XChartDocument>& xChartModel);
};
} //namespace chart
diff --git a/chart2/source/tools/ChartViewHelper.cxx b/chart2/source/tools/ChartViewHelper.cxx
index 183d28189531..8011da3c171c 100644
--- a/chart2/source/tools/ChartViewHelper.cxx
+++ b/chart2/source/tools/ChartViewHelper.cxx
@@ -21,8 +21,7 @@
#include <ChartModel.hxx>
#include <servicenames.hxx>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/util/XModifyListener.hpp>
#include <comphelper/diagnose_ex.hxx>
@@ -51,6 +50,13 @@ void ChartViewHelper::setViewToDirtyState(const rtl::Reference<::chart::ChartMod
DBG_UNHANDLED_EXCEPTION("chart2");
}
}
+
+void ChartViewHelper::setViewToDirtyState_UNO(
+ const css::uno::Reference<css::chart2::XChartDocument>& xChartModel)
+{
+ if (auto pChartModel = dynamic_cast<ChartModel*>(xChartModel.get()))
+ setViewToDirtyState(rtl::Reference(pChartModel));
+}
} //namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */