summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-01-13 09:14:39 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-01-14 11:51:06 +0100
commit94c1f5cfb96a826220b64608cf0ada76d3bdde31 (patch)
tree15c3db39b12440bb5079a28dfe1001983ab9f8f5
parent[pt_PT] Added 15 words to autocorrect (diff)
downloadcore-94c1f5cfb96a826220b64608cf0ada76d3bdde31.tar.gz
core-94c1f5cfb96a826220b64608cf0ada76d3bdde31.zip
rework SfxCharmapCtrl to be a PopupWindowController
With MSVC, the changes to include/sfx2/charmappopup.hxx would cause spurious > isvt.lib(svtlo.dll) : error LNK2005: "public: virtual class com::sun::star::uno::Any __cdecl cppu::ImplInheritanceHelper<class svt::ToolboxController,class com::sun::star::lang::XServiceInfo>::queryInterface(class com::sun::star::uno::Type const &)" (?queryInterface@?$ImplInheritanceHelper@VToolboxController@svt@@VXServiceInfo@lang@star@sun@com@@@cppu@@UAA?AVAny@uno@star@sun@com@@ABVType@4567@@Z) already defined in classificationcontroller.o > isvt.lib(svtlo.dll) : error LNK2005: "public: virtual void __cdecl cppu::ImplInheritanceHelper<class svt::ToolboxController,class com::sun::star::lang::XServiceInfo>::acquire(void)" (?acquire@?$ImplInheritanceHelper@VToolboxController@svt@@VXServiceInfo@lang@star@sun@com@@@cppu@@UAAXXZ) already defined in classificationcontroller.o > isvt.lib(svtlo.dll) : error LNK2005: "public: virtual void __cdecl cppu::ImplInheritanceHelper<class svt::ToolboxController,class com::sun::star::lang::XServiceInfo>::release(void)" (?release@?$ImplInheritanceHelper@VToolboxController@svt@@VXServiceInfo@lang@star@sun@com@@@cppu@@UAAXXZ) already defined in classificationcontroller.o when linking Library_sfx (and which appears to be unrelated to the (implicit) /INCREMENTAL since 9739c37d8ad7c6fca269709674a6975fa7ebd191 "enable incremental linking on windows"), which requires the HACK in include/svtools/popupwindowcontroller.hxx. Change-Id: I74c4318e6216001f18d0cf5ed63e78ba2ab13cd3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86664 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--include/sfx2/charmapcontrol.hxx8
-rw-r--r--include/sfx2/charmappopup.hxx19
-rw-r--r--include/svtools/popupwindowcontroller.hxx10
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu11
-rw-r--r--sc/source/ui/app/scdll.cxx1
-rw-r--r--sd/source/ui/app/sddll.cxx1
-rw-r--r--sfx2/source/control/charmapcontrol.cxx12
-rw-r--r--sfx2/source/dialog/charmappopup.cxx39
-rw-r--r--sfx2/util/sfx.component4
-rw-r--r--svtools/source/uno/popupwindowcontroller.cxx2
-rw-r--r--sw/source/uibase/app/swmodule.cxx2
11 files changed, 72 insertions, 37 deletions
diff --git a/include/sfx2/charmapcontrol.hxx b/include/sfx2/charmapcontrol.hxx
index 4c0501c0abfd..e6a8f672eef8 100644
--- a/include/sfx2/charmapcontrol.hxx
+++ b/include/sfx2/charmapcontrol.hxx
@@ -24,16 +24,18 @@
#include <sfx2/dllapi.h>
#include <sfx2/tbxctrl.hxx>
#include <sfx2/charwin.hxx>
+#include <svtools/toolbarmenu.hxx>
#include <vcl/button.hxx>
#include <deque>
+class CharmapPopup;
+
namespace com::sun::star::frame { class XFrame; }
-class SfxCharmapCtrl final : public SfxPopupWindow
+class SfxCharmapCtrl final : public svtools::ToolbarPopup
{
public:
- explicit SfxCharmapCtrl(sal_uInt16 nId, vcl::Window* pParent,
- const css::uno::Reference< css::frame::XFrame >& rFrame);
+ explicit SfxCharmapCtrl(CharmapPopup* pControl, vcl::Window* pParent);
virtual ~SfxCharmapCtrl() override;
diff --git a/include/sfx2/charmappopup.hxx b/include/sfx2/charmappopup.hxx
index d896acd45e45..a691327104b6 100644
--- a/include/sfx2/charmappopup.hxx
+++ b/include/sfx2/charmappopup.hxx
@@ -20,19 +20,24 @@
#ifndef INCLUDED_SFX2_INC_CHARMAPPOPUP_HXX
#define INCLUDED_SFX2_INC_CHARMAPPOPUP_HXX
-#include <sfx2/tbxctrl.hxx>
+#include <svtools/popupwindowcontroller.hxx>
#include <sfx2/dllapi.h>
-class SFX2_DLLPUBLIC CharmapPopup final : public SfxToolBoxControl
+class SFX2_DLLPUBLIC CharmapPopup final : public svt::PopupWindowController
{
public:
- SFX_DECL_TOOLBOX_CONTROL();
-
- CharmapPopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
+ CharmapPopup(const css::uno::Reference<css::uno::XComponentContext>& rContext);
virtual ~CharmapPopup() override;
- virtual VclPtr<SfxPopupWindow> CreatePopupWindow() override;
- virtual void SAL_CALL execute( sal_Int16 /*KeyModifier*/ ) 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/include/svtools/popupwindowcontroller.hxx b/include/svtools/popupwindowcontroller.hxx
index f1df441a4979..88317cb9de3d 100644
--- a/include/svtools/popupwindowcontroller.hxx
+++ b/include/svtools/popupwindowcontroller.hxx
@@ -40,8 +40,14 @@ namespace svt
{
class PopupWindowControllerImpl;
-class SVT_DLLPUBLIC PopupWindowController : public cppu::ImplInheritanceHelper< svt::ToolboxController,
- css::lang::XServiceInfo >
+//HACK to avoid duplicate ImplInheritanceHelper symbols with MSVC:
+class SAL_DLLPUBLIC_TEMPLATE PopupWindowController_Base:
+ public cppu::ImplInheritanceHelper<svt::ToolboxController, css::lang::XServiceInfo>
+{
+ using ImplInheritanceHelper::ImplInheritanceHelper;
+};
+
+class SVT_DLLPUBLIC PopupWindowController : public PopupWindowController_Base
{
public:
PopupWindowController( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
index a0bd1450d0e0..829f9f17c4e8 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
@@ -1294,6 +1294,17 @@
<value>com.sun.star.comp.svx.CharacterSpacingToolBoxControl</value>
</prop>
</node>
+ <node oor:name="InsertSymbolToolBoxControl" oor:op="replace">
+ <prop oor:name="Command">
+ <value>.uno:CharmapControl</value>
+ </prop>
+ <prop oor:name="Module">
+ <value/>
+ </prop>
+ <prop oor:name="Controller">
+ <value>com.sun.star.comp.sfx2.InsertSymbolToolBoxControl</value>
+ </prop>
+ </node>
<node oor:name="BorderStyleToolBoxControl" oor:op="replace">
<prop oor:name="Command">
<value>.uno:SetBorderStyle</value>
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index df8a4319ea01..fd23b78cf7e3 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -173,7 +173,6 @@ void ScDLL::Init()
SvxCTLTextTbxCtrl::RegisterControl(SID_ATTR_PARA_RIGHT_TO_LEFT, pMod);
EmojiPopup::RegisterControl(SID_EMOJI_CONTROL, pMod );
- CharmapPopup::RegisterControl(SID_CHARMAP_CONTROL, pMod );
// Media Controller
#if HAVE_FEATURE_AVMEDIA
diff --git a/sd/source/ui/app/sddll.cxx b/sd/source/ui/app/sddll.cxx
index b83882bd764b..0e63a002a6f6 100644
--- a/sd/source/ui/app/sddll.cxx
+++ b/sd/source/ui/app/sddll.cxx
@@ -224,7 +224,6 @@ void SdDLL::RegisterControllers(SdModule* pMod)
SvxTbxCtlDraw::RegisterControl(SID_INSERT_DRAW, pMod );
EmojiPopup::RegisterControl(SID_EMOJI_CONTROL, pMod );
- CharmapPopup::RegisterControl(SID_CHARMAP_CONTROL, pMod );
}
void SdDLL::Init()
diff --git a/sfx2/source/control/charmapcontrol.cxx b/sfx2/source/control/charmapcontrol.cxx
index 25c9548bb5d7..fe44619b2f3a 100644
--- a/sfx2/source/control/charmapcontrol.cxx
+++ b/sfx2/source/control/charmapcontrol.cxx
@@ -20,13 +20,14 @@
#include <comphelper/dispatchcommand.hxx>
#include <officecfg/Office/Common.hxx>
#include <sfx2/charmapcontrol.hxx>
+#include <sfx2/charmappopup.hxx>
#include <sfx2/viewfrm.hxx>
#include <vcl/event.hxx>
using namespace css;
-SfxCharmapCtrl::SfxCharmapCtrl(sal_uInt16 nId, vcl::Window* pParent, const css::uno::Reference< css::frame::XFrame >& rFrame)
- : SfxPopupWindow(nId, pParent, "charmapctrl", "sfx/ui/charmapcontrol.ui", rFrame)
+SfxCharmapCtrl::SfxCharmapCtrl(CharmapPopup* pControl, vcl::Window* pParent)
+ : ToolbarPopup(pControl->getFrameInterface(), pParent, "charmapctrl", "sfx/ui/charmapcontrol.ui")
{
get( m_pRecentCharView[0], "viewchar1" );
get( m_pRecentCharView[1], "viewchar2" );
@@ -89,7 +90,6 @@ SfxCharmapCtrl::~SfxCharmapCtrl()
disposeOnce();
}
-
void SfxCharmapCtrl::dispose()
{
for(int i = 0; i < 16; i++)
@@ -99,10 +99,9 @@ void SfxCharmapCtrl::dispose()
maRecentCharFontList.clear();
maDlgBtn.clear();
- SfxPopupWindow::dispose();
+ ToolbarPopup::dispose();
}
-
void SfxCharmapCtrl::getFavCharacterList()
{
//retrieve recent character list
@@ -114,7 +113,6 @@ void SfxCharmapCtrl::getFavCharacterList()
std::copy(rFavCharFontList.begin(), rFavCharFontList.end(), std::back_inserter(maFavCharFontList));
}
-
void SfxCharmapCtrl::updateFavCharControl()
{
int i = 0;
@@ -191,7 +189,7 @@ bool SfxCharmapCtrl::EventNotify( NotifyEvent& rNEvt )
mbNeedsInit = false;
}
}
- return SfxPopupWindow::EventNotify( rNEvt );
+ return ToolbarPopup::EventNotify( rNEvt );
}
diff --git a/sfx2/source/dialog/charmappopup.cxx b/sfx2/source/dialog/charmappopup.cxx
index bbe3ae77b413..330012c176b9 100644
--- a/sfx2/source/dialog/charmappopup.cxx
+++ b/sfx2/source/dialog/charmappopup.cxx
@@ -20,33 +20,46 @@
#include <sfx2/charmapcontrol.hxx>
#include <vcl/toolbox.hxx>
-SFX_IMPL_TOOLBOX_CONTROL(CharmapPopup, SfxVoidItem);
-
-CharmapPopup::CharmapPopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx)
- : SfxToolBoxControl(nSlotId, nId, rTbx)
+CharmapPopup::CharmapPopup(const css::uno::Reference<css::uno::XComponentContext>& rContext)
+ : PopupWindowController(rContext, nullptr, OUString())
{
- rTbx.SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | rTbx.GetItemBits(nId));
}
CharmapPopup::~CharmapPopup()
{
}
-VclPtr<SfxPopupWindow> CharmapPopup::CreatePopupWindow()
+void CharmapPopup::initialize( const css::uno::Sequence< css::uno::Any >& rArguments )
{
- VclPtr<SfxCharmapCtrl> pControl = VclPtr<SfxCharmapCtrl>::Create(GetSlotId(), &GetToolBox(), m_xFrame);
+ 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));
+}
- pControl->StartPopupMode(&GetToolBox(), FloatWinPopupFlags::GrabFocus);
+VclPtr<vcl::Window> CharmapPopup::createPopupWindow(vcl::Window* pParent)
+{
+ return VclPtr<SfxCharmapCtrl>::Create(this, pParent);
+}
- SetPopupWindow(pControl);
+OUString CharmapPopup::getImplementationName()
+{
+ return "com.sun.star.comp.sfx2.InsertSymbolToolBoxControl";
+}
- return pControl;
+css::uno::Sequence<OUString> CharmapPopup::getSupportedServiceNames()
+{
+ return { "com.sun.star.frame.ToolbarController" };
}
-void SAL_CALL CharmapPopup::execute( sal_Int16 /*KeyModifier*/ )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
+com_sun_star_comp_sfx2_InsertSymbolToolBoxControl_get_implementation(
+ css::uno::XComponentContext* rContext,
+ css::uno::Sequence<css::uno::Any> const & )
{
- com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > aArgs;
- Dispatch(".uno:InsertSymbol", aArgs);
+ return cppu::acquire( new CharmapPopup( rContext ) );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/util/sfx.component b/sfx2/util/sfx.component
index ed9a449baca1..0e1b2521c1f6 100644
--- a/sfx2/util/sfx.component
+++ b/sfx2/util/sfx.component
@@ -86,4 +86,8 @@
constructor="com_sun_star_sfx2_ClassificationCategoriesController_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"/>
+ </implementation>
</component>
diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx
index 50135adbe453..a2eb9efc7cfb 100644
--- a/svtools/source/uno/popupwindowcontroller.cxx
+++ b/svtools/source/uno/popupwindowcontroller.cxx
@@ -158,7 +158,7 @@ IMPL_LINK( PopupWindowControllerImpl, WindowEventListener, VclWindowEvent&, rWin
PopupWindowController::PopupWindowController( const Reference< uno::XComponentContext >& rxContext,
const Reference< frame::XFrame >& xFrame,
const OUString& aCommandURL )
-: ImplInheritanceHelper( rxContext, xFrame, aCommandURL )
+: PopupWindowController_Base( rxContext, xFrame, aCommandURL )
, mxImpl( new PopupWindowControllerImpl() )
{
}
diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx
index 2bb64eff605c..dd596895786e 100644
--- a/sw/source/uibase/app/swmodule.cxx
+++ b/sw/source/uibase/app/swmodule.cxx
@@ -336,8 +336,6 @@ void SwDLL::RegisterControls()
false, pMod, comphelper::LibreOfficeKit::isActive() ? SfxChildWindowFlags::NEVERCLONE
: SfxChildWindowFlags::NONE);
- CharmapPopup::RegisterControl(SID_CHARMAP_CONTROL, pMod );
-
SvxGrafRedToolBoxControl::RegisterControl( SID_ATTR_GRAF_RED, pMod );
SvxGrafGreenToolBoxControl::RegisterControl( SID_ATTR_GRAF_GREEN, pMod );
SvxGrafBlueToolBoxControl::RegisterControl( SID_ATTR_GRAF_BLUE, pMod );