1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef __FRAMEWORK_XML_MENUCONFIGURATION_HXX_ 29*cdf0e10cSrcweir #define __FRAMEWORK_XML_MENUCONFIGURATION_HXX_ 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 32*cdf0e10cSrcweir // interface includes 33*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/lang/WrappedTargetException.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/io/XInputStream.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/io/XOutputStream.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/container/XIndexContainer.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/container/XIndexAccess.hpp> 42*cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProvider.hpp> 43*cdf0e10cSrcweir #include <framework/fwedllapi.h> 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 46*cdf0e10cSrcweir // includes of other projects 47*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir #include <cppuhelper/weak.hxx> 50*cdf0e10cSrcweir #include <vcl/menu.hxx> 51*cdf0e10cSrcweir #include <vcl/toolbox.hxx> 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir #define BOOKMARK_NEWMENU ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:menu_bookmark_new" )) 54*cdf0e10cSrcweir #define BOOKMARK_WIZARDMENU ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:menu_bookmark_wizard" )) 55*cdf0e10cSrcweir #define ADDONS_POPUPMENU ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:menu_addons_popup" )) 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir // Prepare for inclusion by framework and sfx 58*cdf0e10cSrcweir // Please consider that there is a corresponding define also in sfxsids.hrc!! (SID_SFX_START)/(SID_ADDONS) 59*cdf0e10cSrcweir #define FWK_SID_SFX_START 5000 60*cdf0e10cSrcweir #define FWK_SID_ADDONS (FWK_SID_SFX_START+1678) 61*cdf0e10cSrcweir #define FWK_SID_ADDONHELP (FWK_SID_SFX_START+1684) 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir const sal_uInt16 START_ITEMID_PICKLIST = 4500; 64*cdf0e10cSrcweir const sal_uInt16 END_ITEMID_PICKLIST = 4599; 65*cdf0e10cSrcweir const sal_uInt16 MAX_ITEMCOUNT_PICKLIST = 99; // difference between START_... & END_... for picklist / must be changed too, if these values are changed! 66*cdf0e10cSrcweir const sal_uInt16 START_ITEMID_WINDOWLIST = 4600; 67*cdf0e10cSrcweir const sal_uInt16 END_ITEMID_WINDOWLIST = 4699; 68*cdf0e10cSrcweir const sal_uInt16 ITEMID_ADDONLIST = FWK_SID_ADDONS; 69*cdf0e10cSrcweir const sal_uInt16 ITEMID_ADDONHELP = FWK_SID_ADDONHELP; 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir namespace framework 72*cdf0e10cSrcweir { 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir class FWE_DLLPUBLIC MenuConfiguration 75*cdf0e10cSrcweir { 76*cdf0e10cSrcweir public: 77*cdf0e10cSrcweir struct Attributes 78*cdf0e10cSrcweir { 79*cdf0e10cSrcweir Attributes() {} 80*cdf0e10cSrcweir Attributes( const ::rtl::OUString& aFrame, const ::rtl::OUString& aImageIdStr ) : 81*cdf0e10cSrcweir aTargetFrame( aFrame ), aImageId( aImageIdStr ) {} 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir ::rtl::OUString aTargetFrame; 84*cdf0e10cSrcweir ::rtl::OUString aImageId; 85*cdf0e10cSrcweir ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XDispatchProvider > xDispatchProvider; 86*cdf0e10cSrcweir sal_Int16 nStyle; 87*cdf0e10cSrcweir }; 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir MenuConfiguration( 90*cdf0e10cSrcweir // #110897#-1 use const when giving a uno reference by reference 91*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir virtual ~MenuConfiguration(); 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > CreateMenuBarConfigurationFromXML( 96*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream ) 97*cdf0e10cSrcweir throw ( ::com::sun::star::lang::WrappedTargetException ); 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir PopupMenu* CreateBookmarkMenu( 100*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, 101*cdf0e10cSrcweir const ::rtl::OUString& aURL ) 102*cdf0e10cSrcweir throw ( ::com::sun::star::lang::WrappedTargetException ); 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir ToolBox* CreateToolBoxFromConfiguration( 105*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream ) 106*cdf0e10cSrcweir throw ( ::com::sun::star::lang::WrappedTargetException ); 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir void StoreMenuBarConfigurationToXML( ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rMenuBarConfiguration, 109*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream ) 110*cdf0e10cSrcweir throw ( ::com::sun::star::lang::WrappedTargetException ); 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir void StoreToolBox( ToolBox* pToolBox, 113*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream ) 114*cdf0e10cSrcweir throw ( ::com::sun::star::lang::WrappedTargetException ); 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir static sal_Bool IsPickListItemId( sal_uInt16 nId ); 117*cdf0e10cSrcweir static sal_Bool IsWindowListItemId( sal_uInt16 nId ); 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir private: 120*cdf0e10cSrcweir // #110897#-1 do not hold the uno reference by reference 121*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& m_rxServiceManager; 122*cdf0e10cSrcweir }; 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir } 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir #endif // __FRAMEWORK_XML_MENUCONFIGURATION_HXX_ 127