bump product version to 4.1.6.2
[LibreOffice.git] / sot / source / unoolestorage / xolesimplestorage.cxx
blobea0b9d7722aa80a342cb0d9f515f6ffae0461e10
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <com/sun/star/lang/DisposedException.hpp>
21 #include <com/sun/star/io/XStream.hpp>
22 #include <com/sun/star/io/XInputStream.hpp>
23 #include <com/sun/star/io/XSeekable.hpp>
24 #include <com/sun/star/io/XTruncate.hpp>
25 #include <com/sun/star/io/TempFile.hpp>
27 #include <comphelper/processfactory.hxx>
28 #include <comphelper/storagehelper.hxx>
30 #include <unotools/ucbstreamhelper.hxx>
32 #include <cppuhelper/exc_hlp.hxx>
34 #include <sot/storinfo.hxx>
36 #include "xolesimplestorage.hxx"
39 using namespace ::com::sun::star;
41 const sal_Int32 nBytesCount = 32000;
44 // --------------------------------------------------------------------------------
45 OLESimpleStorage::OLESimpleStorage( uno::Reference< lang::XMultiServiceFactory > xFactory )
46 : m_bDisposed( sal_False )
47 , m_pStream( NULL )
48 , m_pStorage( NULL )
49 , m_pListenersContainer( NULL )
50 , m_xFactory( xFactory )
51 , m_bNoTemporaryCopy( sal_False )
53 OSL_ENSURE( m_xFactory.is(), "No factory is provided on creation!\n" );
54 if ( !m_xFactory.is() )
55 throw uno::RuntimeException();
58 // --------------------------------------------------------------------------------
59 OLESimpleStorage::~OLESimpleStorage()
61 try {
62 m_refCount++;
63 dispose();
64 } catch( uno::Exception& )
67 if ( m_pListenersContainer )
69 delete m_pListenersContainer;
70 m_pListenersContainer = NULL;
74 //-------------------------------------------------------------------------
75 uno::Sequence< OUString > SAL_CALL OLESimpleStorage::impl_staticGetSupportedServiceNames()
77 uno::Sequence< OUString > aRet(1);
78 aRet[0] = OUString("com.sun.star.embed.OLESimpleStorage");
79 return aRet;
82 //-------------------------------------------------------------------------
83 OUString SAL_CALL OLESimpleStorage::impl_staticGetImplementationName()
85 return OUString("com.sun.star.comp.embed.OLESimpleStorage");
88 //-------------------------------------------------------------------------
89 uno::Reference< uno::XInterface > SAL_CALL OLESimpleStorage::impl_staticCreateSelfInstance(
90 const uno::Reference< lang::XMultiServiceFactory >& xServiceManager )
92 return uno::Reference< uno::XInterface >( *new OLESimpleStorage( xServiceManager ) );
95 //-------------------------------------------------------------------------
96 void OLESimpleStorage::UpdateOriginal_Impl()
98 if ( !m_bNoTemporaryCopy )
100 uno::Reference< io::XSeekable > xSeek( m_xStream, uno::UNO_QUERY_THROW );
101 xSeek->seek( 0 );
103 uno::Reference< io::XSeekable > xTempSeek( m_xTempStream, uno::UNO_QUERY_THROW );
104 sal_Int64 nPos = xTempSeek->getPosition();
105 xTempSeek->seek( 0 );
107 uno::Reference< io::XInputStream > xTempInp = m_xTempStream->getInputStream();
108 uno::Reference< io::XOutputStream > xOutputStream = m_xStream->getOutputStream();
109 if ( !xTempInp.is() || !xOutputStream.is() )
110 throw uno::RuntimeException();
112 uno::Reference< io::XTruncate > xTrunc( xOutputStream, uno::UNO_QUERY_THROW );
113 xTrunc->truncate();
115 ::comphelper::OStorageHelper::CopyInputToOutput( xTempInp, xOutputStream );
116 xOutputStream->flush();
117 xTempSeek->seek( nPos );
121 //-------------------------------------------------------------------------
122 void OLESimpleStorage::InsertInputStreamToStorage_Impl( BaseStorage* pStorage, OUString aName, const uno::Reference< io::XInputStream >& xInputStream )
123 throw ( uno::Exception )
125 if ( !pStorage || aName.isEmpty() || !xInputStream.is() )
126 throw uno::RuntimeException();
128 if ( pStorage->IsContained( aName ) )
129 throw container::ElementExistException(); // TODO:
131 BaseStorageStream* pNewStream = pStorage->OpenStream( aName );
132 if ( !pNewStream || pNewStream->GetError() || pStorage->GetError() )
134 if ( pNewStream )
135 DELETEZ( pNewStream );
136 pStorage->ResetError();
137 throw io::IOException(); // TODO
142 uno::Sequence< sal_Int8 > aData( nBytesCount );
143 sal_Int32 nRead = 0;
146 nRead = xInputStream->readBytes( aData, nBytesCount );
147 if ( nRead < nBytesCount )
148 aData.realloc( nRead );
150 sal_Int32 nWritten = pNewStream->Write( aData.getArray(), nRead );
151 if ( nWritten < nRead )
152 throw io::IOException();
153 } while( nRead == nBytesCount );
155 catch( uno::Exception& )
157 DELETEZ( pNewStream );
158 pStorage->Remove( aName );
160 throw;
163 DELETEZ( pNewStream );
166 //-------------------------------------------------------------------------
167 void OLESimpleStorage::InsertNameAccessToStorage_Impl( BaseStorage* pStorage, OUString aName, const uno::Reference< container::XNameAccess >& xNameAccess )
168 throw ( uno::Exception )
170 if ( !pStorage || aName.isEmpty() || !xNameAccess.is() )
171 throw uno::RuntimeException();
173 if ( pStorage->IsContained( aName ) )
174 throw container::ElementExistException(); // TODO:
176 BaseStorage* pNewStorage = pStorage->OpenStorage( aName );
177 if ( !pNewStorage || pNewStorage->GetError() || pStorage->GetError() )
179 if ( pNewStorage )
180 DELETEZ( pNewStorage );
181 pStorage->ResetError();
182 throw io::IOException(); // TODO
187 uno::Sequence< OUString > aElements = xNameAccess->getElementNames();
188 for ( sal_Int32 nInd = 0; nInd < aElements.getLength(); nInd++ )
190 uno::Reference< io::XInputStream > xInputStream;
191 uno::Reference< container::XNameAccess > xSubNameAccess;
192 uno::Any aAny = xNameAccess->getByName( aElements[nInd] );
193 if ( aAny >>= xInputStream )
194 InsertInputStreamToStorage_Impl( pNewStorage, aElements[nInd], xInputStream );
195 else if ( aAny >>= xSubNameAccess )
196 InsertNameAccessToStorage_Impl( pNewStorage, aElements[nInd], xSubNameAccess );
199 catch( uno::Exception& )
201 DELETEZ( pNewStorage );
202 pStorage->Remove( aName );
204 throw;
207 DELETEZ( pNewStorage );
210 //____________________________________________________________________________________________________
211 // XInitialization
212 //____________________________________________________________________________________________________
214 void SAL_CALL OLESimpleStorage::initialize( const uno::Sequence< uno::Any >& aArguments )
215 throw ( uno::Exception,
216 uno::RuntimeException)
218 if ( m_pStream || m_pStorage )
219 throw io::IOException(); // TODO: already initilized
221 sal_Int32 nArgNum = aArguments.getLength();
222 OSL_ENSURE( nArgNum >= 1 && nArgNum <= 2, "Wrong parameter number" );
224 if ( nArgNum < 1 || nArgNum > 2 )
225 throw lang::IllegalArgumentException(); // TODO:
227 uno::Reference< io::XStream > xStream;
228 uno::Reference< io::XInputStream > xInputStream;
229 if ( !( aArguments[0] >>= xStream ) && !( aArguments[0] >>= xInputStream ) )
230 throw lang::IllegalArgumentException(); // TODO:
232 if ( nArgNum == 2 )
234 if ( !( aArguments[1] >>= m_bNoTemporaryCopy ) )
235 throw lang::IllegalArgumentException(); // TODO:
238 if ( m_bNoTemporaryCopy )
240 // TODO: ???
241 // If the temporary stream is not created, the original stream must be wrapped
242 // since SvStream wrapper closes the stream is owns
243 if ( xInputStream.is() )
245 // the stream must be seekable for direct access
246 uno::Reference< io::XSeekable > xSeek( xInputStream, uno::UNO_QUERY_THROW );
247 m_pStream = ::utl::UcbStreamHelper::CreateStream( xInputStream, sal_False );
249 else if ( xStream.is() )
251 // the stream must be seekable for direct access
252 uno::Reference< io::XSeekable > xSeek( xStream, uno::UNO_QUERY_THROW );
253 m_pStream = ::utl::UcbStreamHelper::CreateStream( xStream, sal_False );
255 else
256 throw lang::IllegalArgumentException(); // TODO:
258 else
260 uno::Reference < io::XStream > xTempFile(
261 io::TempFile::create(comphelper::getComponentContext(m_xFactory)),
262 uno::UNO_QUERY_THROW );
263 uno::Reference < io::XSeekable > xTempSeek( xTempFile, uno::UNO_QUERY_THROW );
264 uno::Reference< io::XOutputStream > xTempOut = xTempFile->getOutputStream();
265 if ( !xTempOut.is() )
266 throw uno::RuntimeException();
268 if ( xInputStream.is() )
272 uno::Reference< io::XSeekable > xSeek( xInputStream, uno::UNO_QUERY_THROW );
273 xSeek->seek( 0 );
275 catch( uno::Exception& )
278 ::comphelper::OStorageHelper::CopyInputToOutput( xInputStream, xTempOut );
279 xTempOut->closeOutput();
280 xTempSeek->seek( 0 );
281 uno::Reference< io::XInputStream > xTempInput = xTempFile->getInputStream();
282 m_pStream = ::utl::UcbStreamHelper::CreateStream( xTempInput, sal_False );
284 else if ( xStream.is() )
286 // not sure that the storage flashes the stream on commit
287 m_xStream = xStream;
288 m_xTempStream = xTempFile;
290 uno::Reference< io::XSeekable > xSeek( xStream, uno::UNO_QUERY_THROW );
291 xSeek->seek( 0 );
292 uno::Reference< io::XInputStream > xInpStream = xStream->getInputStream();
293 if ( !xInpStream.is() || !xStream->getOutputStream().is() )
294 throw uno::RuntimeException();
296 ::comphelper::OStorageHelper::CopyInputToOutput( xInpStream, xTempOut );
297 xTempOut->flush();
298 xTempSeek->seek( 0 );
300 m_pStream = ::utl::UcbStreamHelper::CreateStream( xTempFile, sal_False );
302 else
303 throw lang::IllegalArgumentException(); // TODO:
306 if ( !m_pStream || m_pStream->GetError() )
307 throw io::IOException(); // TODO
309 m_pStorage = new Storage( *m_pStream, sal_False );
313 //____________________________________________________________________________________________________
314 // XNameContainer
315 //____________________________________________________________________________________________________
317 // --------------------------------------------------------------------------------
318 void SAL_CALL OLESimpleStorage::insertByName( const OUString& aName, const uno::Any& aElement )
319 throw ( lang::IllegalArgumentException,
320 container::ElementExistException,
321 lang::WrappedTargetException,
322 uno::RuntimeException)
324 ::osl::MutexGuard aGuard( m_aMutex );
326 if ( m_bDisposed )
327 throw lang::DisposedException();
329 if ( !m_pStorage )
330 throw uno::RuntimeException();
332 uno::Reference< io::XStream > xStream;
333 uno::Reference< io::XInputStream > xInputStream;
334 uno::Reference< container::XNameAccess > xNameAccess;
338 if ( !m_bNoTemporaryCopy && !m_xStream.is() )
339 throw io::IOException(); // TODO
341 if ( aElement >>= xStream )
342 xInputStream = xStream->getInputStream();
343 else if ( !( aElement >>= xInputStream ) && !( aElement >>= xNameAccess ) )
344 throw lang::IllegalArgumentException(); // TODO:
346 if ( xInputStream.is() )
347 InsertInputStreamToStorage_Impl( m_pStorage, aName, xInputStream );
348 else if ( xNameAccess.is() )
349 InsertNameAccessToStorage_Impl( m_pStorage, aName, xNameAccess );
350 else
351 throw uno::RuntimeException();
353 catch( uno::RuntimeException& )
355 throw;
357 catch( container::ElementExistException& )
359 throw;
361 catch( const uno::Exception& e )
363 throw lang::WrappedTargetException( OUString( "Insert has failed!" ),
364 uno::Reference< uno::XInterface >(),
365 uno::makeAny( e ) );
369 // --------------------------------------------------------------------------------
370 void SAL_CALL OLESimpleStorage::removeByName( const OUString& aName )
371 throw ( container::NoSuchElementException,
372 lang::WrappedTargetException,
373 uno::RuntimeException)
375 ::osl::MutexGuard aGuard( m_aMutex );
377 if ( m_bDisposed )
378 throw lang::DisposedException();
380 if ( !m_pStorage )
381 throw uno::RuntimeException();
383 if ( !m_bNoTemporaryCopy && !m_xStream.is() )
384 throw lang::WrappedTargetException(); // io::IOException(); // TODO
386 if ( !m_pStorage->IsContained( aName ) )
387 throw container::NoSuchElementException(); // TODO:
389 m_pStorage->Remove( aName );
391 if ( m_pStorage->GetError() )
393 m_pStorage->ResetError();
394 throw lang::WrappedTargetException(); // io::IOException(); // TODO
398 // --------------------------------------------------------------------------------
399 void SAL_CALL OLESimpleStorage::replaceByName( const OUString& aName, const uno::Any& aElement )
400 throw ( lang::IllegalArgumentException,
401 container::NoSuchElementException,
402 lang::WrappedTargetException,
403 uno::RuntimeException)
405 ::osl::MutexGuard aGuard( m_aMutex );
407 if ( m_bDisposed )
408 throw lang::DisposedException();
410 removeByName( aName );
414 insertByName( aName, aElement );
416 catch( container::ElementExistException& )
418 uno::Any aCaught( ::cppu::getCaughtException() );
420 throw lang::WrappedTargetException( OUString("Can't copy raw stream"),
421 uno::Reference< uno::XInterface >(),
422 aCaught );
426 // --------------------------------------------------------------------------------
427 uno::Any SAL_CALL OLESimpleStorage::getByName( const OUString& aName )
428 throw ( container::NoSuchElementException,
429 lang::WrappedTargetException,
430 uno::RuntimeException )
432 ::osl::MutexGuard aGuard( m_aMutex );
434 if ( m_bDisposed )
435 throw lang::DisposedException();
437 if ( !m_pStorage )
438 throw uno::RuntimeException();
440 if ( !m_pStorage->IsContained( aName ) )
441 throw container::NoSuchElementException(); // TODO:
443 uno::Any aResult;
445 uno::Reference< io::XStream > xTempFile(
446 io::TempFile::create(comphelper::getComponentContext(m_xFactory)),
447 uno::UNO_QUERY );
448 uno::Reference< io::XSeekable > xSeekable( xTempFile, uno::UNO_QUERY_THROW );
449 uno::Reference< io::XOutputStream > xOutputStream = xTempFile->getOutputStream();
450 uno::Reference< io::XInputStream > xInputStream = xTempFile->getInputStream();
451 if ( !xOutputStream.is() || !xInputStream.is() )
452 throw uno::RuntimeException();
454 if ( m_pStorage->IsStorage( aName ) )
456 BaseStorage* pStrg = m_pStorage->OpenStorage( aName );
457 m_pStorage->ResetError();
458 if ( !pStrg )
459 throw io::IOException();
461 SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( xTempFile, sal_False ); // do not close the original stream
462 if ( !pStream )
463 throw uno::RuntimeException();
465 BaseStorage* pNewStor = new Storage( *pStream, sal_False );
466 sal_Bool bSuccess =
467 ( pStrg->CopyTo( pNewStor ) && pNewStor->Commit() && !pNewStor->GetError() && !pStrg->GetError() );
469 DELETEZ( pNewStor );
470 DELETEZ( pStrg );
471 DELETEZ( pStream );
473 if ( !bSuccess )
474 throw uno::RuntimeException();
476 uno::Sequence< uno::Any > aArgs( 2 );
477 aArgs[0] <<= xInputStream; // allow readonly access only
478 aArgs[1] <<= (sal_Bool)sal_True; // do not create copy
480 uno::Reference< container::XNameContainer > xResultNameContainer(
481 m_xFactory->createInstanceWithArguments(
482 OUString("com.sun.star.embed.OLESimpleStorage"),
483 aArgs ),
484 uno::UNO_QUERY_THROW );
486 aResult <<= xResultNameContainer;
488 else
490 BaseStorageStream* pStream = m_pStorage->OpenStream( aName, STREAM_READ | STREAM_SHARE_DENYALL | STREAM_NOCREATE );
491 if ( !pStream || pStream->GetError() || m_pStorage->GetError() )
493 m_pStorage->ResetError();
494 DELETEZ( pStream );
495 throw io::IOException(); // TODO
500 uno::Sequence< sal_Int8 > aData( nBytesCount );
501 sal_Int32 nSize = nBytesCount;
502 sal_Int32 nRead = 0;
503 while( 0 != ( nRead = pStream->Read( aData.getArray(), nSize ) ) )
505 if ( nRead < nSize )
507 nSize = nRead;
508 aData.realloc( nSize );
511 xOutputStream->writeBytes( aData );
514 if ( pStream->GetError() )
515 throw io::IOException(); // TODO
517 xOutputStream->closeOutput();
518 xSeekable->seek( 0 );
520 catch( uno::RuntimeException& )
522 DELETEZ( pStream );
523 throw;
525 catch( uno::Exception& )
527 DELETEZ( pStream );
528 throw lang::WrappedTargetException(); // TODO:
531 DELETEZ( pStream );
533 aResult <<= xInputStream;
536 return aResult;
539 // --------------------------------------------------------------------------------
540 uno::Sequence< OUString > SAL_CALL OLESimpleStorage::getElementNames()
541 throw ( uno::RuntimeException )
543 ::osl::MutexGuard aGuard( m_aMutex );
545 if ( m_bDisposed )
546 throw lang::DisposedException();
548 if ( !m_pStorage )
549 throw uno::RuntimeException();
551 SvStorageInfoList aList;
552 m_pStorage->FillInfoList( &aList );
554 if ( m_pStorage->GetError() )
556 m_pStorage->ResetError();
557 throw uno::RuntimeException(); // TODO:
560 uno::Sequence< OUString > aSeq( aList.size() );
561 for ( sal_uInt32 nInd = 0; nInd < aList.size(); nInd++ )
562 aSeq[nInd] = aList[nInd].GetName();
564 return aSeq;
567 // --------------------------------------------------------------------------------
568 sal_Bool SAL_CALL OLESimpleStorage::hasByName( const OUString& aName )
569 throw ( uno::RuntimeException )
571 ::osl::MutexGuard aGuard( m_aMutex );
573 if ( m_bDisposed )
574 throw lang::DisposedException();
576 if ( !m_pStorage )
577 throw uno::RuntimeException();
579 sal_Bool bResult = m_pStorage->IsContained( aName );
581 if ( m_pStorage->GetError() )
583 m_pStorage->ResetError();
584 throw uno::RuntimeException(); // TODO:
587 return bResult;
590 // --------------------------------------------------------------------------------
591 uno::Type SAL_CALL OLESimpleStorage::getElementType()
592 throw ( uno::RuntimeException )
594 ::osl::MutexGuard aGuard( m_aMutex );
596 if ( m_bDisposed )
597 throw lang::DisposedException();
599 return getCppuType( (const uno::Reference< io::XInputStream >*)NULL );
602 // --------------------------------------------------------------------------------
603 sal_Bool SAL_CALL OLESimpleStorage::hasElements()
604 throw ( uno::RuntimeException )
606 ::osl::MutexGuard aGuard( m_aMutex );
608 if ( m_bDisposed )
609 throw lang::DisposedException();
611 if ( !m_pStorage )
612 throw uno::RuntimeException();
614 SvStorageInfoList aList;
615 m_pStorage->FillInfoList( &aList );
617 if ( m_pStorage->GetError() )
619 m_pStorage->ResetError();
620 throw uno::RuntimeException(); // TODO:
623 return ( aList.size() != 0 );
626 //____________________________________________________________________________________________________
627 // XComponent
628 //____________________________________________________________________________________________________
630 // --------------------------------------------------------------------------------
631 void SAL_CALL OLESimpleStorage::dispose()
632 throw ( uno::RuntimeException )
634 ::osl::MutexGuard aGuard( m_aMutex );
636 if ( m_bDisposed )
637 throw lang::DisposedException();
639 if ( m_pListenersContainer )
641 lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >(this) );
642 m_pListenersContainer->disposeAndClear( aSource );
645 DELETEZ( m_pStorage );
646 DELETEZ( m_pStream );
648 m_xStream = uno::Reference< io::XStream >();
649 m_xTempStream = uno::Reference< io::XStream >();
651 m_bDisposed = sal_True;
654 // --------------------------------------------------------------------------------
655 void SAL_CALL OLESimpleStorage::addEventListener(
656 const uno::Reference< lang::XEventListener >& xListener )
657 throw ( uno::RuntimeException )
659 ::osl::MutexGuard aGuard( m_aMutex );
661 if ( m_bDisposed )
662 throw lang::DisposedException();
664 if ( !m_pListenersContainer )
665 m_pListenersContainer = new ::cppu::OInterfaceContainerHelper( m_aMutex );
667 m_pListenersContainer->addInterface( xListener );
670 // --------------------------------------------------------------------------------
671 void SAL_CALL OLESimpleStorage::removeEventListener(
672 const uno::Reference< lang::XEventListener >& xListener )
673 throw ( uno::RuntimeException )
675 ::osl::MutexGuard aGuard( m_aMutex );
677 if ( m_bDisposed )
678 throw lang::DisposedException();
680 if ( m_pListenersContainer )
681 m_pListenersContainer->removeInterface( xListener );
684 //____________________________________________________________________________________________________
685 // XTransactedObject
686 //____________________________________________________________________________________________________
688 // --------------------------------------------------------------------------------
689 void SAL_CALL OLESimpleStorage::commit()
690 throw ( ::com::sun::star::io::IOException,
691 ::com::sun::star::lang::WrappedTargetException,
692 ::com::sun::star::uno::RuntimeException )
694 ::osl::MutexGuard aGuard( m_aMutex );
696 if ( m_bDisposed )
697 throw lang::DisposedException();
699 if ( !m_pStorage )
700 throw uno::RuntimeException();
702 if ( !m_bNoTemporaryCopy && !m_xStream.is() )
703 throw io::IOException(); // TODO
705 if ( !m_pStorage->Commit() || m_pStorage->GetError() )
707 m_pStorage->ResetError();
708 throw io::IOException(); // TODO
711 UpdateOriginal_Impl();
714 // --------------------------------------------------------------------------------
715 void SAL_CALL OLESimpleStorage::revert()
716 throw ( ::com::sun::star::io::IOException,
717 ::com::sun::star::lang::WrappedTargetException,
718 ::com::sun::star::uno::RuntimeException )
720 ::osl::MutexGuard aGuard( m_aMutex );
722 if ( m_bDisposed )
723 throw lang::DisposedException();
725 if ( !m_pStorage )
726 throw uno::RuntimeException();
728 if ( !m_bNoTemporaryCopy && !m_xStream.is() )
729 throw io::IOException(); // TODO
731 if ( !m_pStorage->Revert() || m_pStorage->GetError() )
733 m_pStorage->ResetError();
734 throw io::IOException(); // TODO
737 UpdateOriginal_Impl();
740 //____________________________________________________________________________________________________
741 // XClassifiedObject
742 //____________________________________________________________________________________________________
744 uno::Sequence< sal_Int8 > SAL_CALL OLESimpleStorage::getClassID()
745 throw ( uno::RuntimeException )
747 ::osl::MutexGuard aGuard( m_aMutex );
749 if ( m_bDisposed )
750 throw lang::DisposedException();
752 if ( !m_pStorage )
753 throw uno::RuntimeException();
755 return m_pStorage->GetClassName().GetByteSequence();
758 OUString SAL_CALL OLESimpleStorage::getClassName()
759 throw ( uno::RuntimeException )
761 return OUString();
764 void SAL_CALL OLESimpleStorage::setClassInfo( const uno::Sequence< sal_Int8 >& /*aClassID*/,
765 const OUString& /*sClassName*/ )
766 throw ( lang::NoSupportException,
767 uno::RuntimeException )
769 throw lang::NoSupportException();
772 //____________________________________________________________________________________________________
773 // XServiceInfo
774 //____________________________________________________________________________________________________
776 // --------------------------------------------------------------------------------
777 OUString SAL_CALL OLESimpleStorage::getImplementationName()
778 throw ( uno::RuntimeException )
780 return impl_staticGetImplementationName();
783 // --------------------------------------------------------------------------------
784 ::sal_Bool SAL_CALL OLESimpleStorage::supportsService( const OUString& ServiceName )
785 throw ( uno::RuntimeException )
787 uno::Sequence< OUString > aSeq = impl_staticGetSupportedServiceNames();
789 for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
790 if ( ServiceName == aSeq[nInd] )
791 return sal_True;
793 return sal_False;
796 // --------------------------------------------------------------------------------
797 uno::Sequence< OUString > SAL_CALL OLESimpleStorage::getSupportedServiceNames()
798 throw ( uno::RuntimeException )
800 return impl_staticGetSupportedServiceNames();
804 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */