diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-01-14 17:17:35 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-01-14 21:27:41 +0100 |
commit | e5701af7c4226341776ed12c4bc5b24469a2599d (patch) | |
tree | 90c924cc2f8f393e39fdfaaf70639ff0fa02d850 | |
parent | 22bf6e323465bd38b38fc026d801bb470e3f9d5c (diff) |
rework SfxEmojiControl to be a PopupWindowController
Change-Id: Ia3262e5b54257d5556c500f440806ac2df9886cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86794
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | include/sfx2/charmapcontrol.hxx | 1 | ||||
-rw-r--r-- | include/sfx2/emojicontrol.hxx | 8 | ||||
-rw-r--r-- | include/sfx2/emojipopup.hxx | 18 | ||||
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu | 11 | ||||
-rw-r--r-- | sc/source/ui/app/scdll.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/app/sddll.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/control/emojicontrol.cxx | 10 | ||||
-rw-r--r-- | sfx2/source/control/emojipopup.cxx | 37 | ||||
-rw-r--r-- | sfx2/util/sfx.component | 4 | ||||
-rw-r--r-- | sw/source/uibase/app/swmodule.cxx | 2 |
10 files changed, 64 insertions, 31 deletions
diff --git a/include/sfx2/charmapcontrol.hxx b/include/sfx2/charmapcontrol.hxx index 83230a458af6..31a7ce5937e7 100644 --- a/include/sfx2/charmapcontrol.hxx +++ b/include/sfx2/charmapcontrol.hxx @@ -22,7 +22,6 @@ #include <sal/config.h> #include <sfx2/dllapi.h> -#include <sfx2/tbxctrl.hxx> #include <sfx2/charwin.hxx> #include <svtools/toolbarmenu.hxx> #include <deque> diff --git a/include/sfx2/emojicontrol.hxx b/include/sfx2/emojicontrol.hxx index 4026a31954ab..33d0e021bbe1 100644 --- a/include/sfx2/emojicontrol.hxx +++ b/include/sfx2/emojicontrol.hxx @@ -13,21 +13,21 @@ #include <sal/config.h> #include <sfx2/dllapi.h> #include <vcl/tabctrl.hxx> -#include <sfx2/tbxctrl.hxx> +#include <svtools/toolbarmenu.hxx> #define TAB_FONT_SIZE 15 namespace com::sun::star::frame { class XFrame; } +class EmojiPopup; class EmojiView; class ThumbnailViewItem; enum class FILTER_CATEGORY; -class SfxEmojiControl final : public SfxPopupWindow +class SfxEmojiControl final : public svtools::ToolbarPopup { public: - explicit SfxEmojiControl(sal_uInt16 nId, vcl::Window* pParent, - const css::uno::Reference< css::frame::XFrame >& rFrame); + explicit SfxEmojiControl(EmojiPopup* pControl, vcl::Window* pParent); virtual ~SfxEmojiControl() override; diff --git a/include/sfx2/emojipopup.hxx b/include/sfx2/emojipopup.hxx index ee98e12e93b8..a5a9b0934504 100644 --- a/include/sfx2/emojipopup.hxx +++ b/include/sfx2/emojipopup.hxx @@ -20,18 +20,24 @@ #ifndef INCLUDED_SFX2_INC_EMOJIPOPUP_HXX #define INCLUDED_SFX2_INC_EMOJIPOPUP_HXX -#include <sfx2/tbxctrl.hxx> +#include <svtools/popupwindowcontroller.hxx> #include <sfx2/dllapi.h> -class SFX2_DLLPUBLIC EmojiPopup final : public SfxToolBoxControl +class SFX2_DLLPUBLIC EmojiPopup final : public svt::PopupWindowController { public: - SFX_DECL_TOOLBOX_CONTROL(); - - EmojiPopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx); + EmojiPopup(const css::uno::Reference<css::uno::XComponentContext>& rContext); virtual ~EmojiPopup() override; - virtual VclPtr<SfxPopupWindow> CreatePopupWindow() override; + using svt::ToolboxController::createPopupWindow; + virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) 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; }; #endif diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu index 924de434b281..07d0da5103fc 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu @@ -1360,6 +1360,17 @@ <value>com.sun.star.comp.svx.CharacterSpacingToolBoxControl</value> </prop> </node> + <node oor:name="InsertEmojiToolBoxControl" oor:op="replace"> + <prop oor:name="Command"> + <value>.uno:EmojiControl</value> + </prop> + <prop oor:name="Module"> + <value/> + </prop> + <prop oor:name="Controller"> + <value>com.sun.star.comp.sfx2.InsertEmojiToolBoxControl</value> + </prop> + </node> <node oor:name="InsertSymbolToolBoxControl" oor:op="replace"> <prop oor:name="Command"> <value>.uno:CharmapControl</value> diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx index fd23b78cf7e3..d3a1bbdc1035 100644 --- a/sc/source/ui/app/scdll.cxx +++ b/sc/source/ui/app/scdll.cxx @@ -172,8 +172,6 @@ void ScDLL::Init() SvxCTLTextTbxCtrl::RegisterControl(SID_ATTR_PARA_LEFT_TO_RIGHT, pMod); SvxCTLTextTbxCtrl::RegisterControl(SID_ATTR_PARA_RIGHT_TO_LEFT, pMod); - EmojiPopup::RegisterControl(SID_EMOJI_CONTROL, pMod ); - // Media Controller #if HAVE_FEATURE_AVMEDIA ::avmedia::MediaToolBoxControl::RegisterControl( SID_AVMEDIA_TOOLBOX, pMod ); diff --git a/sd/source/ui/app/sddll.cxx b/sd/source/ui/app/sddll.cxx index 5cfa2930a9de..e990d56053c9 100644 --- a/sd/source/ui/app/sddll.cxx +++ b/sd/source/ui/app/sddll.cxx @@ -221,8 +221,6 @@ void SdDLL::RegisterControllers(SdModule* pMod) XmlSecStatusBarControl::RegisterControl( SID_SIGNATURE, pMod ); SdTemplateControl::RegisterControl( SID_STATUS_LAYOUT, pMod ); SvxTbxCtlDraw::RegisterControl(SID_INSERT_DRAW, pMod ); - - EmojiPopup::RegisterControl(SID_EMOJI_CONTROL, pMod ); } void SdDLL::Init() diff --git a/sfx2/source/control/emojicontrol.cxx b/sfx2/source/control/emojicontrol.cxx index 68299bc72019..7713009ec014 100644 --- a/sfx2/source/control/emojicontrol.cxx +++ b/sfx2/source/control/emojicontrol.cxx @@ -17,8 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <sfx2/emojiview.hxx> #include <sfx2/emojicontrol.hxx> +#include <sfx2/emojipopup.hxx> +#include <sfx2/emojiview.hxx> #include <sfx2/thumbnailviewitem.hxx> #include <vcl/tabpage.hxx> #include <comphelper/propertysequence.hxx> @@ -37,8 +38,8 @@ const char FILTER_UNICODE9[] = "unicode9"; using namespace com::sun::star; -SfxEmojiControl::SfxEmojiControl(sal_uInt16 nId, vcl::Window* pParent, const css::uno::Reference< css::frame::XFrame >& rFrame) - : SfxPopupWindow(nId, pParent, "emojictrl", "sfx/ui/emojicontrol.ui", rFrame) +SfxEmojiControl::SfxEmojiControl(EmojiPopup* pControl, vcl::Window* pParent) + : ToolbarPopup(pControl->getFrameInterface(), pParent, "emojictrl", "sfx/ui/emojicontrol.ui") { get(mpTabControl, "tabcontrol"); get(mpEmojiView, "emoji_view"); @@ -111,13 +112,12 @@ SfxEmojiControl::~SfxEmojiControl() disposeOnce(); } - void SfxEmojiControl::dispose() { mpTabControl.clear(); mpEmojiView.clear(); - SfxPopupWindow::dispose(); + ToolbarPopup::dispose(); } void SfxEmojiControl::ConvertLabelToUnicode(sal_uInt16 nPageId) diff --git a/sfx2/source/control/emojipopup.cxx b/sfx2/source/control/emojipopup.cxx index 85f5a350ac64..f68bab24fb96 100644 --- a/sfx2/source/control/emojipopup.cxx +++ b/sfx2/source/control/emojipopup.cxx @@ -20,27 +20,46 @@ #include <sfx2/emojicontrol.hxx> #include <vcl/toolbox.hxx> -SFX_IMPL_TOOLBOX_CONTROL(EmojiPopup, SfxVoidItem); +EmojiPopup::EmojiPopup(const css::uno::Reference<css::uno::XComponentContext>& rContext) + : PopupWindowController(rContext, nullptr, OUString()) +{ +} -EmojiPopup::EmojiPopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx) - : SfxToolBoxControl(nSlotId, nId, rTbx) +void EmojiPopup::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)); } EmojiPopup::~EmojiPopup() { } -VclPtr<SfxPopupWindow> EmojiPopup::CreatePopupWindow() +VclPtr<vcl::Window> EmojiPopup::createPopupWindow(vcl::Window* pParent) { - VclPtr<SfxEmojiControl> pControl = VclPtr<SfxEmojiControl>::Create(GetSlotId(), &GetToolBox(), m_xFrame); + return VclPtr<SfxEmojiControl>::Create(this, pParent); +} - pControl->StartPopupMode(&GetToolBox(), FloatWinPopupFlags::GrabFocus); +OUString EmojiPopup::getImplementationName() +{ + return "com.sun.star.comp.sfx2.InsertEmojiToolBoxControl"; +} - SetPopupWindow(pControl); +css::uno::Sequence<OUString> EmojiPopup::getSupportedServiceNames() +{ + return { "com.sun.star.frame.ToolbarController" }; +} - return pControl; +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * +com_sun_star_comp_sfx2_InsertEmojiToolBoxControl_get_implementation( + css::uno::XComponentContext* rContext, + css::uno::Sequence<css::uno::Any> const & ) +{ + return cppu::acquire(new EmojiPopup(rContext)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/util/sfx.component b/sfx2/util/sfx.component index 0e1b2521c1f6..314b8c18ecc9 100644 --- a/sfx2/util/sfx.component +++ b/sfx2/util/sfx.component @@ -86,6 +86,10 @@ constructor="com_sun_star_sfx2_ClassificationCategoriesController_get_implementation"> <service name="com.sun.star.frame.ToolbarController"/> </implementation> + <implementation name="com.sun.star.comp.sfx2.InsertEmojiToolBoxControl" + constructor="com_sun_star_comp_sfx2_InsertEmojiToolBoxControl_get_implementation"> + <service name="com.sun.star.frame.ToolbarController"/> + </implementation> <implementation name="com.sun.star.comp.sfx2.InsertSymbolToolBoxControl" constructor="com_sun_star_comp_sfx2_InsertSymbolToolBoxControl_get_implementation"> <service name="com.sun.star.frame.ToolbarController"/> diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx index 936370d89bb8..d2f60c269e49 100644 --- a/sw/source/uibase/app/swmodule.cxx +++ b/sw/source/uibase/app/swmodule.cxx @@ -309,8 +309,6 @@ void SwDLL::RegisterControls() SvxModifyControl::RegisterControl( SID_DOC_MODIFIED, pMod ); SvxZoomSliderControl::RegisterControl( SID_ATTR_ZOOMSLIDER, pMod ); - EmojiPopup::RegisterControl(SID_EMOJI_CONTROL, pMod ); - SvxIMapDlgChildWindow::RegisterChildWindow( false, pMod ); SvxSearchDialogWrapper::RegisterChildWindow( false, pMod ); SvxHlinkDlgWrapper::RegisterChildWindow( false, pMod ); |