1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef __FRAMEWORK_UIELEMENT_MENUBARWRAPPER_HXX_ 29 #define __FRAMEWORK_UIELEMENT_MENUBARWRAPPER_HXX_ 30 31 //_________________________________________________________________________________________________________________ 32 // my own includes 33 //_________________________________________________________________________________________________________________ 34 35 #include <helper/uiconfigelementwrapperbase.hxx> 36 #include <uielement/menubarmanager.hxx> 37 38 //_________________________________________________________________________________________________________________ 39 // interface includes 40 //_________________________________________________________________________________________________________________ 41 #include <com/sun/star/frame/XFrame.hpp> 42 #include <com/sun/star/frame/XDispatchProvider.hpp> 43 #include <com/sun/star/lang/XComponent.hpp> 44 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 45 #ifndef __COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ 46 #include <com/sun/star/container/XNameAccess.hpp> 47 #endif 48 49 //_________________________________________________________________________________________________________________ 50 // other includes 51 //_________________________________________________________________________________________________________________ 52 53 #include <hash_map> 54 55 namespace framework 56 { 57 58 class MenuBarWrapper : public UIConfigElementWrapperBase, 59 public ::com::sun::star::container::XNameAccess 60 61 { 62 public: 63 // #110897# 64 MenuBarWrapper( 65 const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); 66 virtual ~MenuBarWrapper(); 67 68 //--------------------------------------------------------------------------------------------------------- 69 // XInterface, XTypeProvider 70 //--------------------------------------------------------------------------------------------------------- 71 FWK_DECLARE_XINTERFACE 72 FWK_DECLARE_XTYPEPROVIDER 73 74 MenuBarManager* GetMenuBarManager() const { return static_cast< MenuBarManager* >( m_xMenuBarManager.get() ); } 75 void InvalidatePopupControllerCache() { m_bRefreshPopupControllerCache = sal_True; } 76 77 // XComponent 78 virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); 79 80 // XInitialization 81 virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); 82 83 // XUIElement 84 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface() throw (::com::sun::star::uno::RuntimeException); 85 86 // XUIElementSettings 87 virtual void SAL_CALL updateSettings( ) throw (::com::sun::star::uno::RuntimeException); 88 89 // XElementAccess 90 virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw (::com::sun::star::uno::RuntimeException); 91 virtual ::sal_Bool SAL_CALL hasElements() throw (::com::sun::star::uno::RuntimeException); 92 93 // XNameAccess 94 virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 95 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw (::com::sun::star::uno::RuntimeException); 96 virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); 97 98 private: 99 virtual void impl_fillNewData(); 100 void fillPopupControllerCache(); 101 102 sal_Bool m_bRefreshPopupControllerCache : 1; 103 com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xMenuBarManager; 104 PopupControllerCache m_aPopupControllerCache; 105 }; 106 107 } // namespace framework 108 109 #endif // __FRAMEWORK_UIELEMENT_MENUBARWRAPPER_HXX_ 110