LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/package/source/xstor - ocompinstream.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 91 299 30.4 %
Date: 2013-07-09 Functions: 14 33 42.4 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : 
      21             : #include "ocompinstream.hxx"
      22             : #include <com/sun/star/embed/StorageFormats.hpp>
      23             : #include <com/sun/star/lang/DisposedException.hpp>
      24             : #include <osl/diagnose.h>
      25             : 
      26             : #include "owriteablestream.hxx"
      27             : #include "xstorage.hxx"
      28             : 
      29             : using namespace ::com::sun::star;
      30             : 
      31             : //-----------------------------------------------
      32        3312 : OInputCompStream::OInputCompStream( OWriteStream_Impl& aImpl,
      33             :                                     uno::Reference < io::XInputStream > xStream,
      34             :                                     const uno::Sequence< beans::PropertyValue >& aProps,
      35             :                                     sal_Int32 nStorageType )
      36             : : m_pImpl( &aImpl )
      37             : , m_rMutexRef( m_pImpl->m_rMutexRef )
      38             : , m_xStream( xStream )
      39             : , m_pInterfaceContainer( NULL )
      40             : , m_aProperties( aProps )
      41             : , m_bDisposed( sal_False )
      42        3312 : , m_nStorageType( nStorageType )
      43             : {
      44             :     OSL_ENSURE( m_pImpl->m_rMutexRef.Is(), "No mutex is provided!\n" );
      45        3312 :     if ( !m_pImpl->m_rMutexRef.Is() )
      46           0 :         throw uno::RuntimeException(); // just a disaster
      47             : 
      48             :     OSL_ENSURE( xStream.is(), "No stream is provided!\n" );
      49        3312 : }
      50             : 
      51             : //-----------------------------------------------
      52           0 : OInputCompStream::OInputCompStream( uno::Reference < io::XInputStream > xStream,
      53             :                                     const uno::Sequence< beans::PropertyValue >& aProps,
      54             :                                     sal_Int32 nStorageType )
      55             : : m_pImpl( NULL )
      56           0 : , m_rMutexRef( new SotMutexHolder )
      57             : , m_xStream( xStream )
      58             : , m_pInterfaceContainer( NULL )
      59             : , m_aProperties( aProps )
      60             : , m_bDisposed( sal_False )
      61           0 : , m_nStorageType( nStorageType )
      62             : {
      63             :     OSL_ENSURE( xStream.is(), "No stream is provided!\n" );
      64           0 : }
      65             : 
      66             : //-----------------------------------------------
      67        9103 : OInputCompStream::~OInputCompStream()
      68             : {
      69             :     {
      70        3312 :         ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
      71             : 
      72        3312 :         if ( !m_bDisposed )
      73             :         {
      74        2334 :             m_refCount++;
      75        2334 :             dispose();
      76             :         }
      77             : 
      78        3312 :         if ( m_pInterfaceContainer )
      79        1802 :             delete m_pInterfaceContainer;
      80             :     }
      81        5791 : }
      82             : 
      83             : //-----------------------------------------------
      84       23243 : uno::Any SAL_CALL OInputCompStream::queryInterface( const uno::Type& rType )
      85             :         throw( uno::RuntimeException )
      86             : {
      87       23243 :     uno::Any aReturn;
      88             : 
      89             :     // common interfaces
      90       46486 :     aReturn <<= ::cppu::queryInterface
      91             :                 (   rType
      92             :                     ,   static_cast<io::XInputStream*> ( this )
      93             :                     ,   static_cast<io::XStream*> ( this )
      94             :                     ,   static_cast<lang::XComponent*> ( this )
      95             :                     ,   static_cast<beans::XPropertySet*> ( this )
      96       23243 :                     ,   static_cast<embed::XExtendedStorageStream*> ( this ) );
      97             : 
      98       23243 :     if ( aReturn.hasValue() == sal_True )
      99       13090 :         return aReturn ;
     100             : 
     101       10153 :     if ( m_nStorageType == embed::StorageFormats::OFOPXML )
     102             :     {
     103       17042 :         aReturn <<= ::cppu::queryInterface
     104             :                     (   rType
     105        8521 :                         ,   static_cast<embed::XRelationshipAccess*> ( this ) );
     106             : 
     107        8521 :         if ( aReturn.hasValue() == sal_True )
     108        1471 :             return aReturn ;
     109             :     }
     110             : 
     111        8682 :     return OWeakObject::queryInterface( rType );
     112             : }
     113             : 
     114             : //-----------------------------------------------
     115         303 : sal_Int32 SAL_CALL OInputCompStream::readBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
     116             :         throw ( io::NotConnectedException,
     117             :                 io::BufferSizeExceededException,
     118             :                 io::IOException,
     119             :                 uno::RuntimeException )
     120             : {
     121         303 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     122         303 :     if ( m_bDisposed )
     123             :     {
     124           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     125           0 :         throw lang::DisposedException();
     126             :     }
     127             : 
     128         303 :     if ( !m_xStream.is() )
     129             :     {
     130           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "No stream!" );
     131           0 :         throw uno::RuntimeException();
     132             :     }
     133             : 
     134         304 :     return m_xStream->readBytes( aData, nBytesToRead );
     135             : }
     136             : 
     137             : //-----------------------------------------------
     138        6246 : sal_Int32 SAL_CALL OInputCompStream::readSomeBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead )
     139             :         throw ( io::NotConnectedException,
     140             :                 io::BufferSizeExceededException,
     141             :                 io::IOException,
     142             :                 uno::RuntimeException )
     143             : {
     144        6246 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     145        6246 :     if ( m_bDisposed )
     146             :     {
     147           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     148           0 :         throw lang::DisposedException();
     149             :     }
     150             : 
     151        6246 :     if ( !m_xStream.is() )
     152             :     {
     153           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "No stream!" );
     154           0 :         throw uno::RuntimeException();
     155             :     }
     156             : 
     157        6246 :     return m_xStream->readSomeBytes( aData, nMaxBytesToRead );
     158             : 
     159             : }
     160             : 
     161             : //-----------------------------------------------
     162           0 : void SAL_CALL OInputCompStream::skipBytes( sal_Int32 nBytesToSkip )
     163             :         throw ( io::NotConnectedException,
     164             :                 io::BufferSizeExceededException,
     165             :                 io::IOException,
     166             :                 uno::RuntimeException )
     167             : {
     168           0 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     169           0 :     if ( m_bDisposed )
     170             :     {
     171           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     172           0 :         throw lang::DisposedException();
     173             :     }
     174             : 
     175           0 :     if ( !m_xStream.is() )
     176             :     {
     177           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "No stream!" );
     178           0 :         throw uno::RuntimeException();
     179             :     }
     180             : 
     181           0 :     m_xStream->skipBytes( nBytesToSkip );
     182             : 
     183           0 : }
     184             : 
     185             : //-----------------------------------------------
     186           0 : sal_Int32 SAL_CALL OInputCompStream::available(  )
     187             :         throw ( io::NotConnectedException,
     188             :                 io::IOException,
     189             :                 uno::RuntimeException )
     190             : {
     191           0 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     192           0 :     if ( m_bDisposed )
     193             :     {
     194           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     195           0 :         throw lang::DisposedException();
     196             :     }
     197             : 
     198           0 :     if ( !m_xStream.is() )
     199             :     {
     200           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "No stream!" );
     201           0 :         throw uno::RuntimeException();
     202             :     }
     203             : 
     204           0 :     return m_xStream->available();
     205             : 
     206             : }
     207             : 
     208             : //-----------------------------------------------
     209         964 : void SAL_CALL OInputCompStream::closeInput(  )
     210             :         throw ( io::NotConnectedException,
     211             :                 io::IOException,
     212             :                 uno::RuntimeException )
     213             : {
     214         964 :     dispose();
     215         964 : }
     216             : 
     217             : //-----------------------------------------------
     218        2963 : uno::Reference< io::XInputStream > SAL_CALL OInputCompStream::getInputStream()
     219             :         throw ( uno::RuntimeException )
     220             : {
     221        2963 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     222        2963 :     if ( m_bDisposed )
     223             :     {
     224           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     225           0 :         throw lang::DisposedException();
     226             :     }
     227             : 
     228        2963 :     if ( !m_xStream.is() )
     229           0 :         return uno::Reference< io::XInputStream >();
     230             : 
     231        2963 :     return uno::Reference< io::XInputStream >( static_cast< io::XInputStream* >( this ), uno::UNO_QUERY );
     232             : }
     233             : 
     234             : //-----------------------------------------------
     235         109 : uno::Reference< io::XOutputStream > SAL_CALL OInputCompStream::getOutputStream()
     236             :         throw ( uno::RuntimeException )
     237             : {
     238         109 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     239         109 :     if ( m_bDisposed )
     240             :     {
     241           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     242           0 :         throw lang::DisposedException();
     243             :     }
     244             : 
     245         109 :     return uno::Reference< io::XOutputStream >();
     246             : }
     247             : 
     248             : //-----------------------------------------------
     249           0 : void OInputCompStream::InternalDispose()
     250             : {
     251             :     // can be called only by OWriteStream_Impl
     252           0 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     253           0 :     if ( m_bDisposed )
     254             :     {
     255           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     256           0 :         throw lang::DisposedException();
     257             :     }
     258             : 
     259             :     // the source object is also a kind of locker for the current object
     260             :     // since the listeners could dispose the object while being notified
     261           0 :     lang::EventObject aSource( static_cast< ::cppu::OWeakObject*>( this ) );
     262             : 
     263           0 :     if ( m_pInterfaceContainer )
     264           0 :         m_pInterfaceContainer->disposeAndClear( aSource );
     265             : 
     266             :     try
     267             :     {
     268           0 :         m_xStream->closeInput();
     269             :     }
     270           0 :     catch( uno::Exception& )
     271             :     {}
     272             : 
     273           0 :     m_pImpl = NULL;
     274           0 :     m_bDisposed = sal_True;
     275           0 : }
     276             : 
     277             : //-----------------------------------------------
     278        3312 : void SAL_CALL OInputCompStream::dispose(  )
     279             :         throw ( uno::RuntimeException )
     280             : {
     281        3312 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     282        3312 :     if ( m_bDisposed )
     283             :     {
     284           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     285           0 :         throw lang::DisposedException();
     286             :     }
     287             : 
     288        3312 :     if ( m_pInterfaceContainer )
     289             :     {
     290        1802 :         lang::EventObject aSource( static_cast< ::cppu::OWeakObject*>( this ) );
     291        1802 :         m_pInterfaceContainer->disposeAndClear( aSource );
     292             :     }
     293             : 
     294        3312 :     m_xStream->closeInput();
     295             : 
     296        3312 :     if ( m_pImpl )
     297             :     {
     298        3312 :         m_pImpl->InputStreamDisposed( this );
     299        3312 :         m_pImpl = NULL;
     300             :     }
     301             : 
     302        3312 :     m_bDisposed = sal_True;
     303        3312 : }
     304             : 
     305             : //-----------------------------------------------
     306        1802 : void SAL_CALL OInputCompStream::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
     307             :         throw ( uno::RuntimeException )
     308             : {
     309        1802 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     310        1802 :     if ( m_bDisposed )
     311             :     {
     312           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     313           0 :         throw lang::DisposedException();
     314             :     }
     315             : 
     316        1802 :     if ( !m_pInterfaceContainer )
     317        1802 :         m_pInterfaceContainer = new ::cppu::OInterfaceContainerHelper( m_rMutexRef->GetMutex() );
     318             : 
     319        1802 :     m_pInterfaceContainer->addInterface( xListener );
     320        1802 : }
     321             : 
     322             : //-----------------------------------------------
     323           3 : void SAL_CALL OInputCompStream::removeEventListener( const uno::Reference< lang::XEventListener >& xListener )
     324             :         throw ( uno::RuntimeException )
     325             : {
     326           3 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     327           3 :     if ( m_bDisposed )
     328             :     {
     329           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     330           0 :         throw lang::DisposedException();
     331             :     }
     332             : 
     333           3 :     if ( m_pInterfaceContainer )
     334           3 :         m_pInterfaceContainer->removeInterface( xListener );
     335           3 : }
     336             : 
     337             : //-----------------------------------------------
     338           0 : sal_Bool SAL_CALL OInputCompStream::hasByID(  const OUString& sID )
     339             :         throw ( io::IOException,
     340             :                 uno::RuntimeException )
     341             : {
     342           0 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     343             : 
     344           0 :     if ( m_bDisposed )
     345             :     {
     346           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     347           0 :         throw lang::DisposedException();
     348             :     }
     349             : 
     350           0 :     if ( m_nStorageType != embed::StorageFormats::OFOPXML )
     351           0 :         throw uno::RuntimeException();
     352             : 
     353             :     try
     354             :     {
     355           0 :         getRelationshipByID( sID );
     356           0 :         return sal_True;
     357             :     }
     358           0 :     catch( container::NoSuchElementException& )
     359             :     {}
     360             : 
     361           0 :     return sal_False;
     362             : }
     363             : 
     364             : //-----------------------------------------------
     365           0 : OUString SAL_CALL OInputCompStream::getTargetByID(  const OUString& sID  )
     366             :         throw ( container::NoSuchElementException,
     367             :                 io::IOException,
     368             :                 uno::RuntimeException )
     369             : {
     370           0 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     371             : 
     372           0 :     if ( m_bDisposed )
     373             :     {
     374           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     375           0 :         throw lang::DisposedException();
     376             :     }
     377             : 
     378           0 :     if ( m_nStorageType != embed::StorageFormats::OFOPXML )
     379           0 :         throw uno::RuntimeException();
     380             : 
     381           0 :     uno::Sequence< beans::StringPair > aSeq = getRelationshipByID( sID );
     382           0 :     for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
     383           0 :         if ( aSeq[nInd].First == "Target" )
     384           0 :             return aSeq[nInd].Second;
     385             : 
     386           0 :     return OUString();
     387             : }
     388             : 
     389             : //-----------------------------------------------
     390           0 : OUString SAL_CALL OInputCompStream::getTypeByID(  const OUString& sID  )
     391             :         throw ( container::NoSuchElementException,
     392             :                 io::IOException,
     393             :                 uno::RuntimeException )
     394             : {
     395           0 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     396             : 
     397           0 :     if ( m_bDisposed )
     398             :     {
     399           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     400           0 :         throw lang::DisposedException();
     401             :     }
     402             : 
     403           0 :     if ( m_nStorageType != embed::StorageFormats::OFOPXML )
     404           0 :         throw uno::RuntimeException();
     405             : 
     406           0 :     uno::Sequence< beans::StringPair > aSeq = getRelationshipByID( sID );
     407           0 :     for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
     408           0 :         if ( aSeq[nInd].First == "Type" )
     409           0 :             return aSeq[nInd].Second;
     410             : 
     411           0 :     return OUString();
     412             : }
     413             : 
     414             : //-----------------------------------------------
     415           0 : uno::Sequence< beans::StringPair > SAL_CALL OInputCompStream::getRelationshipByID(  const OUString& sID  )
     416             :         throw ( container::NoSuchElementException,
     417             :                 io::IOException,
     418             :                 uno::RuntimeException )
     419             : {
     420           0 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     421             : 
     422           0 :     if ( m_bDisposed )
     423             :     {
     424           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     425           0 :         throw lang::DisposedException();
     426             :     }
     427             : 
     428           0 :     if ( m_nStorageType != embed::StorageFormats::OFOPXML )
     429           0 :         throw uno::RuntimeException();
     430             : 
     431             :     // TODO/LATER: in future the unification of the ID could be checked
     432           0 :     uno::Sequence< uno::Sequence< beans::StringPair > > aSeq = getAllRelationships();
     433           0 :     for ( sal_Int32 nInd1 = 0; nInd1 < aSeq.getLength(); nInd1++ )
     434           0 :         for ( sal_Int32 nInd2 = 0; nInd2 < aSeq[nInd1].getLength(); nInd2++ )
     435           0 :             if ( aSeq[nInd1][nInd2].First == "Id" )
     436             :             {
     437           0 :                 if ( aSeq[nInd1][nInd2].Second.equals( sID ) )
     438           0 :                     return aSeq[nInd1];
     439           0 :                 break;
     440             :             }
     441             : 
     442           0 :     throw container::NoSuchElementException();
     443             : }
     444             : 
     445             : //-----------------------------------------------
     446           0 : uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OInputCompStream::getRelationshipsByType(  const OUString& sType  )
     447             :         throw ( io::IOException,
     448             :                 uno::RuntimeException )
     449             : {
     450           0 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     451             : 
     452           0 :     if ( m_bDisposed )
     453             :     {
     454           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     455           0 :         throw lang::DisposedException();
     456             :     }
     457             : 
     458           0 :     if ( m_nStorageType != embed::StorageFormats::OFOPXML )
     459           0 :         throw uno::RuntimeException();
     460             : 
     461           0 :     uno::Sequence< uno::Sequence< beans::StringPair > > aResult;
     462           0 :     sal_Int32 nEntriesNum = 0;
     463             : 
     464             :     // TODO/LATER: in future the unification of the ID could be checked
     465           0 :     uno::Sequence< uno::Sequence< beans::StringPair > > aSeq = getAllRelationships();
     466           0 :     for ( sal_Int32 nInd1 = 0; nInd1 < aSeq.getLength(); nInd1++ )
     467           0 :         for ( sal_Int32 nInd2 = 0; nInd2 < aSeq[nInd1].getLength(); nInd2++ )
     468           0 :             if ( aSeq[nInd1][nInd2].First == "Type" )
     469             :             {
     470           0 :                 if ( aSeq[nInd1][nInd2].Second.equals( sType ) )
     471             :                 {
     472           0 :                     aResult.realloc( nEntriesNum );
     473           0 :                     aResult[nEntriesNum-1] = aSeq[nInd1];
     474             :                 }
     475           0 :                 break;
     476             :             }
     477             : 
     478           0 :     return aResult;
     479             : }
     480             : 
     481             : //-----------------------------------------------
     482        1471 : uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OInputCompStream::getAllRelationships()
     483             :         throw (io::IOException, uno::RuntimeException)
     484             : {
     485        1471 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     486             : 
     487        1471 :     if ( m_bDisposed )
     488             :     {
     489           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     490           0 :         throw lang::DisposedException();
     491             :     }
     492             : 
     493        1471 :     if ( m_nStorageType != embed::StorageFormats::OFOPXML )
     494           0 :         throw uno::RuntimeException();
     495             : 
     496             :     // TODO/LATER: in future the information could be taken directly from m_pImpl when possible
     497        1471 :     uno::Sequence< uno::Sequence< beans::StringPair > > aResult;
     498        5884 :     for ( sal_Int32 aInd = 0; aInd < m_aProperties.getLength(); aInd++ )
     499        5884 :         if ( m_aProperties[aInd].Name == "RelationsInfo" )
     500             :         {
     501        1471 :             if ( m_aProperties[aInd].Value >>= aResult )
     502        2942 :                 return aResult;
     503             : 
     504           0 :             break;
     505             :         }
     506             : 
     507           0 :     throw io::IOException(); // the relations info could not be read
     508             : }
     509             : 
     510             : //-----------------------------------------------
     511           0 : void SAL_CALL OInputCompStream::insertRelationshipByID(  const OUString& /*sID*/, const uno::Sequence< beans::StringPair >& /*aEntry*/, ::sal_Bool /*bReplace*/  )
     512             :         throw ( container::ElementExistException,
     513             :                 io::IOException,
     514             :                 uno::RuntimeException )
     515             : {
     516           0 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     517             : 
     518           0 :     if ( m_bDisposed )
     519             :     {
     520           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     521           0 :         throw lang::DisposedException();
     522             :     }
     523             : 
     524           0 :     if ( m_nStorageType != embed::StorageFormats::OFOPXML )
     525           0 :         throw uno::RuntimeException();
     526             : 
     527           0 :     throw io::IOException(); // TODO: Access denied
     528             : }
     529             : 
     530             : //-----------------------------------------------
     531           0 : void SAL_CALL OInputCompStream::removeRelationshipByID(  const OUString& /*sID*/  )
     532             :         throw ( container::NoSuchElementException,
     533             :                 io::IOException,
     534             :                 uno::RuntimeException )
     535             : {
     536           0 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     537             : 
     538           0 :     if ( m_bDisposed )
     539             :     {
     540           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     541           0 :         throw lang::DisposedException();
     542             :     }
     543             : 
     544           0 :     if ( m_nStorageType != embed::StorageFormats::OFOPXML )
     545           0 :         throw uno::RuntimeException();
     546             : 
     547           0 :     throw io::IOException(); // TODO: Access denied
     548             : }
     549             : 
     550             : //-----------------------------------------------
     551           0 : void SAL_CALL OInputCompStream::insertRelationships(  const uno::Sequence< uno::Sequence< beans::StringPair > >& /*aEntries*/, ::sal_Bool /*bReplace*/  )
     552             :         throw ( container::ElementExistException,
     553             :                 io::IOException,
     554             :                 uno::RuntimeException )
     555             : {
     556           0 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     557             : 
     558           0 :     if ( m_bDisposed )
     559             :     {
     560           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     561           0 :         throw lang::DisposedException();
     562             :     }
     563             : 
     564           0 :     if ( m_nStorageType != embed::StorageFormats::OFOPXML )
     565           0 :         throw uno::RuntimeException();
     566             : 
     567           0 :     throw io::IOException(); // TODO: Access denied
     568             : }
     569             : 
     570             : //-----------------------------------------------
     571           0 : void SAL_CALL OInputCompStream::clearRelationships()
     572             :         throw ( io::IOException,
     573             :                 uno::RuntimeException )
     574             : {
     575           0 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     576             : 
     577           0 :     if ( m_bDisposed )
     578             :     {
     579           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     580           0 :         throw lang::DisposedException();
     581             :     }
     582             : 
     583           0 :     if ( m_nStorageType != embed::StorageFormats::OFOPXML )
     584           0 :         throw uno::RuntimeException();
     585             : 
     586           0 :     throw io::IOException(); // TODO: Access denied
     587             : }
     588             : 
     589             : //-----------------------------------------------
     590           0 : uno::Reference< beans::XPropertySetInfo > SAL_CALL OInputCompStream::getPropertySetInfo()
     591             :         throw ( uno::RuntimeException )
     592             : {
     593           0 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     594             : 
     595           0 :     if ( m_bDisposed )
     596             :     {
     597           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     598           0 :         throw lang::DisposedException();
     599             :     }
     600             : 
     601             :     //TODO:
     602           0 :     return uno::Reference< beans::XPropertySetInfo >();
     603             : }
     604             : 
     605             : //-----------------------------------------------
     606           0 : void SAL_CALL OInputCompStream::setPropertyValue( const OUString& aPropertyName, const uno::Any& /*aValue*/ )
     607             :         throw ( beans::UnknownPropertyException,
     608             :                 beans::PropertyVetoException,
     609             :                 lang::IllegalArgumentException,
     610             :                 lang::WrappedTargetException,
     611             :                 uno::RuntimeException )
     612             : {
     613           0 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     614             : 
     615           0 :     if ( m_bDisposed )
     616             :     {
     617           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     618           0 :         throw lang::DisposedException();
     619             :     }
     620             : 
     621             :     // all the provided properties are accessible
     622           0 :     for ( sal_Int32 aInd = 0; aInd < m_aProperties.getLength(); aInd++ )
     623             :     {
     624           0 :         if ( m_aProperties[aInd].Name.equals( aPropertyName ) )
     625             :         {
     626           0 :             throw beans::PropertyVetoException(); // TODO
     627             :         }
     628             :     }
     629             : 
     630           0 :     throw beans::UnknownPropertyException(); // TODO
     631             : }
     632             : 
     633             : 
     634             : //-----------------------------------------------
     635         765 : uno::Any SAL_CALL OInputCompStream::getPropertyValue( const OUString& aProp )
     636             :         throw ( beans::UnknownPropertyException,
     637             :                 lang::WrappedTargetException,
     638             :                 uno::RuntimeException )
     639             : {
     640         765 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     641             : 
     642         765 :     if ( m_bDisposed )
     643             :     {
     644           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     645           0 :         throw lang::DisposedException();
     646             :     }
     647             : 
     648        1530 :     OUString aPropertyName;
     649         765 :     if ( aProp == "IsEncrypted" )
     650           0 :         aPropertyName = "Encrypted";
     651             :     else
     652         765 :         aPropertyName = aProp;
     653             : 
     654         765 :     if ( aPropertyName == "RelationsInfo" )
     655           0 :         throw beans::UnknownPropertyException(); // TODO
     656             : 
     657             :     // all the provided properties are accessible
     658        2729 :     for ( sal_Int32 aInd = 0; aInd < m_aProperties.getLength(); aInd++ )
     659             :     {
     660        2729 :         if ( m_aProperties[aInd].Name.equals( aPropertyName ) )
     661             :         {
     662        1530 :             return m_aProperties[aInd].Value;
     663             :         }
     664             :     }
     665             : 
     666         765 :     throw beans::UnknownPropertyException(); // TODO
     667             : }
     668             : 
     669             : 
     670             : //-----------------------------------------------
     671           0 : void SAL_CALL OInputCompStream::addPropertyChangeListener(
     672             :     const OUString& /*aPropertyName*/,
     673             :     const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ )
     674             :         throw ( beans::UnknownPropertyException,
     675             :                 lang::WrappedTargetException,
     676             :                 uno::RuntimeException )
     677             : {
     678           0 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     679             : 
     680           0 :     if ( m_bDisposed )
     681             :     {
     682           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     683           0 :         throw lang::DisposedException();
     684           0 :     }
     685             : 
     686             :     //TODO:
     687           0 : }
     688             : 
     689             : 
     690             : //-----------------------------------------------
     691           0 : void SAL_CALL OInputCompStream::removePropertyChangeListener(
     692             :     const OUString& /*aPropertyName*/,
     693             :     const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ )
     694             :         throw ( beans::UnknownPropertyException,
     695             :                 lang::WrappedTargetException,
     696             :                 uno::RuntimeException )
     697             : {
     698           0 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     699             : 
     700           0 :     if ( m_bDisposed )
     701             :     {
     702           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     703           0 :         throw lang::DisposedException();
     704           0 :     }
     705             : 
     706             :     //TODO:
     707           0 : }
     708             : 
     709             : 
     710             : //-----------------------------------------------
     711           0 : void SAL_CALL OInputCompStream::addVetoableChangeListener(
     712             :     const OUString& /*PropertyName*/,
     713             :     const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
     714             :         throw ( beans::UnknownPropertyException,
     715             :                 lang::WrappedTargetException,
     716             :                 uno::RuntimeException )
     717             : {
     718           0 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     719             : 
     720           0 :     if ( m_bDisposed )
     721             :     {
     722           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     723           0 :         throw lang::DisposedException();
     724           0 :     }
     725             : 
     726             :     //TODO:
     727           0 : }
     728             : 
     729             : 
     730             : //-----------------------------------------------
     731           0 : void SAL_CALL OInputCompStream::removeVetoableChangeListener(
     732             :     const OUString& /*PropertyName*/,
     733             :     const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
     734             :         throw ( beans::UnknownPropertyException,
     735             :                 lang::WrappedTargetException,
     736             :                 uno::RuntimeException )
     737             : {
     738           0 :     ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
     739             : 
     740           0 :     if ( m_bDisposed )
     741             :     {
     742           0 :         ::package::StaticAddLog( OSL_LOG_PREFIX "Disposed!" );
     743           0 :         throw lang::DisposedException();
     744           0 :     }
     745             : 
     746             :     //TODO:
     747           0 : }
     748             : 
     749             : 
     750             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10