diff options
author | Noel Grandin <noel@peralex.com> | 2016-05-27 09:43:22 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-05-27 12:59:23 +0000 |
commit | 850a8d27ca696f18ce0c529346f8bb8505499545 (patch) | |
tree | 5641e81912760029683e1c544e01af25eee23523 /svtools | |
parent | 6c974272423ca19c94d8d5e182fec46836309d60 (diff) |
Convert GRAPHIC to scoped enum
Change-Id: I1fd09a729cbda00f99841532e0dd3fa66bce7bea
Reviewed-on: https://gerrit.libreoffice.org/25534
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/qa/unit/GraphicObjectTest.cxx | 6 | ||||
-rw-r--r-- | svtools/source/graphic/descriptor.cxx | 16 | ||||
-rw-r--r-- | svtools/source/graphic/graphic.cxx | 10 | ||||
-rw-r--r-- | svtools/source/graphic/grfcache.cxx | 20 | ||||
-rw-r--r-- | svtools/source/graphic/grfmgr.cxx | 14 | ||||
-rw-r--r-- | svtools/source/graphic/grfmgr2.cxx | 8 | ||||
-rw-r--r-- | svtools/source/graphic/provider.cxx | 8 | ||||
-rw-r--r-- | svtools/source/graphic/transformer.cxx | 2 | ||||
-rw-r--r-- | svtools/source/misc/transfer.cxx | 2 | ||||
-rw-r--r-- | svtools/source/misc/transfer2.cxx | 6 |
10 files changed, 46 insertions, 46 deletions
diff --git a/svtools/qa/unit/GraphicObjectTest.cxx b/svtools/qa/unit/GraphicObjectTest.cxx index d1ee3c2abe43..22664425677f 100644 --- a/svtools/qa/unit/GraphicObjectTest.cxx +++ b/svtools/qa/unit/GraphicObjectTest.cxx @@ -233,11 +233,11 @@ void GraphicObjectTest::testSizeBasedAutoSwap() void GraphicObjectTest::testTdf88836() { - // Construction with empty bitmap -> type should be GRAPHIC_NONE + // Construction with empty bitmap -> type should be GraphicType::NONE Graphic aGraphic = Bitmap(); - CPPUNIT_ASSERT_EQUAL(GRAPHIC_NONE, aGraphic.GetType()); + CPPUNIT_ASSERT_EQUAL(int(GraphicType::NONE), int(aGraphic.GetType())); aGraphic = Graphic(BitmapEx()); - CPPUNIT_ASSERT_EQUAL(GRAPHIC_NONE, aGraphic.GetType()); + CPPUNIT_ASSERT_EQUAL(int(GraphicType::NONE), int(aGraphic.GetType())); } void GraphicObjectTest::testTdf88935() diff --git a/svtools/source/graphic/descriptor.cxx b/svtools/source/graphic/descriptor.cxx index 1703fde4fc06..9e320ea4783d 100644 --- a/svtools/source/graphic/descriptor.cxx +++ b/svtools/source/graphic/descriptor.cxx @@ -57,7 +57,7 @@ namespace unographic { GraphicDescriptor::GraphicDescriptor() : ::comphelper::PropertySetHelper( createPropertySetInfo(), SAL_NO_ACQUIRE ), mpGraphic( nullptr ), - meType( GRAPHIC_NONE ), + meType( GraphicType::NONE ), mnBitsPerPixel ( 0 ), mbTransparent ( false ), mbAlpha( false ), @@ -100,7 +100,7 @@ void GraphicDescriptor::implCreate( SvStream& rIStm, const OUString* pURL ) mpGraphic = nullptr; maMimeType.clear(); - meType = GRAPHIC_NONE; + meType = GraphicType::NONE; mnBitsPerPixel = 0; mbTransparent = false; @@ -144,7 +144,7 @@ void GraphicDescriptor::implCreate( SvStream& rIStm, const OUString* pURL ) if( graphic::GraphicType::EMPTY != cType ) { - meType = ( ( graphic::GraphicType::PIXEL == cType ) ? GRAPHIC_BITMAP : GRAPHIC_GDIMETAFILE ); + meType = ( ( graphic::GraphicType::PIXEL == cType ) ? GraphicType::Bitmap : GraphicType::GdiMetafile ); maMimeType = OUString( pMimeType, strlen(pMimeType), RTL_TEXTENCODING_ASCII_US ); maSizePixel = aDescriptor.GetSizePixel(); maSize100thMM = aDescriptor.GetSize_100TH_MM(); @@ -306,8 +306,8 @@ void GraphicDescriptor::_getPropertyValues( const comphelper::PropertyMapEntry** { const GraphicType eType( mpGraphic ? mpGraphic->GetType() : meType ); - *pValues <<= ( ( eType == GRAPHIC_BITMAP ? graphic::GraphicType::PIXEL : - ( eType == GRAPHIC_GDIMETAFILE ? graphic::GraphicType::VECTOR : + *pValues <<= ( ( eType == GraphicType::Bitmap ? graphic::GraphicType::PIXEL : + ( eType == GraphicType::GdiMetafile ? graphic::GraphicType::VECTOR : graphic::GraphicType::EMPTY ) ) ); } break; @@ -347,7 +347,7 @@ void GraphicDescriptor::_getPropertyValues( const comphelper::PropertyMapEntry** aMimeType = OUString::createFromAscii( pMimeType ); } - if( aMimeType.isEmpty() && ( mpGraphic->GetType() != GRAPHIC_NONE ) ) + if( aMimeType.isEmpty() && ( mpGraphic->GetType() != GraphicType::NONE ) ) aMimeType = MIMETYPE_VCLGRAPHIC; } else @@ -363,7 +363,7 @@ void GraphicDescriptor::_getPropertyValues( const comphelper::PropertyMapEntry** if( mpGraphic ) { - if( mpGraphic->GetType() == GRAPHIC_BITMAP ) + if( mpGraphic->GetType() == GraphicType::Bitmap ) { const Size aSizePix( mpGraphic->GetBitmapEx().GetSizePixel() ); aAWTSize = awt::Size( aSizePix.Width(), aSizePix.Height() ); @@ -401,7 +401,7 @@ void GraphicDescriptor::_getPropertyValues( const comphelper::PropertyMapEntry** if( mpGraphic ) { - if( mpGraphic->GetType() == GRAPHIC_BITMAP ) + if( mpGraphic->GetType() == GraphicType::Bitmap ) nBitsPerPixel = mpGraphic->GetBitmapEx().GetBitmap().GetBitCount(); } else diff --git a/svtools/source/graphic/graphic.cxx b/svtools/source/graphic/graphic.cxx index 207f0de3293f..3739d3b491fe 100644 --- a/svtools/source/graphic/graphic.cxx +++ b/svtools/source/graphic/graphic.cxx @@ -161,8 +161,8 @@ uno::Sequence< sal_Int8 > SAL_CALL Graphic::getImplementationId() { ::sal_Int8 cRet = graphic::GraphicType::EMPTY; - if( mpGraphic && ( mpGraphic->GetType() != GRAPHIC_NONE ) ) - cRet = ( ( mpGraphic->GetType() == GRAPHIC_BITMAP ) ? graphic::GraphicType::PIXEL : graphic::GraphicType::VECTOR ); + if( mpGraphic && ( mpGraphic->GetType() != GraphicType::NONE ) ) + cRet = ( ( mpGraphic->GetType() == GraphicType::Bitmap ) ? graphic::GraphicType::PIXEL : graphic::GraphicType::VECTOR ); return cRet; } @@ -176,7 +176,7 @@ awt::Size SAL_CALL Graphic::getSize( ) throw (uno::RuntimeException, std::excep SolarMutexGuard aGuard; ::Size aVclSize; - if( mpGraphic && ( mpGraphic->GetType() != GRAPHIC_NONE ) ) + if( mpGraphic && ( mpGraphic->GetType() != GraphicType::NONE ) ) aVclSize = mpGraphic->GetSizePixel(); return awt::Size( aVclSize.Width(), aVclSize.Height() ); @@ -187,7 +187,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL Graphic::getDIB( ) throw (uno::RuntimeExce { SolarMutexGuard aGuard; - if( mpGraphic && ( mpGraphic->GetType() != GRAPHIC_NONE ) ) + if( mpGraphic && ( mpGraphic->GetType() != GraphicType::NONE ) ) { SvMemoryStream aMem; @@ -205,7 +205,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL Graphic::getMaskDIB( ) throw (uno::Runtime { SolarMutexGuard aGuard; - if( mpGraphic && ( mpGraphic->GetType() != GRAPHIC_NONE ) ) + if( mpGraphic && ( mpGraphic->GetType() != GraphicType::NONE ) ) { SvMemoryStream aMem; diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx index 18e75d58916a..3a37dbb03983 100644 --- a/svtools/source/graphic/grfcache.cxx +++ b/svtools/source/graphic/grfcache.cxx @@ -69,7 +69,7 @@ GraphicID::GraphicID( const GraphicObject& rObj ) switch( rGraphic.GetType() ) { - case GRAPHIC_BITMAP: + case GraphicType::Bitmap: { if(rGraphic.getSvgData().get()) { @@ -102,7 +102,7 @@ GraphicID::GraphicID( const GraphicObject& rObj ) } break; - case GRAPHIC_GDIMETAFILE: + case GraphicType::GdiMetafile: { const GDIMetaFile& rMtf = rGraphic.GetGDIMetaFile(); @@ -227,7 +227,7 @@ bool GraphicCacheEntry::ImplInit( const GraphicObject& rObj ) switch( rGraphic.GetType() ) { - case GRAPHIC_BITMAP: + case GraphicType::Bitmap: { if(rGraphic.getSvgData().get()) { @@ -244,7 +244,7 @@ bool GraphicCacheEntry::ImplInit( const GraphicObject& rObj ) } break; - case GRAPHIC_GDIMETAFILE: + case GraphicType::GdiMetafile: { mpMtf = new GDIMetaFile( rGraphic.GetGDIMetaFile() ); } @@ -273,7 +273,7 @@ void GraphicCacheEntry::ImplFillSubstitute( Graphic& rSubstitute ) const MapMode aPrefMapMode( rSubstitute.GetPrefMapMode() ); const Link<Animation*,void> aAnimationNotifyHdl( rSubstitute.GetAnimationNotifyHdl() ); const GraphicType eOldType = rSubstitute.GetType(); - const bool bDefaultType = ( rSubstitute.GetType() == GRAPHIC_DEFAULT ); + const bool bDefaultType = ( rSubstitute.GetType() == GraphicType::Default ); if( rSubstitute.IsLink() && ( GFX_LINK_TYPE_NONE == maGfxLink.GetType() ) ) maGfxLink = rSubstitute.GetLink(); @@ -299,7 +299,7 @@ void GraphicCacheEntry::ImplFillSubstitute( Graphic& rSubstitute ) rSubstitute.Clear(); } - if( eOldType != GRAPHIC_NONE ) + if( eOldType != GraphicType::NONE ) { rSubstitute.SetPrefSize( aPrefSize ); rSubstitute.SetPrefMapMode( aPrefMapMode ); @@ -759,9 +759,9 @@ sal_uLong GraphicDisplayCacheEntry::GetNeededSize( OutputDevice* pOut, const Poi const GraphicType eType = rGraphic.GetType(); bool canCacheAsBitmap = false; - if( GRAPHIC_BITMAP == eType ) + if( GraphicType::Bitmap == eType ) canCacheAsBitmap = true; - else if( GRAPHIC_GDIMETAFILE == eType ) + else if( GraphicType::GdiMetafile == eType ) canCacheAsBitmap = IsCacheableAsBitmap( rGraphic.GetGDIMetaFile(), pOut, rSz ); else return 0; @@ -847,9 +847,9 @@ void GraphicCache::AddGraphicObject( if( !rObj.IsSwappedOut() && ( pID || ( pCopyObj - && ( pCopyObj->GetType() != GRAPHIC_NONE ) + && ( pCopyObj->GetType() != GraphicType::NONE ) ) - || ( rObj.GetType() != GRAPHIC_NONE ) + || ( rObj.GetType() != GraphicType::NONE ) ) ) { diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx index 064b77a15666..42b2799f1d5e 100644 --- a/svtools/source/graphic/grfmgr.cxx +++ b/svtools/source/graphic/grfmgr.cxx @@ -249,7 +249,7 @@ void GraphicObject::ImplAutoSwapIn() if( pIStm ) { ReadGraphic( *pIStm, maGraphic ); - mbAutoSwapped = ( maGraphic.GetType() != GRAPHIC_NONE ); + mbAutoSwapped = ( maGraphic.GetType() != GraphicType::NONE ); } } } @@ -266,7 +266,7 @@ void GraphicObject::ImplAutoSwapIn() } else { - DBG_ASSERT( ( GRAPHIC_NONE == meType ) || ( GRAPHIC_DEFAULT == meType ), + DBG_ASSERT( ( GraphicType::NONE == meType ) || ( GraphicType::Default == meType ), "GraphicObject::ImplAutoSwapIn: could not get stream to swap in graphic! (=>KA)" ); } } @@ -285,7 +285,7 @@ bool GraphicObject::ImplGetCropParams( OutputDevice* pOut, Point& rPt, Size& rSz { bool bRet = false; - if( GetType() != GRAPHIC_NONE ) + if( GetType() != GraphicType::NONE ) { tools::Polygon aClipPoly( Rectangle( rPt, rSz ) ); const sal_uInt16 nRot10 = pAttr->GetRotation() % 3600; @@ -728,7 +728,7 @@ Graphic GraphicObject::GetTransformedGraphic( const Size& rDestSize, const MapMo Size aCropLeftTop; Size aCropRightBottom; - if( GRAPHIC_GDIMETAFILE == eType ) + if( GraphicType::GdiMetafile == eType ) { GDIMetaFile aMtf( aTransGraphic.GetGDIMetaFile() ); @@ -797,7 +797,7 @@ Graphic GraphicObject::GetTransformedGraphic( const Size& rDestSize, const MapMo aTransGraphic = aMtf; } - else if( GRAPHIC_BITMAP == eType ) + else if( GraphicType::Bitmap == eType ) { BitmapEx aBitmapEx( aTransGraphic.GetBitmapEx() ); Rectangle aCropRect; @@ -953,7 +953,7 @@ Graphic GraphicObject::GetTransformedGraphic( const GraphicAttr* pAttr ) const / { if( aAttr.IsSpecialDrawMode() || aAttr.IsAdjusted() || aAttr.IsMirrored() || aAttr.IsRotated() || aAttr.IsTransparent() ) { - if( GetType() == GRAPHIC_BITMAP ) + if( GetType() == GraphicType::Bitmap ) { if( IsAnimated() ) { @@ -978,7 +978,7 @@ Graphic GraphicObject::GetTransformedGraphic( const GraphicAttr* pAttr ) const / } else { - if( ( GetType() == GRAPHIC_BITMAP ) && IsAnimated() ) + if( ( GetType() == GraphicType::Bitmap ) && IsAnimated() ) { Animation aAnimation( maGraphic.GetAnimation() ); aAnimation.SetLoopCount( mnAnimationLoopCount ); diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx index 1f934f786c69..457d71f056ff 100644 --- a/svtools/source/graphic/grfmgr2.cxx +++ b/svtools/source/graphic/grfmgr2.cxx @@ -92,7 +92,7 @@ bool GraphicManager::DrawObj( OutputDevice* pOut, const Point& rPt, const Size& rCached = false; - if( ( rObj.GetType() == GRAPHIC_BITMAP ) || ( rObj.GetType() == GRAPHIC_GDIMETAFILE ) ) + if( ( rObj.GetType() == GraphicType::Bitmap ) || ( rObj.GetType() == GraphicType::GdiMetafile ) ) { // create output and fill cache @@ -245,7 +245,7 @@ bool GraphicManager::ImplDraw( OutputDevice* pOut, const Point& rPt, if( rGraphic.IsSupportedGraphic() && !rObj.IsSwappedOut() ) { - if( GRAPHIC_BITMAP == rGraphic.GetType() ) + if( GraphicType::Bitmap == rGraphic.GetType() ) { const BitmapEx aSrcBmpEx( rGraphic.GetBitmapEx() ); @@ -1891,7 +1891,7 @@ bool GraphicObject::ImplDrawTiled( OutputDevice* pOut, const Rectangle& rArea, c // #i42643# Casting to Int64, to avoid integer overflow for // huge-DPI output devices - if( GetGraphic().GetType() == GRAPHIC_BITMAP && + if( GetGraphic().GetType() == GraphicType::Bitmap && static_cast<sal_Int64>(rSizePixel.Width()) * rSizePixel.Height() < static_cast<sal_Int64>(nTileCacheSize1D)*nTileCacheSize1D ) { @@ -1996,7 +1996,7 @@ bool GraphicObject::ImplDrawTiled( OutputDevice& rOut, const Point& rPosPixel, int nX, nY; // #107607# Use logical coordinates for metafile playing, too - bool bDrawInPixel( rOut.GetConnectMetaFile() == nullptr && GRAPHIC_BITMAP == GetType() ); + bool bDrawInPixel( rOut.GetConnectMetaFile() == nullptr && GraphicType::Bitmap == GetType() ); bool bRet = false; // #105229# Switch off mapping (converting to logic and back to diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx index 57ed103ed18f..321818fca2fe 100644 --- a/svtools/source/graphic/provider.cxx +++ b/svtools/source/graphic/provider.cxx @@ -478,7 +478,7 @@ uno::Reference< ::graphic::XGraphic > SAL_CALL GraphicProvider::queryGraphic( co if( ( rFilter.ImportGraphic( aVCLGraphic, aPath, *pIStm, GRFILTER_FORMAT_DONTKNOW, nullptr, GraphicFilterImportFlags::NONE, pExtHeader ) == GRFILTER_OK ) && - ( aVCLGraphic.GetType() != GRAPHIC_NONE ) ) + ( aVCLGraphic.GetType() != GraphicType::NONE ) ) { ::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic; @@ -602,7 +602,7 @@ void ImplApplyFilterData( ::Graphic& rGraphic, uno::Sequence< beans::PropertyVal else if (aName == "ImageResolution") aValue >>= nImageResolution; } - if ( rGraphic.GetType() == GRAPHIC_BITMAP ) + if ( rGraphic.GetType() == GraphicType::Bitmap ) { if(rGraphic.getSvgData().get()) { @@ -623,7 +623,7 @@ void ImplApplyFilterData( ::Graphic& rGraphic, uno::Sequence< beans::PropertyVal ImplApplyBitmapScaling( rGraphic, nPixelWidth, nPixelHeight ); } } - else if ( ( rGraphic.GetType() == GRAPHIC_GDIMETAFILE ) && nImageResolution ) + else if ( ( rGraphic.GetType() == GraphicType::GdiMetafile ) && nImageResolution ) { ScopedVclPtrInstance< VirtualDevice > aDummyVDev; GDIMetaFile aMtf( rGraphic.GetGDIMetaFile() ); @@ -812,7 +812,7 @@ void SAL_CALL GraphicProvider::storeGraphic( const uno::Reference< ::graphic::XG const uno::Reference< XInterface > xIFace( rxGraphic, uno::UNO_QUERY ); const ::Graphic* pGraphic = ::unographic::Graphic::getImplementation( xIFace ); - if( pGraphic && ( pGraphic->GetType() != GRAPHIC_NONE ) ) + if( pGraphic && ( pGraphic->GetType() != GraphicType::NONE ) ) { ::Graphic aGraphic( *pGraphic ); ImplApplyFilterData( aGraphic, aFilterDataSeq ); diff --git a/svtools/source/graphic/transformer.cxx b/svtools/source/graphic/transformer.cxx index fbfdfa30516e..0de58a36dd84 100644 --- a/svtools/source/graphic/transformer.cxx +++ b/svtools/source/graphic/transformer.cxx @@ -81,7 +81,7 @@ uno::Reference< graphic::XGraphic > SAL_CALL GraphicTransformer::colorChange( BitmapColor aColorTo( static_cast< sal_uInt8 >( nColorTo ), static_cast< sal_uInt8 >( nColorTo >> 8 ), static_cast< sal_uInt8 >( nColorTo >> 16 ) ); const sal_uInt8 cIndexFrom = aColorFrom.GetBlueOrIndex(); - if ( aGraphic.GetType() == GRAPHIC_BITMAP || aGraphic.GetType() == GRAPHIC_GDIMETAFILE ) + if ( aGraphic.GetType() == GraphicType::Bitmap || aGraphic.GetType() == GraphicType::GdiMetafile ) { BitmapEx aBitmapEx( aGraphic.GetBitmapEx() ); Bitmap aBitmap( aBitmapEx.GetBitmap() ); diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index f21d861d759f..18305d8acd97 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -709,7 +709,7 @@ bool TransferableHelper::SetGDIMetaFile( const GDIMetaFile& rMtf, const DataFlav bool TransferableHelper::SetGraphic( const Graphic& rGraphic, const DataFlavor& ) { - if( rGraphic.GetType() != GRAPHIC_NONE ) + if( rGraphic.GetType() != GraphicType::NONE ) { SvMemoryStream aMemStm( 65535, 65535 ); diff --git a/svtools/source/misc/transfer2.cxx b/svtools/source/misc/transfer2.cxx index 782b804784b8..5b7a3daa7899 100644 --- a/svtools/source/misc/transfer2.cxx +++ b/svtools/source/misc/transfer2.cxx @@ -462,7 +462,7 @@ void TransferDataContainer::CopyImageMap( const ImageMap& rImgMap ) void TransferDataContainer::CopyGraphic( const Graphic& rGrf ) { GraphicType nType = rGrf.GetType(); - if( GRAPHIC_NONE != nType ) + if( GraphicType::NONE != nType ) { if( !pImpl->pGrf ) pImpl->pGrf = new Graphic( rGrf ); @@ -471,12 +471,12 @@ void TransferDataContainer::CopyGraphic( const Graphic& rGrf ) AddFormat( SotClipboardFormatId::SVXB ); - if( GRAPHIC_BITMAP == nType ) + if( GraphicType::Bitmap == nType ) { AddFormat( SotClipboardFormatId::PNG ); AddFormat( SotClipboardFormatId::BITMAP ); } - else if( GRAPHIC_GDIMETAFILE == nType ) + else if( GraphicType::GdiMetafile == nType ) { AddFormat( SotClipboardFormatId::GDIMETAFILE ); } |