diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-02-13 17:06:04 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-02-14 09:58:49 +0100 |
commit | 3f893b52e726d96cb5dfebbc9afc88c28f0a8463 (patch) | |
tree | ae412531cda5a01bd81ea1859f09e1aa810a744f | |
parent | 3688235a8d059285ce8dcf6d2fb6c522b0b6501a (diff) |
de-duplicate some code
Change-Id: I5900ee56cf5c80f00743060d1d22dfd3d383f1eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88622
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | svx/source/tbxctrls/tbunosearchcontrollers.cxx | 20 |
1 files 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<ToolBox*>(pParent.get()); - m_xMatchCaseControl = VclPtr<CheckButtonItemWindow>::Create(pToolbar); - m_xMatchCaseControl->set_label(SvxResId(RID_SVXSTR_FINDBAR_MATCHCASE)); - m_xMatchCaseControl->SetOptimalSize(); + m_xMatchCaseControl = VclPtr<CheckButtonItemWindow>::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<ToolBox*>(pParent.get()); - m_xSearchFormattedControl = VclPtr<CheckButtonItemWindow>::Create(pToolbar); - m_xSearchFormattedControl->set_label(SvxResId(RID_SVXSTR_FINDBAR_SEARCHFORMATTED)); - m_xSearchFormattedControl->SetOptimalSize(); + m_xSearchFormattedControl = VclPtr<CheckButtonItemWindow>::Create(pToolbar, SvxResId(RID_SVXSTR_FINDBAR_SEARCHFORMATTED)); } xItemWindow = VCLUnoHelper::GetInterface(m_xSearchFormattedControl); |