Update git submodules
[LibreOffice.git] / framework / inc / addonmenu.hxx
blobd6f244cdca4ad552178037bcde64a722aa91bc3b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
21 #include <rtl/ustring.hxx>
22 #include <vcl/vclptr.hxx>
24 namespace com::sun::star::beans { struct PropertyValue; }
25 namespace com::sun::star::frame { class XFrame; }
26 namespace com::sun::star::uno { template <class E> class Sequence; }
27 namespace com::sun::star::uno { template <typename > class Reference; }
29 class MenuBar;
30 class PopupMenu;
32 #define ADDONMENU_ITEMID_START 2000
33 #define ADDONMENU_ITEMID_END 3000
35 namespace framework
38 class AddonMenuManager
40 public:
41 static bool HasAddonMenuElements();
43 // Check if the context string matches the provided xModel context
44 static bool IsCorrectContext(std::u16string_view rModuleIdentifier, std::u16string_view rContext);
46 // Create the Add-Ons menu
47 static VclPtr<PopupMenu> CreateAddonMenu( const css::uno::Reference< css::frame::XFrame >& rFrame );
49 // Merge the Add-Ons help menu items into the given menu bar at a defined pos
50 static void MergeAddonHelpMenu( const css::uno::Reference< css::frame::XFrame >& rFrame,
51 MenuBar const * pMergeMenuBar );
53 // Merge the addon popup menus into the given menu bar at the provided pos.
54 static void MergeAddonPopupMenus( const css::uno::Reference< css::frame::XFrame >& rFrame,
55 sal_uInt16 nMergeAtPos,
56 MenuBar* pMergeMenuBar );
58 // Returns the next position to insert a menu item/sub menu
59 static sal_uInt16 GetNextPos( sal_uInt16 nPos );
61 // Build up the menu item and sub menu into the provided pCurrentMenu. The sub menus should be of type nSubMenuType.
62 static void BuildMenu( PopupMenu* pCurrentMenu,
63 sal_uInt16 nInsPos,
64 sal_uInt16& nUniqueMenuId,
65 const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& aAddonMenuDefinition,
66 const css::uno::Reference< css::frame::XFrame >& rFrame,
67 const OUString& rModuleIdentifier );
69 // Retrieve the menu entry property values from a sequence
70 static void GetMenuEntry( const css::uno::Sequence< css::beans::PropertyValue >& rAddonMenuEntry,
71 OUString& rTitle,
72 OUString& rURL,
73 OUString& rTarget,
74 OUString& rContext,
75 css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& rAddonSubMenu );
78 } // namespace framework
80 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */