1046d9d1fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3046d9d1fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4046d9d1fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5046d9d1fSAndrew Rist * distributed with this work for additional information 6046d9d1fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7046d9d1fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8046d9d1fSAndrew Rist * "License"); you may not use this file except in compliance 9046d9d1fSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11046d9d1fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13046d9d1fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14046d9d1fSAndrew Rist * software distributed under the License is distributed on an 15046d9d1fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16046d9d1fSAndrew Rist * KIND, either express or implied. See the License for the 17046d9d1fSAndrew Rist * specific language governing permissions and limitations 18046d9d1fSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20046d9d1fSAndrew Rist *************************************************************/ 21046d9d1fSAndrew Rist 22046d9d1fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sot.hxx" 26cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp> 27cdf0e10cSrcweir #include <com/sun/star/io/XStream.hpp> 28cdf0e10cSrcweir #include <com/sun/star/io/XInputStream.hpp> 29cdf0e10cSrcweir #include <com/sun/star/io/XSeekable.hpp> 30cdf0e10cSrcweir #include <com/sun/star/io/XTruncate.hpp> 31cdf0e10cSrcweir 32cdf0e10cSrcweir #include <comphelper/storagehelper.hxx> 33cdf0e10cSrcweir 34cdf0e10cSrcweir #include <unotools/ucbstreamhelper.hxx> 35cdf0e10cSrcweir 36cdf0e10cSrcweir #include <cppuhelper/exc_hlp.hxx> 37cdf0e10cSrcweir 38cdf0e10cSrcweir #include <sot/storinfo.hxx> 39cdf0e10cSrcweir 40cdf0e10cSrcweir #include "xolesimplestorage.hxx" 41cdf0e10cSrcweir 42cdf0e10cSrcweir 43cdf0e10cSrcweir using namespace ::com::sun::star; 44cdf0e10cSrcweir 45cdf0e10cSrcweir const sal_Int32 nBytesCount = 32000; 46cdf0e10cSrcweir 47cdf0e10cSrcweir 48cdf0e10cSrcweir // -------------------------------------------------------------------------------- 49*641497eaSDamjan Jovanovic OLESimpleStorage::OLESimpleStorage( uno::Reference< uno::XComponentContext > xContext ) 50cdf0e10cSrcweir : m_bDisposed( sal_False ) 51cdf0e10cSrcweir , m_pStream( NULL ) 52cdf0e10cSrcweir , m_pStorage( NULL ) 53cdf0e10cSrcweir , m_pListenersContainer( NULL ) 54*641497eaSDamjan Jovanovic , m_xContext( xContext ) 55cdf0e10cSrcweir , m_bNoTemporaryCopy( sal_False ) 56cdf0e10cSrcweir { 57*641497eaSDamjan Jovanovic OSL_ENSURE( m_xContext.is(), "No component context is provided on creation!\n" ); 58*641497eaSDamjan Jovanovic if ( !m_xContext.is() ) 59cdf0e10cSrcweir throw uno::RuntimeException(); 60cdf0e10cSrcweir } 61cdf0e10cSrcweir 62cdf0e10cSrcweir // -------------------------------------------------------------------------------- 63cdf0e10cSrcweir OLESimpleStorage::~OLESimpleStorage() 64cdf0e10cSrcweir { 65cdf0e10cSrcweir try { 66cdf0e10cSrcweir m_refCount++; 67cdf0e10cSrcweir dispose(); 68cdf0e10cSrcweir } catch( uno::Exception& ) 69cdf0e10cSrcweir {} 70cdf0e10cSrcweir 71cdf0e10cSrcweir if ( m_pListenersContainer ) 72cdf0e10cSrcweir { 73cdf0e10cSrcweir delete m_pListenersContainer; 74cdf0e10cSrcweir m_pListenersContainer = NULL; 75cdf0e10cSrcweir } 76cdf0e10cSrcweir } 77cdf0e10cSrcweir 78cdf0e10cSrcweir //------------------------------------------------------------------------- 79cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > SAL_CALL OLESimpleStorage::impl_staticGetSupportedServiceNames() 80cdf0e10cSrcweir { 81cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > aRet(1); 82cdf0e10cSrcweir aRet[0] = ::rtl::OUString::createFromAscii("com.sun.star.embed.OLESimpleStorage"); 83cdf0e10cSrcweir return aRet; 84cdf0e10cSrcweir } 85cdf0e10cSrcweir 86cdf0e10cSrcweir //------------------------------------------------------------------------- 87cdf0e10cSrcweir ::rtl::OUString SAL_CALL OLESimpleStorage::impl_staticGetImplementationName() 88cdf0e10cSrcweir { 89cdf0e10cSrcweir return ::rtl::OUString::createFromAscii("com.sun.star.comp.embed.OLESimpleStorage"); 90cdf0e10cSrcweir } 91cdf0e10cSrcweir 92cdf0e10cSrcweir //------------------------------------------------------------------------- 93cdf0e10cSrcweir uno::Reference< uno::XInterface > SAL_CALL OLESimpleStorage::impl_staticCreateSelfInstance( 94*641497eaSDamjan Jovanovic const uno::Reference< uno::XComponentContext >& xComponentContext ) 95cdf0e10cSrcweir { 96*641497eaSDamjan Jovanovic return uno::Reference< uno::XInterface >( *new OLESimpleStorage( xComponentContext ) ); 97cdf0e10cSrcweir } 98cdf0e10cSrcweir 99cdf0e10cSrcweir //------------------------------------------------------------------------- 100cdf0e10cSrcweir void OLESimpleStorage::UpdateOriginal_Impl() 101cdf0e10cSrcweir { 102cdf0e10cSrcweir if ( !m_bNoTemporaryCopy ) 103cdf0e10cSrcweir { 104cdf0e10cSrcweir uno::Reference< io::XSeekable > xSeek( m_xStream, uno::UNO_QUERY_THROW ); 105cdf0e10cSrcweir xSeek->seek( 0 ); 106cdf0e10cSrcweir 107cdf0e10cSrcweir uno::Reference< io::XSeekable > xTempSeek( m_xTempStream, uno::UNO_QUERY_THROW ); 108cdf0e10cSrcweir sal_Int64 nPos = xTempSeek->getPosition(); 109cdf0e10cSrcweir xTempSeek->seek( 0 ); 110cdf0e10cSrcweir 111cdf0e10cSrcweir uno::Reference< io::XInputStream > xTempInp = m_xTempStream->getInputStream(); 112cdf0e10cSrcweir uno::Reference< io::XOutputStream > xOutputStream = m_xStream->getOutputStream(); 113cdf0e10cSrcweir if ( !xTempInp.is() || !xOutputStream.is() ) 114cdf0e10cSrcweir throw uno::RuntimeException(); 115cdf0e10cSrcweir 116cdf0e10cSrcweir uno::Reference< io::XTruncate > xTrunc( xOutputStream, uno::UNO_QUERY_THROW ); 117cdf0e10cSrcweir xTrunc->truncate(); 118cdf0e10cSrcweir 119cdf0e10cSrcweir ::comphelper::OStorageHelper::CopyInputToOutput( xTempInp, xOutputStream ); 120cdf0e10cSrcweir xOutputStream->flush(); 121cdf0e10cSrcweir xTempSeek->seek( nPos ); 122cdf0e10cSrcweir } 123cdf0e10cSrcweir } 124cdf0e10cSrcweir 125cdf0e10cSrcweir //------------------------------------------------------------------------- 126cdf0e10cSrcweir void OLESimpleStorage::InsertInputStreamToStorage_Impl( BaseStorage* pStorage, ::rtl::OUString aName, const uno::Reference< io::XInputStream >& xInputStream ) 127cdf0e10cSrcweir throw ( uno::Exception ) 128cdf0e10cSrcweir { 129cdf0e10cSrcweir if ( !pStorage || !aName.getLength() || !xInputStream.is() ) 130cdf0e10cSrcweir throw uno::RuntimeException(); 131cdf0e10cSrcweir 132cdf0e10cSrcweir if ( pStorage->IsContained( aName ) ) 133cdf0e10cSrcweir throw container::ElementExistException(); // TODO: 134cdf0e10cSrcweir 135cdf0e10cSrcweir BaseStorageStream* pNewStream = pStorage->OpenStream( aName ); 136cdf0e10cSrcweir if ( !pNewStream || pNewStream->GetError() || pStorage->GetError() ) 137cdf0e10cSrcweir { 138cdf0e10cSrcweir if ( pNewStream ) 139cdf0e10cSrcweir DELETEZ( pNewStream ); 140cdf0e10cSrcweir pStorage->ResetError(); 141cdf0e10cSrcweir throw io::IOException(); // TODO 142cdf0e10cSrcweir } 143cdf0e10cSrcweir 144cdf0e10cSrcweir try 145cdf0e10cSrcweir { 146cdf0e10cSrcweir uno::Sequence< sal_Int8 > aData( nBytesCount ); 147cdf0e10cSrcweir sal_Int32 nRead = 0; 148cdf0e10cSrcweir do 149cdf0e10cSrcweir { 150cdf0e10cSrcweir nRead = xInputStream->readBytes( aData, nBytesCount ); 151cdf0e10cSrcweir if ( nRead < nBytesCount ) 152cdf0e10cSrcweir aData.realloc( nRead ); 153cdf0e10cSrcweir 154cdf0e10cSrcweir sal_Int32 nWritten = pNewStream->Write( aData.getArray(), nRead ); 155cdf0e10cSrcweir if ( nWritten < nRead ) 156cdf0e10cSrcweir throw io::IOException(); 157cdf0e10cSrcweir } while( nRead == nBytesCount ); 158cdf0e10cSrcweir } 159cdf0e10cSrcweir catch( uno::Exception& ) 160cdf0e10cSrcweir { 161cdf0e10cSrcweir DELETEZ( pNewStream ); 162cdf0e10cSrcweir pStorage->Remove( aName ); 163cdf0e10cSrcweir 164cdf0e10cSrcweir throw; 165cdf0e10cSrcweir } 166cdf0e10cSrcweir 167cdf0e10cSrcweir DELETEZ( pNewStream ); 168cdf0e10cSrcweir } 169cdf0e10cSrcweir 170cdf0e10cSrcweir //------------------------------------------------------------------------- 171cdf0e10cSrcweir void OLESimpleStorage::InsertNameAccessToStorage_Impl( BaseStorage* pStorage, ::rtl::OUString aName, const uno::Reference< container::XNameAccess >& xNameAccess ) 172cdf0e10cSrcweir throw ( uno::Exception ) 173cdf0e10cSrcweir { 174cdf0e10cSrcweir if ( !pStorage || !aName.getLength() || !xNameAccess.is() ) 175cdf0e10cSrcweir throw uno::RuntimeException(); 176cdf0e10cSrcweir 177cdf0e10cSrcweir if ( pStorage->IsContained( aName ) ) 178cdf0e10cSrcweir throw container::ElementExistException(); // TODO: 179cdf0e10cSrcweir 180cdf0e10cSrcweir BaseStorage* pNewStorage = pStorage->OpenStorage( aName ); 181cdf0e10cSrcweir if ( !pNewStorage || pNewStorage->GetError() || pStorage->GetError() ) 182cdf0e10cSrcweir { 183cdf0e10cSrcweir if ( pNewStorage ) 184cdf0e10cSrcweir DELETEZ( pNewStorage ); 185cdf0e10cSrcweir pStorage->ResetError(); 186cdf0e10cSrcweir throw io::IOException(); // TODO 187cdf0e10cSrcweir } 188cdf0e10cSrcweir 189cdf0e10cSrcweir try 190cdf0e10cSrcweir { 191cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > aElements = xNameAccess->getElementNames(); 192cdf0e10cSrcweir for ( sal_Int32 nInd = 0; nInd < aElements.getLength(); nInd++ ) 193cdf0e10cSrcweir { 194cdf0e10cSrcweir uno::Reference< io::XInputStream > xInputStream; 195cdf0e10cSrcweir uno::Reference< container::XNameAccess > xSubNameAccess; 196cdf0e10cSrcweir uno::Any aAny = xNameAccess->getByName( aElements[nInd] ); 197cdf0e10cSrcweir if ( aAny >>= xInputStream ) 198cdf0e10cSrcweir InsertInputStreamToStorage_Impl( pNewStorage, aElements[nInd], xInputStream ); 199cdf0e10cSrcweir else if ( aAny >>= xSubNameAccess ) 200cdf0e10cSrcweir InsertNameAccessToStorage_Impl( pNewStorage, aElements[nInd], xSubNameAccess ); 201cdf0e10cSrcweir } 202cdf0e10cSrcweir } 203cdf0e10cSrcweir catch( uno::Exception& ) 204cdf0e10cSrcweir { 205cdf0e10cSrcweir DELETEZ( pNewStorage ); 206cdf0e10cSrcweir pStorage->Remove( aName ); 207cdf0e10cSrcweir 208cdf0e10cSrcweir throw; 209cdf0e10cSrcweir } 210cdf0e10cSrcweir 211cdf0e10cSrcweir DELETEZ( pNewStorage ); 212cdf0e10cSrcweir } 213cdf0e10cSrcweir 214cdf0e10cSrcweir //____________________________________________________________________________________________________ 215cdf0e10cSrcweir // XInitialization 216cdf0e10cSrcweir //____________________________________________________________________________________________________ 217cdf0e10cSrcweir 218cdf0e10cSrcweir void SAL_CALL OLESimpleStorage::initialize( const uno::Sequence< uno::Any >& aArguments ) 219cdf0e10cSrcweir throw ( uno::Exception, 220cdf0e10cSrcweir uno::RuntimeException) 221cdf0e10cSrcweir { 222cdf0e10cSrcweir if ( m_pStream || m_pStorage ) 223cdf0e10cSrcweir throw io::IOException(); // TODO: already initilized 224cdf0e10cSrcweir 225cdf0e10cSrcweir sal_Int32 nArgNum = aArguments.getLength(); 226cdf0e10cSrcweir OSL_ENSURE( nArgNum >= 1 && nArgNum <= 2, "Wrong parameter number" ); 227cdf0e10cSrcweir 228cdf0e10cSrcweir if ( nArgNum < 1 || nArgNum > 2 ) 229cdf0e10cSrcweir throw lang::IllegalArgumentException(); // TODO: 230cdf0e10cSrcweir 231cdf0e10cSrcweir uno::Reference< io::XStream > xStream; 232cdf0e10cSrcweir uno::Reference< io::XInputStream > xInputStream; 233cdf0e10cSrcweir if ( !( aArguments[0] >>= xStream ) && !( aArguments[0] >>= xInputStream ) ) 234cdf0e10cSrcweir throw lang::IllegalArgumentException(); // TODO: 235cdf0e10cSrcweir 236cdf0e10cSrcweir if ( nArgNum == 2 ) 237cdf0e10cSrcweir { 238cdf0e10cSrcweir if ( !( aArguments[1] >>= m_bNoTemporaryCopy ) ) 239cdf0e10cSrcweir throw lang::IllegalArgumentException(); // TODO: 240cdf0e10cSrcweir } 241cdf0e10cSrcweir 242cdf0e10cSrcweir if ( m_bNoTemporaryCopy ) 243cdf0e10cSrcweir { 244cdf0e10cSrcweir // TODO: ??? 245cdf0e10cSrcweir // If the temporary stream is not created, the original stream must be wrapped 246cdf0e10cSrcweir // since SvStream wrapper closes the stream is owns 247cdf0e10cSrcweir if ( xInputStream.is() ) 248cdf0e10cSrcweir { 249cdf0e10cSrcweir // the stream must be seekable for direct access 250cdf0e10cSrcweir uno::Reference< io::XSeekable > xSeek( xInputStream, uno::UNO_QUERY_THROW ); 251cdf0e10cSrcweir m_pStream = ::utl::UcbStreamHelper::CreateStream( xInputStream, sal_False ); 252cdf0e10cSrcweir } 253cdf0e10cSrcweir else if ( xStream.is() ) 254cdf0e10cSrcweir { 255cdf0e10cSrcweir // the stream must be seekable for direct access 256cdf0e10cSrcweir uno::Reference< io::XSeekable > xSeek( xStream, uno::UNO_QUERY_THROW ); 257cdf0e10cSrcweir m_pStream = ::utl::UcbStreamHelper::CreateStream( xStream, sal_False ); 258cdf0e10cSrcweir } 259cdf0e10cSrcweir else 260cdf0e10cSrcweir throw lang::IllegalArgumentException(); // TODO: 261cdf0e10cSrcweir } 262cdf0e10cSrcweir else 263cdf0e10cSrcweir { 264cdf0e10cSrcweir uno::Reference < io::XStream > xTempFile( 265*641497eaSDamjan Jovanovic m_xContext->getServiceManager()->createInstanceWithContext( ::rtl::OUString::createFromAscii( "com.sun.star.io.TempFile" ), m_xContext ), 266cdf0e10cSrcweir uno::UNO_QUERY_THROW ); 267cdf0e10cSrcweir uno::Reference < io::XSeekable > xTempSeek( xTempFile, uno::UNO_QUERY_THROW ); 268cdf0e10cSrcweir uno::Reference< io::XOutputStream > xTempOut = xTempFile->getOutputStream(); 269cdf0e10cSrcweir if ( !xTempOut.is() ) 270cdf0e10cSrcweir throw uno::RuntimeException(); 271cdf0e10cSrcweir 272cdf0e10cSrcweir if ( xInputStream.is() ) 273cdf0e10cSrcweir { 274cdf0e10cSrcweir try 275cdf0e10cSrcweir { 276cdf0e10cSrcweir uno::Reference< io::XSeekable > xSeek( xInputStream, uno::UNO_QUERY_THROW ); 277cdf0e10cSrcweir xSeek->seek( 0 ); 278cdf0e10cSrcweir } 279cdf0e10cSrcweir catch( uno::Exception& ) 280cdf0e10cSrcweir {} 281cdf0e10cSrcweir 282cdf0e10cSrcweir ::comphelper::OStorageHelper::CopyInputToOutput( xInputStream, xTempOut ); 283cdf0e10cSrcweir xTempOut->closeOutput(); 284cdf0e10cSrcweir xTempSeek->seek( 0 ); 285cdf0e10cSrcweir uno::Reference< io::XInputStream > xTempInput = xTempFile->getInputStream(); 286cdf0e10cSrcweir m_pStream = ::utl::UcbStreamHelper::CreateStream( xTempInput, sal_False ); 287cdf0e10cSrcweir } 288cdf0e10cSrcweir else if ( xStream.is() ) 289cdf0e10cSrcweir { 290cdf0e10cSrcweir // not sure that the storage flashes the stream on commit 291cdf0e10cSrcweir m_xStream = xStream; 292cdf0e10cSrcweir m_xTempStream = xTempFile; 293cdf0e10cSrcweir 294cdf0e10cSrcweir uno::Reference< io::XSeekable > xSeek( xStream, uno::UNO_QUERY_THROW ); 295cdf0e10cSrcweir xSeek->seek( 0 ); 296cdf0e10cSrcweir uno::Reference< io::XInputStream > xInpStream = xStream->getInputStream(); 297cdf0e10cSrcweir if ( !xInpStream.is() || !xStream->getOutputStream().is() ) 298cdf0e10cSrcweir throw uno::RuntimeException(); 299cdf0e10cSrcweir 300cdf0e10cSrcweir ::comphelper::OStorageHelper::CopyInputToOutput( xInpStream, xTempOut ); 301cdf0e10cSrcweir xTempOut->flush(); 302cdf0e10cSrcweir xTempSeek->seek( 0 ); 303cdf0e10cSrcweir 304cdf0e10cSrcweir m_pStream = ::utl::UcbStreamHelper::CreateStream( xTempFile, sal_False ); 305cdf0e10cSrcweir } 306cdf0e10cSrcweir else 307cdf0e10cSrcweir throw lang::IllegalArgumentException(); // TODO: 308cdf0e10cSrcweir } 309cdf0e10cSrcweir 310cdf0e10cSrcweir if ( !m_pStream || m_pStream->GetError() ) 311cdf0e10cSrcweir throw io::IOException(); // TODO 312cdf0e10cSrcweir 313cdf0e10cSrcweir m_pStorage = new Storage( *m_pStream, sal_False ); 314cdf0e10cSrcweir } 315cdf0e10cSrcweir 316cdf0e10cSrcweir 317cdf0e10cSrcweir //____________________________________________________________________________________________________ 318cdf0e10cSrcweir // XNameContainer 319cdf0e10cSrcweir //____________________________________________________________________________________________________ 320cdf0e10cSrcweir 321cdf0e10cSrcweir // -------------------------------------------------------------------------------- 322cdf0e10cSrcweir void SAL_CALL OLESimpleStorage::insertByName( const ::rtl::OUString& aName, const uno::Any& aElement ) 323cdf0e10cSrcweir throw ( lang::IllegalArgumentException, 324cdf0e10cSrcweir container::ElementExistException, 325cdf0e10cSrcweir lang::WrappedTargetException, 326cdf0e10cSrcweir uno::RuntimeException) 327cdf0e10cSrcweir { 328cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 329cdf0e10cSrcweir 330cdf0e10cSrcweir if ( m_bDisposed ) 331cdf0e10cSrcweir throw lang::DisposedException(); 332cdf0e10cSrcweir 333cdf0e10cSrcweir if ( !m_pStorage ) 334cdf0e10cSrcweir throw uno::RuntimeException(); 335cdf0e10cSrcweir 336cdf0e10cSrcweir uno::Reference< io::XStream > xStream; 337cdf0e10cSrcweir uno::Reference< io::XInputStream > xInputStream; 338cdf0e10cSrcweir uno::Reference< container::XNameAccess > xNameAccess; 339cdf0e10cSrcweir 340cdf0e10cSrcweir try 341cdf0e10cSrcweir { 342cdf0e10cSrcweir if ( !m_bNoTemporaryCopy && !m_xStream.is() ) 343cdf0e10cSrcweir throw io::IOException(); // TODO 344cdf0e10cSrcweir 345cdf0e10cSrcweir if ( aElement >>= xStream ) 346cdf0e10cSrcweir xInputStream = xStream->getInputStream(); 347cdf0e10cSrcweir else if ( !( aElement >>= xInputStream ) && !( aElement >>= xNameAccess ) ) 348cdf0e10cSrcweir throw lang::IllegalArgumentException(); // TODO: 349cdf0e10cSrcweir 350cdf0e10cSrcweir if ( xInputStream.is() ) 351cdf0e10cSrcweir InsertInputStreamToStorage_Impl( m_pStorage, aName, xInputStream ); 352cdf0e10cSrcweir else if ( xNameAccess.is() ) 353cdf0e10cSrcweir InsertNameAccessToStorage_Impl( m_pStorage, aName, xNameAccess ); 354cdf0e10cSrcweir else 355cdf0e10cSrcweir throw uno::RuntimeException(); 356cdf0e10cSrcweir } 357cdf0e10cSrcweir catch( uno::RuntimeException& ) 358cdf0e10cSrcweir { 359cdf0e10cSrcweir throw; 360cdf0e10cSrcweir } 361cdf0e10cSrcweir catch( container::ElementExistException& ) 362cdf0e10cSrcweir { 363cdf0e10cSrcweir throw; 364cdf0e10cSrcweir } 365cdf0e10cSrcweir catch( uno::Exception& e ) 366cdf0e10cSrcweir { 367cdf0e10cSrcweir throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Insert has failed!" ) ), 368cdf0e10cSrcweir uno::Reference< uno::XInterface >(), 369cdf0e10cSrcweir uno::makeAny( e ) ); 370cdf0e10cSrcweir } 371cdf0e10cSrcweir } 372cdf0e10cSrcweir 373cdf0e10cSrcweir // -------------------------------------------------------------------------------- 374cdf0e10cSrcweir void SAL_CALL OLESimpleStorage::removeByName( const ::rtl::OUString& aName ) 375cdf0e10cSrcweir throw ( container::NoSuchElementException, 376cdf0e10cSrcweir lang::WrappedTargetException, 377cdf0e10cSrcweir uno::RuntimeException) 378cdf0e10cSrcweir { 379cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 380cdf0e10cSrcweir 381cdf0e10cSrcweir if ( m_bDisposed ) 382cdf0e10cSrcweir throw lang::DisposedException(); 383cdf0e10cSrcweir 384cdf0e10cSrcweir if ( !m_pStorage ) 385cdf0e10cSrcweir throw uno::RuntimeException(); 386cdf0e10cSrcweir 387cdf0e10cSrcweir if ( !m_bNoTemporaryCopy && !m_xStream.is() ) 388cdf0e10cSrcweir throw lang::WrappedTargetException(); // io::IOException(); // TODO 389cdf0e10cSrcweir 390cdf0e10cSrcweir if ( !m_pStorage->IsContained( aName ) ) 391cdf0e10cSrcweir throw container::NoSuchElementException(); // TODO: 392cdf0e10cSrcweir 393cdf0e10cSrcweir m_pStorage->Remove( aName ); 394cdf0e10cSrcweir 395cdf0e10cSrcweir if ( m_pStorage->GetError() ) 396cdf0e10cSrcweir { 397cdf0e10cSrcweir m_pStorage->ResetError(); 398cdf0e10cSrcweir throw lang::WrappedTargetException(); // io::IOException(); // TODO 399cdf0e10cSrcweir } 400cdf0e10cSrcweir } 401cdf0e10cSrcweir 402cdf0e10cSrcweir // -------------------------------------------------------------------------------- 403cdf0e10cSrcweir void SAL_CALL OLESimpleStorage::replaceByName( const ::rtl::OUString& aName, const uno::Any& aElement ) 404cdf0e10cSrcweir throw ( lang::IllegalArgumentException, 405cdf0e10cSrcweir container::NoSuchElementException, 406cdf0e10cSrcweir lang::WrappedTargetException, 407cdf0e10cSrcweir uno::RuntimeException) 408cdf0e10cSrcweir { 409cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 410cdf0e10cSrcweir 411cdf0e10cSrcweir if ( m_bDisposed ) 412cdf0e10cSrcweir throw lang::DisposedException(); 413cdf0e10cSrcweir 414cdf0e10cSrcweir removeByName( aName ); 415cdf0e10cSrcweir 416cdf0e10cSrcweir try 417cdf0e10cSrcweir { 418cdf0e10cSrcweir insertByName( aName, aElement ); 419cdf0e10cSrcweir } 420cdf0e10cSrcweir catch( container::ElementExistException& ) 421cdf0e10cSrcweir { 422cdf0e10cSrcweir uno::Any aCaught( ::cppu::getCaughtException() ); 423cdf0e10cSrcweir 424cdf0e10cSrcweir throw lang::WrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy raw stream" ), 425cdf0e10cSrcweir uno::Reference< uno::XInterface >(), 426cdf0e10cSrcweir aCaught ); 427cdf0e10cSrcweir } 428cdf0e10cSrcweir } 429cdf0e10cSrcweir 430cdf0e10cSrcweir // -------------------------------------------------------------------------------- 431cdf0e10cSrcweir uno::Any SAL_CALL OLESimpleStorage::getByName( const ::rtl::OUString& aName ) 432cdf0e10cSrcweir throw ( container::NoSuchElementException, 433cdf0e10cSrcweir lang::WrappedTargetException, 434cdf0e10cSrcweir uno::RuntimeException ) 435cdf0e10cSrcweir { 436cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 437cdf0e10cSrcweir 438cdf0e10cSrcweir if ( m_bDisposed ) 439cdf0e10cSrcweir throw lang::DisposedException(); 440cdf0e10cSrcweir 441cdf0e10cSrcweir if ( !m_pStorage ) 442cdf0e10cSrcweir throw uno::RuntimeException(); 443cdf0e10cSrcweir 444cdf0e10cSrcweir if ( !m_pStorage->IsContained( aName ) ) 445cdf0e10cSrcweir throw container::NoSuchElementException(); // TODO: 446cdf0e10cSrcweir 447cdf0e10cSrcweir uno::Any aResult; 448cdf0e10cSrcweir 449cdf0e10cSrcweir uno::Reference< io::XStream > xTempFile( 450*641497eaSDamjan Jovanovic m_xContext->getServiceManager()->createInstanceWithContext( ::rtl::OUString::createFromAscii( "com.sun.star.io.TempFile" ), m_xContext ), 451cdf0e10cSrcweir uno::UNO_QUERY ); 452cdf0e10cSrcweir uno::Reference< io::XSeekable > xSeekable( xTempFile, uno::UNO_QUERY_THROW ); 453cdf0e10cSrcweir uno::Reference< io::XOutputStream > xOutputStream = xTempFile->getOutputStream(); 454cdf0e10cSrcweir uno::Reference< io::XInputStream > xInputStream = xTempFile->getInputStream(); 455cdf0e10cSrcweir if ( !xOutputStream.is() || !xInputStream.is() ) 456cdf0e10cSrcweir throw uno::RuntimeException(); 457cdf0e10cSrcweir 458cdf0e10cSrcweir if ( m_pStorage->IsStorage( aName ) ) 459cdf0e10cSrcweir { 460cdf0e10cSrcweir BaseStorage* pStrg = m_pStorage->OpenStorage( aName ); 461cdf0e10cSrcweir m_pStorage->ResetError(); 462cdf0e10cSrcweir if ( !pStrg ) 463cdf0e10cSrcweir throw io::IOException(); 464cdf0e10cSrcweir 465cdf0e10cSrcweir SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( xTempFile, sal_False ); // do not close the original stream 466cdf0e10cSrcweir if ( !pStream ) 467cdf0e10cSrcweir throw uno::RuntimeException(); 468cdf0e10cSrcweir 469cdf0e10cSrcweir BaseStorage* pNewStor = new Storage( *pStream, sal_False ); 470cdf0e10cSrcweir sal_Bool bSuccess = 471cdf0e10cSrcweir ( pStrg->CopyTo( pNewStor ) && pNewStor->Commit() && !pNewStor->GetError() && !pStrg->GetError() ); 472cdf0e10cSrcweir 473cdf0e10cSrcweir DELETEZ( pNewStor ); 474cdf0e10cSrcweir DELETEZ( pStrg ); 475cdf0e10cSrcweir DELETEZ( pStream ); 476cdf0e10cSrcweir 477cdf0e10cSrcweir if ( !bSuccess ) 478cdf0e10cSrcweir throw uno::RuntimeException(); 479cdf0e10cSrcweir 480cdf0e10cSrcweir uno::Sequence< uno::Any > aArgs( 2 ); 481cdf0e10cSrcweir aArgs[0] <<= xInputStream; // allow readonly access only 482cdf0e10cSrcweir aArgs[1] <<= (sal_Bool)sal_True; // do not create copy 483cdf0e10cSrcweir 484cdf0e10cSrcweir uno::Reference< container::XNameContainer > xResultNameContainer( 485*641497eaSDamjan Jovanovic m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( 486cdf0e10cSrcweir ::rtl::OUString::createFromAscii( "com.sun.star.embed.OLESimpleStorage" ), 487*641497eaSDamjan Jovanovic aArgs, 488*641497eaSDamjan Jovanovic m_xContext ), 489cdf0e10cSrcweir uno::UNO_QUERY_THROW ); 490cdf0e10cSrcweir 491cdf0e10cSrcweir aResult <<= xResultNameContainer; 492cdf0e10cSrcweir } 493cdf0e10cSrcweir else 494cdf0e10cSrcweir { 495cdf0e10cSrcweir BaseStorageStream* pStream = m_pStorage->OpenStream( aName, STREAM_READ | STREAM_SHARE_DENYALL | STREAM_NOCREATE ); 496cdf0e10cSrcweir if ( !pStream || pStream->GetError() || m_pStorage->GetError() ) 497cdf0e10cSrcweir { 498cdf0e10cSrcweir m_pStorage->ResetError(); 499cdf0e10cSrcweir DELETEZ( pStream ); 500cdf0e10cSrcweir throw io::IOException(); // TODO 501cdf0e10cSrcweir } 502cdf0e10cSrcweir 503cdf0e10cSrcweir try 504cdf0e10cSrcweir { 505cdf0e10cSrcweir uno::Sequence< sal_Int8 > aData( nBytesCount ); 506cdf0e10cSrcweir sal_Int32 nSize = nBytesCount; 507cdf0e10cSrcweir sal_Int32 nRead = 0; 508cdf0e10cSrcweir while( 0 != ( nRead = pStream->Read( aData.getArray(), nSize ) ) ) 509cdf0e10cSrcweir { 510cdf0e10cSrcweir if ( nRead < nSize ) 511cdf0e10cSrcweir { 512cdf0e10cSrcweir nSize = nRead; 513cdf0e10cSrcweir aData.realloc( nSize ); 514cdf0e10cSrcweir } 515cdf0e10cSrcweir 516cdf0e10cSrcweir xOutputStream->writeBytes( aData ); 517cdf0e10cSrcweir } 518cdf0e10cSrcweir 519cdf0e10cSrcweir if ( pStream->GetError() ) 520cdf0e10cSrcweir throw io::IOException(); // TODO 521cdf0e10cSrcweir 522cdf0e10cSrcweir xOutputStream->closeOutput(); 523cdf0e10cSrcweir xSeekable->seek( 0 ); 524cdf0e10cSrcweir } 525cdf0e10cSrcweir catch( uno::RuntimeException& ) 526cdf0e10cSrcweir { 527cdf0e10cSrcweir DELETEZ( pStream ); 528cdf0e10cSrcweir throw; 529cdf0e10cSrcweir } 530cdf0e10cSrcweir catch( uno::Exception& ) 531cdf0e10cSrcweir { 532cdf0e10cSrcweir DELETEZ( pStream ); 533cdf0e10cSrcweir throw lang::WrappedTargetException(); // TODO: 534cdf0e10cSrcweir } 535cdf0e10cSrcweir 536cdf0e10cSrcweir DELETEZ( pStream ); 537cdf0e10cSrcweir 538cdf0e10cSrcweir aResult <<= xInputStream; 539cdf0e10cSrcweir } 540cdf0e10cSrcweir 541cdf0e10cSrcweir return aResult; 542cdf0e10cSrcweir } 543cdf0e10cSrcweir 544cdf0e10cSrcweir // -------------------------------------------------------------------------------- 545cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > SAL_CALL OLESimpleStorage::getElementNames() 546cdf0e10cSrcweir throw ( uno::RuntimeException ) 547cdf0e10cSrcweir { 548cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 549cdf0e10cSrcweir 550cdf0e10cSrcweir if ( m_bDisposed ) 551cdf0e10cSrcweir throw lang::DisposedException(); 552cdf0e10cSrcweir 553cdf0e10cSrcweir if ( !m_pStorage ) 554cdf0e10cSrcweir throw uno::RuntimeException(); 555cdf0e10cSrcweir 556cdf0e10cSrcweir SvStorageInfoList aList; 557cdf0e10cSrcweir m_pStorage->FillInfoList( &aList ); 558cdf0e10cSrcweir 559cdf0e10cSrcweir if ( m_pStorage->GetError() ) 560cdf0e10cSrcweir { 561cdf0e10cSrcweir m_pStorage->ResetError(); 562cdf0e10cSrcweir throw uno::RuntimeException(); // TODO: 563cdf0e10cSrcweir } 564cdf0e10cSrcweir 565cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > aSeq( aList.Count() ); 566cdf0e10cSrcweir for ( sal_uInt32 nInd = 0; nInd < aList.Count(); nInd++ ) 567cdf0e10cSrcweir aSeq[nInd] = aList[nInd].GetName(); 568cdf0e10cSrcweir 569cdf0e10cSrcweir return aSeq; 570cdf0e10cSrcweir } 571cdf0e10cSrcweir 572cdf0e10cSrcweir // -------------------------------------------------------------------------------- 573cdf0e10cSrcweir sal_Bool SAL_CALL OLESimpleStorage::hasByName( const ::rtl::OUString& aName ) 574cdf0e10cSrcweir throw ( uno::RuntimeException ) 575cdf0e10cSrcweir { 576cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 577cdf0e10cSrcweir 578cdf0e10cSrcweir if ( m_bDisposed ) 579cdf0e10cSrcweir throw lang::DisposedException(); 580cdf0e10cSrcweir 581cdf0e10cSrcweir if ( !m_pStorage ) 582cdf0e10cSrcweir throw uno::RuntimeException(); 583cdf0e10cSrcweir 584cdf0e10cSrcweir sal_Bool bResult = m_pStorage->IsContained( aName ); 585cdf0e10cSrcweir 586cdf0e10cSrcweir if ( m_pStorage->GetError() ) 587cdf0e10cSrcweir { 588cdf0e10cSrcweir m_pStorage->ResetError(); 589cdf0e10cSrcweir throw uno::RuntimeException(); // TODO: 590cdf0e10cSrcweir } 591cdf0e10cSrcweir 592cdf0e10cSrcweir return bResult; 593cdf0e10cSrcweir } 594cdf0e10cSrcweir 595cdf0e10cSrcweir // -------------------------------------------------------------------------------- 596cdf0e10cSrcweir uno::Type SAL_CALL OLESimpleStorage::getElementType() 597cdf0e10cSrcweir throw ( uno::RuntimeException ) 598cdf0e10cSrcweir { 599cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 600cdf0e10cSrcweir 601cdf0e10cSrcweir if ( m_bDisposed ) 602cdf0e10cSrcweir throw lang::DisposedException(); 603cdf0e10cSrcweir 604cdf0e10cSrcweir return getCppuType( (const uno::Reference< io::XInputStream >*)NULL ); 605cdf0e10cSrcweir } 606cdf0e10cSrcweir 607cdf0e10cSrcweir // -------------------------------------------------------------------------------- 608cdf0e10cSrcweir sal_Bool SAL_CALL OLESimpleStorage::hasElements() 609cdf0e10cSrcweir throw ( uno::RuntimeException ) 610cdf0e10cSrcweir { 611cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 612cdf0e10cSrcweir 613cdf0e10cSrcweir if ( m_bDisposed ) 614cdf0e10cSrcweir throw lang::DisposedException(); 615cdf0e10cSrcweir 616cdf0e10cSrcweir if ( !m_pStorage ) 617cdf0e10cSrcweir throw uno::RuntimeException(); 618cdf0e10cSrcweir 619cdf0e10cSrcweir SvStorageInfoList aList; 620cdf0e10cSrcweir m_pStorage->FillInfoList( &aList ); 621cdf0e10cSrcweir 622cdf0e10cSrcweir if ( m_pStorage->GetError() ) 623cdf0e10cSrcweir { 624cdf0e10cSrcweir m_pStorage->ResetError(); 625cdf0e10cSrcweir throw uno::RuntimeException(); // TODO: 626cdf0e10cSrcweir } 627cdf0e10cSrcweir 628cdf0e10cSrcweir return ( aList.Count() != 0 ); 629cdf0e10cSrcweir } 630cdf0e10cSrcweir 631cdf0e10cSrcweir //____________________________________________________________________________________________________ 632cdf0e10cSrcweir // XComponent 633cdf0e10cSrcweir //____________________________________________________________________________________________________ 634cdf0e10cSrcweir 635cdf0e10cSrcweir // -------------------------------------------------------------------------------- 636cdf0e10cSrcweir void SAL_CALL OLESimpleStorage::dispose() 637cdf0e10cSrcweir throw ( uno::RuntimeException ) 638cdf0e10cSrcweir { 639cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 640cdf0e10cSrcweir 641cdf0e10cSrcweir if ( m_bDisposed ) 642cdf0e10cSrcweir throw lang::DisposedException(); 643cdf0e10cSrcweir 644cdf0e10cSrcweir if ( m_pListenersContainer ) 645cdf0e10cSrcweir { 646cdf0e10cSrcweir lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >(this) ); 647cdf0e10cSrcweir m_pListenersContainer->disposeAndClear( aSource ); 648cdf0e10cSrcweir } 649cdf0e10cSrcweir 650cdf0e10cSrcweir DELETEZ( m_pStorage ); 651cdf0e10cSrcweir DELETEZ( m_pStream ); 652cdf0e10cSrcweir 653cdf0e10cSrcweir m_xStream = uno::Reference< io::XStream >(); 654cdf0e10cSrcweir m_xTempStream = uno::Reference< io::XStream >(); 655cdf0e10cSrcweir 656cdf0e10cSrcweir m_bDisposed = sal_True; 657cdf0e10cSrcweir } 658cdf0e10cSrcweir 659cdf0e10cSrcweir // -------------------------------------------------------------------------------- 660cdf0e10cSrcweir void SAL_CALL OLESimpleStorage::addEventListener( 661cdf0e10cSrcweir const uno::Reference< lang::XEventListener >& xListener ) 662cdf0e10cSrcweir throw ( uno::RuntimeException ) 663cdf0e10cSrcweir { 664cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 665cdf0e10cSrcweir 666cdf0e10cSrcweir if ( m_bDisposed ) 667cdf0e10cSrcweir throw lang::DisposedException(); 668cdf0e10cSrcweir 669cdf0e10cSrcweir if ( !m_pListenersContainer ) 670cdf0e10cSrcweir m_pListenersContainer = new ::cppu::OInterfaceContainerHelper( m_aMutex ); 671cdf0e10cSrcweir 672cdf0e10cSrcweir m_pListenersContainer->addInterface( xListener ); 673cdf0e10cSrcweir } 674cdf0e10cSrcweir 675cdf0e10cSrcweir // -------------------------------------------------------------------------------- 676cdf0e10cSrcweir void SAL_CALL OLESimpleStorage::removeEventListener( 677cdf0e10cSrcweir const uno::Reference< lang::XEventListener >& xListener ) 678cdf0e10cSrcweir throw ( uno::RuntimeException ) 679cdf0e10cSrcweir { 680cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 681cdf0e10cSrcweir 682cdf0e10cSrcweir if ( m_bDisposed ) 683cdf0e10cSrcweir throw lang::DisposedException(); 684cdf0e10cSrcweir 685cdf0e10cSrcweir if ( m_pListenersContainer ) 686cdf0e10cSrcweir m_pListenersContainer->removeInterface( xListener ); 687cdf0e10cSrcweir } 688cdf0e10cSrcweir 689cdf0e10cSrcweir //____________________________________________________________________________________________________ 690cdf0e10cSrcweir // XTransactedObject 691cdf0e10cSrcweir //____________________________________________________________________________________________________ 692cdf0e10cSrcweir 693cdf0e10cSrcweir // -------------------------------------------------------------------------------- 694cdf0e10cSrcweir void SAL_CALL OLESimpleStorage::commit() 695cdf0e10cSrcweir throw ( ::com::sun::star::io::IOException, 696cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 697cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException ) 698cdf0e10cSrcweir { 699cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 700cdf0e10cSrcweir 701cdf0e10cSrcweir if ( m_bDisposed ) 702cdf0e10cSrcweir throw lang::DisposedException(); 703cdf0e10cSrcweir 704cdf0e10cSrcweir if ( !m_pStorage ) 705cdf0e10cSrcweir throw uno::RuntimeException(); 706cdf0e10cSrcweir 707cdf0e10cSrcweir if ( !m_bNoTemporaryCopy && !m_xStream.is() ) 708cdf0e10cSrcweir throw io::IOException(); // TODO 709cdf0e10cSrcweir 710cdf0e10cSrcweir if ( !m_pStorage->Commit() || m_pStorage->GetError() ) 711cdf0e10cSrcweir { 712cdf0e10cSrcweir m_pStorage->ResetError(); 713cdf0e10cSrcweir throw io::IOException(); // TODO 714cdf0e10cSrcweir } 715cdf0e10cSrcweir 716cdf0e10cSrcweir UpdateOriginal_Impl(); 717cdf0e10cSrcweir } 718cdf0e10cSrcweir 719cdf0e10cSrcweir // -------------------------------------------------------------------------------- 720cdf0e10cSrcweir void SAL_CALL OLESimpleStorage::revert() 721cdf0e10cSrcweir throw ( ::com::sun::star::io::IOException, 722cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 723cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException ) 724cdf0e10cSrcweir { 725cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 726cdf0e10cSrcweir 727cdf0e10cSrcweir if ( m_bDisposed ) 728cdf0e10cSrcweir throw lang::DisposedException(); 729cdf0e10cSrcweir 730cdf0e10cSrcweir if ( !m_pStorage ) 731cdf0e10cSrcweir throw uno::RuntimeException(); 732cdf0e10cSrcweir 733cdf0e10cSrcweir if ( !m_bNoTemporaryCopy && !m_xStream.is() ) 734cdf0e10cSrcweir throw io::IOException(); // TODO 735cdf0e10cSrcweir 736cdf0e10cSrcweir if ( !m_pStorage->Revert() || m_pStorage->GetError() ) 737cdf0e10cSrcweir { 738cdf0e10cSrcweir m_pStorage->ResetError(); 739cdf0e10cSrcweir throw io::IOException(); // TODO 740cdf0e10cSrcweir } 741cdf0e10cSrcweir 742cdf0e10cSrcweir UpdateOriginal_Impl(); 743cdf0e10cSrcweir } 744cdf0e10cSrcweir 745cdf0e10cSrcweir //____________________________________________________________________________________________________ 746cdf0e10cSrcweir // XClassifiedObject 747cdf0e10cSrcweir //____________________________________________________________________________________________________ 748cdf0e10cSrcweir 749cdf0e10cSrcweir uno::Sequence< sal_Int8 > SAL_CALL OLESimpleStorage::getClassID() 750cdf0e10cSrcweir throw ( uno::RuntimeException ) 751cdf0e10cSrcweir { 752cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 753cdf0e10cSrcweir 754cdf0e10cSrcweir if ( m_bDisposed ) 755cdf0e10cSrcweir throw lang::DisposedException(); 756cdf0e10cSrcweir 757cdf0e10cSrcweir if ( !m_pStorage ) 758cdf0e10cSrcweir throw uno::RuntimeException(); 759cdf0e10cSrcweir 760cdf0e10cSrcweir return m_pStorage->GetClassName().GetByteSequence(); 761cdf0e10cSrcweir } 762cdf0e10cSrcweir 763cdf0e10cSrcweir ::rtl::OUString SAL_CALL OLESimpleStorage::getClassName() 764cdf0e10cSrcweir throw ( uno::RuntimeException ) 765cdf0e10cSrcweir { 766cdf0e10cSrcweir return ::rtl::OUString(); 767cdf0e10cSrcweir } 768cdf0e10cSrcweir 769cdf0e10cSrcweir void SAL_CALL OLESimpleStorage::setClassInfo( const uno::Sequence< sal_Int8 >& /*aClassID*/, 770cdf0e10cSrcweir const ::rtl::OUString& /*sClassName*/ ) 771cdf0e10cSrcweir throw ( lang::NoSupportException, 772cdf0e10cSrcweir uno::RuntimeException ) 773cdf0e10cSrcweir { 774cdf0e10cSrcweir throw lang::NoSupportException(); 775cdf0e10cSrcweir } 776cdf0e10cSrcweir 777cdf0e10cSrcweir //____________________________________________________________________________________________________ 778cdf0e10cSrcweir // XServiceInfo 779cdf0e10cSrcweir //____________________________________________________________________________________________________ 780cdf0e10cSrcweir 781cdf0e10cSrcweir // -------------------------------------------------------------------------------- 782cdf0e10cSrcweir ::rtl::OUString SAL_CALL OLESimpleStorage::getImplementationName() 783cdf0e10cSrcweir throw ( uno::RuntimeException ) 784cdf0e10cSrcweir { 785cdf0e10cSrcweir return impl_staticGetImplementationName(); 786cdf0e10cSrcweir } 787cdf0e10cSrcweir 788cdf0e10cSrcweir // -------------------------------------------------------------------------------- 789cdf0e10cSrcweir ::sal_Bool SAL_CALL OLESimpleStorage::supportsService( const ::rtl::OUString& ServiceName ) 790cdf0e10cSrcweir throw ( uno::RuntimeException ) 791cdf0e10cSrcweir { 792cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames(); 793cdf0e10cSrcweir 794cdf0e10cSrcweir for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ ) 795cdf0e10cSrcweir if ( ServiceName.compareTo( aSeq[nInd] ) == 0 ) 796cdf0e10cSrcweir return sal_True; 797cdf0e10cSrcweir 798cdf0e10cSrcweir return sal_False; 799cdf0e10cSrcweir } 800cdf0e10cSrcweir 801cdf0e10cSrcweir // -------------------------------------------------------------------------------- 802cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > SAL_CALL OLESimpleStorage::getSupportedServiceNames() 803cdf0e10cSrcweir throw ( uno::RuntimeException ) 804cdf0e10cSrcweir { 805cdf0e10cSrcweir return impl_staticGetSupportedServiceNames(); 806cdf0e10cSrcweir } 807