1*353d8f4dSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*353d8f4dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*353d8f4dSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*353d8f4dSAndrew Rist * distributed with this work for additional information 6*353d8f4dSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*353d8f4dSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*353d8f4dSAndrew Rist * "License"); you may not use this file except in compliance 9*353d8f4dSAndrew Rist * with the License. You may obtain a copy of the License at 10*353d8f4dSAndrew Rist * 11*353d8f4dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*353d8f4dSAndrew Rist * 13*353d8f4dSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*353d8f4dSAndrew Rist * software distributed under the License is distributed on an 15*353d8f4dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*353d8f4dSAndrew Rist * KIND, either express or implied. See the License for the 17*353d8f4dSAndrew Rist * specific language governing permissions and limitations 18*353d8f4dSAndrew Rist * under the License. 19*353d8f4dSAndrew Rist * 20*353d8f4dSAndrew Rist *************************************************************/ 21*353d8f4dSAndrew Rist 22*353d8f4dSAndrew Rist 23cdf0e10cSrcweir #ifndef _SFXMNUMGR_HXX 24cdf0e10cSrcweir #define _SFXMNUMGR_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <stdarg.h> 27cdf0e10cSrcweir 28cdf0e10cSrcweir #ifndef _MENU_HXX //autogen //wg. MENU_APPEND !!!! 29cdf0e10cSrcweir #include <vcl/menu.hxx> 30cdf0e10cSrcweir #endif 31cdf0e10cSrcweir #include <tools/wintypes.hxx> 32cdf0e10cSrcweir #include <tools/link.hxx> 33cdf0e10cSrcweir #include <com/sun/star/embed/VerbDescriptor.hpp> 34cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx> 35cdf0e10cSrcweir 36cdf0e10cSrcweir #include <tools/stream.hxx> 37cdf0e10cSrcweir #include <tools/resid.hxx> 38cdf0e10cSrcweir #include <sfx2/sfx.hrc> 39cdf0e10cSrcweir 40cdf0e10cSrcweir class SfxVirtualMenu; 41cdf0e10cSrcweir class SfxPoolItem; 42cdf0e10cSrcweir class SfxBindings; 43cdf0e10cSrcweir class ResMgr; 44cdf0e10cSrcweir class Menu; 45cdf0e10cSrcweir class PopupMenu; 46cdf0e10cSrcweir class SfxBindings; 47cdf0e10cSrcweir class ResId; 48cdf0e10cSrcweir class Point; 49cdf0e10cSrcweir class SfxObjectShell; 50cdf0e10cSrcweir class SfxModule; 51cdf0e10cSrcweir class SfxViewFrame; 52cdf0e10cSrcweir 53cdf0e10cSrcweir class SfxMenuManager 54cdf0e10cSrcweir { 55cdf0e10cSrcweir friend class SfxPopupMenuManager; 56cdf0e10cSrcweir 57cdf0e10cSrcweir SfxVirtualMenu* pMenu; // das eigentliche Menu 58cdf0e10cSrcweir SfxVirtualMenu* pOldMenu; // only while reconfiguring 59cdf0e10cSrcweir sal_Bool bMenuBar; // Popup oder MenuBar 60cdf0e10cSrcweir SfxBindings* pBindings; 61cdf0e10cSrcweir ResMgr* pResMgr; 62cdf0e10cSrcweir sal_uInt32 nType; 63cdf0e10cSrcweir sal_Bool bAddClipboardFuncs : 1; 64cdf0e10cSrcweir 65cdf0e10cSrcweir void Construct( SfxVirtualMenu& rMenu ); 66cdf0e10cSrcweir 67cdf0e10cSrcweir protected: 68cdf0e10cSrcweir SfxMenuManager( Menu*, SfxBindings& ); 69cdf0e10cSrcweir SfxMenuManager( const ResId&, SfxBindings& ); 70cdf0e10cSrcweir ~SfxMenuManager(); 71cdf0e10cSrcweir sal_uInt16 GetItemPos( sal_uInt16 nId ); GetType()72cdf0e10cSrcweir sal_uInt32 GetType() { return nType; } 73cdf0e10cSrcweir public: 74cdf0e10cSrcweir 75cdf0e10cSrcweir void UseDefault(); 76cdf0e10cSrcweir 77cdf0e10cSrcweir DECL_LINK( Select, Menu* ); 78cdf0e10cSrcweir GetMenu() const79cdf0e10cSrcweir SfxVirtualMenu* GetMenu() const 80cdf0e10cSrcweir { return pMenu; } 81cdf0e10cSrcweir GetBindings()82cdf0e10cSrcweir SfxBindings& GetBindings() { return *pBindings; } GetBindings() const83cdf0e10cSrcweir const SfxBindings& GetBindings() const { return *pBindings; } SetResMgr(ResMgr * pMgr)84cdf0e10cSrcweir void SetResMgr(ResMgr* pMgr) {pResMgr = pMgr; } GetResMgr() const85cdf0e10cSrcweir ResMgr* GetResMgr() const { return pResMgr; } 86cdf0e10cSrcweir void SetPopupMenu( sal_uInt16 nId, PopupMenu *pMenu ); 87cdf0e10cSrcweir 88cdf0e10cSrcweir //#if 0 // _SOLAR__PRIVATE 89cdf0e10cSrcweir void Construct_Impl( Menu* pMenu, sal_Bool bWithHelp ); 90cdf0e10cSrcweir //#endif 91cdf0e10cSrcweir }; 92cdf0e10cSrcweir 93cdf0e10cSrcweir //-------------------------------------------------------------------- 94cdf0e10cSrcweir 95cdf0e10cSrcweir class SAL_DLLPUBLIC_EXPORT SfxPopupMenuManager : public SfxMenuManager 96cdf0e10cSrcweir { 97cdf0e10cSrcweir private: 98cdf0e10cSrcweir DECL_LINK( SelectHdl, void * ); 99cdf0e10cSrcweir Menu* pSVMenu; 100cdf0e10cSrcweir 101cdf0e10cSrcweir // when #i107205 gets fixed this one should be superfluous. 102cdf0e10cSrcweir // But right now we want to avoid the memory leak that would otherwise occur, 103cdf0e10cSrcweir // if we don't delete the pointer that got created in SfxPopupMenuManager::Popup 104cdf0e10cSrcweir static PopupMenu * pStaticThesSubMenu; 105cdf0e10cSrcweir 106cdf0e10cSrcweir // only declared, but not defined: don't allow copying 107cdf0e10cSrcweir SfxPopupMenuManager( const SfxPopupMenuManager& ); 108cdf0e10cSrcweir SfxPopupMenuManager& operator=( const SfxPopupMenuManager& ); 109cdf0e10cSrcweir 110cdf0e10cSrcweir public: 111cdf0e10cSrcweir SfxPopupMenuManager( const ResId&, SfxBindings& ); 112cdf0e10cSrcweir SfxPopupMenuManager( PopupMenu*, SfxBindings& ); 113cdf0e10cSrcweir ~SfxPopupMenuManager(); 114cdf0e10cSrcweir static void ExecutePopup( const ResId&, SfxViewFrame* pViewFrame, const Point& rPoint, Window* pWindow ); 115cdf0e10cSrcweir // @deprecated!! 116cdf0e10cSrcweir // Don't use this method any longer. The whole class will be removed in the future. 117cdf0e10cSrcweir // Changing code which relies on Popup would need much more effort. 118cdf0e10cSrcweir // Please contact cd@openoffice.org if you have questions or need help 119cdf0e10cSrcweir static SfxPopupMenuManager* Popup( const ResId& rResId, SfxViewFrame* pFrame,const Point& rPoint, Window* pWindow ); 120cdf0e10cSrcweir 121cdf0e10cSrcweir sal_uInt16 Execute( const Point& rPos, Window *pWindow ); 122cdf0e10cSrcweir sal_uInt16 Execute( const Point& rPoint, Window* pWindow, va_list pArgs, const SfxPoolItem *pArg1 ); 123cdf0e10cSrcweir sal_uInt16 Execute( const Point& rPoint, Window* pWindow, const SfxPoolItem *pArg1 ... ); 124cdf0e10cSrcweir 125cdf0e10cSrcweir // @deprecated (start)!! 126cdf0e10cSrcweir // Don't use these methods any longer. The whole class will be removed in the future. 127cdf0e10cSrcweir // Changing code which relies on these methods would need much more effort! 128cdf0e10cSrcweir // Please contact cd@openoffice.org if you have questions or need help 129cdf0e10cSrcweir void StartInsert(); 130cdf0e10cSrcweir void EndInsert(); 131cdf0e10cSrcweir void CheckItem( sal_uInt16, sal_Bool ); 132cdf0e10cSrcweir void RemoveItem( sal_uInt16 ); 133cdf0e10cSrcweir void InsertItem( sal_uInt16, const String&, MenuItemBits, const rtl::OString& rHelpId, 134cdf0e10cSrcweir sal_uInt16 nPos = MENU_APPEND ); 135cdf0e10cSrcweir void InsertSeparator( sal_uInt16 nPos = MENU_APPEND ); 136cdf0e10cSrcweir // @deprecated (end) 137cdf0e10cSrcweir 138cdf0e10cSrcweir void RemoveDisabledEntries(); 139cdf0e10cSrcweir void AddClipboardFunctions(); 140cdf0e10cSrcweir Menu* GetSVMenu(); 141cdf0e10cSrcweir }; 142cdf0e10cSrcweir 143cdf0e10cSrcweir #endif // #ifndef _SFXMNUMGR_HXX 144cdf0e10cSrcweir 145