LibreOffice Module framework (master) 1
addonmenu.hxx
Go to the documentation of this file.
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#pragma once
20
21#include <rtl/ustring.hxx>
22#include <vcl/vclptr.hxx>
23
24namespace com::sun::star::beans { struct PropertyValue; }
25namespace com::sun::star::frame { class XFrame; }
26namespace com::sun::star::uno { template <class E> class Sequence; }
27namespace com::sun::star::uno { template <typename > class Reference; }
28
29class MenuBar;
30class PopupMenu;
31
32#define ADDONMENU_ITEMID_START 2000
33#define ADDONMENU_ITEMID_END 3000
34
35namespace framework
36{
37
39{
40 public:
41 static bool HasAddonMenuElements();
42
43 // Check if the context string matches the provided xModel context
44 static bool IsCorrectContext(std::u16string_view rModuleIdentifier, std::u16string_view rContext);
45
46 // Create the Add-Ons menu
47 static VclPtr<PopupMenu> CreateAddonMenu( const css::uno::Reference< css::frame::XFrame >& rFrame );
48
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 );
52
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 );
57
58 // Returns the next position to insert a menu item/sub menu
59 static sal_uInt16 GetNextPos( sal_uInt16 nPos );
60
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 );
68
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 );
76};
77
78} // namespace framework
79
80/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static bool HasAddonMenuElements()
Definition: addonmenu.cxx:38
static void MergeAddonPopupMenus(const css::uno::Reference< css::frame::XFrame > &rFrame, sal_uInt16 nMergeAtPos, MenuBar *pMergeMenuBar)
Definition: addonmenu.cxx:134
static void BuildMenu(PopupMenu *pCurrentMenu, sal_uInt16 nInsPos, sal_uInt16 &nUniqueMenuId, const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > &aAddonMenuDefinition, const css::uno::Reference< css::frame::XFrame > &rFrame, const OUString &rModuleIdentifier)
Definition: addonmenu.cxx:187
static bool IsCorrectContext(std::u16string_view rModuleIdentifier, std::u16string_view rContext)
Definition: addonmenu.cxx:284
static void MergeAddonHelpMenu(const css::uno::Reference< css::frame::XFrame > &rFrame, MenuBar const *pMergeMenuBar)
Definition: addonmenu.cxx:89
static VclPtr< PopupMenu > CreateAddonMenu(const css::uno::Reference< css::frame::XFrame > &rFrame)
Definition: addonmenu.cxx:44
static void GetMenuEntry(const css::uno::Sequence< css::beans::PropertyValue > &rAddonMenuEntry, OUString &rTitle, OUString &rURL, OUString &rTarget, OUString &rContext, css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > &rAddonSubMenu)
Definition: addonmenu.cxx:257
static sal_uInt16 GetNextPos(sal_uInt16 nPos)
Definition: addonmenu.cxx:68
FilterGroup & rTarget
sal_uInt16 nPos
Reference