From 3f893b52e726d96cb5dfebbc9afc88c28f0a8463 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 13 Feb 2020 17:06:04 +0000 Subject: de-duplicate some code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I5900ee56cf5c80f00743060d1d22dfd3d383f1eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88622 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- svx/source/tbxctrls/tbunosearchcontrollers.cxx | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index b786b03fc2da..1c620ef7da3e 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -80,23 +80,15 @@ static const sal_Int32 REMEMBER_SIZE = 10; class CheckButtonItemWindow final : public InterimItemWindow { public: - CheckButtonItemWindow(vcl::Window* pParent) + CheckButtonItemWindow(vcl::Window* pParent, const OUString& rLabel) : InterimItemWindow(pParent, "svx/ui/checkbuttonbox.ui", "CheckButtonBox") , m_xWidget(m_xBuilder->weld_check_button("checkbutton")) { m_xWidget->connect_key_press(LINK(this, CheckButtonItemWindow, KeyInputHdl)); - } - - void SetOptimalSize() - { + m_xWidget->set_label(rLabel); SetSizePixel(m_xWidget->get_preferred_size()); } - void set_label(const OUString& rText) - { - m_xWidget->set_label(rText); - } - bool get_active() const { return m_xWidget->get_active(); @@ -926,9 +918,7 @@ css::uno::Reference< css::awt::XWindow > SAL_CALL MatchCaseToolboxController::cr if ( pParent ) { ToolBox* pToolbar = static_cast(pParent.get()); - m_xMatchCaseControl = VclPtr::Create(pToolbar); - m_xMatchCaseControl->set_label(SvxResId(RID_SVXSTR_FINDBAR_MATCHCASE)); - m_xMatchCaseControl->SetOptimalSize(); + m_xMatchCaseControl = VclPtr::Create(pToolbar, SvxResId(RID_SVXSTR_FINDBAR_MATCHCASE)); } xItemWindow = VCLUnoHelper::GetInterface(m_xMatchCaseControl); @@ -1044,9 +1034,7 @@ css::uno::Reference< css::awt::XWindow > SAL_CALL SearchFormattedToolboxControll if ( pParent ) { ToolBox* pToolbar = static_cast(pParent.get()); - m_xSearchFormattedControl = VclPtr::Create(pToolbar); - m_xSearchFormattedControl->set_label(SvxResId(RID_SVXSTR_FINDBAR_SEARCHFORMATTED)); - m_xSearchFormattedControl->SetOptimalSize(); + m_xSearchFormattedControl = VclPtr::Create(pToolbar, SvxResId(RID_SVXSTR_FINDBAR_SEARCHFORMATTED)); } xItemWindow = VCLUnoHelper::GetInterface(m_xSearchFormattedControl); -- cgit