1*6df1ea1fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*6df1ea1fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*6df1ea1fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*6df1ea1fSAndrew Rist * distributed with this work for additional information 6*6df1ea1fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*6df1ea1fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*6df1ea1fSAndrew Rist * "License"); you may not use this file except in compliance 9*6df1ea1fSAndrew Rist * with the License. You may obtain a copy of the License at 10*6df1ea1fSAndrew Rist * 11*6df1ea1fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*6df1ea1fSAndrew Rist * 13*6df1ea1fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*6df1ea1fSAndrew Rist * software distributed under the License is distributed on an 15*6df1ea1fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*6df1ea1fSAndrew Rist * KIND, either express or implied. See the License for the 17*6df1ea1fSAndrew Rist * specific language governing permissions and limitations 18*6df1ea1fSAndrew Rist * under the License. 19*6df1ea1fSAndrew Rist * 20*6df1ea1fSAndrew Rist *************************************************************/ 21*6df1ea1fSAndrew Rist 22*6df1ea1fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _PROV_HXX_ 25cdf0e10cSrcweir #define _PROV_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <cppuhelper/weak.hxx> 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include "osl/mutex.hxx" 30cdf0e10cSrcweir #include <ucbhelper/macros.hxx> 31cdf0e10cSrcweir #include <com/sun/star/uno/XInterface.hpp> 32cdf0e10cSrcweir #include <com/sun/star/lang/XTypeProvider.hpp> 33cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp> 34cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp> 35cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 36cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 37cdf0e10cSrcweir #include <com/sun/star/ucb/XContentProvider.hpp> 38cdf0e10cSrcweir #include <com/sun/star/ucb/XContentIdentifierFactory.hpp> 39cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 40cdf0e10cSrcweir #include <com/sun/star/ucb/XFileIdentifierConverter.hpp> 41cdf0e10cSrcweir #include <com/sun/star/container/XHierarchicalNameAccess.hpp> 42cdf0e10cSrcweir 43cdf0e10cSrcweir // FileProvider 44cdf0e10cSrcweir 45cdf0e10cSrcweir 46cdf0e10cSrcweir 47cdf0e10cSrcweir namespace fileaccess { 48cdf0e10cSrcweir 49cdf0e10cSrcweir // Forward declaration 50cdf0e10cSrcweir 51cdf0e10cSrcweir class BaseContent; 52cdf0e10cSrcweir class shell; 53cdf0e10cSrcweir 54cdf0e10cSrcweir class FileProvider: 55cdf0e10cSrcweir public cppu::OWeakObject, 56cdf0e10cSrcweir public com::sun::star::lang::XServiceInfo, 57cdf0e10cSrcweir public com::sun::star::lang::XInitialization, 58cdf0e10cSrcweir public com::sun::star::lang::XTypeProvider, 59cdf0e10cSrcweir public com::sun::star::ucb::XContentProvider, 60cdf0e10cSrcweir public com::sun::star::ucb::XContentIdentifierFactory, 61cdf0e10cSrcweir public com::sun::star::beans::XPropertySet, 62cdf0e10cSrcweir public com::sun::star::ucb::XFileIdentifierConverter 63cdf0e10cSrcweir { 64cdf0e10cSrcweir friend class BaseContent; 65cdf0e10cSrcweir public: 66cdf0e10cSrcweir 67cdf0e10cSrcweir FileProvider( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xMSF ); 68cdf0e10cSrcweir ~FileProvider(); 69cdf0e10cSrcweir 70cdf0e10cSrcweir // XInterface 71cdf0e10cSrcweir virtual com::sun::star::uno::Any SAL_CALL 72cdf0e10cSrcweir queryInterface( 73cdf0e10cSrcweir const com::sun::star::uno::Type& aType ) 74cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException); 75cdf0e10cSrcweir 76cdf0e10cSrcweir virtual void SAL_CALL 77cdf0e10cSrcweir acquire( 78cdf0e10cSrcweir void ) 79cdf0e10cSrcweir throw(); 80cdf0e10cSrcweir 81cdf0e10cSrcweir virtual void SAL_CALL 82cdf0e10cSrcweir release( 83cdf0e10cSrcweir void ) 84cdf0e10cSrcweir throw(); 85cdf0e10cSrcweir 86cdf0e10cSrcweir // XServiceInfo 87cdf0e10cSrcweir virtual rtl::OUString SAL_CALL 88cdf0e10cSrcweir getImplementationName( 89cdf0e10cSrcweir void ) 90cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 91cdf0e10cSrcweir 92cdf0e10cSrcweir virtual sal_Bool SAL_CALL 93cdf0e10cSrcweir supportsService( 94cdf0e10cSrcweir const rtl::OUString& ServiceName ) 95cdf0e10cSrcweir throw(com::sun::star::uno::RuntimeException ); 96cdf0e10cSrcweir 97cdf0e10cSrcweir virtual com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 98cdf0e10cSrcweir getSupportedServiceNames( 99cdf0e10cSrcweir void ) 100cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 101cdf0e10cSrcweir 102cdf0e10cSrcweir 103cdf0e10cSrcweir static com::sun::star::uno::Reference< com::sun::star::lang::XSingleServiceFactory > SAL_CALL 104cdf0e10cSrcweir createServiceFactory( 105cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxServiceMgr ); 106cdf0e10cSrcweir 107cdf0e10cSrcweir static com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL 108cdf0e10cSrcweir CreateInstance( 109cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xMultiServiceFactory ); 110cdf0e10cSrcweir 111cdf0e10cSrcweir // XTypeProvider 112cdf0e10cSrcweir 113cdf0e10cSrcweir XTYPEPROVIDER_DECL() 114cdf0e10cSrcweir 115cdf0e10cSrcweir // XInitialization 116cdf0e10cSrcweir virtual void SAL_CALL 117cdf0e10cSrcweir initialize( 118cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) 119cdf0e10cSrcweir throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); 120cdf0e10cSrcweir 121cdf0e10cSrcweir 122cdf0e10cSrcweir // XContentProvider 123cdf0e10cSrcweir virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent > SAL_CALL 124cdf0e10cSrcweir queryContent( 125cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Identifier ) 126cdf0e10cSrcweir throw( com::sun::star::ucb::IllegalIdentifierException, 127cdf0e10cSrcweir com::sun::star::uno::RuntimeException ); 128cdf0e10cSrcweir 129cdf0e10cSrcweir // XContentIdentifierFactory 130cdf0e10cSrcweir 131cdf0e10cSrcweir virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier > SAL_CALL 132cdf0e10cSrcweir createContentIdentifier( 133cdf0e10cSrcweir const rtl::OUString& ContentId ) 134cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 135cdf0e10cSrcweir 136cdf0e10cSrcweir 137cdf0e10cSrcweir virtual sal_Int32 SAL_CALL 138cdf0e10cSrcweir compareContentIds( 139cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Id1, 140cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Id2 ) 141cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 142cdf0e10cSrcweir 143cdf0e10cSrcweir // XProperySet 144cdf0e10cSrcweir 145cdf0e10cSrcweir virtual com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL 146cdf0e10cSrcweir getPropertySetInfo( ) 147cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 148cdf0e10cSrcweir 149cdf0e10cSrcweir virtual void SAL_CALL 150cdf0e10cSrcweir setPropertyValue( 151cdf0e10cSrcweir const rtl::OUString& aPropertyName, 152cdf0e10cSrcweir const com::sun::star::uno::Any& aValue ) 153cdf0e10cSrcweir throw( com::sun::star::beans::UnknownPropertyException, 154cdf0e10cSrcweir com::sun::star::beans::PropertyVetoException, 155cdf0e10cSrcweir com::sun::star::lang::IllegalArgumentException, 156cdf0e10cSrcweir com::sun::star::lang::WrappedTargetException, 157cdf0e10cSrcweir com::sun::star::uno::RuntimeException ); 158cdf0e10cSrcweir 159cdf0e10cSrcweir virtual com::sun::star::uno::Any SAL_CALL 160cdf0e10cSrcweir getPropertyValue( 161cdf0e10cSrcweir const rtl::OUString& PropertyName ) 162cdf0e10cSrcweir throw( com::sun::star::beans::UnknownPropertyException, 163cdf0e10cSrcweir com::sun::star::lang::WrappedTargetException, 164cdf0e10cSrcweir com::sun::star::uno::RuntimeException ); 165cdf0e10cSrcweir 166cdf0e10cSrcweir virtual void SAL_CALL 167cdf0e10cSrcweir addPropertyChangeListener( 168cdf0e10cSrcweir const rtl::OUString& aPropertyName, 169cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::beans::XPropertyChangeListener >& xListener ) 170cdf0e10cSrcweir throw( com::sun::star::beans::UnknownPropertyException, 171cdf0e10cSrcweir com::sun::star::lang::WrappedTargetException, 172cdf0e10cSrcweir com::sun::star::uno::RuntimeException); 173cdf0e10cSrcweir 174cdf0e10cSrcweir virtual void SAL_CALL 175cdf0e10cSrcweir removePropertyChangeListener( 176cdf0e10cSrcweir const rtl::OUString& aPropertyName, 177cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::beans::XPropertyChangeListener >& aListener ) 178cdf0e10cSrcweir throw( com::sun::star::beans::UnknownPropertyException, 179cdf0e10cSrcweir com::sun::star::lang::WrappedTargetException, 180cdf0e10cSrcweir com::sun::star::uno::RuntimeException ); 181cdf0e10cSrcweir 182cdf0e10cSrcweir virtual void SAL_CALL 183cdf0e10cSrcweir addVetoableChangeListener( 184cdf0e10cSrcweir const rtl::OUString& PropertyName, 185cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::beans::XVetoableChangeListener >& aListener ) 186cdf0e10cSrcweir throw( com::sun::star::beans::UnknownPropertyException, 187cdf0e10cSrcweir com::sun::star::lang::WrappedTargetException, 188cdf0e10cSrcweir com::sun::star::uno::RuntimeException ); 189cdf0e10cSrcweir 190cdf0e10cSrcweir virtual void SAL_CALL 191cdf0e10cSrcweir removeVetoableChangeListener( 192cdf0e10cSrcweir const rtl::OUString& PropertyName, 193cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::beans::XVetoableChangeListener >& aListener ) 194cdf0e10cSrcweir throw( com::sun::star::beans::UnknownPropertyException, 195cdf0e10cSrcweir com::sun::star::lang::WrappedTargetException, 196cdf0e10cSrcweir com::sun::star::uno::RuntimeException); 197cdf0e10cSrcweir 198cdf0e10cSrcweir 199cdf0e10cSrcweir // XFileIdentifierConverter 200cdf0e10cSrcweir 201cdf0e10cSrcweir virtual sal_Int32 SAL_CALL 202cdf0e10cSrcweir getFileProviderLocality( const rtl::OUString& BaseURL ) 203cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 204cdf0e10cSrcweir 205cdf0e10cSrcweir virtual rtl::OUString SAL_CALL getFileURLFromSystemPath( const rtl::OUString& BaseURL, 206cdf0e10cSrcweir const rtl::OUString& SystemPath ) 207cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 208cdf0e10cSrcweir 209cdf0e10cSrcweir virtual rtl::OUString SAL_CALL getSystemPathFromFileURL( const rtl::OUString& URL ) 210cdf0e10cSrcweir throw( com::sun::star::uno::RuntimeException ); 211cdf0e10cSrcweir 212cdf0e10cSrcweir 213cdf0e10cSrcweir private: 214cdf0e10cSrcweir // methods 215cdf0e10cSrcweir void SAL_CALL init(); 216cdf0e10cSrcweir 217cdf0e10cSrcweir // Members 218cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xMultiServiceFactory; 219cdf0e10cSrcweir 220cdf0e10cSrcweir void SAL_CALL initProperties( void ); 221cdf0e10cSrcweir osl::Mutex m_aMutex; 222cdf0e10cSrcweir rtl::OUString m_HostName; 223cdf0e10cSrcweir rtl::OUString m_HomeDirectory; 224cdf0e10cSrcweir sal_Int32 m_FileSystemNotation; 225cdf0e10cSrcweir 226cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > m_xPropertySetInfo; 227cdf0e10cSrcweir 228cdf0e10cSrcweir shell* m_pMyShell; 229cdf0e10cSrcweir }; 230cdf0e10cSrcweir 231cdf0e10cSrcweir } // end namespace fileaccess 232cdf0e10cSrcweir 233cdf0e10cSrcweir #endif 234cdf0e10cSrcweir 235