LibreOffice Module framework (master) 1
menubarmerger.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
20#pragma once
21
22#include <com/sun/star/beans/PropertyValue.hpp>
23
24#include <rtl/ustring.hxx>
25#include <vcl/menu.hxx>
26
27#include <string_view>
28#include <vector>
29
30namespace framework
31{
32
33struct AddonMenuItem;
34typedef ::std::vector< AddonMenuItem > AddonMenuContainer;
35
37{
38 OUString aTitle;
39 OUString aURL;
40 OUString aContext;
42};
43
45{
50};
51
53{
55 sal_uInt16 nPos;
56 sal_Int32 nLevel;
58};
59
60namespace MenuBarMerger
61{
63 std::u16string_view aContext, std::u16string_view aModuleIdentifier );
64
65 void RetrieveReferencePath( std::u16string_view,
66 std::vector< OUString >& aReferencePath );
67 ReferencePathInfo FindReferencePath( const std::vector< OUString >& aReferencePath, Menu* pMenu );
68 sal_uInt16 FindMenuItem( std::u16string_view rCmd,
69 Menu const * pMenu );
70 void GetMenuEntry( const css::uno::Sequence< css::beans::PropertyValue >& rAddonMenuEntry,
71 AddonMenuItem& aAddonMenu );
72 void GetSubMenu( const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > >& rSubMenuEntries,
73 AddonMenuContainer& rSubMenu );
74 bool ProcessMergeOperation( Menu* pMenu,
75 sal_uInt16 nPos,
76 sal_uInt16& rItemId,
77 std::u16string_view rMergeCommand,
78 std::u16string_view rMergeCommandParameter,
79 const OUString& rModuleIdentifier,
80 const AddonMenuContainer& rAddonMenuItems );
81 bool ProcessFallbackOperation( const ReferencePathInfo& aRefPathInfo,
82 sal_uInt16& rItemId,
83 std::u16string_view rMergeCommand,
84 std::u16string_view rMergeFallback,
85 const ::std::vector< OUString >& rReferencePath,
86 std::u16string_view rModuleIdentifier,
87 const AddonMenuContainer& rAddonMenuItems );
88 bool MergeMenuItems( Menu* pMenu,
89 sal_uInt16 nPos,
90 sal_uInt16 nModIndex,
91 sal_uInt16& rItemId,
92 const OUString& rModuleIdentifier,
93 const AddonMenuContainer& rAddonMenuItems );
94 bool ReplaceMenuItem( Menu* pMenu,
95 sal_uInt16 nPos,
96 sal_uInt16& rItemId,
97 const OUString& rModuleIdentifier,
98 const AddonMenuContainer& rAddonMenuItems );
99 bool RemoveMenuItems( Menu* pMenu,
100 sal_uInt16 nPos,
101 std::u16string_view rMergeCommandParameter );
102 bool CreateSubMenu( Menu* pSubMenu,
103 sal_uInt16& nItemId,
104 const OUString& rModuleIdentifier,
105 const AddonMenuContainer& rAddonSubMenu );
106}
107
108} // namespace framework
109
110/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool ProcessFallbackOperation(const ReferencePathInfo &aRefPathInfo, sal_uInt16 &rItemId, std::u16string_view rMergeCommand, std::u16string_view rMergeFallback, const ::std::vector< OUString > &rReferencePath, std::u16string_view rModuleIdentifier, const AddonMenuContainer &rAddonMenuItems)
void GetSubMenu(const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > &rSubMenuEntries, AddonMenuContainer &rSubMenu)
bool ProcessMergeOperation(Menu *pMenu, sal_uInt16 nPos, sal_uInt16 &rItemId, std::u16string_view rMergeCommand, std::u16string_view rMergeCommandParameter, const OUString &rModuleIdentifier, const AddonMenuContainer &rAddonMenuItems)
bool MergeMenuItems(Menu *pMenu, sal_uInt16 nPos, sal_uInt16 nModIndex, sal_uInt16 &rItemId, const OUString &rModuleIdentifier, const AddonMenuContainer &rAddonMenuItems)
sal_uInt16 FindMenuItem(std::u16string_view rCmd, Menu const *pMenu)
bool ReplaceMenuItem(Menu *pMenu, sal_uInt16 nPos, sal_uInt16 &rItemId, const OUString &rModuleIdentifier, const AddonMenuContainer &rAddonMenuItems)
void GetMenuEntry(const css::uno::Sequence< css::beans::PropertyValue > &rAddonMenuEntry, AddonMenuItem &aAddonMenu)
bool RemoveMenuItems(Menu *pMenu, sal_uInt16 nPos, std::u16string_view rMergeCommandParameter)
bool IsCorrectContext(std::u16string_view aContext, std::u16string_view aModuleIdentifier)
Check whether a module identifier is part of a context defined by a colon separated list of module id...
void RetrieveReferencePath(std::u16string_view, std::vector< OUString > &aReferencePath)
bool CreateSubMenu(Menu *pSubMenu, sal_uInt16 &nItemId, const OUString &rModuleIdentifier, const AddonMenuContainer &rAddonSubMenu)
ReferencePathInfo FindReferencePath(const std::vector< OUString > &aReferencePath, Menu *pMenu)
::std::vector< AddonMenuItem > AddonMenuContainer
@ RP_MENUITEM_NOT_FOUND
@ RP_POPUPMENU_NOT_FOUND
@ RP_MENUITEM_INSTEAD_OF_POPUPMENU_FOUND
AddonMenuContainer aSubMenu