1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef _SFXMNUMGR_HXX
20 #define _SFXMNUMGR_HXX
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>
28 #include <tools/stream.hxx>
29 #include <tools/resid.hxx>
30 #include <sfx2/sfx.hrc>
47 friend class SfxPopupMenuManager
;
49 SfxVirtualMenu
* pMenu
; // the actual Menu
50 SfxVirtualMenu
* pOldMenu
; // only while reconfiguring
51 sal_Bool bMenuBar
; // Popup or MenuBar
52 SfxBindings
* pBindings
;
55 sal_Bool bAddClipboardFuncs
: 1;
57 void Construct( SfxVirtualMenu
& rMenu
);
60 SfxMenuManager( Menu
*, SfxBindings
& );
62 sal_uInt16
GetItemPos( sal_uInt16 nId
);
63 sal_uInt32
GetType() { return nType
; }
66 DECL_LINK( Select
, Menu
* );
68 SfxVirtualMenu
* GetMenu() const
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
);
78 //--------------------------------------------------------------------
80 class SAL_DLLPUBLIC_EXPORT SfxPopupMenuManager
: public SfxMenuManager
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
;
90 // only declared, but not defined: don't allow copying
91 SfxPopupMenuManager( const SfxPopupMenuManager
& );
92 SfxPopupMenuManager
& operator=( const SfxPopupMenuManager
& );
95 SfxPopupMenuManager( PopupMenu
*, SfxBindings
& );
96 ~SfxPopupMenuManager();
97 static void ExecutePopup( const ResId
&, SfxViewFrame
* pViewFrame
, const Point
& rPoint
, Window
* pWindow
);
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
);
103 sal_uInt16
Execute( const Point
& rPos
, Window
*pWindow
);
105 void RemoveDisabledEntries();
109 #endif // #ifndef _SFXMNUMGR_HXX
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */