summaryrefslogtreecommitdiff
path: root/sc/source/ui/sidebar
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 /sc/source/ui/sidebar
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 'sc/source/ui/sidebar')
-rw-r--r--sc/source/ui/sidebar/AlignmentPropertyPanel.cxx23
-rw-r--r--sc/source/ui/sidebar/AlignmentPropertyPanel.hxx10
-rw-r--r--sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx22
-rw-r--r--sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx11
-rw-r--r--sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx23
-rw-r--r--sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx10
-rw-r--r--sc/source/ui/sidebar/ScPanelFactory.cxx26
7 files changed, 39 insertions, 86 deletions
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
index 135772d669d9..ff91ad41c0b0 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
@@ -37,10 +37,10 @@ using namespace css::uno;
namespace sc::sidebar {
AlignmentPropertyPanel::AlignmentPropertyPanel(
- vcl::Window* pParent,
+ weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings)
- : PanelLayout(pParent, "AlignmentPropertyPanel", "modules/scalc/ui/sidebaralignment.ui", rxFrame)
+ : PanelLayout(pParent, "AlignmentPropertyPanel", "modules/scalc/ui/sidebaralignment.ui")
, mxFTLeftIndent(m_xBuilder->weld_label("leftindentlabel"))
, mxMFLeftIndent(m_xBuilder->weld_metric_spin_button("leftindent", FieldUnit::POINT))
, mxCBXWrapText(m_xBuilder->weld_check_button("wraptext"))
@@ -73,16 +73,10 @@ AlignmentPropertyPanel::AlignmentPropertyPanel(
, mpBindings(pBindings)
{
Initialize();
- m_pInitialFocusWidget = &mxMFLeftIndent->get_widget();
}
AlignmentPropertyPanel::~AlignmentPropertyPanel()
{
- disposeOnce();
-}
-
-void AlignmentPropertyPanel::dispose()
-{
mxIndentButtonsDispatch.reset();
mxIndentButtons.reset();
mxWriteDirectionDispatch.reset();
@@ -111,8 +105,6 @@ void AlignmentPropertyPanel::dispose()
maAngleControl.dispose();
maVrtStackControl.dispose();
maRefEdgeControl.dispose();
-
- PanelLayout::dispose();
}
void AlignmentPropertyPanel::Initialize()
@@ -199,8 +191,8 @@ IMPL_LINK_NOARG(AlignmentPropertyPanel, CBOXWrapTextClkHdl, weld::ToggleButton&,
SfxCallMode::RECORD, { &aItem });
}
-VclPtr<PanelLayout> AlignmentPropertyPanel::Create (
- vcl::Window* pParent,
+std::unique_ptr<PanelLayout> AlignmentPropertyPanel::Create (
+ weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings)
{
@@ -211,14 +203,9 @@ VclPtr<PanelLayout> AlignmentPropertyPanel::Create (
if (pBindings == nullptr)
throw lang::IllegalArgumentException("no SfxBindings given to AlignmentPropertyPanel::Create", nullptr, 2);
- return VclPtr<AlignmentPropertyPanel>::Create(
- pParent, rxFrame, pBindings);
+ return std::make_unique<AlignmentPropertyPanel>(pParent, rxFrame, pBindings);
}
-void AlignmentPropertyPanel::DataChanged(
- const DataChangedEvent&)
-{}
-
void AlignmentPropertyPanel::HandleContextChange(
const vcl::EnumContext& rContext)
{
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
index f6f09c11e992..c849a7e9e3f3 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
@@ -33,14 +33,11 @@ class AlignmentPropertyPanel
public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
{
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,
SfxBindings* pBindings);
- virtual void DataChanged(
- const DataChangedEvent& rEvent) override;
-
virtual void HandleContextChange(
const vcl::EnumContext& rContext) override;
@@ -57,11 +54,10 @@ public:
// constructor/destructor
AlignmentPropertyPanel(
- vcl::Window* pParent,
+ weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings);
virtual ~AlignmentPropertyPanel() override;
- virtual void dispose() override;
private:
//ui controls
diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
index 15b1ffad6396..188a638e7315 100644
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
@@ -44,10 +44,10 @@ constexpr OStringLiteral LINESTYLE = "LineStyle";
namespace sc::sidebar {
CellAppearancePropertyPanel::CellAppearancePropertyPanel(
- vcl::Window* pParent,
+ weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings)
-: PanelLayout(pParent, "CellAppearancePropertyPanel", "modules/scalc/ui/sidebarcellappearance.ui", rxFrame),
+: PanelLayout(pParent, "CellAppearancePropertyPanel", "modules/scalc/ui/sidebarcellappearance.ui"),
mxTBCellBorder(m_xBuilder->weld_toolbar("cellbordertype")),
mxTBCellBackground(m_xBuilder->weld_toolbar("cellbackgroundcolor")),
@@ -106,11 +106,6 @@ CellAppearancePropertyPanel::CellAppearancePropertyPanel(
CellAppearancePropertyPanel::~CellAppearancePropertyPanel()
{
- disposeOnce();
-}
-
-void CellAppearancePropertyPanel::dispose()
-{
mxCellBorderPopoverContainer.reset();
mxTBCellBorder.reset();
mxBackColorDispatch.reset();
@@ -126,8 +121,6 @@ void CellAppearancePropertyPanel::dispose()
maGridShowControl.dispose();
maBorderTLBRControl.dispose();
maBorderBLTRControl.dispose();
-
- PanelLayout::dispose();
}
void CellAppearancePropertyPanel::Initialize()
@@ -184,8 +177,8 @@ IMPL_LINK_NOARG(CellAppearancePropertyPanel, TbxLineStyleMenuHdl, const OString&
pPopup->GrabFocus();
}
-VclPtr<PanelLayout> CellAppearancePropertyPanel::Create (
- vcl::Window* pParent,
+std::unique_ptr<PanelLayout> CellAppearancePropertyPanel::Create (
+ weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings)
{
@@ -196,14 +189,9 @@ VclPtr<PanelLayout> CellAppearancePropertyPanel::Create (
if (pBindings == nullptr)
throw lang::IllegalArgumentException("no SfxBindings given to CellAppearancePropertyPanel::Create", nullptr, 2);
- return VclPtr<CellAppearancePropertyPanel>::Create(
- pParent, rxFrame, pBindings);
+ return std::make_unique<CellAppearancePropertyPanel>(pParent, rxFrame, pBindings);
}
-void CellAppearancePropertyPanel::DataChanged(
- const DataChangedEvent&)
-{}
-
void CellAppearancePropertyPanel::HandleContextChange(const vcl::EnumContext& rContext)
{
if (maContext == rContext)
diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
index d90e57b0bc35..a0249a7249c2 100644
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
@@ -24,6 +24,7 @@
#include <sfx2/sidebar/PanelLayout.hxx>
#include <vcl/EnumContext.hxx>
#include <vcl/image.hxx>
+#include <com/sun/star/frame/XFrame.hpp>
class ToolbarUnoDispatcher;
class ToolbarPopupContainer;
@@ -40,14 +41,11 @@ private:
friend class CellBorderStylePopup;
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,
SfxBindings* pBindings);
- virtual void DataChanged(
- const DataChangedEvent& rEvent) override;
-
virtual void HandleContextChange(
const vcl::EnumContext& rContext) override;
@@ -64,11 +62,10 @@ public:
// constructor/destructor
CellAppearancePropertyPanel(
- vcl::Window* pParent,
+ weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings);
virtual ~CellAppearancePropertyPanel() override;
- virtual void dispose() override;
private:
//ui controls
diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
index e3e95e50a710..93dd19da0c98 100644
--- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
@@ -31,10 +31,10 @@ using namespace css::uno;
namespace sc::sidebar {
NumberFormatPropertyPanel::NumberFormatPropertyPanel(
- vcl::Window* pParent,
+ weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings)
- : PanelLayout(pParent,"NumberFormatPropertyPanel", "modules/scalc/ui/sidebarnumberformat.ui", rxFrame)
+ : PanelLayout(pParent,"NumberFormatPropertyPanel", "modules/scalc/ui/sidebarnumberformat.ui")
, mxLbCategory(m_xBuilder->weld_combo_box("numberformatcombobox"))
, mxTBCategory(m_xBuilder->weld_toolbar("numberformat"))
, mxCategoryDispatch(new ToolbarUnoDispatcher(*mxTBCategory, *m_xBuilder, rxFrame))
@@ -54,16 +54,10 @@ NumberFormatPropertyPanel::NumberFormatPropertyPanel(
, mpBindings(pBindings)
{
Initialize();
- m_pInitialFocusWidget = mxLbCategory.get();
}
NumberFormatPropertyPanel::~NumberFormatPropertyPanel()
{
- disposeOnce();
-}
-
-void NumberFormatPropertyPanel::dispose()
-{
mxLbCategory.reset();
mxCategoryDispatch.reset();
mxTBCategory.reset();
@@ -79,8 +73,6 @@ void NumberFormatPropertyPanel::dispose()
maNumFormatControl.dispose();
maFormatControl.dispose();
-
- PanelLayout::dispose();
}
void NumberFormatPropertyPanel::Initialize()
@@ -151,8 +143,8 @@ IMPL_LINK_NOARG( NumberFormatPropertyPanel, NumFormatValueHdl, weld::SpinButton&
SfxCallMode::RECORD, { &aItem });
}
-VclPtr<PanelLayout> NumberFormatPropertyPanel::Create (
- vcl::Window* pParent,
+std::unique_ptr<PanelLayout> NumberFormatPropertyPanel::Create (
+ weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings)
{
@@ -163,14 +155,9 @@ VclPtr<PanelLayout> NumberFormatPropertyPanel::Create (
if (pBindings == nullptr)
throw lang::IllegalArgumentException("no SfxBindings given to NumberFormatPropertyPanel::Create", nullptr, 2);
- return VclPtr<NumberFormatPropertyPanel>::Create(
- pParent, rxFrame, pBindings);
+ return std::make_unique<NumberFormatPropertyPanel>(pParent, rxFrame, pBindings);
}
-void NumberFormatPropertyPanel::DataChanged(
- const DataChangedEvent&)
-{}
-
void NumberFormatPropertyPanel::HandleContextChange(
const vcl::EnumContext& rContext)
{
diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx
index 7d67d630dfdf..8505829c5a89 100644
--- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx
+++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx
@@ -34,14 +34,11 @@ class NumberFormatPropertyPanel
{
public:
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,
SfxBindings* pBindings);
- virtual void DataChanged(
- const DataChangedEvent& rEvent) override;
-
virtual void HandleContextChange(
const vcl::EnumContext& rContext) override;
@@ -58,11 +55,10 @@ public:
// constructor/destructor
NumberFormatPropertyPanel(
- vcl::Window* pParent,
+ weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings);
virtual ~NumberFormatPropertyPanel() override;
- virtual void dispose() override;
private:
//ui controls
std::unique_ptr<weld::ComboBox> mxLbCategory;
diff --git a/sc/source/ui/sidebar/ScPanelFactory.cxx b/sc/source/ui/sidebar/ScPanelFactory.cxx
index 9459178886b3..67c949475023 100644
--- a/sc/source/ui/sidebar/ScPanelFactory.cxx
+++ b/sc/source/ui/sidebar/ScPanelFactory.cxx
@@ -26,8 +26,7 @@
#include <dwfunctr.hxx>
#include <sfx2/sidebar/SidebarPanelBase.hxx>
-#include <toolkit/helper/vclunohelper.hxx>
-#include <vcl/window.hxx>
+#include <vcl/weldutils.hxx>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <comphelper/namedvaluecollection.hxx>
#include <cppuhelper/exc_hlp.hxx>
@@ -61,8 +60,11 @@ Reference<ui::XUIElement> SAL_CALL ScPanelFactory::createUIElement (
const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0)));
SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue);
- 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);
@@ -76,29 +78,29 @@ Reference<ui::XUIElement> SAL_CALL ScPanelFactory::createUIElement (
nullptr);
sal_Int32 nMinimumSize = -1;
- VclPtr<PanelLayout> pPanel;
+ std::unique_ptr<PanelLayout> xPanel;
if (rsResourceURL.endsWith("/AlignmentPropertyPanel"))
- pPanel = AlignmentPropertyPanel::Create( pParentWindow, xFrame, pBindings );
+ xPanel = AlignmentPropertyPanel::Create( pParent, xFrame, pBindings );
else if (rsResourceURL.endsWith("/CellAppearancePropertyPanel"))
- pPanel = CellAppearancePropertyPanel::Create( pParentWindow, xFrame, pBindings );
+ xPanel = CellAppearancePropertyPanel::Create( pParent, xFrame, pBindings );
else if (rsResourceURL.endsWith("/NumberFormatPropertyPanel"))
- pPanel = NumberFormatPropertyPanel::Create( pParentWindow, xFrame, pBindings );
+ xPanel = NumberFormatPropertyPanel::Create( pParent, xFrame, pBindings );
else if (rsResourceURL.endsWith("/NavigatorPanel"))
{
- pPanel = VclPtr<ScNavigatorDlg>::Create(pBindings, pParentWindow);
+ xPanel = std::make_unique<ScNavigatorDlg>(pBindings, pParent, nullptr);
nMinimumSize = 0;
}
else if (rsResourceURL.endsWith("/FunctionsPanel"))
{
- pPanel = VclPtr<ScFunctionWin>::Create(pParentWindow, xFrame);
+ xPanel = std::make_unique<ScFunctionWin>(pParent);
nMinimumSize = 0;
}
- if (pPanel)
+ if (xPanel)
xElement = sfx2::sidebar::SidebarPanelBase::Create(
rsResourceURL,
xFrame,
- pPanel,
+ std::move(xPanel),
ui::LayoutSize(nMinimumSize,-1,-1));
}
catch (const uno::RuntimeException &)