LCOV - code coverage report
Current view: top level - ucb/source/ucp/tdoc - tdoc_stgelems.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 39 265 14.7 %
Date: 2012-08-25 Functions: 7 66 10.6 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 35 290 12.1 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : /**************************************************************************
      31                 :            :                                 TODO
      32                 :            :  **************************************************************************
      33                 :            : 
      34                 :            :  - remove root storage access workaround
      35                 :            : 
      36                 :            :  *************************************************************************/
      37                 :            : 
      38                 :            : #include "com/sun/star/lang/DisposedException.hpp"
      39                 :            : #include "com/sun/star/reflection/XProxyFactory.hpp"
      40                 :            : 
      41                 :            : #include "tdoc_uri.hxx"
      42                 :            : 
      43                 :            : #include "tdoc_stgelems.hxx"
      44                 :            : 
      45                 :            : using namespace com::sun::star;
      46                 :            : using namespace tdoc_ucp;
      47                 :            : 
      48                 :            : //=========================================================================
      49                 :            : //=========================================================================
      50                 :            : //
      51                 :            : // ParentStorageHolder Implementation.
      52                 :            : //
      53                 :            : //=========================================================================
      54                 :            : //=========================================================================
      55                 :            : 
      56                 :         95 : ParentStorageHolder::ParentStorageHolder(
      57                 :            :             const uno::Reference< embed::XStorage > & xParentStorage,
      58                 :            :             const rtl::OUString & rUri )
      59                 :            : : m_xParentStorage( xParentStorage ),
      60                 :         95 :   m_bParentIsRootStorage( false )
      61                 :            : {
      62                 :         95 :     Uri aUri( rUri );
      63 [ -  + ][ +  - ]:         95 :     if ( aUri.isDocument() )
      64                 :         95 :         m_bParentIsRootStorage = true;
      65                 :         95 : }
      66                 :            : 
      67                 :            : //=========================================================================
      68                 :            : //=========================================================================
      69                 :            : //
      70                 :            : // Storage Implementation.
      71                 :            : //
      72                 :            : //=========================================================================
      73                 :            : //=========================================================================
      74                 :            : 
      75                 :         95 : Storage::Storage( const uno::Reference< lang::XMultiServiceFactory > & xSMgr,
      76                 :            :                   const rtl::Reference< StorageElementFactory > & xFactory,
      77                 :            :                   const rtl::OUString & rUri,
      78                 :            :                   const uno::Reference< embed::XStorage > & xParentStorage,
      79                 :            :                   const uno::Reference< embed::XStorage > & xStorageToWrap )
      80         [ +  - ]:        190 : : ParentStorageHolder( xParentStorage, Uri( rUri ).getParentUri() ),
      81                 :            :   m_xFactory( xFactory ),
      82                 :            :   m_xWrappedStorage( xStorageToWrap ),
      83                 :            :   m_xWrappedTransObj( xStorageToWrap, uno::UNO_QUERY ), // optional interface
      84                 :            :   m_xWrappedComponent( xStorageToWrap, uno::UNO_QUERY ),
      85                 :            :   m_xWrappedTypeProv( xStorageToWrap, uno::UNO_QUERY ),
      86   [ +  -  +  - ]:        285 :   m_bIsDocumentStorage( Uri( rUri ).isDocument() )
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      87                 :            : {
      88                 :            :     OSL_ENSURE( m_xWrappedStorage.is(),
      89                 :            :                 "Storage::Storage: No storage to wrap!" );
      90                 :            : 
      91                 :            :     OSL_ENSURE( m_xWrappedComponent.is(),
      92                 :            :                 "Storage::Storage: No component to wrap!" );
      93                 :            : 
      94                 :            :     OSL_ENSURE( m_xWrappedTypeProv.is(),
      95                 :            :                 "Storage::Storage: No Type Provider!" );
      96                 :            : 
      97                 :            :     // Use proxy factory service to create aggregatable proxy.
      98                 :            :     try
      99                 :            :     {
     100                 :            :         uno::Reference< reflection::XProxyFactory > xProxyFac(
     101         [ +  - ]:         95 :             xSMgr->createInstance(
     102                 :            :                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
     103                 :         95 :                     "com.sun.star.reflection.ProxyFactory" ) ) ),
     104 [ +  - ][ +  - ]:         95 :             uno::UNO_QUERY );
                 [ +  - ]
     105         [ +  - ]:         95 :         if ( xProxyFac.is() )
     106                 :            :         {
     107 [ +  - ][ +  - ]:         95 :             m_xAggProxy = xProxyFac->createProxy( m_xWrappedStorage );
                 [ +  - ]
     108         [ #  # ]:         95 :         }
     109                 :            :     }
     110         [ #  # ]:          0 :     catch ( uno::Exception const & )
     111                 :            :     {
     112                 :            :         OSL_FAIL( "Storage::Storage: Caught exception!" );
     113                 :            :     }
     114                 :            : 
     115                 :            :     OSL_ENSURE( m_xAggProxy.is(),
     116                 :            :                 "Storage::Storage: Wrapped storage cannot be aggregated!" );
     117                 :            : 
     118         [ +  - ]:         95 :     if ( m_xAggProxy.is() )
     119                 :            :     {
     120         [ +  - ]:         95 :         osl_incrementInterlockedCount( &m_refCount );
     121                 :            :         {
     122                 :            :             // Solaris compiler problem:
     123                 :            :             // Extra block to enforce destruction of temporary object created
     124                 :            :             // in next statement _before_ osl_decrementInterlockedCount is
     125                 :            :             // called.  Otherwise 'this' will destroy itself even before ctor
     126                 :            :             // is completed (See impl. of XInterface::release())!
     127                 :            : 
     128         [ +  - ]:         95 :             m_xAggProxy->setDelegator(
     129 [ +  - ][ +  - ]:         95 :                 static_cast< cppu::OWeakObject * >( this ) );
     130                 :            :         }
     131         [ +  - ]:         95 :         osl_decrementInterlockedCount( &m_refCount );
     132                 :            :     }
     133                 :         95 : }
     134                 :            : 
     135                 :            : //=========================================================================
     136                 :            : // virtual
     137 [ +  - ][ +  - ]:         95 : Storage::~Storage()
     138                 :            : {
     139         [ +  - ]:         95 :     if ( m_xAggProxy.is() )
     140 [ +  - ][ +  - ]:         95 :         m_xAggProxy->setDelegator( uno::Reference< uno::XInterface >() );
                 [ #  # ]
     141                 :            : 
     142                 :            :     // Never dispose a document storage. Not owner!
     143         [ -  + ]:         95 :     if ( !isDocumentStorage() )
     144                 :            :     {
     145         [ #  # ]:          0 :         if ( m_xWrappedComponent.is() )
     146                 :            :         {
     147                 :            :             // "Auto-dispose"...
     148                 :            :             try
     149                 :            :             {
     150 [ #  # ][ #  # ]:          0 :                 m_xWrappedComponent->dispose();
     151                 :            :             }
     152         [ #  # ]:          0 :             catch ( lang::DisposedException const & )
     153                 :            :             {
     154                 :            :                 // might happen.
     155                 :            :             }
     156         [ #  # ]:          0 :             catch ( ... )
     157                 :            :             {
     158                 :            :                 OSL_FAIL( "Storage::~Storage - Caught exception!" );
     159                 :            :             }
     160                 :            :         }
     161                 :            :     }
     162         [ -  + ]:        190 : }
     163                 :            : 
     164                 :            : //=========================================================================
     165                 :            : //
     166                 :            : // uno::XInterface
     167                 :            : //
     168                 :            : //=========================================================================
     169                 :            : 
     170                 :            : // virtual
     171                 :         95 : uno::Any SAL_CALL Storage::queryInterface( const uno::Type& aType )
     172                 :            :     throw ( uno::RuntimeException )
     173                 :            : {
     174                 :            :     // First, try to use interfaces implemented by myself and base class(es)
     175         [ +  - ]:         95 :     uno::Any aRet = StorageUNOBase::queryInterface( aType );
     176                 :            : 
     177         [ +  - ]:         95 :     if ( aRet.hasValue() )
     178                 :         95 :         return aRet;
     179                 :            : 
     180                 :            :     // Try to use requested interface from aggregated storage
     181 [ #  # ][ #  # ]:         95 :     return m_xAggProxy->queryAggregation( aType );
     182                 :            : }
     183                 :            : 
     184                 :            : //=========================================================================
     185                 :            : // virtual
     186                 :        380 : void SAL_CALL Storage::acquire()
     187                 :            :     throw ()
     188                 :            : {
     189                 :        380 :     osl_incrementInterlockedCount( &m_refCount );
     190                 :        380 : }
     191                 :            : 
     192                 :            : //=========================================================================
     193                 :            : // virtual
     194                 :        380 : void SAL_CALL Storage::release()
     195                 :            :     throw ()
     196                 :            : {
     197         [ +  + ]:        380 :     if ( osl_decrementInterlockedCount( &m_refCount ) == 0 )
     198                 :            :     {
     199                 :         95 :         m_xFactory->releaseElement( this );
     200         [ +  - ]:         95 :         delete this;
     201                 :            :     }
     202                 :        380 : }
     203                 :            : 
     204                 :            : //=========================================================================
     205                 :            : //
     206                 :            : // lang::XTypeProvider
     207                 :            : //
     208                 :            : //=========================================================================
     209                 :            : 
     210                 :            : // virtual
     211                 :          0 : uno::Sequence< uno::Type > SAL_CALL Storage::getTypes()
     212                 :            :     throw ( uno::RuntimeException )
     213                 :            : {
     214                 :          0 :     return m_xWrappedTypeProv->getTypes();
     215                 :            : }
     216                 :            : 
     217                 :            : //=========================================================================
     218                 :            : // virtual
     219                 :          0 : uno::Sequence< sal_Int8 > SAL_CALL Storage::getImplementationId()
     220                 :            :     throw ( uno::RuntimeException )
     221                 :            : {
     222                 :          0 :     return m_xWrappedTypeProv->getImplementationId();
     223                 :            : }
     224                 :            : 
     225                 :            : //=========================================================================
     226                 :            : //
     227                 :            : // lang::XComponent (base of embed::XStorage)
     228                 :            : //
     229                 :            : //=========================================================================
     230                 :            : // virtual
     231                 :          0 : void SAL_CALL Storage::dispose()
     232                 :            :     throw ( uno::RuntimeException )
     233                 :            : {
     234                 :          0 :     m_xWrappedStorage->dispose();
     235                 :          0 : }
     236                 :            : 
     237                 :            : //=========================================================================
     238                 :            : // virtual
     239                 :          0 : void SAL_CALL Storage::addEventListener(
     240                 :            :         const uno::Reference< lang::XEventListener >& xListener )
     241                 :            :     throw ( uno::RuntimeException )
     242                 :            : {
     243                 :          0 :     m_xWrappedStorage->addEventListener( xListener );
     244                 :          0 : }
     245                 :            : //=========================================================================
     246                 :            : // virtual
     247                 :          0 : void SAL_CALL Storage::removeEventListener(
     248                 :            :         const uno::Reference< lang::XEventListener >& aListener )
     249                 :            :     throw (uno::RuntimeException)
     250                 :            : {
     251                 :          0 :     m_xWrappedStorage->removeEventListener( aListener );
     252                 :          0 : }
     253                 :            : 
     254                 :            : //=========================================================================
     255                 :            : //
     256                 :            : // container::XElementAccess (base of container::XNameAccess)
     257                 :            : //
     258                 :            : //=========================================================================
     259                 :            : 
     260                 :            : // virtual
     261                 :          0 : uno::Type SAL_CALL Storage::getElementType()
     262                 :            :     throw ( uno::RuntimeException )
     263                 :            : {
     264                 :          0 :     return m_xWrappedStorage->getElementType();
     265                 :            : }
     266                 :            : 
     267                 :            : //=========================================================================
     268                 :            : // virtual
     269                 :          0 : ::sal_Bool SAL_CALL Storage::hasElements()
     270                 :            :     throw ( uno::RuntimeException )
     271                 :            : {
     272                 :          0 :     return m_xWrappedStorage->hasElements();
     273                 :            : }
     274                 :            : 
     275                 :            : //=========================================================================
     276                 :            : //
     277                 :            : // container::XNameAccess (base of embed::XStorage)
     278                 :            : //
     279                 :            : //=========================================================================
     280                 :            : 
     281                 :            : // virtual
     282                 :          0 : uno::Any SAL_CALL Storage::getByName( const ::rtl::OUString& aName )
     283                 :            :     throw ( container::NoSuchElementException,
     284                 :            :             lang::WrappedTargetException,
     285                 :            :             uno::RuntimeException )
     286                 :            : {
     287                 :          0 :     return m_xWrappedStorage->getByName( aName );
     288                 :            : }
     289                 :            : 
     290                 :            : //=========================================================================
     291                 :            : // virtual
     292                 :          0 : uno::Sequence< ::rtl::OUString > SAL_CALL Storage::getElementNames()
     293                 :            :     throw ( uno::RuntimeException )
     294                 :            : {
     295                 :          0 :     return m_xWrappedStorage->getElementNames();
     296                 :            : }
     297                 :            : 
     298                 :            : //=========================================================================
     299                 :            : // virtual
     300                 :          0 : ::sal_Bool SAL_CALL Storage::hasByName( const ::rtl::OUString& aName )
     301                 :            :     throw ( uno::RuntimeException )
     302                 :            : {
     303                 :          0 :     return m_xWrappedStorage->hasByName( aName );
     304                 :            : }
     305                 :            : 
     306                 :            : //=========================================================================
     307                 :            : //
     308                 :            : // embed::XStorage
     309                 :            : //
     310                 :            : //=========================================================================
     311                 :            : 
     312                 :            : // virtual
     313                 :          0 : void SAL_CALL Storage::copyToStorage(
     314                 :            :         const uno::Reference< embed::XStorage >& xDest )
     315                 :            :     throw ( embed::InvalidStorageException,
     316                 :            :             lang::IllegalArgumentException,
     317                 :            :             io::IOException,
     318                 :            :             embed::StorageWrappedTargetException,
     319                 :            :             uno::RuntimeException )
     320                 :            : {
     321                 :          0 :     m_xWrappedStorage->copyToStorage( xDest );
     322                 :          0 : }
     323                 :            : 
     324                 :            : //=========================================================================
     325                 :            : // virtual
     326                 :          0 : uno::Reference< io::XStream > SAL_CALL Storage::openStreamElement(
     327                 :            :         const ::rtl::OUString& aStreamName, sal_Int32 nOpenMode )
     328                 :            :     throw ( embed::InvalidStorageException,
     329                 :            :             lang::IllegalArgumentException,
     330                 :            :             packages::WrongPasswordException,
     331                 :            :             io::IOException,
     332                 :            :             embed::StorageWrappedTargetException,
     333                 :            :             uno::RuntimeException )
     334                 :            : {
     335                 :          0 :     return m_xWrappedStorage->openStreamElement( aStreamName, nOpenMode );
     336                 :            : }
     337                 :            : 
     338                 :            : //=========================================================================
     339                 :            : // virtual
     340                 :          0 : uno::Reference< io::XStream > SAL_CALL Storage::openEncryptedStreamElement(
     341                 :            :         const ::rtl::OUString& aStreamName,
     342                 :            :         sal_Int32 nOpenMode,
     343                 :            :         const ::rtl::OUString& aPassword )
     344                 :            :     throw ( embed::InvalidStorageException,
     345                 :            :             lang::IllegalArgumentException,
     346                 :            :             packages::NoEncryptionException,
     347                 :            :             packages::WrongPasswordException,
     348                 :            :             io::IOException,
     349                 :            :             embed::StorageWrappedTargetException,
     350                 :            :             uno::RuntimeException )
     351                 :            : {
     352                 :          0 :     return m_xWrappedStorage->openEncryptedStreamElement(
     353                 :          0 :         aStreamName, nOpenMode, aPassword );
     354                 :            : }
     355                 :            : 
     356                 :            : //=========================================================================
     357                 :            : // virtual
     358                 :          0 : uno::Reference< embed::XStorage > SAL_CALL Storage::openStorageElement(
     359                 :            :         const ::rtl::OUString& aStorName, sal_Int32 nOpenMode )
     360                 :            :     throw ( embed::InvalidStorageException,
     361                 :            :             lang::IllegalArgumentException,
     362                 :            :             io::IOException,
     363                 :            :             embed::StorageWrappedTargetException,
     364                 :            :             uno::RuntimeException )
     365                 :            : {
     366                 :          0 :     return m_xWrappedStorage->openStorageElement( aStorName, nOpenMode );
     367                 :            : }
     368                 :            : 
     369                 :            : //=========================================================================
     370                 :            : // virtual
     371                 :          0 : uno::Reference< io::XStream > SAL_CALL Storage::cloneStreamElement(
     372                 :            :         const ::rtl::OUString& aStreamName )
     373                 :            :     throw ( embed::InvalidStorageException,
     374                 :            :             lang::IllegalArgumentException,
     375                 :            :             packages::WrongPasswordException,
     376                 :            :             io::IOException,
     377                 :            :             embed::StorageWrappedTargetException,
     378                 :            :             uno::RuntimeException )
     379                 :            : {
     380                 :          0 :     return m_xWrappedStorage->cloneStreamElement( aStreamName );
     381                 :            : }
     382                 :            : 
     383                 :            : //=========================================================================
     384                 :            : // virtual
     385                 :          0 : uno::Reference< io::XStream > SAL_CALL Storage::cloneEncryptedStreamElement(
     386                 :            :         const ::rtl::OUString& aStreamName,
     387                 :            :         const ::rtl::OUString& aPassword )
     388                 :            :     throw ( embed::InvalidStorageException,
     389                 :            :             lang::IllegalArgumentException,
     390                 :            :             packages::NoEncryptionException,
     391                 :            :             packages::WrongPasswordException,
     392                 :            :             io::IOException,
     393                 :            :             embed::StorageWrappedTargetException,
     394                 :            :             uno::RuntimeException )
     395                 :            : {
     396                 :          0 :     return m_xWrappedStorage->cloneEncryptedStreamElement( aStreamName,
     397                 :          0 :                                                            aPassword );
     398                 :            : }
     399                 :            : 
     400                 :            : //=========================================================================
     401                 :            : // virtual
     402                 :          0 : void SAL_CALL Storage::copyLastCommitTo(
     403                 :            :         const uno::Reference< embed::XStorage >& xTargetStorage )
     404                 :            :     throw ( embed::InvalidStorageException,
     405                 :            :             lang::IllegalArgumentException,
     406                 :            :             io::IOException,
     407                 :            :             embed::StorageWrappedTargetException,
     408                 :            :             uno::RuntimeException)
     409                 :            : {
     410                 :          0 :     m_xWrappedStorage->copyLastCommitTo( xTargetStorage );
     411                 :          0 : }
     412                 :            : 
     413                 :            : //=========================================================================
     414                 :            : // virtual
     415                 :          0 : void SAL_CALL Storage::copyStorageElementLastCommitTo(
     416                 :            :         const ::rtl::OUString& aStorName,
     417                 :            :         const uno::Reference< embed::XStorage >& xTargetStorage )
     418                 :            :     throw ( embed::InvalidStorageException,
     419                 :            :             lang::IllegalArgumentException,
     420                 :            :             io::IOException,
     421                 :            :             embed::StorageWrappedTargetException,
     422                 :            :             uno::RuntimeException)
     423                 :            : {
     424                 :          0 :     m_xWrappedStorage->copyStorageElementLastCommitTo( aStorName, xTargetStorage );
     425                 :          0 : }
     426                 :            : 
     427                 :            : //=========================================================================
     428                 :            : // virtual
     429                 :          0 : sal_Bool SAL_CALL Storage::isStreamElement(
     430                 :            :         const ::rtl::OUString& aElementName )
     431                 :            :     throw ( container::NoSuchElementException,
     432                 :            :             lang::IllegalArgumentException,
     433                 :            :             embed::InvalidStorageException,
     434                 :            :             uno::RuntimeException )
     435                 :            : {
     436                 :          0 :     return m_xWrappedStorage->isStreamElement( aElementName );
     437                 :            : }
     438                 :            : 
     439                 :            : //=========================================================================
     440                 :            : // virtual
     441                 :          0 : sal_Bool SAL_CALL Storage::isStorageElement(
     442                 :            :         const ::rtl::OUString& aElementName )
     443                 :            :     throw ( container::NoSuchElementException,
     444                 :            :             lang::IllegalArgumentException,
     445                 :            :             embed::InvalidStorageException,
     446                 :            :             uno::RuntimeException )
     447                 :            : {
     448                 :          0 :     return m_xWrappedStorage->isStorageElement( aElementName );
     449                 :            : }
     450                 :            : 
     451                 :            : //=========================================================================
     452                 :            : // virtual
     453                 :          0 : void SAL_CALL Storage::removeElement( const ::rtl::OUString& aElementName )
     454                 :            :     throw ( embed::InvalidStorageException,
     455                 :            :             lang::IllegalArgumentException,
     456                 :            :             container::NoSuchElementException,
     457                 :            :             io::IOException,
     458                 :            :             embed::StorageWrappedTargetException,
     459                 :            :             uno::RuntimeException )
     460                 :            : {
     461                 :          0 :     m_xWrappedStorage->removeElement( aElementName );
     462                 :          0 : }
     463                 :            : 
     464                 :            : //=========================================================================
     465                 :            : // virtual
     466                 :          0 : void SAL_CALL Storage::renameElement( const ::rtl::OUString& aEleName,
     467                 :            :                                       const ::rtl::OUString& aNewName )
     468                 :            :     throw ( embed::InvalidStorageException,
     469                 :            :             lang::IllegalArgumentException,
     470                 :            :             container::NoSuchElementException,
     471                 :            :             container::ElementExistException,
     472                 :            :             io::IOException,
     473                 :            :             embed::StorageWrappedTargetException,
     474                 :            :             uno::RuntimeException )
     475                 :            : {
     476                 :          0 :     m_xWrappedStorage->renameElement( aEleName, aNewName );
     477                 :          0 : }
     478                 :            : 
     479                 :            : //=========================================================================
     480                 :            : // virtual
     481                 :          0 : void SAL_CALL Storage::copyElementTo(
     482                 :            :         const ::rtl::OUString& aElementName,
     483                 :            :         const uno::Reference< embed::XStorage >& xDest,
     484                 :            :         const ::rtl::OUString& aNewName )
     485                 :            :     throw ( embed::InvalidStorageException,
     486                 :            :             lang::IllegalArgumentException,
     487                 :            :             container::NoSuchElementException,
     488                 :            :             container::ElementExistException,
     489                 :            :             io::IOException,
     490                 :            :             embed::StorageWrappedTargetException,
     491                 :            :             uno::RuntimeException )
     492                 :            : {
     493                 :          0 :     m_xWrappedStorage->copyElementTo( aElementName, xDest, aNewName );
     494                 :          0 : }
     495                 :            : 
     496                 :            : //=========================================================================
     497                 :            : // virtual
     498                 :          0 : void SAL_CALL Storage::moveElementTo(
     499                 :            :         const ::rtl::OUString& aElementName,
     500                 :            :         const uno::Reference< embed::XStorage >& xDest,
     501                 :            :         const ::rtl::OUString& rNewName )
     502                 :            :     throw ( embed::InvalidStorageException,
     503                 :            :             lang::IllegalArgumentException,
     504                 :            :             container::NoSuchElementException,
     505                 :            :             container::ElementExistException,
     506                 :            :             io::IOException,
     507                 :            :             embed::StorageWrappedTargetException,
     508                 :            :             uno::RuntimeException )
     509                 :            : {
     510                 :          0 :     m_xWrappedStorage->moveElementTo( aElementName, xDest, rNewName );
     511                 :          0 : }
     512                 :            : 
     513                 :            : //=========================================================================
     514                 :            : //
     515                 :            : // embed::XTransactedObject
     516                 :            : //
     517                 :            : //=========================================================================
     518                 :            : 
     519                 :            : // virtual
     520                 :          0 : void SAL_CALL Storage::commit()
     521                 :            :     throw ( io::IOException,
     522                 :            :             lang::WrappedTargetException,
     523                 :            :             uno::RuntimeException )
     524                 :            : {
     525                 :            :     // Never commit a root storage (-> has no parent)!
     526                 :            :     // Would lead in writing the whole document to disk.
     527                 :            : 
     528         [ #  # ]:          0 :     uno::Reference< embed::XStorage > xParentStorage = getParentStorage();
     529         [ #  # ]:          0 :     if ( xParentStorage.is() )
     530                 :            :     {
     531                 :            :         OSL_ENSURE( m_xWrappedTransObj.is(), "No XTransactedObject interface!" );
     532                 :            : 
     533         [ #  # ]:          0 :         if ( m_xWrappedTransObj.is() )
     534                 :            :         {
     535 [ #  # ][ #  # ]:          0 :             m_xWrappedTransObj->commit();
     536                 :            : 
     537         [ #  # ]:          0 :             if ( !isParentARootStorage() )
     538                 :            :             {
     539                 :            :                 uno::Reference< embed::XTransactedObject > xParentTA(
     540         [ #  # ]:          0 :                     xParentStorage, uno::UNO_QUERY );
     541                 :            :                 OSL_ENSURE( xParentTA.is(), "No XTransactedObject interface!" );
     542                 :            : 
     543         [ #  # ]:          0 :                 if ( xParentTA.is() )
     544 [ #  # ][ #  # ]:          0 :                     xParentTA->commit();
     545                 :            :             }
     546                 :            :         }
     547                 :          0 :     }
     548                 :          0 : }
     549                 :            : 
     550                 :            : //=========================================================================
     551                 :            : // virtual
     552                 :          0 : void SAL_CALL Storage::revert()
     553                 :            :     throw ( io::IOException,
     554                 :            :             lang::WrappedTargetException,
     555                 :            :             uno::RuntimeException )
     556                 :            : {
     557         [ #  # ]:          0 :     uno::Reference< embed::XStorage > xParentStorage = getParentStorage();
     558         [ #  # ]:          0 :     if ( xParentStorage.is() )
     559                 :            :     {
     560                 :            :         OSL_ENSURE( m_xWrappedTransObj.is(), "No XTransactedObject interface!" );
     561                 :            : 
     562         [ #  # ]:          0 :         if ( m_xWrappedTransObj.is() )
     563                 :            :         {
     564 [ #  # ][ #  # ]:          0 :             m_xWrappedTransObj->revert();
     565                 :            : 
     566         [ #  # ]:          0 :             if ( !isParentARootStorage() )
     567                 :            :             {
     568                 :            :                 uno::Reference< embed::XTransactedObject > xParentTA(
     569         [ #  # ]:          0 :                     xParentStorage, uno::UNO_QUERY );
     570                 :            :                 OSL_ENSURE( xParentTA.is(), "No XTransactedObject interface!" );
     571                 :            : 
     572         [ #  # ]:          0 :                 if ( xParentTA.is() )
     573 [ #  # ][ #  # ]:          0 :                     xParentTA->revert();
     574                 :            :             }
     575                 :            :         }
     576                 :          0 :     }
     577                 :          0 : }
     578                 :            : 
     579                 :            : //=========================================================================
     580                 :            : //=========================================================================
     581                 :            : //
     582                 :            : // OutputStream Implementation.
     583                 :            : //
     584                 :            : //=========================================================================
     585                 :            : //=========================================================================
     586                 :            : 
     587                 :          0 : OutputStream::OutputStream(
     588                 :            :             const uno::Reference< lang::XMultiServiceFactory > & xSMgr,
     589                 :            :             const rtl::OUString & rUri,
     590                 :            :             const uno::Reference< embed::XStorage >  & xParentStorage,
     591                 :            :             const uno::Reference< io::XOutputStream > & xStreamToWrap )
     592         [ #  # ]:          0 : : ParentStorageHolder( xParentStorage, Uri( rUri ).getParentUri() ),
     593                 :            :   m_xWrappedStream( xStreamToWrap ),
     594                 :            :   m_xWrappedComponent( xStreamToWrap, uno::UNO_QUERY ),
     595   [ #  #  #  # ]:          0 :   m_xWrappedTypeProv( xStreamToWrap, uno::UNO_QUERY )
                 [ #  # ]
     596                 :            : {
     597                 :            :     OSL_ENSURE( m_xWrappedStream.is(),
     598                 :            :                 "OutputStream::OutputStream: No stream to wrap!" );
     599                 :            : 
     600                 :            :     OSL_ENSURE( m_xWrappedComponent.is(),
     601                 :            :                 "OutputStream::OutputStream: No component to wrap!" );
     602                 :            : 
     603                 :            :     OSL_ENSURE( m_xWrappedTypeProv.is(),
     604                 :            :                 "OutputStream::OutputStream: No Type Provider!" );
     605                 :            : 
     606                 :            :     // Use proxy factory service to create aggregatable proxy.
     607                 :            :     try
     608                 :            :     {
     609                 :            :         uno::Reference< reflection::XProxyFactory > xProxyFac(
     610         [ #  # ]:          0 :             xSMgr->createInstance(
     611                 :            :                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
     612                 :          0 :                     "com.sun.star.reflection.ProxyFactory" ) ) ),
     613 [ #  # ][ #  # ]:          0 :             uno::UNO_QUERY );
                 [ #  # ]
     614         [ #  # ]:          0 :         if ( xProxyFac.is() )
     615                 :            :         {
     616 [ #  # ][ #  # ]:          0 :             m_xAggProxy = xProxyFac->createProxy( m_xWrappedStream );
                 [ #  # ]
     617         [ #  # ]:          0 :         }
     618                 :            :     }
     619         [ #  # ]:          0 :     catch ( uno::Exception const & )
     620                 :            :     {
     621                 :            :         OSL_FAIL( "OutputStream::OutputStream: Caught exception!" );
     622                 :            :     }
     623                 :            : 
     624                 :            :     OSL_ENSURE( m_xAggProxy.is(),
     625                 :            :             "OutputStream::OutputStream: Wrapped stream cannot be aggregated!" );
     626                 :            : 
     627         [ #  # ]:          0 :     if ( m_xAggProxy.is() )
     628                 :            :     {
     629         [ #  # ]:          0 :         osl_incrementInterlockedCount( &m_refCount );
     630                 :            :         {
     631                 :            :             // Solaris compiler problem:
     632                 :            :             // Extra block to enforce destruction of temporary object created
     633                 :            :             // in next statement _before_ osl_decrementInterlockedCount is
     634                 :            :             // called.  Otherwise 'this' will destroy itself even before ctor
     635                 :            :             // is completed (See impl. of XInterface::release())!
     636                 :            : 
     637         [ #  # ]:          0 :             m_xAggProxy->setDelegator(
     638 [ #  # ][ #  # ]:          0 :                 static_cast< cppu::OWeakObject * >( this ) );
     639                 :            :         }
     640         [ #  # ]:          0 :         osl_decrementInterlockedCount( &m_refCount );
     641                 :            :     }
     642                 :          0 : }
     643                 :            : 
     644                 :            : //=========================================================================
     645                 :            : // virtual
     646         [ #  # ]:          0 : OutputStream::~OutputStream()
     647                 :            : {
     648         [ #  # ]:          0 :     if ( m_xAggProxy.is() )
     649 [ #  # ][ #  # ]:          0 :         m_xAggProxy->setDelegator( uno::Reference< uno::XInterface >() );
     650         [ #  # ]:          0 : }
     651                 :            : 
     652                 :            : //=========================================================================
     653                 :            : //
     654                 :            : // uno::XInterface
     655                 :            : //
     656                 :            : //=========================================================================
     657                 :            : 
     658                 :            : // virtual
     659                 :          0 : uno::Any SAL_CALL OutputStream::queryInterface( const uno::Type& aType )
     660                 :            :     throw ( uno::RuntimeException )
     661                 :            : {
     662         [ #  # ]:          0 :     uno::Any aRet = OutputStreamUNOBase::queryInterface( aType );
     663                 :            : 
     664         [ #  # ]:          0 :     if ( aRet.hasValue() )
     665                 :          0 :         return aRet;
     666                 :            : 
     667         [ #  # ]:          0 :     if ( m_xAggProxy.is() )
     668 [ #  # ][ #  # ]:          0 :         return m_xAggProxy->queryAggregation( aType );
     669                 :            :     else
     670                 :          0 :         return uno::Any();
     671                 :            : }
     672                 :            : 
     673                 :            : //=========================================================================
     674                 :            : //
     675                 :            : // lang::XTypeProvider
     676                 :            : //
     677                 :            : //=========================================================================
     678                 :            : 
     679                 :            : // virtual
     680                 :          0 : uno::Sequence< uno::Type > SAL_CALL OutputStream::getTypes()
     681                 :            :     throw ( uno::RuntimeException )
     682                 :            : {
     683                 :          0 :     return m_xWrappedTypeProv->getTypes();
     684                 :            : }
     685                 :            : 
     686                 :            : //=========================================================================
     687                 :            : // virtual
     688                 :          0 : uno::Sequence< sal_Int8 > SAL_CALL OutputStream::getImplementationId()
     689                 :            :     throw ( uno::RuntimeException )
     690                 :            : {
     691                 :          0 :     return m_xWrappedTypeProv->getImplementationId();
     692                 :            : }
     693                 :            : 
     694                 :            : //=========================================================================
     695                 :            : //
     696                 :            : // io::XOutputStream
     697                 :            : //
     698                 :            : //=========================================================================
     699                 :            : 
     700                 :            : // virtual
     701                 :            : void SAL_CALL
     702                 :          0 : OutputStream::writeBytes( const uno::Sequence< sal_Int8 >& aData )
     703                 :            :     throw ( io::NotConnectedException,
     704                 :            :             io::BufferSizeExceededException,
     705                 :            :             io::IOException,
     706                 :            :             uno::RuntimeException )
     707                 :            : {
     708                 :          0 :     m_xWrappedStream->writeBytes( aData );
     709                 :          0 : }
     710                 :            : 
     711                 :            : //=========================================================================
     712                 :            : // virtual
     713                 :            : void SAL_CALL
     714                 :          0 : OutputStream::flush()
     715                 :            :     throw ( io::NotConnectedException,
     716                 :            :             io::BufferSizeExceededException,
     717                 :            :             io::IOException,
     718                 :            :             uno::RuntimeException )
     719                 :            : {
     720                 :          0 :     m_xWrappedStream->flush();
     721                 :          0 : }
     722                 :            : 
     723                 :            : //=========================================================================
     724                 :            : // virtual
     725                 :            : void SAL_CALL
     726                 :          0 : OutputStream::closeOutput(  )
     727                 :            :     throw ( io::NotConnectedException,
     728                 :            :             io::BufferSizeExceededException,
     729                 :            :             io::IOException,
     730                 :            :             uno::RuntimeException )
     731                 :            : {
     732                 :          0 :     m_xWrappedStream->closeOutput();
     733                 :            : 
     734                 :            :     // Release parent storage.
     735                 :            :     // Now, that the stream is closed/disposed it is not needed any longer.
     736         [ #  # ]:          0 :     setParentStorage( uno::Reference< embed::XStorage >() );
     737                 :          0 : }
     738                 :            : 
     739                 :            : //=========================================================================
     740                 :            : //
     741                 :            : // lang::XComponent
     742                 :            : //
     743                 :            : //=========================================================================
     744                 :            : 
     745                 :            : // virtual
     746                 :            : void SAL_CALL
     747                 :          0 : OutputStream::dispose()
     748                 :            :     throw ( uno::RuntimeException )
     749                 :            : {
     750                 :          0 :     m_xWrappedComponent->dispose();
     751                 :            : 
     752                 :            :     // Release parent storage.
     753                 :            :     // Now, that the stream is closed/disposed it is not needed any longer.
     754         [ #  # ]:          0 :     setParentStorage( uno::Reference< embed::XStorage >() );
     755                 :          0 : }
     756                 :            : 
     757                 :            : //=========================================================================
     758                 :            : // virtual
     759                 :            : void SAL_CALL
     760                 :          0 : OutputStream::addEventListener(
     761                 :            :         const uno::Reference< lang::XEventListener >& xListener )
     762                 :            :     throw ( uno::RuntimeException )
     763                 :            : {
     764                 :          0 :     m_xWrappedComponent->addEventListener( xListener );
     765                 :          0 : }
     766                 :            : 
     767                 :            : //=========================================================================
     768                 :            : // virtual
     769                 :            : void SAL_CALL
     770                 :          0 : OutputStream::removeEventListener(
     771                 :            :         const uno::Reference< lang::XEventListener >& aListener )
     772                 :            :     throw ( uno::RuntimeException )
     773                 :            : {
     774                 :          0 :     m_xWrappedComponent->removeEventListener( aListener );
     775                 :          0 : }
     776                 :            : 
     777                 :            : //=========================================================================
     778                 :            : //=========================================================================
     779                 :            : //
     780                 :            : // Stream Implementation.
     781                 :            : //
     782                 :            : //=========================================================================
     783                 :            : //=========================================================================
     784                 :            : 
     785                 :          0 : Stream::Stream(
     786                 :            :             const uno::Reference< lang::XMultiServiceFactory > & xSMgr,
     787                 :            :             const rtl::OUString & rUri,
     788                 :            :             const uno::Reference< embed::XStorage >  & xParentStorage,
     789                 :            :             const uno::Reference< io::XStream > & xStreamToWrap )
     790         [ #  # ]:          0 : : ParentStorageHolder( xParentStorage, Uri( rUri ).getParentUri() ),
     791                 :            :   m_xWrappedStream( xStreamToWrap ),
     792         [ #  # ]:          0 :   m_xWrappedOutputStream( xStreamToWrap->getOutputStream() ), // might be empty
     793                 :            :   m_xWrappedTruncate( m_xWrappedOutputStream, uno::UNO_QUERY ), // might be empty
     794         [ #  # ]:          0 :   m_xWrappedInputStream( xStreamToWrap->getInputStream(), uno::UNO_QUERY ),
     795                 :            :   m_xWrappedComponent( xStreamToWrap, uno::UNO_QUERY ),
     796 [ #  # ][ #  # ]:          0 :   m_xWrappedTypeProv( xStreamToWrap, uno::UNO_QUERY )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     797                 :            : {
     798                 :            :     OSL_ENSURE( m_xWrappedStream.is(),
     799                 :            :                 "OutputStream::OutputStream: No stream to wrap!" );
     800                 :            : 
     801                 :            :     OSL_ENSURE( m_xWrappedComponent.is(),
     802                 :            :                 "OutputStream::OutputStream: No component to wrap!" );
     803                 :            : 
     804                 :            :     OSL_ENSURE( m_xWrappedTypeProv.is(),
     805                 :            :                 "OutputStream::OutputStream: No Type Provider!" );
     806                 :            : 
     807                 :            :     // Use proxy factory service to create aggregatable proxy.
     808                 :            :     try
     809                 :            :     {
     810                 :            :         uno::Reference< reflection::XProxyFactory > xProxyFac(
     811         [ #  # ]:          0 :             xSMgr->createInstance(
     812                 :            :                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
     813                 :          0 :                     "com.sun.star.reflection.ProxyFactory" ) ) ),
     814 [ #  # ][ #  # ]:          0 :             uno::UNO_QUERY );
                 [ #  # ]
     815         [ #  # ]:          0 :         if ( xProxyFac.is() )
     816                 :            :         {
     817 [ #  # ][ #  # ]:          0 :             m_xAggProxy = xProxyFac->createProxy( m_xWrappedStream );
                 [ #  # ]
     818         [ #  # ]:          0 :         }
     819                 :            :     }
     820         [ #  # ]:          0 :     catch ( uno::Exception const & )
     821                 :            :     {
     822                 :            :         OSL_FAIL( "OutputStream::OutputStream: Caught exception!" );
     823                 :            :     }
     824                 :            : 
     825                 :            :     OSL_ENSURE( m_xAggProxy.is(),
     826                 :            :             "OutputStream::OutputStream: Wrapped stream cannot be aggregated!" );
     827                 :            : 
     828         [ #  # ]:          0 :     if ( m_xAggProxy.is() )
     829                 :            :     {
     830         [ #  # ]:          0 :         osl_incrementInterlockedCount( &m_refCount );
     831                 :            :         {
     832                 :            :             // Solaris compiler problem:
     833                 :            :             // Extra block to enforce destruction of temporary object created
     834                 :            :             // in next statement _before_ osl_decrementInterlockedCount is
     835                 :            :             // called.  Otherwise 'this' will destroy itself even before ctor
     836                 :            :             // is completed (See impl. of XInterface::release())!
     837                 :            : 
     838         [ #  # ]:          0 :             m_xAggProxy->setDelegator(
     839 [ #  # ][ #  # ]:          0 :                 static_cast< cppu::OWeakObject * >( this ) );
     840                 :            :         }
     841         [ #  # ]:          0 :         osl_decrementInterlockedCount( &m_refCount );
     842                 :            :     }
     843                 :          0 : }
     844                 :            : 
     845                 :            : //=========================================================================
     846                 :            : // virtual
     847         [ #  # ]:          0 : Stream::~Stream()
     848                 :            : {
     849         [ #  # ]:          0 :     if ( m_xAggProxy.is() )
     850 [ #  # ][ #  # ]:          0 :         m_xAggProxy->setDelegator( uno::Reference< uno::XInterface >() );
     851         [ #  # ]:          0 : }
     852                 :            : 
     853                 :            : //=========================================================================
     854                 :            : //
     855                 :            : // uno::XInterface
     856                 :            : //
     857                 :            : //=========================================================================
     858                 :            : 
     859                 :            : // virtual
     860                 :          0 : uno::Any SAL_CALL Stream::queryInterface( const uno::Type& aType )
     861                 :            :     throw ( uno::RuntimeException )
     862                 :            : {
     863         [ #  # ]:          0 :     uno::Any aRet = StreamUNOBase::queryInterface( aType );
     864                 :            : 
     865         [ #  # ]:          0 :     if ( aRet.hasValue() )
     866                 :          0 :         return aRet;
     867                 :            : 
     868         [ #  # ]:          0 :     if ( m_xAggProxy.is() )
     869 [ #  # ][ #  # ]:          0 :         return m_xAggProxy->queryAggregation( aType );
     870                 :            :     else
     871                 :          0 :         return uno::Any();
     872                 :            : }
     873                 :            : 
     874                 :            : //=========================================================================
     875                 :            : //
     876                 :            : // lang::XTypeProvider
     877                 :            : //
     878                 :            : //=========================================================================
     879                 :            : 
     880                 :            : // virtual
     881                 :          0 : uno::Sequence< uno::Type > SAL_CALL Stream::getTypes()
     882                 :            :     throw ( uno::RuntimeException )
     883                 :            : {
     884                 :          0 :     return m_xWrappedTypeProv->getTypes();
     885                 :            : }
     886                 :            : 
     887                 :            : //=========================================================================
     888                 :            : // virtual
     889                 :          0 : uno::Sequence< sal_Int8 > SAL_CALL Stream::getImplementationId()
     890                 :            :     throw ( uno::RuntimeException )
     891                 :            : {
     892                 :          0 :     return m_xWrappedTypeProv->getImplementationId();
     893                 :            : }
     894                 :            : 
     895                 :            : //=========================================================================
     896                 :            : //
     897                 :            : // io::XStream.
     898                 :            : //
     899                 :            : //=========================================================================
     900                 :            : 
     901                 :            : // virtual
     902                 :          0 : uno::Reference< io::XInputStream > SAL_CALL Stream::getInputStream()
     903                 :            :     throw( uno::RuntimeException )
     904                 :            : {
     905                 :          0 :     return uno::Reference< io::XInputStream >( this );
     906                 :            : }
     907                 :            : 
     908                 :            : //=========================================================================
     909                 :            : // virtual
     910                 :          0 : uno::Reference< io::XOutputStream > SAL_CALL Stream::getOutputStream()
     911                 :            :     throw( uno::RuntimeException )
     912                 :            : {
     913                 :          0 :     return uno::Reference< io::XOutputStream >( this );
     914                 :            : }
     915                 :            : 
     916                 :            : //=========================================================================
     917                 :            : //
     918                 :            : // io::XOutputStream.
     919                 :            : //
     920                 :            : //=========================================================================
     921                 :            : 
     922                 :            : // virtual
     923                 :          0 : void SAL_CALL Stream::writeBytes( const uno::Sequence< sal_Int8 >& aData )
     924                 :            :     throw( io::NotConnectedException,
     925                 :            :            io::BufferSizeExceededException,
     926                 :            :            io::IOException,
     927                 :            :            uno::RuntimeException )
     928                 :            : {
     929         [ #  # ]:          0 :     if ( m_xWrappedOutputStream.is() )
     930                 :            :     {
     931                 :          0 :         m_xWrappedOutputStream->writeBytes( aData );
     932                 :          0 :         commitChanges();
     933                 :            :     }
     934                 :          0 : }
     935                 :            : 
     936                 :            : //=========================================================================
     937                 :            : // virtual
     938                 :          0 : void SAL_CALL Stream::flush()
     939                 :            :     throw( io::NotConnectedException,
     940                 :            :            io::BufferSizeExceededException,
     941                 :            :            io::IOException,
     942                 :            :            uno::RuntimeException )
     943                 :            : {
     944         [ #  # ]:          0 :     if ( m_xWrappedOutputStream.is() )
     945                 :            :     {
     946                 :          0 :         m_xWrappedOutputStream->flush();
     947                 :          0 :         commitChanges();
     948                 :            :     }
     949                 :          0 : }
     950                 :            : 
     951                 :            : //=========================================================================
     952                 :            : // virtual
     953                 :          0 : void SAL_CALL Stream::closeOutput()
     954                 :            :     throw( io::NotConnectedException,
     955                 :            :            io::IOException,
     956                 :            :            uno::RuntimeException )
     957                 :            : {
     958         [ #  # ]:          0 :     if ( m_xWrappedOutputStream.is() )
     959                 :            :     {
     960                 :          0 :         m_xWrappedOutputStream->closeOutput();
     961                 :          0 :         commitChanges();
     962                 :            :     }
     963                 :            : 
     964                 :            :     // Release parent storage.
     965                 :            :     // Now, that the stream is closed/disposed it is not needed any longer.
     966         [ #  # ]:          0 :     setParentStorage( uno::Reference< embed::XStorage >() );
     967                 :          0 : }
     968                 :            : 
     969                 :            : //=========================================================================
     970                 :            : //
     971                 :            : // io::XTruncate.
     972                 :            : //
     973                 :            : //=========================================================================
     974                 :            : 
     975                 :            : // virtual
     976                 :          0 : void SAL_CALL Stream::truncate()
     977                 :            :     throw( io::IOException,
     978                 :            :            uno::RuntimeException )
     979                 :            : {
     980         [ #  # ]:          0 :     if ( m_xWrappedTruncate.is() )
     981                 :            :     {
     982                 :          0 :         m_xWrappedTruncate->truncate();
     983                 :          0 :         commitChanges();
     984                 :            :     }
     985                 :          0 : }
     986                 :            : 
     987                 :            : //=========================================================================
     988                 :            : //
     989                 :            : // io::XInputStream.
     990                 :            : //
     991                 :            : //=========================================================================
     992                 :            : 
     993                 :            : // virtual
     994                 :          0 : sal_Int32 SAL_CALL Stream::readBytes( uno::Sequence< sal_Int8 >& aData,
     995                 :            :                                       sal_Int32 nBytesToRead )
     996                 :            :     throw( io::NotConnectedException,
     997                 :            :            io::BufferSizeExceededException,
     998                 :            :            io::IOException,
     999                 :            :            uno::RuntimeException )
    1000                 :            : {
    1001                 :          0 :     return m_xWrappedInputStream->readBytes( aData, nBytesToRead );
    1002                 :            : }
    1003                 :            : 
    1004                 :            : //=========================================================================
    1005                 :            : // virtual
    1006                 :          0 : sal_Int32 SAL_CALL Stream::readSomeBytes( uno::Sequence< sal_Int8 >& aData,
    1007                 :            :                                           sal_Int32 nMaxBytesToRead )
    1008                 :            :     throw( io::NotConnectedException,
    1009                 :            :            io::BufferSizeExceededException,
    1010                 :            :            io::IOException,
    1011                 :            :            uno::RuntimeException )
    1012                 :            : {
    1013                 :          0 :     return m_xWrappedInputStream->readSomeBytes( aData, nMaxBytesToRead );
    1014                 :            : }
    1015                 :            : 
    1016                 :            : //=========================================================================
    1017                 :            : // virtual
    1018                 :          0 : void SAL_CALL Stream::skipBytes( sal_Int32 nBytesToSkip )
    1019                 :            :     throw( io::NotConnectedException,
    1020                 :            :            io::BufferSizeExceededException,
    1021                 :            :            io::IOException,
    1022                 :            :            uno::RuntimeException )
    1023                 :            : {
    1024                 :          0 :     m_xWrappedInputStream->skipBytes( nBytesToSkip );
    1025                 :          0 : }
    1026                 :            : 
    1027                 :            : //=========================================================================
    1028                 :            : // virtual
    1029                 :          0 : sal_Int32 SAL_CALL Stream::available()
    1030                 :            :     throw( io::NotConnectedException,
    1031                 :            :            io::IOException,
    1032                 :            :            uno::RuntimeException )
    1033                 :            : {
    1034                 :          0 :     return m_xWrappedInputStream->available();
    1035                 :            : }
    1036                 :            : 
    1037                 :            : //=========================================================================
    1038                 :            : // virtual
    1039                 :          0 : void SAL_CALL Stream::closeInput()
    1040                 :            :     throw( io::NotConnectedException,
    1041                 :            :            io::IOException,
    1042                 :            :            uno::RuntimeException )
    1043                 :            : {
    1044                 :          0 :     m_xWrappedInputStream->closeInput();
    1045                 :          0 : }
    1046                 :            : 
    1047                 :            : //=========================================================================
    1048                 :            : //
    1049                 :            : // lang::XComponent
    1050                 :            : //
    1051                 :            : //=========================================================================
    1052                 :            : 
    1053                 :            : // virtual
    1054                 :          0 : void SAL_CALL Stream::dispose()
    1055                 :            :     throw ( uno::RuntimeException )
    1056                 :            : {
    1057                 :          0 :     m_xWrappedComponent->dispose();
    1058                 :            : 
    1059                 :            :     // Release parent storage.
    1060                 :            :     // Now, that the stream is closed/disposed it is not needed any longer.
    1061         [ #  # ]:          0 :     setParentStorage( uno::Reference< embed::XStorage >() );
    1062                 :          0 : }
    1063                 :            : 
    1064                 :            : //=========================================================================
    1065                 :            : // virtual
    1066                 :          0 : void SAL_CALL Stream::addEventListener(
    1067                 :            :         const uno::Reference< lang::XEventListener >& xListener )
    1068                 :            :     throw ( uno::RuntimeException )
    1069                 :            : {
    1070                 :          0 :     m_xWrappedComponent->addEventListener( xListener );
    1071                 :          0 : }
    1072                 :            : 
    1073                 :            : //=========================================================================
    1074                 :            : // virtual
    1075                 :          0 : void SAL_CALL Stream::removeEventListener(
    1076                 :            :         const uno::Reference< lang::XEventListener >& aListener )
    1077                 :            :     throw ( uno::RuntimeException )
    1078                 :            : {
    1079                 :          0 :     m_xWrappedComponent->removeEventListener( aListener );
    1080                 :          0 : }
    1081                 :            : 
    1082                 :            : //=========================================================================
    1083                 :            : //
    1084                 :            : // Non-UNO
    1085                 :            : //
    1086                 :            : //=========================================================================
    1087                 :            : 
    1088                 :          0 : void Stream::commitChanges()
    1089                 :            :     throw( io::IOException )
    1090                 :            : {
    1091                 :            :     uno::Reference< embed::XTransactedObject >
    1092 [ #  # ][ #  # ]:          0 :         xParentTA( getParentStorage(), uno::UNO_QUERY );
    1093                 :            :     OSL_ENSURE( xParentTA.is(), "No XTransactedObject interface!" );
    1094                 :            : 
    1095         [ #  # ]:          0 :     if ( xParentTA.is() )
    1096                 :            :     {
    1097                 :            :         try
    1098                 :            :         {
    1099 [ #  # ][ #  # ]:          0 :             xParentTA->commit();
    1100                 :            :         }
    1101         [ #  # ]:          0 :         catch ( lang::WrappedTargetException const & )
    1102                 :            :         {
    1103         [ #  # ]:          0 :             throw io::IOException(); // @@@
    1104                 :            :         }
    1105                 :          0 :     }
    1106                 :          0 : }
    1107                 :            : 
    1108                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10