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 .
20 #ifndef INCLUDED_FRAMEWORK_INC_UIELEMENT_MENUBARMERGER_HXX
21 #define INCLUDED_FRAMEWORK_INC_UIELEMENT_MENUBARMERGER_HXX
23 #include <com/sun/star/beans/PropertyValue.hpp>
25 #include <rtl/ustring.hxx>
26 #include <vcl/menu.hxx>
32 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
60 namespace MenuBarMerger
62 bool IsCorrectContext( const OUString
& aContext
, const OUString
& aModuleIdentifier
);
64 void RetrieveReferencePath( const OUString
&,
65 std::vector
< OUString
>& aReferencePath
);
66 ReferencePathInfo
FindReferencePath( const std::vector
< OUString
>& aReferencePath
, Menu
* pMenu
);
67 sal_uInt16
FindMenuItem( const OUString
& rCmd
,
69 void GetMenuEntry( const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& rAddonMenuEntry
,
70 AddonMenuItem
& aAddonMenu
);
71 void GetSubMenu( const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
> >& rSubMenuEntries
,
72 AddonMenuContainer
& rSubMenu
);
73 bool ProcessMergeOperation( Menu
* pMenu
,
76 const OUString
& rMergeCommand
,
77 const OUString
& rMergeCommandParameter
,
78 const OUString
& rModuleIdentifier
,
79 const AddonMenuContainer
& rAddonMenuItems
);
80 bool ProcessFallbackOperation( const ReferencePathInfo
& aRefPathInfo
,
82 const OUString
& rMergeCommand
,
83 const OUString
& rMergeFallback
,
84 const ::std::vector
< OUString
>& rReferencePath
,
85 const OUString
& rModuleIdentifier
,
86 const AddonMenuContainer
& rAddonMenuItems
);
87 bool ProcessFallbackOperation();
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 const OUString
& rMergeCommandParameter
);
102 bool CreateSubMenu( Menu
* pSubMenu
,
104 const OUString
& rModuleIdentifier
,
105 const AddonMenuContainer
& rAddonSubMenu
);
108 } // namespace framework
110 #endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_MENUBARMERGER_HXX
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */