xref: /aoo42x/main/ucb/source/ucp/file/prov.hxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _PROV_HXX_
29*cdf0e10cSrcweir #define _PROV_HXX_
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #include "osl/mutex.hxx"
34*cdf0e10cSrcweir #include <ucbhelper/macros.hxx>
35*cdf0e10cSrcweir #include <com/sun/star/uno/XInterface.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/lang/XTypeProvider.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
40*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
41*cdf0e10cSrcweir #include <com/sun/star/ucb/XContentProvider.hpp>
42*cdf0e10cSrcweir #include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
43*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
44*cdf0e10cSrcweir #include <com/sun/star/ucb/XFileIdentifierConverter.hpp>
45*cdf0e10cSrcweir #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir // FileProvider
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir namespace fileaccess {
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir 	// Forward declaration
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir 	class BaseContent;
56*cdf0e10cSrcweir 	class shell;
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir 	class FileProvider:
59*cdf0e10cSrcweir 		public cppu::OWeakObject,
60*cdf0e10cSrcweir 		public com::sun::star::lang::XServiceInfo,
61*cdf0e10cSrcweir         public com::sun::star::lang::XInitialization,
62*cdf0e10cSrcweir 		public com::sun::star::lang::XTypeProvider,
63*cdf0e10cSrcweir 		public com::sun::star::ucb::XContentProvider,
64*cdf0e10cSrcweir 		public com::sun::star::ucb::XContentIdentifierFactory,
65*cdf0e10cSrcweir 		public com::sun::star::beans::XPropertySet,
66*cdf0e10cSrcweir 		public com::sun::star::ucb::XFileIdentifierConverter
67*cdf0e10cSrcweir 	{
68*cdf0e10cSrcweir 		friend class BaseContent;
69*cdf0e10cSrcweir 	public:
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir 		FileProvider( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xMSF );
72*cdf0e10cSrcweir 		~FileProvider();
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir 		// XInterface
75*cdf0e10cSrcweir 		virtual com::sun::star::uno::Any SAL_CALL
76*cdf0e10cSrcweir 		queryInterface(
77*cdf0e10cSrcweir 			const com::sun::star::uno::Type& aType )
78*cdf0e10cSrcweir 			throw( com::sun::star::uno::RuntimeException);
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir 		virtual void SAL_CALL
81*cdf0e10cSrcweir 		acquire(
82*cdf0e10cSrcweir 			void )
83*cdf0e10cSrcweir 			throw();
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir 		virtual void SAL_CALL
86*cdf0e10cSrcweir 		release(
87*cdf0e10cSrcweir 			void )
88*cdf0e10cSrcweir 			throw();
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir 		// XServiceInfo
91*cdf0e10cSrcweir 		virtual rtl::OUString SAL_CALL
92*cdf0e10cSrcweir 		getImplementationName(
93*cdf0e10cSrcweir 			void )
94*cdf0e10cSrcweir 			throw( com::sun::star::uno::RuntimeException );
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir 		virtual sal_Bool SAL_CALL
97*cdf0e10cSrcweir 		supportsService(
98*cdf0e10cSrcweir 			const rtl::OUString& ServiceName )
99*cdf0e10cSrcweir 			throw(com::sun::star::uno::RuntimeException );
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir 		virtual com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
102*cdf0e10cSrcweir 		getSupportedServiceNames(
103*cdf0e10cSrcweir 			void )
104*cdf0e10cSrcweir 			throw( com::sun::star::uno::RuntimeException );
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir 		static com::sun::star::uno::Reference< com::sun::star::lang::XSingleServiceFactory > SAL_CALL
108*cdf0e10cSrcweir 		createServiceFactory(
109*cdf0e10cSrcweir 			const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxServiceMgr );
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir 		static com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL
112*cdf0e10cSrcweir 		CreateInstance(
113*cdf0e10cSrcweir 			const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xMultiServiceFactory );
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir 		// XTypeProvider
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir 		XTYPEPROVIDER_DECL()
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir         // XInitialization
120*cdf0e10cSrcweir         virtual void SAL_CALL
121*cdf0e10cSrcweir         initialize(
122*cdf0e10cSrcweir             const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
123*cdf0e10cSrcweir             throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir 		// XContentProvider
127*cdf0e10cSrcweir 		virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent > SAL_CALL
128*cdf0e10cSrcweir 		queryContent(
129*cdf0e10cSrcweir 			const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Identifier )
130*cdf0e10cSrcweir 			throw( com::sun::star::ucb::IllegalIdentifierException,
131*cdf0e10cSrcweir 				   com::sun::star::uno::RuntimeException );
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir 		// XContentIdentifierFactory
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir 		virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > SAL_CALL
136*cdf0e10cSrcweir 		createContentIdentifier(
137*cdf0e10cSrcweir 			const rtl::OUString& ContentId )
138*cdf0e10cSrcweir 			throw( com::sun::star::uno::RuntimeException );
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir 		virtual sal_Int32 SAL_CALL
142*cdf0e10cSrcweir 		compareContentIds(
143*cdf0e10cSrcweir 			const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Id1,
144*cdf0e10cSrcweir 			const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Id2 )
145*cdf0e10cSrcweir 			throw( com::sun::star::uno::RuntimeException );
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir 		// XProperySet
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir 		virtual com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL
150*cdf0e10cSrcweir 		getPropertySetInfo(  )
151*cdf0e10cSrcweir 			throw( com::sun::star::uno::RuntimeException );
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir 		virtual void SAL_CALL
154*cdf0e10cSrcweir 		setPropertyValue(
155*cdf0e10cSrcweir 			const rtl::OUString& aPropertyName,
156*cdf0e10cSrcweir 			const com::sun::star::uno::Any& aValue )
157*cdf0e10cSrcweir 			throw( com::sun::star::beans::UnknownPropertyException,
158*cdf0e10cSrcweir 				   com::sun::star::beans::PropertyVetoException,
159*cdf0e10cSrcweir 				   com::sun::star::lang::IllegalArgumentException,
160*cdf0e10cSrcweir 				   com::sun::star::lang::WrappedTargetException,
161*cdf0e10cSrcweir 				   com::sun::star::uno::RuntimeException );
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir 		virtual com::sun::star::uno::Any SAL_CALL
164*cdf0e10cSrcweir 		getPropertyValue(
165*cdf0e10cSrcweir 			const rtl::OUString& PropertyName )
166*cdf0e10cSrcweir 			throw( com::sun::star::beans::UnknownPropertyException,
167*cdf0e10cSrcweir 				   com::sun::star::lang::WrappedTargetException,
168*cdf0e10cSrcweir 				   com::sun::star::uno::RuntimeException );
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir 		virtual void SAL_CALL
171*cdf0e10cSrcweir 		addPropertyChangeListener(
172*cdf0e10cSrcweir 			const rtl::OUString& aPropertyName,
173*cdf0e10cSrcweir 			const com::sun::star::uno::Reference< com::sun::star::beans::XPropertyChangeListener >& xListener )
174*cdf0e10cSrcweir 			throw( com::sun::star::beans::UnknownPropertyException,
175*cdf0e10cSrcweir 				   com::sun::star::lang::WrappedTargetException,
176*cdf0e10cSrcweir 				   com::sun::star::uno::RuntimeException);
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir 		virtual void SAL_CALL
179*cdf0e10cSrcweir 		removePropertyChangeListener(
180*cdf0e10cSrcweir 			const rtl::OUString& aPropertyName,
181*cdf0e10cSrcweir 			const com::sun::star::uno::Reference< com::sun::star::beans::XPropertyChangeListener >& aListener )
182*cdf0e10cSrcweir 			throw( com::sun::star::beans::UnknownPropertyException,
183*cdf0e10cSrcweir 				   com::sun::star::lang::WrappedTargetException,
184*cdf0e10cSrcweir 				   com::sun::star::uno::RuntimeException );
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir 		virtual void SAL_CALL
187*cdf0e10cSrcweir 		addVetoableChangeListener(
188*cdf0e10cSrcweir 			const rtl::OUString& PropertyName,
189*cdf0e10cSrcweir 			const com::sun::star::uno::Reference< com::sun::star::beans::XVetoableChangeListener >& aListener )
190*cdf0e10cSrcweir 			throw( com::sun::star::beans::UnknownPropertyException,
191*cdf0e10cSrcweir 				   com::sun::star::lang::WrappedTargetException,
192*cdf0e10cSrcweir 				   com::sun::star::uno::RuntimeException );
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir 		virtual void SAL_CALL
195*cdf0e10cSrcweir 		removeVetoableChangeListener(
196*cdf0e10cSrcweir 			const rtl::OUString& PropertyName,
197*cdf0e10cSrcweir 			const com::sun::star::uno::Reference< com::sun::star::beans::XVetoableChangeListener >& aListener )
198*cdf0e10cSrcweir 			throw( com::sun::star::beans::UnknownPropertyException,
199*cdf0e10cSrcweir 				   com::sun::star::lang::WrappedTargetException,
200*cdf0e10cSrcweir 				   com::sun::star::uno::RuntimeException);
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir 		// XFileIdentifierConverter
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir 		virtual sal_Int32 SAL_CALL
206*cdf0e10cSrcweir 		getFileProviderLocality( const rtl::OUString& BaseURL )
207*cdf0e10cSrcweir 			throw( com::sun::star::uno::RuntimeException );
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir 		virtual rtl::OUString SAL_CALL getFileURLFromSystemPath( const rtl::OUString& BaseURL,
210*cdf0e10cSrcweir 																 const rtl::OUString& SystemPath )
211*cdf0e10cSrcweir 			throw( com::sun::star::uno::RuntimeException );
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir 		virtual rtl::OUString SAL_CALL getSystemPathFromFileURL( const rtl::OUString& URL )
214*cdf0e10cSrcweir 			throw( com::sun::star::uno::RuntimeException );
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir 	private:
218*cdf0e10cSrcweir         // methods
219*cdf0e10cSrcweir         void SAL_CALL init();
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir 		// Members
222*cdf0e10cSrcweir 		com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >  m_xMultiServiceFactory;
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir 		void SAL_CALL initProperties( void );
225*cdf0e10cSrcweir 		osl::Mutex   m_aMutex;
226*cdf0e10cSrcweir 		rtl::OUString m_HostName;
227*cdf0e10cSrcweir 		rtl::OUString m_HomeDirectory;
228*cdf0e10cSrcweir 		sal_Int32     m_FileSystemNotation;
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir 		com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo >     m_xPropertySetInfo;
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir 		shell*                                                                        m_pMyShell;
233*cdf0e10cSrcweir 	};
234*cdf0e10cSrcweir 
235*cdf0e10cSrcweir }       // end namespace fileaccess
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir #endif
238*cdf0e10cSrcweir 
239