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 INCLUDED_SFX2_MNUMGR_HXX
20 : #define INCLUDED_SFX2_MNUMGR_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 : SfxBindings* pBindings;
52 : ResMgr* pResMgr;
53 : sal_uInt32 nType;
54 : bool bAddClipboardFuncs : 1;
55 :
56 : void Construct( SfxVirtualMenu& rMenu );
57 :
58 : protected:
59 : SfxMenuManager( Menu*, SfxBindings& );
60 : ~SfxMenuManager();
61 : sal_uInt16 GetItemPos( sal_uInt16 nId );
62 : sal_uInt32 GetType() { return nType; }
63 : public:
64 :
65 : DECL_LINK( Select, Menu* );
66 :
67 0 : SfxVirtualMenu* GetMenu() const
68 0 : { return pMenu; }
69 :
70 : SfxBindings& GetBindings() { return *pBindings; }
71 : const SfxBindings& GetBindings() const { return *pBindings; }
72 : void SetResMgr(ResMgr* pMgr) {pResMgr = pMgr; }
73 : ResMgr* GetResMgr() const { return pResMgr; }
74 : void SetPopupMenu( sal_uInt16 nId, PopupMenu *pMenu );
75 : };
76 :
77 :
78 :
79 : class SAL_DLLPUBLIC_EXPORT SfxPopupMenuManager : public SfxMenuManager
80 : {
81 : private:
82 : Menu* pSVMenu;
83 :
84 : // when #i107205 gets fixed this one should be superfluous.
85 : // But right now we want to avoid the memory leak that would otherwise occur,
86 : // if we don't delete the pointer that got created in SfxPopupMenuManager::Popup
87 : static PopupMenu * pStaticThesSubMenu;
88 :
89 : // only declared, but not defined: don't allow copying
90 : SfxPopupMenuManager( const SfxPopupMenuManager& );
91 : SfxPopupMenuManager& operator=( const SfxPopupMenuManager& );
92 :
93 : public:
94 : SfxPopupMenuManager( PopupMenu*, SfxBindings& );
95 : ~SfxPopupMenuManager();
96 : static void ExecutePopup( const ResId&, SfxViewFrame* pViewFrame, const Point& rPoint, vcl::Window* pWindow );
97 : // @deprecated!!
98 : // Don't use this method any longer. The whole class will be removed in the future.
99 : // Changing code which relies on Popup would need much more effort.
100 : static SfxPopupMenuManager* Popup( const ResId& rResId, SfxViewFrame* pFrame,const Point& rPoint, vcl::Window* pWindow );
101 :
102 : sal_uInt16 Execute( const Point& rPos, vcl::Window *pWindow );
103 :
104 : void RemoveDisabledEntries();
105 : Menu* GetSVMenu();
106 : };
107 :
108 : #endif // INCLUDED_SFX2_MNUMGR_HXX
109 :
110 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|