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 _HIERARCHYDATASOURCE_HXX
25 #define _HIERARCHYDATASOURCE_HXX
26 
27 #include <osl/mutex.hxx>
28 #include <com/sun/star/lang/XComponent.hpp>
29 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
30 #include <com/sun/star/lang/XServiceInfo.hpp>
31 #include <com/sun/star/lang/XTypeProvider.hpp>
32 #include <cppuhelper/weak.hxx>
33 #include <ucbhelper/macros.hxx>
34 
35 namespace cppu { class OInterfaceContainerHelper; }
36 
37 namespace hierarchy_ucp {
38 
39 //=========================================================================
40 
41 class HierarchyDataSource : public cppu::OWeakObject,
42                             public com::sun::star::lang::XServiceInfo,
43                             public com::sun::star::lang::XTypeProvider,
44                             public com::sun::star::lang::XComponent,
45                             public com::sun::star::lang::XMultiServiceFactory
46 {
47     osl::Mutex m_aMutex;
48     com::sun::star::uno::Reference<
49         com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
50     com::sun::star::uno::Reference<
51         com::sun::star::lang::XMultiServiceFactory > m_xConfigProvider;
52     cppu::OInterfaceContainerHelper * m_pDisposeEventListeners;
53 
54 public:
55     HierarchyDataSource( const com::sun::star::uno::Reference<
56                             com::sun::star::lang::XMultiServiceFactory > &
57                                 rxServiceMgr );
58     virtual ~HierarchyDataSource();
59 
60 	// XInterface
61 	XINTERFACE_DECL()
62 
63     // XServiceInfo
64 	XSERVICEINFO_DECL()
65 
66 	// XTypeProvider
67 	XTYPEPROVIDER_DECL()
68 
69     // XComponent
70     virtual void SAL_CALL
71     dispose()
72         throw ( com::sun::star::uno::RuntimeException );
73     virtual void SAL_CALL
74     addEventListener( const com::sun::star::uno::Reference<
75                         com::sun::star::lang::XEventListener > & xListener )
76         throw ( com::sun::star::uno::RuntimeException );
77     virtual void SAL_CALL
78     removeEventListener( const com::sun::star::uno::Reference<
79                             com::sun::star::lang::XEventListener > & aListener )
80         throw ( com::sun::star::uno::RuntimeException );
81 
82     // XMultiServiceFactory
83     virtual com::sun::star::uno::Reference<
84         com::sun::star::uno::XInterface > SAL_CALL
85     createInstance( const rtl::OUString & aServiceSpecifier )
86         throw ( com::sun::star::uno::Exception,
87                 com::sun::star::uno::RuntimeException );
88     virtual com::sun::star::uno::Reference<
89         com::sun::star::uno::XInterface > SAL_CALL
90     createInstanceWithArguments( const rtl::OUString & ServiceSpecifier,
91                                  const com::sun::star::uno::Sequence<
92                                     com::sun::star::uno::Any > & Arguments )
93         throw ( com::sun::star::uno::Exception,
94                 com::sun::star::uno::RuntimeException );
95     virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
96     getAvailableServiceNames()
97         throw ( com::sun::star::uno::RuntimeException );
98 
99 	// Non-Interface methods
100 
101 private:
102     com::sun::star::uno::Reference<
103         com::sun::star::uno::XInterface > SAL_CALL
104     createInstanceWithArguments( const rtl::OUString & ServiceSpecifier,
105                                  const com::sun::star::uno::Sequence<
106                                     com::sun::star::uno::Any > & Arguments,
107                                  bool bCheckArgs )
108         throw ( com::sun::star::uno::Exception,
109                 com::sun::star::uno::RuntimeException );
110 
111     com::sun::star::uno::Reference<
112         com::sun::star::lang::XMultiServiceFactory >
113     getConfigProvider();
114 
115     bool
116     createConfigPath( const rtl::OUString & rInPath, rtl::OUString & rOutPath );
117 };
118 
119 } // namespace hierarchy_ucp
120 
121 #endif /* !_HIERARCHYDATASOURCE_HXX */
122