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