diff options
author | Kurt Zenker <kz@openoffice.org> | 2006-07-05 20:54:54 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2006-07-05 20:54:54 +0000 |
commit | 4283180301647dd2cefbec2b906a40e052b138c9 (patch) | |
tree | f2f13763b682d9989731de856a20fea4495315ac /goodies | |
parent | 0a30d7a8c04fe01de3e323a4bf85d675e97a7e69 (diff) |
INTEGRATION: CWS impresssavegraphic (1.4.72); FILE MERGED
2006/04/05 08:20:12 cl 1.4.72.1: #i49565# allow detection with url and stream
Diffstat (limited to 'goodies')
-rw-r--r-- | goodies/source/unographic/provider.cxx | 96 |
1 files changed, 50 insertions, 46 deletions
diff --git a/goodies/source/unographic/provider.cxx b/goodies/source/unographic/provider.cxx index 5c9c5291b90c..313d299bc6e5 100644 --- a/goodies/source/unographic/provider.cxx +++ b/goodies/source/unographic/provider.cxx @@ -4,9 +4,9 @@ * * $RCSfile: provider.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: rt $ $Date: 2005-09-09 03:11:17 $ + * last change: $Author: kz $ $Date: 2006-07-05 21:54:54 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -271,6 +271,9 @@ uno::Reference< beans::XPropertySet > SAL_CALL GraphicProvider::queryGraphicDesc { uno::Reference< beans::XPropertySet > xRet; + ::rtl::OUString aURL; + uno::Reference< io::XInputStream > xIStm; + for( sal_Int32 i = 0; ( i < rMediaProperties.getLength() ) && !xRet.is(); ++i ) { const ::rtl::OUString aName( rMediaProperties[ i ].Name ); @@ -278,35 +281,36 @@ uno::Reference< beans::XPropertySet > SAL_CALL GraphicProvider::queryGraphicDesc if( COMPARE_EQUAL == aName.compareToAscii( "URL" ) ) { - ::rtl::OUString aURL; + aValue >>= aURL; + } + else if( COMPARE_EQUAL == aName.compareToAscii( "InputStream" ) ) + { + aValue >>= xIStm; + } + } - if( ( aValue >>= aURL ) && aURL.getLength() ) - { - uno::Reference< ::graphic::XGraphic > xGraphic( implLoadMemory( aURL ) ); + if( xIStm.is() ) + { + GraphicDescriptor* pDescriptor = new GraphicDescriptor; + pDescriptor->init( xIStm, aURL ); + xRet = pDescriptor; + } + else if( aURL.getLength() ) + { + uno::Reference< ::graphic::XGraphic > xGraphic( implLoadMemory( aURL ) ); - if( !xGraphic.is() ) - xGraphic = implLoadResource( aURL ); + if( !xGraphic.is() ) + xGraphic = implLoadResource( aURL ); - if( xGraphic.is() ) - xRet = uno::Reference< beans::XPropertySet >( xGraphic, uno::UNO_QUERY ); - else - { - GraphicDescriptor* pDescriptor = new GraphicDescriptor; - pDescriptor->init( aURL ); - xRet = pDescriptor; - } - } + if( xGraphic.is() ) + { + xRet = uno::Reference< beans::XPropertySet >( xGraphic, uno::UNO_QUERY ); } - else if( COMPARE_EQUAL == aName.compareToAscii( "InputStream" ) ) + else { - uno::Reference< io::XInputStream > xIStm; - - if( ( aValue >>= xIStm ) && xIStm.is() ) - { - GraphicDescriptor* pDescriptor = new GraphicDescriptor; - pDescriptor->init( xIStm ); - xRet = pDescriptor; - } + GraphicDescriptor* pDescriptor = new GraphicDescriptor; + pDescriptor->init( aURL ); + xRet = pDescriptor; } } @@ -322,6 +326,8 @@ uno::Reference< ::graphic::XGraphic > SAL_CALL GraphicProvider::queryGraphic( co String aPath; SvStream* pIStm = NULL; + uno::Reference< io::XInputStream > xIStm; + for( sal_Int32 i = 0; ( i < rMediaProperties.getLength() ) && !pIStm && !xRet.is(); ++i ) { const ::rtl::OUString aName( rMediaProperties[ i ].Name ); @@ -330,32 +336,30 @@ uno::Reference< ::graphic::XGraphic > SAL_CALL GraphicProvider::queryGraphic( co if( COMPARE_EQUAL == aName.compareToAscii( "URL" ) ) { ::rtl::OUString aURL; - - if( ( aValue >>= aURL ) && aURL.getLength() ) - { - xRet = implLoadMemory( aURL ); - - if( !xRet.is() ) - xRet = implLoadResource( aURL ); - - if( !xRet.is() ) - { - pIStm = ::utl::UcbStreamHelper::CreateStream( aURL, STREAM_READ ); - - if( pIStm ) - aPath = aURL; - } - } + aValue >>= aURL; + aPath = aURL; } else if( COMPARE_EQUAL == aName.compareToAscii( "InputStream" ) ) { - uno::Reference< io::XInputStream > xIStm; - - if( ( aValue >>= xIStm ) && xIStm.is() ) - pIStm = ::utl::UcbStreamHelper::CreateStream( xIStm ); + aValue >>= xIStm; } } + if( xIStm.is() ) + { + pIStm = ::utl::UcbStreamHelper::CreateStream( xIStm ); + } + else if( aPath.Len() ) + { + xRet = implLoadMemory( aPath ); + + if( !xRet.is() ) + xRet = implLoadResource( aPath ); + + if( !xRet.is() ) + pIStm = ::utl::UcbStreamHelper::CreateStream( aPath, STREAM_READ ); + } + if( pIStm ) { ::GraphicFilter* pFilter = ::GraphicFilter::GetGraphicFilter(); |