diff options
44 files changed, 6 insertions, 2584 deletions
diff --git a/compilerplugins/clang/store/constantfunction.cxx b/compilerplugins/clang/store/constantfunction.cxx index 74fc0f4669b3..9459bc3c26f2 100644 --- a/compilerplugins/clang/store/constantfunction.cxx +++ b/compilerplugins/clang/store/constantfunction.cxx @@ -433,7 +433,7 @@ bool ConstantFunction::VisitFunctionDecl(const FunctionDecl * pFunctionDecl) { return true; } // LINK callback which supplies a return value which means something - if (aFunctionName == "SfxVirtualMenu::Highlight" || aFunctionName == "framework::MenuManager::Highlight" + if (aFunctionName == "framework::MenuManager::Highlight" || aFunctionName == "framework::MenuBarManager::Highlight") { return true; } diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 5fcee3feba2c..9dbe49f9882b 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -38,7 +38,6 @@ #include <sfx2/viewsh.hxx> #include <sfx2/msg.hxx> #include <sfx2/msgpool.hxx> -#include <sfx2/mnumgr.hxx> #include <sfx2/minfitem.hxx> #include <sfx2/objsh.hxx> #include <sfx2/request.hxx> diff --git a/include/sfx2/app.hxx b/include/sfx2/app.hxx index 33180caa92f3..6703157b7c6b 100644 --- a/include/sfx2/app.hxx +++ b/include/sfx2/app.hxx @@ -74,7 +74,6 @@ class SfxModule; class SfxModule; namespace vcl { class Window; } struct SfxChildWinFactory; -struct SfxMenuCtrlFactory; struct SfxStbCtrlFactory; struct SfxTbxCtrlFactory; class SimpleResMgr; @@ -191,7 +190,6 @@ public: SAL_DLLPRIVATE void RegisterChildWindow_Impl(SfxModule*, SfxChildWinFactory*); SAL_DLLPRIVATE void RegisterChildWindowContext_Impl(SfxModule*, sal_uInt16, SfxChildWinContextFactory*); SAL_DLLPRIVATE void RegisterStatusBarControl_Impl(SfxModule*, const SfxStbCtrlFactory&); - SAL_DLLPRIVATE void RegisterMenuControl_Impl(SfxModule*, const SfxMenuCtrlFactory&); SAL_DLLPRIVATE void RegisterToolBoxControl_Impl( SfxModule*, const SfxTbxCtrlFactory&); SAL_DLLPRIVATE SfxTbxCtrlFactArr_Impl& GetTbxCtrlFactories_Impl() const; SAL_DLLPRIVATE SfxStbCtrlFactArr_Impl& GetStbCtrlFactories_Impl() const; diff --git a/include/sfx2/dispatch.hxx b/include/sfx2/dispatch.hxx index 47be2d7aaf0e..ed4878099db2 100644 --- a/include/sfx2/dispatch.hxx +++ b/include/sfx2/dispatch.hxx @@ -155,7 +155,6 @@ public: SfxViewFrame* GetFrame() const; SfxModule* GetModule() const; - void ExecutePopup( const ResId &rId, vcl::Window *pWin = nullptr, const Point *pPos = nullptr ); void ExecutePopup( const OUString &rResName, vcl::Window *pWin = nullptr, const Point *pPos = nullptr ); static void ExecutePopup( vcl::Window *pWin = nullptr, const Point *pPosPixel = nullptr ); diff --git a/include/sfx2/mnuitem.hxx b/include/sfx2/mnuitem.hxx deleted file mode 100644 index 56dc4bd63852..000000000000 --- a/include/sfx2/mnuitem.hxx +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_MNUITEM_HXX -#define INCLUDED_SFX2_MNUITEM_HXX - -#include <com/sun/star/frame/XDispatch.hpp> -#include <com/sun/star/util/URL.hpp> -#include <rtl/ustring.hxx> -#include <sal/config.h> -#include <sfx2/ctrlitem.hxx> -#include <sfx2/dllapi.h> -#include <tools/link.hxx> - -class SfxVirtualMenu; -class SfxBindings; -class SfxModule; -class Menu; -class PopupMenu; -class SfxUnoMenuControl; -class SfxUnoControllerItem; -struct SfxMenuCtrlFactory; - -class SFX2_DLLPUBLIC SfxMenuControl: public SfxControllerItem -{ - OUString aTitle; - SfxVirtualMenu* pOwnMenu; - SfxVirtualMenu* pSubMenu; - bool b_ShowStrings; - -public: - SfxMenuControl(); - SfxMenuControl( bool bShowStrings ); - SfxMenuControl( sal_uInt16, SfxBindings&); - - static SfxMenuControl* CreateImpl( sal_uInt16 nId, Menu &rMenu, SfxBindings &rBindings ); - static void RegisterControl( sal_uInt16 nSlotId = 0, SfxModule *pMod=nullptr ); - - virtual ~SfxMenuControl(); - - using SfxControllerItem::Bind; - void Bind( SfxVirtualMenu* pOwnMenu, sal_uInt16 nId, - const OUString& rTitle, SfxBindings& rBindings ); - void Bind( SfxVirtualMenu* pOwnMenu, sal_uInt16 nId, - SfxVirtualMenu& rSubMenu, - const OUString& rTitle, SfxBindings& rBindings ); - - OUString GetTitle() const; - SfxVirtualMenu* GetPopupMenu() const; - - virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, - const SfxPoolItem* pState ) override; - - static SfxMenuControl* CreateControl( sal_uInt16 nId, Menu &, SfxBindings & ); - static SfxUnoMenuControl* CreateControl( const OUString&, sal_uInt16, Menu&, const OUString& sItemText, SfxBindings&, SfxVirtualMenu* ); - static void RegisterMenuControl( SfxModule*, const SfxMenuCtrlFactory& ); - -}; - -class SfxUnoMenuControl : public SfxMenuControl -{ - SfxUnoControllerItem* pUnoCtrl; -public: - SfxUnoMenuControl( const OUString&, sal_uInt16 nId, Menu&, - const OUString&, - SfxBindings&, SfxVirtualMenu* ); - virtual ~SfxUnoMenuControl(); -}; - -typedef SfxMenuControl* (*SfxMenuControlCtor)( sal_uInt16 nId, Menu &, SfxBindings & ); - -struct SfxMenuCtrlFactory -{ - SfxMenuControlCtor pCtor; - const std::type_info& nTypeId; - sal_uInt16 nSlotId; - - SfxMenuCtrlFactory( SfxMenuControlCtor pTheCtor, - const std::type_info& nTheTypeId, sal_uInt16 nTheSlotId ): - pCtor(pTheCtor), - nTypeId(nTheTypeId), - nSlotId(nTheSlotId) - {} -}; - -inline OUString SfxMenuControl::GetTitle() const -{ - return aTitle; -} - -inline SfxVirtualMenu* SfxMenuControl::GetPopupMenu() const -{ - return pSubMenu; -} - -#define SFX_DECL_MENU_CONTROL() \ - static SfxMenuControl* CreateImpl( sal_uInt16 nId, Menu &rMenu, SfxBindings &rBindings ); \ - static void RegisterControl(sal_uInt16 nSlotId = 0, SfxModule *pMod=nullptr) - -#define SFX_IMPL_MENU_CONTROL(Class, nItemClass) \ - SfxMenuControl* Class::CreateImpl( sal_uInt16 nId, Menu &rMenu, SfxBindings &rBindings ) \ - { return new Class(nId, rMenu, rBindings); } \ - void Class::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod) \ - { SfxMenuControl::RegisterMenuControl( pMod, SfxMenuCtrlFactory( \ - Class::CreateImpl, typeid(nItemClass), nSlotId ) ); } - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/mnumgr.hxx b/include/sfx2/mnumgr.hxx deleted file mode 100644 index 46349955011f..000000000000 --- a/include/sfx2/mnumgr.hxx +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_MNUMGR_HXX -#define INCLUDED_SFX2_MNUMGR_HXX - -#include <vcl/menu.hxx> -#include <tools/wintypes.hxx> -#include <tools/link.hxx> -#include <com/sun/star/embed/VerbDescriptor.hpp> -#include <com/sun/star/uno/Sequence.hxx> - -#include <tools/resid.hxx> -#include <sfx2/sfx.hrc> - -class SfxVirtualMenu; -class SfxPoolItem; -class SfxBindings; -class ResMgr; -class Menu; -class PopupMenu; -class SfxBindings; -class ResId; -class Point; -class SfxObjectShell; -class SfxModule; -class SfxViewFrame; - -class SfxMenuManager -{ -friend class SfxPopupMenuManager; - - SfxVirtualMenu* pMenu; // the actual Menu - SfxBindings* pBindings; - bool bAddClipboardFuncs : 1; - - void Construct( SfxVirtualMenu& rMenu ); - -protected: - SfxMenuManager( Menu*, SfxBindings& ); - ~SfxMenuManager(); -public: - - DECL_LINK_TYPED( Select, Menu*, bool ); - - SfxVirtualMenu* GetMenu() const - { return pMenu; } -}; - - -class SAL_DLLPUBLIC_EXPORT SfxPopupMenuManager : public SfxMenuManager -{ -private: - Menu* pSVMenu; - SfxPopupMenuManager( const SfxPopupMenuManager& ) = delete; - SfxPopupMenuManager& operator=( const SfxPopupMenuManager& ) = delete; - -public: - SfxPopupMenuManager( PopupMenu*, SfxBindings& ); - ~SfxPopupMenuManager(); - static void ExecutePopup( const ResId&, SfxViewFrame* pViewFrame, const Point& rPoint, vcl::Window* pWindow ); - void Execute( const Point& rPos, vcl::Window *pWindow ); - - void RemoveDisabledEntries(); -}; - -#endif // INCLUDED_SFX2_MNUMGR_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/module.hxx b/include/sfx2/module.hxx index 9d8e8a195092..37d59bfe49a3 100644 --- a/include/sfx2/module.hxx +++ b/include/sfx2/module.hxx @@ -41,7 +41,6 @@ class SfxModule_Impl; class SfxSlotPool; struct SfxChildWinContextFactory; struct SfxChildWinFactory; -struct SfxMenuCtrlFactory; struct SfxStbCtrlFactory; struct SfxTbxCtrlFactory; class SfxTabPage; @@ -80,7 +79,6 @@ public: void RegisterToolBoxControl(const SfxTbxCtrlFactory&); void RegisterChildWindow(SfxChildWinFactory*); void RegisterStatusBarControl(const SfxStbCtrlFactory&); - void RegisterMenuControl(const SfxMenuCtrlFactory&); virtual VclPtr<SfxTabPage> CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx index 7ecf96fc617a..fe92614a6f65 100644 --- a/sd/source/ui/annotations/annotationwindow.cxx +++ b/sd/source/ui/annotations/annotationwindow.cxx @@ -56,7 +56,6 @@ #include <sfx2/viewfrm.hxx> #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> -#include <sfx2/mnumgr.hxx> #include <vcl/vclenum.hxx> #include <vcl/edit.hxx> diff --git a/sd/source/ui/app/sddll.cxx b/sd/source/ui/app/sddll.cxx index b2c67210f48d..c229ff992063 100644 --- a/sd/source/ui/app/sddll.cxx +++ b/sd/source/ui/app/sddll.cxx @@ -89,7 +89,6 @@ #include <sfx2/docfilt.hxx> #include <sfx2/docfile.hxx> #include <sfx2/fcontnr.hxx> -#include <sfx2/mnuitem.hxx> #include <sfx2/sidebar/SidebarChildWindow.hxx> #include <vcl/FilterConfigItem.hxx> #include <comphelper/processfactory.hxx> @@ -217,10 +216,6 @@ void SdDLL::RegisterControllers() SvxModifyControl::RegisterControl( SID_DOC_MODIFIED, pMod ); SvxZoomSliderControl::RegisterControl( SID_ATTR_ZOOMSLIDER, pMod ); - SfxMenuControl::RegisterControl( SID_SET_SNAPITEM, pMod ); - SfxMenuControl::RegisterControl( SID_DELETE_SNAPITEM, pMod ); - SfxMenuControl::RegisterControl( SID_BEZIER_CLOSE, pMod ); - // #UndoRedo# SvxUndoRedoControl::RegisterControl( SID_UNDO , pMod ); SvxUndoRedoControl::RegisterControl( SID_REDO , pMod ); diff --git a/sd/source/ui/sidebar/MasterPagesSelector.cxx b/sd/source/ui/sidebar/MasterPagesSelector.cxx index 3eb1e7498529..2f61b25a320a 100644 --- a/sd/source/ui/sidebar/MasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/MasterPagesSelector.cxx @@ -47,7 +47,6 @@ #include <svl/languageoptions.hxx> #include <sfx2/app.hxx> #include <sfx2/dispatch.hxx> -#include <sfx2/mnumgr.hxx> #include <svl/itemset.hxx> #include <svl/eitem.hxx> #include <svx/dlgutil.hxx> diff --git a/sfx2/AllLangResTarget_sfx2.mk b/sfx2/AllLangResTarget_sfx2.mk index 6513e1cbdc83..b8e5e41f4141 100644 --- a/sfx2/AllLangResTarget_sfx2.mk +++ b/sfx2/AllLangResTarget_sfx2.mk @@ -51,7 +51,6 @@ $(eval $(call gb_SrsTarget_add_files,sfx/res,\ sfx2/source/doc/doc.src \ sfx2/source/doc/doctempl.src \ sfx2/source/doc/templatelocnames.src \ - sfx2/source/menu/menu.src \ sfx2/source/sidebar/Sidebar.src \ sfx2/source/view/view.src \ )) diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index 0e4b51cef105..5ab2bb336903 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -237,10 +237,6 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/doc/templatedlg \ sfx2/source/explorer/nochaos \ sfx2/source/inet/inettbc \ - sfx2/source/menu/mnuitem \ - sfx2/source/menu/mnumgr \ - sfx2/source/menu/thessubmenu \ - sfx2/source/menu/virtmenu \ sfx2/source/notify/eventsupplier \ sfx2/source/notify/globalevents \ sfx2/source/notify/hintpost \ diff --git a/sfx2/inc/pch/precompiled_sfx.hxx b/sfx2/inc/pch/precompiled_sfx.hxx index 3b7cecc02542..9c39828923eb 100644 --- a/sfx2/inc/pch/precompiled_sfx.hxx +++ b/sfx2/inc/pch/precompiled_sfx.hxx @@ -468,8 +468,6 @@ #include <sfx2/linkmgr.hxx> #include <sfx2/lnkbase.hxx> #include <sfx2/minfitem.hxx> -#include <sfx2/mnuitem.hxx> -#include <sfx2/mnumgr.hxx> #include <sfx2/module.hxx> #include <sfx2/msg.hxx> #include <sfx2/msgpool.hxx> diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index a82ae7f62281..0db36091c525 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -81,7 +81,6 @@ #include "appdata.hxx" #include "openflag.hxx" #include "app.hrc" -#include "virtmenu.hxx" #include <sfx2/module.hxx> #include <sfx2/event.hxx> #include "imestatuswindow.hxx" @@ -94,10 +93,6 @@ #include <sfx2/dockwin.hxx> #include "shellimpl.hxx" -#ifdef DBG_UTIL -#include <sfx2/mnuitem.hxx> -#endif - #include <unotools/saveopt.hxx> #include <svtools/helpopt.hxx> #include <unotools/pathoptions.hxx> @@ -432,11 +427,6 @@ SfxStbCtrlFactArr_Impl& SfxApplication::GetStbCtrlFactories_Impl() const return *pAppData_Impl->pStbCtrlFac; } -SfxMenuCtrlFactArr_Impl& SfxApplication::GetMenuCtrlFactories_Impl() const -{ - return *pAppData_Impl->pMenuCtrlFac; -} - SfxViewFrameArr_Impl& SfxApplication::GetViewFrames_Impl() const { return *pAppData_Impl->pViewFrames; diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx index 77e6a9571aec..92a315b825a1 100644 --- a/sfx2/source/appl/appdata.cxx +++ b/sfx2/source/appl/appdata.cxx @@ -110,7 +110,6 @@ SfxAppData_Impl::SfxAppData_Impl( SfxApplication* ) , m_xImeStatusWindow(new sfx2::appl::ImeStatusWindow(comphelper::getProcessComponentContext())) , pTbxCtrlFac(nullptr) , pStbCtrlFac(nullptr) - , pMenuCtrlFac(nullptr) , pViewFrames(nullptr) , pViewShells(nullptr) , pObjShells(nullptr) diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx index 1434494c09dd..bd00ae5ee589 100644 --- a/sfx2/source/appl/appinit.cxx +++ b/sfx2/source/appl/appinit.cxx @@ -57,7 +57,6 @@ #include <sfx2/dispatch.hxx> #include <sfx2/docfac.hxx> #include <sfx2/evntconf.hxx> -#include <sfx2/mnumgr.hxx> #include <sfx2/msgpool.hxx> #include <sfx2/progress.hxx> #include <sfx2/sfxhelp.hxx> @@ -250,7 +249,6 @@ void SfxApplication::Initialize_Impl() pAppData_Impl->pSlotPool = new SfxSlotPool; pAppData_Impl->pTbxCtrlFac = new SfxTbxCtrlFactArr_Impl; pAppData_Impl->pStbCtrlFac = new SfxStbCtrlFactArr_Impl; - pAppData_Impl->pMenuCtrlFac = new SfxMenuCtrlFactArr_Impl; pAppData_Impl->pViewFrames = new SfxViewFrameArr_Impl; pAppData_Impl->pViewShells = new SfxViewShellArr_Impl; pAppData_Impl->pObjShells = new SfxObjectShellArr_Impl; diff --git a/sfx2/source/appl/appmain.cxx b/sfx2/source/appl/appmain.cxx index d70a95231d52..d1d132b9f6b9 100644 --- a/sfx2/source/appl/appmain.cxx +++ b/sfx2/source/appl/appmain.cxx @@ -37,7 +37,6 @@ #include <sfx2/fcontnr.hxx> #include <sfx2/viewsh.hxx> #include <sfx2/msgpool.hxx> -#include <sfx2/mnumgr.hxx> #include "app.hrc" #include <sfx2/docfile.hxx> #include "workwin.hxx" diff --git a/sfx2/source/appl/appmisc.cxx b/sfx2/source/appl/appmisc.cxx index 04ae901e740d..3721838847c1 100644 --- a/sfx2/source/appl/appmisc.cxx +++ b/sfx2/source/appl/appmisc.cxx @@ -55,7 +55,6 @@ #include "appdata.hxx" #include <sfx2/tbxctrl.hxx> #include <sfx2/stbitem.hxx> -#include <sfx2/mnuitem.hxx> #include <sfx2/docfac.hxx> #include <sfx2/docfile.hxx> #include <sfx2/docfilt.hxx> diff --git a/sfx2/source/appl/appquit.cxx b/sfx2/source/appl/appquit.cxx index a97ae379116e..209d1b089f89 100644 --- a/sfx2/source/appl/appquit.cxx +++ b/sfx2/source/appl/appquit.cxx @@ -40,7 +40,6 @@ #include "arrdecl.hxx" #include <sfx2/sfxresid.hxx> #include <sfx2/event.hxx> -#include <sfx2/mnumgr.hxx> #include <sfx2/templdlg.hxx> #include <sfx2/msgpool.hxx> #include <sfx2/docfile.hxx> @@ -117,7 +116,6 @@ void SfxApplication::Deinitialize() DELETEX(SfxTbxCtrlFactArr_Impl, pAppData_Impl->pTbxCtrlFac); DELETEX(SfxStbCtrlFactArr_Impl, pAppData_Impl->pStbCtrlFac); - DELETEX(SfxMenuCtrlFactArr_Impl, pAppData_Impl->pMenuCtrlFac); DELETEX(SfxViewFrameArr_Impl, pAppData_Impl->pViewFrames); DELETEX(SfxViewShellArr_Impl, pAppData_Impl->pViewShells); DELETEX(SfxObjectShellArr_Impl, pAppData_Impl->pObjShells); diff --git a/sfx2/source/appl/appreg.cxx b/sfx2/source/appl/appreg.cxx index 44e571f8b719..293b66c86e2d 100644 --- a/sfx2/source/appl/appreg.cxx +++ b/sfx2/source/appl/appreg.cxx @@ -37,7 +37,6 @@ #include <sfx2/objsh.hxx> #include <sfx2/viewsh.hxx> #include <sfx2/objface.hxx> -#include <sfx2/mnuitem.hxx> void SfxApplication::Registrations_Impl() @@ -109,28 +108,4 @@ void SfxApplication::RegisterStatusBarControl_Impl( SfxModule *pMod, const SfxSt pAppData_Impl->pStbCtrlFac->push_back( rFact ); } - -void SfxApplication::RegisterMenuControl_Impl( SfxModule *pMod, const SfxMenuCtrlFactory& rFact ) -{ - if ( pMod ) - { - pMod->RegisterMenuControl( rFact ); - return; - } - -#ifdef DBG_UTIL - for ( size_t n=0; n<pAppData_Impl->pMenuCtrlFac->size(); n++ ) - { - SfxMenuCtrlFactory *pF = &(*pAppData_Impl->pMenuCtrlFac)[n]; - if ( pF->nTypeId == rFact.nTypeId && - (pF->nSlotId == rFact.nSlotId || pF->nSlotId == 0) ) - { - SAL_INFO("sfx", "MenuController register is not clearly defined!"); - } - } -#endif - - pAppData_Impl->pMenuCtrlFac->push_back( rFact ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx index bf7df421db97..9bc8aaf9131e 100644 --- a/sfx2/source/appl/module.cxx +++ b/sfx2/source/appl/module.cxx @@ -26,12 +26,11 @@ #include <sfx2/msgpool.hxx> #include <sfx2/tbxctrl.hxx> #include <sfx2/stbitem.hxx> -#include <sfx2/mnuitem.hxx> #include <sfx2/childwin.hxx> -#include <sfx2/mnumgr.hxx> #include <sfx2/docfac.hxx> #include <sfx2/objface.hxx> #include <sfx2/viewfrm.hxx> +#include <sfx2/sfx.hrc> #include <sfx2/tabdlg.hxx> #include <svl/intitem.hxx> #include <tools/diagnose_ex.h> @@ -86,7 +85,6 @@ public: SfxSlotPool* pSlotPool; SfxTbxCtrlFactArr_Impl* pTbxCtrlFac; SfxStbCtrlFactArr_Impl* pStbCtrlFac; - SfxMenuCtrlFactArr_Impl* pMenuCtrlFac; SfxChildWinFactArr_Impl* pFactArr; ImageList* pImgListSmall; ImageList* pImgListBig; @@ -97,7 +95,7 @@ public: }; SfxModule_Impl::SfxModule_Impl() - : pSlotPool(nullptr), pTbxCtrlFac(nullptr), pStbCtrlFac(nullptr), pMenuCtrlFac(nullptr), pFactArr(nullptr), pImgListSmall(nullptr), pImgListBig(nullptr) + : pSlotPool(nullptr), pTbxCtrlFac(nullptr), pStbCtrlFac(nullptr), pFactArr(nullptr), pImgListSmall(nullptr), pImgListBig(nullptr) { } @@ -106,7 +104,6 @@ SfxModule_Impl::~SfxModule_Impl() delete pSlotPool; delete pTbxCtrlFac; delete pStbCtrlFac; - delete pMenuCtrlFac; delete pFactArr; delete pImgListSmall; delete pImgListBig; @@ -165,7 +162,6 @@ void SfxModule::Construct_Impl() pImpl->pTbxCtrlFac=nullptr; pImpl->pStbCtrlFac=nullptr; - pImpl->pMenuCtrlFac=nullptr; pImpl->pFactArr=nullptr; pImpl->pImgListSmall=nullptr; pImpl->pImgListBig=nullptr; @@ -270,27 +266,6 @@ void SfxModule::RegisterStatusBarControl( const SfxStbCtrlFactory& rFact ) } -void SfxModule::RegisterMenuControl( const SfxMenuCtrlFactory& rFact ) -{ - if (!pImpl->pMenuCtrlFac) - pImpl->pMenuCtrlFac = new SfxMenuCtrlFactArr_Impl; - -#ifdef DBG_UTIL - for ( size_t n=0; n<pImpl->pMenuCtrlFac->size(); n++ ) - { - SfxMenuCtrlFactory *pF = &(*pImpl->pMenuCtrlFac)[n]; - if ( pF->nTypeId == rFact.nTypeId && - (pF->nSlotId == rFact.nSlotId || pF->nSlotId == 0) ) - { - SAL_INFO("sfx.appl", "MenuController-Registering is not clearly defined!"); - } - } -#endif - - pImpl->pMenuCtrlFac->push_back( rFact ); -} - - SfxTbxCtrlFactArr_Impl* SfxModule::GetTbxCtrlFactories_Impl() const { return pImpl->pTbxCtrlFac; @@ -302,13 +277,6 @@ SfxStbCtrlFactArr_Impl* SfxModule::GetStbCtrlFactories_Impl() const return pImpl->pStbCtrlFac; } - -SfxMenuCtrlFactArr_Impl* SfxModule::GetMenuCtrlFactories_Impl() const -{ - return pImpl->pMenuCtrlFac; -} - - SfxChildWinFactArr_Impl* SfxModule::GetChildWinFactories_Impl() const { return pImpl->pFactArr; diff --git a/sfx2/source/control/ctrlfactoryimpl.cxx b/sfx2/source/control/ctrlfactoryimpl.cxx index 1df7301b495d..925ba7b75bb3 100644 --- a/sfx2/source/control/ctrlfactoryimpl.cxx +++ b/sfx2/source/control/ctrlfactoryimpl.cxx @@ -19,26 +19,6 @@ #include <ctrlfactoryimpl.hxx> -const SfxMenuCtrlFactory& SfxMenuCtrlFactArr_Impl::operator []( size_t i ) const -{ - return maData[i]; -} - -SfxMenuCtrlFactory& SfxMenuCtrlFactArr_Impl::operator []( size_t i ) -{ - return maData[i]; -} - -void SfxMenuCtrlFactArr_Impl::push_back( const SfxMenuCtrlFactory& p ) -{ - maData.push_back(p); -} - -size_t SfxMenuCtrlFactArr_Impl::size() const -{ - return maData.size(); -} - const SfxStbCtrlFactory& SfxStbCtrlFactArr_Impl::operator []( size_t i ) const { return maData[i]; diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index a4d73d5415d2..25ce3fe518c6 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -43,7 +43,6 @@ #include <sfx2/docfile.hxx> #include <sfx2/hintpost.hxx> #include <sfx2/ipclient.hxx> -#include <sfx2/mnumgr.hxx> #include <sfx2/module.hxx> #include <sfx2/msg.hxx> #include <sfx2/msgpool.hxx> @@ -1860,14 +1859,8 @@ void SfxDispatcher::ExecutePopup( vcl::Window *pWin, const Point *pPos ) for ( pSh = rDisp.GetShell(nShLevel); pSh; ++nShLevel, pSh = rDisp.GetShell(nShLevel) ) { - const ResId& rResId = pSh->GetInterface()->GetPopupMenuResId(); const OUString& rResName = pSh->GetInterface()->GetPopupMenuName(); - if ( rResId.GetId() ) - { - rDisp.ExecutePopup( rResId, pWin, pPos ); - return; - } - else if ( !rResName.isEmpty() ) + if ( !rResName.isEmpty() ) { rDisp.ExecutePopup( rResName, pWin, pPos ); return; @@ -1875,12 +1868,6 @@ void SfxDispatcher::ExecutePopup( vcl::Window *pWin, const Point *pPos ) } } -void SfxDispatcher::ExecutePopup( const ResId &rId, vcl::Window *pWin, const Point *pPos ) -{ - vcl::Window *pWindow = pWin ? pWin : xImp->pFrame->GetFrame().GetWorkWindow_Impl()->GetWindow(); - SfxPopupMenuManager::ExecutePopup( rId, GetFrame(), pPos ? *pPos : pWindow->GetPointerPosPixel(), pWindow ); -} - void SfxDispatcher::ExecutePopup( const OUString& rResName, vcl::Window *pWin, const Point* pPos ) { css::uno::Sequence< css::uno::Any > aArgs( 3 ); diff --git a/sfx2/source/control/objface.cxx b/sfx2/source/control/objface.cxx index ece51f4e1891..b180f4010009 100644 --- a/sfx2/source/control/objface.cxx +++ b/sfx2/source/control/objface.cxx @@ -77,14 +77,12 @@ struct SfxInterface_Impl { SfxObjectUIArr_Impl aObjectBars; // registered ObjectBars SfxObjectUIArr_Impl aChildWindows; // registered ChildWindows - OUString aPopupName; // registered xml-based PopupMenu - ResId aPopupRes; // registered PopupMenu + OUString aPopupName; // registered PopupMenu ResId aStatBarRes; // registered StatusBar SfxModule* pModule; bool bRegistered; SfxInterface_Impl() : - aPopupRes(nullptr, *SfxApplication::GetSfxResManager()), aStatBarRes(nullptr, *SfxApplication::GetSfxResManager()) , pModule(nullptr) , bRegistered(false) @@ -363,12 +361,6 @@ const SfxSlot* SfxInterface::GetRealSlot( sal_uInt16 nSlotId ) const return pSlot->pLinkedSlot; } -void SfxInterface::RegisterPopupMenu( const ResId& rResId ) -{ - - pImpData->aPopupRes = rResId; -} - void SfxInterface::RegisterPopupMenu( const OUString& rResourceName ) { pImpData->aPopupName = rResourceName; @@ -505,11 +497,6 @@ sal_uInt16 SfxInterface::GetChildWindowCount() const return pImpData->aChildWindows.size(); } -const ResId& SfxInterface::GetPopupMenuResId() const -{ - return pImpData->aPopupRes; -} - const OUString& SfxInterface::GetPopupMenuName() const { return pImpData->aPopupName; diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx index d009c0cc283f..5e80b2858f68 100644 --- a/sfx2/source/control/shell.cxx +++ b/sfx2/source/control/shell.cxx @@ -39,7 +39,6 @@ #include <sfx2/viewsh.hxx> #include "sfxtypes.hxx" #include <sfx2/request.hxx> -#include <sfx2/mnumgr.hxx> #include "statcach.hxx" #include <sfx2/msgpool.hxx> #include <sidebar/ContextChangeBroadcaster.hxx> diff --git a/sfx2/source/dialog/splitwin.cxx b/sfx2/source/dialog/splitwin.cxx index 701bc9ac3bd6..2184b06067cf 100644 --- a/sfx2/source/dialog/splitwin.cxx +++ b/sfx2/source/dialog/splitwin.cxx @@ -26,6 +26,7 @@ #include <vcl/wrkwin.hxx> #include <unotools/viewoptions.hxx> +#include <vcl/menu.hxx> #include <vcl/timer.hxx> #include "splitwin.hxx" @@ -34,8 +35,6 @@ #include <sfx2/app.hxx> #include "dialog.hrc" #include <sfx2/sfxresid.hxx> -#include <sfx2/mnumgr.hxx> -#include "virtmenu.hxx" #include <sfx2/msgpool.hxx> #include <sfx2/viewfrm.hxx> diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index f7cba15ac6be..e5a98ed994b9 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -40,7 +40,6 @@ #include "arrdecl.hxx" #include <sfx2/app.hxx> #include <sfx2/module.hxx> -#include <sfx2/mnumgr.hxx> #include <sfx2/sfxresid.hxx> #include <sfx2/sfxuno.hxx> #include "syspath.hxx" diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx index 46834b3fb057..696b13899341 100644 --- a/sfx2/source/inc/appdata.hxx +++ b/sfx2/source/inc/appdata.hxx @@ -111,7 +111,6 @@ public: SfxTbxCtrlFactArr_Impl* pTbxCtrlFac; SfxStbCtrlFactArr_Impl* pStbCtrlFac; - SfxMenuCtrlFactArr_Impl* pMenuCtrlFac; SfxViewFrameArr_Impl* pViewFrames; SfxViewShellArr_Impl* pViewShells; SfxObjectShellArr_Impl* pObjShells; diff --git a/sfx2/source/inc/ctrlfactoryimpl.hxx b/sfx2/source/inc/ctrlfactoryimpl.hxx index 38a25d8fa099..7b91aed7aba3 100644 --- a/sfx2/source/inc/ctrlfactoryimpl.hxx +++ b/sfx2/source/inc/ctrlfactoryimpl.hxx @@ -20,26 +20,11 @@ #ifndef INCLUDED_SFX2_CTRLFACTORYIMPL_HXX #define INCLUDED_SFX2_CTRLFACTORYIMPL_HXX -#include <sfx2/mnuitem.hxx> #include <sfx2/stbitem.hxx> #include <sfx2/tbxctrl.hxx> #include <vector> -class SfxMenuCtrlFactArr_Impl -{ - typedef std::vector<SfxMenuCtrlFactory> DataType; - DataType maData; - -public: - const SfxMenuCtrlFactory& operator []( size_t i ) const; - SfxMenuCtrlFactory& operator []( size_t i ); - - void push_back( const SfxMenuCtrlFactory& ); - - size_t size() const; -}; - class SfxStbCtrlFactArr_Impl { typedef std::vector<SfxStbCtrlFactory> DataType; diff --git a/sfx2/source/inc/virtmenu.hxx b/sfx2/source/inc/virtmenu.hxx deleted file mode 100644 index 2009db827d65..000000000000 --- a/sfx2/source/inc/virtmenu.hxx +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_SOURCE_INC_VIRTMENU_HXX -#define INCLUDED_SFX2_SOURCE_INC_VIRTMENU_HXX - -#include <vector> -#include <memory> - -#include <sfx2/mnuitem.hxx> - -class SfxBindings; -class SfxMenuImageControl_Impl; - -typedef std::vector<std::unique_ptr<SfxMenuControl> > SfxMenuCtrlArr_Impl; - -class SAL_DLLPUBLIC_EXPORT SfxVirtualMenu -{ -friend class SfxMenuControl; - -private: - Menu* pSVMenu; - SfxVirtualMenu* pParent; - SfxMenuCtrlArr_Impl* pAppCtrl; - SfxMenuControl* pItems; - SfxMenuImageControl_Impl* pImageControl; - SfxBindings* pBindings; - ResMgr* pResMgr; - PopupMenu* pWindowMenu; - PopupMenu* pPickMenu; - PopupMenu* pAddonsMenu; - sal_uInt16 nVisibleItems; - sal_uInt16 nId; - sal_uInt16 nCount; - sal_uInt16 nLocks; - bool bResCtor : 1; // SV Menu created from resource - bool bOLE : 1; // InPlaceMenu - bool bHelpInitialized : 1; - bool bIsActive : 1; - bool bControllersUnBound : 1; - bool bIsAddonPopupMenu : 1; - -private: - void Construct_Impl(); - bool Bind_Impl( Menu *pMenu ); - inline SfxMenuCtrlArr_Impl& GetAppCtrl_Impl() - { - return pAppCtrl? *pAppCtrl: *(pAppCtrl = new SfxMenuCtrlArr_Impl) ; - } - void UnbindControllers(); - void BindControllers(); - -protected: - SfxVirtualMenu( sal_uInt16 nOwnId, SfxVirtualMenu* pParent, Menu& rMenu, bool bWithHelp, - SfxBindings &rBind, bool bOLEServer=false, bool bRes=false, bool bIsAddonMenu=false ); - - void CreateFromSVMenu(); - DECL_STATIC_LINK_TYPED( SfxVirtualMenu, Highlight, Menu *, bool ); - DECL_LINK_TYPED( Activate, Menu *, bool ); - DECL_LINK_TYPED( Deactivate, Menu *, bool ); - DECL_LINK_TYPED( SettingsChanged, LinkParamNone*, void ); - - // Used for runtime popup menus - void UpdateImages( Menu* pMenu ); - void RemoveMenuImages( Menu* pMenu ); - void InsertAddOnsMenuItem( Menu* pMenu ); - -public: - ~SfxVirtualMenu(); - SfxVirtualMenu( Menu *pStarViewMenu, bool bWithHelp, - SfxBindings &rBind, bool bOLEServer=false, bool bRes=false, bool bIsAddonMenu=false ); - void CheckItem( sal_uInt16 nItemId, bool bCheck ); - void EnableItem( sal_uInt16 nItemId, bool bEnable ); - void SetItemText( sal_uInt16 nItemId, const OUString& rText ); - - Menu* GetSVMenu() const { return pSVMenu;} - - void SetPopupMenu( sal_uInt16 nId, PopupMenu *pMenu ); - void InitPopup(sal_uInt16 nPos, bool bOLE = true); - void InitializeHelp(); - - DECL_LINK_TYPED( Select, Menu*, bool ); -}; - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/menu/menu.hrc b/sfx2/source/menu/menu.hrc deleted file mode 100644 index 872ef32752a0..000000000000 --- a/sfx2/source/menu/menu.hrc +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef _MNUCFG_HRC -#define _MNUCFG_HRC - -#include <sfx2/sfx.hrc> - -#define STR_MENU_CFGITEM RID_SFX_MENU_START+1 -#define STR_MENU_ADDONS RID_SFX_MENU_START+2 -#define STR_MENU_ADDONHELP RID_SFX_MENU_START+3 - -#define STR_MENU_SYNONYMS (RID_SFX_MENU_START+11) -#define STR_MENU_NO_SYNONYM_FOUND (RID_SFX_MENU_START+12) -#define STR_MENU_THESAURUS (RID_SFX_MENU_START+13) - -#define MN_CLIPBOARDFUNCS RID_SFX_MENU_START+1 -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/menu/menu.src b/sfx2/source/menu/menu.src deleted file mode 100644 index 890a91519159..000000000000 --- a/sfx2/source/menu/menu.src +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "menu.hrc" -#include <sfx2/sfxcommands.h> - -String STR_MENU_CFGITEM -{ - Text [ en-US ] = "Configuration Menu" ; -}; - -String STR_MENU_ADDONS -{ - Text [ en-US ] = "~Add-Ons" ; -}; - -Menu MN_CLIPBOARDFUNCS -{ - ItemList = - { - MenuItem - { - Identifier = SID_CUT ; - HelpID = CMD_SID_CUT ; - Text [ en-US ] = "Cu~t" ; - }; - MenuItem - { - Identifier = SID_COPY ; - HelpID = CMD_SID_COPY ; - Text [ en-US ] = "~Copy" ; - }; - MenuItem - { - Identifier = SID_PASTE ; - HelpID = CMD_SID_PASTE ; - Text [ en-US ] = "~Paste" ; - }; - }; -}; - -String SID_WIN_FULLSCREEN -{ - Text [ en-US ] = "Leave Full-Screen Mode"; -}; - -String STR_MENU_ADDONHELP -{ - Text [ en-US ] = "Add-~On Help" ; -}; - -String STR_MENU_SYNONYMS -{ - Text [ en-US ] = "Synonyms" ; -}; - -String STR_MENU_NO_SYNONYM_FOUND -{ - Text [ en-US ] = "(none)" ; -}; - -String STR_MENU_THESAURUS -{ - Text [ en-US ] = "~Thesaurus..." ; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/menu/mnuitem.cxx b/sfx2/source/menu/mnuitem.cxx deleted file mode 100644 index 8d62caf6e66b..000000000000 --- a/sfx2/source/menu/mnuitem.cxx +++ /dev/null @@ -1,309 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#ifdef SOLARIS -#include <ctime> -#endif - -#include <string> -#include <com/sun/star/uno/Reference.h> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/frame/Desktop.hpp> -#include <com/sun/star/frame/XDispatch.hpp> -#include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/util/URL.hpp> -#include <com/sun/star/util/URLTransformer.hpp> -#include <com/sun/star/util/XURLTransformer.hpp> -#include <comphelper/processfactory.hxx> -#include <tools/urlobj.hxx> -#include <svl/eitem.hxx> -#include <svl/stritem.hxx> -#include <svtools/imagemgr.hxx> -#include <svtools/menuoptions.hxx> -#include <framework/menuconfiguration.hxx> - -#include <sfx2/app.hxx> -#include <sfx2/sfx.hrc> -#include <sfx2/msgpool.hxx> -#include <sfx2/msg.hxx> -#include <sfx2/bindings.hxx> -#include <sfx2/dispatch.hxx> -#include "sfxtypes.hxx" -#include "virtmenu.hxx" -#include <ctrlfactoryimpl.hxx> -#include <sfx2/mnuitem.hxx> -#include <sfx2/tbxctrl.hxx> -#include <sfx2/module.hxx> -#include <sfx2/unoctitm.hxx> -#include <sfx2/viewfrm.hxx> -#include <sfx2/imgmgr.hxx> -#include <sfx2/imagemgr.hxx> -#include <sfx2/sfxresid.hxx> -#include "../doc/doc.hrc" -#include <vcl/settings.hxx> - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::frame; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::util; - - -// binds the instance to the specified id and assignes the title - -void SfxMenuControl::Bind( - SfxVirtualMenu* pOwn, - sal_uInt16 nSlotId, - const OUString& rTitle, - SfxBindings &rBindings ) -{ - aTitle = rTitle; - pOwnMenu = pOwn; - pSubMenu = nullptr; - if ( pOwn ) - SfxControllerItem::Bind(nSlotId, &rBindings); - else - SetId( nSlotId ); - -#ifdef DBG_UTIL - CheckConfigure_Impl(SfxSlotMode::MENUCONFIG); -#endif -} - - -// binds the item to the specified menu and assignes the title - -void SfxMenuControl::Bind( - SfxVirtualMenu* pOwn, - sal_uInt16 nSlotId, - SfxVirtualMenu& rMenu, - const OUString& rTitle, - SfxBindings &rBindings ) -{ - SetId( nSlotId ); - SetBindings(rBindings); - pOwnMenu = pOwn; - pSubMenu = &rMenu; - aTitle = rTitle; -} - - -// Constructor for explicit registration - -SfxMenuControl::SfxMenuControl( bool bShowStrings ) -: pOwnMenu(nullptr), - pSubMenu(nullptr), - b_ShowStrings(bShowStrings) -{ -} - - -// Constructor for array -SfxMenuControl::SfxMenuControl(): - pOwnMenu(nullptr), - pSubMenu(nullptr), - b_ShowStrings(false) -{ -} - - -SfxMenuControl::SfxMenuControl(sal_uInt16 nSlotId, SfxBindings& rBindings): - SfxControllerItem(nSlotId, rBindings), - pOwnMenu(nullptr), - pSubMenu(nullptr), - b_ShowStrings(false) -{ - // This constructor should make it possible already during the design - // to fall back to the bindings, but can as always be bound later. - // The usefulness of this is for example if a StatusForwarder should - // be created in the constructor of a derived class. - UnBind(); -} - - -SfxMenuControl::~SfxMenuControl() -{ - delete pSubMenu; -} - - -// changes the state in the virtual menu - -void SfxMenuControl::StateChanged -( - sal_uInt16 nSID, - SfxItemState eState, - const SfxPoolItem* pState -) -{ - (void)nSID; - DBG_ASSERT( nSID == GetId(), "strange SID" ); - DBG_ASSERT( pOwnMenu != nullptr, "setting state to dangling SfxMenuControl" ); - - bool bIsObjMenu = - GetId() >= SID_OBJECTMENU0 && GetId() < SID_OBJECTMENU_LAST; - - // Fix inclusion of enabled/disabled-Flag - -#ifdef UNIX - if (nSID == SID_PASTE) - pOwnMenu->EnableItem( GetId(), true ); - else -#endif - pOwnMenu->EnableItem( GetId(), bIsObjMenu - ? nullptr != pOwnMenu->GetSVMenu()->GetPopupMenu( GetId() ) - : eState != SfxItemState::DISABLED ); - - if ( eState != SfxItemState::DEFAULT ) - { - // check only for non-Object Menus - if ( !bIsObjMenu ) - pOwnMenu->CheckItem( GetId(), false ); - - if ( pOwnMenu->GetSVMenu()->GetItemText( GetId() ) != GetTitle() ) - { - SAL_INFO("sfx", "Title of menu item changed - please check if this needs correction!"); - } - return; - } - - bool bCheck = false; - if ( dynamic_cast< const SfxBoolItem *>( pState ) != nullptr ) - { - // BoolItem for check - DBG_ASSERT( GetId() < SID_OBJECTMENU0 || GetId() > SID_OBJECTMENU_LAST, - "SfxBoolItem not allowed for SID_OBJECTMENUx" ); - bCheck = static_cast<const SfxBoolItem*>(pState)->GetValue(); - Menu* pMenu = pOwnMenu->GetSVMenu(); - pMenu->SetItemBits( GetId() , pMenu->GetItemBits( GetId() ) | MenuItemBits::CHECKABLE); - } - else if ( dynamic_cast< const SfxEnumItemInterface *>( pState ) != nullptr && - static_cast<const SfxEnumItemInterface *>(pState)->HasBoolValue() ) - { - // Treat EnumItem as Bool - DBG_ASSERT( GetId() < SID_OBJECTMENU0 || GetId() > SID_OBJECTMENU_LAST, - "SfxEnumItem not allowed for SID_OBJECTMENUx" ); - bCheck = static_cast<const SfxEnumItemInterface *>(pState)->GetBoolValue(); - Menu* pMenu = pOwnMenu->GetSVMenu(); - pMenu->SetItemBits( GetId() , pMenu->GetItemBits( GetId() ) | MenuItemBits::CHECKABLE); - } - else if ( ( b_ShowStrings || bIsObjMenu ) && dynamic_cast< const SfxStringItem *>( pState ) != nullptr ) - { - // Get MenuText from SfxStringItem - OUString aStr( static_cast<const SfxStringItem*>(pState)->GetValue() ); - if ( aStr.startsWith("($1)") ) - { - OUString aEntry(SfxResId(STR_UPDATEDOC).toString()); - aEntry += " "; - aEntry += aStr.copy(4); - aStr = aEntry; - } - else if ( aStr.startsWith("($2)") ) - { - OUString aEntry(SfxResId(STR_CLOSEDOC_ANDRETURN).toString()); - aEntry += aStr.copy(4); - aStr = aEntry; - } - - pOwnMenu->SetItemText( GetId(), aStr ); - } - - pOwnMenu->CheckItem( GetId(), bCheck ); -} - - -SfxMenuControl* SfxMenuControl::CreateImpl( sal_uInt16 /*nId*/, Menu& /*rMenu*/, SfxBindings& /*rBindings*/ ) -{ - return new SfxMenuControl( true ); -} - -void SfxMenuControl::RegisterControl( sal_uInt16 nSlotId, SfxModule *pMod ) -{ - RegisterMenuControl( pMod, SfxMenuCtrlFactory( - SfxMenuControl::CreateImpl, typeid(SfxStringItem), nSlotId ) ); -} - - -void SfxMenuControl::RegisterMenuControl(SfxModule* pMod, const SfxMenuCtrlFactory& rFact) -{ - SfxGetpApp()->RegisterMenuControl_Impl( pMod, rFact ); -} - -SfxMenuControl* SfxMenuControl::CreateControl( sal_uInt16 nId, Menu &rMenu, SfxBindings &rBindings ) -{ - const std::type_info* aSlotType = SFX_SLOTPOOL().GetSlotType(nId); - if ( aSlotType ) - { - SfxApplication *pApp = SfxGetpApp(); - SfxDispatcher *pDisp = rBindings.GetDispatcher_Impl(); - SfxModule *pMod = pDisp ? SfxModule::GetActiveModule( pDisp->GetFrame() ) :nullptr; - if ( pMod ) - { - SfxMenuCtrlFactArr_Impl *pFactories = pMod->GetMenuCtrlFactories_Impl(); - if ( pFactories ) - { - SfxMenuCtrlFactArr_Impl &rFactories = *pFactories; - for ( size_t nFactory = 0; nFactory < rFactories.size(); ++nFactory ) - if ( rFactories[nFactory].nTypeId == *aSlotType && - ( ( rFactories[nFactory].nSlotId == 0 ) || - ( rFactories[nFactory].nSlotId == nId) ) ) - return rFactories[nFactory].pCtor( nId, rMenu, rBindings ); - } - } - - SfxMenuCtrlFactArr_Impl &rFactories = pApp->GetMenuCtrlFactories_Impl(); - - for ( size_t nFactory = 0; nFactory < rFactories.size(); ++nFactory ) - if ( rFactories[nFactory].nTypeId == *aSlotType && - ( ( rFactories[nFactory].nSlotId == 0 ) || - ( rFactories[nFactory].nSlotId == nId) ) ) - return rFactories[nFactory].pCtor( nId, rMenu, rBindings ); - } - return nullptr; -} - - -SfxUnoMenuControl* SfxMenuControl::CreateControl( const OUString& rCmd, - sal_uInt16 nId, Menu& rMenu, const OUString& sItemText, - SfxBindings& rBindings, SfxVirtualMenu* pVirt) -{ - return new SfxUnoMenuControl( rCmd, nId, rMenu, sItemText, rBindings, pVirt); -} - -SfxUnoMenuControl::SfxUnoMenuControl( - const OUString& rCmd, sal_uInt16 nSlotId, Menu& /*rMenu*/, - const OUString& rItemText, - SfxBindings& rBindings, SfxVirtualMenu* pVirt) - : SfxMenuControl( nSlotId, rBindings ) -{ - Bind( pVirt, nSlotId, rItemText, rBindings); - UnBind(); - pUnoCtrl = new SfxUnoControllerItem( this, rBindings, rCmd ); - pUnoCtrl->acquire(); - pUnoCtrl->GetNewDispatch(); -} - -SfxUnoMenuControl::~SfxUnoMenuControl() -{ - pUnoCtrl->UnBind(); - pUnoCtrl->release(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/menu/mnumgr.cxx b/sfx2/source/menu/mnumgr.cxx deleted file mode 100644 index aca28a807867..000000000000 --- a/sfx2/source/menu/mnumgr.cxx +++ /dev/null @@ -1,322 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <com/sun/star/embed/VerbDescriptor.hpp> -#include <com/sun/star/embed/VerbAttributes.hpp> -#include <com/sun/star/container/XNamed.hpp> - -#ifdef SOLARIS -#include <ctime> -#endif - -#include <string> -#include <cstdarg> - -#include <vcl/pointr.hxx> - -#include <unotools/streamwrap.hxx> -#include <sfx2/objsh.hxx> -#include <framework/menuconfiguration.hxx> -#include <framework/addonmenu.hxx> -#include <comphelper/processfactory.hxx> -#include <unotools/ucbstreamhelper.hxx> -#include <unotools/lingucfg.hxx> -#include <unotools/pathoptions.hxx> -#include <svl/stritem.hxx> -#include <toolkit/helper/vclunohelper.hxx> -#include <osl/file.hxx> -#include <vcl/graph.hxx> -#include <vcl/graphicfilter.hxx> -#include <svl/lngmisc.hxx> - -#include <sfx2/mnumgr.hxx> - -#include <svtools/menuoptions.hxx> - -#include "virtmenu.hxx" -#include <sfx2/msg.hxx> -#include <sfx2/dispatch.hxx> -#include <sfx2/app.hxx> -#include "sfxtypes.hxx" -#include <sfx2/bindings.hxx> -#include <sfx2/sfxresid.hxx> -#include <sfx2/msgpool.hxx> -#include <sfx2/sfx.hrc> -#include "menu.hrc" -#include <sfx2/viewfrm.hxx> -#include <sfx2/viewsh.hxx> -#include <sfx2/objface.hxx> -#include "thessubmenu.hxx" - -using namespace com::sun::star; - -void TryToHideDisabledEntries_Impl( Menu* pMenu ) -{ - DBG_ASSERT( pMenu, "invalid menu" ); - if( ! SvtMenuOptions().IsEntryHidingEnabled() ) - { - pMenu->SetMenuFlags( pMenu->GetMenuFlags() | MenuFlags::HideDisabledEntries ); - } -} - - -SfxMenuManager::~SfxMenuManager() -{ - pBindings->ENTERREGISTRATIONS(); - delete pMenu; - pBindings->LEAVEREGISTRATIONS(); -} - - -void SfxMenuManager::Construct( SfxVirtualMenu& rMenu ) -{ - pMenu = &rMenu; - - // set the handlers - Menu *pSvMenu = pMenu->GetSVMenu(); - pSvMenu->SetSelectHdl( LINK(this, SfxMenuManager, Select) ); - TryToHideDisabledEntries_Impl( pSvMenu ); -} - - -void InsertVerbs_Impl( SfxBindings* pBindings, const css::uno::Sequence < css::embed::VerbDescriptor >& aVerbs, Menu* pMenu ) -{ - SfxViewShell *pView = pBindings->GetDispatcher()->GetFrame()->GetViewShell(); - if ( pView && aVerbs.getLength() ) - { - SfxObjectShell* pDoc = pView->GetObjectShell(); - pMenu->InsertSeparator(); - sal_uInt16 nr=0; - for ( sal_Int32 n = 0; n < aVerbs.getLength(); ++n ) - { - // check for ReadOnly verbs - if ( pDoc->IsReadOnly() && !(aVerbs[n].VerbAttributes & embed::VerbAttributes::MS_VERBATTR_NEVERDIRTIES) ) - continue; - - // check for verbs that shouldn't appear in the menu - if ( !(aVerbs[n].VerbAttributes & embed::VerbAttributes::MS_VERBATTR_ONCONTAINERMENU) ) - continue; - - sal_uInt16 nId = SID_VERB_START + nr++; - DBG_ASSERT(nId <= SID_VERB_END, "Too many verbs!"); - if ( nId > SID_VERB_END ) - break; - - pMenu->InsertItem( nId, aVerbs[n].VerbName ); - } - } -} - -PopupMenu* InsertThesaurusSubmenu_Impl( SfxBindings* pBindings, Menu* pSVMenu ) -{ - - // build thesaurus sub menu if look-up string is available - - PopupMenu* pThesSubMenu = nullptr; - std::unique_ptr<SfxPoolItem> pItem; - pBindings->QueryState( SID_THES, pItem ); - OUString aThesLookUpStr; - SfxStringItem *pStrItem = dynamic_cast< SfxStringItem * >(pItem.get()); - sal_Int32 nDelimPos = -1; - if (pStrItem) - { - aThesLookUpStr = pStrItem->GetValue(); - nDelimPos = aThesLookUpStr.lastIndexOf( '#' ); - } - if ( !aThesLookUpStr.isEmpty() && nDelimPos != -1 ) - { - // get synonym list for sub menu - std::vector< OUString > aSynonyms; - SfxThesSubMenuHelper aHelper; - OUString aText( SfxThesSubMenuHelper::GetText( aThesLookUpStr, nDelimPos ) ); - lang::Locale aLocale; - SfxThesSubMenuHelper::GetLocale( aLocale, aThesLookUpStr, nDelimPos ); - const bool bHasMoreSynonyms = aHelper.GetMeanings( aSynonyms, aText, aLocale, 7 /*max number of synonyms to retrieve*/ ); - (void) bHasMoreSynonyms; - - pThesSubMenu = new PopupMenu; - pThesSubMenu->SetMenuFlags(MenuFlags::NoAutoMnemonics); - const size_t nNumSynonyms = aSynonyms.size(); - if (nNumSynonyms > 0) - { - SvtLinguConfig aCfg; - - Image aImage; - OUString sThesImplName( aHelper.GetThesImplName( aLocale ) ); - OUString aSynonymsImageUrl( aCfg.GetSynonymsContextImage( sThesImplName ) ); - if (!sThesImplName.isEmpty() && !aSynonymsImageUrl.isEmpty()) - aImage = Image( aSynonymsImageUrl ); - - for (size_t i = 0; i < nNumSynonyms; ++i) - { - //! item ids should start with values > 0, since 0 has special meaning - const sal_uInt16 nId = i + 1; - - OUString aItemText( linguistic::GetThesaurusReplaceText( aSynonyms[i] ) ); - pThesSubMenu->InsertItem( nId, aItemText ); - OUString aCmd(".uno:ThesaurusFromContext?WordReplace:string=" ); - aCmd += aItemText; - pThesSubMenu->SetItemCommand( nId, aCmd ); - - if (!aSynonymsImageUrl.isEmpty()) - pThesSubMenu->SetItemImage( nId, aImage ); - } - } - else // nNumSynonyms == 0 - { - const OUString aItemText( SfxResId(STR_MENU_NO_SYNONYM_FOUND).toString() ); - pThesSubMenu->InsertItem( 1, aItemText, MenuItemBits::NOSELECT ); - } - pThesSubMenu->InsertSeparator(); - const OUString sThesaurus( SfxResId(STR_MENU_THESAURUS).toString() ); - pThesSubMenu->InsertItem( 100, sThesaurus ); - pThesSubMenu->SetItemCommand( 100, ".uno:ThesaurusDialog" ); - - pSVMenu->InsertSeparator(); - const OUString sSynonyms( SfxResId(STR_MENU_SYNONYMS).toString() ); - pSVMenu->InsertItem( SID_THES, sSynonyms ); - pSVMenu->SetPopupMenu( SID_THES, pThesSubMenu ); - } - - return pThesSubMenu; -} - - -// executes the function for the selected item -IMPL_LINK_TYPED( SfxMenuManager, Select, Menu *, pSelMenu, bool ) -{ - sal_uInt16 nId = (sal_uInt16) pSelMenu->GetCurItemId(); - OUString aCommand = pSelMenu->GetItemCommand( nId ); - if ( aCommand.isEmpty() && pBindings ) - { - const SfxSlot* pSlot = SfxSlotPool::GetSlotPool( pBindings->GetDispatcher()->GetFrame() ).GetSlot( nId ); - if ( pSlot && pSlot->pUnoName ) - { - aCommand = ".uno:" + OUString::createFromAscii( pSlot->GetUnoName() ); - } - } - - if (!aCommand.isEmpty() && pBindings) - { - pBindings->ExecuteCommand_Impl( aCommand ); - return true; - } - - if (!pBindings) - return true; - - if ( pBindings->IsBound(nId) ) - // normal function - pBindings->Execute( nId ); - else - // special menu function - pBindings->GetDispatcher_Impl()->Execute( nId ); - - return true; -} - -SfxPopupMenuManager::~SfxPopupMenuManager() -{ -} - - -void SfxPopupMenuManager::RemoveDisabledEntries() -{ - if ( pSVMenu ) - TryToHideDisabledEntries_Impl( pSVMenu ); -} - - -void SfxPopupMenuManager::Execute( const Point& rPos, vcl::Window* pWindow ) -{ - static_cast<PopupMenu*>( GetMenu()->GetSVMenu() )->Execute( pWindow, rPos ); -} - - -SfxMenuManager::SfxMenuManager( Menu* pMenuArg, SfxBindings &rBindings ) -: pMenu(nullptr), - pBindings(&rBindings) -{ - bAddClipboardFuncs = false; - SfxVirtualMenu* pVMenu = new SfxVirtualMenu( pMenuArg, false, rBindings, true, true ); - Construct(*pVMenu); -} - -SfxPopupMenuManager::SfxPopupMenuManager( PopupMenu* pMenuArg, SfxBindings& rBindings ) - : SfxMenuManager( pMenuArg, rBindings ) - , pSVMenu( pMenuArg ) -{ -} - -void SfxPopupMenuManager::ExecutePopup( const ResId& rResId, SfxViewFrame* pFrame, const Point& rPoint, vcl::Window* pWindow ) -{ - PopupMenu *pSVMenu = new PopupMenu( rResId ); - sal_uInt16 n, nCount = pSVMenu->GetItemCount(); - for ( n=0; n<nCount; n++ ) - { - sal_uInt16 nId = pSVMenu->GetItemId( n ); - if ( nId == SID_COPY || nId == SID_CUT || nId == SID_PASTE ) - break; - } - - PopupMenu* pThesSubMenu = InsertThesaurusSubmenu_Impl( &pFrame->GetBindings(), pSVMenu ); - - if ( n == nCount ) - { - PopupMenu aPop( SfxResId( MN_CLIPBOARDFUNCS ) ); - nCount = aPop.GetItemCount(); - for ( n=0; n<nCount; n++ ) - { - sal_uInt16 nId = aPop.GetItemId( n ); - pSVMenu->InsertItem( nId, aPop.GetItemText( nId ), aPop.GetItemBits( nId ), OString(), n ); - pSVMenu->SetHelpId( nId, aPop.GetHelpId( nId )); - } - pSVMenu->InsertSeparator( OString(), n ); - } - - InsertVerbs_Impl( &pFrame->GetBindings(), pFrame->GetViewShell()->GetVerbs(), pSVMenu ); - Menu* pMenu = nullptr; - css::ui::ContextMenuExecuteEvent aEvent; - aEvent.SourceWindow = VCLUnoHelper::GetInterface( pWindow ); - aEvent.ExecutePosition.X = rPoint.X(); - aEvent.ExecutePosition.Y = rPoint.Y(); - OUString sDummyMenuName; - if ( pFrame->GetViewShell()->TryContextMenuInterception( *pSVMenu, sDummyMenuName, pMenu, aEvent ) ) - { - if ( pMenu ) - { - delete pSVMenu; - pSVMenu = static_cast<PopupMenu*>( pMenu ); - } - - SfxPopupMenuManager aPop( pSVMenu, pFrame->GetBindings() ); - aPop.RemoveDisabledEntries(); - aPop.Execute( rPoint, pWindow ); - - // #i112646 avoid crash when context menu is closed. - // the (manually inserted) sub-menu needs to be destroyed before - // aPop gets destroyed. - delete pThesSubMenu; - pThesSubMenu = nullptr; - } - - delete pThesSubMenu; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/menu/thessubmenu.cxx b/sfx2/source/menu/thessubmenu.cxx deleted file mode 100644 index 93ee0b665bee..000000000000 --- a/sfx2/source/menu/thessubmenu.cxx +++ /dev/null @@ -1,139 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/linguistic2/XThesaurus.hpp> -#include <com/sun/star/linguistic2/XMeaning.hpp> -#include <com/sun/star/linguistic2/LinguServiceManager.hpp> - -#include <comphelper/processfactory.hxx> -#include <svl/stritem.hxx> -#include <tools/debug.hxx> -#include <vcl/graph.hxx> -#include <vcl/graphicfilter.hxx> - - -#include <vector> - -#include <sfx2/bindings.hxx> -#include <sfx2/dispatch.hxx> -#include <sfx2/viewsh.hxx> -#include "thessubmenu.hxx" - -using namespace ::com::sun::star; - -OUString SfxThesSubMenuHelper::GetText( - const OUString &rLookUpString, - sal_Int32 nDelimPos ) -{ - return rLookUpString.copy( 0, nDelimPos ); -} - - -void SfxThesSubMenuHelper::GetLocale( - lang::Locale /*out */ &rLocale, - const OUString &rLookUpString, - sal_Int32 nDelimPos ) -{ - OUString aIsoLang( rLookUpString.copy( nDelimPos + 1) ); - rLocale = LanguageTag::convertToLocale( aIsoLang); -} - - -SfxThesSubMenuHelper::SfxThesSubMenuHelper(): - m_xLngMgr( - linguistic2::LinguServiceManager::create( - comphelper::getProcessComponentContext())), - m_xThesarus(m_xLngMgr->getThesaurus()) -{ -} - - -SfxThesSubMenuHelper::~SfxThesSubMenuHelper() -{ -} - - -bool SfxThesSubMenuHelper::IsSupportedLocale( const lang::Locale & rLocale ) const -{ - return m_xThesarus.is() && m_xThesarus->hasLocale( rLocale ); -} - - -bool SfxThesSubMenuHelper::GetMeanings( - std::vector< OUString > & rSynonyms, - const OUString & rWord, - const lang::Locale & rLocale, - sal_Int16 nMaxSynonms ) -{ - bool bHasMoreSynonyms = false; - rSynonyms.clear(); - if (IsSupportedLocale( rLocale ) && !rWord.isEmpty() && nMaxSynonms > 0) - { - try - { - // get all meannings - const uno::Sequence< uno::Reference< linguistic2::XMeaning > > aMeaningSeq( - m_xThesarus->queryMeanings( rWord, rLocale, uno::Sequence< beans::PropertyValue >() )); - const uno::Reference< linguistic2::XMeaning > *pxMeaning = aMeaningSeq.getConstArray(); - const sal_Int32 nMeanings = aMeaningSeq.getLength(); - - // iterate over all meanings until nMaxSynonms are found or all meanings are processed - sal_Int32 nCount = 0; - sal_Int32 i = 0; - for ( ; i < nMeanings && nCount < nMaxSynonms; ++i) - { - const uno::Sequence< OUString > aSynonymSeq( pxMeaning[i]->querySynonyms() ); - const OUString *pSynonyms = aSynonymSeq.getConstArray(); - const sal_Int32 nSynonyms = aSynonymSeq.getLength(); - sal_Int32 k = 0; - for ( ; k < nSynonyms && nCount < nMaxSynonms; ++k) - { - rSynonyms.push_back( pSynonyms[k] ); - ++nCount; - } - bHasMoreSynonyms = k < nSynonyms; // any synonym from this meaning skipped? - } - - bHasMoreSynonyms |= i < nMeanings; // any meaning skipped? - } - catch (const uno::Exception &) - { - DBG_ASSERT( false, "failed to get synonyms" ); - } - } - return bHasMoreSynonyms; -} - - -OUString SfxThesSubMenuHelper::GetThesImplName( const lang::Locale &rLocale ) const -{ - OUString aRes; - uno::Sequence< OUString > aServiceNames = m_xLngMgr->getConfiguredServices( - "com.sun.star.linguistic2.Thesaurus", rLocale ); - // there should be at most one thesaurus configured for each language - DBG_ASSERT( aServiceNames.getLength() <= 1, "more than one thesaurus found. Should not be possible" ); - if (aServiceNames.getLength() == 1) - aRes = aServiceNames[0]; - return aRes; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/menu/thessubmenu.hxx b/sfx2/source/menu/thessubmenu.hxx deleted file mode 100644 index 145ed4f449fa..000000000000 --- a/sfx2/source/menu/thessubmenu.hxx +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#ifndef INCLUDED_SFX2_SOURCE_MENU_THESSUBMENU_HXX -#define INCLUDED_SFX2_SOURCE_MENU_THESSUBMENU_HXX - -#include <com/sun/star/linguistic2/XThesaurus.hpp> -#include <com/sun/star/linguistic2/XLinguServiceManager2.hpp> - -#include <vcl/menu.hxx> -#include <sfx2/mnuitem.hxx> - -class SfxThesSubMenuHelper -{ - css::uno::Reference< css::linguistic2::XLinguServiceManager2 > m_xLngMgr; - css::uno::Reference< css::linguistic2::XThesaurus > m_xThesarus; - -private: - SfxThesSubMenuHelper( const SfxThesSubMenuHelper & ) = delete; - SfxThesSubMenuHelper & operator = ( const SfxThesSubMenuHelper & ) = delete; - -public: - SfxThesSubMenuHelper(); - ~SfxThesSubMenuHelper(); - - static OUString GetText( const OUString &rLookUpString, sal_Int32 nDelimPos ); - - // returns the Locale to be used for the selected text when the thesaurus is to be called - static void GetLocale( css::lang::Locale /*out */ &rLocale, const OUString &rLookUpString, sal_Int32 nDelimPos ); - - // returns true if the locale is supported by the thesaurus - bool IsSupportedLocale( const css::lang::Locale & rLocale ) const; - - // get the first nMax Synonym entries, even if different meanings need to be evaluated - bool GetMeanings( std::vector< OUString > & rSynonyms, const OUString & rWord, const css::lang::Locale & rLocale, sal_Int16 nMaxSynonms ); - - OUString GetThesImplName( const css::lang::Locale &rLocale ) const; -}; - - -#endif - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/menu/virtmenu.cxx b/sfx2/source/menu/virtmenu.cxx deleted file mode 100644 index bf0c2c5113b7..000000000000 --- a/sfx2/source/menu/virtmenu.cxx +++ /dev/null @@ -1,1057 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <sal/config.h> - -#include <svtools/menuoptions.hxx> -#include <svtools/imagemgr.hxx> -#include <svl/imageitm.hxx> -#include <com/sun/star/container/XEnumeration.hpp> -#include <com/sun/star/frame/Desktop.hpp> -#include <com/sun/star/frame/XFramesSupplier.hpp> -#include <comphelper/processfactory.hxx> -#include <toolkit/helper/vclunohelper.hxx> - -#include "virtmenu.hxx" -#include <sfx2/msgpool.hxx> -#include "statcach.hxx" -#include <sfx2/msg.hxx> -#include <sfx2/mnuitem.hxx> -#include <sfx2/mnumgr.hxx> -#include <sfx2/bindings.hxx> -#include <sfx2/dispatch.hxx> -#include <sfx2/app.hxx> -#include "sfxtypes.hxx" -#include "arrdecl.hxx" -#include <sfx2/sfx.hrc> -#include <sfx2/viewsh.hxx> -#include "sfxpicklist.hxx" -#include <sfx2/sfxresid.hxx> -#include "menu.hrc" -#include <sfx2/imagemgr.hxx> -#include <sfx2/viewfrm.hxx> -#include <sfx2/objsh.hxx> -#include <framework/addonsoptions.hxx> - -#include <framework/addonmenu.hxx> -#include <framework/menuconfiguration.hxx> -#include <vcl/settings.hxx> - -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::frame; -using namespace ::com::sun::star::uno; - -class SfxMenuImageControl_Impl : public SfxControllerItem -{ - SfxVirtualMenu* pMenu; - long lRotation; - bool bIsMirrored; - -protected: - virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override; -public: - SfxMenuImageControl_Impl( sal_uInt16 nSlotId, SfxBindings& rBindings, SfxVirtualMenu* pVMenu ) - : SfxControllerItem( nSlotId, rBindings ) - , pMenu( pVMenu ) - , lRotation( 0 ) - , bIsMirrored( false ) - {} - void Update(); -}; - -void SfxMenuImageControl_Impl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState /*eState*/, const SfxPoolItem* pState ) -{ - const SfxImageItem* pItem = dynamic_cast<const SfxImageItem*>( pState ); - if ( pItem ) - { - lRotation = pItem->GetRotation(); - bIsMirrored = pItem->IsMirrored(); - Update(); - } -} - -void SfxMenuImageControl_Impl::Update() -{ - SfxViewFrame* pViewFrame = GetBindings().GetDispatcher_Impl()->GetFrame(); - SfxModule* pModule = pViewFrame->GetObjectShell()->GetModule(); - SfxSlotPool* pPool = pModule->GetSlotPool(); - Menu* pSVMenu = pMenu->GetSVMenu(); - for (sal_uInt16 nPos = 0; nPos<pSVMenu->GetItemCount(); nPos++) - { - sal_uInt16 nslotId = pSVMenu->GetItemId( nPos ); - const SfxSlot* pSlot = pPool->GetSlot( nslotId ); - if ( pSlot && pSlot->IsMode( SfxSlotMode::IMAGEROTATION ) ) - { - pSVMenu->SetItemImageMirrorMode( nslotId, false ); - pSVMenu->SetItemImageAngle( nslotId, lRotation ); - } - - if ( pSlot && pSlot->IsMode( SfxSlotMode::IMAGEREFLECTION ) ) - pSVMenu->SetItemImageMirrorMode( nslotId, bIsMirrored ); - } -} - - -static Image RetrieveAddOnImage( Reference< css::frame::XFrame >& rFrame, - const OUString& aImageId, - const OUString& aURL, - bool bBigImage -) -{ - Image aImage; - - if ( !aImageId.isEmpty() ) - { - aImage = GetImage( rFrame, aImageId, bBigImage ); - if ( !!aImage ) - return aImage; - } - - aImage = GetImage( rFrame, aURL, bBigImage ); - if ( !aImage ) - aImage = framework::AddonsOptions().GetImageFromURL( aURL, bBigImage ); - - return aImage; -} - - -/* This helper function checks whether a Slot-id in the current application - status is visible or not. This relates to the application status to see - if the OLE server application exist or not. -*/ - -bool IsItemHidden_Impl( sal_uInt16 nItemId, bool bOleServer, bool bMac ) -{ - return ( bMac && - ( nItemId == SID_MINIMIZED ) ) || - ( bOleServer && - ( nItemId == SID_QUITAPP || nItemId == SID_SAVEDOC || - nItemId == SID_OPENDOC || nItemId == SID_SAVEASDOC || - nItemId == SID_NEWDOC ) ) || - ( !bOleServer && - ( nItemId == SID_EXITANDRETURN || nItemId == SID_UPDATEDOC ) ); -} - - -void SfxVirtualMenu::Construct_Impl() -{ - pSVMenu->SetHighlightHdl( LINK(this, SfxVirtualMenu, Highlight) ); - pSVMenu->SetActivateHdl( LINK(this, SfxVirtualMenu, Activate) ); - pSVMenu->SetDeactivateHdl( LINK(this, SfxVirtualMenu, Deactivate) ); - pSVMenu->SetSelectHdl( LINK(this, SfxVirtualMenu, Select) ); - - if ( !pResMgr && pParent ) - pResMgr = pParent->pResMgr; -} - - -SfxVirtualMenu::SfxVirtualMenu( sal_uInt16 nOwnId, - SfxVirtualMenu* pOwnParent, Menu& rMenu, bool bWithHelp, - SfxBindings &rBindings, bool bOLEServer, bool bRes, bool bIsAddonMenu ): - pItems(nullptr), - pImageControl(nullptr), - pBindings(&rBindings), - pResMgr(nullptr), - nLocks(0), - bHelpInitialized( bWithHelp ), - bIsAddonPopupMenu( bIsAddonMenu ) -{ - pSVMenu = &rMenu; - - bResCtor = bRes; - bOLE = bOLEServer; - nId = nOwnId; - pParent = pOwnParent; - nVisibleItems = 0; - pAppCtrl = nullptr; - pWindowMenu = nullptr; - pPickMenu = nullptr; - pAddonsMenu = nullptr; - bIsActive = false; - bControllersUnBound = false; - CreateFromSVMenu(); - Construct_Impl(); - bHelpInitialized = false; -} - - -// creates a virtual menu from a StarView MenuBar or PopupMenu - -SfxVirtualMenu::SfxVirtualMenu( Menu *pStarViewMenu, bool bWithHelp, - SfxBindings &rBindings, bool bOLEServer, bool bRes, bool bIsAddonMenu ): - pItems(nullptr), - pImageControl(nullptr), - pBindings(&rBindings), - pResMgr(nullptr), - nLocks(0), - bHelpInitialized( bWithHelp ), - bIsAddonPopupMenu( bIsAddonMenu ) -{ - - pSVMenu = pStarViewMenu; - - bResCtor = bRes; - bOLE = bOLEServer; - nId = 0; - pParent = nullptr; - pAppCtrl = nullptr; - nVisibleItems = 0; - pWindowMenu = nullptr; - pPickMenu = nullptr; - pAddonsMenu = nullptr; - bIsActive = false; - bControllersUnBound = false; - CreateFromSVMenu(); - Construct_Impl(); - bHelpInitialized = false; -} - - -/* The destructor of the class SfxVirtualMenu releases bounded items and - the associated StarView-PopupMenu is released from its parent. - If it is related to the Pickmenu or the MDI-menu, it is unregistered here. -*/ - -SfxVirtualMenu::~SfxVirtualMenu() -{ - - DELETEZ( pImageControl ); - SvtMenuOptions().RemoveListenerLink( LINK( this, SfxVirtualMenu, SettingsChanged ) ); - - if ( bIsActive ) - { - pBindings->LEAVEREGISTRATIONS(); --nLocks; bIsActive = false; - } - - if (pItems) - { - delete [] pItems; - } - - delete pAppCtrl; - pBindings = nullptr; - - // All the menus, which were created by SV, will also be there deleted - // again (i.e. created by loading them from the resource) - // The top-level menu is never deleted by SV, since the allocation - // in done in the SFX - if ( !bResCtor || !pParent) - { - if ( pParent ) - { - if( pParent->pSVMenu->GetItemPos( nId ) != MENU_ITEM_NOTFOUND ) - pParent->pSVMenu->SetPopupMenu( nId, nullptr ); - if ( pParent->pPickMenu == pSVMenu ) - pParent->pPickMenu = nullptr; - if ( pParent->pWindowMenu == pSVMenu) - pParent->pWindowMenu = nullptr; - if ( pParent->pAddonsMenu == pSVMenu ) - pParent->pAddonsMenu = nullptr; - } - - delete pSVMenu; - } - - SAL_INFO("sfx", "SfxVirtualMenu " << this << " destroyed"); - DBG_ASSERT( !nLocks, "destroying active menu" ); -} - -// internal: creates the virtual menu from the pSVMenu - -void SfxVirtualMenu::CreateFromSVMenu() -{ - - // Merge Addon popup menus into the SV Menu - SfxViewFrame* pViewFrame = pBindings->GetDispatcher()->GetFrame(); - Reference< css::frame::XFrame > xFrame( pViewFrame->GetFrame().GetFrameInterface() ); - - if ( pSVMenu->IsMenuBar() ) - { - Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - sal_uInt16 nPos = pSVMenu->GetItemPos( SID_MDIWINDOWLIST ); - if ( nPos != MENU_ITEM_NOTFOUND && xFrame.is() ) - { - // Retrieve addon popup menus and add them to our menu bar - framework::AddonMenuManager::MergeAddonPopupMenus( xFrame, nPos, static_cast<MenuBar *>(pSVMenu), xContext ); - } - - // Merge the Add-Ons help menu items into the Office help menu - if ( xFrame.is() ) - framework::AddonMenuManager::MergeAddonHelpMenu( xFrame, static_cast<MenuBar *>(pSVMenu), xContext ); - - // Set addon menu pointer here to avoid problems. When accessibility is enabled, the whole menu - // is created immediately! - pAddonsMenu = pSVMenu->GetPopupMenu( SID_ADDONLIST ); - } - else if ( pParent ) - { - if ( pSVMenu == pParent->pAddonsMenu && - framework::AddonsOptions().HasAddonsMenu() && - !pSVMenu->GetPopupMenu( SID_ADDONS ) ) - { - // Create menu item at the end of the tools popup menu for the addons popup menu - InsertAddOnsMenuItem( pSVMenu ); - } - } - - // get and store the number of items - nCount = pSVMenu->GetItemCount(); - - // Note: only this time it is guaranteed that nCount and the ItemCount - // the SV-menus match; later on the SvMenu can have more entries - // (Pick list!) - if (nCount) - pItems = new SfxMenuControl[nCount]; - - // remember some values - SfxGetpApp(); - const bool bOleServer = false; - const bool bMac = false; - SvtMenuOptions aOptions; - aOptions.AddListenerLink( LINK( this, SfxVirtualMenu, SettingsChanged ) ); - - // iterate through the items - pBindings->ENTERREGISTRATIONS(); ++nLocks; - pImageControl = new SfxMenuImageControl_Impl( SID_IMAGE_ORIENTATION, *pBindings, this ); - - sal_uInt16 nSVPos = 0; - for ( sal_uInt16 nPos=0; nPos<nCount; ++nPos, ++nSVPos ) - { - sal_uInt16 nSlotId = pSVMenu->GetItemId(nSVPos); - PopupMenu* pPopup = pSVMenu->GetPopupMenu(nSlotId); - if( pPopup && nSlotId >= SID_OBJECTMENU0 && nSlotId <= SID_OBJECTMENU_LAST ) - { - // artefact in XML menuconfig: every entry in root menu must have a popup! - pSVMenu->SetPopupMenu( nSlotId, nullptr ); - DELETEZ( pPopup ); - } - - const OUString sItemText = pSVMenu->GetItemText(nSlotId); - - if ( pPopup ) - { - - SfxMenuControl *pMnuCtrl = - SfxMenuControl::CreateControl(nSlotId, *pPopup, *pBindings); - - if ( pMnuCtrl ) - { - // The pop was obviously not "real" and such are never loaded - // from the resource and need thus to be explicitly deleted. - if ( pSVMenu->GetPopupMenu( nSlotId ) == pPopup ) - pSVMenu->SetPopupMenu( nSlotId, nullptr ); - delete pPopup; - pPopup = nullptr; - - SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl(); - rCtrlArr.push_back(std::unique_ptr<SfxMenuControl>(pMnuCtrl)); - (pItems+nPos)->Bind( nullptr, nSlotId, sItemText, *pBindings); - pMnuCtrl->Bind( this, nSlotId, sItemText, *pBindings); - - if ( Application::GetSettings().GetStyleSettings().GetUseImagesInMenus() ) - { - OUString aSlotURL( "slot:" ); - aSlotURL += OUString::number( nSlotId); - Image aImage = GetImage( xFrame, aSlotURL, false ); - pSVMenu->SetItemImage( nSlotId, aImage ); - } - } - else - { - pMnuCtrl = pItems+nPos; - - // Normally only now in Activate-Handler - if ( bOLE ) - { - pMnuCtrl->Bind( this, nSlotId, - *new SfxVirtualMenu(nSlotId, this, *pPopup, bHelpInitialized, *pBindings, bOLE, bResCtor), - sItemText, *pBindings ); - } - } - - ++nVisibleItems; - } - else - { - switch ( pSVMenu->GetItemType(nSVPos) ) - { - case MenuItemType::STRING: - case MenuItemType::STRINGIMAGE: - { - SfxMenuControl *pMnuCtrl=nullptr; - OUString aCmd( pSVMenu->GetItemCommand( nSlotId ) ); - if ( !aCmd.isEmpty() && (( nSlotId < SID_SFX_START ) || ( nSlotId > SHRT_MAX )) ) - { - // try to create control via command name - pMnuCtrl = SfxMenuControl::CreateControl( aCmd, nSlotId, *pSVMenu, sItemText, *pBindings, this ); - if ( pMnuCtrl ) - { - SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl(); - rCtrlArr.push_back(std::unique_ptr<SfxMenuControl>(pMnuCtrl)); - (pItems+nPos)->Bind( nullptr, nSlotId, sItemText, *pBindings); - } - } - - if ( !pMnuCtrl ) - { - // try to create control via Id - pMnuCtrl = SfxMenuControl::CreateControl(nSlotId, *pSVMenu, *pBindings); - if ( pMnuCtrl ) - { - SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl(); - rCtrlArr.push_back(std::unique_ptr<SfxMenuControl>(pMnuCtrl)); - (pItems+nPos)->Bind( nullptr, nSlotId, sItemText, *pBindings); - } - else - // take default control - pMnuCtrl = (pItems+nPos); - - pMnuCtrl->Bind( this, nSlotId, sItemText, *pBindings); - } - - if ( Application::GetSettings().GetStyleSettings().GetUseImagesInMenus() ) - { - Image aImage; - if ( bIsAddonPopupMenu || framework::AddonMenuManager::IsAddonMenuId( nSlotId )) - { - OUString aImageId; - - ::framework::MenuAttributes* pMenuAttributes = - reinterpret_cast< ::framework::MenuAttributes*>(pSVMenu->GetUserValue( nSlotId )); - - if ( pMenuAttributes ) - aImageId = pMenuAttributes->aImageId; // Retrieve image id from menu attributes - - aImage = RetrieveAddOnImage( xFrame, aImageId, aCmd, false ); - } - else - { - OUString aSlotURL( "slot:" ); - aSlotURL += OUString::number( nSlotId); - aImage = GetImage( xFrame, aSlotURL, false ); - } - - if ( !!aImage ) - pSVMenu->SetItemImage( nSlotId, aImage ); - } - - if ( !IsItemHidden_Impl(nSlotId, bOleServer, bMac) ) - ++nVisibleItems; - else - pSVMenu->RemoveItem( nSVPos-- ); - break; - } - - case MenuItemType::IMAGE: - //! not implemented - break; - - case MenuItemType::SEPARATOR: - //! not implemented - break; - default: - break; // DONTKNOW and STRINGIMAGE not handled. - } - } - } - pBindings->LEAVEREGISTRATIONS(); --nLocks; -} - - -// called on activation of the SV-Menu - -IMPL_STATIC_LINK_NOARG_TYPED( - SfxVirtualMenu, Highlight, Menu *, bool ) -{ - - return true; -} - -IMPL_LINK_NOARG_TYPED(SfxVirtualMenu, SettingsChanged, LinkParamNone*, void) -{ - sal_uInt16 nItemCount = pSVMenu->GetItemCount(); - SfxViewFrame *pViewFrame = pBindings->GetDispatcher()->GetFrame(); - bool bIcons = Application::GetSettings().GetStyleSettings().GetUseImagesInMenus(); - Reference<css::frame::XFrame> xFrame( pViewFrame->GetFrame().GetFrameInterface() ); - - if ( !bIsAddonPopupMenu ) - { - for ( sal_uInt16 nSVPos=0; nSVPos<nItemCount; ++nSVPos ) - { - sal_uInt16 nSlotId = pSVMenu->GetItemId( nSVPos ); - MenuItemType nType = pSVMenu->GetItemType( nSVPos ); - if ( nType == MenuItemType::STRING && bIcons ) - { - if ( framework::AddonMenuManager::IsAddonMenuId( nSlotId )) - { - // Special code for Add-On menu items. They can appear inside the help menu. - OUString aCmd( pSVMenu->GetItemCommand( nSlotId ) ); - OUString aImageId; - - ::framework::MenuAttributes* pMenuAttributes = - reinterpret_cast< ::framework::MenuAttributes*>(pSVMenu->GetUserValue( nSlotId )); - - if ( pMenuAttributes ) - aImageId = pMenuAttributes->aImageId; // Retrieve image id from menu attributes - - pSVMenu->SetItemImage( nSlotId, RetrieveAddOnImage( xFrame, aImageId, aCmd, false )); - } - else - { - OUString aSlotURL( "slot:" ); - aSlotURL += OUString::number( nSlotId); - pSVMenu->SetItemImage( nSlotId, GetImage( xFrame, aSlotURL, false )); - } - } - else if( nType == MenuItemType::STRINGIMAGE && !bIcons ) - { - pSVMenu->SetItemImage( nSlotId, Image() ); - } - } - } - else - { - // Remove/update images from Add-Ons top-level popup menus when settings have changed - if ( !bIcons ) - RemoveMenuImages( pSVMenu ); - else - UpdateImages( pSVMenu ); - } - - // Special code to remove menu images from runtime popup menus when settings have changed - if ( pParent && pSVMenu == pParent->pAddonsMenu ) - { - if ( !bIcons ) - RemoveMenuImages( pParent->pAddonsMenu->GetPopupMenu( SID_ADDONS )); - else - UpdateImages( pParent->pAddonsMenu->GetPopupMenu( SID_ADDONS )); - } - - if ( pImageControl ) - pImageControl->Update(); -} - - -void SfxVirtualMenu::UpdateImages( Menu* pMenu ) -{ - if ( !pMenu ) - return; - - framework::AddonsOptions aAddonOptions; - - bool bIcons = Application::GetSettings().GetStyleSettings().GetUseImagesInMenus(); - if ( bIcons ) - { - sal_uInt16 nItemCount = pMenu->GetItemCount(); - Reference<css::frame::XFrame> aXFrame( pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame().GetFrameInterface() ); - - for ( sal_uInt16 nPos=0; nPos < nItemCount; ++nPos ) - { - sal_uInt16 nSlotId = pMenu->GetItemId( nPos ); - PopupMenu* pPopup = pMenu->GetPopupMenu( nSlotId ); - if ( pMenu->GetItemType( nPos ) != MenuItemType::SEPARATOR ) - { - OUString aImageId; - - ::framework::MenuAttributes* pMenuAttributes = - reinterpret_cast< ::framework::MenuAttributes*>(pMenu->GetUserValue( nSlotId )); - - if ( pMenuAttributes ) - aImageId = pMenuAttributes->aImageId; // Retrieve image id from menu attributes - - pMenu->SetItemImage( nSlotId, RetrieveAddOnImage( aXFrame, aImageId, pMenu->GetItemCommand( nSlotId ), false )); - } - - if ( pPopup ) - UpdateImages( pPopup ); - } - - if ( pImageControl ) - pImageControl->Update(); - } -} - - -void SfxVirtualMenu::RemoveMenuImages( Menu* pMenu ) -{ - if ( !pMenu ) - return; - - sal_uInt16 nItemCount = pMenu->GetItemCount(); - for ( sal_uInt16 nPos=0; nPos < nItemCount; ++nPos ) - { - sal_uInt16 nSlotId = pMenu->GetItemId( nPos ); - PopupMenu* pPopup = pMenu->GetPopupMenu( nSlotId ); - if ( pMenu->GetItemType( nPos ) == MenuItemType::STRINGIMAGE ) - pMenu->SetItemImage( nSlotId, Image() ); - if ( pPopup ) - RemoveMenuImages( pPopup ); - } -} - - -bool SfxVirtualMenu::Bind_Impl( Menu *pMenu ) -{ - // Search , as SV with 'sal_uInt16 nSID = pSVMenu->GetCurItemId();' always - // returns 0. It is like this, since the Event-Forwarding has nothing to do - // with the Parent-Menus CurItem. - - for ( sal_uInt16 nPos = 0; nPos < nCount; ++nPos ) - { - sal_uInt16 nSID = pSVMenu->GetItemId(nPos); - SfxMenuControl &rCtrl = pItems[nPos]; - // found the Sub-Menu in question? - bool bFound = pSVMenu->GetPopupMenu(nSID) == pMenu; - SfxVirtualMenu *pSubMenu = rCtrl.GetPopupMenu(); - - if ( bFound ) - { - // Only a binded Menu-Controller as already an Id! - if ( !rCtrl.GetId() ) - { - bIsAddonPopupMenu = false; - DBG_ASSERT( !pSubMenu, "Popup already exists!"); - - // Check if the popup is an Add-On popup menu - // Either the popup menu has a special ID or a special command URL prefix! - OUString aCommand = pSVMenu->GetItemCommand( nSID ); - if ( ( nSID == SID_ADDONS ) || - ( nSID == SID_ADDONHELP ) || - ( aCommand.startsWith( ADDONSPOPUPMENU_URL_PREFIX_STR ) ) ) - bIsAddonPopupMenu = true; - - // Create VirtualMenu for Sub-Menu - bool bRes = bResCtor; - pSubMenu = new SfxVirtualMenu( nSID, this, - *pMenu, false, *pBindings, bOLE, bRes, bIsAddonPopupMenu ); - - SAL_INFO("sfx", "New VirtualMenu " << pSubMenu << " created"); - - rCtrl.Bind( this, nSID, *pSubMenu, pSVMenu->GetItemText(nSID), *pBindings ); - - // Forward Activate - pSubMenu->Bind_Impl( pMenu ); - pSubMenu->Activate( pMenu ); - } - } - - // continue searching recursively (SV Activate only the menu itself - // and Top-Menu) - if ( !bFound && pSubMenu ) - bFound = pSubMenu->Bind_Impl( pMenu ); - - // If found, break - if ( bFound ) - return true; - } - - // Not found in this submenu - return false; -} - -void SfxVirtualMenu::BindControllers() -{ - pBindings->ENTERREGISTRATIONS(); - - sal_uInt16 nPos; - for ( nPos = 0; nPos < nCount; ++nPos ) - { - SfxMenuControl& rCtrl = pItems[nPos]; - if ( rCtrl.IsBindable_Impl() && !rCtrl.GetPopupMenu() ) - rCtrl.ReBind(); - } - - SfxMenuCtrlArr_Impl& rCtrlArr = GetAppCtrl_Impl(); - for (SfxMenuCtrlArr_Impl::iterator i = rCtrlArr.begin(); - i != rCtrlArr.end(); ++i) - { - sal_uInt16 nSlotId = (*i)->GetId(); - if (pSVMenu->GetItemCommand(nSlotId).isEmpty()) - { - (*i)->ReBind(); - } - } - - pBindings->LEAVEREGISTRATIONS(); - bControllersUnBound = false; -} - -void SfxVirtualMenu::UnbindControllers() -{ - pBindings->ENTERREGISTRATIONS(); - - sal_uInt16 nPos; - for ( nPos = 0; nPos < nCount; ++nPos ) - { - SfxMenuControl &rCtrl = pItems[nPos]; - if ( rCtrl.IsBound() ) - rCtrl.UnBind(); - } - - SfxMenuCtrlArr_Impl& rCtrlArr = GetAppCtrl_Impl(); - for (SfxMenuCtrlArr_Impl::iterator i = rCtrlArr.begin(); - i != rCtrlArr.end(); ++i) - { - if ((*i)->IsBound()) - { - // UnoController is not bound! - (*i)->UnBind(); - } - } - - pBindings->LEAVEREGISTRATIONS(); - bControllersUnBound = true; -} - - -void SfxVirtualMenu::InsertAddOnsMenuItem( Menu* pMenu ) -{ - // Create special popup menu that is filled with the 3rd party components popup menu items - ::framework::MenuConfiguration aConf( ::comphelper::getProcessComponentContext() ); - Reference<css::frame::XFrame> xFrame( pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame().GetFrameInterface() ); - - PopupMenu* pAddonMenu = nullptr; - try - { - Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - pAddonMenu = framework::AddonMenuManager::CreateAddonMenu(xFrame, xContext); - } - catch ( const css::lang::WrappedTargetException& ) - { - } - - // Create menu item at the end of the tools popup menu for the addons popup menu - if ( pAddonMenu && pAddonMenu->GetItemCount() > 0 ) - { - sal_uInt16 nItemCount = pMenu->GetItemCount(); - OUString aAddonsTitle(SfxResId(STR_MENU_ADDONS).toString()); - if ( nItemCount > 0 && pMenu->GetItemType( nItemCount-1 ) != MenuItemType::SEPARATOR ) - pMenu->InsertSeparator(); - pMenu->InsertItem( SID_ADDONS, aAddonsTitle ); - pMenu->SetPopupMenu( SID_ADDONS, pAddonMenu ); - - if ( Application::GetSettings().GetStyleSettings().GetUseImagesInMenus() ) - { - OUString aSlotURL( "slot:" ); - aSlotURL += OUString::number( SID_ADDONS); - pMenu->SetItemImage( SID_ADDONS, GetImage( xFrame, aSlotURL, false )); - } - } - else - delete pAddonMenu; -} - - -// called on activation of the SV-Menu - -IMPL_LINK_TYPED( SfxVirtualMenu, Activate, Menu *, pMenu, bool ) -{ - SAL_INFO( - "sfx", - "SfxVirtualMenu " << this << " activated " << pMenu << ", own " - << pSVMenu); - - // MI: for what was it still good for? - // MBA: seems to be an old QAP-Hack (checked-in in rev.1.41!) - - if ( pMenu ) - { - bool bDontHide = SvtMenuOptions().IsEntryHidingEnabled(); - MenuFlags nFlag = pMenu->GetMenuFlags(); - if ( bDontHide ) - nFlag &= ~MenuFlags::HideDisabledEntries; - else - nFlag |= MenuFlags::HideDisabledEntries; - pMenu->SetMenuFlags( nFlag ); - } - - // Own StarView-Menu - if ( pMenu == pSVMenu ) - { - // Prevent Double Activate - if ( bIsActive ) - return true; - - // ggf. Pick-Menu erzeugen - if ( pParent && pSVMenu == pParent->pPickMenu ) - { - SfxPickList::Get().CreateMenuEntries( pParent->pPickMenu ); - } - else - pPickMenu = pSVMenu->GetPopupMenu(SID_PICKLIST); - - if ( pParent && pSVMenu == pParent->pWindowMenu ) - { - // update window list - ::std::vector< OUString > aNewWindowListVector; - Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); - - sal_uInt16 nActiveItemId = 0; - sal_uInt16 nItemId = START_ITEMID_WINDOWLIST; - - Reference< XFrame > xCurrentFrame = xDesktop->getCurrentFrame(); - Reference< XIndexAccess > xList ( xDesktop->getFrames(), UNO_QUERY ); - sal_Int32 nFrameCount = xList->getCount(); - for( sal_Int32 i=0; i<nFrameCount; ++i ) - { - Reference< XFrame > xFrame; - Any aVal = xList->getByIndex(i); - if (!(aVal>>=xFrame) || !xFrame.is() ) - continue; - - if ( xFrame == xCurrentFrame ) - nActiveItemId = nItemId; - - vcl::Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); - if ( pWin && pWin->IsVisible() ) - { - aNewWindowListVector.push_back( pWin->GetText() ); - ++nItemId; - } - } - - int nItemCount = pMenu->GetItemCount(); - - if ( nItemCount > 0 ) - { - // remove all old window list entries from menu - sal_uInt16 nPos = pMenu->GetItemPos( START_ITEMID_WINDOWLIST ); - for ( sal_uInt16 n = nPos; n < pMenu->GetItemCount(); ) - pMenu->RemoveItem( n ); - - if ( pMenu->GetItemType( pMenu->GetItemCount()-1 ) == MenuItemType::SEPARATOR ) - pMenu->RemoveItem( pMenu->GetItemCount()-1 ); - } - - if ( aNewWindowListVector.size() > 0 ) - { - // append new window list entries to menu - pMenu->InsertSeparator(); - nItemId = START_ITEMID_WINDOWLIST; - for ( size_t i = 0; i < aNewWindowListVector.size(); i++ ) - { - pMenu->InsertItem( nItemId, aNewWindowListVector.at( i ), MenuItemBits::RADIOCHECK ); - if ( nItemId == nActiveItemId ) - pMenu->CheckItem( nItemId ); - ++nItemId; - } - } - } - else - pWindowMenu = pSVMenu->GetPopupMenu(SID_MDIWINDOWLIST); - - if ( !pParent && pSVMenu->IsMenuBar() && !pAddonsMenu ) - { - // Store Add-Ons parents of our runtime menu items - pAddonsMenu = pSVMenu->GetPopupMenu( SID_ADDONLIST ); - } - - // Provides consistency to the Status - if ( bControllersUnBound ) - BindControllers(); - - pBindings->GetDispatcher_Impl()->Flush(); - for ( sal_uInt16 nPos = 0; nPos < nCount; ++nPos ) - { - sal_uInt16 nSlotId = (pItems+nPos)->GetId(); - if ( nSlotId && nSlotId > END_ITEMID_WINDOWLIST ) - pBindings->Update(nSlotId); - } - - pBindings->Update( SID_IMAGE_ORIENTATION ); - - // Suppress the Status updates until Deactivate - pBindings->ENTERREGISTRATIONS(); ++nLocks; bIsActive = true; - - return true; - } - else - { - // Find the VirtualMenu for the SubMenu and if possible, bind a - // VirtualMenu - bool bRet = pMenu && Bind_Impl(pMenu); -#ifdef DBG_UTIL - if ( !bRet) - SAL_INFO( "sfx", "W1: Virtual menu could not be created!" ); -#endif - return bRet; - } -} - - -IMPL_LINK_TYPED( SfxVirtualMenu, Deactivate, Menu *, pMenu, bool ) -{ - SAL_INFO( - "sfx", - "SfxVirtualMenu " << this << " deactivated " << pMenu << ", own " - << pSVMenu); - if ( bIsActive && ( nullptr == pMenu || pMenu == pSVMenu ) ) - { - // All controllers can be unbinded all the way up to the Menubar, - // when the menu is disabled (= closed) - if ( pParent ) - UnbindControllers(); - pBindings->LEAVEREGISTRATIONS(); --nLocks; bIsActive = false; - } - return true; -} - - -// called on activation of the SV-Menu - -IMPL_LINK_TYPED( SfxVirtualMenu, Select, Menu *, pMenu, bool ) -{ - sal_uInt16 nSlotId = (sal_uInt16) pMenu->GetCurItemId(); - SAL_INFO( - "sfx", - "SfxVirtualMenu " << this << " selected " << nSlotId << " from " - << pMenu); - - if ( nSlotId >= START_ITEMID_WINDOWLIST && nSlotId <= END_ITEMID_WINDOWLIST ) - { - // window list menu item selected - Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); - sal_uInt16 nTaskId = START_ITEMID_WINDOWLIST; - Reference< XIndexAccess > xList( xDesktop->getFrames(), UNO_QUERY ); - sal_Int32 nFrameCount = xList->getCount(); - for ( sal_Int32 i=0; i<nFrameCount; ++i ) - { - Any aItem = xList->getByIndex(i); - Reference< XFrame > xFrame; - if (( aItem >>= xFrame ) && xFrame.is() && nTaskId == nSlotId ) - { - vcl::Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); - pWin->GrabFocus(); - pWin->ToTop( ToTopFlags::RestoreWhenMin ); - break; - } - - nTaskId++; - } - - return true; - } - else if ( nSlotId >= START_ITEMID_PICKLIST && nSlotId <= END_ITEMID_PICKLIST ) - { - SfxPickList::ExecuteMenuEntry( nSlotId ); - return true; - } - - OUString sCommand = pMenu->GetItemCommand(nSlotId); - if (!sCommand.isEmpty()) - pBindings->ExecuteCommand_Impl(sCommand); - else - pBindings->Execute(nSlotId); - - return true; -} - - -// returns the associated StarView-menu - - -// set the checkmark of the specified item - -void SfxVirtualMenu::CheckItem( sal_uInt16 nItemId, bool bCheck ) -{ - DBG_ASSERT( pSVMenu != nullptr, "" ); - if (pSVMenu->GetItemPos( nItemId ) != MENU_ITEM_NOTFOUND ) - pSVMenu->CheckItem( nItemId, bCheck ); -} - - -// set the enabled-state of the specified item - -void SfxVirtualMenu::EnableItem( sal_uInt16 nItemId, bool bEnable ) -{ - DBG_ASSERT( pSVMenu != nullptr, "" ); - - if (pSVMenu->GetItemPos( nItemId ) != MENU_ITEM_NOTFOUND ) - pSVMenu->EnableItem( nItemId, bEnable ); -} - - -// set the text of the specified item - -void SfxVirtualMenu::SetItemText( sal_uInt16 nItemId, const OUString& rText ) -{ - DBG_ASSERT( pSVMenu != nullptr, "" ); - if (pSVMenu->GetItemPos( nItemId ) != MENU_ITEM_NOTFOUND ) - pSVMenu->SetItemText( nItemId, rText ); -} - - -void SfxVirtualMenu::SetPopupMenu( sal_uInt16 nItemId, PopupMenu *pMenu ) -{ - - if (pSVMenu->GetItemPos( nItemId ) != MENU_ITEM_NOTFOUND ) - GetSVMenu()->SetPopupMenu( nItemId, pMenu ); - for ( sal_uInt16 n = 0; n < nCount; ++n ) - { - SfxVirtualMenu *pSubMenu = (pItems+n)->GetPopupMenu(); - if ( pSubMenu ) - pSubMenu->SetPopupMenu( nItemId, pMenu ); - } -} - - -// Forces the initialization, which is otherwise only happens in Activate - -void SfxVirtualMenu::InitPopup( sal_uInt16 nPos, bool /*bOLE*/ ) -{ - - sal_uInt16 nSID = pSVMenu->GetItemId(nPos); - PopupMenu *pMenu = pSVMenu->GetPopupMenu( nSID ); - - DBG_ASSERT( pMenu, "No popup exist here!"); - - SfxMenuControl &rCtrl = pItems[nPos]; - if ( !rCtrl.GetId() ) - { - // Generate VirtualMenu for Sub-Menu - bool bRes = bResCtor; - SfxVirtualMenu *pSubMenu = - new SfxVirtualMenu(nSID, this, *pMenu, false, *pBindings, bOLE, bRes); - - SAL_INFO("sfx", "New VirtualMenu " << pSubMenu << " created"); - - rCtrl.Bind( this, nSID, *pSubMenu, pSVMenu->GetItemText(nSID), *pBindings ); - } -} - -void SfxVirtualMenu::InitializeHelp() -{ - for ( sal_uInt16 nPos = 0; nPos<pSVMenu->GetItemCount(); ++nPos ) - { - sal_uInt16 nSlotId = pSVMenu->GetItemId(nPos); - SfxMenuControl &rCtrl = pItems[nPos]; - if ( nSlotId && !rCtrl.GetId() ) - { - InitPopup( nPos ); - } - - SfxVirtualMenu *pSubMenu = rCtrl.GetPopupMenu(); - if ( pSubMenu ) - pSubMenu->InitializeHelp(); - } - - bHelpInitialized = true; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index ec0b2f577eea..93302a84d029 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -71,7 +71,6 @@ #include <svtools/miscopt.hxx> #include <sfx2/tbxctrl.hxx> -#include <sfx2/mnumgr.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/msg.hxx> #include <sfx2/msgpool.hxx> @@ -89,7 +88,6 @@ #include "helpid.hrc" #include "workwin.hxx" #include <sfx2/imgmgr.hxx> -#include "virtmenu.hxx" #include <sfx2/imagemgr.hxx> #include <ctrlfactoryimpl.hxx> diff --git a/svx/inc/pch/precompiled_svx.hxx b/svx/inc/pch/precompiled_svx.hxx index af1e100458e2..17916bdf49c9 100644 --- a/svx/inc/pch/precompiled_svx.hxx +++ b/svx/inc/pch/precompiled_svx.hxx @@ -326,7 +326,6 @@ #include <sfx2/dockwin.hxx> #include <sfx2/imagemgr.hxx> #include <sfx2/itemconnect.hxx> -#include <sfx2/mnuitem.hxx> #include <sfx2/module.hxx> #include <sfx2/objsh.hxx> #include <sfx2/request.hxx> diff --git a/svx/source/form/fmobjfac.cxx b/svx/source/form/fmobjfac.cxx index 115dfa0d739c..ded879ab6d73 100644 --- a/svx/source/form/fmobjfac.cxx +++ b/svx/source/form/fmobjfac.cxx @@ -67,7 +67,6 @@ FmFormObjFactory::FmFormObjFactory() SvxFmTbxCtlRecTotal::RegisterControl( SID_FM_RECORD_TOTAL ); SvxFmTbxPrevRec::RegisterControl( SID_FM_RECORD_PREV ); SvxFmTbxNextRec::RegisterControl( SID_FM_RECORD_NEXT ); - ControlConversionMenuController::RegisterControl(SID_FM_CHANGECONTROLTYPE); // Registrieung von globalen fenstern FmFieldWinMgr::RegisterChildWindow(); diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 6c3fc9a9bc9e..d03efc06f4ad 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -4013,79 +4013,4 @@ bool SearchableControlIterator::ShouldStepInto(const Reference< XInterface>& /*x return true; } - -SFX_IMPL_MENU_CONTROL(ControlConversionMenuController, SfxBoolItem); - - -ControlConversionMenuController::ControlConversionMenuController( sal_uInt16 _nId, Menu& _rMenu, SfxBindings& _rBindings ) - :SfxMenuControl( _nId, _rBindings ) - ,m_pMainMenu( &_rMenu ) - ,m_pConversionMenu( nullptr ) -{ - if ( _nId == SID_FM_CHANGECONTROLTYPE ) - { - m_pConversionMenu = FmXFormShell::GetConversionMenu(); - _rMenu.SetPopupMenu( _nId, m_pConversionMenu ); - - for (sal_Int16 i=0; i<m_pConversionMenu->GetItemCount(); ++i) - { - _rBindings.Invalidate(m_pConversionMenu->GetItemId(i)); - m_aStatusForwarders.push_back(o3tl::make_unique<SfxStatusForwarder>(m_pConversionMenu->GetItemId(i), *this)); - } - } -} - - -ControlConversionMenuController::~ControlConversionMenuController() -{ - m_pMainMenu->SetPopupMenu(SID_FM_CHANGECONTROLTYPE, nullptr); - delete m_pConversionMenu; -} - - -void ControlConversionMenuController::StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) -{ - if (nSID == GetId()) - SfxMenuControl::StateChanged(nSID, eState, pState); - else if (FmXFormShell::isControlConversionSlot(nSID)) - { - if ((m_pConversionMenu->GetItemPos(nSID) != MENU_ITEM_NOTFOUND) && (eState == SfxItemState::DISABLED)) - { - m_pConversionMenu->RemoveItem(m_pConversionMenu->GetItemPos(nSID)); - } - else if ((m_pConversionMenu->GetItemPos(nSID) == MENU_ITEM_NOTFOUND) && (eState != SfxItemState::DISABLED)) - { - // We can't simply re-insert the item because we have a clear order for all the our items. - // So first we have to determine the position of the item to insert. - std::unique_ptr<PopupMenu> pSource(FmXFormShell::GetConversionMenu()); - sal_uInt16 nSourcePos = pSource->GetItemPos(nSID); - DBG_ASSERT(nSourcePos != MENU_ITEM_NOTFOUND, "ControlConversionMenuController::StateChanged : FmXFormShell supplied an invalid menu !"); - sal_uInt16 nPrevInSource = nSourcePos; - sal_uInt16 nPrevInConversion = MENU_ITEM_NOTFOUND; - while (nPrevInSource>0) - { - sal_Int16 nPrevId = pSource->GetItemId(--nPrevInSource); - - // do we have the source's predecessor in our conversion menu, too ? - nPrevInConversion = m_pConversionMenu->GetItemPos(nPrevId); - if (nPrevInConversion != MENU_ITEM_NOTFOUND) - break; - } - if (MENU_ITEM_NOTFOUND == nPrevInConversion) - // none of the items which precede the nSID-slot in the source menu are present in our conversion menu - nPrevInConversion = sal::static_int_cast< sal_uInt16 >(-1); // put the item at the first position - m_pConversionMenu->InsertItem(nSID, pSource->GetItemText(nSID), - pSource->GetItemBits(nSID), OString(), ++nPrevInConversion); - m_pConversionMenu->SetItemImage(nSID, pSource->GetItemImage(nSID)); - m_pConversionMenu->SetHelpId(nSID, pSource->GetHelpId(nSID)); - } - m_pMainMenu->EnableItem(SID_FM_CHANGECONTROLTYPE, m_pConversionMenu->GetItemCount() > 0); - } - else - { - OSL_FAIL("ControlConversionMenuController::StateChanged : unknown id !"); - } -} - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/fmshimp.hxx b/svx/source/inc/fmshimp.hxx index 81057e8aa294..2743587ed22b 100644 --- a/svx/source/inc/fmshimp.hxx +++ b/svx/source/inc/fmshimp.hxx @@ -46,7 +46,6 @@ #include <svx/svxids.hrc> #include <svl/lstner.hxx> -#include <sfx2/mnuitem.hxx> #include "svx/fmtools.hxx" #include "svx/fmsrccfg.hxx" #include <osl/mutex.hxx> @@ -567,25 +566,6 @@ public: virtual void Invalidate() override { IndexAccessIterator::Invalidate(); m_sCurrentValue.clear(); } }; - -class SVX_DLLPUBLIC ControlConversionMenuController : public SfxMenuControl -{ - ControlConversionMenuController( const ControlConversionMenuController&) = delete; - ControlConversionMenuController& operator =( const ControlConversionMenuController&) = delete; - -protected: - std::vector<std::unique_ptr<SfxStatusForwarder> > m_aStatusForwarders; - Menu* m_pMainMenu; - PopupMenu* m_pConversionMenu; - -public: - SVX_DLLPRIVATE ControlConversionMenuController(sal_uInt16 nId, Menu& rMenu, SfxBindings& rBindings); - SVX_DLLPRIVATE virtual ~ControlConversionMenuController(); - SFX_DECL_MENU_CONTROL(); - - SVX_DLLPRIVATE virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) override; -}; - #endif // INCLUDED_SVX_SOURCE_INC_FMSHIMP_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/ribbar/tbxanchr.cxx b/sw/source/uibase/ribbar/tbxanchr.cxx index deb2b7400822..d3a55457e520 100644 --- a/sw/source/uibase/ribbar/tbxanchr.cxx +++ b/sw/source/uibase/ribbar/tbxanchr.cxx @@ -24,7 +24,6 @@ #include <svl/intitem.hxx> #include <sfx2/dispatch.hxx> #include <vcl/toolbox.hxx> -#include <sfx2/mnumgr.hxx> #include "cmdid.h" #include "docsh.hxx" diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx index 420df7eb1ea0..506e4de330fd 100644 --- a/sw/source/uibase/ribbar/workctrl.cxx +++ b/sw/source/uibase/ribbar/workctrl.cxx @@ -25,7 +25,6 @@ #include <sfx2/dispatch.hxx> #include <sfx2/bindings.hxx> #include <sfx2/imagemgr.hxx> -#include <sfx2/mnumgr.hxx> #include <sfx2/msgpool.hxx> #include <swmodule.hxx> #include <view.hxx> |