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 INCLUDED_FRAMEWORK_ADDONMENU_HXX
20 #define INCLUDED_FRAMEWORK_ADDONMENU_HXX
22 #include <rtl/ustring.hxx>
23 #include <vcl/vclptr.hxx>
25 #include <framework/fwedllapi.h>
27 namespace com::sun::star::beans
{ struct PropertyValue
; }
28 namespace com::sun::star::frame
{ class XFrame
; }
29 namespace com::sun::star::uno
{ template <class E
> class Sequence
; }
30 namespace com::sun::star::uno
{ template <typename
> class Reference
; }
35 #define ADDONMENU_ITEMID_START 2000
36 #define ADDONMENU_ITEMID_END 3000
41 class FWE_DLLPUBLIC AddonMenuManager
44 static bool HasAddonMenuElements();
46 // Check if the context string matches the provided xModel context
47 static bool IsCorrectContext(const OUString
& rModuleIdentifier
, const OUString
& rContext
);
49 // Create the Add-Ons menu
50 static VclPtr
<PopupMenu
> CreateAddonMenu( const css::uno::Reference
< css::frame::XFrame
>& rFrame
);
52 // Merge the Add-Ons help menu items into the given menu bar at a defined pos
53 static void MergeAddonHelpMenu( const css::uno::Reference
< css::frame::XFrame
>& rFrame
,
54 MenuBar
const * pMergeMenuBar
);
56 // Merge the addon popup menus into the given menu bar at the provided pos.
57 static void MergeAddonPopupMenus( const css::uno::Reference
< css::frame::XFrame
>& rFrame
,
58 sal_uInt16 nMergeAtPos
,
59 MenuBar
* pMergeMenuBar
);
61 // Returns the next position to insert a menu item/sub menu
62 static sal_uInt16
GetNextPos( sal_uInt16 nPos
);
64 // Build up the menu item and sub menu into the provided pCurrentMenu. The sub menus should be of type nSubMenuType.
65 static void BuildMenu( PopupMenu
* pCurrentMenu
,
67 sal_uInt16
& nUniqueMenuId
,
68 const css::uno::Sequence
< css::uno::Sequence
< css::beans::PropertyValue
> >& aAddonMenuDefinition
,
69 const css::uno::Reference
< css::frame::XFrame
>& rFrame
,
70 const OUString
& rModuleIdentifier
);
72 // Retrieve the menu entry property values from a sequence
73 static void GetMenuEntry( const css::uno::Sequence
< css::beans::PropertyValue
>& rAddonMenuEntry
,
79 css::uno::Sequence
< css::uno::Sequence
< css::beans::PropertyValue
> >& rAddonSubMenu
);
82 } // namespace framework
84 #endif // INCLUDED_FRAMEWORK_ADDONMENU_HXX
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */