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_UICONFIGURATION_MODULEUICFGSUPPLIER_HXX_ 29 #define __FRAMEWORK_UICONFIGURATION_MODULEUICFGSUPPLIER_HXX_ 30 31 32 /** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble 33 with solaris headers ... 34 */ 35 #include <vector> 36 #include <list> 37 #include <hash_map> 38 39 //_________________________________________________________________________________________________________________ 40 // my own includes 41 //_________________________________________________________________________________________________________________ 42 #include <threadhelp/threadhelpbase.hxx> 43 #include <macros/generic.hxx> 44 #include <macros/xinterface.hxx> 45 #include <macros/xtypeprovider.hxx> 46 #include <macros/xserviceinfo.hxx> 47 #include <stdtypes.h> 48 49 //_________________________________________________________________________________________________________________ 50 // interface includes 51 //_________________________________________________________________________________________________________________ 52 #include <com/sun/star/lang/XServiceInfo.hpp> 53 #include <com/sun/star/lang/XTypeProvider.hpp> 54 #include <com/sun/star/lang/XComponent.hpp> 55 #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> 56 #include <com/sun/star/ui/XUIConfigurationManager.hpp> 57 #include <com/sun/star/frame/XModuleManager.hpp> 58 #include <com/sun/star/embed/XStorage.hpp> 59 #include <com/sun/star/embed/XTransactedObject.hpp> 60 61 //_________________________________________________________________________________________________________________ 62 // other includes 63 //_________________________________________________________________________________________________________________ 64 #include <cppuhelper/weak.hxx> 65 #include <cppuhelper/interfacecontainer.hxx> 66 #include <rtl/ustring.hxx> 67 68 69 namespace framework 70 { 71 class ModuleUIConfigurationManagerSupplier : public com::sun::star::lang::XTypeProvider , 72 public com::sun::star::lang::XServiceInfo , 73 public com::sun::star::lang::XComponent , 74 public ::com::sun::star::ui::XModuleUIConfigurationManagerSupplier , 75 private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. 76 public ::cppu::OWeakObject 77 { 78 public: 79 // XInterface, XTypeProvider, XServiceInfo 80 FWK_DECLARE_XINTERFACE 81 FWK_DECLARE_XTYPEPROVIDER 82 DECLARE_XSERVICEINFO 83 84 ModuleUIConfigurationManagerSupplier( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); 85 virtual ~ModuleUIConfigurationManagerSupplier(); 86 87 // XComponent 88 virtual void SAL_CALL dispose() 89 throw (::com::sun::star::uno::RuntimeException); 90 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) 91 throw (::com::sun::star::uno::RuntimeException); 92 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) 93 throw (::com::sun::star::uno::RuntimeException); 94 95 // XModuleUIConfigurationManagerSupplier 96 virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > SAL_CALL getUIConfigurationManager( const ::rtl::OUString& ModuleIdentifier ) 97 throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); 98 99 private: 100 typedef ::std::hash_map< rtl::OUString, com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager >, OUStringHashCode, ::std::equal_to< rtl::OUString > > ModuleToModuleCfgMgr; 101 102 //TODO_AS void impl_initStorages(); 103 104 // private methods 105 ModuleToModuleCfgMgr m_aModuleToModuleUICfgMgrMap; 106 bool m_bDisposed; 107 // TODO_AS bool m_bInit; 108 rtl::OUString m_aDefaultConfigURL; 109 rtl::OUString m_aUserConfigURL; 110 com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xDefaultCfgRootStorage; 111 com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xUserCfgRootStorage; 112 com::sun::star::uno::Reference< com::sun::star::embed::XTransactedObject > m_xUserRootCommit; 113 com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleMgr; 114 com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; 115 ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener 116 }; 117 } 118 119 #endif // __FRAMEWORK_UICONFIGURATION_MODULEUICFGSUPPLIER_HXX_ 120