diff options
author | Kurt Zenker <kz@openoffice.org> | 2008-06-24 11:00:06 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2008-06-24 11:00:06 +0000 |
commit | 8e70de1b1e6a9bca2a0b93fafe4b749d33bb19ce (patch) | |
tree | ce6a3f9494944e4b2e85c915f891aea1ef50196f /goodies | |
parent | 0907dfd7e00da69b60f7610d7fc16cb98f898da2 (diff) |
INTEGRATION: CWS canvas05 (1.13.26); FILE MERGED
2008/04/21 07:52:21 thb 1.13.26.4: RESYNC: (1.16-1.17); FILE MERGED
2008/04/07 14:41:12 thb 1.13.26.3: RESYNC: (1.14-1.16); FILE MERGED
2007/11/06 12:37:25 thb 1.13.26.2: RESYNC: (1.13-1.14); FILE MERGED
2007/10/01 13:47:58 thb 1.13.26.1: #i79339# Merge from CWS picom
Diffstat (limited to 'goodies')
-rw-r--r-- | goodies/source/unographic/provider.cxx | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/goodies/source/unographic/provider.cxx b/goodies/source/unographic/provider.cxx index 0e63802e7735..f59471628e3f 100644 --- a/goodies/source/unographic/provider.cxx +++ b/goodies/source/unographic/provider.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: provider.cxx,v $ - * $Revision: 1.17 $ + * $Revision: 1.18 $ * * This file is part of OpenOffice.org. * @@ -233,6 +233,39 @@ uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadStandardImage( co // ------------------------------------------------------------------------------ +uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadBitmap( const uno::Reference< awt::XBitmap >& xBtm ) const +{ + uno::Reference< ::graphic::XGraphic > xRet; + uno::Sequence< sal_Int8 > aBmpSeq( xBtm->getDIB() ); + uno::Sequence< sal_Int8 > aMaskSeq( xBtm->getMaskDIB() ); + SvMemoryStream aBmpStream( aBmpSeq.getArray(), aBmpSeq.getLength(), STREAM_READ ); + Bitmap aBmp; + aBmpStream >> aBmp; + + BitmapEx aBmpEx; + + if( aMaskSeq.getLength() ) + { + SvMemoryStream aMaskStream( aMaskSeq.getArray(), aMaskSeq.getLength(), STREAM_READ ); + Bitmap aMask; + aMaskStream >> aMask; + aBmpEx = BitmapEx( aBmp, aMask ); + } + else + aBmpEx = BitmapEx( aBmp ); + + if( !aBmpEx.IsEmpty() ) + { + ::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic; + + pUnoGraphic->init( aBmpEx ); + xRet = pUnoGraphic; + } + return xRet; +} + +// ------------------------------------------------------------------------------ + uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadResource( const ::rtl::OUString& rResourceURL ) const { uno::Reference< ::graphic::XGraphic > xRet; @@ -319,6 +352,7 @@ uno::Reference< beans::XPropertySet > SAL_CALL GraphicProvider::queryGraphicDesc ::rtl::OUString aURL; uno::Reference< io::XInputStream > xIStm; + uno::Reference< awt::XBitmap >xBtm; for( sal_Int32 i = 0; ( i < rMediaProperties.getLength() ) && !xRet.is(); ++i ) { @@ -333,6 +367,10 @@ uno::Reference< beans::XPropertySet > SAL_CALL GraphicProvider::queryGraphicDesc { aValue >>= xIStm; } + else if( COMPARE_EQUAL == aName.compareToAscii( "Bitmap" ) ) + { + aValue >>= xBtm; + } } if( xIStm.is() ) @@ -365,6 +403,12 @@ uno::Reference< beans::XPropertySet > SAL_CALL GraphicProvider::queryGraphicDesc xRet = pDescriptor; } } + else if( xBtm.is() ) + { + uno::Reference< ::graphic::XGraphic > xGraphic( implLoadBitmap( xBtm ) ); + if( xGraphic.is() ) + xRet = uno::Reference< beans::XPropertySet >( xGraphic, uno::UNO_QUERY ); + } return xRet; } @@ -379,6 +423,7 @@ uno::Reference< ::graphic::XGraphic > SAL_CALL GraphicProvider::queryGraphic( co SvStream* pIStm = NULL; uno::Reference< io::XInputStream > xIStm; + uno::Reference< awt::XBitmap >xBtm; for( sal_Int32 i = 0; ( i < rMediaProperties.getLength() ) && !pIStm && !xRet.is(); ++i ) { @@ -395,6 +440,10 @@ uno::Reference< ::graphic::XGraphic > SAL_CALL GraphicProvider::queryGraphic( co { aValue >>= xIStm; } + else if( COMPARE_EQUAL == aName.compareToAscii( "Bitmap" ) ) + { + aValue >>= xBtm; + } } if( xIStm.is() ) @@ -417,6 +466,10 @@ uno::Reference< ::graphic::XGraphic > SAL_CALL GraphicProvider::queryGraphic( co if( !xRet.is() ) pIStm = ::utl::UcbStreamHelper::CreateStream( aPath, STREAM_READ ); } + else if( xBtm.is() ) + { + xRet = implLoadBitmap( xBtm ); + } if( pIStm ) { |