[Libreoffice-commits] core.git: include/svx officecfg/registry sc/source sd/source svx/source svx/util sw/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jan 13 17:30:12 UTC 2020
include/svx/TextUnderlinePopup.hxx | 19 ++--
officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu | 11 ++
sc/source/ui/app/scdll.cxx | 1
sd/source/ui/app/sddll.cxx | 2
svx/source/sidebar/text/TextUnderlineControl.cxx | 7 +
svx/source/sidebar/text/TextUnderlineControl.hxx | 8 +-
svx/source/sidebar/text/TextUnderlinePopup.cxx | 40 ++++++----
svx/util/svx.component | 4 +
sw/source/uibase/app/swmodule.cxx | 1
9 files changed, 62 insertions(+), 31 deletions(-)
New commits:
commit c81afdb5118536b2e2365a9a9af6b6e162c87aeb
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Jan 13 14:53:51 2020 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Jan 13 18:29:32 2020 +0100
rework TextUnderlinePopup to be a PopupWindowController
Change-Id: I149777b827dd00e00e62b461836122861864f829
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86697
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/svx/TextUnderlinePopup.hxx b/include/svx/TextUnderlinePopup.hxx
index 994664a621d4..6dc64face2b1 100644
--- a/include/svx/TextUnderlinePopup.hxx
+++ b/include/svx/TextUnderlinePopup.hxx
@@ -19,23 +19,26 @@
#ifndef INCLUDED_SVX_SIDEBAR_TEXT_TEXTUNDERLINEPOPUP_HXX
#define INCLUDED_SVX_SIDEBAR_TEXT_TEXTUNDERLINEPOPUP_HXX
-#include <sfx2/tbxctrl.hxx>
+#include <svtools/popupwindowcontroller.hxx>
#include <svx/svxdllapi.h>
namespace svx {
-class SVX_DLLPUBLIC TextUnderlinePopup final : public SfxToolBoxControl
+class SVX_DLLPUBLIC TextUnderlinePopup final : public svt::PopupWindowController
{
public:
- SFX_DECL_TOOLBOX_CONTROL();
-
- TextUnderlinePopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
+ TextUnderlinePopup(const css::uno::Reference<css::uno::XComponentContext>& rContext);
virtual ~TextUnderlinePopup() override;
- // XInitialization
- virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
+ using svt::ToolboxController::createPopupWindow;
+ virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) override;
- virtual VclPtr<SfxPopupWindow> CreatePopupWindow() override;
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& rArguments ) override;
};
} // end of namespace svx
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
index e89903cd0149..a0bd1450d0e0 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
@@ -1404,6 +1404,17 @@
<value>com.sun.star.comp.svx.ColorToolBoxControl</value>
</prop>
</node>
+ <node oor:name="UnderlineToolBoxControl" oor:op="replace">
+ <prop oor:name="Command">
+ <value>.uno:Underline</value>
+ </prop>
+ <prop oor:name="Module">
+ <value/>
+ </prop>
+ <prop oor:name="Controller">
+ <value>com.sun.star.comp.svx.UnderlineToolBoxControl</value>
+ </prop>
+ </node>
<node oor:name="XLineColorToolBox" oor:op="replace">
<prop oor:name="Command">
<value>.uno:XLineColor</value>
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 07ae6ae2894b..df8a4319ea01 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -153,7 +153,6 @@ void ScDLL::Init()
SvxClipBoardControl ::RegisterControl(SID_PASTE_UNFORMATTED, pMod );
SvxUndoRedoControl ::RegisterControl(SID_UNDO, pMod );
SvxUndoRedoControl ::RegisterControl(SID_REDO, pMod );
- svx::TextUnderlinePopup ::RegisterControl(SID_ATTR_CHAR_UNDERLINE, pMod );
svx::FormatPaintBrushToolBoxControl::RegisterControl(SID_FORMATPAINTBRUSH, pMod );
sc::ScNumberFormatControl ::RegisterControl(SID_NUMBER_TYPE_FORMAT, pMod );
diff --git a/sd/source/ui/app/sddll.cxx b/sd/source/ui/app/sddll.cxx
index 281e96ef1831..b83882bd764b 100644
--- a/sd/source/ui/app/sddll.cxx
+++ b/sd/source/ui/app/sddll.cxx
@@ -215,8 +215,6 @@ void SdDLL::RegisterControllers(SdModule* pMod)
SvxClipBoardControl::RegisterControl( SID_PASTE, pMod );
SvxClipBoardControl::RegisterControl( SID_PASTE_UNFORMATTED, pMod );
- svx::TextUnderlinePopup::RegisterControl(SID_ATTR_CHAR_UNDERLINE, pMod);
-
#if HAVE_FEATURE_AVMEDIA
::avmedia::MediaToolBoxControl::RegisterControl( SID_AVMEDIA_TOOLBOX, pMod );
#endif
diff --git a/svx/source/sidebar/text/TextUnderlineControl.cxx b/svx/source/sidebar/text/TextUnderlineControl.cxx
index c509998e0b49..f8bac8dc99d4 100644
--- a/svx/source/sidebar/text/TextUnderlineControl.cxx
+++ b/svx/source/sidebar/text/TextUnderlineControl.cxx
@@ -21,6 +21,7 @@
#include <sfx2/dispatch.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/sidebar/Theme.hxx>
+#include <svx/TextUnderlinePopup.hxx>
#include <editeng/editids.hrc>
#include <editeng/udlnitem.hxx>
#include <vcl/button.hxx>
@@ -29,8 +30,8 @@
namespace svx {
-TextUnderlineControl::TextUnderlineControl(sal_uInt16 nId, vcl::Window* pParent)
-: SfxPopupWindow(nId, pParent, "TextUnderlineControl", "svx/ui/textunderlinecontrol.ui")
+TextUnderlineControl::TextUnderlineControl(TextUnderlinePopup* pControl, vcl::Window* pParent)
+ : ToolbarPopup(pControl->getFrameInterface(), pParent, "TextUnderlineControl", "svx/ui/textunderlinecontrol.ui")
{
get(maNone, "none");
get(maSingle, "single");
@@ -82,7 +83,7 @@ void TextUnderlineControl::dispose()
maWave.clear();
maMoreOptions.clear();
- SfxPopupWindow::dispose();
+ ToolbarPopup::dispose();
}
FontLineStyle TextUnderlineControl::getLineStyle(Button const * pButton)
diff --git a/svx/source/sidebar/text/TextUnderlineControl.hxx b/svx/source/sidebar/text/TextUnderlineControl.hxx
index ec1df4bbb696..48ba6d63e059 100644
--- a/svx/source/sidebar/text/TextUnderlineControl.hxx
+++ b/svx/source/sidebar/text/TextUnderlineControl.hxx
@@ -23,15 +23,17 @@
#include <sfx2/bindings.hxx>
#include <vcl/button.hxx>
#include <vcl/vclenum.hxx>
+#include <svtools/toolbarmenu.hxx>
#include <svtools/valueset.hxx>
-#include <sfx2/tbxctrl.hxx>
namespace svx {
-class TextUnderlineControl : public SfxPopupWindow
+class TextUnderlinePopup;
+
+class TextUnderlineControl final : public svtools::ToolbarPopup
{
public:
- explicit TextUnderlineControl(sal_uInt16 nId, vcl::Window* pParent);
+ explicit TextUnderlineControl(TextUnderlinePopup* pControl, vcl::Window* pParent);
virtual ~TextUnderlineControl() override;
virtual void dispose() override;
diff --git a/svx/source/sidebar/text/TextUnderlinePopup.cxx b/svx/source/sidebar/text/TextUnderlinePopup.cxx
index a06012f18e25..5aebdbbdb4e1 100644
--- a/svx/source/sidebar/text/TextUnderlinePopup.cxx
+++ b/svx/source/sidebar/text/TextUnderlinePopup.cxx
@@ -23,10 +23,8 @@
using namespace svx;
-SFX_IMPL_TOOLBOX_CONTROL(TextUnderlinePopup, SvxUnderlineItem);
-
-TextUnderlinePopup::TextUnderlinePopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx)
- : SfxToolBoxControl(nSlotId, nId, rTbx)
+TextUnderlinePopup::TextUnderlinePopup(const css::uno::Reference<css::uno::XComponentContext>& rContext)
+ : PopupWindowController(rContext, nullptr, OUString())
{
}
@@ -34,21 +32,37 @@ TextUnderlinePopup::~TextUnderlinePopup()
{
}
-void TextUnderlinePopup::initialize( const css::uno::Sequence< css::uno::Any >& aArguments )
+void TextUnderlinePopup::initialize( const css::uno::Sequence< css::uno::Any >& rArguments )
{
- SfxToolBoxControl::initialize(aArguments);
- if (GetToolBox().GetItemCommand(GetId()) == m_aCommandURL)
- GetToolBox().SetItemBits(GetId(), ToolBoxItemBits::DROPDOWN | GetToolBox().GetItemBits(GetId()));
+ 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));
}
-VclPtr<SfxPopupWindow> TextUnderlinePopup::CreatePopupWindow()
+VclPtr<vcl::Window> TextUnderlinePopup::createPopupWindow(vcl::Window* pParent)
{
- VclPtr<TextUnderlineControl> pControl = VclPtr<TextUnderlineControl>::Create(GetSlotId(), &GetToolBox());
- pControl->StartPopupMode(&GetToolBox(), FloatWinPopupFlags::GrabFocus);
- SetPopupWindow(pControl);
+ return VclPtr<TextUnderlineControl>::Create(this, pParent);
+}
- return pControl;
+OUString TextUnderlinePopup::getImplementationName()
+{
+ return "com.sun.star.comp.svx.UnderlineToolBoxControl";
}
+css::uno::Sequence<OUString> TextUnderlinePopup::getSupportedServiceNames()
+{
+ return { "com.sun.star.frame.ToolbarController" };
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
+com_sun_star_comp_svx_UnderlineToolBoxControl_get_implementation(
+ css::uno::XComponentContext* rContext,
+ css::uno::Sequence<css::uno::Any> const & )
+{
+ return cppu::acquire(new TextUnderlinePopup(rContext));
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/util/svx.component b/svx/util/svx.component
index a27f47063d68..e195f023bae1 100644
--- a/svx/util/svx.component
+++ b/svx/util/svx.component
@@ -112,4 +112,8 @@
constructor="com_sun_star_comp_svx_CharacterSpacingToolBoxControl_get_implementation">
<service name="com.sun.star.frame.ToolbarController"/>
</implementation>
+ <implementation name="com.sun.star.comp.svx.UnderlineToolBoxControl"
+ constructor="com_sun_star_comp_svx_UnderlineToolBoxControl_get_implementation">
+ <service name="com.sun.star.frame.ToolbarController"/>
+ </implementation>
</component>
diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx
index 67c492e66192..2bb64eff605c 100644
--- a/sw/source/uibase/app/swmodule.cxx
+++ b/sw/source/uibase/app/swmodule.cxx
@@ -274,7 +274,6 @@ void SwDLL::RegisterControls()
SvxTbxCtlDraw::RegisterControl(SID_INSERT_DRAW, pMod );
SvxTbxCtlDraw::RegisterControl(SID_TRACK_CHANGES_BAR, pMod );
SwTbxAutoTextCtrl::RegisterControl(FN_GLOSSARY_DLG, pMod );
- svx::TextUnderlinePopup::RegisterControl(SID_ATTR_CHAR_UNDERLINE, pMod);
svx::ParaAboveSpacingControl::RegisterControl(SID_ATTR_PARA_ABOVESPACE, pMod);
svx::ParaBelowSpacingControl::RegisterControl(SID_ATTR_PARA_BELOWSPACE, pMod);
svx::ParaLeftSpacingControl::RegisterControl(SID_ATTR_PARA_LEFTSPACE, pMod);
More information about the Libreoffice-commits
mailing list