xref: /trunk/main/framework/inc/uiconfiguration/moduleuicfgsupplier.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
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. Otherwise 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 initialization 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             virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener );
86             virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener );
87 
88             // XModuleUIConfigurationManagerSupplier
89             virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > SAL_CALL getUIConfigurationManager( const ::rtl::OUString& ModuleIdentifier );
90 
91         private:
92             typedef ::std::hash_map< rtl::OUString, com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager >, rtl::OUStringHash, ::std::equal_to< rtl::OUString > > ModuleToModuleCfgMgr;
93 
94 //TODO_AS            void impl_initStorages();
95 
96             // private methods
97             ModuleToModuleCfgMgr                                                                m_aModuleToModuleUICfgMgrMap;
98             bool                                                                                m_bDisposed;
99 // TODO_AS            bool                                                                                m_bInit;
100             rtl::OUString                                                                       m_aDefaultConfigURL;
101             rtl::OUString                                                                       m_aUserConfigURL;
102             com::sun::star::uno::Reference< com::sun::star::embed::XStorage >                   m_xDefaultCfgRootStorage;
103             com::sun::star::uno::Reference< com::sun::star::embed::XStorage >                   m_xUserCfgRootStorage;
104             com::sun::star::uno::Reference< com::sun::star::embed::XTransactedObject >          m_xUserRootCommit;
105             com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager >   m_xModuleMgr;
106             com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >        m_xServiceManager;
107             ::cppu::OMultiTypeInterfaceContainerHelper                                          m_aListenerContainer;   /// container for ALL Listener
108    };
109 }
110 
111 #endif // __FRAMEWORK_UICONFIGURATION_MODULEUICFGSUPPLIER_HXX_
112