From 6124f6726a8f6da9088024fabac9c3ccc3dca08a Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 21 May 2020 09:52:30 +0100 Subject: split out labelitemwindow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: If5121b58538708a47783aee099bc426408989cbf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94636 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- svx/Library_svxcore.mk | 1 + svx/inc/pch/precompiled_svx.hxx | 2 +- svx/source/dialog/srchdlg.cxx | 2 +- svx/source/form/labelitemwindow.cxx | 43 ++++++++++++++++++++++++++ svx/source/form/tbxform.cxx | 42 +------------------------ svx/source/inc/labelitemwindow.hxx | 29 ----------------- svx/source/tbxctrls/tbunosearchcontrollers.cxx | 2 +- 7 files changed, 48 insertions(+), 73 deletions(-) create mode 100644 svx/source/form/labelitemwindow.cxx delete mode 100644 svx/source/inc/labelitemwindow.hxx (limited to 'svx') diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk index f18e60d54d5d..cf23b824ca3e 100644 --- a/svx/Library_svxcore.mk +++ b/svx/Library_svxcore.mk @@ -433,6 +433,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\ svx/source/form/datalistener \ svx/source/form/datanavi \ svx/source/form/delayedevent \ + svx/source/form/labelitemwindow \ svx/source/form/fmcontrolbordermanager \ svx/source/form/fmcontrollayout \ svx/source/form/fmdmod \ diff --git a/svx/inc/pch/precompiled_svx.hxx b/svx/inc/pch/precompiled_svx.hxx index e692c3de4f25..45da207e9fb8 100644 --- a/svx/inc/pch/precompiled_svx.hxx +++ b/svx/inc/pch/precompiled_svx.hxx @@ -370,7 +370,6 @@ #include #include #include -#include #include #include #include @@ -394,6 +393,7 @@ #include #include #include +#include #include #include #include diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index 371bac5c75cf..ffd8d0e90adb 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -74,8 +74,8 @@ #include #include -#include +#include #include #include diff --git a/svx/source/form/labelitemwindow.cxx b/svx/source/form/labelitemwindow.cxx new file mode 100644 index 000000000000..45c5160f4c4f --- /dev/null +++ b/svx/source/form/labelitemwindow.cxx @@ -0,0 +1,43 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include + +LabelItemWindow::LabelItemWindow(vcl::Window* pParent, const OUString& rLabel) + : InterimItemWindow(pParent, "svx/ui/labelbox.ui", "LabelBox") + , m_xLabel(m_xBuilder->weld_label("label")) +{ + m_xLabel->set_label(rLabel); + + SetOptimalSize(); + + m_xLabel->set_toolbar_background(); +} + +void LabelItemWindow::SetOptimalSize() +{ + Size aSize(m_xLabel->get_preferred_size()); + aSize.AdjustWidth(12); + + SetSizePixel(aSize); +} + +void LabelItemWindow::set_label(const OUString& rLabel) { m_xLabel->set_label(rLabel); } + +OUString LabelItemWindow::get_label() const { return m_xLabel->get_label(); } + +void LabelItemWindow::dispose() +{ + m_xLabel.reset(); + InterimItemWindow::dispose(); +} + +LabelItemWindow::~LabelItemWindow() { disposeOnce(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/svx/source/form/tbxform.cxx b/svx/source/form/tbxform.cxx index 035dfca802bf..837aa154aabf 100644 --- a/svx/source/form/tbxform.cxx +++ b/svx/source/form/tbxform.cxx @@ -23,9 +23,9 @@ #include #include #include -#include #include +#include #include #include #include @@ -157,46 +157,6 @@ SvxFmTbxCtlRecText::~SvxFmTbxCtlRecText() { } -LabelItemWindow::LabelItemWindow(vcl::Window *pParent, const OUString& rLabel) - : InterimItemWindow(pParent, "svx/ui/labelbox.ui", "LabelBox") - , m_xLabel(m_xBuilder->weld_label("label")) -{ - m_xLabel->set_label(rLabel); - - SetOptimalSize(); - - m_xLabel->set_toolbar_background(); -} - -void LabelItemWindow::SetOptimalSize() -{ - Size aSize(m_xLabel->get_preferred_size()); - aSize.AdjustWidth(12); - - SetSizePixel(aSize); -} - -void LabelItemWindow::set_label(const OUString& rLabel) -{ - m_xLabel->set_label(rLabel); -} - -OUString LabelItemWindow::get_label() const -{ - return m_xLabel->get_label(); -} - -void LabelItemWindow::dispose() -{ - m_xLabel.reset(); - InterimItemWindow::dispose(); -} - -LabelItemWindow::~LabelItemWindow() -{ - disposeOnce(); -} - VclPtr SvxFmTbxCtlRecText::CreateItemWindow( vcl::Window* pParent ) { OUString aText(SvxResId(RID_STR_REC_TEXT)); diff --git a/svx/source/inc/labelitemwindow.hxx b/svx/source/inc/labelitemwindow.hxx deleted file mode 100644 index 798369c10fa0..000000000000 --- a/svx/source/inc/labelitemwindow.hxx +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#pragma once - -#include - -class LabelItemWindow final : public InterimItemWindow -{ -private: - std::unique_ptr m_xLabel; - -public: - LabelItemWindow(vcl::Window* pParent, const OUString& rLabel); - void set_label(const OUString& rLabel); - OUString get_label() const; - - void SetOptimalSize(); - virtual void dispose() override; - virtual ~LabelItemWindow() override; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index 584784387da3..c68c168b6599 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -56,11 +56,11 @@ #include #include #include +#include #include #include #include -#include using namespace css; -- cgit