diff options
author | Mathias Bauer <mba@openoffice.org> | 2002-09-12 14:09:09 +0000 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2002-09-12 14:09:09 +0000 |
commit | be87173f70821cf2ee99e6ba7eb7b8aa5fb3c4f1 (patch) | |
tree | 652aadc8355a17bfc70f47104d218ce1be67fba7 /sot | |
parent | 39078cc00dd3d7262d726018128f63a0e72fad9c (diff) |
#103001#: new method to ask for property of elements
Diffstat (limited to 'sot')
-rw-r--r-- | sot/inc/stg.hxx | 8 | ||||
-rw-r--r-- | sot/source/sdstor/storage.cxx | 18 | ||||
-rw-r--r-- | sot/source/sdstor/ucbstorage.cxx | 59 |
3 files changed, 77 insertions, 8 deletions
diff --git a/sot/inc/stg.hxx b/sot/inc/stg.hxx index 03a28727320c..e517d32b329c 100644 --- a/sot/inc/stg.hxx +++ b/sot/inc/stg.hxx @@ -2,9 +2,9 @@ * * $RCSfile: stg.hxx,v $ * - * $Revision: 1.17 $ + * $Revision: 1.18 $ * - * last change: $Author: mav $ $Date: 2002-08-22 12:27:34 $ + * last change: $Author: mba $ $Date: 2002-09-12 15:08:22 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -313,8 +313,7 @@ public: BOOL SetProperty( const String& rName, const ::com::sun::star::uno::Any& rValue ); BOOL GetProperty( const String& rName, ::com::sun::star::uno::Any& rValue ); - ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > - GetXInputStream() const; + ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetXInputStream() const; }; namespace ucb @@ -388,6 +387,7 @@ public: virtual BOOL Equals( const BaseStorage& rStream ) const; BOOL SetProperty( const String& rName, const ::com::sun::star::uno::Any& rValue ); BOOL GetProperty( const String& rName, ::com::sun::star::uno::Any& rValue ); + BOOL GetProperty( const String& rEleName, const String& rName, ::com::sun::star::uno::Any& rValue ); GetXInputStream(); #if _SOLAR__PRIVATE diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx index 93a91b170a2e..b38bfb76fe02 100644 --- a/sot/source/sdstor/storage.cxx +++ b/sot/source/sdstor/storage.cxx @@ -2,9 +2,9 @@ * * $RCSfile: storage.cxx,v $ * - * $Revision: 1.32 $ + * $Revision: 1.33 $ * - * last change: $Author: mav $ $Date: 2002-04-29 07:17:32 $ + * last change: $Author: mba $ $Date: 2002-09-12 15:09:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1299,6 +1299,20 @@ BOOL SotStorage::GetProperty( const String& rName, ::com::sun::star::uno::Any& r } } +BOOL SotStorage::GetProperty( const String& rEleName, const String& rName, ::com::sun::star::uno::Any& rValue ) +{ + UCBStorage* pStg = PTR_CAST( UCBStorage, pOwnStg ); + if ( pStg ) + { + return pStg->GetProperty( rEleName, rName, rValue ); + } + else + { + DBG_WARNING("W1:Not implemented!") + return FALSE; + } +} + BOOL SotStorage::IsOLEStorage() const { UCBStorage* pStg = PTR_CAST( UCBStorage, pOwnStg ); diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx index 4c1b0ba75b21..3ba87508d3d1 100644 --- a/sot/source/sdstor/ucbstorage.cxx +++ b/sot/source/sdstor/ucbstorage.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ucbstorage.cxx,v $ * - * $Revision: 1.71 $ + * $Revision: 1.72 $ * - * last change: $Author: mav $ $Date: 2002-08-22 12:26:06 $ + * last change: $Author: mba $ $Date: 2002-09-12 15:09:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -3373,3 +3373,58 @@ BOOL UCBStorage::GetProperty( const String& rName, ::com::sun::star::uno::Any& r return FALSE; } + +BOOL UCBStorage::GetProperty( const String& rEleName, const String& rName, ::com::sun::star::uno::Any& rValue ) +{ + UCBStorageElement_Impl *pEle = FindElement_Impl( rEleName ); + if ( !pEle ) + return FALSE; + + if ( !pEle->m_bIsFolder ) + { + if ( !pEle->m_xStream.Is() ) + pImp->OpenStream( pEle, pImp->m_nMode, pImp->m_bDirect ); + if ( pEle->m_xStream->m_nError ) + { + pEle->m_xStream.Clear(); + return FALSE; + } + + try + { + if ( pEle->m_xStream->m_pContent ) + { + rValue = pEle->m_xStream->m_pContent->getPropertyValue( rName ); + return TRUE; + } + } + catch ( Exception& ) + { + } + } + else + { + if ( !pEle->m_xStorage.Is() ) + pImp->OpenStorage( pEle, pImp->m_nMode, pImp->m_bDirect ); + if ( pEle->m_xStorage->m_nError ) + { + pEle->m_xStorage.Clear(); + return FALSE; + } + + try + { + if ( pEle->m_xStorage->GetContent() ) + { + rValue = pEle->m_xStorage->m_pContent->getPropertyValue( rName ); + return TRUE; + } + } + catch ( Exception& ) + { + } + } + + return FALSE; +} + |