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