xref: /aoo42x/main/ucb/source/ucp/file/prov.hxx (revision cdf0e10c)
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 _PROV_HXX_
29 #define _PROV_HXX_
30 
31 #include <cppuhelper/weak.hxx>
32 
33 #include "osl/mutex.hxx"
34 #include <ucbhelper/macros.hxx>
35 #include <com/sun/star/uno/XInterface.hpp>
36 #include <com/sun/star/lang/XTypeProvider.hpp>
37 #include <com/sun/star/lang/XInitialization.hpp>
38 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
39 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
40 #include <com/sun/star/lang/XServiceInfo.hpp>
41 #include <com/sun/star/ucb/XContentProvider.hpp>
42 #include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
43 #include <com/sun/star/beans/XPropertySet.hpp>
44 #include <com/sun/star/ucb/XFileIdentifierConverter.hpp>
45 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
46 
47 // FileProvider
48 
49 
50 
51 namespace fileaccess {
52 
53 	// Forward declaration
54 
55 	class BaseContent;
56 	class shell;
57 
58 	class FileProvider:
59 		public cppu::OWeakObject,
60 		public com::sun::star::lang::XServiceInfo,
61         public com::sun::star::lang::XInitialization,
62 		public com::sun::star::lang::XTypeProvider,
63 		public com::sun::star::ucb::XContentProvider,
64 		public com::sun::star::ucb::XContentIdentifierFactory,
65 		public com::sun::star::beans::XPropertySet,
66 		public com::sun::star::ucb::XFileIdentifierConverter
67 	{
68 		friend class BaseContent;
69 	public:
70 
71 		FileProvider( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xMSF );
72 		~FileProvider();
73 
74 		// XInterface
75 		virtual com::sun::star::uno::Any SAL_CALL
76 		queryInterface(
77 			const com::sun::star::uno::Type& aType )
78 			throw( com::sun::star::uno::RuntimeException);
79 
80 		virtual void SAL_CALL
81 		acquire(
82 			void )
83 			throw();
84 
85 		virtual void SAL_CALL
86 		release(
87 			void )
88 			throw();
89 
90 		// XServiceInfo
91 		virtual rtl::OUString SAL_CALL
92 		getImplementationName(
93 			void )
94 			throw( com::sun::star::uno::RuntimeException );
95 
96 		virtual sal_Bool SAL_CALL
97 		supportsService(
98 			const rtl::OUString& ServiceName )
99 			throw(com::sun::star::uno::RuntimeException );
100 
101 		virtual com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
102 		getSupportedServiceNames(
103 			void )
104 			throw( com::sun::star::uno::RuntimeException );
105 
106 
107 		static com::sun::star::uno::Reference< com::sun::star::lang::XSingleServiceFactory > SAL_CALL
108 		createServiceFactory(
109 			const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxServiceMgr );
110 
111 		static com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL
112 		CreateInstance(
113 			const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xMultiServiceFactory );
114 
115 		// XTypeProvider
116 
117 		XTYPEPROVIDER_DECL()
118 
119         // XInitialization
120         virtual void SAL_CALL
121         initialize(
122             const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
123             throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
124 
125 
126 		// XContentProvider
127 		virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent > SAL_CALL
128 		queryContent(
129 			const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Identifier )
130 			throw( com::sun::star::ucb::IllegalIdentifierException,
131 				   com::sun::star::uno::RuntimeException );
132 
133 		// XContentIdentifierFactory
134 
135 		virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > SAL_CALL
136 		createContentIdentifier(
137 			const rtl::OUString& ContentId )
138 			throw( com::sun::star::uno::RuntimeException );
139 
140 
141 		virtual sal_Int32 SAL_CALL
142 		compareContentIds(
143 			const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Id1,
144 			const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Id2 )
145 			throw( com::sun::star::uno::RuntimeException );
146 
147 		// XProperySet
148 
149 		virtual com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL
150 		getPropertySetInfo(  )
151 			throw( com::sun::star::uno::RuntimeException );
152 
153 		virtual void SAL_CALL
154 		setPropertyValue(
155 			const rtl::OUString& aPropertyName,
156 			const com::sun::star::uno::Any& aValue )
157 			throw( com::sun::star::beans::UnknownPropertyException,
158 				   com::sun::star::beans::PropertyVetoException,
159 				   com::sun::star::lang::IllegalArgumentException,
160 				   com::sun::star::lang::WrappedTargetException,
161 				   com::sun::star::uno::RuntimeException );
162 
163 		virtual com::sun::star::uno::Any SAL_CALL
164 		getPropertyValue(
165 			const rtl::OUString& PropertyName )
166 			throw( com::sun::star::beans::UnknownPropertyException,
167 				   com::sun::star::lang::WrappedTargetException,
168 				   com::sun::star::uno::RuntimeException );
169 
170 		virtual void SAL_CALL
171 		addPropertyChangeListener(
172 			const rtl::OUString& aPropertyName,
173 			const com::sun::star::uno::Reference< com::sun::star::beans::XPropertyChangeListener >& xListener )
174 			throw( com::sun::star::beans::UnknownPropertyException,
175 				   com::sun::star::lang::WrappedTargetException,
176 				   com::sun::star::uno::RuntimeException);
177 
178 		virtual void SAL_CALL
179 		removePropertyChangeListener(
180 			const rtl::OUString& aPropertyName,
181 			const com::sun::star::uno::Reference< com::sun::star::beans::XPropertyChangeListener >& aListener )
182 			throw( com::sun::star::beans::UnknownPropertyException,
183 				   com::sun::star::lang::WrappedTargetException,
184 				   com::sun::star::uno::RuntimeException );
185 
186 		virtual void SAL_CALL
187 		addVetoableChangeListener(
188 			const rtl::OUString& PropertyName,
189 			const com::sun::star::uno::Reference< com::sun::star::beans::XVetoableChangeListener >& aListener )
190 			throw( com::sun::star::beans::UnknownPropertyException,
191 				   com::sun::star::lang::WrappedTargetException,
192 				   com::sun::star::uno::RuntimeException );
193 
194 		virtual void SAL_CALL
195 		removeVetoableChangeListener(
196 			const rtl::OUString& PropertyName,
197 			const com::sun::star::uno::Reference< com::sun::star::beans::XVetoableChangeListener >& aListener )
198 			throw( com::sun::star::beans::UnknownPropertyException,
199 				   com::sun::star::lang::WrappedTargetException,
200 				   com::sun::star::uno::RuntimeException);
201 
202 
203 		// XFileIdentifierConverter
204 
205 		virtual sal_Int32 SAL_CALL
206 		getFileProviderLocality( const rtl::OUString& BaseURL )
207 			throw( com::sun::star::uno::RuntimeException );
208 
209 		virtual rtl::OUString SAL_CALL getFileURLFromSystemPath( const rtl::OUString& BaseURL,
210 																 const rtl::OUString& SystemPath )
211 			throw( com::sun::star::uno::RuntimeException );
212 
213 		virtual rtl::OUString SAL_CALL getSystemPathFromFileURL( const rtl::OUString& URL )
214 			throw( com::sun::star::uno::RuntimeException );
215 
216 
217 	private:
218         // methods
219         void SAL_CALL init();
220 
221 		// Members
222 		com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >  m_xMultiServiceFactory;
223 
224 		void SAL_CALL initProperties( void );
225 		osl::Mutex   m_aMutex;
226 		rtl::OUString m_HostName;
227 		rtl::OUString m_HomeDirectory;
228 		sal_Int32     m_FileSystemNotation;
229 
230 		com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo >     m_xPropertySetInfo;
231 
232 		shell*                                                                        m_pMyShell;
233 	};
234 
235 }       // end namespace fileaccess
236 
237 #endif
238 
239