1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: menubarmerger.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef __FRAMEWORK_UIELEMENT_MENUBARMERGER_HXX_
32 #define __FRAMEWORK_UIELEMENT_MENUBARMERGER_HXX_
34 #include <com/sun/star/beans/PropertyValue.hpp>
36 #include <rtl/ustring.hxx>
37 #include <vcl/menu.hxx>
43 typedef ::std::vector
< AddonMenuItem
> AddonMenuContainer
;
47 ::rtl::OUString aTitle
;
49 ::rtl::OUString aTarget
;
50 ::rtl::OUString aImageId
;
51 ::rtl::OUString aContext
;
52 AddonMenuContainer aSubMenu
;
58 RP_POPUPMENU_NOT_FOUND
,
59 RP_MENUITEM_NOT_FOUND
,
60 RP_MENUITEM_INSTEAD_OF_POPUPMENU_FOUND
63 struct ReferencePathInfo
74 static bool IsCorrectContext( const ::rtl::OUString
& aContext
, const ::rtl::OUString
& aModuleIdentifier
);
76 static void RetrieveReferencePath( const ::rtl::OUString
&,
77 std::vector
< ::rtl::OUString
>& aReferencePath
);
78 static ReferencePathInfo
FindReferencePath( const std::vector
< ::rtl::OUString
>& aReferencePath
, Menu
* pMenu
);
79 static sal_uInt16
FindMenuItem( const ::rtl::OUString
& rCmd
,
81 static void GetMenuEntry( const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& rAddonMenuEntry
,
82 AddonMenuItem
& aAddonMenu
);
83 static void GetSubMenu( const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
> >& rSubMenuEntries
,
84 AddonMenuContainer
& rSubMenu
);
85 static bool ProcessMergeOperation( Menu
* pMenu
,
88 const ::rtl::OUString
& rMergeCommand
,
89 const ::rtl::OUString
& rMergeCommandParameter
,
90 const ::rtl::OUString
& rModuleIdentifier
,
91 const AddonMenuContainer
& rAddonMenuItems
);
92 static bool ProcessFallbackOperation( const ReferencePathInfo
& aRefPathInfo
,
94 const ::rtl::OUString
& rMergeCommand
,
95 const ::rtl::OUString
& rMergeFallback
,
96 const ::std::vector
< ::rtl::OUString
>& rReferencePath
,
97 const ::rtl::OUString
& rModuleIdentifier
,
98 const AddonMenuContainer
& rAddonMenuItems
);
99 static bool ProcessFallbackOperation();
100 static bool MergeMenuItems( Menu
* pMenu
,
102 sal_uInt16 nModIndex
,
104 const ::rtl::OUString
& rModuleIdentifier
,
105 const AddonMenuContainer
& rAddonMenuItems
);
106 static bool ReplaceMenuItem( Menu
* pMenu
,
109 const ::rtl::OUString
& rModuleIdentifier
,
110 const AddonMenuContainer
& rAddonMenuItems
);
111 static bool RemoveMenuItems( Menu
* pMenu
,
113 const ::rtl::OUString
& rMergeCommandParameter
);
114 static bool CreateSubMenu( Menu
* pSubMenu
,
116 const ::rtl::OUString
& rModuleIdentifier
,
117 const AddonMenuContainer
& rAddonSubMenu
);
121 MenuBarMerger( const MenuBarMerger
& );
122 MenuBarMerger
& operator=( const MenuBarMerger
& );
125 } // namespace framework
127 #endif // __FRAMEWORK_UIELEMENT_MENUBARMERGER_HXX_