Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef _SFXMNUMGR_HXX
20 : #define _SFXMNUMGR_HXX
21 :
22 : #include <vcl/menu.hxx>
23 : #include <tools/wintypes.hxx>
24 : #include <tools/link.hxx>
25 : #include <com/sun/star/embed/VerbDescriptor.hpp>
26 : #include <com/sun/star/uno/Sequence.hxx>
27 :
28 : #include <tools/stream.hxx>
29 : #include <tools/resid.hxx>
30 : #include <sfx2/sfx.hrc>
31 :
32 : class SfxVirtualMenu;
33 : class SfxPoolItem;
34 : class SfxBindings;
35 : class ResMgr;
36 : class Menu;
37 : class PopupMenu;
38 : class SfxBindings;
39 : class ResId;
40 : class Point;
41 : class SfxObjectShell;
42 : class SfxModule;
43 : class SfxViewFrame;
44 :
45 : class SfxMenuManager
46 : {
47 : friend class SfxPopupMenuManager;
48 :
49 : SfxVirtualMenu* pMenu; // the actual Menu
50 : SfxVirtualMenu* pOldMenu; // only while reconfiguring
51 : bool bMenuBar; // Popup or MenuBar
52 : SfxBindings* pBindings;
53 : ResMgr* pResMgr;
54 : sal_uInt32 nType;
55 : bool bAddClipboardFuncs : 1;
56 :
57 : void Construct( SfxVirtualMenu& rMenu );
58 :
59 : protected:
60 : SfxMenuManager( Menu*, SfxBindings& );
61 : ~SfxMenuManager();
62 : sal_uInt16 GetItemPos( sal_uInt16 nId );
63 : sal_uInt32 GetType() { return nType; }
64 : public:
65 :
66 : DECL_LINK( Select, Menu* );
67 :
68 0 : SfxVirtualMenu* GetMenu() const
69 0 : { return pMenu; }
70 :
71 : SfxBindings& GetBindings() { return *pBindings; }
72 : const SfxBindings& GetBindings() const { return *pBindings; }
73 : void SetResMgr(ResMgr* pMgr) {pResMgr = pMgr; }
74 : ResMgr* GetResMgr() const { return pResMgr; }
75 : void SetPopupMenu( sal_uInt16 nId, PopupMenu *pMenu );
76 : };
77 :
78 :
79 :
80 : class SAL_DLLPUBLIC_EXPORT SfxPopupMenuManager : public SfxMenuManager
81 : {
82 : private:
83 : Menu* pSVMenu;
84 :
85 : // when #i107205 gets fixed this one should be superfluous.
86 : // But right now we want to avoid the memory leak that would otherwise occur,
87 : // if we don't delete the pointer that got created in SfxPopupMenuManager::Popup
88 : static PopupMenu * pStaticThesSubMenu;
89 :
90 : // only declared, but not defined: don't allow copying
91 : SfxPopupMenuManager( const SfxPopupMenuManager& );
92 : SfxPopupMenuManager& operator=( const SfxPopupMenuManager& );
93 :
94 : public:
95 : SfxPopupMenuManager( PopupMenu*, SfxBindings& );
96 : ~SfxPopupMenuManager();
97 : static void ExecutePopup( const ResId&, SfxViewFrame* pViewFrame, const Point& rPoint, Window* pWindow );
98 : // @deprecated!!
99 : // Don't use this method any longer. The whole class will be removed in the future.
100 : // Changing code which relies on Popup would need much more effort.
101 : static SfxPopupMenuManager* Popup( const ResId& rResId, SfxViewFrame* pFrame,const Point& rPoint, Window* pWindow );
102 :
103 : sal_uInt16 Execute( const Point& rPos, Window *pWindow );
104 :
105 : void RemoveDisabledEntries();
106 : Menu* GetSVMenu();
107 : };
108 :
109 : #endif // #ifndef _SFXMNUMGR_HXX
110 :
111 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|