merge the formfield patch from ooo-build
[ooovba.git] / framework / inc / xml / menuconfiguration.hxx
blobf24994bd40da248257a8384e376e0193529ccd00
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: menuconfiguration.hxx,v $
10 * $Revision: 1.6 $
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_XML_MENUCONFIGURATION_HXX_
32 #define __FRAMEWORK_XML_MENUCONFIGURATION_HXX_
34 //_________________________________________________________________________________________________________________
35 // interface includes
36 //_________________________________________________________________________________________________________________
38 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
39 #include <com/sun/star/lang/WrappedTargetException.hpp>
40 #include <com/sun/star/io/XInputStream.hpp>
41 #include <com/sun/star/io/XOutputStream.hpp>
42 #include <com/sun/star/frame/XFrame.hpp>
43 #include <com/sun/star/container/XIndexContainer.hpp>
44 #include <com/sun/star/container/XIndexAccess.hpp>
45 #include <com/sun/star/frame/XDispatchProvider.hpp>
47 //_________________________________________________________________________________________________________________
48 // includes of other projects
49 //_________________________________________________________________________________________________________________
51 #include <cppuhelper/weak.hxx>
52 #include <vcl/menu.hxx>
53 #include <vcl/toolbox.hxx>
55 #define BOOKMARK_NEWMENU ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:menu_bookmark_new" ))
56 #define BOOKMARK_WIZARDMENU ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:menu_bookmark_wizard" ))
57 #define ADDONS_POPUPMENU ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:menu_addons_popup" ))
59 // Prepare for inclusion by framework and sfx
60 // Please consider that there is a corresponding define also in sfxsids.hrc!! (SID_SFX_START)/(SID_ADDONS)
61 #define FWK_SID_SFX_START 5000
62 #define FWK_SID_ADDONS (FWK_SID_SFX_START+1678)
63 #define FWK_SID_ADDONHELP (FWK_SID_SFX_START+1684)
65 const USHORT START_ITEMID_PICKLIST = 4500;
66 const USHORT END_ITEMID_PICKLIST = 4599;
67 const USHORT MAX_ITEMCOUNT_PICKLIST = 99; // difference between START_... & END_... for picklist / must be changed too, if these values are changed!
68 const USHORT START_ITEMID_WINDOWLIST = 4600;
69 const USHORT END_ITEMID_WINDOWLIST = 4699;
70 const USHORT ITEMID_ADDONLIST = FWK_SID_ADDONS;
71 const USHORT ITEMID_ADDONHELP = FWK_SID_ADDONHELP;
73 namespace framework
76 class MenuConfiguration
78 public:
79 struct Attributes
81 Attributes() {}
82 Attributes( const ::rtl::OUString& aFrame, const ::rtl::OUString& aImageIdStr ) :
83 aTargetFrame( aFrame ), aImageId( aImageIdStr ) {}
85 ::rtl::OUString aTargetFrame;
86 ::rtl::OUString aImageId;
87 ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XDispatchProvider > xDispatchProvider;
88 sal_Int16 nStyle;
91 MenuConfiguration(
92 // #110897#-1 use const when giving a uno reference by reference
93 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager );
95 virtual ~MenuConfiguration();
97 ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > CreateMenuBarConfigurationFromXML(
98 ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream )
99 throw ( ::com::sun::star::lang::WrappedTargetException );
101 PopupMenu* CreateBookmarkMenu(
102 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
103 const ::rtl::OUString& aURL )
104 throw ( ::com::sun::star::lang::WrappedTargetException );
106 ToolBox* CreateToolBoxFromConfiguration(
107 ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream )
108 throw ( ::com::sun::star::lang::WrappedTargetException );
110 void StoreMenuBarConfigurationToXML( ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rMenuBarConfiguration,
111 ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream )
112 throw ( ::com::sun::star::lang::WrappedTargetException );
114 void StoreToolBox( ToolBox* pToolBox,
115 ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream )
116 throw ( ::com::sun::star::lang::WrappedTargetException );
118 static BOOL IsPickListItemId( USHORT nId );
119 static BOOL IsWindowListItemId( USHORT nId );
121 private:
122 // #110897#-1 do not hold the uno reference by reference
123 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& m_rxServiceManager;
128 #endif // __FRAMEWORK_XML_MENUCONFIGURATION_HXX_