xref: /AOO41X/main/framework/inc/framework/menuconfiguration.hxx (revision f8e07b45f7e1fb69563504f404bb0b75210f0be6)
1*f8e07b45SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f8e07b45SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f8e07b45SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f8e07b45SAndrew Rist  * distributed with this work for additional information
6*f8e07b45SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f8e07b45SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f8e07b45SAndrew Rist  * "License"); you may not use this file except in compliance
9*f8e07b45SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*f8e07b45SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*f8e07b45SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f8e07b45SAndrew Rist  * software distributed under the License is distributed on an
15*f8e07b45SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f8e07b45SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f8e07b45SAndrew Rist  * specific language governing permissions and limitations
18*f8e07b45SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*f8e07b45SAndrew Rist  *************************************************************/
21*f8e07b45SAndrew Rist 
22*f8e07b45SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef __FRAMEWORK_XML_MENUCONFIGURATION_HXX_
25cdf0e10cSrcweir #define __FRAMEWORK_XML_MENUCONFIGURATION_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //_________________________________________________________________________________________________________________
28cdf0e10cSrcweir //	interface includes
29cdf0e10cSrcweir //_________________________________________________________________________________________________________________
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
32cdf0e10cSrcweir #include <com/sun/star/lang/WrappedTargetException.hpp>
33cdf0e10cSrcweir #include <com/sun/star/io/XInputStream.hpp>
34cdf0e10cSrcweir #include <com/sun/star/io/XOutputStream.hpp>
35cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp>
36cdf0e10cSrcweir #include <com/sun/star/container/XIndexContainer.hpp>
37cdf0e10cSrcweir #include <com/sun/star/container/XIndexAccess.hpp>
38cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProvider.hpp>
39cdf0e10cSrcweir #include <framework/fwedllapi.h>
40cdf0e10cSrcweir 
41cdf0e10cSrcweir //_________________________________________________________________________________________________________________
42cdf0e10cSrcweir //	includes of other projects
43cdf0e10cSrcweir //_________________________________________________________________________________________________________________
44cdf0e10cSrcweir 
45cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
46cdf0e10cSrcweir #include <vcl/menu.hxx>
47cdf0e10cSrcweir #include <vcl/toolbox.hxx>
48cdf0e10cSrcweir 
49cdf0e10cSrcweir #define BOOKMARK_NEWMENU		::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:menu_bookmark_new" ))
50cdf0e10cSrcweir #define BOOKMARK_WIZARDMENU		::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:menu_bookmark_wizard" ))
51cdf0e10cSrcweir #define ADDONS_POPUPMENU		::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:menu_addons_popup" ))
52cdf0e10cSrcweir 
53cdf0e10cSrcweir // Prepare for inclusion by framework and sfx
54cdf0e10cSrcweir // Please consider that there is a corresponding define also in sfxsids.hrc!! (SID_SFX_START)/(SID_ADDONS)
55cdf0e10cSrcweir #define FWK_SID_SFX_START 5000
56cdf0e10cSrcweir #define FWK_SID_ADDONS (FWK_SID_SFX_START+1678)
57cdf0e10cSrcweir #define FWK_SID_ADDONHELP (FWK_SID_SFX_START+1684)
58cdf0e10cSrcweir 
59cdf0e10cSrcweir const sal_uInt16 START_ITEMID_PICKLIST		= 4500;
60cdf0e10cSrcweir const sal_uInt16 END_ITEMID_PICKLIST        = 4599;
61cdf0e10cSrcweir const sal_uInt16 MAX_ITEMCOUNT_PICKLIST     =   99; // difference between START_... & END_... for picklist / must be changed too, if these values are changed!
62cdf0e10cSrcweir const sal_uInt16 START_ITEMID_WINDOWLIST	= 4600;
63cdf0e10cSrcweir const sal_uInt16 END_ITEMID_WINDOWLIST		= 4699;
64cdf0e10cSrcweir const sal_uInt16 ITEMID_ADDONLIST			= FWK_SID_ADDONS;
65cdf0e10cSrcweir const sal_uInt16 ITEMID_ADDONHELP			= FWK_SID_ADDONHELP;
66cdf0e10cSrcweir 
67cdf0e10cSrcweir namespace framework
68cdf0e10cSrcweir {
69cdf0e10cSrcweir 
70cdf0e10cSrcweir class FWE_DLLPUBLIC MenuConfiguration
71cdf0e10cSrcweir {
72cdf0e10cSrcweir 	public:
73cdf0e10cSrcweir 		struct Attributes
74cdf0e10cSrcweir 		{
Attributesframework::MenuConfiguration::Attributes75cdf0e10cSrcweir             Attributes() {}
Attributesframework::MenuConfiguration::Attributes76cdf0e10cSrcweir 			Attributes( const ::rtl::OUString& aFrame, const ::rtl::OUString& aImageIdStr ) :
77cdf0e10cSrcweir 			    aTargetFrame( aFrame ), aImageId( aImageIdStr ) {}
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 			::rtl::OUString aTargetFrame;
80cdf0e10cSrcweir 			::rtl::OUString	aImageId;
81cdf0e10cSrcweir             ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XDispatchProvider > xDispatchProvider;
82cdf0e10cSrcweir                         sal_Int16 nStyle;
83cdf0e10cSrcweir 		};
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 		MenuConfiguration(
86cdf0e10cSrcweir 			// #110897#-1 use const when giving a uno reference by reference
87cdf0e10cSrcweir 			const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 		virtual ~MenuConfiguration();
90cdf0e10cSrcweir 
91cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > CreateMenuBarConfigurationFromXML(
92cdf0e10cSrcweir 			::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream )
93cdf0e10cSrcweir 			throw ( ::com::sun::star::lang::WrappedTargetException );
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 		PopupMenu* CreateBookmarkMenu(
96cdf0e10cSrcweir 				::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
97cdf0e10cSrcweir 				const ::rtl::OUString& aURL )
98cdf0e10cSrcweir 			throw ( ::com::sun::star::lang::WrappedTargetException );
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 		ToolBox* CreateToolBoxFromConfiguration(
101cdf0e10cSrcweir 			::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream )
102cdf0e10cSrcweir 			throw ( ::com::sun::star::lang::WrappedTargetException );
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 		void StoreMenuBarConfigurationToXML( ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rMenuBarConfiguration,
105cdf0e10cSrcweir 					  ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream )
106cdf0e10cSrcweir 			throw ( ::com::sun::star::lang::WrappedTargetException );
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 		void StoreToolBox( ToolBox* pToolBox,
109cdf0e10cSrcweir 					  ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream )
110cdf0e10cSrcweir 			throw ( ::com::sun::star::lang::WrappedTargetException );
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 		static sal_Bool IsPickListItemId( sal_uInt16 nId );
113cdf0e10cSrcweir 		static sal_Bool IsWindowListItemId( sal_uInt16 nId );
114cdf0e10cSrcweir 
115cdf0e10cSrcweir 	private:
116cdf0e10cSrcweir 		// #110897#-1 do not hold the uno reference by reference
117cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& m_rxServiceManager;
118cdf0e10cSrcweir };
119cdf0e10cSrcweir 
120cdf0e10cSrcweir }
121cdf0e10cSrcweir 
122cdf0e10cSrcweir #endif // __FRAMEWORK_XML_MENUCONFIGURATION_HXX_
123