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 .
22 #include <com/sun/star/beans/PropertyValue.hpp>
24 #include <rtl/ustring.hxx>
25 #include <vcl/menu.hxx>
27 #include <string_view>
34 typedef ::std::vector
< AddonMenuItem
> AddonMenuContainer
;
41 AddonMenuContainer aSubMenu
;
47 RP_POPUPMENU_NOT_FOUND
,
48 RP_MENUITEM_NOT_FOUND
,
49 RP_MENUITEM_INSTEAD_OF_POPUPMENU_FOUND
52 struct ReferencePathInfo
54 VclPtr
<Menu
> pPopupMenu
;
60 namespace MenuBarMerger
62 bool IsCorrectContext(
63 std::u16string_view aContext
, std::u16string_view aModuleIdentifier
);
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
,
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
,
77 std::u16string_view rMergeCommand
,
78 std::u16string_view rMergeCommandParameter
,
79 const OUString
& rModuleIdentifier
,
80 const AddonMenuContainer
& rAddonMenuItems
);
81 bool ProcessFallbackOperation( const ReferencePathInfo
& aRefPathInfo
,
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
,
92 const OUString
& rModuleIdentifier
,
93 const AddonMenuContainer
& rAddonMenuItems
);
94 bool ReplaceMenuItem( Menu
* pMenu
,
97 const OUString
& rModuleIdentifier
,
98 const AddonMenuContainer
& rAddonMenuItems
);
99 bool RemoveMenuItems( Menu
* pMenu
,
101 std::u16string_view rMergeCommandParameter
);
102 bool CreateSubMenu( Menu
* pSubMenu
,
104 const OUString
& rModuleIdentifier
,
105 const AddonMenuContainer
& rAddonSubMenu
);
108 } // namespace framework
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */