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