diff -urpN unotools_old/source/ucbhelper/XTempFile.hxx unotools_new/source/ucbhelper/XTempFile.hxx --- unotools_old/source/ucbhelper/XTempFile.hxx 2007-06-07 10:09:10.000000000 +0800 +++ unotools_new/source/ucbhelper/XTempFile.hxx 2007-06-07 09:22:20.000000000 +0800 @@ -1,57 +1,60 @@ /************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: XTempFile.hxx,v $ - * - * $Revision: 1.9 $ - * - * last change: $Author: hr $ $Date: 2006/06/19 14:09:23 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ -#ifndef _XTEMPFILE_HXX -#define _XTEMPFILE_HXX - +* +* OpenOffice.org - a multi-platform office productivity suite +* +* $RCSfile: XTempFile.hxx,v $ +* +* $Revision: 1.9 $ +* +* last change: $Author: hr $ $Date: 2006/06/19 14:09:23 $ +* +* The Contents of this file are made available subject to +* the terms of GNU Lesser General Public License Version 2.1. +* +* +* GNU Lesser General Public License Version 2.1 +* ============================================= +* Copyright 2005 by Sun Microsystems, Inc. +* 901 San Antonio Road, Palo Alto, CA 94303, USA +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License version 2.1, as published by the Free Software Foundation. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +* +************************************************************************/ +#ifndef _XTEMPFILE_HXX_ +#define _XTEMPFILE_HXX_ + #ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_ #include #endif #ifndef _COM_SUN_STAR_IO_XOUTPUTSTREAM_HPP_ #include #endif -#ifndef _COM_SUN_STAR_IO_XSEEKABLE_HPP_ -#include +#ifndef _COM_SUN_STAR_IO_XSEEKABLE_HPP_ +#include +#endif +#ifndef _COM_SUN_STAR_IO_XSTREAM_HPP_ +#include #endif -#ifndef _COM_SUN_STAR_IO_XSTREAM_HPP_ -#include +#ifndef _COM_SUN_STAR_IO_XTEMPFILE_HPP_ +#include #endif #ifndef _COM_SUN_STAR_IO_XTRUNCATE_HPP_ #include #endif -#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_ -#include +#ifndef _COM_SUN_STAR_LANG_XSINGLECOMPONENTFACTORY_HPP_ +#include #endif #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ #include @@ -59,32 +62,31 @@ #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ #include #endif -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HPP_ -#include +#ifndef _CPPUHELPER_IMPLBASE5_HXX_ +#include #endif -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ -#include -#endif -#ifndef _CPPUHELPER_IMPLBASE8_HXX_ -#include +#ifndef _CPPUHELPER_PROPERTYSETMIXIN_HXX_ +#include #endif #ifndef _OSL_MUTEX_HXX_ #include #endif - + class SvStream; namespace utl { class TempFile; } - -class XTempFile : public ::cppu::WeakImplHelper8< com::sun::star::io::XInputStream - , ::com::sun::star::io::XOutputStream - , ::com::sun::star::io::XSeekable - , ::com::sun::star::io::XStream - , ::com::sun::star::io::XTruncate - , ::com::sun::star::beans::XPropertySetInfo - , ::com::sun::star::beans::XPropertySet - , ::com::sun::star::lang::XServiceInfo - > -{ + +typedef ::cppu::WeakImplHelper5< ::com::sun::star::io::XTempFile + , ::com::sun::star::io::XInputStream + , ::com::sun::star::io::XOutputStream + , ::com::sun::star::io::XTruncate + , ::com::sun::star::lang::XServiceInfo + > + OTempFileBase; + +class OTempFileService : + public OTempFileBase, + public ::cppu::PropertySetMixin< ::com::sun::star::io::XTempFile > +{ protected: ::utl::TempFile* mpTempFile; ::osl::Mutex maMutex; @@ -93,87 +95,89 @@ protected: sal_Bool mbInClosed; sal_Bool mbOutClosed; - // intended to hold the current position in disconnected state sal_Int64 mnCachedPos; sal_Bool mbHasCachedPos; - + void checkError () const; void checkConnected (); - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > GetProps(); - public: - XTempFile (); - virtual ~XTempFile (); + OTempFileService (::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & context); + + //Methods + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire( ) + throw (); + virtual void SAL_CALL release( ) + throw (); + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getImplementationId( ) + throw (::com::sun::star::uno::RuntimeException); + + // XTempFile + virtual ::sal_Bool SAL_CALL getRemoveFile() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setRemoveFile( ::sal_Bool _removefile ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getUri() + throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getResourceName() + throw (::com::sun::star::uno::RuntimeException); - // XInputStream - virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) + // XInputStream + virtual ::sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData, ::sal_Int32 nBytesToRead ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) + virtual ::sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData, ::sal_Int32 nMaxBytesToRead ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) + virtual void SAL_CALL skipBytes( ::sal_Int32 nBytesToSkip ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL available( ) + virtual ::sal_Int32 SAL_CALL available( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL closeInput( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); // XOutputStream - virtual void SAL_CALL writeBytes( const ::com::sun::star::uno::Sequence< sal_Int8 >& aData ) + virtual void SAL_CALL writeBytes( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL flush( ) + virtual void SAL_CALL flush( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL closeOutput( ) + virtual void SAL_CALL closeOutput( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); // XSeekable - virtual void SAL_CALL seek( sal_Int64 location ) + virtual void SAL_CALL seek( sal_Int64 location ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int64 SAL_CALL getPosition( ) + virtual sal_Int64 SAL_CALL getPosition( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int64 SAL_CALL getLength( ) + virtual sal_Int64 SAL_CALL getLength( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - // XStream - virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getInputStream( ) + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getInputStream( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > SAL_CALL getOutputStream( ) + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > SAL_CALL getOutputStream( ) throw (::com::sun::star::uno::RuntimeException); - // XTruncate - virtual void SAL_CALL truncate() + virtual void SAL_CALL truncate( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - - // XPropertySetInfo - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName( const ::rtl::OUString& aName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL hasPropertyByName( const ::rtl::OUString& Name ) throw (::com::sun::star::uno::RuntimeException); - - // XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) - throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) - throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) - throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) - throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) - throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) - throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) - throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - - static ::rtl::OUString getImplementationName_Static (); - static ::com::sun::star::uno::Sequence < ::rtl::OUString > getSupportedServiceNames_Static(); - static ::com::sun::star::uno::Reference < com::sun::star::lang::XSingleServiceFactory > createServiceFactory_Static( com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > const & rServiceFactory ); - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); -}; -#endif + //::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface > SAL_CALL XTempFile_createInstance( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & context); + static ::rtl::OUString getImplementationName_Static (); + static ::com::sun::star::uno::Sequence < ::rtl::OUString > getSupportedServiceNames_Static(); + + static ::com::sun::star::uno::Reference < com::sun::star::lang::XSingleComponentFactory > createServiceFactory_Static( com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > const & rServiceFactory ); + +private: + OTempFileService( OTempFileService & ); + virtual ~OTempFileService (); + +}; +#endif \ No newline at end of file diff -urpN unotools_old/source/ucbhelper/xtempfile.cxx unotools_new/source/ucbhelper/xtempfile.cxx --- unotools_old/source/ucbhelper/xtempfile.cxx 2006-11-01 19:14:04.000000000 +0800 +++ unotools_new/source/ucbhelper/xtempfile.cxx 2007-06-07 09:22:48.000000000 +0800 @@ -1,42 +1,40 @@ /************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: xtempfile.cxx,v $ - * - * $Revision: 1.14 $ - * - * last change: $Author: obo $ $Date: 2006/09/17 01:30:57 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove +* +* OpenOffice.org - a multi-platform office productivity suite +* +* $RCSfile: xtempfile.cxx,v $ +* +* $Revision: 1.14 $ +* +* last change: $Author: obo $ $Date: 2006/09/17 01:30:57 $ +* +* The Contents of this file are made available subject to +* the terms of GNU Lesser General Public License Version 2.1. +* +* +* GNU Lesser General Public License Version 2.1 +* ============================================= +* Copyright 2005 by Sun Microsystems, Inc. +* 901 San Antonio Road, Palo Alto, CA 94303, USA +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License version 2.1, as published by the Free Software Foundation. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +* +************************************************************************/ #include "precompiled_unotools.hxx" -#ifndef _XTEMPFILE_HXX +#ifndef _XTEMPFILE_HXX_ #include #endif #ifndef _CPPUHELPER_FACTORY_HXX_ @@ -52,7 +50,7 @@ #include #endif #ifndef _UNOTOOLS_TEMPFILE_HXX -#include +#include #endif #ifndef _OSL_FILE_HXX_ #include @@ -67,102 +65,151 @@ #include #endif -using namespace ::com::sun::star; - -using com::sun::star::beans::XPropertySetInfo; -using com::sun::star::beans::XPropertySet; -using com::sun::star::beans::XPropertyChangeListener; -using com::sun::star::beans::XVetoableChangeListener; -using com::sun::star::beans::UnknownPropertyException; -using com::sun::star::beans::PropertyVetoException; -using com::sun::star::lang::WrappedTargetException; -using com::sun::star::registry::XRegistryKey; -using com::sun::star::registry::InvalidRegistryException; -using com::sun::star::uno::Any; -using com::sun::star::uno::RuntimeException; -using com::sun::star::uno::Type; -using com::sun::star::uno::Sequence; -using com::sun::star::uno::XInterface; -using com::sun::star::uno::XWeak; -using com::sun::star::uno::Reference; -using com::sun::star::io::NotConnectedException; -using com::sun::star::io::BufferSizeExceededException; -using com::sun::star::io::IOException; -using com::sun::star::io::XInputStream; -using com::sun::star::io::XOutputStream; -using com::sun::star::io::XSeekable; -using com::sun::star::lang::IllegalArgumentException; -using com::sun::star::lang::XMultiServiceFactory; -using com::sun::star::lang::XSingleServiceFactory; -using com::sun::star::lang::XTypeProvider; -using rtl::OUString; -using osl::FileBase; -using osl::MutexGuard; -using utl::TempFile; -using namespace utl; +namespace css = com::sun::star; // copy define from desktop\source\app\appinit.cxx #define DESKTOP_TEMPNAMEBASE_DIR "/temp/soffice.tmp" -XTempFile::XTempFile () +OTempFileService::OTempFileService(::css::uno::Reference< ::css::uno::XComponentContext > const & context) : mpStream( NULL ) , mbRemoveFile( sal_True ) , mbInClosed( sal_False ) , mbOutClosed( sal_False ) , mnCachedPos( 0 ) , mbHasCachedPos( sal_False ) +,::cppu::PropertySetMixin< ::css::io::XTempFile >( + context + , static_cast< Implements >( IMPLEMENTS_PROPERTY_SET | IMPLEMENTS_FAST_PROPERTY_SET | IMPLEMENTS_PROPERTY_ACCESS ) + , NULL ) { - mpTempFile = new TempFile; - mpTempFile->EnableKillingFile ( sal_True ); + mpTempFile = new ::utl::TempFile; + mpTempFile->EnableKillingFile( sal_True ); } -XTempFile::~XTempFile () +OTempFileService::~OTempFileService () { if ( mpTempFile ) delete mpTempFile; } -uno::Sequence< beans::Property > XTempFile::GetProps() + +// XInterface + +::css::uno::Any SAL_CALL OTempFileService::queryInterface( ::css::uno::Type const & aType ) +throw ( ::css::uno::RuntimeException ) +{ + ::css::uno::Any aResult( OTempFileBase::queryInterface( aType ) ); + if (!aResult.hasValue()) + aResult = cppu::PropertySetMixin< ::css::io::XTempFile >::queryInterface( aType ) ; + return aResult; +}; +void SAL_CALL OTempFileService::acquire( ) +throw () +{ + OTempFileBase::acquire(); +} +void SAL_CALL OTempFileService::release( ) +throw () +{ + OTempFileBase::release(); +} + +// XTypeProvider + +::css::uno::Sequence< ::css::uno::Type > SAL_CALL OTempFileService::getTypes( ) +throw ( ::css::uno::RuntimeException ) +{ + static ::cppu::OTypeCollection* pTypeCollection = NULL; + if ( pTypeCollection == NULL ) + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + + if ( pTypeCollection == NULL ) + { + static ::cppu::OTypeCollection aTypeCollection( + ::getCppuType( ( const ::css::uno::Reference< ::css::beans::XPropertySet >*)NULL ) + ,OTempFileBase::getTypes() ); + pTypeCollection = &aTypeCollection; + } + } + return pTypeCollection->getTypes(); +}; +::css::uno::Sequence< sal_Int8 > SAL_CALL OTempFileService::getImplementationId( ) +throw ( ::css::uno::RuntimeException ) +{ + return OTempFileBase::getImplementationId(); +} + +// XTempFile + +sal_Bool SAL_CALL OTempFileService::getRemoveFile() +throw ( ::css::uno::RuntimeException ) { - static uno::Sequence< beans::Property >* pProps = NULL; - if ( pProps == NULL ) + ::osl::MutexGuard aGuard( maMutex ); + + if ( !mpTempFile ) { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ) ; + // the stream is already disconnected + throw ::css::uno::RuntimeException(); + } - if ( pProps == NULL ) - { - static uno::Sequence< beans::Property > aProps( 3 ); + return mbRemoveFile; +}; +void SAL_CALL OTempFileService::setRemoveFile( sal_Bool _removefile ) +throw ( ::css::uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( maMutex ); + + if ( !mpTempFile ) + { + // the stream is already disconnected + throw ::css::uno::RuntimeException(); + } - aProps[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RemoveFile" ) ); - aProps[0].Type = getCppuType( static_cast< sal_Bool* >( NULL ) ); - aProps[0].Attributes = beans::PropertyAttribute::TRANSIENT; - aProps[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceName" ) ); - aProps[1].Type = getCppuType( static_cast< ::rtl::OUString* >( NULL ) ); - aProps[1].Attributes = beans::PropertyAttribute::TRANSIENT | beans::PropertyAttribute::READONLY; - aProps[2].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Uri" ) ); - aProps[2].Type = getCppuType( static_cast< ::rtl::OUString* >( NULL ) ); - aProps[2].Attributes = beans::PropertyAttribute::TRANSIENT | beans::PropertyAttribute::READONLY; + mbRemoveFile = _removefile; + mpTempFile->EnableKillingFile( mbRemoveFile ); +}; +::rtl::OUString SAL_CALL OTempFileService::getUri() +throw ( ::css::uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( maMutex ); - pProps = &aProps; - } + if ( !mpTempFile ) + { + throw ::css::uno::RuntimeException(); } - return *pProps; -} + return ::rtl::OUString( mpTempFile->GetURL() ); + +}; +::rtl::OUString SAL_CALL OTempFileService::getResourceName() +throw ( ::css::uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( maMutex ); + + if ( !mpTempFile ) + { + throw ::css::uno::RuntimeException(); + } + + return ::rtl::OUString( mpTempFile->GetFileName() ); +}; + + // XInputStream -sal_Int32 SAL_CALL XTempFile::readBytes( Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) - throw (NotConnectedException, BufferSizeExceededException, IOException, RuntimeException) +sal_Int32 SAL_CALL OTempFileService::readBytes( ::css::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) +throw (::css::io::NotConnectedException, ::css::io::BufferSizeExceededException, ::css::io::IOException, ::css::uno::RuntimeException ) { - MutexGuard aGuard( maMutex ); + ::osl::MutexGuard aGuard( maMutex ); if ( mbInClosed ) - throw NotConnectedException ( OUString(), const_cast < XWeak * > ( static_cast < const XWeak* > (this ) ) ); + throw ::css::io::NotConnectedException ( ::rtl::OUString(), const_cast < ::css::uno::XWeak * > ( static_cast < const ::css::uno::XWeak * > (this ) ) ); checkConnected(); if (nBytesToRead < 0) - throw BufferSizeExceededException( OUString(), static_cast(this)); + throw ::css::io::BufferSizeExceededException( ::rtl::OUString(), static_cast< ::css::uno::XWeak * >(this)); aData.realloc(nBytesToRead); @@ -186,18 +233,18 @@ sal_Int32 SAL_CALL XTempFile::readBytes( return nRead; } -sal_Int32 SAL_CALL XTempFile::readSomeBytes( Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) - throw (NotConnectedException, BufferSizeExceededException, IOException, RuntimeException) +sal_Int32 SAL_CALL OTempFileService::readSomeBytes( ::css::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) +throw ( ::css::io::NotConnectedException, ::css::io::BufferSizeExceededException, ::css::io::IOException, ::css::uno::RuntimeException ) { - MutexGuard aGuard( maMutex ); + ::osl::MutexGuard aGuard( maMutex ); if ( mbInClosed ) - throw NotConnectedException ( OUString(), const_cast < XWeak * > ( static_cast < const XWeak* > (this ) ) ); + throw ::css::io::NotConnectedException ( ::rtl::OUString(), const_cast < ::css::uno::XWeak * > ( static_cast < const ::css::uno::XWeak * > (this ) ) ); checkConnected(); checkError(); if (nMaxBytesToRead < 0) - throw BufferSizeExceededException(OUString(), static_cast < XWeak* >( this ) ); + throw ::css::io::BufferSizeExceededException( ::rtl::OUString(), static_cast < ::css::uno::XWeak * >( this ) ); if (mpStream->IsEof()) { @@ -207,24 +254,24 @@ sal_Int32 SAL_CALL XTempFile::readSomeBy else return readBytes(aData, nMaxBytesToRead); } -void SAL_CALL XTempFile::skipBytes( sal_Int32 nBytesToSkip ) - throw (NotConnectedException, BufferSizeExceededException, IOException, RuntimeException) +void SAL_CALL OTempFileService::skipBytes( sal_Int32 nBytesToSkip ) +throw ( ::css::io::NotConnectedException, ::css::io::BufferSizeExceededException, ::css::io::IOException, ::css::uno::RuntimeException ) { - MutexGuard aGuard( maMutex ); + ::osl::MutexGuard aGuard( maMutex ); if ( mbInClosed ) - throw NotConnectedException ( OUString(), const_cast < XWeak * > ( static_cast < const XWeak* > (this ) ) ); + throw ::css::io::NotConnectedException ( ::rtl::OUString(), const_cast < ::css::uno::XWeak * > ( static_cast < const ::css::uno::XWeak * > (this ) ) ); checkConnected(); checkError(); mpStream->SeekRel(nBytesToSkip); checkError(); } -sal_Int32 SAL_CALL XTempFile::available( ) - throw (NotConnectedException, IOException, RuntimeException) +sal_Int32 SAL_CALL OTempFileService::available( ) +throw ( ::css::io::NotConnectedException, ::css::io::IOException, ::css::uno::RuntimeException ) { - MutexGuard aGuard( maMutex ); + ::osl::MutexGuard aGuard( maMutex ); if ( mbInClosed ) - throw NotConnectedException ( OUString(), const_cast < XWeak * > ( static_cast < const XWeak* > (this ) ) ); + throw ::css::io::NotConnectedException ( ::rtl::OUString(), const_cast < ::css::uno::XWeak * > ( static_cast < const ::css::uno::XWeak * > (this ) ) ); checkConnected(); @@ -240,12 +287,12 @@ sal_Int32 SAL_CALL XTempFile::available( return nAvailable; } -void SAL_CALL XTempFile::closeInput( ) - throw (NotConnectedException, IOException, RuntimeException) +void SAL_CALL OTempFileService::closeInput( ) +throw ( ::css::io::NotConnectedException, ::css::io::IOException, ::css::uno::RuntimeException ) { - MutexGuard aGuard( maMutex ); + ::osl::MutexGuard aGuard( maMutex ); if ( mbInClosed ) - throw NotConnectedException ( OUString(), const_cast < XWeak * > ( static_cast < const XWeak* > (this ) ) ); + throw ::css::io::NotConnectedException ( ::rtl::OUString(), const_cast < ::css::uno::XWeak * > ( static_cast < const ::css::uno::XWeak * > (this ) ) ); mbInClosed = sal_True; @@ -262,79 +309,38 @@ void SAL_CALL XTempFile::closeInput( ) } } -// XSeekable - -void SAL_CALL XTempFile::seek( sal_Int64 nLocation ) - throw (IllegalArgumentException, IOException, RuntimeException) -{ - MutexGuard aGuard( maMutex ); - checkConnected(); - if ( nLocation < 0 || nLocation > getLength() ) - throw IllegalArgumentException(); - - mpStream->Seek((sal_uInt32) nLocation); - checkError(); -} -sal_Int64 SAL_CALL XTempFile::getPosition( ) - throw (IOException, RuntimeException) -{ - MutexGuard aGuard( maMutex ); - checkConnected(); - - sal_uInt32 nPos = mpStream->Tell(); - checkError(); - return (sal_Int64)nPos; -} -sal_Int64 SAL_CALL XTempFile::getLength( ) - throw (IOException, RuntimeException) -{ - MutexGuard aGuard( maMutex ); - checkConnected(); - - sal_uInt32 nCurrentPos = mpStream->Tell(); - checkError(); - - mpStream->Seek(STREAM_SEEK_TO_END); - sal_uInt32 nEndPos = mpStream->Tell(); - mpStream->Seek(nCurrentPos); - - checkError(); - - return (sal_Int64)nEndPos; -} - // XOutputStream -void SAL_CALL XTempFile::writeBytes( const Sequence< sal_Int8 >& aData ) - throw (NotConnectedException, BufferSizeExceededException, IOException, RuntimeException) +void SAL_CALL OTempFileService::writeBytes( const ::css::uno::Sequence< sal_Int8 >& aData ) +throw ( ::css::io::NotConnectedException, ::css::io::BufferSizeExceededException, ::css::io::IOException, ::css::uno::RuntimeException ) { - MutexGuard aGuard( maMutex ); + ::osl::MutexGuard aGuard( maMutex ); if ( mbOutClosed ) - throw NotConnectedException ( OUString(), const_cast < XWeak * > ( static_cast < const XWeak* > (this ) ) ); + throw ::css::io::NotConnectedException ( ::rtl::OUString(), const_cast < ::css::uno::XWeak * > ( static_cast < const ::css::uno::XWeak * > (this ) ) ); checkConnected(); sal_uInt32 nWritten = mpStream->Write(aData.getConstArray(),aData.getLength()); checkError(); if ( nWritten != (sal_uInt32)aData.getLength()) - throw BufferSizeExceededException( OUString(),static_cast < XWeak* > ( this ) ); + throw ::css::io::BufferSizeExceededException( ::rtl::OUString(),static_cast < ::css::uno::XWeak * > ( this ) ); } -void SAL_CALL XTempFile::flush( ) - throw (NotConnectedException, BufferSizeExceededException, IOException, RuntimeException) +void SAL_CALL OTempFileService::flush( ) +throw ( ::css::io::NotConnectedException, ::css::io::BufferSizeExceededException, ::css::io::IOException, ::css::uno::RuntimeException ) { - MutexGuard aGuard( maMutex ); + ::osl::MutexGuard aGuard( maMutex ); if ( mbOutClosed ) - throw NotConnectedException ( OUString(), const_cast < XWeak * > ( static_cast < const XWeak* > (this ) ) ); + throw ::css::io::NotConnectedException ( ::rtl::OUString(), const_cast < ::css::uno::XWeak * > ( static_cast < const ::css::uno::XWeak * > (this ) ) ); checkConnected(); mpStream->Flush(); checkError(); } -void SAL_CALL XTempFile::closeOutput( ) - throw (NotConnectedException, BufferSizeExceededException, IOException, RuntimeException) +void SAL_CALL OTempFileService::closeOutput( ) +throw ( ::css::io::NotConnectedException, ::css::io::BufferSizeExceededException, ::css::io::IOException, ::css::uno::RuntimeException ) { - MutexGuard aGuard( maMutex ); + ::osl::MutexGuard aGuard( maMutex ); if ( mbOutClosed ) - throw NotConnectedException ( OUString(), const_cast < XWeak * > ( static_cast < const XWeak* > (this ) ) ); + throw ::css::io::NotConnectedException ( ::rtl::OUString(), const_cast < ::css::uno::XWeak * > ( static_cast < const ::css::uno::XWeak * > (this ) ) ); mbOutClosed = sal_True; @@ -363,12 +369,12 @@ void SAL_CALL XTempFile::closeOutput( ) } -void XTempFile::checkError () const +void OTempFileService::checkError () const { if (!mpStream || mpStream->SvStream::GetError () != ERRCODE_NONE ) - throw NotConnectedException ( OUString(), const_cast < XWeak * > ( static_cast < const XWeak* > (this ) ) ); + throw ::css::io::NotConnectedException ( ::rtl::OUString(), const_cast < ::css::uno::XWeak * > ( static_cast < const ::css::uno::XWeak * > (this ) ) ); } -void XTempFile::checkConnected () +void OTempFileService::checkConnected () { if (!mpStream && mpTempFile) { @@ -390,211 +396,138 @@ void XTempFile::checkConnected () } if (!mpStream) - throw NotConnectedException ( OUString(), const_cast < XWeak * > ( static_cast < const XWeak* > (this ) ) ); -} - -// XStream - -Reference< XInputStream > SAL_CALL XTempFile::getInputStream() - throw (RuntimeException) -{ - return Reference< XInputStream >( *this, ::com::sun::star::uno::UNO_QUERY ); + throw ::css::io::NotConnectedException ( ::rtl::OUString(), const_cast < ::css::uno::XWeak * > ( static_cast < const ::css::uno::XWeak * > (this ) ) ); } -Reference< XOutputStream > SAL_CALL XTempFile::getOutputStream() - throw (RuntimeException) -{ - return Reference< XOutputStream >( *this, ::com::sun::star::uno::UNO_QUERY ); -} - -// XTruncate +// XSeekable -void SAL_CALL XTempFile::truncate() - throw (IOException, RuntimeException) +void SAL_CALL OTempFileService::seek( sal_Int64 nLocation ) +throw ( ::css::lang::IllegalArgumentException, ::css::io::IOException, ::css::uno::RuntimeException ) { - MutexGuard aGuard( maMutex ); + ::osl::MutexGuard aGuard( maMutex ); checkConnected(); - // SetStreamSize() call does not change the position - mpStream->Seek( 0 ); - mpStream->SetStreamSize( 0 ); + if ( nLocation < 0 || nLocation > getLength() ) + throw ::css::lang::IllegalArgumentException(); + + mpStream->Seek((sal_uInt32) nLocation ); checkError(); } - -// XPropertySetInfo -uno::Sequence< beans::Property > SAL_CALL XTempFile::getProperties() - throw (uno::RuntimeException) +sal_Int64 SAL_CALL OTempFileService::getPosition( ) +throw ( ::css::io::IOException, ::css::uno::RuntimeException ) { ::osl::MutexGuard aGuard( maMutex ); + checkConnected(); - return GetProps(); + sal_uInt32 nPos = mpStream->Tell(); + checkError(); + return (sal_Int64)nPos; } - -beans::Property SAL_CALL XTempFile::getPropertyByName( const ::rtl::OUString& aName ) - throw (beans::UnknownPropertyException, uno::RuntimeException) +sal_Int64 SAL_CALL OTempFileService::getLength( ) +throw ( ::css::io::IOException, ::css::uno::RuntimeException ) { ::osl::MutexGuard aGuard( maMutex ); + checkConnected(); - uno::Sequence< beans::Property > aProps = XTempFile::GetProps(); - for ( sal_Int32 nInd = 0; nInd < aProps.getLength(); nInd++ ) - if ( aName.equals( aProps[nInd].Name ) ) - return aProps[nInd]; - - throw beans::UnknownPropertyException(); -} + sal_uInt32 nCurrentPos = mpStream->Tell(); + checkError(); -::sal_Bool SAL_CALL XTempFile::hasPropertyByName( const ::rtl::OUString& aName ) - throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( maMutex ); + mpStream->Seek(STREAM_SEEK_TO_END); + sal_uInt32 nEndPos = mpStream->Tell(); + mpStream->Seek(nCurrentPos); - uno::Sequence< beans::Property > aProps = XTempFile::GetProps(); - for ( sal_Int32 nInd = 0; nInd < aProps.getLength(); nInd++ ) - if ( aName.equals( aProps[nInd].Name ) ) - return sal_True; + checkError(); - return sal_False; + return (sal_Int64)nEndPos; } -// XPropertySet +// XStream -Reference< XPropertySetInfo > SAL_CALL XTempFile::getPropertySetInfo( ) - throw (RuntimeException) +::css::uno::Reference< ::css::io::XInputStream > SAL_CALL OTempFileService::getInputStream() +throw ( ::css::uno::RuntimeException ) { - MutexGuard aGuard( maMutex ); - - return Reference< XPropertySetInfo > ( static_cast< XPropertySetInfo* >( this ) ); + return ::css::uno::Reference< ::css::io::XInputStream >( *this, ::css::uno::UNO_QUERY ); } -void SAL_CALL XTempFile::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) - throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) +::css::uno::Reference< ::css::io::XOutputStream > SAL_CALL OTempFileService::getOutputStream() +throw ( ::css::uno::RuntimeException ) { - MutexGuard aGuard( maMutex ); - - if ( !mpTempFile ) - { - // the stream is already disconnected - throw RuntimeException(); - } - - if ( aPropertyName.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "RemoveFile" ) ) ) - { - if ( !( aValue >>= mbRemoveFile ) ) - throw IllegalArgumentException(); - - mpTempFile->EnableKillingFile( mbRemoveFile ); - } - // All other properties are read-only - else if ( aPropertyName.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "ResourceName" ) ) || - aPropertyName.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "Uri" ) ) ) - throw IllegalArgumentException(); - else - throw UnknownPropertyException(); + return ::css::uno::Reference< ::css::io::XOutputStream >( *this, ::css::uno::UNO_QUERY ); } -Any SAL_CALL XTempFile::getPropertyValue( const OUString& PropertyName ) - throw (UnknownPropertyException, WrappedTargetException, RuntimeException) -{ - MutexGuard aGuard( maMutex ); - - if ( !mpTempFile ) - { - // the stream is already disconnected - throw RuntimeException(); - } - Any aRet; +// XTruncate - if ( PropertyName.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "RemoveFile" ) ) ) - aRet <<= mbRemoveFile; - else if ( PropertyName.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "ResourceName" ) ) ) - aRet <<= OUString ( mpTempFile->GetFileName() ); - else if ( PropertyName.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "Uri" ) ) ) - aRet <<= OUString ( mpTempFile->GetURL() ); - else - throw UnknownPropertyException(); - return aRet; -} -void SAL_CALL XTempFile::addPropertyChangeListener( const OUString& /*aPropertyName*/, const Reference< XPropertyChangeListener >& /*xListener*/ ) - throw (UnknownPropertyException, WrappedTargetException, RuntimeException) -{ - DBG_ASSERT ( sal_False, "Listeners not implemented" ); -} -void SAL_CALL XTempFile::removePropertyChangeListener( const OUString& /*aPropertyName*/, const Reference< XPropertyChangeListener >& /*aListener*/ ) - throw (UnknownPropertyException, WrappedTargetException, RuntimeException) -{ - DBG_ASSERT ( sal_False, "Listeners not implemented" ); -} -void SAL_CALL XTempFile::addVetoableChangeListener( const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener >& /*aListener*/ ) - throw (UnknownPropertyException, WrappedTargetException, RuntimeException) +void SAL_CALL OTempFileService::truncate() +throw ( ::css::io::IOException, ::css::uno::RuntimeException ) { - DBG_ASSERT ( sal_False, "Listeners not implemented" ); -} -void SAL_CALL XTempFile::removeVetoableChangeListener( const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener >& /*aListener*/ ) - throw (UnknownPropertyException, WrappedTargetException, RuntimeException) -{ - DBG_ASSERT ( sal_False, "Listeners not implemented" ); + ::osl::MutexGuard aGuard( maMutex ); + checkConnected(); + // SetStreamSize() call does not change the position + mpStream->Seek( 0 ); + mpStream->SetStreamSize( 0 ); + checkError(); } // XServiceInfo -::rtl::OUString SAL_CALL XTempFile::getImplementationName() - throw (::com::sun::star::uno::RuntimeException) + +::rtl::OUString SAL_CALL OTempFileService::getImplementationName() +throw ( ::css::uno::RuntimeException ) { return getImplementationName_Static(); } -sal_Bool SAL_CALL XTempFile::supportsService(rtl::OUString const & rServiceName) - throw (com::sun::star::uno::RuntimeException) +sal_Bool SAL_CALL OTempFileService::supportsService( ::rtl::OUString const & rServiceName ) +throw ( ::css::uno::RuntimeException ) { - Sequence< OUString > aServices(getSupportedServiceNames_Static()); + ::css::uno::Sequence< ::rtl::OUString > aServices(getSupportedServiceNames_Static()); return rServiceName == aServices[0]; } -::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL XTempFile::getSupportedServiceNames() - throw (::com::sun::star::uno::RuntimeException) +::css::uno::Sequence < ::rtl::OUString > SAL_CALL OTempFileService::getSupportedServiceNames() +throw ( ::css::uno::RuntimeException ) { return getSupportedServiceNames_Static(); } -OUString XTempFile::getImplementationName_Static () +::rtl::OUString OTempFileService::getImplementationName_Static () { - return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.io.comp.TempFile" ) ); + return ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.io.comp.TempFile" ) ); } -Sequence < OUString > XTempFile::getSupportedServiceNames_Static() +::css::uno::Sequence < ::rtl::OUString > OTempFileService::getSupportedServiceNames_Static() { - Sequence < OUString > aNames ( 1 ); - aNames[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.io.TempFile" ) ); + ::css::uno::Sequence < ::rtl::OUString > aNames ( 1 ); + aNames[0] = ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.io.TempFile" ) ); return aNames; } -Reference < XInterface >SAL_CALL XTempFile_createInstance( - const Reference< XMultiServiceFactory > & /*xMgr*/ ) +::css::uno::Reference < ::css::uno::XInterface >SAL_CALL XTempFile_createInstance( + css::uno::Reference< ::css::uno::XComponentContext > const & context) + SAL_THROW( ( css::uno::Exception ) ) { - return Reference< XInterface >( *new XTempFile ); + return static_cast< ::cppu::OWeakObject * >( new OTempFileService(context) ); } -Reference < XSingleServiceFactory > XTempFile::createServiceFactory_Static( Reference < XMultiServiceFactory > const & rServiceFactory ) +::css::uno::Reference < ::css::lang::XSingleComponentFactory > OTempFileService::createServiceFactory_Static( ::css::uno::Reference < ::css::lang::XMultiServiceFactory > const & rServiceFactory ) { - return cppu::createSingleFactory ( rServiceFactory, getImplementationName_Static(), - XTempFile_createInstance, - getSupportedServiceNames_Static()); + return ::cppu::createSingleComponentFactory( XTempFile_createInstance, getImplementationName_Static(), getSupportedServiceNames_Static() ); } static sal_Bool writeInfo( void * pRegistryKey, - const OUString & rImplementationName, - Sequence< OUString > const & rServiceNames ) + const ::rtl::OUString & rImplementationName, + ::css::uno::Sequence< ::rtl::OUString > const & rServiceNames ) { - OUString aKeyName( RTL_CONSTASCII_USTRINGPARAM ( "/" ) ); + ::rtl::OUString aKeyName( RTL_CONSTASCII_USTRINGPARAM ( "/" ) ); aKeyName += rImplementationName; - aKeyName += OUString( RTL_CONSTASCII_USTRINGPARAM ( "/UNO/SERVICES" ) ); + aKeyName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "/UNO/SERVICES" ) ); - Reference< XRegistryKey > xKey; + ::css::uno::Reference< ::css::registry::XRegistryKey > xKey; try { - xKey = static_cast< XRegistryKey * >( - pRegistryKey )->createKey( aKeyName ); + xKey = static_cast< ::css::registry::XRegistryKey * >( + pRegistryKey )->createKey( aKeyName ); } - catch ( InvalidRegistryException const & ) + catch ( ::css::registry::InvalidRegistryException const & ) { } @@ -609,7 +542,7 @@ static sal_Bool writeInfo( void * pRegis { xKey->createKey( rServiceNames[ n ] ); } - catch ( InvalidRegistryException const & ) + catch ( ::css::registry::InvalidRegistryException const & ) { bSuccess = sal_False; break; @@ -620,48 +553,48 @@ static sal_Bool writeInfo( void * pRegis // C functions to implement this as a component extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) + const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } /** - * This function creates an implementation section in the registry and another subkey - * for each supported service. - * @param pServiceManager generic uno interface providing a service manager - * @param pRegistryKey generic uno interface providing registry key to write - */ +* This function creates an implementation section in the registry and another subkey +* for each supported service. +* @param pServiceManager generic uno interface providing a service manager +* @param pRegistryKey generic uno interface providing registry key to write +*/ extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/, void* pRegistryKey ) { - return pRegistryKey && - writeInfo (pRegistryKey, - XTempFile::getImplementationName_Static(), - XTempFile::getSupportedServiceNames_Static() ); + return pRegistryKey && + writeInfo (pRegistryKey, + OTempFileService::getImplementationName_Static(), + OTempFileService::getSupportedServiceNames_Static() ); } /** - * This function is called to get service factories for an implementation. - * @param pImplName name of implementation - * @param pServiceManager generic uno interface providing a service manager to instantiate components - * @param pRegistryKey registry data key to read and write component persistent data - * @return a component factory (generic uno interface) - */ +* This function is called to get service factories for an implementation. +* @param pImplName name of implementation +* @param pServiceManager generic uno interface providing a service manager to instantiate components +* @param pRegistryKey registry data key to read and write component persistent data +* @return a component factory (generic uno interface) +*/ extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( - const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) + const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) { - void * pRet = 0; - Reference< XMultiServiceFactory > xSMgr( - reinterpret_cast< XMultiServiceFactory * >( pServiceManager ) ); - Reference< XSingleServiceFactory > xFactory; + void * pRet = 0; + ::css::uno::Reference< ::css::lang::XMultiServiceFactory > xSMgr( + reinterpret_cast< ::css::lang::XMultiServiceFactory * >( pServiceManager ) ); + ::css::uno::Reference< ::css::lang::XSingleComponentFactory > xFactory; - if (XTempFile::getImplementationName_Static().compareToAscii( pImplName ) == 0) - xFactory = XTempFile::createServiceFactory_Static ( xSMgr ); + if (OTempFileService::getImplementationName_Static().compareToAscii( pImplName ) == 0) + xFactory = OTempFileService::createServiceFactory_Static ( xSMgr ); if ( xFactory.is() ) { xFactory->acquire(); pRet = xFactory.get(); } - return pRet; + return pRet; }