xref: /trunk/main/ucb/source/ucp/file/prov.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
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 
71         virtual void SAL_CALL
72         acquire(
73             void )
74             throw();
75 
76         virtual void SAL_CALL
77         release(
78             void )
79             throw();
80 
81         // XServiceInfo
82         virtual rtl::OUString SAL_CALL
83         getImplementationName(
84             void );
85 
86         virtual sal_Bool SAL_CALL
87         supportsService(
88             const rtl::OUString& ServiceName );
89 
90         virtual com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
91         getSupportedServiceNames(
92             void );
93 
94 
95         static com::sun::star::uno::Reference< com::sun::star::lang::XSingleServiceFactory > SAL_CALL
96         createServiceFactory(
97             const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxServiceMgr );
98 
99         static com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL
100         CreateInstance(
101             const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xMultiServiceFactory );
102 
103         // XTypeProvider
104 
105         XTYPEPROVIDER_DECL()
106 
107         // XInitialization
108         virtual void SAL_CALL
109         initialize(
110             const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments );
111 
112 
113         // XContentProvider
114         virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent > SAL_CALL
115         queryContent(
116             const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Identifier );
117 
118         // XContentIdentifierFactory
119 
120         virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > SAL_CALL
121         createContentIdentifier(
122             const rtl::OUString& ContentId );
123 
124 
125         virtual sal_Int32 SAL_CALL
126         compareContentIds(
127             const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Id1,
128             const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Id2 );
129 
130         // XPropertySet
131 
132         virtual com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL
133         getPropertySetInfo(  );
134 
135         virtual void SAL_CALL
136         setPropertyValue(
137             const rtl::OUString& aPropertyName,
138             const com::sun::star::uno::Any& aValue );
139 
140         virtual com::sun::star::uno::Any SAL_CALL
141         getPropertyValue(
142             const rtl::OUString& PropertyName );
143 
144         virtual void SAL_CALL
145         addPropertyChangeListener(
146             const rtl::OUString& aPropertyName,
147             const com::sun::star::uno::Reference< com::sun::star::beans::XPropertyChangeListener >& xListener );
148 
149         virtual void SAL_CALL
150         removePropertyChangeListener(
151             const rtl::OUString& aPropertyName,
152             const com::sun::star::uno::Reference< com::sun::star::beans::XPropertyChangeListener >& aListener );
153 
154         virtual void SAL_CALL
155         addVetoableChangeListener(
156             const rtl::OUString& PropertyName,
157             const com::sun::star::uno::Reference< com::sun::star::beans::XVetoableChangeListener >& aListener );
158 
159         virtual void SAL_CALL
160         removeVetoableChangeListener(
161             const rtl::OUString& PropertyName,
162             const com::sun::star::uno::Reference< com::sun::star::beans::XVetoableChangeListener >& aListener );
163 
164 
165         // XFileIdentifierConverter
166 
167         virtual sal_Int32 SAL_CALL
168         getFileProviderLocality( const rtl::OUString& BaseURL );
169 
170         virtual rtl::OUString SAL_CALL getFileURLFromSystemPath( const rtl::OUString& BaseURL,
171                                                                  const rtl::OUString& SystemPath );
172 
173         virtual rtl::OUString SAL_CALL getSystemPathFromFileURL( const rtl::OUString& URL );
174 
175 
176     private:
177         // methods
178         void SAL_CALL init();
179 
180         // Members
181         com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >  m_xMultiServiceFactory;
182 
183         void SAL_CALL initProperties( void );
184         osl::Mutex   m_aMutex;
185         rtl::OUString m_HostName;
186         rtl::OUString m_HomeDirectory;
187         sal_Int32     m_FileSystemNotation;
188 
189         com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo >     m_xPropertySetInfo;
190 
191         shell*                                                                        m_pMyShell;
192     };
193 
194 } // end namespace fileaccess
195 
196 #endif
197 
198 /* vim: set noet sw=4 ts=4: */
199