diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-01-13 13:20:45 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-01-13 18:28:59 +0100 |
commit | c9ba69cdfaaf19695fc8e40ba7af1d06490a123f (patch) | |
tree | 4f78b0543befffdbcec349ba6c6be4d569925bd2 /svx | |
parent | 4e12a674f51e898cf11af64b01e8da8468cec401 (diff) |
rework TextCharacterSpacingPopup to be a PopupWindowController
Change-Id: I3db8f93b99157f7ee8d6095f7dfc5c2b2e6890e8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86690
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx | 3 | ||||
-rw-r--r-- | svx/source/sidebar/text/TextCharacterSpacingControl.cxx | 13 | ||||
-rw-r--r-- | svx/source/sidebar/text/TextCharacterSpacingControl.hxx | 10 | ||||
-rw-r--r-- | svx/source/sidebar/text/TextCharacterSpacingPopup.cxx | 37 | ||||
-rw-r--r-- | svx/util/svx.component | 4 |
5 files changed, 45 insertions, 22 deletions
diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx index 93ced9fece15..13d662bc9763 100644 --- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx +++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx @@ -27,9 +27,6 @@ #include <sfx2/sfxsids.hrc> #include <sfx2/viewfrm.hxx> #include <svtools/unitconv.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> -#include <vcl/lstbox.hxx> #include <svl/itempool.hxx> diff --git a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx index 3084b4527686..3de287aff0f9 100644 --- a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx +++ b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx @@ -26,6 +26,7 @@ #include <sfx2/dispatch.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/sidebar/Theme.hxx> +#include <svx/TextCharacterSpacingPopup.hxx> #include <vcl/button.hxx> #include <vcl/settings.hxx> #include <svl/itempool.hxx> @@ -41,11 +42,11 @@ namespace svx { -TextCharacterSpacingControl::TextCharacterSpacingControl(sal_uInt16 nId, vcl::Window* pParent) - : SfxPopupWindow(nId, pParent, "TextCharacterSpacingControl", "svx/ui/textcharacterspacingcontrol.ui") -, mnId(nId) -, mnCustomKern(0) -, mnLastCus(SPACING_NOCUSTOM) +TextCharacterSpacingControl::TextCharacterSpacingControl(TextCharacterSpacingPopup* pControl, vcl::Window* pParent) + : ToolbarPopup(pControl->getFrameInterface(), pParent, "TextCharacterSpacingControl", "svx/ui/textcharacterspacingcontrol.ui") + , mnId(SID_ATTR_CHAR_KERNING) + , mnCustomKern(0) + , mnLastCus(SPACING_NOCUSTOM) { get(maEditKerning, "kerning"); @@ -94,7 +95,7 @@ void TextCharacterSpacingControl::dispose() maLoose.clear(); maLastCustom.clear(); - SfxPopupWindow::dispose(); + ToolbarPopup::dispose(); } void TextCharacterSpacingControl::Initialize() diff --git a/svx/source/sidebar/text/TextCharacterSpacingControl.hxx b/svx/source/sidebar/text/TextCharacterSpacingControl.hxx index 6c3a649edf12..d4f79cdbbbe7 100644 --- a/svx/source/sidebar/text/TextCharacterSpacingControl.hxx +++ b/svx/source/sidebar/text/TextCharacterSpacingControl.hxx @@ -22,7 +22,7 @@ #include <sfx2/bindings.hxx> #include <vcl/fixed.hxx> #include <vcl/field.hxx> -#include <sfx2/tbxctrl.hxx> +#include <svtools/toolbarmenu.hxx> namespace svx { #define SPACING_NOCUSTOM 0 @@ -31,10 +31,12 @@ namespace svx { #define SIDEBAR_SPACING_GLOBAL_VALUE "PopupPanel_Spacing" -class TextCharacterSpacingControl : public SfxPopupWindow +class TextCharacterSpacingPopup; + +class TextCharacterSpacingControl final : public svtools::ToolbarPopup { public: - explicit TextCharacterSpacingControl(sal_uInt16 nId, vcl::Window* pParent); + explicit TextCharacterSpacingControl(TextCharacterSpacingPopup* pControl, vcl::Window* pParent); virtual ~TextCharacterSpacingControl() override; virtual void dispose() override; @@ -48,7 +50,7 @@ private: VclPtr<PushButton> maLoose; VclPtr<PushButton> maLastCustom; - sal_uInt16 const mnId; + sal_uInt16 mnId; long mnCustomKern; short mnLastCus; diff --git a/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx b/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx index cdf0f99b8bb9..ea7104344f75 100644 --- a/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx +++ b/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx @@ -24,27 +24,46 @@ using namespace svx; -SFX_IMPL_TOOLBOX_CONTROL(TextCharacterSpacingPopup, SvxKerningItem); +TextCharacterSpacingPopup::TextCharacterSpacingPopup(const css::uno::Reference<css::uno::XComponentContext>& rContext) + : PopupWindowController(rContext, nullptr, OUString()) +{ +} -TextCharacterSpacingPopup::TextCharacterSpacingPopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx) - : SfxToolBoxControl(nSlotId, nId, rTbx) +void TextCharacterSpacingPopup::initialize( const css::uno::Sequence< css::uno::Any >& rArguments ) { - rTbx.SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | rTbx.GetItemBits(nId)); + PopupWindowController::initialize(rArguments); + + ToolBox* pToolBox = nullptr; + sal_uInt16 nId = 0; + if (getToolboxId(nId, &pToolBox) && pToolBox->GetItemCommand(nId) == m_aCommandURL) + pToolBox->SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | pToolBox->GetItemBits(nId)); } TextCharacterSpacingPopup::~TextCharacterSpacingPopup() { } -VclPtr<SfxPopupWindow> TextCharacterSpacingPopup::CreatePopupWindow() +VclPtr<vcl::Window> TextCharacterSpacingPopup::createPopupWindow(vcl::Window* pParent) { - VclPtr<TextCharacterSpacingControl> pControl = VclPtr<TextCharacterSpacingControl>::Create(GetSlotId(), &GetToolBox()); + return VclPtr<TextCharacterSpacingControl>::Create(this, pParent); +} - pControl->StartPopupMode(&GetToolBox(), FloatWinPopupFlags::GrabFocus); +OUString TextCharacterSpacingPopup::getImplementationName() +{ + return "com.sun.star.comp.svx.CharacterSpacingToolBoxControl"; +} - SetPopupWindow(pControl); +css::uno::Sequence<OUString> TextCharacterSpacingPopup::getSupportedServiceNames() +{ + return { "com.sun.star.frame.ToolbarController" }; +} - return pControl; +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * +com_sun_star_comp_svx_CharacterSpacingToolBoxControl_get_implementation( + css::uno::XComponentContext* rContext, + css::uno::Sequence<css::uno::Any> const & ) +{ + return cppu::acquire(new TextCharacterSpacingPopup(rContext)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/util/svx.component b/svx/util/svx.component index 323126691b1e..a27f47063d68 100644 --- a/svx/util/svx.component +++ b/svx/util/svx.component @@ -108,4 +108,8 @@ constructor="com_sun_star_comp_svx_LineSpacingToolBoxControl_get_implementation"> <service name="com.sun.star.frame.ToolbarController"/> </implementation> + <implementation name="com.sun.star.comp.svx.CharacterSpacingToolBoxControl" + constructor="com_sun_star_comp_svx_CharacterSpacingToolBoxControl_get_implementation"> + <service name="com.sun.star.frame.ToolbarController"/> + </implementation> </component> |