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