summaryrefslogtreecommitdiff
path: root/chart2/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-03-04 17:22:14 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-03-11 17:42:22 +0100
commit1653bb9bffaa84a40b7d81a8277e887ea28df4e4 (patch)
tree5e56142b7b63ab66fb1dcc781ffeb3ae5afda2ad /chart2/source
parent40c58f6039fb02cff74e442f6adc5ba38adcff1d (diff)
remove intermediate containers in sidebars
tested extension sidebars of: a) Wollmux extension sidebars b) Analog Clock Extension demo https://wiki.openoffice.org/wiki/Sidebar_for_Developers#Example:_Analog_Clock_Extension Change-Id: If9729e20526681928137989f01a8ae733a9b0cb5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112035 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'chart2/source')
-rw-r--r--chart2/source/controller/sidebar/Chart2PanelFactory.cxx38
-rw-r--r--chart2/source/controller/sidebar/ChartAreaPanel.cxx16
-rw-r--r--chart2/source/controller/sidebar/ChartAreaPanel.hxx8
-rw-r--r--chart2/source/controller/sidebar/ChartAxisPanel.cxx29
-rw-r--r--chart2/source/controller/sidebar/ChartAxisPanel.hxx10
-rw-r--r--chart2/source/controller/sidebar/ChartElementsPanel.cxx28
-rw-r--r--chart2/source/controller/sidebar/ChartElementsPanel.hxx10
-rw-r--r--chart2/source/controller/sidebar/ChartErrorBarPanel.cxx30
-rw-r--r--chart2/source/controller/sidebar/ChartErrorBarPanel.hxx10
-rw-r--r--chart2/source/controller/sidebar/ChartLinePanel.cxx16
-rw-r--r--chart2/source/controller/sidebar/ChartLinePanel.hxx8
-rw-r--r--chart2/source/controller/sidebar/ChartSeriesPanel.cxx28
-rw-r--r--chart2/source/controller/sidebar/ChartSeriesPanel.hxx9
-rw-r--r--chart2/source/controller/sidebar/ChartTypePanel.cxx20
-rw-r--r--chart2/source/controller/sidebar/ChartTypePanel.hxx5
15 files changed, 79 insertions, 186 deletions
diff --git a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
index 62d1ab65753f..b5bde521d031 100644
--- a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
+++ b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
@@ -20,12 +20,11 @@
#include "Chart2PanelFactory.hxx"
#include <sfx2/sidebar/SidebarPanelBase.hxx>
-#include <toolkit/helper/vclunohelper.hxx>
-#include <vcl/window.hxx>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <cppuhelper/exc_hlp.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <vcl/weldutils.hxx>
#include "ChartElementsPanel.hxx"
#include "ChartTypePanel.hxx"
@@ -62,8 +61,11 @@ Reference<css::ui::XUIElement> SAL_CALL ChartPanelFactory::createUIElement (
Reference<css::awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<css::awt::XWindow>()));
Reference<css::frame::XController> xController (aArguments.getOrDefault("Controller", Reference<css::frame::XController>()));
- VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
- if ( ! xParentWindow.is() || pParentWindow==nullptr)
+ weld::Widget* pParent(nullptr);
+ if (weld::TransportAsXWindow* pTunnel = dynamic_cast<weld::TransportAsXWindow*>(xParentWindow.get()))
+ pParent = pTunnel->getWidget();
+
+ if (!pParent)
throw RuntimeException(
"PanelFactory::createUIElement called without ParentWindow",
nullptr);
@@ -82,35 +84,27 @@ Reference<css::ui::XUIElement> SAL_CALL ChartPanelFactory::createUIElement (
"ChartPanelFactory::createUIElement called without valid ChartController",
nullptr);
- VclPtr<PanelLayout> pPanel;
+ std::unique_ptr<PanelLayout> xPanel;
if (rsResourceURL.endsWith("/ElementsPanel"))
- pPanel = ChartElementsPanel::Create( pParentWindow, xFrame, pController );
+ xPanel = ChartElementsPanel::Create( pParent, pController );
else if (rsResourceURL.endsWith("/TypePanel"))
- {
- //pPanel = ChartTypePanel::Create( pParentWindow, xFrame, pController );
- VclPtrInstance<ChartTypePanel> ppPanel(pParentWindow, xFrame, pController);
- xElement = sfx2::sidebar::SidebarPanelBase::Create(
- rsResourceURL,
- xFrame,
- ppPanel,
- css::ui::LayoutSize(-1,-1,-1));
- }
+ xPanel = std::make_unique<ChartTypePanel>(pParent, pController);
else if (rsResourceURL.endsWith("/SeriesPanel"))
- pPanel = ChartSeriesPanel::Create(pParentWindow, xFrame, pController);
+ xPanel = ChartSeriesPanel::Create(pParent, pController);
else if (rsResourceURL.endsWith("/AxisPanel"))
- pPanel = ChartAxisPanel::Create(pParentWindow, xFrame, pController);
+ xPanel = ChartAxisPanel::Create(pParent, pController);
else if (rsResourceURL.endsWith("/ErrorBarPanel"))
- pPanel = ChartErrorBarPanel::Create(pParentWindow, xFrame, pController);
+ xPanel = ChartErrorBarPanel::Create(pParent, pController);
else if (rsResourceURL.endsWith("/AreaPanel"))
- pPanel = ChartAreaPanel::Create(pParentWindow, xFrame, pController);
+ xPanel = ChartAreaPanel::Create(pParent, xFrame, pController);
else if (rsResourceURL.endsWith("/LinePanel"))
- pPanel = ChartLinePanel::Create(pParentWindow, xFrame, pController);
+ xPanel = ChartLinePanel::Create(pParent, xFrame, pController);
- if (pPanel)
+ if (xPanel)
xElement = sfx2::sidebar::SidebarPanelBase::Create(
rsResourceURL,
xFrame,
- pPanel,
+ std::move(xPanel),
css::ui::LayoutSize(-1,-1,-1));
}
catch (const css::uno::RuntimeException &)
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index 6d25025d460f..51e71e22cf33 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -256,8 +256,8 @@ private:
}
-VclPtr<PanelLayout> ChartAreaPanel::Create(
- vcl::Window* pParent,
+std::unique_ptr<PanelLayout> ChartAreaPanel::Create(
+ weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
ChartController* pController)
{
@@ -266,11 +266,10 @@ VclPtr<PanelLayout> ChartAreaPanel::Create(
if (!rxFrame.is())
throw css::lang::IllegalArgumentException("no XFrame given to ChartAxisPanel::Create", nullptr, 1);
- return VclPtr<ChartAreaPanel>::Create(
- pParent, rxFrame, pController);
+ return std::make_unique<ChartAreaPanel>(pParent, rxFrame, pController);
}
-ChartAreaPanel::ChartAreaPanel(vcl::Window* pParent,
+ChartAreaPanel::ChartAreaPanel(weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
ChartController* pController):
svx::sidebar::AreaPropertyPanelBase(pParent, rxFrame),
@@ -290,19 +289,12 @@ ChartAreaPanel::ChartAreaPanel(vcl::Window* pParent,
ChartAreaPanel::~ChartAreaPanel()
{
- disposeOnce();
-}
-
-void ChartAreaPanel::dispose()
-{
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);
-
- AreaPropertyPanelBase::dispose();
}
void ChartAreaPanel::Initialize()
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.hxx b/chart2/source/controller/sidebar/ChartAreaPanel.hxx
index c7d171f20e38..01fb9077a178 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.hxx
@@ -37,14 +37,14 @@ class ChartAreaPanel : public svx::sidebar::AreaPropertyPanelBase,
public ChartSidebarSelectionListenerParent
{
public:
- static VclPtr<PanelLayout> Create(
- vcl::Window* pParent,
+ static std::unique_ptr<PanelLayout> Create(
+ weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
ChartController* pController);
// constructor/destructor
ChartAreaPanel(
- vcl::Window* pParent,
+ weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
ChartController* pController);
@@ -63,8 +63,6 @@ public:
virtual void selectionChanged(bool bCorrectType) override;
- virtual void dispose() override;
-
virtual void updateModel(css::uno::Reference<css::frame::XModel> xModel) override;
private:
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.cxx b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
index bf84d253961d..f35a57bdf232 100644
--- a/chart2/source/controller/sidebar/ChartAxisPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.cxx
@@ -204,10 +204,9 @@ double getAxisRotation(const css::uno::Reference<css::frame::XModel>& xModel,
}
ChartAxisPanel::ChartAxisPanel(
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ weld::Widget* pParent,
ChartController* pController)
- : PanelLayout(pParent, "ChartAxisPanel", "modules/schart/ui/sidebaraxis.ui", rxFrame)
+ : PanelLayout(pParent, "ChartAxisPanel", "modules/schart/ui/sidebaraxis.ui")
, mxCBShowLabel(m_xBuilder->weld_check_button("checkbutton_show_label"))
, mxCBReverse(m_xBuilder->weld_check_button("checkbutton_reverse"))
, mxLBLabelPos(m_xBuilder->weld_combo_box("comboboxtext_label_position"))
@@ -219,17 +218,10 @@ ChartAxisPanel::ChartAxisPanel(
, mbModelValid(true)
{
Initialize();
-
- m_pInitialFocusWidget = mxCBShowLabel.get();
}
ChartAxisPanel::~ChartAxisPanel()
{
- disposeOnce();
-}
-
-void ChartAxisPanel::dispose()
-{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcaster->removeModifyListener(mxModifyListener);
@@ -244,8 +236,6 @@ void ChartAxisPanel::dispose()
mxGridLabel.reset();
mxNFRotation.reset();
-
- PanelLayout::dispose();
}
void ChartAxisPanel::Initialize()
@@ -288,23 +278,18 @@ void ChartAxisPanel::updateData()
mxNFRotation->set_value(getAxisRotation(mxModel, aCID), FieldUnit::DEGREE);
}
-VclPtr<PanelLayout> ChartAxisPanel::Create (
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+std::unique_ptr<PanelLayout> ChartAxisPanel::Create (
+ weld::Widget* pParent,
ChartController* pController)
{
if (pParent == nullptr)
throw lang::IllegalArgumentException("no parent Window given to ChartAxisPanel::Create", nullptr, 0);
- if ( ! rxFrame.is())
- throw lang::IllegalArgumentException("no XFrame given to ChartAxisPanel::Create", nullptr, 1);
-
- return VclPtr<ChartAxisPanel>::Create(
- pParent, rxFrame, pController);
+ return std::make_unique<ChartAxisPanel>(pParent, pController);
}
-void ChartAxisPanel::DataChanged(
- const DataChangedEvent& )
+void ChartAxisPanel::DataChanged(const DataChangedEvent& rEvent)
{
+ PanelLayout::DataChanged(rEvent);
updateData();
}
diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.hxx b/chart2/source/controller/sidebar/ChartAxisPanel.hxx
index f662c9f27cf5..b5f36d90ad89 100644
--- a/chart2/source/controller/sidebar/ChartAxisPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartAxisPanel.hxx
@@ -14,7 +14,6 @@
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
#include <sfx2/sidebar/SidebarModelUpdate.hxx>
#include <sfx2/sidebar/PanelLayout.hxx>
-
#include "ChartSidebarModifyListener.hxx"
#include "ChartSidebarSelectionListener.hxx"
@@ -35,9 +34,8 @@ class ChartAxisPanel : public PanelLayout,
public ChartSidebarSelectionListenerParent
{
public:
- static VclPtr<PanelLayout> Create(
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ static std::unique_ptr<PanelLayout> Create(
+ weld::Widget* pParent,
ChartController* pController);
virtual void DataChanged(
@@ -57,11 +55,9 @@ public:
// constructor/destructor
ChartAxisPanel(
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ weld::Widget* pParent,
ChartController* pController);
virtual ~ChartAxisPanel() override;
- virtual void dispose() override;
virtual void updateData() override;
virtual void modelInvalid() override;
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index f740fa7319ac..582ac621ee12 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -298,9 +298,8 @@ void setLegendPos(const css::uno::Reference<css::frame::XModel>& xModel, sal_Int
}
ChartElementsPanel::ChartElementsPanel(
- vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame,
- ChartController* pController)
- : PanelLayout(pParent, "ChartElementsPanel", "modules/schart/ui/sidebarelements.ui", rxFrame)
+ weld::Widget* pParent, ChartController* pController)
+ : PanelLayout(pParent, "ChartElementsPanel", "modules/schart/ui/sidebarelements.ui")
, mxCBTitle(m_xBuilder->weld_check_button("checkbutton_title"))
, mxEditTitle(m_xBuilder->weld_entry("edit_title"))
, mxCBSubtitle(m_xBuilder->weld_check_button("checkbutton_subtitle"))
@@ -336,17 +335,10 @@ ChartElementsPanel::ChartElementsPanel(
maTextSubTitle = mxTextSubTitle->get_label();
Initialize();
-
- m_pInitialFocusWidget = mxCBTitle.get();
}
ChartElementsPanel::~ChartElementsPanel()
{
- disposeOnce();
-}
-
-void ChartElementsPanel::dispose()
-{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcaster->removeModifyListener(mxListener);
mxCBTitle.reset();
@@ -378,8 +370,6 @@ void ChartElementsPanel::dispose()
mxTextTitle.reset();
mxTextSubTitle.reset();
-
- PanelLayout::dispose();
}
void ChartElementsPanel::Initialize()
@@ -540,22 +530,18 @@ void ChartElementsPanel::updateData()
mxLBLegendPosition->set_active(getLegendPos(mxModel));
}
-VclPtr<PanelLayout> ChartElementsPanel::Create (
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+std::unique_ptr<PanelLayout> ChartElementsPanel::Create (
+ weld::Widget* pParent,
ChartController* pController)
{
if (pParent == nullptr)
throw lang::IllegalArgumentException("no parent Window given to ChartElementsPanel::Create", nullptr, 0);
- if ( ! rxFrame.is())
- throw lang::IllegalArgumentException("no XFrame given to ChartElementsPanel::Create", nullptr, 1);
- return VclPtr<ChartElementsPanel>::Create(
- pParent, rxFrame, pController);
+ return std::make_unique<ChartElementsPanel>(pParent, pController);
}
-void ChartElementsPanel::DataChanged(
- const DataChangedEvent& )
+void ChartElementsPanel::DataChanged(const DataChangedEvent& rEvent)
{
+ PanelLayout::DataChanged(rEvent);
updateData();
}
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.hxx b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
index 75ad788d7319..801b40efdb72 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
@@ -39,9 +39,8 @@ class ChartElementsPanel : public PanelLayout,
public ChartSidebarModifyListenerParent
{
public:
- static VclPtr<PanelLayout> Create(
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ static std::unique_ptr<PanelLayout> Create(
+ weld::Widget* pParent,
ChartController* pController);
virtual void DataChanged(
@@ -52,14 +51,11 @@ public:
// constructor/destructor
ChartElementsPanel(
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ weld::Widget* pParent,
ChartController* pController);
virtual ~ChartElementsPanel() override;
- virtual void dispose() override;
-
virtual void updateData() override;
virtual void modelInvalid() override;
diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
index 6799a147339d..943abdbdd66c 100644
--- a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx
@@ -234,10 +234,8 @@ OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
}
-ChartErrorBarPanel::ChartErrorBarPanel(
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame, ChartController* pController)
- : PanelLayout(pParent, "ChartErrorBarPanel", "modules/schart/ui/sidebarerrorbar.ui", rxFrame)
+ChartErrorBarPanel::ChartErrorBarPanel(weld::Widget* pParent, ChartController* pController)
+ : PanelLayout(pParent, "ChartErrorBarPanel", "modules/schart/ui/sidebarerrorbar.ui")
, mxRBPosAndNeg(m_xBuilder->weld_radio_button("radiobutton_positive_negative"))
, mxRBPos(m_xBuilder->weld_radio_button("radiobutton_positive"))
, mxRBNeg(m_xBuilder->weld_radio_button("radiobutton_negative"))
@@ -249,17 +247,10 @@ ChartErrorBarPanel::ChartErrorBarPanel(
, mbModelValid(true)
{
Initialize();
-
- m_pInitialFocusWidget = mxRBPosAndNeg.get();
}
ChartErrorBarPanel::~ChartErrorBarPanel()
{
- disposeOnce();
-}
-
-void ChartErrorBarPanel::dispose()
-{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcaster->removeModifyListener(mxListener);
@@ -271,8 +262,6 @@ void ChartErrorBarPanel::dispose()
mxMFPos.reset();
mxMFNeg.reset();
-
- PanelLayout::dispose();
}
void ChartErrorBarPanel::Initialize()
@@ -349,23 +338,18 @@ void ChartErrorBarPanel::updateData()
}
}
-VclPtr<PanelLayout> ChartErrorBarPanel::Create (
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+std::unique_ptr<PanelLayout> ChartErrorBarPanel::Create (
+ weld::Widget* pParent,
ChartController* pController)
{
if (pParent == nullptr)
throw lang::IllegalArgumentException("no parent Window given to ChartErrorBarPanel::Create", nullptr, 0);
- if ( ! rxFrame.is())
- throw lang::IllegalArgumentException("no XFrame given to ChartErrorBarPanel::Create", nullptr, 1);
-
- return VclPtr<ChartErrorBarPanel>::Create(
- pParent, rxFrame, pController);
+ return std::make_unique<ChartErrorBarPanel>(pParent, pController);
}
-void ChartErrorBarPanel::DataChanged(
- const DataChangedEvent& )
+void ChartErrorBarPanel::DataChanged(const DataChangedEvent& rEvent)
{
+ PanelLayout::DataChanged(rEvent);
updateData();
}
diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
index df8d0b621317..0b95a565bf01 100644
--- a/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.hxx
@@ -14,7 +14,6 @@
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
#include <sfx2/sidebar/SidebarModelUpdate.hxx>
#include <sfx2/sidebar/PanelLayout.hxx>
-
#include "ChartSidebarModifyListener.hxx"
namespace com::sun::star::util { class XModifyListener; }
@@ -32,9 +31,8 @@ class ChartErrorBarPanel : public PanelLayout,
public ChartSidebarModifyListenerParent
{
public:
- static VclPtr<PanelLayout> Create(
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ static std::unique_ptr<PanelLayout> Create(
+ weld::Widget* pParent,
ChartController* pController);
virtual void DataChanged(
@@ -54,11 +52,9 @@ public:
// constructor/destructor
ChartErrorBarPanel(
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ weld::Widget* pParent,
ChartController* pController);
virtual ~ChartErrorBarPanel() override;
- virtual void dispose() override;
virtual void updateData() override;
virtual void modelInvalid() override;
diff --git a/chart2/source/controller/sidebar/ChartLinePanel.cxx b/chart2/source/controller/sidebar/ChartLinePanel.cxx
index 58280f19fcdb..d36c1bf7ce31 100644
--- a/chart2/source/controller/sidebar/ChartLinePanel.cxx
+++ b/chart2/source/controller/sidebar/ChartLinePanel.cxx
@@ -107,8 +107,8 @@ private:
}
-VclPtr<PanelLayout> ChartLinePanel::Create(
- vcl::Window* pParent,
+std::unique_ptr<PanelLayout> ChartLinePanel::Create(
+ weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
ChartController* pController)
{
@@ -117,11 +117,10 @@ VclPtr<PanelLayout> ChartLinePanel::Create(
if (!rxFrame.is())
throw css::lang::IllegalArgumentException("no XFrame given to ChartAxisPanel::Create", nullptr, 1);
- return VclPtr<ChartLinePanel>::Create(
- pParent, rxFrame, pController);
+ return std::make_unique<ChartLinePanel>(pParent, rxFrame, pController);
}
-ChartLinePanel::ChartLinePanel(vcl::Window* pParent,
+ChartLinePanel::ChartLinePanel(weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
ChartController* pController):
svx::sidebar::LinePropertyPanelBase(pParent, rxFrame),
@@ -144,19 +143,12 @@ ChartLinePanel::ChartLinePanel(vcl::Window* pParent,
ChartLinePanel::~ChartLinePanel()
{
- disposeOnce();
-}
-
-void ChartLinePanel::dispose()
-{
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);
-
- LinePropertyPanelBase::dispose();
}
void ChartLinePanel::Initialize()
diff --git a/chart2/source/controller/sidebar/ChartLinePanel.hxx b/chart2/source/controller/sidebar/ChartLinePanel.hxx
index b30775353b08..b46452467fec 100644
--- a/chart2/source/controller/sidebar/ChartLinePanel.hxx
+++ b/chart2/source/controller/sidebar/ChartLinePanel.hxx
@@ -37,14 +37,14 @@ class ChartLinePanel : public svx::sidebar::LinePropertyPanelBase,
public ChartSidebarSelectionListenerParent
{
public:
- static VclPtr<PanelLayout> Create(
- vcl::Window* pParent,
+ static std::unique_ptr<PanelLayout> Create(
+ weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
ChartController* pController);
// constructor/destructor
ChartLinePanel(
- vcl::Window* pParent,
+ weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
ChartController* pController);
@@ -55,8 +55,6 @@ public:
virtual void selectionChanged(bool bCorrectType) override;
- virtual void dispose() override;
-
virtual void updateModel(css::uno::Reference<css::frame::XModel> xModel) override;
virtual void setLineWidth(const XLineWidthItem& rItem) override;
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
index 80153beaa80d..4ce23d66811c 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
@@ -277,10 +277,9 @@ OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
}
ChartSeriesPanel::ChartSeriesPanel(
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ weld::Widget* pParent,
ChartController* pController)
- : PanelLayout(pParent, "ChartSeriesPanel", "modules/schart/ui/sidebarseries.ui", rxFrame)
+ : PanelLayout(pParent, "ChartSeriesPanel", "modules/schart/ui/sidebarseries.ui")
, mxCBLabel(m_xBuilder->weld_check_button("checkbutton_label"))
, mxCBTrendline(m_xBuilder->weld_check_button("checkbutton_trendline"))
, mxCBXError(m_xBuilder->weld_check_button("checkbutton_x_error"))
@@ -297,17 +296,10 @@ ChartSeriesPanel::ChartSeriesPanel(
, mbModelValid(true)
{
Initialize();
-
- m_pInitialFocusWidget = mxCBLabel.get();
}
ChartSeriesPanel::~ChartSeriesPanel()
{
- disposeOnce();
-}
-
-void ChartSeriesPanel::dispose()
-{
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);
@@ -327,8 +319,6 @@ void ChartSeriesPanel::dispose()
mxFTSeriesName.reset();
mxFTSeriesTemplate.reset();
-
- PanelLayout::dispose();
}
void ChartSeriesPanel::Initialize()
@@ -385,23 +375,19 @@ void ChartSeriesPanel::updateData()
mxFTSeriesName->set_label(aFrameLabel);
}
-VclPtr<PanelLayout> ChartSeriesPanel::Create (
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+std::unique_ptr<PanelLayout> ChartSeriesPanel::Create (
+ weld::Widget* pParent,
ChartController* pController)
{
if (pParent == nullptr)
throw lang::IllegalArgumentException("no parent Window given to ChartSeriesPanel::Create", nullptr, 0);
- if ( ! rxFrame.is())
- throw lang::IllegalArgumentException("no XFrame given to ChartSeriesPanel::Create", nullptr, 1);
- return VclPtr<ChartSeriesPanel>::Create(
- pParent, rxFrame, pController);
+ return std::make_unique<ChartSeriesPanel>(pParent, pController);
}
-void ChartSeriesPanel::DataChanged(
- const DataChangedEvent& )
+void ChartSeriesPanel::DataChanged(const DataChangedEvent& rEvent)
{
+ PanelLayout::DataChanged(rEvent);
updateData();
}
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.hxx b/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
index 485b46fe68d6..2844051001fe 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.hxx
@@ -43,9 +43,8 @@ class ChartSeriesPanel : public PanelLayout,
public ChartSidebarSelectionListenerParent
{
public:
- static VclPtr<PanelLayout> Create(
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ static std::unique_ptr<PanelLayout> Create(
+ weld::Widget* pParent,
ChartController* pController);
virtual void DataChanged(
@@ -65,11 +64,9 @@ public:
// constructor/destructor
ChartSeriesPanel(
- vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
+ weld::Widget* pParent,
ChartController* pController);
virtual ~ChartSeriesPanel() override;
- virtual void dispose() override;
virtual void updateData() override;
virtual void modelInvalid() override;
diff --git a/chart2/source/controller/sidebar/ChartTypePanel.cxx b/chart2/source/controller/sidebar/ChartTypePanel.cxx
index a0e38bdb393a..66ffaa97c819 100644
--- a/chart2/source/controller/sidebar/ChartTypePanel.cxx
+++ b/chart2/source/controller/sidebar/ChartTypePanel.cxx
@@ -39,10 +39,8 @@ using namespace css::uno;
namespace chart::sidebar
{
-ChartTypePanel::ChartTypePanel(vcl::Window* pParent,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
- ::chart::ChartController* pController)
- : PanelLayout(pParent, "ChartTypePanel", "modules/schart/ui/sidebartype.ui", rxFrame)
+ChartTypePanel::ChartTypePanel(weld::Widget* pParent, ::chart::ChartController* pController)
+ : PanelLayout(pParent, "ChartTypePanel", "modules/schart/ui/sidebartype.ui")
, maContext()
, mxModel(pController->getModel())
, mxListener(new ChartSidebarModifyListener(this))
@@ -119,13 +117,9 @@ ChartTypePanel::ChartTypePanel(vcl::Window* pParent,
m_pSortByXValuesResourceGroup->setChangeListener(this);
Initialize();
-
- m_pInitialFocusWidget = m_xMainTypeList.get();
}
-ChartTypePanel::~ChartTypePanel() { disposeOnce(); }
-
-void ChartTypePanel::dispose()
+ChartTypePanel::~ChartTypePanel()
{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel,
css::uno::UNO_QUERY_THROW);
@@ -146,8 +140,6 @@ void ChartTypePanel::dispose()
m_xSubTypeListWin.reset();
m_xSubTypeList.reset();
m_xMainTypeList.reset();
-
- PanelLayout::dispose();
}
IMPL_LINK_NOARG(ChartTypePanel, SelectMainTypeHdl, weld::ComboBox&, void) { selectMainType(); }
@@ -251,7 +243,11 @@ void ChartTypePanel::updateData()
}
}
-void ChartTypePanel::DataChanged(const DataChangedEvent&) { updateData(); }
+void ChartTypePanel::DataChanged(const DataChangedEvent& rEvent)
+{
+ PanelLayout::DataChanged(rEvent);
+ updateData();
+}
void ChartTypePanel::HandleContextChange(const vcl::EnumContext& rContext)
{
diff --git a/chart2/source/controller/sidebar/ChartTypePanel.hxx b/chart2/source/controller/sidebar/ChartTypePanel.hxx
index 7c4e27246ca3..6a9036ebaa02 100644
--- a/chart2/source/controller/sidebar/ChartTypePanel.hxx
+++ b/chart2/source/controller/sidebar/ChartTypePanel.hxx
@@ -62,13 +62,10 @@ public:
virtual void HandleContextChange(const vcl::EnumContext& rContext) override;
// constructor/destructor
- ChartTypePanel(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame,
- ::chart::ChartController* pController);
+ ChartTypePanel(weld::Widget* pParent, ::chart::ChartController* pController);
virtual ~ChartTypePanel() override;
- virtual void dispose() override;
-
virtual void updateData() override;
virtual void modelInvalid() override;