diff options
Diffstat (limited to 'svtools/source/graphic')
-rw-r--r-- | svtools/source/graphic/descriptor.cxx | 130 | ||||
-rw-r--r-- | svtools/source/graphic/descriptor.hxx | 96 | ||||
-rw-r--r-- | svtools/source/graphic/graphic.cxx | 62 | ||||
-rw-r--r-- | svtools/source/graphic/graphic.hxx | 20 | ||||
-rw-r--r-- | svtools/source/graphic/graphicunofactory.cxx | 8 | ||||
-rw-r--r-- | svtools/source/graphic/grfattr.cxx | 44 | ||||
-rw-r--r-- | svtools/source/graphic/grfcache.cxx | 158 | ||||
-rw-r--r-- | svtools/source/graphic/grfcache.hxx | 84 | ||||
-rw-r--r-- | svtools/source/graphic/grfmgr.cxx | 116 | ||||
-rw-r--r-- | svtools/source/graphic/grfmgr2.cxx | 406 | ||||
-rw-r--r-- | svtools/source/graphic/provider.cxx | 206 | ||||
-rw-r--r-- | svtools/source/graphic/renderer.cxx | 84 | ||||
-rw-r--r-- | svtools/source/graphic/transformer.cxx | 8 | ||||
-rw-r--r-- | svtools/source/graphic/transformer.hxx | 16 |
14 files changed, 719 insertions, 719 deletions
diff --git a/svtools/source/graphic/descriptor.cxx b/svtools/source/graphic/descriptor.cxx index 3c477f045fc3..7665f7f1e1cf 100644 --- a/svtools/source/graphic/descriptor.cxx +++ b/svtools/source/graphic/descriptor.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -45,14 +45,14 @@ #include "vcl/graph.hxx" #include "vcl/svapp.hxx" -#define UNOGRAPHIC_GRAPHICTYPE 1 -#define UNOGRAPHIC_MIMETYPE 2 -#define UNOGRAPHIC_SIZEPIXEL 3 -#define UNOGRAPHIC_SIZE100THMM 4 -#define UNOGRAPHIC_BITSPERPIXEL 5 -#define UNOGRAPHIC_TRANSPARENT 6 -#define UNOGRAPHIC_ALPHA 7 -#define UNOGRAPHIC_ANIMATED 8 +#define UNOGRAPHIC_GRAPHICTYPE 1 +#define UNOGRAPHIC_MIMETYPE 2 +#define UNOGRAPHIC_SIZEPIXEL 3 +#define UNOGRAPHIC_SIZE100THMM 4 +#define UNOGRAPHIC_BITSPERPIXEL 5 +#define UNOGRAPHIC_TRANSPARENT 6 +#define UNOGRAPHIC_ALPHA 7 +#define UNOGRAPHIC_ANIMATED 8 using namespace ::com::sun::star; @@ -61,7 +61,7 @@ namespace unographic { // --------------------- // - GraphicDescriptor - // --------------------- - + GraphicDescriptor::GraphicDescriptor() : ::comphelper::PropertySetHelper( createPropertySetInfo(), SAL_NO_ACQUIRE ), mpGraphic( NULL ), @@ -82,7 +82,7 @@ GraphicDescriptor::~GraphicDescriptor() // ------------------------------------------------------------------------------ -void GraphicDescriptor::init( const ::Graphic& rGraphic ) +void GraphicDescriptor::init( const ::Graphic& rGraphic ) throw() { mpGraphic = &rGraphic; @@ -90,11 +90,11 @@ void GraphicDescriptor::init( const ::Graphic& rGraphic ) // ------------------------------------------------------------------------------ -void GraphicDescriptor::init( const ::rtl::OUString& rURL ) +void GraphicDescriptor::init( const ::rtl::OUString& rURL ) throw() { SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( rURL, STREAM_READ ); - + if( pIStm ) { implCreate( *pIStm, &rURL ); @@ -104,11 +104,11 @@ void GraphicDescriptor::init( const ::rtl::OUString& rURL ) // ------------------------------------------------------------------------------ -void GraphicDescriptor::init( const uno::Reference< io::XInputStream >& rxIStm, const ::rtl::OUString& rURL ) +void GraphicDescriptor::init( const uno::Reference< io::XInputStream >& rxIStm, const ::rtl::OUString& rURL ) throw() { SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( rxIStm ); - + if( pIStm ) { implCreate( *pIStm, &rURL ); @@ -137,12 +137,12 @@ void GraphicDescriptor::implCreate( SvStream& rIStm, const ::rtl::OUString* pURL meType = GRAPHIC_NONE; mnBitsPerPixel = 0; mbTransparent = false; - + if( aDescriptor.Detect( true ) && aDescriptor.GetFileFormat() != GFF_NOT ) { - const char* pMimeType = NULL; - sal_uInt8 cType = graphic::GraphicType::EMPTY; - + const char* pMimeType = NULL; + sal_uInt8 cType = graphic::GraphicType::EMPTY; + switch( aDescriptor.GetFileFormat() ) { case( GFF_BMP ): pMimeType = MIMETYPE_BMP; cType = graphic::GraphicType::PIXEL; break; @@ -160,7 +160,7 @@ void GraphicDescriptor::implCreate( SvStream& rIStm, const ::rtl::OUString* pURL case( GFF_RAS ): pMimeType = MIMETYPE_RAS; cType = graphic::GraphicType::PIXEL; break; case( GFF_TGA ): pMimeType = MIMETYPE_TGA; cType = graphic::GraphicType::PIXEL; break; case( GFF_PSD ): pMimeType = MIMETYPE_PSD; cType = graphic::GraphicType::PIXEL; break; - + case( GFF_EPS ): pMimeType = MIMETYPE_EPS; cType = graphic::GraphicType::VECTOR; break; case( GFF_DXF ): pMimeType = MIMETYPE_DXF; cType = graphic::GraphicType::VECTOR; break; case( GFF_MET ): pMimeType = MIMETYPE_MET; cType = graphic::GraphicType::VECTOR; break; @@ -170,11 +170,11 @@ void GraphicDescriptor::implCreate( SvStream& rIStm, const ::rtl::OUString* pURL case( GFF_WMF ): pMimeType = MIMETYPE_WMF; cType = graphic::GraphicType::VECTOR; break; case( GFF_SGV ): pMimeType = MIMETYPE_SGV; cType = graphic::GraphicType::VECTOR; break; case( GFF_EMF ): pMimeType = MIMETYPE_EMF; cType = graphic::GraphicType::VECTOR; break; - + default: break; } - + if( graphic::GraphicType::EMPTY != cType ) { meType = ( ( graphic::GraphicType::PIXEL == cType ) ? GRAPHIC_BITMAP : GRAPHIC_GDIMETAFILE ); @@ -190,7 +190,7 @@ void GraphicDescriptor::implCreate( SvStream& rIStm, const ::rtl::OUString* pURL // ------------------------------------------------------------------------------ -::rtl::OUString GraphicDescriptor::getImplementationName_Static() +::rtl::OUString GraphicDescriptor::getImplementationName_Static() throw() { return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.graphic.GraphicDescriptor" ) ); @@ -198,19 +198,19 @@ void GraphicDescriptor::implCreate( SvStream& rIStm, const ::rtl::OUString* pURL // ------------------------------------------------------------------------------ -uno::Sequence< ::rtl::OUString > GraphicDescriptor::getSupportedServiceNames_Static() - throw( ) +uno::Sequence< ::rtl::OUString > GraphicDescriptor::getSupportedServiceNames_Static() + throw( ) { uno::Sequence< ::rtl::OUString > aSeq( 1 ); - + aSeq.getArray()[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.GraphicDescriptor" ) ); - + return aSeq; } // ------------------------------------------------------------------------------ -uno::Any SAL_CALL GraphicDescriptor::queryAggregation( const uno::Type & rType ) +uno::Any SAL_CALL GraphicDescriptor::queryAggregation( const uno::Type & rType ) throw( uno::RuntimeException ) { uno::Any aAny; @@ -233,7 +233,7 @@ uno::Any SAL_CALL GraphicDescriptor::queryAggregation( const uno::Type & rType ) // ------------------------------------------------------------------------------ -uno::Any SAL_CALL GraphicDescriptor::queryInterface( const uno::Type & rType ) +uno::Any SAL_CALL GraphicDescriptor::queryInterface( const uno::Type & rType ) throw( uno::RuntimeException ) { return OWeakAggObject::queryInterface( rType ); @@ -241,7 +241,7 @@ uno::Any SAL_CALL GraphicDescriptor::queryInterface( const uno::Type & rType ) // ------------------------------------------------------------------------------ -void SAL_CALL GraphicDescriptor::acquire() +void SAL_CALL GraphicDescriptor::acquire() throw() { OWeakAggObject::acquire(); @@ -257,7 +257,7 @@ void SAL_CALL GraphicDescriptor::release() // ------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL GraphicDescriptor::getImplementationName() +::rtl::OUString SAL_CALL GraphicDescriptor::getImplementationName() throw( uno::RuntimeException ) { return getImplementationName_Static(); @@ -268,8 +268,8 @@ void SAL_CALL GraphicDescriptor::release() sal_Bool SAL_CALL GraphicDescriptor::supportsService( const rtl::OUString& ServiceName ) throw( uno::RuntimeException ) { - uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); - const ::rtl::OUString* pArray = aSNL.getConstArray(); + uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); + const ::rtl::OUString* pArray = aSNL.getConstArray(); for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) if( pArray[i] == ServiceName ) @@ -291,8 +291,8 @@ uno::Sequence< rtl::OUString > SAL_CALL GraphicDescriptor::getSupportedServiceNa uno::Sequence< uno::Type > SAL_CALL GraphicDescriptor::getTypes() throw( uno::RuntimeException ) { - uno::Sequence< uno::Type > aTypes( 6 ); - uno::Type* pTypes = aTypes.getArray(); + uno::Sequence< uno::Type > aTypes( 6 ); + uno::Type* pTypes = aTypes.getArray(); *pTypes++ = ::getCppuType((const uno::Reference< uno::XAggregation>*)0); *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo>*)0); @@ -303,21 +303,21 @@ uno::Sequence< uno::Type > SAL_CALL GraphicDescriptor::getTypes() return aTypes; } - + // ------------------------------------------------------------------------------ uno::Sequence< sal_Int8 > SAL_CALL GraphicDescriptor::getImplementationId() throw( uno::RuntimeException ) { SolarMutexGuard aGuard; - static uno::Sequence< sal_Int8 > aId; - + static uno::Sequence< sal_Int8 > aId; + if( aId.getLength() == 0 ) { aId.realloc( 16 ); rtl_createUuid( reinterpret_cast< sal_uInt8* >( aId.getArray() ), 0, sal_True ); } - + return aId; } @@ -326,19 +326,19 @@ uno::Sequence< sal_Int8 > SAL_CALL GraphicDescriptor::getImplementationId() ::comphelper::PropertySetInfo* GraphicDescriptor::createPropertySetInfo() { SolarMutexGuard aGuard; - ::comphelper::PropertySetInfo* pRet = new ::comphelper::PropertySetInfo(); + ::comphelper::PropertySetInfo* pRet = new ::comphelper::PropertySetInfo(); static ::comphelper::PropertyMapEntry aEntries[] = { { MAP_CHAR_LEN( "GraphicType" ), UNOGRAPHIC_GRAPHICTYPE, &::getCppuType( (const sal_Int8*)(0)), beans::PropertyAttribute::READONLY, 0 }, { MAP_CHAR_LEN( "MimeType" ), UNOGRAPHIC_MIMETYPE, &::getCppuType( (const ::rtl::OUString*)(0)), beans::PropertyAttribute::READONLY, 0 }, { MAP_CHAR_LEN( "SizePixel" ), UNOGRAPHIC_SIZEPIXEL, &::getCppuType( (const awt::Size*)(0)), beans::PropertyAttribute::READONLY, 0 }, - { MAP_CHAR_LEN( "Size100thMM" ), UNOGRAPHIC_SIZE100THMM, &::getCppuType( (const awt::Size*)(0)), beans::PropertyAttribute::READONLY, 0 }, + { MAP_CHAR_LEN( "Size100thMM" ), UNOGRAPHIC_SIZE100THMM, &::getCppuType( (const awt::Size*)(0)), beans::PropertyAttribute::READONLY, 0 }, { MAP_CHAR_LEN( "BitsPerPixel" ), UNOGRAPHIC_BITSPERPIXEL, &::getCppuType( (const sal_uInt8*)(0)), beans::PropertyAttribute::READONLY, 0 }, { MAP_CHAR_LEN( "Transparent" ), UNOGRAPHIC_TRANSPARENT, &::getCppuType( (const sal_Bool*)(0)), beans::PropertyAttribute::READONLY, 0 }, { MAP_CHAR_LEN( "Alpha" ), UNOGRAPHIC_ALPHA, &::getCppuType( (const sal_Bool*)(0)), beans::PropertyAttribute::READONLY, 0 }, { MAP_CHAR_LEN( "Animated" ), UNOGRAPHIC_ANIMATED, &::getCppuType( (const sal_Bool*)(0)), beans::PropertyAttribute::READONLY, 0 }, - + { 0,0,0,0,0,0 } }; @@ -351,14 +351,14 @@ uno::Sequence< sal_Int8 > SAL_CALL GraphicDescriptor::getImplementationId() // ------------------------------------------------------------------------------ void GraphicDescriptor::_setPropertyValues( const comphelper::PropertyMapEntry** /*ppEntries*/, const uno::Any* /*pValues*/ ) - throw( beans::UnknownPropertyException, - beans::PropertyVetoException, + throw( beans::UnknownPropertyException, + beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException ) { // we only have readonly attributes } - + // ------------------------------------------------------------------------------ void GraphicDescriptor::_getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, uno::Any* pValues ) @@ -373,9 +373,9 @@ void GraphicDescriptor::_getPropertyValues( const comphelper::PropertyMapEntry** case( UNOGRAPHIC_GRAPHICTYPE ): { const GraphicType eType( mpGraphic ? mpGraphic->GetType() : meType ); - - *pValues <<= ( ( eType == GRAPHIC_BITMAP ? graphic::GraphicType::PIXEL : - ( eType == GRAPHIC_GDIMETAFILE ? graphic::GraphicType::VECTOR : + + *pValues <<= ( ( eType == GRAPHIC_BITMAP ? graphic::GraphicType::PIXEL : + ( eType == GRAPHIC_GDIMETAFILE ? graphic::GraphicType::VECTOR : graphic::GraphicType::EMPTY ) ) ); } break; @@ -383,13 +383,13 @@ void GraphicDescriptor::_getPropertyValues( const comphelper::PropertyMapEntry** case( UNOGRAPHIC_MIMETYPE ): { ::rtl::OUString aMimeType; - + if( mpGraphic ) { if( mpGraphic->IsLink() ) { const char* pMimeType; - + switch( const_cast< Graphic* >( mpGraphic )->GetLink().GetType() ) { case( GFX_LINK_TYPE_NATIVE_GIF ): pMimeType = MIMETYPE_GIF; break; @@ -398,30 +398,30 @@ void GraphicDescriptor::_getPropertyValues( const comphelper::PropertyMapEntry** case( GFX_LINK_TYPE_NATIVE_WMF ): pMimeType = MIMETYPE_WMF; break; case( GFX_LINK_TYPE_NATIVE_MET ): pMimeType = MIMETYPE_MET; break; case( GFX_LINK_TYPE_NATIVE_PCT ): pMimeType = MIMETYPE_PCT ; break; - + default: pMimeType = NULL; break; } - + if( pMimeType ) aMimeType = ::rtl::OUString::createFromAscii( pMimeType ); } - + if( !aMimeType.getLength() && ( mpGraphic->GetType() != GRAPHIC_NONE ) ) aMimeType = ::rtl::OUString::createFromAscii( MIMETYPE_VCLGRAPHIC ); } else aMimeType = maMimeType; - + *pValues <<= aMimeType; } break; - + case( UNOGRAPHIC_SIZEPIXEL ): { awt::Size aAWTSize( 0, 0 ); - + if( mpGraphic ) { if( mpGraphic->GetType() == GRAPHIC_BITMAP ) @@ -436,11 +436,11 @@ void GraphicDescriptor::_getPropertyValues( const comphelper::PropertyMapEntry** *pValues <<= aAWTSize; } break; - + case( UNOGRAPHIC_SIZE100THMM ): { awt::Size aAWTSize( 0, 0 ); - + if( mpGraphic ) { if( mpGraphic->GetPrefMapMode().GetMapUnit() != MAP_PIXEL ) @@ -451,15 +451,15 @@ void GraphicDescriptor::_getPropertyValues( const comphelper::PropertyMapEntry** } else aAWTSize = awt::Size( maSize100thMM.Width(), maSize100thMM.Height() ); - + *pValues <<= aAWTSize; } break; - + case( UNOGRAPHIC_BITSPERPIXEL ): { USHORT nBitsPerPixel = 0; - + if( mpGraphic ) { if( mpGraphic->GetType() == GRAPHIC_BITMAP ) @@ -467,11 +467,11 @@ void GraphicDescriptor::_getPropertyValues( const comphelper::PropertyMapEntry** } else nBitsPerPixel = mnBitsPerPixel; - + *pValues <<= sal::static_int_cast< sal_Int8 >(nBitsPerPixel); } break; - + case( UNOGRAPHIC_TRANSPARENT ): { *pValues <<= static_cast< sal_Bool >( mpGraphic ? mpGraphic->IsTransparent() : mbTransparent ); @@ -483,14 +483,14 @@ void GraphicDescriptor::_getPropertyValues( const comphelper::PropertyMapEntry** *pValues <<= static_cast< sal_Bool >( mpGraphic ? mpGraphic->IsAlpha() : mbAlpha ); } break; - + case( UNOGRAPHIC_ANIMATED ): { *pValues <<= static_cast< sal_Bool >( mpGraphic ? mpGraphic->IsAnimated() : mbAnimated ); } break; } - + ++ppEntries; ++pValues; } diff --git a/svtools/source/graphic/descriptor.hxx b/svtools/source/graphic/descriptor.hxx index 38d0241dcd0d..c81a1c84b341 100644 --- a/svtools/source/graphic/descriptor.hxx +++ b/svtools/source/graphic/descriptor.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -26,8 +26,8 @@ * ************************************************************************/ -#ifndef _GOODIES_DESCRIPTOR_HXX -#define _GOODIES_DESCRIPTOR_HXX +#ifndef _GOODIES_DESCRIPTOR_HXX +#define _GOODIES_DESCRIPTOR_HXX #include <comphelper/propertysethelper.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -35,37 +35,37 @@ #include <comphelper/propertysetinfo.hxx> #include <vcl/graph.hxx> -#define MIMETYPE_BMP "image/x-MS-bmp" -#define MIMETYPE_GIF "image/gif" -#define MIMETYPE_JPG "image/jpeg" -#define MIMETYPE_PCD "image/x-photo-cd" -#define MIMETYPE_PCX "image/x-pcx" -#define MIMETYPE_PNG "image/png" -#define MIMETYPE_TIF "image/tiff" -#define MIMETYPE_XBM "image/x-xbitmap" -#define MIMETYPE_XPM "image/x-xpixmap" -#define MIMETYPE_PBM "image/x-portable-bitmap" -#define MIMETYPE_PGM "image/x-portable-graymap" -#define MIMETYPE_PPM "image/x-portable-pixmap" -#define MIMETYPE_RAS "image/x-cmu-raster" -#define MIMETYPE_TGA "image/x-targa" -#define MIMETYPE_PSD "image/vnd.adobe.photoshop" -#define MIMETYPE_EPS "image/x-eps" -#define MIMETYPE_DXF "image/vnd.dxf" -#define MIMETYPE_MET "image/x-met" -#define MIMETYPE_PCT "image/x-pict" -#define MIMETYPE_SGF "image/x-sgf" -#define MIMETYPE_SVM "image/x-svm" -#define MIMETYPE_WMF "image/x-wmf" -#define MIMETYPE_SGV "image/x-sgv" -#define MIMETYPE_EMF "image/x-emf" -#define MIMETYPE_SVG "image/svg+xml" -#define MIMETYPE_VCLGRAPHIC "image/x-vclgraphic" +#define MIMETYPE_BMP "image/x-MS-bmp" +#define MIMETYPE_GIF "image/gif" +#define MIMETYPE_JPG "image/jpeg" +#define MIMETYPE_PCD "image/x-photo-cd" +#define MIMETYPE_PCX "image/x-pcx" +#define MIMETYPE_PNG "image/png" +#define MIMETYPE_TIF "image/tiff" +#define MIMETYPE_XBM "image/x-xbitmap" +#define MIMETYPE_XPM "image/x-xpixmap" +#define MIMETYPE_PBM "image/x-portable-bitmap" +#define MIMETYPE_PGM "image/x-portable-graymap" +#define MIMETYPE_PPM "image/x-portable-pixmap" +#define MIMETYPE_RAS "image/x-cmu-raster" +#define MIMETYPE_TGA "image/x-targa" +#define MIMETYPE_PSD "image/vnd.adobe.photoshop" +#define MIMETYPE_EPS "image/x-eps" +#define MIMETYPE_DXF "image/vnd.dxf" +#define MIMETYPE_MET "image/x-met" +#define MIMETYPE_PCT "image/x-pict" +#define MIMETYPE_SGF "image/x-sgf" +#define MIMETYPE_SVM "image/x-svm" +#define MIMETYPE_WMF "image/x-wmf" +#define MIMETYPE_SGV "image/x-sgv" +#define MIMETYPE_EMF "image/x-emf" +#define MIMETYPE_SVG "image/svg+xml" +#define MIMETYPE_VCLGRAPHIC "image/x-vclgraphic" using namespace com::sun::star; namespace comphelper { class PropertySetInfo; } -namespace com { namespace sun { namespace star { namespace io { class XInputStream; } } } } +namespace com { namespace sun { namespace star { namespace io { class XInputStream; } } } } class Graphic; @@ -81,19 +81,19 @@ class GraphicDescriptor : public ::cppu::OWeakAggObject, public ::comphelper::PropertySetHelper { public: - + GraphicDescriptor(); ~GraphicDescriptor() throw(); - + void init( const ::Graphic& rGraphic ) throw(); void init( const ::rtl::OUString& rURL ) throw(); void init( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxIStm, const ::rtl::OUString& rURL ) throw(); - + bool isValid() const; static ::rtl::OUString getImplementationName_Static() throw(); static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw(); - + protected: static ::comphelper::PropertySetInfo* createPropertySetInfo(); @@ -103,7 +103,7 @@ protected: virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); virtual void SAL_CALL acquire() throw(); virtual void SAL_CALL release() throw(); - + // XServiceInfo virtual rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException ); @@ -119,25 +119,25 @@ protected: private: - const ::Graphic* mpGraphic; - GraphicType meType; - ::rtl::OUString maMimeType; - Size maSizePixel; - Size maSize100thMM; - USHORT mnBitsPerPixel; - bool mbTransparent; - bool mbAlpha; - bool mbAnimated; - + const ::Graphic* mpGraphic; + GraphicType meType; + ::rtl::OUString maMimeType; + Size maSizePixel; + Size maSize100thMM; + USHORT mnBitsPerPixel; + bool mbTransparent; + bool mbAlpha; + bool mbAnimated; + GraphicDescriptor( const GraphicDescriptor& rDescriptor ); - - GraphicDescriptor& operator=( const GraphicDescriptor& ); + + GraphicDescriptor& operator=( const GraphicDescriptor& ); void implCreate( SvStream& rIStm, const ::rtl::OUString* pPath ); }; } -#endif +#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/graphic/graphic.cxx b/svtools/source/graphic/graphic.cxx index 19c8d904b3d9..0c73949d0263 100644 --- a/svtools/source/graphic/graphic.cxx +++ b/svtools/source/graphic/graphic.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -62,7 +62,7 @@ Graphic::~Graphic() void Graphic::init( const ::Graphic& rGraphic ) throw() -{ +{ delete mpGraphic; mpGraphic = new ::Graphic( rGraphic ); ::unographic::GraphicDescriptor::init( *mpGraphic ); @@ -82,7 +82,7 @@ uno::Any SAL_CALL Graphic::queryAggregation( const uno::Type& rType ) aAny <<= uno::Reference< lang::XUnoTunnel >(this); else aAny <<= ::unographic::GraphicDescriptor::queryAggregation( rType ); - + return aAny ; } @@ -99,7 +99,7 @@ uno::Any SAL_CALL Graphic::queryInterface( const uno::Type & rType ) // ------------------------------------------------------------------------------ -void SAL_CALL Graphic::acquire() +void SAL_CALL Graphic::acquire() throw() { ::unographic::GraphicDescriptor::acquire(); @@ -113,24 +113,24 @@ void SAL_CALL Graphic::release() throw() } // ------------------------------------------------------------------------------ - -uno::Sequence< sal_Int8 > SAL_CALL Graphic::getImplementationId_Static() + +uno::Sequence< sal_Int8 > SAL_CALL Graphic::getImplementationId_Static() throw(uno::RuntimeException) { SolarMutexGuard aGuard; - static uno::Sequence< sal_Int8 > aId; - + static uno::Sequence< sal_Int8 > aId; + if( aId.getLength() == 0 ) { aId.realloc( 16 ); rtl_createUuid( reinterpret_cast< sal_uInt8* >( aId.getArray() ), 0, sal_True ); } - + return aId; } // ------------------------------------------------------------------------------ - + ::rtl::OUString Graphic::getImplementationName_Static() throw() { @@ -143,14 +143,14 @@ uno::Sequence< ::rtl::OUString > Graphic::getSupportedServiceNames_Static() throw() { uno::Sequence< ::rtl::OUString > aSeq( 1 ); - + aSeq.getArray()[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.Graphic" ) ); - + return aSeq; } // ------------------------------------------------------------------------------ - + ::rtl::OUString SAL_CALL Graphic::getImplementationName() throw( uno::RuntimeException ) { @@ -159,35 +159,35 @@ uno::Sequence< ::rtl::OUString > Graphic::getSupportedServiceNames_Static() // ------------------------------------------------------------------------------ -sal_Bool SAL_CALL Graphic::supportsService( const ::rtl::OUString& rServiceName ) +sal_Bool SAL_CALL Graphic::supportsService( const ::rtl::OUString& rServiceName ) throw( uno::RuntimeException ) { if( ::unographic::GraphicDescriptor::supportsService( rServiceName ) ) return true; else { - uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); - const ::rtl::OUString* pArray = aSNL.getConstArray(); - + uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); + const ::rtl::OUString* pArray = aSNL.getConstArray(); + for( int i = 0; i < aSNL.getLength(); i++ ) if( pArray[i] == rServiceName ) return true; - + return false; } } // ------------------------------------------------------------------------------ -uno::Sequence< ::rtl::OUString > SAL_CALL Graphic::getSupportedServiceNames() +uno::Sequence< ::rtl::OUString > SAL_CALL Graphic::getSupportedServiceNames() throw( uno::RuntimeException ) { - uno::Sequence< ::rtl::OUString > aRet( ::unographic::GraphicDescriptor::getSupportedServiceNames() ); - uno::Sequence< ::rtl::OUString > aNew( getSupportedServiceNames_Static() ); - sal_Int32 nOldCount = aRet.getLength(); - + uno::Sequence< ::rtl::OUString > aRet( ::unographic::GraphicDescriptor::getSupportedServiceNames() ); + uno::Sequence< ::rtl::OUString > aNew( getSupportedServiceNames_Static() ); + sal_Int32 nOldCount = aRet.getLength(); + aRet.realloc( nOldCount + aNew.getLength() ); - + for( sal_Int32 i = 0; i < aNew.getLength(); ++i ) aRet[ nOldCount++ ] = aNew[ i ]; @@ -196,22 +196,22 @@ uno::Sequence< ::rtl::OUString > SAL_CALL Graphic::getSupportedServiceNames() // ------------------------------------------------------------------------------ -uno::Sequence< uno::Type > SAL_CALL Graphic::getTypes() +uno::Sequence< uno::Type > SAL_CALL Graphic::getTypes() throw(uno::RuntimeException) { - uno::Sequence< uno::Type > aRet( ::unographic::GraphicDescriptor::getTypes() ); - sal_Int32 nOldCount = aRet.getLength(); + uno::Sequence< uno::Type > aRet( ::unographic::GraphicDescriptor::getTypes() ); + sal_Int32 nOldCount = aRet.getLength(); aRet.realloc( nOldCount + 2 ); aRet[ nOldCount ] = ::getCppuType((const uno::Reference< graphic::XGraphic>*)0); aRet[ nOldCount+1 ] = ::getCppuType((const uno::Reference< awt::XBitmap>*)0); - + return aRet; } // ------------------------------------------------------------------------------ -uno::Sequence< sal_Int8 > SAL_CALL Graphic::getImplementationId() +uno::Sequence< sal_Int8 > SAL_CALL Graphic::getImplementationId() throw(uno::RuntimeException) { return getImplementationId_Static(); @@ -226,7 +226,7 @@ uno::Sequence< sal_Int8 > SAL_CALL Graphic::getImplementationId() if( mpGraphic && ( mpGraphic->GetType() != GRAPHIC_NONE ) ) cRet = ( ( mpGraphic->GetType() == GRAPHIC_BITMAP ) ? graphic::GraphicType::PIXEL : graphic::GraphicType::VECTOR ); - + return cRet; } @@ -294,7 +294,7 @@ sal_Int64 SAL_CALL Graphic::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw( uno::RuntimeException ) { return( ( rId.getLength() == 16 && 0 == rtl_compareMemory( getImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) ? - reinterpret_cast< sal_Int64 >( mpGraphic ) : + reinterpret_cast< sal_Int64 >( mpGraphic ) : 0 ); } diff --git a/svtools/source/graphic/graphic.hxx b/svtools/source/graphic/graphic.hxx index a82c9cca7ced..e4b968d1f343 100644 --- a/svtools/source/graphic/graphic.hxx +++ b/svtools/source/graphic/graphic.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -26,8 +26,8 @@ * ************************************************************************/ -#ifndef _GOODIES_GRAPHIC_HXX -#define _GOODIES_GRAPHIC_HXX +#ifndef _GOODIES_GRAPHIC_HXX +#define _GOODIES_GRAPHIC_HXX #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/graphic/XGraphic.hpp> @@ -49,23 +49,23 @@ namespace unographic { class Graphic : public ::com::sun::star::graphic::XGraphic, public ::com::sun::star::awt::XBitmap, - public ::com::sun::star::lang::XUnoTunnel, + public ::com::sun::star::lang::XUnoTunnel, public ::unographic::GraphicDescriptor, public ::unographic::GraphicTransformer { public: - + Graphic(); ~Graphic() throw(); using unographic::GraphicDescriptor::init; void init( const ::Graphic& rGraphic ) throw(); - + static const ::Graphic* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw(); static ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId_Static( ) throw(::com::sun::star::uno::RuntimeException); static ::rtl::OUString getImplementationName_Static() throw(); static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw(); - + protected: // XInterface @@ -73,7 +73,7 @@ protected: virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); virtual void SAL_CALL acquire() throw(); virtual void SAL_CALL release() throw(); - + // XServiceInfo virtual rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException ); @@ -82,7 +82,7 @@ protected: // XTypeProvider virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); - + // XGraphic virtual ::sal_Int8 SAL_CALL getType( ) throw (::com::sun::star::uno::RuntimeException); @@ -101,6 +101,6 @@ private: } -#endif +#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/graphic/graphicunofactory.cxx b/svtools/source/graphic/graphicunofactory.cxx index c1e2f13068de..a0b27992ac86 100644 --- a/svtools/source/graphic/graphicunofactory.cxx +++ b/svtools/source/graphic/graphicunofactory.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -63,11 +63,11 @@ GObjectImpl::GObjectImpl( uno::Sequence< uno::Any > const & args, uno::Reference rtl::OUString sId; if ( !( args[ 0 ] >>= sId ) || sId.getLength() == 0 ) throw lang::IllegalArgumentException(); - ByteString bsId( sId.getStr(), RTL_TEXTENCODING_UTF8 ); - mpGObject.reset( new GraphicObject( bsId ) ); + ByteString bsId( sId.getStr(), RTL_TEXTENCODING_UTF8 ); + mpGObject.reset( new GraphicObject( bsId ) ); } else - mpGObject.reset( new GraphicObject() ); + mpGObject.reset( new GraphicObject() ); } uno::Reference< graphic::XGraphic > SAL_CALL GObjectImpl::getGraphic() throw (uno::RuntimeException) diff --git a/svtools/source/graphic/grfattr.cxx b/svtools/source/graphic/grfattr.cxx index 3515ed276529..0ee3685425e3 100644 --- a/svtools/source/graphic/grfattr.cxx +++ b/svtools/source/graphic/grfattr.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -37,21 +37,21 @@ // --------------- GraphicAttr::GraphicAttr() : - mfGamma ( 1.0 ), - mnMirrFlags ( 0 ), - mnLeftCrop ( 0 ), - mnTopCrop ( 0 ), - mnRightCrop ( 0 ), - mnBottomCrop ( 0 ), - mnRotate10 ( 0 ), - mnContPercent ( 0 ), - mnLumPercent ( 0 ), - mnRPercent ( 0 ), - mnGPercent ( 0 ), - mnBPercent ( 0 ), - mbInvert ( FALSE ), - mcTransparency ( 0 ), - meDrawMode ( GRAPHICDRAWMODE_STANDARD ) + mfGamma ( 1.0 ), + mnMirrFlags ( 0 ), + mnLeftCrop ( 0 ), + mnTopCrop ( 0 ), + mnRightCrop ( 0 ), + mnBottomCrop ( 0 ), + mnRotate10 ( 0 ), + mnContPercent ( 0 ), + mnLumPercent ( 0 ), + mnRPercent ( 0 ), + mnGPercent ( 0 ), + mnBPercent ( 0 ), + mbInvert ( FALSE ), + mcTransparency ( 0 ), + meDrawMode ( GRAPHICDRAWMODE_STANDARD ) { } @@ -86,13 +86,13 @@ BOOL GraphicAttr::operator==( const GraphicAttr& rAttr ) const SvStream& operator>>( SvStream& rIStm, GraphicAttr& rAttr ) { - VersionCompat aCompat( rIStm, STREAM_READ ); - sal_uInt32 nTmp32; - UINT16 nTmp16; + VersionCompat aCompat( rIStm, STREAM_READ ); + sal_uInt32 nTmp32; + UINT16 nTmp16; rIStm >> nTmp32 >> nTmp32 >> rAttr.mfGamma >> rAttr.mnMirrFlags >> rAttr.mnRotate10; rIStm >> rAttr.mnContPercent >> rAttr.mnLumPercent >> rAttr.mnRPercent >> rAttr.mnGPercent >> rAttr.mnBPercent; - rIStm >> rAttr.mbInvert >> rAttr.mcTransparency >> nTmp16; + rIStm >> rAttr.mbInvert >> rAttr.mcTransparency >> nTmp16; rAttr.meDrawMode = (GraphicDrawMode) nTmp16; if( aCompat.GetVersion() >= 2 ) @@ -107,8 +107,8 @@ SvStream& operator>>( SvStream& rIStm, GraphicAttr& rAttr ) SvStream& operator<<( SvStream& rOStm, const GraphicAttr& rAttr ) { - VersionCompat aCompat( rOStm, STREAM_WRITE, 2 ); - const sal_uInt32 nTmp32 = 0; + VersionCompat aCompat( rOStm, STREAM_WRITE, 2 ); + const sal_uInt32 nTmp32 = 0; rOStm << nTmp32 << nTmp32 << rAttr.mfGamma << rAttr.mnMirrFlags << rAttr.mnRotate10; rOStm << rAttr.mnContPercent << rAttr.mnLumPercent << rAttr.mnRPercent << rAttr.mnGPercent << rAttr.mnBPercent; diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx index 6f3c02907144..fb52096118ac 100644 --- a/svtools/source/graphic/grfcache.cxx +++ b/svtools/source/graphic/grfcache.cxx @@ -42,7 +42,7 @@ // ----------- #define RELEASE_TIMEOUT 10000 -#define MAX_BMP_EXTENT 4096 +#define MAX_BMP_EXTENT 4096 // ----------- // - statics - @@ -58,10 +58,10 @@ class GraphicID { private: - sal_uInt32 mnID1; - sal_uInt32 mnID2; - sal_uInt32 mnID3; - sal_uInt32 mnID4; + sal_uInt32 mnID1; + sal_uInt32 mnID2; + sal_uInt32 mnID3; + sal_uInt32 mnID4; GraphicID(); @@ -71,13 +71,13 @@ public: GraphicID( const GraphicObject& rObj ); ~GraphicID() {} - BOOL operator==( const GraphicID& rID ) const + BOOL operator==( const GraphicID& rID ) const { return( rID.mnID1 == mnID1 && rID.mnID2 == mnID2 && rID.mnID3 == mnID3 && rID.mnID4 == mnID4 ); } - ByteString GetIDString() const; + ByteString GetIDString() const; BOOL IsEmpty() const { return( 0 == mnID4 ); } }; @@ -135,9 +135,9 @@ GraphicID::GraphicID( const GraphicObject& rObj ) ByteString GraphicID::GetIDString() const { - ByteString aHexStr; - sal_Char* pStr = aHexStr.AllocBuffer( 32 ); - sal_Int32 nShift; + ByteString aHexStr; + sal_Char* pStr = aHexStr.AllocBuffer( 32 ); + sal_Int32 nShift; for( nShift = 28; nShift >= 0; nShift -= 4 ) *pStr++ = aHexData[ ( mnID1 >> (sal_uInt32) nShift ) & 0xf ]; @@ -162,43 +162,43 @@ class GraphicCacheEntry { private: - List maGraphicObjectList; - GraphicID maID; - GfxLink maGfxLink; - BitmapEx* mpBmpEx; - GDIMetaFile* mpMtf; - Animation* mpAnimation; - BOOL mbSwappedAll; + List maGraphicObjectList; + GraphicID maID; + GfxLink maGfxLink; + BitmapEx* mpBmpEx; + GDIMetaFile* mpMtf; + Animation* mpAnimation; + BOOL mbSwappedAll; - BOOL ImplInit( const GraphicObject& rObj ); - BOOL ImplMatches( const GraphicObject& rObj ) const { return( GraphicID( rObj ) == maID ); } - void ImplFillSubstitute( Graphic& rSubstitute ); + BOOL ImplInit( const GraphicObject& rObj ); + BOOL ImplMatches( const GraphicObject& rObj ) const { return( GraphicID( rObj ) == maID ); } + void ImplFillSubstitute( Graphic& rSubstitute ); public: GraphicCacheEntry( const GraphicObject& rObj ); ~GraphicCacheEntry(); - const GraphicID& GetID() const { return maID; } + const GraphicID& GetID() const { return maID; } - void AddGraphicObjectReference( const GraphicObject& rObj, Graphic& rSubstitute ); - BOOL ReleaseGraphicObjectReference( const GraphicObject& rObj ); - ULONG GetGraphicObjectReferenceCount() { return maGraphicObjectList.Count(); } - BOOL HasGraphicObjectReference( const GraphicObject& rObj ); + void AddGraphicObjectReference( const GraphicObject& rObj, Graphic& rSubstitute ); + BOOL ReleaseGraphicObjectReference( const GraphicObject& rObj ); + ULONG GetGraphicObjectReferenceCount() { return maGraphicObjectList.Count(); } + BOOL HasGraphicObjectReference( const GraphicObject& rObj ); - void TryToSwapIn(); - void GraphicObjectWasSwappedOut( const GraphicObject& rObj ); - BOOL FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute ); - void GraphicObjectWasSwappedIn( const GraphicObject& rObj ); + void TryToSwapIn(); + void GraphicObjectWasSwappedOut( const GraphicObject& rObj ); + BOOL FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute ); + void GraphicObjectWasSwappedIn( const GraphicObject& rObj ); }; // ----------------------------------------------------------------------------- GraphicCacheEntry::GraphicCacheEntry( const GraphicObject& rObj ) : - maID ( rObj ), - mpBmpEx ( NULL ), - mpMtf ( NULL ), - mpAnimation ( NULL ), + maID ( rObj ), + mpBmpEx ( NULL ), + mpMtf ( NULL ), + mpAnimation ( NULL ), mbSwappedAll ( !ImplInit( rObj ) ) { maGraphicObjectList.Insert( (void*) &rObj, LIST_APPEND ); @@ -274,13 +274,13 @@ BOOL GraphicCacheEntry::ImplInit( const GraphicObject& rObj ) void GraphicCacheEntry::ImplFillSubstitute( Graphic& rSubstitute ) { // create substitute for graphic; - const Size aPrefSize( rSubstitute.GetPrefSize() ); - const MapMode aPrefMapMode( rSubstitute.GetPrefMapMode() ); - const Link aAnimationNotifyHdl( rSubstitute.GetAnimationNotifyHdl() ); - const String aDocFileName( rSubstitute.GetDocFileName() ); - const ULONG nDocFilePos = rSubstitute.GetDocFilePos(); - const GraphicType eOldType = rSubstitute.GetType(); - const BOOL bDefaultType = ( rSubstitute.GetType() == GRAPHIC_DEFAULT ); + const Size aPrefSize( rSubstitute.GetPrefSize() ); + const MapMode aPrefMapMode( rSubstitute.GetPrefMapMode() ); + const Link aAnimationNotifyHdl( rSubstitute.GetAnimationNotifyHdl() ); + const String aDocFileName( rSubstitute.GetDocFileName() ); + const ULONG nDocFilePos = rSubstitute.GetDocFilePos(); + const GraphicType eOldType = rSubstitute.GetType(); + const BOOL bDefaultType = ( rSubstitute.GetType() == GRAPHIC_DEFAULT ); if( rSubstitute.IsLink() && ( GFX_LINK_TYPE_NONE == maGfxLink.GetType() ) ) maGfxLink = rSubstitute.GetLink(); @@ -411,18 +411,18 @@ class GraphicDisplayCacheEntry private: ::salhelper::TTimeValue maReleaseTime; - const GraphicCacheEntry* mpRefCacheEntry; - GDIMetaFile* mpMtf; - BitmapEx* mpBmpEx; - GraphicAttr maAttr; - Size maOutSizePix; - ULONG mnCacheSize; - ULONG mnOutDevDrawMode; - USHORT mnOutDevBitCount; + const GraphicCacheEntry* mpRefCacheEntry; + GDIMetaFile* mpMtf; + BitmapEx* mpBmpEx; + GraphicAttr maAttr; + Size maOutSizePix; + ULONG mnCacheSize; + ULONG mnOutDevDrawMode; + USHORT mnOutDevBitCount; public: - static ULONG GetNeededSize( OutputDevice* pOut, const Point& rPt, const Size& rSz, + static ULONG GetNeededSize( OutputDevice* pOut, const Point& rPt, const Size& rSz, const GraphicObject& rObj, const GraphicAttr& rAttr ); public: @@ -456,17 +456,17 @@ public: ~GraphicDisplayCacheEntry(); - const GraphicAttr& GetAttr() const { return maAttr; } - const Size& GetOutputSizePixel() const { return maOutSizePix; } - ULONG GetCacheSize() const { return mnCacheSize; } - const GraphicCacheEntry* GetReferencedCacheEntry() const { return mpRefCacheEntry; } - ULONG GetOutDevDrawMode() const { return mnOutDevDrawMode; } - USHORT GetOutDevBitCount() const { return mnOutDevBitCount; } + const GraphicAttr& GetAttr() const { return maAttr; } + const Size& GetOutputSizePixel() const { return maOutSizePix; } + ULONG GetCacheSize() const { return mnCacheSize; } + const GraphicCacheEntry* GetReferencedCacheEntry() const { return mpRefCacheEntry; } + ULONG GetOutDevDrawMode() const { return mnOutDevDrawMode; } + USHORT GetOutDevBitCount() const { return mnOutDevBitCount; } void SetReleaseTime( const ::salhelper::TTimeValue& rReleaseTime ) { maReleaseTime = rReleaseTime; } const ::salhelper::TTimeValue& GetReleaseTime() const { return maReleaseTime; } - BOOL Matches( OutputDevice* pOut, const Point& /*rPtPixel*/, const Size& rSzPixel, + BOOL Matches( OutputDevice* pOut, const Point& /*rPtPixel*/, const Size& rSzPixel, const GraphicCacheEntry* pCacheEntry, const GraphicAttr& rAttr ) const { // #i46805# Additional match @@ -482,7 +482,7 @@ public: ( pOut->GetDrawMode() == mnOutDevDrawMode ) ); } - void Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz ) const; + void Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz ) const; }; // ----------------------------------------------------------------------------- @@ -491,8 +491,8 @@ ULONG GraphicDisplayCacheEntry::GetNeededSize( OutputDevice* pOut, const Point& const GraphicObject& rObj, const GraphicAttr& rAttr ) { const Graphic& rGraphic = rObj.GetGraphic(); - const GraphicType eType = rGraphic.GetType(); - ULONG nNeededSize; + const GraphicType eType = rGraphic.GetType(); + ULONG nNeededSize; if( GRAPHIC_BITMAP == eType ) { @@ -562,11 +562,11 @@ void GraphicDisplayCacheEntry::Draw( OutputDevice* pOut, const Point& rPt, const // ----------------------- GraphicCache::GraphicCache( GraphicManager& rMgr, ULONG nDisplayCacheSize, ULONG nMaxObjDisplayCacheSize ) : - mrMgr ( rMgr ), + mrMgr ( rMgr ), mnReleaseTimeoutSeconds ( 0UL ), - mnMaxDisplaySize ( nDisplayCacheSize ), - mnMaxObjDisplaySize ( nMaxObjDisplayCacheSize ), - mnUsedDisplaySize ( 0UL ) + mnMaxDisplaySize ( nDisplayCacheSize ), + mnMaxObjDisplaySize ( nMaxObjDisplayCacheSize ), + mnUsedDisplaySize ( 0UL ) { maReleaseTimer.SetTimeoutHdl( LINK( this, GraphicCache, ReleaseTimeoutHdl ) ); maReleaseTimer.SetTimeout( RELEASE_TIMEOUT ); @@ -676,8 +676,8 @@ void GraphicCache::AddGraphicObject( const GraphicObject& rObj, Graphic& rSubsti void GraphicCache::ReleaseGraphicObject( const GraphicObject& rObj ) { // Release cached object - GraphicCacheEntry* pEntry = (GraphicCacheEntry*) maGraphicCache.First(); - BOOL bRemoved = FALSE; + GraphicCacheEntry* pEntry = (GraphicCacheEntry*) maGraphicCache.First(); + BOOL bRemoved = FALSE; while( !bRemoved && pEntry ) { @@ -843,11 +843,11 @@ BOOL GraphicCache::IsDisplayCacheable( OutputDevice* pOut, const Point& rPt, con BOOL GraphicCache::IsInDisplayCache( OutputDevice* pOut, const Point& rPt, const Size& rSz, const GraphicObject& rObj, const GraphicAttr& rAttr ) const { - const Point aPtPixel( pOut->LogicToPixel( rPt ) ); - const Size aSzPixel( pOut->LogicToPixel( rSz ) ); - const GraphicCacheEntry* pCacheEntry = ( (GraphicCache*) this )->ImplGetCacheEntry( rObj ); - //GraphicDisplayCacheEntry* pDisplayEntry = (GraphicDisplayCacheEntry*) ( (GraphicCache*) this )->maDisplayCache.First(); // -Wall removed .... - BOOL bFound = FALSE; + const Point aPtPixel( pOut->LogicToPixel( rPt ) ); + const Size aSzPixel( pOut->LogicToPixel( rSz ) ); + const GraphicCacheEntry* pCacheEntry = ( (GraphicCache*) this )->ImplGetCacheEntry( rObj ); + //GraphicDisplayCacheEntry* pDisplayEntry = (GraphicDisplayCacheEntry*) ( (GraphicCache*) this )->maDisplayCache.First(); // -Wall removed .... + BOOL bFound = FALSE; if( pCacheEntry ) { @@ -863,8 +863,8 @@ BOOL GraphicCache::IsInDisplayCache( OutputDevice* pOut, const Point& rPt, const ByteString GraphicCache::GetUniqueID( const GraphicObject& rObj ) const { - ByteString aRet; - GraphicCacheEntry* pEntry = ( (GraphicCache*) this )->ImplGetCacheEntry( rObj ); + ByteString aRet; + GraphicCacheEntry* pEntry = ( (GraphicCache*) this )->ImplGetCacheEntry( rObj ); // ensure that the entry is correctly initialized (it has to be read at least once) if( pEntry && pEntry->GetID().IsEmpty() ) @@ -886,7 +886,7 @@ BOOL GraphicCache::CreateDisplayCacheObj( OutputDevice* pOut, const Point& rPt, const BitmapEx& rBmpEx ) { const ULONG nNeededSize = GraphicDisplayCacheEntry::GetNeededSize( pOut, rPt, rSz, rObj, rAttr ); - BOOL bRet = FALSE; + BOOL bRet = FALSE; if( nNeededSize <= GetMaxObjDisplayCacheSize() ) { @@ -920,7 +920,7 @@ BOOL GraphicCache::CreateDisplayCacheObj( OutputDevice* pOut, const Point& rPt, const GDIMetaFile& rMtf ) { const ULONG nNeededSize = GraphicDisplayCacheEntry::GetNeededSize( pOut, rPt, rSz, rObj, rAttr ); - BOOL bRet = FALSE; + BOOL bRet = FALSE; if( nNeededSize <= GetMaxObjDisplayCacheSize() ) { @@ -952,11 +952,11 @@ BOOL GraphicCache::CreateDisplayCacheObj( OutputDevice* pOut, const Point& rPt, BOOL GraphicCache::DrawDisplayCacheObj( OutputDevice* pOut, const Point& rPt, const Size& rSz, const GraphicObject& rObj, const GraphicAttr& rAttr ) { - const Point aPtPixel( pOut->LogicToPixel( rPt ) ); - const Size aSzPixel( pOut->LogicToPixel( rSz ) ); - const GraphicCacheEntry* pCacheEntry = ImplGetCacheEntry( rObj ); - GraphicDisplayCacheEntry* pDisplayCacheEntry = (GraphicDisplayCacheEntry*) maDisplayCache.First(); - BOOL bRet = FALSE; + const Point aPtPixel( pOut->LogicToPixel( rPt ) ); + const Size aSzPixel( pOut->LogicToPixel( rSz ) ); + const GraphicCacheEntry* pCacheEntry = ImplGetCacheEntry( rObj ); + GraphicDisplayCacheEntry* pDisplayCacheEntry = (GraphicDisplayCacheEntry*) maDisplayCache.First(); + BOOL bRet = FALSE; while( !bRet && pDisplayCacheEntry ) { diff --git a/svtools/source/graphic/grfcache.hxx b/svtools/source/graphic/grfcache.hxx index a91ad1e833f3..ecf2cf16d210 100644 --- a/svtools/source/graphic/grfcache.hxx +++ b/svtools/source/graphic/grfcache.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -44,66 +44,66 @@ class GraphicCache { private: - GraphicManager& mrMgr; + GraphicManager& mrMgr; Timer maReleaseTimer; - List maGraphicCache; - List maDisplayCache; + List maGraphicCache; + List maDisplayCache; ULONG mnReleaseTimeoutSeconds; - ULONG mnMaxDisplaySize; - ULONG mnMaxObjDisplaySize; - ULONG mnUsedDisplaySize; + ULONG mnMaxDisplaySize; + ULONG mnMaxObjDisplaySize; + ULONG mnUsedDisplaySize; - BOOL ImplFreeDisplayCacheSpace( ULONG nSizeToFree ); - GraphicCacheEntry* ImplGetCacheEntry( const GraphicObject& rObj ); + BOOL ImplFreeDisplayCacheSpace( ULONG nSizeToFree ); + GraphicCacheEntry* ImplGetCacheEntry( const GraphicObject& rObj ); DECL_LINK( ReleaseTimeoutHdl, Timer* pTimer ); - -public: - + +public: + GraphicCache( GraphicManager& rMgr, - ULONG nDisplayCacheSize = 10000000UL, + ULONG nDisplayCacheSize = 10000000UL, ULONG nMaxObjDisplayCacheSize = 2400000UL ); ~GraphicCache(); - -public: - - void AddGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute, + +public: + + void AddGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute, const ByteString* pID, const GraphicObject* pCopyObj ); - void ReleaseGraphicObject( const GraphicObject& rObj ); - - void GraphicObjectWasSwappedOut( const GraphicObject& rObj ); - BOOL FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute ); - void GraphicObjectWasSwappedIn( const GraphicObject& rObj ); - - ByteString GetUniqueID( const GraphicObject& rObj ) const; - -public: - - void SetMaxDisplayCacheSize( ULONG nNewCacheSize ); - ULONG GetMaxDisplayCacheSize() const { return mnMaxDisplaySize; }; - - void SetMaxObjDisplayCacheSize( ULONG nNewMaxObjSize, BOOL bDestroyGreaterCached = FALSE ); - ULONG GetMaxObjDisplayCacheSize() const { return mnMaxObjDisplaySize; } - - ULONG GetUsedDisplayCacheSize() const { return mnUsedDisplaySize; } - ULONG GetFreeDisplayCacheSize() const { return( mnMaxDisplaySize - mnUsedDisplaySize ); } + void ReleaseGraphicObject( const GraphicObject& rObj ); + + void GraphicObjectWasSwappedOut( const GraphicObject& rObj ); + BOOL FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute ); + void GraphicObjectWasSwappedIn( const GraphicObject& rObj ); + + ByteString GetUniqueID( const GraphicObject& rObj ) const; + +public: + + void SetMaxDisplayCacheSize( ULONG nNewCacheSize ); + ULONG GetMaxDisplayCacheSize() const { return mnMaxDisplaySize; }; + + void SetMaxObjDisplayCacheSize( ULONG nNewMaxObjSize, BOOL bDestroyGreaterCached = FALSE ); + ULONG GetMaxObjDisplayCacheSize() const { return mnMaxObjDisplaySize; } + + ULONG GetUsedDisplayCacheSize() const { return mnUsedDisplaySize; } + ULONG GetFreeDisplayCacheSize() const { return( mnMaxDisplaySize - mnUsedDisplaySize ); } void SetCacheTimeout( ULONG nTimeoutSeconds ); ULONG GetCacheTimeout() const { return mnReleaseTimeoutSeconds; } - - void ClearDisplayCache(); - BOOL IsDisplayCacheable( OutputDevice* pOut, const Point& rPt, const Size& rSz, + + void ClearDisplayCache(); + BOOL IsDisplayCacheable( OutputDevice* pOut, const Point& rPt, const Size& rSz, const GraphicObject& rObj, const GraphicAttr& rAttr ) const; - BOOL IsInDisplayCache( OutputDevice* pOut, const Point& rPt, const Size& rSz, + BOOL IsInDisplayCache( OutputDevice* pOut, const Point& rPt, const Size& rSz, const GraphicObject& rObj, const GraphicAttr& rAttr ) const; - BOOL CreateDisplayCacheObj( OutputDevice* pOut, const Point& rPt, const Size& rSz, + BOOL CreateDisplayCacheObj( OutputDevice* pOut, const Point& rPt, const Size& rSz, const GraphicObject& rObj, const GraphicAttr& rAttr, const BitmapEx& rBmpEx ); - BOOL CreateDisplayCacheObj( OutputDevice* pOut, const Point& rPt, const Size& rSz, + BOOL CreateDisplayCacheObj( OutputDevice* pOut, const Point& rPt, const Size& rSz, const GraphicObject& rObj, const GraphicAttr& rAttr, const GDIMetaFile& rMtf ); - BOOL DrawDisplayCacheObj( OutputDevice* pOut, const Point& rPt, const Size& rSz, + BOOL DrawDisplayCacheObj( OutputDevice* pOut, const Point& rPt, const Size& rSz, const GraphicObject& rObj, const GraphicAttr& rAttr ); }; diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx index 22e790a5db55..a624092dda61 100644 --- a/svtools/source/graphic/grfmgr.cxx +++ b/svtools/source/graphic/grfmgr.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -47,15 +47,15 @@ #include <vcl/pdfextoutdevdata.hxx> -#define WATERMARK_LUM_OFFSET 50 -#define WATERMARK_CON_OFFSET -70 +#define WATERMARK_LUM_OFFSET 50 +#define WATERMARK_CON_OFFSET -70 GraphicManager* GraphicObject::mpGlobalMgr = NULL; struct GrfSimpleCacheObj { - Graphic maGraphic; - GraphicAttr maAttr; + Graphic maGraphic; + GraphicAttr maAttr; GrfSimpleCacheObj( const Graphic& rGraphic, const GraphicAttr& rAttr ) : maGraphic( rGraphic ), maAttr( rAttr ) {} @@ -64,8 +64,8 @@ struct GrfSimpleCacheObj TYPEINIT1_AUTOFACTORY( GraphicObject, SvDataCopyStream ); GraphicObject::GraphicObject( const GraphicManager* pMgr ) : - mpLink ( NULL ), - mpUserData ( NULL ) + mpLink ( NULL ), + mpUserData ( NULL ) { ImplConstruct(); ImplAssignGraphicData(); @@ -73,9 +73,9 @@ GraphicObject::GraphicObject( const GraphicManager* pMgr ) : } GraphicObject::GraphicObject( const Graphic& rGraphic, const GraphicManager* pMgr ) : - maGraphic ( rGraphic ), - mpLink ( NULL ), - mpUserData ( NULL ) + maGraphic ( rGraphic ), + mpLink ( NULL ), + mpUserData ( NULL ) { ImplConstruct(); ImplAssignGraphicData(); @@ -83,9 +83,9 @@ GraphicObject::GraphicObject( const Graphic& rGraphic, const GraphicManager* pMg } GraphicObject::GraphicObject( const Graphic& rGraphic, const String& rLink, const GraphicManager* pMgr ) : - maGraphic ( rGraphic ), - mpLink ( rLink.Len() ? ( new String( rLink ) ) : NULL ), - mpUserData ( NULL ) + maGraphic ( rGraphic ), + mpLink ( rLink.Len() ? ( new String( rLink ) ) : NULL ), + mpUserData ( NULL ) { ImplConstruct(); ImplAssignGraphicData(); @@ -94,10 +94,10 @@ GraphicObject::GraphicObject( const Graphic& rGraphic, const String& rLink, cons GraphicObject::GraphicObject( const GraphicObject& rGraphicObj, const GraphicManager* pMgr ) : SvDataCopyStream(), - maGraphic ( rGraphicObj.GetGraphic() ), - maAttr ( rGraphicObj.maAttr ), - mpLink ( rGraphicObj.mpLink ? ( new String( *rGraphicObj.mpLink ) ) : NULL ), - mpUserData ( rGraphicObj.mpUserData ? ( new String( *rGraphicObj.mpUserData ) ) : NULL ) + maGraphic ( rGraphicObj.GetGraphic() ), + maAttr ( rGraphicObj.maAttr ), + mpLink ( rGraphicObj.mpLink ? ( new String( *rGraphicObj.mpLink ) ) : NULL ), + mpUserData ( rGraphicObj.mpUserData ? ( new String( *rGraphicObj.mpUserData ) ) : NULL ) { ImplConstruct(); ImplAssignGraphicData(); @@ -105,8 +105,8 @@ GraphicObject::GraphicObject( const GraphicObject& rGraphicObj, const GraphicMan } GraphicObject::GraphicObject( const ByteString& rUniqueID, const GraphicManager* pMgr ) : - mpLink ( NULL ), - mpUserData ( NULL ) + mpLink ( NULL ), + mpUserData ( NULL ) { ImplConstruct(); @@ -274,14 +274,14 @@ BOOL GraphicObject::ImplGetCropParams( OutputDevice* pOut, Point& rPt, Size& rSz if( GetType() != GRAPHIC_NONE ) { - Polygon aClipPoly( Rectangle( rPt, rSz ) ); - const USHORT nRot10 = pAttr->GetRotation() % 3600; - const Point aOldOrigin( rPt ); - const MapMode aMap100( MAP_100TH_MM ); - Size aSize100; - long nTotalWidth, nTotalHeight; - long nNewLeft, nNewTop, nNewRight, nNewBottom; - double fScale; + Polygon aClipPoly( Rectangle( rPt, rSz ) ); + const USHORT nRot10 = pAttr->GetRotation() % 3600; + const Point aOldOrigin( rPt ); + const MapMode aMap100( MAP_100TH_MM ); + Size aSize100; + long nTotalWidth, nTotalHeight; + long nNewLeft, nNewTop, nNewRight, nNewBottom; + double fScale; if( nRot10 ) { @@ -366,7 +366,7 @@ GraphicObject& GraphicObject::operator=( const GraphicObject& rGraphicObj ) BOOL GraphicObject::operator==( const GraphicObject& rGraphicObj ) const { - return( ( rGraphicObj.maGraphic == maGraphic ) && + return( ( rGraphicObj.maGraphic == maGraphic ) && ( rGraphicObj.maAttr == maAttr ) && ( rGraphicObj.GetLink() == GetLink() ) ); } @@ -472,7 +472,7 @@ void GraphicObject::SetSwapStreamHdl() void GraphicObject::SetSwapStreamHdl( const Link& rHdl, const ULONG nSwapOutTimeout ) { - delete mpSwapStreamHdl, mpSwapStreamHdl = new Link( rHdl ); + delete mpSwapStreamHdl, mpSwapStreamHdl = new Link( rHdl ); if( nSwapOutTimeout ) { @@ -561,16 +561,16 @@ List* GraphicObject::GetAnimationInfoList() const BOOL GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz, const GraphicAttr* pAttr, ULONG nFlags ) { - GraphicAttr aAttr( pAttr ? *pAttr : GetAttr() ); - Point aPt( rPt ); - Size aSz( rSz ); + GraphicAttr aAttr( pAttr ? *pAttr : GetAttr() ); + Point aPt( rPt ); + Size aSz( rSz ); const sal_uInt32 nOldDrawMode = pOut->GetDrawMode(); - BOOL bCropped = aAttr.IsCropped(); - BOOL bCached = FALSE; - BOOL bRet; + BOOL bCropped = aAttr.IsCropped(); + BOOL bCached = FALSE; + BOOL bRet; // #i29534# Provide output rects for PDF writer - Rectangle aCropRect; + Rectangle aCropRect; if( !( GRFMGR_DRAW_USE_DRAWMODE_SETTINGS & nFlags ) ) pOut->SetDrawMode( nOldDrawMode & ( ~( DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT ) ) ); @@ -594,8 +594,8 @@ BOOL GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz, if( bCropped ) { PolyPolygon aClipPolyPoly; - BOOL bRectClip; - const BOOL bCrop = ImplGetCropParams( pOut, aPt, aSz, &aAttr, aClipPolyPoly, bRectClip ); + BOOL bRectClip; + const BOOL bCrop = ImplGetCropParams( pOut, aPt, aSz, &aAttr, aClipPolyPoly, bRectClip ); pOut->Push( PUSH_CLIPREGION ); @@ -702,11 +702,11 @@ BOOL GraphicObject::DrawTiled( OutputDevice* pOut, const Rectangle& rArea, const if( pOut == NULL || rSize.Width() == 0 || rSize.Height() == 0 ) return FALSE; - const MapMode aOutMapMode( pOut->GetMapMode() ); - const MapMode aMapMode( aOutMapMode.GetMapUnit(), Point(), aOutMapMode.GetScaleX(), aOutMapMode.GetScaleY() ); + const MapMode aOutMapMode( pOut->GetMapMode() ); + const MapMode aMapMode( aOutMapMode.GetMapUnit(), Point(), aOutMapMode.GetScaleX(), aOutMapMode.GetScaleY() ); // #106258# Clamp size to 1 for zero values. This is okay, since // logical size of zero is handled above already - const Size aOutTileSize( ::std::max( 1L, pOut->LogicToPixel( rSize, aOutMapMode ).Width() ), + const Size aOutTileSize( ::std::max( 1L, pOut->LogicToPixel( rSize, aOutMapMode ).Width() ), ::std::max( 1L, pOut->LogicToPixel( rSize, aOutMapMode ).Height() ) ); //#i69780 clip final tile size to a sane max size @@ -733,14 +733,14 @@ BOOL GraphicObject::StartAnimation( OutputDevice* pOut, const Point& rPt, const if( mbAnimated ) { Point aPt( rPt ); - Size aSz( rSz ); - BOOL bCropped = aAttr.IsCropped(); + Size aSz( rSz ); + BOOL bCropped = aAttr.IsCropped(); if( bCropped ) { PolyPolygon aClipPolyPoly; - BOOL bRectClip; - const BOOL bCrop = ImplGetCropParams( pOut, aPt, aSz, &aAttr, aClipPolyPoly, bRectClip ); + BOOL bRectClip; + const BOOL bCrop = ImplGetCropParams( pOut, aPt, aSz, &aAttr, aClipPolyPoly, bRectClip ); pOut->Push( PUSH_CLIPREGION ); @@ -804,7 +804,7 @@ void GraphicObject::SetGraphic( const Graphic& rGraphic, const GraphicObject* pC delete mpSimpleCache, mpSimpleCache = NULL; mpMgr->ImplRegisterObj( *this, maGraphic, 0, pCopyObj); - + if( mpSwapOutTimer ) mpSwapOutTimer->Start(); } @@ -818,9 +818,9 @@ void GraphicObject::SetGraphic( const Graphic& rGraphic, const String& rLink ) Graphic GraphicObject::GetTransformedGraphic( const Size& rDestSize, const MapMode& rDestMap, const GraphicAttr& rAttr ) const { // #104550# Extracted from svx/source/svdraw/svdograf.cxx - Graphic aTransGraphic( maGraphic ); - const GraphicType eType = GetType(); - const Size aSrcSize( aTransGraphic.GetPrefSize() ); + Graphic aTransGraphic( maGraphic ); + const GraphicType eType = GetType(); + const Size aSrcSize( aTransGraphic.GetPrefSize() ); // #104115# Convert the crop margins to graphic object mapmode const MapMode aMapGraph( aTransGraphic.GetPrefMapMode() ); @@ -1176,11 +1176,11 @@ IMPL_LINK( GraphicObject, ImplAutoSwapOutHdl, void*, EMPTYARG ) SvStream& operator>>( SvStream& rIStm, GraphicObject& rGraphicObj ) { - VersionCompat aCompat( rIStm, STREAM_READ ); - Graphic aGraphic; - GraphicAttr aAttr; - ByteString aLink; - BOOL bLink; + VersionCompat aCompat( rIStm, STREAM_READ ); + Graphic aGraphic; + GraphicAttr aAttr; + ByteString aLink; + BOOL bLink; rIStm >> aGraphic >> aAttr >> bLink; @@ -1202,8 +1202,8 @@ SvStream& operator>>( SvStream& rIStm, GraphicObject& rGraphicObj ) SvStream& operator<<( SvStream& rOStm, const GraphicObject& rGraphicObj ) { - VersionCompat aCompat( rOStm, STREAM_WRITE, 1 ); - const BOOL bLink = rGraphicObj.HasLink(); + VersionCompat aCompat( rOStm, STREAM_WRITE, 1 ); + const BOOL bLink = rGraphicObj.HasLink(); rOStm << rGraphicObj.GetGraphic() << rGraphicObj.GetAttr() << bLink; @@ -1226,10 +1226,10 @@ GraphicObject GraphicObject::CreateGraphicObjectFromURL( const ::rtl::OUString & } else { - Graphic aGraphic; + Graphic aGraphic; if ( aURL.Len() ) { - SvStream* pStream = utl::UcbStreamHelper::CreateStream( aURL, STREAM_READ ); + SvStream* pStream = utl::UcbStreamHelper::CreateStream( aURL, STREAM_READ ); if( pStream ) GraphicConverter::Import( *pStream, aGraphic ); } diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx index 8fe7739cf8cf..70b81c85b403 100644 --- a/svtools/source/graphic/grfmgr2.cxx +++ b/svtools/source/graphic/grfmgr2.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -46,10 +46,10 @@ // - defines - // ----------- -#define MAX_PRINTER_EXT 1024 -#define MAP( cVal0, cVal1, nFrac ) ((BYTE)((((long)(cVal0)<<20L)+nFrac*((long)(cVal1)-(cVal0)))>>20L)) -#define WATERMARK_LUM_OFFSET 50 -#define WATERMARK_CON_OFFSET -70 +#define MAX_PRINTER_EXT 1024 +#define MAP( cVal0, cVal1, nFrac ) ((BYTE)((((long)(cVal0)<<20L)+nFrac*((long)(cVal1)-(cVal0)))>>20L)) +#define WATERMARK_LUM_OFFSET 50 +#define WATERMARK_CON_OFFSET -70 // ----------- // - helpers - @@ -158,9 +158,9 @@ ULONG GraphicManager::GetMaxObjCacheSize() const // ----------------------------------------------------------------------------- -ULONG GraphicManager::GetUsedCacheSize() const -{ - return mpCache->GetUsedDisplayCacheSize(); +ULONG GraphicManager::GetUsedCacheSize() const +{ + return mpCache->GetUsedDisplayCacheSize(); } // ----------------------------------------------------------------------------- @@ -201,7 +201,7 @@ void GraphicManager::ReleaseFromCache( const GraphicObject& /*rObj*/ ) // ----------------------------------------------------------------------------- BOOL GraphicManager::IsInCache( OutputDevice* pOut, const Point& rPt, - const Size& rSz, const GraphicObject& rObj, + const Size& rSz, const GraphicObject& rObj, const GraphicAttr& rAttr ) const { return mpCache->IsInDisplayCache( pOut, rPt, rSz, rObj, rAttr ); @@ -214,8 +214,8 @@ BOOL GraphicManager::DrawObj( OutputDevice* pOut, const Point& rPt, const Size& const ULONG nFlags, BOOL& rCached ) { Point aPt( rPt ); - Size aSz( rSz ); - BOOL bRet = FALSE; + Size aSz( rSz ); + BOOL bRet = FALSE; rCached = FALSE; @@ -225,9 +225,9 @@ BOOL GraphicManager::DrawObj( OutputDevice* pOut, const Point& rPt, const Size& const Size aOutSize( pOut->GetOutputSizePixel() ); if( rObj.IsAnimated() || ( pOut->GetOutDevType() == OUTDEV_PRINTER ) || - ( !( nFlags & GRFMGR_DRAW_NO_SUBSTITUTE ) && - ( ( nFlags & GRFMGR_DRAW_SUBSTITUTE ) || - !( nFlags & GRFMGR_DRAW_CACHED ) || + ( !( nFlags & GRFMGR_DRAW_NO_SUBSTITUTE ) && + ( ( nFlags & GRFMGR_DRAW_SUBSTITUTE ) || + !( nFlags & GRFMGR_DRAW_CACHED ) || ( pOut->GetConnectMetaFile() && !pOut->IsOutputEnabled() ) ) ) ) { // simple output of transformed graphic @@ -236,7 +236,7 @@ BOOL GraphicManager::DrawObj( OutputDevice* pOut, const Point& rPt, const Size& if( aGraphic.IsSupportedGraphic() ) { const USHORT nRot10 = rAttr.GetRotation() % 3600; - + if( nRot10 ) { Polygon aPoly( Rectangle( aPt, aSz ) ); @@ -268,7 +268,7 @@ BOOL GraphicManager::DrawObj( OutputDevice* pOut, const Point& rPt, const Size& // ----------------------------------------------------------------------------- -void GraphicManager::ImplRegisterObj( const GraphicObject& rObj, Graphic& rSubstitute, +void GraphicManager::ImplRegisterObj( const GraphicObject& rObj, Graphic& rSubstitute, const ByteString* pID, const GraphicObject* pCopyObj ) { maObjList.Insert( (void*) &rObj, LIST_APPEND ); @@ -278,7 +278,7 @@ void GraphicManager::ImplRegisterObj( const GraphicObject& rObj, Graphic& rSubst // ----------------------------------------------------------------------------- void GraphicManager::ImplUnregisterObj( const GraphicObject& rObj ) -{ +{ mpCache->ReleaseGraphicObject( rObj ); maObjList.Remove( (void*) &rObj ); } @@ -315,11 +315,11 @@ void GraphicManager::ImplGraphicObjectWasSwappedIn( const GraphicObject& rObj ) BOOL GraphicManager::ImplDraw( OutputDevice* pOut, const Point& rPt, const Size& rSz, GraphicObject& rObj, - const GraphicAttr& rAttr, + const GraphicAttr& rAttr, const ULONG nFlags, BOOL& rCached ) { - const Graphic& rGraphic = rObj.GetGraphic(); - BOOL bRet = FALSE; + const Graphic& rGraphic = rObj.GetGraphic(); + BOOL bRet = FALSE; if( rGraphic.IsSupportedGraphic() && !rGraphic.IsSwapOut() ) { @@ -333,7 +333,7 @@ BOOL GraphicManager::ImplDraw( OutputDevice* pOut, const Point& rPt, mpCache->IsDisplayCacheable( pOut, rPt, rSz, rObj, rAttr ) ) { BitmapEx aDstBmpEx; - + if( ImplCreateOutput( pOut, rPt, rSz, aSrcBmpEx, rAttr, nFlags, &aDstBmpEx ) ) { rCached = mpCache->CreateDisplayCacheObj( pOut, rPt, rSz, rObj, rAttr, aDstBmpEx ); @@ -361,7 +361,7 @@ BOOL GraphicManager::ImplDraw( OutputDevice* pOut, const Point& rPt, // metafile basically contains only a single // bitmap BitmapEx aDstBmpEx; - + if( ImplCreateOutput( pOut, rPt, rSz, aContainedBmpEx, rAttr, nFlags, &aDstBmpEx ) ) { rCached = mpCache->CreateDisplayCacheObj( pOut, rPt, rSz, rObj, rAttr, aDstBmpEx ); @@ -379,7 +379,7 @@ BOOL GraphicManager::ImplDraw( OutputDevice* pOut, const Point& rPt, if( !bRet ) { const Graphic aGraphic( rObj.GetTransformedGraphic( &rAttr ) ); - + if( aGraphic.IsSupportedGraphic() ) { aGraphic.Draw( pOut, rPt, rSz ); @@ -394,16 +394,16 @@ BOOL GraphicManager::ImplDraw( OutputDevice* pOut, const Point& rPt, // ----------------------------------------------------------------------------- -BOOL GraphicManager::ImplCreateOutput( OutputDevice* pOut, +BOOL GraphicManager::ImplCreateOutput( OutputDevice* pOut, const Point& rPt, const Size& rSz, const BitmapEx& rBmpEx, const GraphicAttr& rAttr, const ULONG nFlags, BitmapEx* pBmpEx ) { - USHORT nRot10 = rAttr.GetRotation() % 3600; - Point aOutPtPix; - Size aOutSzPix; - Size aUnrotatedSzPix( pOut->LogicToPixel( rSz ) ); - BOOL bRet = FALSE; + USHORT nRot10 = rAttr.GetRotation() % 3600; + Point aOutPtPix; + Size aOutSzPix; + Size aUnrotatedSzPix( pOut->LogicToPixel( rSz ) ); + BOOL bRet = FALSE; if( nRot10 ) { @@ -422,29 +422,29 @@ BOOL GraphicManager::ImplCreateOutput( OutputDevice* pOut, if( aUnrotatedSzPix.Width() && aUnrotatedSzPix.Height() ) { - BitmapEx aBmpEx( rBmpEx ); - BitmapEx aOutBmpEx; - Point aOutPt; - Size aOutSz; - const Size& rBmpSzPix = rBmpEx.GetSizePixel(); - const long nW = rBmpSzPix.Width(); - const long nH = rBmpSzPix.Height(); - const long nNewW = aUnrotatedSzPix.Width(); - const long nNewH = aUnrotatedSzPix.Height(); - double fTmp; - long* pMapIX = new long[ nNewW ]; - long* pMapFX = new long[ nNewW ]; - long* pMapIY = new long[ nNewH ]; - long* pMapFY = new long[ nNewH ]; - long nStartX = -1, nStartY = -1, nEndX = -1, nEndY = -1; - long nX, nY, nTmp, nTmpX, nTmpY; - BOOL bHMirr = ( rAttr.GetMirrorFlags() & BMP_MIRROR_HORZ ) != 0; - BOOL bVMirr = ( rAttr.GetMirrorFlags() & BMP_MIRROR_VERT ) != 0; + BitmapEx aBmpEx( rBmpEx ); + BitmapEx aOutBmpEx; + Point aOutPt; + Size aOutSz; + const Size& rBmpSzPix = rBmpEx.GetSizePixel(); + const long nW = rBmpSzPix.Width(); + const long nH = rBmpSzPix.Height(); + const long nNewW = aUnrotatedSzPix.Width(); + const long nNewH = aUnrotatedSzPix.Height(); + double fTmp; + long* pMapIX = new long[ nNewW ]; + long* pMapFX = new long[ nNewW ]; + long* pMapIY = new long[ nNewH ]; + long* pMapFY = new long[ nNewH ]; + long nStartX = -1, nStartY = -1, nEndX = -1, nEndY = -1; + long nX, nY, nTmp, nTmpX, nTmpY; + BOOL bHMirr = ( rAttr.GetMirrorFlags() & BMP_MIRROR_HORZ ) != 0; + BOOL bVMirr = ( rAttr.GetMirrorFlags() & BMP_MIRROR_VERT ) != 0; if( nFlags & GRFMGR_DRAW_BILINEAR ) { - const double fRevScaleX = ( nNewW > 1L ) ? ( (double) ( nW - 1L ) / ( nNewW - 1L ) ) : 0.0; - const double fRevScaleY = ( nNewH > 1L ) ? ( (double) ( nH - 1L ) / ( nNewH - 1L ) ) : 0.0; + const double fRevScaleX = ( nNewW > 1L ) ? ( (double) ( nW - 1L ) / ( nNewW - 1L ) ) : 0.0; + const double fRevScaleY = ( nNewH > 1L ) ? ( (double) ( nH - 1L ) / ( nNewH - 1L ) ) : 0.0; // create horizontal mapping table for( nX = 0L, nTmpX = nW - 1L, nTmp = nW - 2L; nX < nNewW; nX++ ) @@ -471,8 +471,8 @@ BOOL GraphicManager::ImplCreateOutput( OutputDevice* pOut, else { // #98290# Use a different mapping for non-interpolating mode, to avoid missing rows/columns - const double fRevScaleX = ( nNewW > 1L ) ? ( (double) nW / nNewW ) : 0.0; - const double fRevScaleY = ( nNewH > 1L ) ? ( (double) nH / nNewH ) : 0.0; + const double fRevScaleX = ( nNewW > 1L ) ? ( (double) nW / nNewW ) : 0.0; + const double fRevScaleY = ( nNewH > 1L ) ? ( (double) nH / nNewH ) : 0.0; // create horizontal mapping table for( nX = 0L, nTmpX = nW - 1L, nTmp = nW - 2L; nX < nNewW; nX++ ) @@ -504,9 +504,9 @@ BOOL GraphicManager::ImplCreateOutput( OutputDevice* pOut, // calculate output sizes if( !pBmpEx ) { - Point aPt; - Rectangle aOutRect( aPt, pOut->GetOutputSizePixel() ); - Rectangle aBmpRect( aOutPtPix, aOutSzPix ); + Point aPt; + Rectangle aOutRect( aPt, pOut->GetOutputSizePixel() ); + Rectangle aBmpRect( aOutPtPix, aOutSzPix ); if( pOut->GetOutDevType() == OUTDEV_WINDOW ) { @@ -646,7 +646,7 @@ BOOL GraphicManager::ImplCreateOutput( OutputDevice* pOut, const double fScaleY = 1.0; const MapMode& rPrefMapMode( rMtf.GetPrefMapMode() ); - const Size& rSizePix( pOut->LogicToPixel( aNewSize, + const Size& rSizePix( pOut->LogicToPixel( aNewSize, rPrefMapMode ) ); // taking care of font width default if scaling metafile. @@ -929,17 +929,17 @@ BOOL GraphicManager::ImplCreateScaled( const BitmapEx& rBmpEx, long nStartX, long nEndX, long nStartY, long nEndY, BitmapEx& rOutBmpEx ) { - Bitmap aBmp( rBmpEx.GetBitmap() ); - Bitmap aOutBmp; - BitmapReadAccess* pAcc = aBmp.AcquireReadAccess(); - BitmapWriteAccess* pWAcc; - BitmapColor aCol0, aCol1, aColRes; - const long nDstW = nEndX - nStartX + 1L; - const long nDstH = nEndY - nStartY + 1L; - long nX, nY, nTmpX, nTmpY, nTmpFX, nTmpFY; - long nXDst, nYDst; - BYTE cR0, cG0, cB0, cR1, cG1, cB1; - BOOL bRet = FALSE; + Bitmap aBmp( rBmpEx.GetBitmap() ); + Bitmap aOutBmp; + BitmapReadAccess* pAcc = aBmp.AcquireReadAccess(); + BitmapWriteAccess* pWAcc; + BitmapColor aCol0, aCol1, aColRes; + const long nDstW = nEndX - nStartX + 1L; + const long nDstH = nEndY - nStartY + 1L; + long nX, nY, nTmpX, nTmpY, nTmpFX, nTmpFY; + long nXDst, nYDst; + BYTE cR0, cG0, cB0, cR1, cG1, cB1; + BOOL bRet = FALSE; DBG_ASSERT( aBmp.GetSizePixel() == rBmpEx.GetSizePixel(), "GraphicManager::ImplCreateScaled(): bmp size inconsistent" ); @@ -1021,8 +1021,8 @@ BOOL GraphicManager::ImplCreateScaled( const BitmapEx& rBmpEx, { if( pAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_BGR ) { - Scanline pLine0, pLine1, pTmp0, pTmp1; - long nOff; + Scanline pLine0, pLine1, pTmp0, pTmp1; + long nOff; for( nY = nStartY, nYDst = 0L; nY <= nEndY; nY++, nYDst++ ) { @@ -1054,8 +1054,8 @@ BOOL GraphicManager::ImplCreateScaled( const BitmapEx& rBmpEx, } else if( pAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_RGB ) { - Scanline pLine0, pLine1, pTmp0, pTmp1; - long nOff; + Scanline pLine0, pLine1, pTmp0, pTmp1; + long nOff; for( nY = nStartY, nYDst = 0L; nY <= nEndY; nY++, nYDst++ ) { @@ -1132,8 +1132,8 @@ BOOL GraphicManager::ImplCreateScaled( const BitmapEx& rBmpEx, DBG_ASSERT( rBmpEx.GetAlpha().GetSizePixel() == rBmpEx.GetSizePixel(), "GraphicManager::ImplCreateScaled(): alpha mask size inconsistent" ); - AlphaMask aAlpha( rBmpEx.GetAlpha() ); - AlphaMask aOutAlpha; + AlphaMask aAlpha( rBmpEx.GetAlpha() ); + AlphaMask aOutAlpha; pAcc = aAlpha.AcquireReadAccess(); @@ -1160,12 +1160,12 @@ BOOL GraphicManager::ImplCreateScaled( const BitmapEx& rBmpEx, { nTmpX = pMapIX[ nX ]; nTmpFX = pMapFX[ nX ]; - const long nAlpha0 = pLine0[ nTmpX ]; - const long nAlpha2 = pLine1[ nTmpX ]; - const long nAlpha1 = pLine0[ ++nTmpX ]; - const long nAlpha3 = pLine1[ nTmpX ]; - const long n0 = MAP( nAlpha0, nAlpha1, nTmpFX ); - const long n1 = MAP( nAlpha2, nAlpha3, nTmpFX ); + const long nAlpha0 = pLine0[ nTmpX ]; + const long nAlpha2 = pLine1[ nTmpX ]; + const long nAlpha1 = pLine0[ ++nTmpX ]; + const long nAlpha3 = pLine1[ nTmpX ]; + const long n0 = MAP( nAlpha0, nAlpha1, nTmpFX ); + const long n1 = MAP( nAlpha2, nAlpha3, nTmpFX ); *pLineW++ = MAP( n0, n1, nTmpFY ); } @@ -1183,13 +1183,13 @@ BOOL GraphicManager::ImplCreateScaled( const BitmapEx& rBmpEx, { nTmpX = pMapIX[ nX ]; nTmpFX = pMapFX[ nX ]; - long nAlpha0 = pAcc->GetPixel( nTmpY, nTmpX ).GetIndex(); - long nAlpha1 = pAcc->GetPixel( nTmpY, ++nTmpX ).GetIndex(); - const long n0 = MAP( nAlpha0, nAlpha1, nTmpFX ); + long nAlpha0 = pAcc->GetPixel( nTmpY, nTmpX ).GetIndex(); + long nAlpha1 = pAcc->GetPixel( nTmpY, ++nTmpX ).GetIndex(); + const long n0 = MAP( nAlpha0, nAlpha1, nTmpFX ); nAlpha1 = pAcc->GetPixel( ++nTmpY, nTmpX ).GetIndex(); nAlpha0 = pAcc->GetPixel( nTmpY--, --nTmpX ).GetIndex(); - const long n1 = MAP( nAlpha0, nAlpha1, nTmpFX ); + const long n1 = MAP( nAlpha0, nAlpha1, nTmpFX ); aAlphaValue.SetIndex( MAP( n0, n1, nTmpFY ) ); pWAcc->SetPixel( nYDst, nXDst++, aAlphaValue ); @@ -1212,8 +1212,8 @@ BOOL GraphicManager::ImplCreateScaled( const BitmapEx& rBmpEx, DBG_ASSERT( rBmpEx.GetMask().GetSizePixel() == rBmpEx.GetSizePixel(), "GraphicManager::ImplCreateScaled(): mask size inconsistent" ); - Bitmap aMsk( rBmpEx.GetMask() ); - Bitmap aOutMsk; + Bitmap aMsk( rBmpEx.GetMask() ); + Bitmap aOutMsk; pAcc = aMsk.AcquireReadAccess(); @@ -1223,7 +1223,7 @@ BOOL GraphicManager::ImplCreateScaled( const BitmapEx& rBmpEx, // bitmap. Otherwise, we'd have to color-map even the // case below, when both masks are one bit deep. if( pAcc->HasPalette() ) - aOutMsk = Bitmap( Size( nDstW, nDstH ), + aOutMsk = Bitmap( Size( nDstW, nDstH ), 1, &pAcc->GetPalette() ); else @@ -1329,26 +1329,26 @@ BOOL GraphicManager::ImplCreateRotatedScaled( const BitmapEx& rBmpEx, long nStartX, long nEndX, long nStartY, long nEndY, BitmapEx& rOutBmpEx ) { - Point aPt; - Bitmap aBmp( rBmpEx.GetBitmap() ); - Bitmap aOutBmp; - BitmapReadAccess* pAcc = aBmp.AcquireReadAccess(); - BitmapWriteAccess* pWAcc; - Polygon aPoly( Rectangle( aPt, rUnrotatedSzPix ) ); aPoly.Rotate( Point(), nRot10 ); - Rectangle aNewBound( aPoly.GetBoundRect() ); - const double fCosAngle = cos( nRot10 * F_PI1800 ), fSinAngle = sin( nRot10 * F_PI1800 ); - double fTmp; - const long nDstW = nEndX - nStartX + 1L; - const long nDstH = nEndY - nStartY + 1L; - const long nUnRotW = rUnrotatedSzPix.Width(); - const long nUnRotH = rUnrotatedSzPix.Height(); - long* pCosX = new long[ nDstW ]; - long* pSinX = new long[ nDstW ]; - long* pCosY = new long[ nDstH ]; - long* pSinY = new long[ nDstH ]; - long nX, nY, nTmpX, nTmpY, nTmpFX, nTmpFY, nUnRotX, nUnRotY, nSinY, nCosY; - BYTE cR0, cG0, cB0, cR1, cG1, cB1; - BOOL bRet = FALSE; + Point aPt; + Bitmap aBmp( rBmpEx.GetBitmap() ); + Bitmap aOutBmp; + BitmapReadAccess* pAcc = aBmp.AcquireReadAccess(); + BitmapWriteAccess* pWAcc; + Polygon aPoly( Rectangle( aPt, rUnrotatedSzPix ) ); aPoly.Rotate( Point(), nRot10 ); + Rectangle aNewBound( aPoly.GetBoundRect() ); + const double fCosAngle = cos( nRot10 * F_PI1800 ), fSinAngle = sin( nRot10 * F_PI1800 ); + double fTmp; + const long nDstW = nEndX - nStartX + 1L; + const long nDstH = nEndY - nStartY + 1L; + const long nUnRotW = rUnrotatedSzPix.Width(); + const long nUnRotH = rUnrotatedSzPix.Height(); + long* pCosX = new long[ nDstW ]; + long* pSinX = new long[ nDstW ]; + long* pCosY = new long[ nDstH ]; + long* pSinY = new long[ nDstH ]; + long nX, nY, nTmpX, nTmpY, nTmpFX, nTmpFY, nUnRotX, nUnRotY, nSinY, nCosY; + BYTE cR0, cG0, cB0, cR1, cG1, cB1; + BOOL bRet = FALSE; // create horizontal mapping table for( nX = 0L, nTmpX = aNewBound.Left() + nStartX; nX < nDstW; nX++ ) @@ -1413,7 +1413,7 @@ BOOL GraphicManager::ImplCreateRotatedScaled( const BitmapEx& rBmpEx, } else { - BitmapColor aCol0, aCol1; + BitmapColor aCol0, aCol1; for( nY = 0; nY < nDstH; nY++ ) { @@ -1466,8 +1466,8 @@ BOOL GraphicManager::ImplCreateRotatedScaled( const BitmapEx& rBmpEx, if( rBmpEx.IsAlpha() ) { - AlphaMask aAlpha( rBmpEx.GetAlpha() ); - AlphaMask aOutAlpha; + AlphaMask aAlpha( rBmpEx.GetAlpha() ); + AlphaMask aOutAlpha; pAcc = aAlpha.AcquireReadAccess(); @@ -1502,12 +1502,12 @@ BOOL GraphicManager::ImplCreateRotatedScaled( const BitmapEx& rBmpEx, pLine0 = pAcc->GetScanline( nTmpY++ ); pLine1 = pAcc->GetScanline( nTmpY ); - const long nAlpha0 = pLine0[ nTmpX ]; - const long nAlpha2 = pLine1[ nTmpX++ ]; - const long nAlpha1 = pLine0[ nTmpX ]; - const long nAlpha3 = pLine1[ nTmpX ]; - const long n0 = MAP( nAlpha0, nAlpha1, nTmpFX ); - const long n1 = MAP( nAlpha2, nAlpha3, nTmpFX ); + const long nAlpha0 = pLine0[ nTmpX ]; + const long nAlpha2 = pLine1[ nTmpX++ ]; + const long nAlpha1 = pLine0[ nTmpX ]; + const long nAlpha3 = pLine1[ nTmpX ]; + const long n0 = MAP( nAlpha0, nAlpha1, nTmpFX ); + const long n1 = MAP( nAlpha2, nAlpha3, nTmpFX ); *pLineW++ = MAP( n0, n1, nTmpFY ); } @@ -1518,8 +1518,8 @@ BOOL GraphicManager::ImplCreateRotatedScaled( const BitmapEx& rBmpEx, } else { - const BitmapColor aTrans( pWAcc->GetBestMatchingColor( Color( COL_WHITE ) ) ); - BitmapColor aAlphaVal( 0 ); + const BitmapColor aTrans( pWAcc->GetBestMatchingColor( Color( COL_WHITE ) ) ); + BitmapColor aAlphaVal( 0 ); for( nY = 0; nY < nDstH; nY++ ) { @@ -1536,12 +1536,12 @@ BOOL GraphicManager::ImplCreateRotatedScaled( const BitmapEx& rBmpEx, nTmpX = pMapIX[ nUnRotX ]; nTmpFX = pMapFX[ nUnRotX ]; nTmpY = pMapIY[ nUnRotY ], nTmpFY = pMapFY[ nUnRotY ]; - const long nAlpha0 = pAcc->GetPixel( nTmpY, nTmpX ).GetIndex(); - const long nAlpha1 = pAcc->GetPixel( nTmpY, ++nTmpX ).GetIndex(); - const long nAlpha3 = pAcc->GetPixel( ++nTmpY, nTmpX ).GetIndex(); - const long nAlpha2 = pAcc->GetPixel( nTmpY, --nTmpX ).GetIndex(); - const long n0 = MAP( nAlpha0, nAlpha1, nTmpFX ); - const long n1 = MAP( nAlpha2, nAlpha3, nTmpFX ); + const long nAlpha0 = pAcc->GetPixel( nTmpY, nTmpX ).GetIndex(); + const long nAlpha1 = pAcc->GetPixel( nTmpY, ++nTmpX ).GetIndex(); + const long nAlpha3 = pAcc->GetPixel( ++nTmpY, nTmpX ).GetIndex(); + const long nAlpha2 = pAcc->GetPixel( nTmpY, --nTmpX ).GetIndex(); + const long n0 = MAP( nAlpha0, nAlpha1, nTmpFX ); + const long n1 = MAP( nAlpha2, nAlpha3, nTmpFX ); aAlphaVal.SetIndex( MAP( n0, n1, nTmpFY ) ); pWAcc->SetPixel( nY, nX, aAlphaVal ); @@ -1569,16 +1569,16 @@ BOOL GraphicManager::ImplCreateRotatedScaled( const BitmapEx& rBmpEx, if( pWAcc ) { - Bitmap aMsk( rBmpEx.GetMask() ); - const BitmapColor aB( pWAcc->GetBestMatchingColor( Color( COL_BLACK ) ) ); - const BitmapColor aW( pWAcc->GetBestMatchingColor( Color( COL_WHITE ) ) ); - BitmapReadAccess* pMAcc = NULL; + Bitmap aMsk( rBmpEx.GetMask() ); + const BitmapColor aB( pWAcc->GetBestMatchingColor( Color( COL_BLACK ) ) ); + const BitmapColor aW( pWAcc->GetBestMatchingColor( Color( COL_WHITE ) ) ); + BitmapReadAccess* pMAcc = NULL; if( !aMsk || ( ( pMAcc = aMsk.AcquireReadAccess() ) != NULL ) ) { - long* pMapLX = new long[ nUnRotW ]; - long* pMapLY = new long[ nUnRotH ]; - BitmapColor aTestB; + long* pMapLX = new long[ nUnRotW ]; + long* pMapLY = new long[ nUnRotH ]; + BitmapColor aTestB; if( pMAcc ) aTestB = pMAcc->GetBestMatchingColor( Color( COL_BLACK ) ); @@ -1699,8 +1699,8 @@ void GraphicManager::ImplAdjust( BitmapEx& rBmpEx, const GraphicAttr& rAttr, ULO if( ( nAdjustmentFlags & ADJUSTMENT_TRANSPARENCY ) && aAttr.IsTransparent() ) { - AlphaMask aAlpha; - BYTE cTrans = aAttr.GetTransparency(); + AlphaMask aAlpha; + BYTE cTrans = aAttr.GetTransparency(); if( !rBmpEx.IsTransparent() ) aAlpha = AlphaMask( rBmpEx.GetSizePixel(), &cTrans ); @@ -1716,8 +1716,8 @@ void GraphicManager::ImplAdjust( BitmapEx& rBmpEx, const GraphicAttr& rAttr, ULO if( pA ) { - ULONG nTrans = cTrans, nNewTrans; - const long nWidth = pA->Width(), nHeight = pA->Height(); + ULONG nTrans = cTrans, nNewTrans; + const long nWidth = pA->Width(), nHeight = pA->Height(); if( pA->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL ) { @@ -1866,9 +1866,9 @@ void GraphicManager::ImplAdjust( Animation& rAnimation, const GraphicAttr& rAttr void GraphicManager::ImplDraw( OutputDevice* pOut, const Point& rPt, const Size& rSz, const GDIMetaFile& rMtf, const GraphicAttr& rAttr ) { - USHORT nRot10 = rAttr.GetRotation() % 3600; - Point aOutPt( rPt ); - Size aOutSz( rSz ); + USHORT nRot10 = rAttr.GetRotation() % 3600; + Point aOutPt( rPt ); + Size aOutSz( rSz ); if( nRot10 ) { @@ -1896,7 +1896,7 @@ struct ImplTileInfo { ImplTileInfo() : aTileTopLeft(), aNextTileTopLeft(), aTileSizePixel(), nTilesEmptyX(0), nTilesEmptyY(0) {} - Point aTileTopLeft; // top, left position of the rendered tile + Point aTileTopLeft; // top, left position of the rendered tile Point aNextTileTopLeft; // top, left position for next recursion // level's tile Size aTileSizePixel; // size of the generated tile (might @@ -1909,7 +1909,7 @@ struct ImplTileInfo // required area coverage is often // less. The extraneous area covered is // later overwritten by the next stage) - int nTilesEmptyX; // number of original tiles empty right of + int nTilesEmptyX; // number of original tiles empty right of // this tile. This counts from // aNextTileTopLeft, i.e. the additional // area covered by aTileSizePixel is not @@ -1917,13 +1917,13 @@ struct ImplTileInfo // unification purposes, as the iterative // calculation of the next level's empty // tiles has to be based on this value. - int nTilesEmptyY; // as above, for Y + int nTilesEmptyY; // as above, for Y }; -bool GraphicObject::ImplRenderTempTile( VirtualDevice& rVDev, int nExponent, - int nNumTilesX, int nNumTilesY, - const Size& rTileSizePixel, +bool GraphicObject::ImplRenderTempTile( VirtualDevice& rVDev, int nExponent, + int nNumTilesX, int nNumTilesY, + const Size& rTileSizePixel, const GraphicAttr* pAttr, ULONG nFlags ) { if( nExponent <= 1 ) @@ -1932,7 +1932,7 @@ bool GraphicObject::ImplRenderTempTile( VirtualDevice& rVDev, int nExponent, // determine MSB factor int nMSBFactor( 1 ); while( nNumTilesX / nMSBFactor != 0 || - nNumTilesY / nMSBFactor != 0 ) + nNumTilesY / nMSBFactor != 0 ) { nMSBFactor *= nExponent; } @@ -1947,7 +1947,7 @@ bool GraphicObject::ImplRenderTempTile( VirtualDevice& rVDev, int nExponent, BOOL bOldMap( rVDev.IsMapModeEnabled() ); rVDev.EnableMapMode( FALSE ); - bool bRet( ImplRenderTileRecursive( rVDev, nExponent, nMSBFactor, nNumTilesX, nNumTilesY, + bool bRet( ImplRenderTileRecursive( rVDev, nExponent, nMSBFactor, nNumTilesX, nNumTilesY, nNumTilesX, nNumTilesY, rTileSizePixel, pAttr, nFlags, aTileInfo ) ); rVDev.EnableMapMode( bOldMap ); @@ -1965,9 +1965,9 @@ bool GraphicObject::ImplRenderTempTile( VirtualDevice& rVDev, int nExponent, // size is given by the decimal place of the corresponding decimal // representation. bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent, int nMSBFactor, - int nNumOrigTilesX, int nNumOrigTilesY, - int nRemainderTilesX, int nRemainderTilesY, - const Size& rTileSizePixel, const GraphicAttr* pAttr, + int nNumOrigTilesX, int nNumOrigTilesY, + int nRemainderTilesX, int nRemainderTilesY, + const Size& rTileSizePixel, const GraphicAttr* pAttr, ULONG nFlags, ImplTileInfo& rTileInfo ) { // gets loaded with our tile bitmap @@ -1989,7 +1989,7 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent ImplTileInfo aTileInfo; // current output position while drawing - Point aCurrPos; + Point aCurrPos; int nX, nY; // check for recursion's end condition: LSB place reached? @@ -2002,23 +2002,23 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent aTileInfo.nTilesEmptyX = nNumOrigTilesX; aTileInfo.nTilesEmptyY = nNumOrigTilesY; } - else if( ImplRenderTileRecursive( rVDev, nExponent, nMSBFactor/nExponent, - nNumOrigTilesX, nNumOrigTilesY, - nNewRemainderX, nNewRemainderY, + else if( ImplRenderTileRecursive( rVDev, nExponent, nMSBFactor/nExponent, + nNumOrigTilesX, nNumOrigTilesY, + nNewRemainderX, nNewRemainderY, rTileSizePixel, pAttr, nFlags, aTileInfo ) ) { // extract generated tile -> see comment on the first loop below BitmapEx aTileBitmap( rVDev.GetBitmap( aTileInfo.aTileTopLeft, aTileInfo.aTileSizePixel ) ); - + aTmpGraphic = GraphicObject( aTileBitmap ); // fill stripes left over from upstream levels: - // + // // x0000 // 0 // 0 // 0 - // 0 + // 0 // // where x denotes the place filled by our recursive predecessors @@ -2039,12 +2039,12 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent { if( !aTmpGraphic.Draw( &rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr, nFlags ) ) return false; - + aCurrPos.X() += aTileInfo.aTileSizePixel.Width(); } #ifdef DBG_TEST -// rVDev.SetFillColor( COL_WHITE ); +// rVDev.SetFillColor( COL_WHITE ); rVDev.SetFillColor(); rVDev.SetLineColor( Color( 255 * nExponent / nMSBFactor, 255 - 255 * nExponent / nMSBFactor, 128 - 255 * nExponent / nMSBFactor ) ); rVDev.DrawEllipse( Rectangle(aTileInfo.aNextTileTopLeft.X(), aTileInfo.aTileTopLeft.Y(), @@ -2094,13 +2094,13 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent nRemainderTilesY -= nNewRemainderY; // fill tile info for calling method - rTileInfo.aTileTopLeft = aTileInfo.aNextTileTopLeft; + rTileInfo.aTileTopLeft = aTileInfo.aNextTileTopLeft; rTileInfo.aNextTileTopLeft = Point( rTileInfo.aTileTopLeft.X() + rTileSizePixel.Width()*nRemainderTilesX, rTileInfo.aTileTopLeft.Y() + rTileSizePixel.Height()*nRemainderTilesY ); rTileInfo.aTileSizePixel = Size( rTileSizePixel.Width()*nMSBFactor*nExponent, rTileSizePixel.Height()*nMSBFactor*nExponent ); - rTileInfo.nTilesEmptyX = aTileInfo.nTilesEmptyX - nRemainderTilesX; - rTileInfo.nTilesEmptyY = aTileInfo.nTilesEmptyY - nRemainderTilesY; + rTileInfo.nTilesEmptyX = aTileInfo.nTilesEmptyX - nRemainderTilesX; + rTileInfo.nTilesEmptyY = aTileInfo.nTilesEmptyY - nRemainderTilesY; // init output position aCurrPos = aTileInfo.aNextTileTopLeft; @@ -2131,8 +2131,8 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent // rVDev.SetFillColor( COL_WHITE ); rVDev.SetFillColor(); rVDev.SetLineColor( Color( 255 * nExponent / nMSBFactor, 255 - 255 * nExponent / nMSBFactor, 128 - 255 * nExponent / nMSBFactor ) ); - rVDev.DrawRect( Rectangle((rTileInfo.aTileTopLeft.X())*rTileSizePixel.Width(), - (rTileInfo.aTileTopLeft.Y())*rTileSizePixel.Height(), + rVDev.DrawRect( Rectangle((rTileInfo.aTileTopLeft.X())*rTileSizePixel.Width(), + (rTileInfo.aTileTopLeft.Y())*rTileSizePixel.Height(), (rTileInfo.aNextTileTopLeft.X())*rTileSizePixel.Width()-1, (rTileInfo.aNextTileTopLeft.Y())*rTileSizePixel.Height()-1) ); #endif @@ -2148,68 +2148,68 @@ bool GraphicObject::ImplDrawTiled( OutputDevice* pOut, const Rectangle& rArea, c // how many tiles to generate per recursion step enum{ SubdivisionExponent=2 }; - const MapMode aOutMapMode( pOut->GetMapMode() ); - const MapMode aMapMode( aOutMapMode.GetMapUnit(), Point(), aOutMapMode.GetScaleX(), aOutMapMode.GetScaleY() ); - bool bRet( false ); + const MapMode aOutMapMode( pOut->GetMapMode() ); + const MapMode aMapMode( aOutMapMode.GetMapUnit(), Point(), aOutMapMode.GetScaleX(), aOutMapMode.GetScaleY() ); + bool bRet( false ); // #i42643# Casting to Int64, to avoid integer overflow for // huge-DPI output devices if( GetGraphic().GetType() == GRAPHIC_BITMAP && - static_cast<sal_Int64>(rSizePixel.Width()) * rSizePixel.Height() < + static_cast<sal_Int64>(rSizePixel.Width()) * rSizePixel.Height() < static_cast<sal_Int64>(nTileCacheSize1D)*nTileCacheSize1D ) { // First combine very small bitmaps into a larger tile // =================================================== - VirtualDevice aVDev; - const int nNumTilesInCacheX( (nTileCacheSize1D + rSizePixel.Width()-1) / rSizePixel.Width() ); - const int nNumTilesInCacheY( (nTileCacheSize1D + rSizePixel.Height()-1) / rSizePixel.Height() ); + VirtualDevice aVDev; + const int nNumTilesInCacheX( (nTileCacheSize1D + rSizePixel.Width()-1) / rSizePixel.Width() ); + const int nNumTilesInCacheY( (nTileCacheSize1D + rSizePixel.Height()-1) / rSizePixel.Height() ); - aVDev.SetOutputSizePixel( Size( nNumTilesInCacheX*rSizePixel.Width(), + aVDev.SetOutputSizePixel( Size( nNumTilesInCacheX*rSizePixel.Width(), nNumTilesInCacheY*rSizePixel.Height() ) ); aVDev.SetMapMode( aMapMode ); // draw bitmap content - if( ImplRenderTempTile( aVDev, SubdivisionExponent, nNumTilesInCacheX, + if( ImplRenderTempTile( aVDev, SubdivisionExponent, nNumTilesInCacheX, nNumTilesInCacheY, rSizePixel, pAttr, nFlags ) ) { BitmapEx aTileBitmap( aVDev.GetBitmap( Point(0,0), aVDev.GetOutputSize() ) ); - + // draw alpha content, if any if( IsTransparent() ) { GraphicObject aAlphaGraphic; - + if( GetGraphic().IsAlpha() ) aAlphaGraphic.SetGraphic( GetGraphic().GetBitmapEx().GetAlpha().GetBitmap() ); else - aAlphaGraphic.SetGraphic( GetGraphic().GetBitmapEx().GetMask() ); - - if( aAlphaGraphic.ImplRenderTempTile( aVDev, SubdivisionExponent, nNumTilesInCacheX, + aAlphaGraphic.SetGraphic( GetGraphic().GetBitmapEx().GetMask() ); + + if( aAlphaGraphic.ImplRenderTempTile( aVDev, SubdivisionExponent, nNumTilesInCacheX, nNumTilesInCacheY, rSizePixel, pAttr, nFlags ) ) - { + { // Combine bitmap and alpha/mask if( GetGraphic().IsAlpha() ) - aTileBitmap = BitmapEx( aTileBitmap.GetBitmap(), + aTileBitmap = BitmapEx( aTileBitmap.GetBitmap(), AlphaMask( aVDev.GetBitmap( Point(0,0), aVDev.GetOutputSize() ) ) ); else - aTileBitmap = BitmapEx( aTileBitmap.GetBitmap(), + aTileBitmap = BitmapEx( aTileBitmap.GetBitmap(), aVDev.GetBitmap( Point(0,0), aVDev.GetOutputSize() ).CreateMask( Color(COL_WHITE) ) ); } } - + // paint generated tile GraphicObject aTmpGraphic( aTileBitmap ); - bRet = aTmpGraphic.ImplDrawTiled( pOut, rArea, - aTileBitmap.GetSizePixel(), + bRet = aTmpGraphic.ImplDrawTiled( pOut, rArea, + aTileBitmap.GetSizePixel(), rOffset, pAttr, nFlags, nTileCacheSize1D ); } } else { - const Size aOutOffset( pOut->LogicToPixel( rOffset, aOutMapMode ) ); - const Rectangle aOutArea( pOut->LogicToPixel( rArea, aOutMapMode ) ); - + const Size aOutOffset( pOut->LogicToPixel( rOffset, aOutMapMode ) ); + const Rectangle aOutArea( pOut->LogicToPixel( rArea, aOutMapMode ) ); + // number of invisible (because out-of-area) tiles int nInvisibleTilesX; int nInvisibleTilesY; @@ -2252,17 +2252,17 @@ bool GraphicObject::ImplDrawTiled( OutputDevice* pOut, const Rectangle& rArea, c // ----------------------------------------------------------------------------- -bool GraphicObject::ImplDrawTiled( OutputDevice& rOut, const Point& rPosPixel, - int nNumTilesX, int nNumTilesY, +bool GraphicObject::ImplDrawTiled( OutputDevice& rOut, const Point& rPosPixel, + int nNumTilesX, int nNumTilesY, const Size& rTileSizePixel, const GraphicAttr* pAttr, ULONG nFlags ) { - Point aCurrPos( rPosPixel ); - Size aTileSizeLogic( rOut.PixelToLogic( rTileSizePixel ) ); - int nX, nY; + Point aCurrPos( rPosPixel ); + Size aTileSizeLogic( rOut.PixelToLogic( rTileSizePixel ) ); + int nX, nY; // #107607# Use logical coordinates for metafile playing, too - bool bDrawInPixel( rOut.GetConnectMetaFile() == NULL && GRAPHIC_BITMAP == GetType() ); - BOOL bRet( FALSE ); + bool bDrawInPixel( rOut.GetConnectMetaFile() == NULL && GRAPHIC_BITMAP == GetType() ); + BOOL bRet( FALSE ); // #105229# Switch off mapping (converting to logic and back to // pixel might cause roundoff errors) @@ -2283,9 +2283,9 @@ bool GraphicObject::ImplDrawTiled( OutputDevice& rOut, const Point& rPosPixel, // update return value. This method should return true, if // at least one of the looped Draws succeeded. - bRet |= Draw( &rOut, - bDrawInPixel ? aCurrPos : rOut.PixelToLogic( aCurrPos ), - bDrawInPixel ? rTileSizePixel : aTileSizeLogic, + bRet |= Draw( &rOut, + bDrawInPixel ? aCurrPos : rOut.PixelToLogic( aCurrPos ), + bDrawInPixel ? rTileSizePixel : aTileSizeLogic, pAttr, nFlags ); aCurrPos.X() += rTileSizePixel.Width(); @@ -2302,13 +2302,13 @@ bool GraphicObject::ImplDrawTiled( OutputDevice& rOut, const Point& rPosPixel, // ----------------------------------------------------------------------------- -void GraphicObject::ImplTransformBitmap( BitmapEx& rBmpEx, +void GraphicObject::ImplTransformBitmap( BitmapEx& rBmpEx, const GraphicAttr& rAttr, - const Size& rCropLeftTop, - const Size& rCropRightBottom, - const Rectangle& rCropRect, - const Size& rDstSize, - BOOL bEnlarge ) const + const Size& rCropLeftTop, + const Size& rCropRightBottom, + const Rectangle& rCropRect, + const Size& rDstSize, + BOOL bEnlarge ) const { // #107947# Extracted from svdograf.cxx @@ -2331,7 +2331,7 @@ void GraphicObject::ImplTransformBitmap( BitmapEx& rBmpEx, sal_Int32 nPadTotalHeight( aBmpSize.Height() + nPadTop + (rCropRightBottom.Height() < 0 ? -rCropRightBottom.Height() : 0) ); BitmapEx aBmpEx2; - + if( rBmpEx.IsTransparent() ) { if( rBmpEx.IsAlpha() ) @@ -2359,8 +2359,8 @@ void GraphicObject::ImplTransformBitmap( BitmapEx& rBmpEx, } } - const Size aSizePixel( rBmpEx.GetSizePixel() ); - + const Size aSizePixel( rBmpEx.GetSizePixel() ); + if( rAttr.GetRotation() != 0 && !IsAnimated() ) { if( aSizePixel.Width() && aSizePixel.Height() && rDstSize.Width() && rDstSize.Height() ) diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx index 045dca6fe5d9..789b864f47b2 100644 --- a/svtools/source/graphic/provider.cxx +++ b/svtools/source/graphic/provider.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -78,7 +78,7 @@ GraphicProvider::~GraphicProvider() } // ------------------------------------------------------------------------------ - + ::rtl::OUString GraphicProvider::getImplementationName_Static() throw() { @@ -91,15 +91,15 @@ uno::Sequence< ::rtl::OUString > GraphicProvider::getSupportedServiceNames_Stati throw() { uno::Sequence< ::rtl::OUString > aSeq( 1 ); - + aSeq.getArray()[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.GraphicProvider" ) ); - + return aSeq; } // ------------------------------------------------------------------------------ - -::rtl::OUString SAL_CALL GraphicProvider::getImplementationName() + +::rtl::OUString SAL_CALL GraphicProvider::getImplementationName() throw( uno::RuntimeException ) { return getImplementationName_Static(); @@ -107,11 +107,11 @@ uno::Sequence< ::rtl::OUString > GraphicProvider::getSupportedServiceNames_Stati // ------------------------------------------------------------------------------ -sal_Bool SAL_CALL GraphicProvider::supportsService( const ::rtl::OUString& ServiceName ) +sal_Bool SAL_CALL GraphicProvider::supportsService( const ::rtl::OUString& ServiceName ) throw( uno::RuntimeException ) { - uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); - const ::rtl::OUString* pArray = aSNL.getConstArray(); + uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); + const ::rtl::OUString* pArray = aSNL.getConstArray(); for( int i = 0; i < aSNL.getLength(); i++ ) if( pArray[i] == ServiceName ) @@ -122,7 +122,7 @@ sal_Bool SAL_CALL GraphicProvider::supportsService( const ::rtl::OUString& Servi // ------------------------------------------------------------------------------ -uno::Sequence< ::rtl::OUString > SAL_CALL GraphicProvider::getSupportedServiceNames() +uno::Sequence< ::rtl::OUString > SAL_CALL GraphicProvider::getSupportedServiceNames() throw( uno::RuntimeException ) { return getSupportedServiceNames_Static(); @@ -130,11 +130,11 @@ uno::Sequence< ::rtl::OUString > SAL_CALL GraphicProvider::getSupportedServiceNa // ------------------------------------------------------------------------------ -uno::Sequence< uno::Type > SAL_CALL GraphicProvider::getTypes() +uno::Sequence< uno::Type > SAL_CALL GraphicProvider::getTypes() throw(uno::RuntimeException) { - uno::Sequence< uno::Type > aTypes( 3 ); - uno::Type* pTypes = aTypes.getArray(); + uno::Sequence< uno::Type > aTypes( 3 ); + uno::Type* pTypes = aTypes.getArray(); *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo>*)0); *pTypes++ = ::getCppuType((const uno::Reference< lang::XTypeProvider>*)0); @@ -145,18 +145,18 @@ uno::Sequence< uno::Type > SAL_CALL GraphicProvider::getTypes() // ------------------------------------------------------------------------------ -uno::Sequence< sal_Int8 > SAL_CALL GraphicProvider::getImplementationId() +uno::Sequence< sal_Int8 > SAL_CALL GraphicProvider::getImplementationId() throw(uno::RuntimeException) { SolarMutexGuard aGuard; - static uno::Sequence< sal_Int8 > aId; - + static uno::Sequence< sal_Int8 > aId; + if( aId.getLength() == 0 ) { aId.realloc( 16 ); rtl_createUuid( reinterpret_cast< sal_uInt8* >( aId.getArray() ), 0, sal_True ); } - + return aId; } @@ -164,14 +164,14 @@ uno::Sequence< sal_Int8 > SAL_CALL GraphicProvider::getImplementationId() uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadGraphicObject( const ::rtl::OUString& rResourceURL ) const { - uno::Reference< ::graphic::XGraphic > xRet; - if( rResourceURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) == 0 ) + uno::Reference< ::graphic::XGraphic > xRet; + if( rResourceURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) == 0 ) { // graphic manager url String aTmpStr( rResourceURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 ) ); ByteString aUniqueID( aTmpStr, RTL_TEXTENCODING_UTF8 ); - GraphicObject aGrafObj( aUniqueID ); - // I don't call aGrafObj.GetXGraphic because it will call us back + GraphicObject aGrafObj( aUniqueID ); + // I don't call aGrafObj.GetXGraphic because it will call us back // into implLoadMemory ( with "private:memorygraphic" test ) ::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic; pUnoGraphic->init( aGrafObj.GetGraphic() ); @@ -182,22 +182,22 @@ uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadGraphicObject( co uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadMemory( const ::rtl::OUString& rResourceURL ) const { - uno::Reference< ::graphic::XGraphic > xRet; - sal_Int32 nIndex = 0; - + uno::Reference< ::graphic::XGraphic > xRet; + sal_Int32 nIndex = 0; + if( ( 0 == rResourceURL.getToken( 0, '/', nIndex ).compareToAscii( "private:memorygraphic" ) ) ) { sal_Int64 nGraphicAddress = rResourceURL.getToken( 0, '/', nIndex ).toInt64(); - + if( nGraphicAddress ) { ::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic; - + pUnoGraphic->init( *reinterpret_cast< ::Graphic* >( nGraphicAddress ) ); xRet = pUnoGraphic; } } - + return xRet; } @@ -205,8 +205,8 @@ uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadMemory( const ::r uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadRepositoryImage( const ::rtl::OUString& rResourceURL ) const { - uno::Reference< ::graphic::XGraphic > xRet; - sal_Int32 nIndex = 0; + uno::Reference< ::graphic::XGraphic > xRet; + sal_Int32 nIndex = 0; if( ( 0 == rResourceURL.getToken( 0, '/', nIndex ).compareToAscii( "private:graphicrepository" ) ) ) { @@ -226,8 +226,8 @@ uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadRepositoryImage( uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadStandardImage( const ::rtl::OUString& rResourceURL ) const { - uno::Reference< ::graphic::XGraphic > xRet; - sal_Int32 nIndex = 0; + uno::Reference< ::graphic::XGraphic > xRet; + sal_Int32 nIndex = 0; if( ( 0 == rResourceURL.getToken( 0, '/', nIndex ).compareToAscii( "private:standardimage" ) ) ) { @@ -262,9 +262,9 @@ uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadBitmap( const uno 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 ); @@ -278,7 +278,7 @@ uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadBitmap( const uno if( !aBmpEx.IsEmpty() ) { ::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic; - + pUnoGraphic->init( aBmpEx ); xRet = pUnoGraphic; } @@ -289,29 +289,29 @@ uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadBitmap( const uno uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadResource( const ::rtl::OUString& rResourceURL ) const { - uno::Reference< ::graphic::XGraphic > xRet; - sal_Int32 nIndex = 0; - + uno::Reference< ::graphic::XGraphic > xRet; + sal_Int32 nIndex = 0; + if( ( 0 == rResourceURL.getToken( 0, '/', nIndex ).compareToAscii( "private:resource" ) ) ) { ByteString aResMgrName( String( rResourceURL.getToken( 0, '/', nIndex ) ), RTL_TEXTENCODING_ASCII_US ); - + ResMgr* pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); - + if( pResMgr ) { - const ::rtl::OUString aResourceType( rResourceURL.getToken( 0, '/', nIndex ) ); - const ResId aResId( rResourceURL.getToken( 0, '/', nIndex ).toInt32(), *pResMgr ); - + const ::rtl::OUString aResourceType( rResourceURL.getToken( 0, '/', nIndex ) ); + const ResId aResId( rResourceURL.getToken( 0, '/', nIndex ).toInt32(), *pResMgr ); + if( aResourceType.getLength() ) { BitmapEx aBmpEx; - + if( ( 0 == aResourceType.compareToAscii( "bitmap" ) ) || ( 0 == aResourceType.compareToAscii( "bitmapex" ) ) ) { aResId.SetRT( RSC_BITMAP ); - + if( pResMgr->IsAvailable( aResId ) ) { aBmpEx = BitmapEx( aResId ); @@ -320,7 +320,7 @@ uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadResource( const : else if( 0 == aResourceType.compareToAscii( "image" ) ) { aResId.SetRT( RSC_IMAGE ); - + if( pResMgr->IsAvailable( aResId ) ) { const Image aImage( aResId ); @@ -330,12 +330,12 @@ uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadResource( const : else if( 0 == aResourceType.compareToAscii( "imagelist" ) ) { aResId.SetRT( RSC_IMAGELIST ); - + if( pResMgr->IsAvailable( aResId ) ) { const ImageList aImageList( aResId ); - sal_Int32 nImageId = ( nIndex > -1 ) ? rResourceURL.getToken( 0, '/', nIndex ).toInt32() : 0; - + sal_Int32 nImageId = ( nIndex > -1 ) ? rResourceURL.getToken( 0, '/', nIndex ).toInt32() : 0; + if( 0 < nImageId ) { const Image aImage( aImageList.GetImage( sal::static_int_cast< USHORT >(nImageId) ) ); @@ -347,20 +347,20 @@ uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadResource( const : } } } - + if( !aBmpEx.IsEmpty() ) { ::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic; - + pUnoGraphic->init( aBmpEx ); xRet = pUnoGraphic; } } - + delete pResMgr; } } - + return xRet; } @@ -377,9 +377,9 @@ uno::Reference< beans::XPropertySet > SAL_CALL GraphicProvider::queryGraphicDesc for( sal_Int32 i = 0; ( i < rMediaProperties.getLength() ) && !xRet.is(); ++i ) { - const ::rtl::OUString aName( rMediaProperties[ i ].Name ); - const uno::Any aValue( rMediaProperties[ i ].Value ); - + const ::rtl::OUString aName( rMediaProperties[ i ].Name ); + const uno::Any aValue( rMediaProperties[ i ].Value ); + if( COMPARE_EQUAL == aName.compareToAscii( "URL" ) ) { aValue >>= aURL; @@ -413,7 +413,7 @@ uno::Reference< beans::XPropertySet > SAL_CALL GraphicProvider::queryGraphicDesc if ( !xGraphic.is() ) xGraphic = implLoadStandardImage( aURL ); - + if( xGraphic.is() ) { xRet = uno::Reference< beans::XPropertySet >( xGraphic, uno::UNO_QUERY ); @@ -436,24 +436,24 @@ uno::Reference< beans::XPropertySet > SAL_CALL GraphicProvider::queryGraphicDesc } // ------------------------------------------------------------------------------ - + uno::Reference< ::graphic::XGraphic > SAL_CALL GraphicProvider::queryGraphic( const uno::Sequence< ::beans::PropertyValue >& rMediaProperties ) throw ( io::IOException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { - uno::Reference< ::graphic::XGraphic > xRet; - String aPath; - SvStream* pIStm = NULL; + uno::Reference< ::graphic::XGraphic > xRet; + String aPath; + 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 ) { - const ::rtl::OUString aName( rMediaProperties[ i ].Name ); - const uno::Any aValue( rMediaProperties[ i ].Value ); - + const ::rtl::OUString aName( rMediaProperties[ i ].Name ); + const uno::Any aValue( rMediaProperties[ i ].Value ); + if( COMPARE_EQUAL == aName.compareToAscii( "URL" ) ) - { + { ::rtl::OUString aURL; aValue >>= aURL; aPath = aURL; @@ -478,10 +478,10 @@ uno::Reference< ::graphic::XGraphic > SAL_CALL GraphicProvider::queryGraphic( co if( !xRet.is() ) xRet = implLoadGraphicObject( aPath ); - + if( !xRet.is() ) xRet = implLoadResource( aPath ); - + if ( !xRet.is() ) xRet = implLoadRepositoryImage( aPath ); @@ -499,24 +499,24 @@ uno::Reference< ::graphic::XGraphic > SAL_CALL GraphicProvider::queryGraphic( co if( pIStm ) { ::GraphicFilter* pFilter = ::GraphicFilter::GetGraphicFilter(); - + if( pFilter ) { ::Graphic aVCLGraphic; - - if( ( pFilter->ImportGraphic( aVCLGraphic, aPath, *pIStm ) == GRFILTER_OK ) && + + if( ( pFilter->ImportGraphic( aVCLGraphic, aPath, *pIStm ) == GRFILTER_OK ) && ( aVCLGraphic.GetType() != GRAPHIC_NONE ) ) { ::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic; - + pUnoGraphic->init( aVCLGraphic ); xRet = pUnoGraphic; } } - + delete pIStm; } - + return xRet; } @@ -558,7 +558,7 @@ void ImplApplyBitmapScaling( ::Graphic& rGraphic, sal_Int32 nPixelWidth, sal_Int { BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); MapMode aPrefMapMode( aBmpEx.GetPrefMapMode() ); - Size aPrefSize( aBmpEx.GetPrefSize() ); + Size aPrefSize( aBmpEx.GetPrefSize() ); aBmpEx.Scale( Size( nPixelWidth, nPixelHeight ) ); aBmpEx.SetPrefMapMode( aPrefMapMode ); aBmpEx.SetPrefSize( aPrefSize ); @@ -582,7 +582,7 @@ void ImplApplyBitmapResolution( ::Graphic& rGraphic, sal_Int32 nImageResolution, sal_Int32 nDestPixelHeight = nSourcePixelHeight; // check, if the bitmap DPI exceeds the maximum DPI - if( fSourceDPIX > fImageResolution ) + if( fSourceDPIX > fImageResolution ) { nDestPixelWidth = static_cast<sal_Int32>(( fSourcePixelWidth * fImageResolution ) / fSourceDPIX); if ( !nDestPixelWidth || ( nDestPixelWidth > nSourcePixelWidth ) ) @@ -615,8 +615,8 @@ void ImplApplyFilterData( ::Graphic& rGraphic, uno::Sequence< beans::PropertyVal for( sal_Int32 i = 0; i < rFilterData.getLength(); ++i ) { - const ::rtl::OUString aName( rFilterData[ i ].Name ); - const uno::Any aValue( rFilterData[ i ].Value ); + const ::rtl::OUString aName( rFilterData[ i ].Name ); + const uno::Any aValue( rFilterData[ i ].Value ); if( COMPARE_EQUAL == aName.compareToAscii( "PixelWidth" ) ) aValue >>= nPixelWidth; @@ -733,23 +733,23 @@ void ImplApplyFilterData( ::Graphic& rGraphic, uno::Sequence< beans::PropertyVal } // ------------------------------------------------------------------------------ - -void SAL_CALL GraphicProvider::storeGraphic( const uno::Reference< ::graphic::XGraphic >& rxGraphic, const uno::Sequence< beans::PropertyValue >& rMediaProperties ) + +void SAL_CALL GraphicProvider::storeGraphic( const uno::Reference< ::graphic::XGraphic >& rxGraphic, const uno::Sequence< beans::PropertyValue >& rMediaProperties ) throw ( io::IOException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { - SvStream* pOStm = NULL; - String aPath; - sal_Int32 i; - + SvStream* pOStm = NULL; + String aPath; + sal_Int32 i; + for( i = 0; ( i < rMediaProperties.getLength() ) && !pOStm; ++i ) { - const ::rtl::OUString aName( rMediaProperties[ i ].Name ); - const uno::Any aValue( rMediaProperties[ i ].Value ); - + const ::rtl::OUString aName( rMediaProperties[ i ].Name ); + const uno::Any aValue( rMediaProperties[ i ].Value ); + if( COMPARE_EQUAL == aName.compareToAscii( "URL" ) ) { ::rtl::OUString aURL; - + aValue >>= aURL; pOStm = ::utl::UcbStreamHelper::CreateStream( aURL, STREAM_WRITE | STREAM_TRUNC ); aPath = aURL; @@ -757,9 +757,9 @@ void SAL_CALL GraphicProvider::storeGraphic( const uno::Reference< ::graphic::XG else if( COMPARE_EQUAL == aName.compareToAscii( "OutputStream" ) ) { uno::Reference< io::XStream > xOStm; - + aValue >>= xOStm; - + if( xOStm.is() ) pOStm = ::utl::UcbStreamHelper::CreateStream( xOStm ); } @@ -767,24 +767,24 @@ void SAL_CALL GraphicProvider::storeGraphic( const uno::Reference< ::graphic::XG if( pOStm ) { - uno::Sequence< beans::PropertyValue > aFilterDataSeq; - const char* pFilterShortName = NULL; - + uno::Sequence< beans::PropertyValue > aFilterDataSeq; + const char* pFilterShortName = NULL; + for( i = 0; i < rMediaProperties.getLength(); ++i ) { - const ::rtl::OUString aName( rMediaProperties[ i ].Name ); - const uno::Any aValue( rMediaProperties[ i ].Value ); - + const ::rtl::OUString aName( rMediaProperties[ i ].Name ); + const uno::Any aValue( rMediaProperties[ i ].Value ); + if( COMPARE_EQUAL == aName.compareToAscii( "FilterData" ) ) { aValue >>= aFilterDataSeq; } else if( COMPARE_EQUAL == aName.compareToAscii( "MimeType" ) ) { - ::rtl::OUString aMimeType; - + ::rtl::OUString aMimeType; + aValue >>= aMimeType; - + if( COMPARE_EQUAL == aMimeType.compareToAscii( MIMETYPE_BMP ) ) pFilterShortName = "bmp"; else if( COMPARE_EQUAL == aMimeType.compareToAscii( MIMETYPE_EPS ) ) @@ -823,16 +823,16 @@ void SAL_CALL GraphicProvider::storeGraphic( const uno::Reference< ::graphic::XG pFilterShortName = MIMETYPE_VCLGRAPHIC; } } - + if( pFilterShortName ) { ::GraphicFilter* pFilter = ::GraphicFilter::GetGraphicFilter(); - + if( pFilter ) { - const uno::Reference< XInterface > xIFace( rxGraphic, uno::UNO_QUERY ); - const ::Graphic* pGraphic = ::unographic::Graphic::getImplementation( xIFace ); - + const uno::Reference< XInterface > xIFace( rxGraphic, uno::UNO_QUERY ); + const ::Graphic* pGraphic = ::unographic::Graphic::getImplementation( xIFace ); + if( pGraphic && ( pGraphic->GetType() != GRAPHIC_NONE ) ) { ::Graphic aGraphic( *pGraphic ); @@ -846,7 +846,7 @@ void SAL_CALL GraphicProvider::storeGraphic( const uno::Reference< ::graphic::XG aMemStrm << aGraphic; else { - pFilter->ExportGraphic( aGraphic, aPath, aMemStrm, + pFilter->ExportGraphic( aGraphic, aPath, aMemStrm, pFilter->GetExportFormatNumberForShortName( ::rtl::OUString::createFromAscii( pFilterShortName ) ), ( aFilterDataSeq.getLength() ? &aFilterDataSeq : NULL ) ); } diff --git a/svtools/source/graphic/renderer.cxx b/svtools/source/graphic/renderer.cxx index d955fca30cac..3ac324892d8a 100644 --- a/svtools/source/graphic/renderer.cxx +++ b/svtools/source/graphic/renderer.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,9 +42,9 @@ #include "graphic.hxx" #include "renderer.hxx" -#define UNOGRAPHIC_DEVICE 1 -#define UNOGRAPHIC_DESTINATIONRECT 2 -#define UNOGRAPHIC_RENDERDATA 3 +#define UNOGRAPHIC_DEVICE 1 +#define UNOGRAPHIC_DESTINATIONRECT 2 +#define UNOGRAPHIC_RENDERDATA 3 using namespace ::com::sun::star; @@ -59,7 +59,7 @@ uno::Reference< uno::XInterface > SAL_CALL GraphicRendererVCL_CreateInstance( co return SAL_STATIC_CAST( ::cppu::OWeakObject*, new GraphicRendererVCL ); } - + GraphicRendererVCL::GraphicRendererVCL() : ::comphelper::PropertySetHelper( createPropertySetInfo() ), mpOutDev( NULL ) @@ -75,7 +75,7 @@ GraphicRendererVCL::~GraphicRendererVCL() // ------------------------------------------------------------------------------ -::rtl::OUString GraphicRendererVCL::getImplementationName_Static() +::rtl::OUString GraphicRendererVCL::getImplementationName_Static() throw() { return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.graphic.GraphicRendererVCL" ) ); @@ -83,19 +83,19 @@ GraphicRendererVCL::~GraphicRendererVCL() // ------------------------------------------------------------------------------ -uno::Sequence< ::rtl::OUString > GraphicRendererVCL::getSupportedServiceNames_Static() - throw( ) +uno::Sequence< ::rtl::OUString > GraphicRendererVCL::getSupportedServiceNames_Static() + throw( ) { uno::Sequence< ::rtl::OUString > aSeq( 1 ); - + aSeq.getArray()[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.GraphicRendererVCL" ) ); - + return aSeq; } // ------------------------------------------------------------------------------ -uno::Any SAL_CALL GraphicRendererVCL::queryAggregation( const uno::Type & rType ) +uno::Any SAL_CALL GraphicRendererVCL::queryAggregation( const uno::Type & rType ) throw( uno::RuntimeException ) { uno::Any aAny; @@ -120,7 +120,7 @@ uno::Any SAL_CALL GraphicRendererVCL::queryAggregation( const uno::Type & rType // ------------------------------------------------------------------------------ -uno::Any SAL_CALL GraphicRendererVCL::queryInterface( const uno::Type & rType ) +uno::Any SAL_CALL GraphicRendererVCL::queryInterface( const uno::Type & rType ) throw( uno::RuntimeException ) { return OWeakAggObject::queryInterface( rType ); @@ -128,7 +128,7 @@ uno::Any SAL_CALL GraphicRendererVCL::queryInterface( const uno::Type & rType ) // ------------------------------------------------------------------------------ -void SAL_CALL GraphicRendererVCL::acquire() +void SAL_CALL GraphicRendererVCL::acquire() throw() { OWeakAggObject::acquire(); @@ -144,7 +144,7 @@ void SAL_CALL GraphicRendererVCL::release() // ------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL GraphicRendererVCL::getImplementationName() +::rtl::OUString SAL_CALL GraphicRendererVCL::getImplementationName() throw( uno::RuntimeException ) { return getImplementationName_Static(); @@ -155,8 +155,8 @@ void SAL_CALL GraphicRendererVCL::release() sal_Bool SAL_CALL GraphicRendererVCL::supportsService( const rtl::OUString& ServiceName ) throw( uno::RuntimeException ) { - uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); - const ::rtl::OUString* pArray = aSNL.getConstArray(); + uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() ); + const ::rtl::OUString* pArray = aSNL.getConstArray(); for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) if( pArray[i] == ServiceName ) @@ -178,8 +178,8 @@ uno::Sequence< rtl::OUString > SAL_CALL GraphicRendererVCL::getSupportedServiceN uno::Sequence< uno::Type > SAL_CALL GraphicRendererVCL::getTypes() throw( uno::RuntimeException ) { - uno::Sequence< uno::Type > aTypes( 7 ); - uno::Type* pTypes = aTypes.getArray(); + uno::Sequence< uno::Type > aTypes( 7 ); + uno::Type* pTypes = aTypes.getArray(); *pTypes++ = ::getCppuType((const uno::Reference< uno::XAggregation>*)0); *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo>*)0); @@ -191,21 +191,21 @@ uno::Sequence< uno::Type > SAL_CALL GraphicRendererVCL::getTypes() return aTypes; } - + // ------------------------------------------------------------------------------ uno::Sequence< sal_Int8 > SAL_CALL GraphicRendererVCL::getImplementationId() throw( uno::RuntimeException ) { SolarMutexGuard aGuard; - static uno::Sequence< sal_Int8 > aId; - + static uno::Sequence< sal_Int8 > aId; + if( aId.getLength() == 0 ) { aId.realloc( 16 ); rtl_createUuid( reinterpret_cast< sal_uInt8* >( aId.getArray() ), 0, sal_True ); } - + return aId; } @@ -214,14 +214,14 @@ uno::Sequence< sal_Int8 > SAL_CALL GraphicRendererVCL::getImplementationId() ::comphelper::PropertySetInfo* GraphicRendererVCL::createPropertySetInfo() { SolarMutexGuard aGuard; - ::comphelper::PropertySetInfo* pRet = new ::comphelper::PropertySetInfo(); + ::comphelper::PropertySetInfo* pRet = new ::comphelper::PropertySetInfo(); static ::comphelper::PropertyMapEntry aEntries[] = { { MAP_CHAR_LEN( "Device" ), UNOGRAPHIC_DEVICE, &::getCppuType( (const uno::Any*)(0)), 0, 0 }, { MAP_CHAR_LEN( "DestinationRect" ), UNOGRAPHIC_DESTINATIONRECT, &::getCppuType( (const awt::Rectangle*)(0)), 0, 0 }, - { MAP_CHAR_LEN( "RenderData" ), UNOGRAPHIC_RENDERDATA, &::getCppuType( (const uno::Any*)(0)), 0, 0 }, - + { MAP_CHAR_LEN( "RenderData" ), UNOGRAPHIC_RENDERDATA, &::getCppuType( (const uno::Any*)(0)), 0, 0 }, + { 0,0,0,0,0,0 } }; @@ -234,8 +234,8 @@ uno::Sequence< sal_Int8 > SAL_CALL GraphicRendererVCL::getImplementationId() // ------------------------------------------------------------------------------ void GraphicRendererVCL::_setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const uno::Any* pValues ) - throw( beans::UnknownPropertyException, - beans::PropertyVetoException, + throw( beans::UnknownPropertyException, + beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException ) { @@ -247,8 +247,8 @@ void GraphicRendererVCL::_setPropertyValues( const comphelper::PropertyMapEntry* { case( UNOGRAPHIC_DEVICE ): { - uno::Reference< awt::XDevice > xDevice; - + uno::Reference< awt::XDevice > xDevice; + if( ( *pValues >>= xDevice ) && xDevice.is() ) { mxDevice = xDevice; @@ -265,27 +265,27 @@ void GraphicRendererVCL::_setPropertyValues( const comphelper::PropertyMapEntry* case( UNOGRAPHIC_DESTINATIONRECT ): { awt::Rectangle aAWTRect; - + if( *pValues >>= aAWTRect ) { - maDestRect = Rectangle( Point( aAWTRect.X, aAWTRect.Y ), + maDestRect = Rectangle( Point( aAWTRect.X, aAWTRect.Y ), Size( aAWTRect.Width, aAWTRect.Height ) ); } } break; - + case( UNOGRAPHIC_RENDERDATA ): { *pValues >>= maRenderData; } break; } - + ++ppEntries; ++pValues; } } - + // ------------------------------------------------------------------------------ void GraphicRendererVCL::_getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, uno::Any* pValues ) @@ -306,35 +306,35 @@ void GraphicRendererVCL::_getPropertyValues( const comphelper::PropertyMapEntry* case( UNOGRAPHIC_DESTINATIONRECT ): { - const awt::Rectangle aAWTRect( maDestRect.Left(), maDestRect.Top(), + const awt::Rectangle aAWTRect( maDestRect.Left(), maDestRect.Top(), maDestRect.GetWidth(), maDestRect.GetHeight() ); - + *pValues <<= aAWTRect; } break; - + case( UNOGRAPHIC_RENDERDATA ): { *pValues <<= maRenderData; } break; } - + ++ppEntries; ++pValues; } } // ------------------------------------------------------------------------------ - + void SAL_CALL GraphicRendererVCL::render( const uno::Reference< graphic::XGraphic >& rxGraphic ) throw (uno::RuntimeException) { if( mpOutDev && mxDevice.is() && rxGraphic.is() ) { - const uno::Reference< XInterface > xIFace( rxGraphic, uno::UNO_QUERY ); - const ::Graphic* pGraphic = ::unographic::Graphic::getImplementation( xIFace ); - + const uno::Reference< XInterface > xIFace( rxGraphic, uno::UNO_QUERY ); + const ::Graphic* pGraphic = ::unographic::Graphic::getImplementation( xIFace ); + if( pGraphic ) { GraphicObject aGraphicObject( *pGraphic ); diff --git a/svtools/source/graphic/transformer.cxx b/svtools/source/graphic/transformer.cxx index 3a0d3c8e2fd4..226fd3afcc2d 100644 --- a/svtools/source/graphic/transformer.cxx +++ b/svtools/source/graphic/transformer.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -91,7 +91,7 @@ void setAlpha( Bitmap& rBitmap, AlphaMask& rAlpha, sal_Int32 nColorFrom, sal_Int } // XGraphicTransformer -uno::Reference< graphic::XGraphic > SAL_CALL GraphicTransformer::colorChange( +uno::Reference< graphic::XGraphic > SAL_CALL GraphicTransformer::colorChange( const uno::Reference< graphic::XGraphic >& rxGraphic, sal_Int32 nColorFrom, sal_Int8 nTolerance, sal_Int32 nColorTo, sal_Int8 nAlphaTo ) throw ( lang::IllegalArgumentException, uno::RuntimeException) { @@ -103,8 +103,8 @@ uno::Reference< graphic::XGraphic > SAL_CALL GraphicTransformer::colorChange( if ( aGraphic.GetType() == GRAPHIC_BITMAP ) { - BitmapEx aBitmapEx( aGraphic.GetBitmapEx() ); - Bitmap aBitmap( aBitmapEx.GetBitmap() ); + BitmapEx aBitmapEx( aGraphic.GetBitmapEx() ); + Bitmap aBitmap( aBitmapEx.GetBitmap() ); if ( aBitmapEx.IsAlpha() ) { diff --git a/svtools/source/graphic/transformer.hxx b/svtools/source/graphic/transformer.hxx index 0ee340c40631..d109be98b5e8 100644 --- a/svtools/source/graphic/transformer.hxx +++ b/svtools/source/graphic/transformer.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -26,10 +26,10 @@ * ************************************************************************/ -#ifndef _GOODIES_GRAPHICTRANSFORMER_HXX -#define _GOODIES_GRAPHICTRANSFORMER_HXX +#ifndef _GOODIES_GRAPHICTRANSFORMER_HXX +#define _GOODIES_GRAPHICTRANSFORMER_HXX -#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/implbase1.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/graphic/XGraphicTransformer.hpp> @@ -50,17 +50,17 @@ class GraphicTransformer : public GraphicTransformer_UnoImplHelper1 GraphicTransformer(); ~GraphicTransformer(); - + // XGraphicTransformer - virtual ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > SAL_CALL colorChange( + virtual ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > SAL_CALL colorChange( const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rGraphic, sal_Int32 nColorFrom, sal_Int8 nTolerance, sal_Int32 nColorTo, sal_Int8 nAlphaTo ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - + }; } -#endif +#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |