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