[Libreoffice-commits] core.git: chart2/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Wed May 19 19:38:47 UTC 2021
chart2/source/controller/sidebar/ChartAreaPanel.cxx | 30 ++++++++--------
chart2/source/controller/sidebar/ChartAreaPanel.hxx | 1
chart2/source/controller/sidebar/ChartAxisPanel.cxx | 30 ++++++++--------
chart2/source/controller/sidebar/ChartAxisPanel.hxx | 1
chart2/source/controller/sidebar/ChartElementsPanel.cxx | 17 ++++++---
chart2/source/controller/sidebar/ChartElementsPanel.hxx | 1
chart2/source/controller/sidebar/ChartErrorBarPanel.cxx | 16 +++++---
chart2/source/controller/sidebar/ChartErrorBarPanel.hxx | 1
chart2/source/controller/sidebar/ChartLinePanel.cxx | 30 ++++++++--------
chart2/source/controller/sidebar/ChartLinePanel.hxx | 1
chart2/source/controller/sidebar/ChartSeriesPanel.cxx | 19 +++++-----
chart2/source/controller/sidebar/ChartSeriesPanel.hxx | 1
chart2/source/controller/sidebar/ChartTypePanel.cxx | 16 +++++---
chart2/source/controller/sidebar/ChartTypePanel.hxx | 1
14 files changed, 100 insertions(+), 65 deletions(-)
New commits:
commit feb17e47bc04e2af6b4ecf7202764ce980f83242
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed May 19 17:36:48 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed May 19 21:38:06 2021 +0200
tdf#142364 exception thrown during destruction
Change-Id: I4e06ac82108e5381cd11fbd6407e1ce1e85c3ac6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115822
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index 51e71e22cf33..0378f7bbda6f 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -289,12 +289,7 @@ ChartAreaPanel::ChartAreaPanel(weld::Widget* pParent,
ChartAreaPanel::~ChartAreaPanel()
{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->removeModifyListener(mxListener);
-
- css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
- if (xSelectionSupplier.is())
- xSelectionSupplier->removeSelectionChangeListener(mxSelectionListener);
+ doUpdateModel(nullptr);
}
void ChartAreaPanel::Initialize()
@@ -512,23 +507,25 @@ void ChartAreaPanel::selectionChanged(bool bCorrectType)
updateData();
}
-void ChartAreaPanel::updateModel(
- css::uno::Reference<css::frame::XModel> xModel)
+void ChartAreaPanel::doUpdateModel(css::uno::Reference<css::frame::XModel> xModel)
{
if (mbModelValid)
{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcaster->removeModifyListener(mxListener);
- }
- css::uno::Reference<css::view::XSelectionSupplier> oldSelectionSupplier(
- mxModel->getCurrentController(), css::uno::UNO_QUERY);
- if (oldSelectionSupplier.is()) {
- oldSelectionSupplier->removeSelectionChangeListener(mxSelectionListener);
+ css::uno::Reference<css::view::XSelectionSupplier> oldSelectionSupplier(
+ mxModel->getCurrentController(), css::uno::UNO_QUERY);
+ if (oldSelectionSupplier.is()) {
+ oldSelectionSupplier->removeSelectionChangeListener(mxSelectionListener);
+ }
}
mxModel = xModel;
- mbModelValid = true;
+ mbModelValid = mxModel.is();
+
+ if (!mbModelValid)
+ return;
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcasterNew->addModifyListener(mxListener);
@@ -538,6 +535,11 @@ void ChartAreaPanel::updateModel(
xSelectionSupplier->addSelectionChangeListener(mxSelectionListener);
}
+void ChartAreaPanel::updateModel( css::uno::Reference<css::frame::XModel> xModel)
+{
+ doUpdateModel(xModel);
+}
+
}
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.hxx b/chart2/source/controller/sidebar/ChartAreaPanel.hxx
index 01fb9077a178..110132ca4356 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.hxx
@@ -72,6 +72,7 @@ private:
rtl::Reference<ChartSidebarSelectionListener> mxSelectionListener;
void Initialize();
+ void doUpdateModel(css::uno::Reference<css::frame::XModel> xModel);
bool mbUpdate;
bool mbModelValid;
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.cxx b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
index f35a57bdf232..ccab43770b8f 100644
--- a/chart2/source/controller/sidebar/ChartAxisPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
@@ -222,12 +222,7 @@ ChartAxisPanel::ChartAxisPanel(
ChartAxisPanel::~ChartAxisPanel()
{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->removeModifyListener(mxModifyListener);
-
- css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
- if (xSelectionSupplier.is())
- xSelectionSupplier->removeSelectionChangeListener(mxSelectionListener);
+ doUpdateModel(nullptr);
mxCBShowLabel.reset();
mxCBReverse.reset();
@@ -311,23 +306,25 @@ void ChartAxisPanel::modelInvalid()
mbModelValid = false;
}
-void ChartAxisPanel::updateModel(
- css::uno::Reference<css::frame::XModel> xModel)
+void ChartAxisPanel::doUpdateModel(css::uno::Reference<css::frame::XModel> xModel)
{
if (mbModelValid)
{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcaster->removeModifyListener(mxModifyListener);
- }
- css::uno::Reference<css::view::XSelectionSupplier> oldSelectionSupplier(
- mxModel->getCurrentController(), css::uno::UNO_QUERY);
- if (oldSelectionSupplier.is()) {
- oldSelectionSupplier->removeSelectionChangeListener(mxSelectionListener);
+ css::uno::Reference<css::view::XSelectionSupplier> oldSelectionSupplier(
+ mxModel->getCurrentController(), css::uno::UNO_QUERY);
+ if (oldSelectionSupplier.is()) {
+ oldSelectionSupplier->removeSelectionChangeListener(mxSelectionListener);
+ }
}
mxModel = xModel;
- mbModelValid = true;
+ mbModelValid = mxModel.is();
+
+ if (!mbModelValid)
+ return;
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcasterNew->addModifyListener(mxModifyListener);
@@ -337,6 +334,11 @@ void ChartAxisPanel::updateModel(
xSelectionSupplier->addSelectionChangeListener(mxSelectionListener);
}
+void ChartAxisPanel::updateModel(css::uno::Reference<css::frame::XModel> xModel)
+{
+ doUpdateModel(xModel);
+}
+
void ChartAxisPanel::selectionChanged(bool bCorrectType)
{
if (bCorrectType)
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.hxx b/chart2/source/controller/sidebar/ChartAxisPanel.hxx
index b5f36d90ad89..4134b76c20dd 100644
--- a/chart2/source/controller/sidebar/ChartAxisPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.hxx
@@ -81,6 +81,7 @@ private:
bool mbModelValid;
void Initialize();
+ void doUpdateModel(css::uno::Reference<css::frame::XModel> xModel);
DECL_LINK(CheckBoxHdl, weld::ToggleButton&, void);
DECL_LINK(ListBoxHdl, weld::ComboBox&, void);
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index 582ac621ee12..59afe8cbb7d4 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -339,8 +339,8 @@ ChartElementsPanel::ChartElementsPanel(
ChartElementsPanel::~ChartElementsPanel()
{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->removeModifyListener(mxListener);
+ doUpdateModel(nullptr);
+
mxCBTitle.reset();
mxEditTitle.reset();
mxCBSubtitle.reset();
@@ -563,8 +563,7 @@ void ChartElementsPanel::modelInvalid()
mbModelValid = false;
}
-void ChartElementsPanel::updateModel(
- css::uno::Reference<css::frame::XModel> xModel)
+void ChartElementsPanel::doUpdateModel(css::uno::Reference<css::frame::XModel> xModel)
{
if (mbModelValid)
{
@@ -573,12 +572,20 @@ void ChartElementsPanel::updateModel(
}
mxModel = xModel;
- mbModelValid = true;
+ mbModelValid = mxModel.is();
+
+ if (!mbModelValid)
+ return;
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcasterNew->addModifyListener(mxListener);
}
+void ChartElementsPanel::updateModel(css::uno::Reference<css::frame::XModel> xModel)
+{
+ doUpdateModel(xModel);
+}
+
IMPL_LINK(ChartElementsPanel, CheckBoxHdl, weld::ToggleButton&, rCheckBox, void)
{
bool bChecked = rCheckBox.get_active();
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.hxx b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
index 801b40efdb72..b53aa715f583 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
@@ -102,6 +102,7 @@ private:
OUString maTextSubTitle;
void Initialize();
+ void doUpdateModel(css::uno::Reference<css::frame::XModel> xModel);
void setTitleVisible(TitleHelper::eTitleType eTitle, bool bVisible);
diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
index 943abdbdd66c..1b3f35551382 100644
--- a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
@@ -251,8 +251,7 @@ ChartErrorBarPanel::ChartErrorBarPanel(weld::Widget* pParent, ChartController* p
ChartErrorBarPanel::~ChartErrorBarPanel()
{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->removeModifyListener(mxListener);
+ doUpdateModel(nullptr);
mxRBPosAndNeg.reset();
mxRBPos.reset();
@@ -371,8 +370,7 @@ void ChartErrorBarPanel::modelInvalid()
mbModelValid = false;
}
-void ChartErrorBarPanel::updateModel(
- css::uno::Reference<css::frame::XModel> xModel)
+void ChartErrorBarPanel::doUpdateModel(css::uno::Reference<css::frame::XModel> xModel)
{
if (mbModelValid)
{
@@ -381,12 +379,20 @@ void ChartErrorBarPanel::updateModel(
}
mxModel = xModel;
- mbModelValid = true;
+ mbModelValid = mxModel.is();
+
+ if (!mbModelValid)
+ return;
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcasterNew->addModifyListener(mxListener);
}
+void ChartErrorBarPanel::updateModel(css::uno::Reference<css::frame::XModel> xModel)
+{
+ doUpdateModel(xModel);
+}
+
IMPL_LINK_NOARG(ChartErrorBarPanel, RadioBtnHdl, weld::ToggleButton&, void)
{
OUString aCID = getCID(mxModel);
diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
index 0b95a565bf01..e87a65d845b9 100644
--- a/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
@@ -78,6 +78,7 @@ private:
bool mbModelValid;
void Initialize();
+ void doUpdateModel(css::uno::Reference<css::frame::XModel> xModel);
DECL_LINK(RadioBtnHdl, weld::ToggleButton&, void);
DECL_LINK(ListBoxHdl, weld::ComboBox&, void);
diff --git a/chart2/source/controller/sidebar/ChartLinePanel.cxx b/chart2/source/controller/sidebar/ChartLinePanel.cxx
index d36c1bf7ce31..1de557ec5aba 100644
--- a/chart2/source/controller/sidebar/ChartLinePanel.cxx
+++ b/chart2/source/controller/sidebar/ChartLinePanel.cxx
@@ -143,12 +143,7 @@ ChartLinePanel::ChartLinePanel(weld::Widget* pParent,
ChartLinePanel::~ChartLinePanel()
{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->removeModifyListener(mxListener);
-
- css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
- if (xSelectionSupplier.is())
- xSelectionSupplier->removeSelectionChangeListener(mxSelectionListener);
+ doUpdateModel(nullptr);
}
void ChartLinePanel::Initialize()
@@ -205,23 +200,25 @@ void ChartLinePanel::selectionChanged(bool bCorrectType)
updateData();
}
-void ChartLinePanel::updateModel(
- css::uno::Reference<css::frame::XModel> xModel)
+void ChartLinePanel::doUpdateModel(css::uno::Reference<css::frame::XModel> xModel)
{
if (mbModelValid)
{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcaster->removeModifyListener(mxListener);
- }
- css::uno::Reference<css::view::XSelectionSupplier> oldSelectionSupplier(
- mxModel->getCurrentController(), css::uno::UNO_QUERY);
- if (oldSelectionSupplier.is()) {
- oldSelectionSupplier->removeSelectionChangeListener(mxSelectionListener);
+ css::uno::Reference<css::view::XSelectionSupplier> oldSelectionSupplier(
+ mxModel->getCurrentController(), css::uno::UNO_QUERY);
+ if (oldSelectionSupplier.is()) {
+ oldSelectionSupplier->removeSelectionChangeListener(mxSelectionListener);
+ }
}
mxModel = xModel;
- mbModelValid = true;
+ mbModelValid = mxModel.is();
+
+ if (!mbModelValid)
+ return;
maLineStyleWrapper.updateModel(mxModel);
maLineColorWrapper.updateModel(mxModel);
@@ -234,6 +231,11 @@ void ChartLinePanel::updateModel(
xSelectionSupplier->addSelectionChangeListener(mxSelectionListener);
}
+void ChartLinePanel::updateModel(css::uno::Reference<css::frame::XModel> xModel)
+{
+ doUpdateModel(xModel);
+}
+
void ChartLinePanel::setLineJoint(const XLineJointItem* pItem)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet =
diff --git a/chart2/source/controller/sidebar/ChartLinePanel.hxx b/chart2/source/controller/sidebar/ChartLinePanel.hxx
index b46452467fec..c1348c7ac481 100644
--- a/chart2/source/controller/sidebar/ChartLinePanel.hxx
+++ b/chart2/source/controller/sidebar/ChartLinePanel.hxx
@@ -74,6 +74,7 @@ private:
rtl::Reference<ChartSidebarSelectionListener> mxSelectionListener;
void Initialize();
+ void doUpdateModel(css::uno::Reference<css::frame::XModel> xModel);
bool mbUpdate;
bool mbModelValid;
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
index 4ce23d66811c..fe2452572985 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
@@ -300,11 +300,7 @@ ChartSeriesPanel::ChartSeriesPanel(
ChartSeriesPanel::~ChartSeriesPanel()
{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
- xBroadcaster->removeModifyListener(mxListener);
- css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
- if (xSelectionSupplier.is())
- xSelectionSupplier->removeSelectionChangeListener(mxSelectionListener);
+ doUpdateModel(nullptr);
mxCBLabel.reset();
mxCBTrendline.reset();
@@ -409,8 +405,7 @@ void ChartSeriesPanel::modelInvalid()
mbModelValid = false;
}
-void ChartSeriesPanel::updateModel(
- css::uno::Reference<css::frame::XModel> xModel)
+void ChartSeriesPanel::doUpdateModel(css::uno::Reference<css::frame::XModel> xModel)
{
if (mbModelValid)
{
@@ -425,7 +420,10 @@ void ChartSeriesPanel::updateModel(
}
mxModel = xModel;
- mbModelValid = true;
+ mbModelValid = mxModel.is();
+
+ if (!mbModelValid)
+ return;
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcasterNew->addModifyListener(mxListener);
@@ -435,6 +433,11 @@ void ChartSeriesPanel::updateModel(
xSelectionSupplier->addSelectionChangeListener(mxSelectionListener);
}
+void ChartSeriesPanel::updateModel(css::uno::Reference<css::frame::XModel> xModel)
+{
+ doUpdateModel(xModel);
+}
+
void ChartSeriesPanel::selectionChanged(bool bCorrectType)
{
if (bCorrectType)
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.hxx b/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
index 2844051001fe..64bc5315bfaa 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
@@ -98,6 +98,7 @@ private:
bool mbModelValid;
void Initialize();
+ void doUpdateModel(css::uno::Reference<css::frame::XModel> xModel);
DECL_LINK(CheckBoxHdl, weld::ToggleButton&, void);
DECL_LINK(RadioBtnHdl, weld::ToggleButton&, void);
diff --git a/chart2/source/controller/sidebar/ChartTypePanel.cxx b/chart2/source/controller/sidebar/ChartTypePanel.cxx
index 8ff15267760b..2fca2443807f 100644
--- a/chart2/source/controller/sidebar/ChartTypePanel.cxx
+++ b/chart2/source/controller/sidebar/ChartTypePanel.cxx
@@ -121,9 +121,7 @@ ChartTypePanel::ChartTypePanel(weld::Widget* pParent, ::chart::ChartController*
ChartTypePanel::~ChartTypePanel()
{
- css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel,
- css::uno::UNO_QUERY_THROW);
- xBroadcaster->removeModifyListener(mxListener);
+ doUpdateModel(nullptr);
//delete all dialog controller
m_aChartTypeDialogControllerList.clear();
@@ -264,7 +262,7 @@ void ChartTypePanel::HandleContextChange(const vcl::EnumContext& rContext)
void ChartTypePanel::modelInvalid() { mbModelValid = false; }
-void ChartTypePanel::updateModel(css::uno::Reference<css::frame::XModel> xModel)
+void ChartTypePanel::doUpdateModel(css::uno::Reference<css::frame::XModel> xModel)
{
if (mbModelValid)
{
@@ -274,13 +272,21 @@ void ChartTypePanel::updateModel(css::uno::Reference<css::frame::XModel> xModel)
}
mxModel = xModel;
- mbModelValid = true;
+ mbModelValid = mxModel.is();
+
+ if (!mbModelValid)
+ return;
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel,
css::uno::UNO_QUERY_THROW);
xBroadcasterNew->addModifyListener(mxListener);
}
+void ChartTypePanel::updateModel(css::uno::Reference<css::frame::XModel> xModel)
+{
+ doUpdateModel(xModel);
+}
+
uno::Reference<css::chart2::XChartTypeTemplate> ChartTypePanel::getCurrentTemplate() const
{
if (m_pCurrentMainType && m_xChartModel.is())
diff --git a/chart2/source/controller/sidebar/ChartTypePanel.hxx b/chart2/source/controller/sidebar/ChartTypePanel.hxx
index 6a9036ebaa02..9610ce3520e9 100644
--- a/chart2/source/controller/sidebar/ChartTypePanel.hxx
+++ b/chart2/source/controller/sidebar/ChartTypePanel.hxx
@@ -96,6 +96,7 @@ private:
bool mbModelValid;
void Initialize();
+ void doUpdateModel(css::uno::Reference<css::frame::XModel> xModel);
std::unique_ptr<Dim3DLookResourceGroup> m_pDim3DLookResourceGroup;
std::unique_ptr<StackingResourceGroup> m_pStackingResourceGroup;
More information about the Libreoffice-commits
mailing list