summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorOuyang Leyan <ouyang.leyan@hotmail.com>2020-09-06 20:11:57 +0200
committerAndras Timar <andras.timar@collabora.com>2020-11-11 09:52:47 +0100
commit7c1a4e77e90f5997010107540e8d019d4088dfb0 (patch)
tree67c32b08480a7593bc6c00ce877d4cf3a3877661 /chart2
parent8ab544945bf7495ab91020a6f7284acb5c0a324d (diff)
tdf#133630 Check object type when updating side panel data
Change-Id: I033b4c7fb1dc1787d28caf5b925ed45bbb63cf06 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102544 Tested-by: Jenkins Reviewed-by: Andras Timar <andras.timar@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105525 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/sidebar/ChartAxisPanel.cxx8
-rw-r--r--chart2/source/controller/sidebar/ChartErrorBarPanel.cxx16
-rw-r--r--chart2/source/controller/sidebar/ChartSeriesPanel.cxx12
3 files changed, 31 insertions, 5 deletions
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.cxx b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
index 419c287d3eeb..94d7b3cca480 100644
--- a/chart2/source/controller/sidebar/ChartAxisPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
@@ -24,6 +24,7 @@
#include <com/sun/star/util/XModifyBroadcaster.hpp>
+#include <sal/log.hxx>
#include "ChartAxisPanel.hxx"
#include <ChartController.hxx>
#include <vcl/lstbox.hxx>
@@ -167,7 +168,8 @@ OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
aAny >>= aCID;
#if defined DBG_UTIL && !defined NDEBUG
ObjectType eType = ObjectIdentifier::getObjectType(aCID);
- assert(eType == OBJECTTYPE_AXIS);
+ if(eType != OBJECTTYPE_AXIS)
+ SAL_WARN("chart2","Selected item is not an axis");
#endif
return aCID;
@@ -274,6 +276,10 @@ void ChartAxisPanel::updateData()
return;
OUString aCID = getCID(mxModel);
+ ObjectType eType = ObjectIdentifier::getObjectType(aCID);
+ if (eType!=OBJECTTYPE_AXIS)
+ return;
+
SolarMutexGuard aGuard;
mpCBShowLabel->Check(isLabelShown(mxModel, aCID));
diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
index 4ef3c19228dd..655fe34a811d 100644
--- a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
@@ -27,6 +27,8 @@
#include <vcl/field.hxx>
#include <vcl/button.hxx>
#include <vcl/svapp.hxx>
+#include <sal/log.hxx>
+
using namespace css;
using namespace css::uno;
@@ -223,9 +225,11 @@ OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
aAny >>= aCID;
#if defined DBG_UTIL && !defined NDEBUG
ObjectType eType = ObjectIdentifier::getObjectType(aCID);
- assert(eType == OBJECTTYPE_DATA_ERRORS_X ||
- eType == OBJECTTYPE_DATA_ERRORS_Y ||
- eType == OBJECTTYPE_DATA_ERRORS_Z);
+ if (eType != OBJECTTYPE_DATA_ERRORS_X &&
+ eType != OBJECTTYPE_DATA_ERRORS_Y &&
+ eType != OBJECTTYPE_DATA_ERRORS_Z)
+ SAL_WARN("chart2","Selected item is not an error bar");
+
#endif
return aCID;
@@ -305,6 +309,12 @@ void ChartErrorBarPanel::updateData()
return;
OUString aCID = getCID(mxModel);
+ ObjectType eType = ObjectIdentifier::getObjectType(aCID);
+ if (eType != OBJECTTYPE_DATA_ERRORS_X &&
+ eType != OBJECTTYPE_DATA_ERRORS_Y &&
+ eType != OBJECTTYPE_DATA_ERRORS_Z)
+ return;
+
bool bPos = showPositiveError(mxModel, aCID);
bool bNeg = showNegativeError(mxModel, aCID);
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
index d2ce4e198fcc..36b5dc2957bb 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
#include <com/sun/star/util/XModifyBroadcaster.hpp>
+#include <sal/log.hxx>
#include "ChartSeriesPanel.hxx"
#include <ChartController.hxx>
#include <vcl/fixed.hxx>
@@ -264,7 +265,10 @@ OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
#if defined DBG_UTIL && !defined NDEBUG
ObjectType eType = ObjectIdentifier::getObjectType(aCID);
- assert(eType == OBJECTTYPE_DATA_SERIES);
+ if (eType != OBJECTTYPE_DATA_SERIES &&
+ eType != OBJECTTYPE_DATA_POINT &&
+ eType != OBJECTTYPE_DATA_CURVE)
+ SAL_WARN("chart2","Selected item is not a chart series");
#endif
return aCID;
@@ -358,6 +362,12 @@ void ChartSeriesPanel::updateData()
return;
OUString aCID = getCID(mxModel);
+ ObjectType eType = ObjectIdentifier::getObjectType(aCID);
+ if (eType!=OBJECTTYPE_DATA_SERIES &&
+ eType != OBJECTTYPE_DATA_POINT &&
+ eType != OBJECTTYPE_DATA_CURVE)
+ return;
+
SolarMutexGuard aGuard;
bool bLabelVisible = isDataLabelVisible(mxModel, aCID);
mpCBLabel->Check(bLabelVisible);