diff options
author | Noel Grandin <noel@peralex.com> | 2016-05-30 10:24:32 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-05-31 06:26:25 +0000 |
commit | fe6ac2d11a6f870094bd630759f998d8ed9272e3 (patch) | |
tree | 6012c260e7926a2cdd01e586f83add8af1ec327e /vcl | |
parent | 0b23eec200c8c12db5778405df44f4bf8e38e4ad (diff) |
Convert GfxLinkType to scoped enum
Change-Id: Iae074ef0927a55f1fbf401cb66f4f183213f547c
Reviewed-on: https://gerrit.libreoffice.org/25656
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/filter/GraphicNativeMetadata.cxx | 2 | ||||
-rw-r--r-- | vcl/source/filter/GraphicNativeTransform.cxx | 16 | ||||
-rw-r--r-- | vcl/source/filter/graphicfilter.cxx | 28 | ||||
-rw-r--r-- | vcl/source/gdi/gfxlink.cxx | 22 | ||||
-rw-r--r-- | vcl/source/gdi/pdfextoutdevdata.cxx | 8 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl2.cxx | 4 |
6 files changed, 40 insertions, 40 deletions
diff --git a/vcl/source/filter/GraphicNativeMetadata.cxx b/vcl/source/filter/GraphicNativeMetadata.cxx index 532e2d4284ab..2f9880c00282 100644 --- a/vcl/source/filter/GraphicNativeMetadata.cxx +++ b/vcl/source/filter/GraphicNativeMetadata.cxx @@ -35,7 +35,7 @@ GraphicNativeMetadata::~GraphicNativeMetadata() bool GraphicNativeMetadata::read(Graphic& rGraphic) { GfxLink aLink = rGraphic.GetLink(); - if ( aLink.GetType() != GFX_LINK_TYPE_NATIVE_JPG ) + if ( aLink.GetType() != GfxLinkType::NativeJpg ) return false; sal_uInt32 aDataSize = aLink.GetDataSize(); std::unique_ptr<sal_uInt8[]> aBuffer(new sal_uInt8[aDataSize]); diff --git a/vcl/source/filter/GraphicNativeTransform.cxx b/vcl/source/filter/GraphicNativeTransform.cxx index 11a17a5f091f..aa24bfb50113 100644 --- a/vcl/source/filter/GraphicNativeTransform.cxx +++ b/vcl/source/filter/GraphicNativeTransform.cxx @@ -44,10 +44,10 @@ bool GraphicNativeTransform::canBeRotated() return false; } - if ( aLink.GetType() == GFX_LINK_TYPE_NATIVE_JPG - || aLink.GetType() == GFX_LINK_TYPE_NATIVE_PNG - || aLink.GetType() == GFX_LINK_TYPE_NATIVE_GIF - || aLink.GetType() == GFX_LINK_TYPE_NONE) + if ( aLink.GetType() == GfxLinkType::NativeJpg + || aLink.GetType() == GfxLinkType::NativePng + || aLink.GetType() == GfxLinkType::NativeGif + || aLink.GetType() == GfxLinkType::NONE) { return true; } @@ -70,19 +70,19 @@ bool GraphicNativeTransform::rotate(sal_uInt16 aInputRotation) } GfxLink aLink = mrGraphic.GetLink(); - if ( aLink.GetType() == GFX_LINK_TYPE_NATIVE_JPG ) + if ( aLink.GetType() == GfxLinkType::NativeJpg ) { return rotateJPEG(aRotation); } - else if ( aLink.GetType() == GFX_LINK_TYPE_NATIVE_PNG ) + else if ( aLink.GetType() == GfxLinkType::NativePng ) { return rotateGeneric(aRotation, "png"); } - else if ( aLink.GetType() == GFX_LINK_TYPE_NATIVE_GIF ) + else if ( aLink.GetType() == GfxLinkType::NativeGif ) { return rotateGeneric(aRotation, "gif"); } - else if ( aLink.GetType() == GFX_LINK_TYPE_NONE ) + else if ( aLink.GetType() == GfxLinkType::NONE ) { return rotateBitmapOnly(aRotation); } diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index aff8f04c9855..a690faf222c7 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -1325,7 +1325,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat sal_uLong nStreamBegin; sal_uInt16 nStatus; GraphicReader* pContext = rGraphic.GetContext(); - GfxLinkType eLinkType = GFX_LINK_TYPE_NONE; + GfxLinkType eLinkType = GfxLinkType::NONE; bool bDummyContext = rGraphic.IsDummyContext(); const bool bLinkSet = rGraphic.IsLink(); FilterConfigItem* pFilterConfigItem = nullptr; @@ -1424,7 +1424,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat if( !ImportGIF( rIStream, rGraphic ) ) nStatus = GRFILTER_FILTERERROR; else - eLinkType = GFX_LINK_TYPE_NATIVE_GIF; + eLinkType = GfxLinkType::NativeGif; } else if( aFilterName.equalsIgnoreAsciiCase( IMP_PNG ) ) { @@ -1464,7 +1464,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat aIStrm.Read(pGraphicContent, nGraphicContentSize); aIStrm.Seek(aCurrentPosition); ImportGIF(aIStrm, rGraphic); - eLinkType = GFX_LINK_TYPE_NATIVE_GIF; + eLinkType = GfxLinkType::NativeGif; break; } } @@ -1472,7 +1472,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat } } - if ( eLinkType == GFX_LINK_TYPE_NONE ) + if ( eLinkType == GfxLinkType::NONE ) { BitmapEx aBmpEx( aPNGReader.Read( aPreviewSizeHint ) ); if ( aBmpEx.IsEmpty() ) @@ -1480,7 +1480,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat else { rGraphic = aBmpEx; - eLinkType = GFX_LINK_TYPE_NATIVE_PNG; + eLinkType = GfxLinkType::NativePng; } } } @@ -1497,7 +1497,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat if( !ImportJPEG( rIStream, rGraphic, nullptr, nImportFlags ) ) nStatus = GRFILTER_FILTERERROR; else - eLinkType = GFX_LINK_TYPE_NATIVE_JPG; + eLinkType = GfxLinkType::NativeJpg; } else if( aFilterName.equalsIgnoreAsciiCase( IMP_SVG ) ) { @@ -1562,7 +1562,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat if (bOkay) { - eLinkType = GFX_LINK_TYPE_NATIVE_SVG; + eLinkType = GfxLinkType::NativeSvg; } else { @@ -1597,7 +1597,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat else if (aFilterName.equalsIgnoreAsciiCase(IMP_BMP)) { // #i15508# added BMP type (checked, works) - eLinkType = GFX_LINK_TYPE_NATIVE_BMP; + eLinkType = GfxLinkType::NativeBmp; } } else if( aFilterName.equalsIgnoreAsciiCase( IMP_MOV ) ) @@ -1609,7 +1609,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat { rGraphic.SetDefaultType(); rIStream.Seek( STREAM_SEEK_TO_END ); - eLinkType = GFX_LINK_TYPE_NATIVE_MOV; + eLinkType = GfxLinkType::NativeMov; } } else if( aFilterName.equalsIgnoreAsciiCase( IMP_WMF ) || @@ -1621,7 +1621,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat else { rGraphic = aMtf; - eLinkType = GFX_LINK_TYPE_NATIVE_WMF; + eLinkType = GfxLinkType::NativeWmf; } } else if( aFilterName.equalsIgnoreAsciiCase( IMP_SVSGF ) @@ -1726,18 +1726,18 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat if( nFormat != GRFILTER_FORMAT_DONTKNOW ) { if( aShortName.startsWith( TIF_SHORTNAME ) ) - eLinkType = GFX_LINK_TYPE_NATIVE_TIF; + eLinkType = GfxLinkType::NativeTif; else if( aShortName.startsWith( MET_SHORTNAME ) ) - eLinkType = GFX_LINK_TYPE_NATIVE_MET; + eLinkType = GfxLinkType::NativeMet; else if( aShortName.startsWith( PCT_SHORTNAME ) ) - eLinkType = GFX_LINK_TYPE_NATIVE_PCT; + eLinkType = GfxLinkType::NativePct; } } } } } - if( nStatus == GRFILTER_OK && bCreateNativeLink && ( eLinkType != GFX_LINK_TYPE_NONE ) && !rGraphic.GetContext() && !bLinkSet ) + if( nStatus == GRFILTER_OK && bCreateNativeLink && ( eLinkType != GfxLinkType::NONE ) && !rGraphic.GetContext() && !bLinkSet ) { if (pGraphicContent == nullptr) { diff --git a/vcl/source/gdi/gfxlink.cxx b/vcl/source/gdi/gfxlink.cxx index 266c8a46681d..fed0321f3ed8 100644 --- a/vcl/source/gdi/gfxlink.cxx +++ b/vcl/source/gdi/gfxlink.cxx @@ -31,7 +31,7 @@ #include <memory> GfxLink::GfxLink() : - meType ( GFX_LINK_TYPE_NONE ), + meType ( GfxLinkType::NONE ), mpBuf ( nullptr ), mpSwap ( nullptr ), mnBufSize ( 0 ), @@ -169,18 +169,18 @@ bool GfxLink::LoadNative( Graphic& rGraphic ) switch( meType ) { - case GFX_LINK_TYPE_NATIVE_GIF: nCvtType = ConvertDataFormat::GIF; break; + case GfxLinkType::NativeGif: nCvtType = ConvertDataFormat::GIF; break; // #i15508# added BMP type for better exports (reload when swapped - checked, works) - case GFX_LINK_TYPE_NATIVE_BMP: nCvtType = ConvertDataFormat::BMP; break; + case GfxLinkType::NativeBmp: nCvtType = ConvertDataFormat::BMP; break; - case GFX_LINK_TYPE_NATIVE_JPG: nCvtType = ConvertDataFormat::JPG; break; - case GFX_LINK_TYPE_NATIVE_PNG: nCvtType = ConvertDataFormat::PNG; break; - case GFX_LINK_TYPE_NATIVE_TIF: nCvtType = ConvertDataFormat::TIF; break; - case GFX_LINK_TYPE_NATIVE_WMF: nCvtType = ConvertDataFormat::WMF; break; - case GFX_LINK_TYPE_NATIVE_MET: nCvtType = ConvertDataFormat::MET; break; - case GFX_LINK_TYPE_NATIVE_PCT: nCvtType = ConvertDataFormat::PCT; break; - case GFX_LINK_TYPE_NATIVE_SVG: nCvtType = ConvertDataFormat::SVG; break; + case GfxLinkType::NativeJpg: nCvtType = ConvertDataFormat::JPG; break; + case GfxLinkType::NativePng: nCvtType = ConvertDataFormat::PNG; break; + case GfxLinkType::NativeTif: nCvtType = ConvertDataFormat::TIF; break; + case GfxLinkType::NativeWmf: nCvtType = ConvertDataFormat::WMF; break; + case GfxLinkType::NativeMet: nCvtType = ConvertDataFormat::MET; break; + case GfxLinkType::NativePct: nCvtType = ConvertDataFormat::PCT; break; + case GfxLinkType::NativeSvg: nCvtType = ConvertDataFormat::SVG; break; default: nCvtType = ConvertDataFormat::Unknown; break; } @@ -245,7 +245,7 @@ SvStream& WriteGfxLink( SvStream& rOStream, const GfxLink& rGfxLink ) std::unique_ptr<VersionCompat> pCompat(new VersionCompat( rOStream, StreamMode::WRITE, 2 )); // Version 1 - rOStream.WriteUInt16( rGfxLink.GetType() ).WriteUInt32( rGfxLink.GetDataSize() ).WriteUInt32( rGfxLink.GetUserId() ); + rOStream.WriteUInt16( (sal_uInt16)rGfxLink.GetType() ).WriteUInt32( rGfxLink.GetDataSize() ).WriteUInt32( rGfxLink.GetUserId() ); // Version 2 WritePair( rOStream, rGfxLink.GetPrefSize() ); diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx index 03ed698222b0..ca25461b3693 100644 --- a/vcl/source/gdi/pdfextoutdevdata.cxx +++ b/vcl/source/gdi/pdfextoutdevdata.cxx @@ -412,7 +412,7 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAc if ( rGraphic.IsLink() ) { GfxLinkType eType = rGraphic.GetLink().GetType(); - if ( eType == GFX_LINK_TYPE_NATIVE_JPG && mParaRects.size() >= 2 ) + if ( eType == GfxLinkType::NativeJpg && mParaRects.size() >= 2 ) { mbGroupIgnoreGDIMtfActions = rOutDevData.HasAdequateCompression( @@ -420,7 +420,7 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAc if ( !mbGroupIgnoreGDIMtfActions ) mCurrentGraphic = rGraphic; } - else if ( eType == GFX_LINK_TYPE_NATIVE_PNG ) + else if ( eType == GfxLinkType::NativePng ) { mCurrentGraphic = rGraphic; } @@ -453,7 +453,7 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAc bool bClippingNeeded = ( aOutputRect != aVisibleOutputRect ) && !aVisibleOutputRect.IsEmpty(); GfxLink aGfxLink( aGraphic.GetLink() ); - if ( aGfxLink.GetType() == GFX_LINK_TYPE_NATIVE_JPG ) + if ( aGfxLink.GetType() == GfxLinkType::NativeJpg ) { if ( bClippingNeeded ) { @@ -796,7 +796,7 @@ bool PDFExtOutDevData::HasAdequateCompression( const Graphic &rGraphic, { bool bReduceResolution = false; - assert( rGraphic.IsLink() && rGraphic.GetLink().GetType() == GFX_LINK_TYPE_NATIVE_JPG ); + assert( rGraphic.IsLink() && rGraphic.GetLink().GetType() == GfxLinkType::NativeJpg ); // small items better off as PNG anyway if ( rGraphic.GetSizePixel().Width() < 32 && diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index 1a5d258db281..694c698b8b21 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -100,8 +100,8 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz if( i_Graphic.GetType() != GraphicType::NONE && i_Graphic.GetBitmapEx() == aBitmapEx ) { GfxLinkType eType = i_Graphic.GetLink().GetType(); - bIsJpeg = (eType == GFX_LINK_TYPE_NATIVE_JPG); - bIsPng = (eType == GFX_LINK_TYPE_NATIVE_PNG); + bIsJpeg = (eType == GfxLinkType::NativeJpg); + bIsPng = (eType == GfxLinkType::NativePng); } if( i_rContext.m_nMaxImageResolution > 50 ) |