[Libreoffice-commits] core.git: avmedia/source filter/source include/svx include/vcl oox/source sfx2/source svtools/source svx/source sw/source vcl/source

Noel Grandin noel at peralex.com
Thu May 21 02:02:24 PDT 2015


 avmedia/source/macavf/framegrabber.mm       |    2 
 avmedia/source/quicktime/framegrabber.mm    |    2 
 filter/source/graphicfilter/eps/eps.cxx     |    4 -
 filter/source/graphicfilter/ieps/ieps.cxx   |    8 +--
 filter/source/msfilter/escherex.cxx         |    4 -
 filter/source/svg/svgwriter.cxx             |    2 
 include/svx/galtheme.hxx                    |    2 
 include/vcl/cvtgrf.hxx                      |    4 -
 include/vcl/salctype.hxx                    |   35 +++++++++-------
 oox/source/export/drawingml.cxx             |    4 -
 sfx2/source/doc/graphhelp.cxx               |    6 +-
 sfx2/source/doc/graphhelp.hxx               |    5 +-
 sfx2/source/doc/sfxbasemodel.cxx            |    8 +--
 svtools/source/misc/transfer.cxx            |    2 
 svx/source/gallery2/galtheme.cxx            |   58 ++++++++++++++--------------
 svx/source/xoutdev/_xoutbmp.cxx             |   10 ++--
 sw/source/filter/ww8/rtfattributeoutput.cxx |   12 ++---
 sw/source/filter/ww8/rtfsdrexport.cxx       |    2 
 vcl/source/filter/graphicfilter.cxx         |   22 +++++-----
 vcl/source/gdi/cvtgrf.cxx                   |    4 -
 vcl/source/gdi/gfxlink.cxx                  |   26 ++++++------
 vcl/source/gdi/impgraph.cxx                 |   12 ++---
 vcl/source/gdi/pdfwriter_impl.cxx           |    2 
 23 files changed, 120 insertions(+), 116 deletions(-)

New commits:
commit 431598b97b47b13c8b241f587b5eea21bf134893
Author: Noel Grandin <noel at peralex.com>
Date:   Wed May 20 13:00:06 2015 +0200

    convert CVT constants to scoped enum
    
    Change-Id: I7703816b6a1df2bf24c06cdf9992f9982ae724e8
    Reviewed-on: https://gerrit.libreoffice.org/15826
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/avmedia/source/macavf/framegrabber.mm b/avmedia/source/macavf/framegrabber.mm
index 4662720..cfdbbae 100644
--- a/avmedia/source/macavf/framegrabber.mm
+++ b/avmedia/source/macavf/framegrabber.mm
@@ -101,7 +101,7 @@ uno::Reference< graphic::XGraphic > SAL_CALL FrameGrabber::grabFrame( double fMe
     // convert the image into the return-value type which is a graphic::XGraphic
     SvMemoryStream aMemStm( pBitmapBytes, nBitmapLen, StreamMode::READ | StreamMode::WRITE );
     Graphic aGraphic;
-    if( GraphicConverter::Import( aMemStm, aGraphic, CVT_TIF ) == ERRCODE_NONE )
+    if( GraphicConverter::Import( aMemStm, aGraphic, ConvertDataFormat::TIF ) == ERRCODE_NONE )
         xRet = aGraphic.GetXGraphic();
 
     // clean up resources
diff --git a/avmedia/source/quicktime/framegrabber.mm b/avmedia/source/quicktime/framegrabber.mm
index a13d98a..401c17d 100644
--- a/avmedia/source/quicktime/framegrabber.mm
+++ b/avmedia/source/quicktime/framegrabber.mm
@@ -99,7 +99,7 @@ uno::Reference< graphic::XGraphic > SAL_CALL FrameGrabber::grabFrame( double fMe
     const void* pBitmapData = [pBitmap bytes];
     SvMemoryStream  aMemStm( const_cast<void *>(pBitmapData), nSize, StreamMode::READ | StreamMode::WRITE );
     Graphic aGraphic;
-    if ( GraphicConverter::Import( aMemStm, aGraphic, CVT_TIF ) == ERRCODE_NONE )
+    if ( GraphicConverter::Import( aMemStm, aGraphic, ConvertDataFormat::TIF ) == ERRCODE_NONE )
     {
         xRet = aGraphic.GetXGraphic();
     }
diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx
index 177fa35..1cc70b9 100644
--- a/filter/source/graphicfilter/eps/eps.cxx
+++ b/filter/source/graphicfilter/eps/eps.cxx
@@ -386,10 +386,10 @@ bool PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, Filter
         {
             BitmapEx aTempBitmapEx( rGraphic.GetBitmapEx() );
             aTempBitmapEx.Convert( BMP_CONVERSION_8BIT_GREYS );
-            nErrCode = GraphicConverter::Export( rTargetStream, aTempBitmapEx, CVT_TIF ) ;
+            nErrCode = GraphicConverter::Export( rTargetStream, aTempBitmapEx, ConvertDataFormat::TIF ) ;
         }
         else
-            nErrCode = GraphicConverter::Export( rTargetStream, rGraphic, CVT_TIF ) ;
+            nErrCode = GraphicConverter::Export( rTargetStream, rGraphic, ConvertDataFormat::TIF ) ;
 
         if ( nErrCode == ERRCODE_NONE )
         {
diff --git a/filter/source/graphicfilter/ieps/ieps.cxx b/filter/source/graphicfilter/ieps/ieps.cxx
index 730dd80..0cf8b59 100644
--- a/filter/source/graphicfilter/ieps/ieps.cxx
+++ b/filter/source/graphicfilter/ieps/ieps.cxx
@@ -257,7 +257,7 @@ static bool RenderAsEMF(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, Graphic &r
     if (nCount == nBytesRead && bEMFSupported)
     {
         SvFileStream aFile(output, StreamMode::READ);
-        if (GraphicConverter::Import(aFile, rGraphic, CVT_EMF) == ERRCODE_NONE)
+        if (GraphicConverter::Import(aFile, rGraphic, ConvertDataFormat::EMF) == ERRCODE_NONE)
             bRet = true;
     }
 
@@ -324,7 +324,7 @@ static bool RenderAsBMPThroughHelper(const sal_uInt8* pBuf, sal_uInt32 nBytesRea
         aMemStm.Seek(0);
         if (
             aMemStm.GetEndOfData() &&
-            GraphicConverter::Import(aMemStm, rGraphic, CVT_BMP) == ERRCODE_NONE
+            GraphicConverter::Import(aMemStm, rGraphic, ConvertDataFormat::BMP) == ERRCODE_NONE
            )
         {
             MakeAsMeta(rGraphic);
@@ -557,7 +557,7 @@ GraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* )
             if ( nPosWMF != 0 )
             {
                 rStream.Seek( nOrigPos + nPosWMF );
-                if ( GraphicConverter::Import( rStream, aGraphic, CVT_WMF ) == ERRCODE_NONE )
+                if ( GraphicConverter::Import( rStream, aGraphic, ConvertDataFormat::WMF ) == ERRCODE_NONE )
                     bHasPreview = bRetValue = true;
             }
         }
@@ -570,7 +570,7 @@ GraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* )
             if ( nPosTIFF && nSizeTIFF )
             {
                 rStream.Seek( nOrigPos + nPosTIFF );
-                if ( GraphicConverter::Import( rStream, aGraphic, CVT_TIF ) == ERRCODE_NONE )
+                if ( GraphicConverter::Import( rStream, aGraphic, ConvertDataFormat::TIF ) == ERRCODE_NONE )
                 {
                     MakeAsMeta(aGraphic);
                     rStream.Seek( nOrigPos + nPosTIFF );
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index 3bc125f..d6bed05 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -1463,7 +1463,7 @@ bool EscherPropertyContainer::CreateGraphicProperties(
             {
                 Graphic         aGraphic;
                 SvMemoryStream  aTemp( (void*)pAry, nAryLen, StreamMode::READ );
-                sal_uInt32 nErrCode = GraphicConverter::Import( aTemp, aGraphic, CVT_WMF );
+                sal_uInt32 nErrCode = GraphicConverter::Import( aTemp, aGraphic, ConvertDataFormat::WMF );
                 if ( nErrCode == ERRCODE_NONE )
                 {
                     aGraphicObject = aGraphic;
@@ -4412,7 +4412,7 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const OStrin
             {
                 sal_uInt32 nErrCode;
                 if ( !aGraphic.IsAnimated() )
-                    nErrCode = GraphicConverter::Export( aStream, aGraphic, ( eGraphicType == GRAPHIC_BITMAP ) ? CVT_PNG  : CVT_EMF );
+                    nErrCode = GraphicConverter::Export( aStream, aGraphic, ( eGraphicType == GRAPHIC_BITMAP ) ? ConvertDataFormat::PNG  : ConvertDataFormat::EMF );
                 else
                 {   // to store a animation, a gif has to be included into the msOG chunk of a png  #I5583#
                     GraphicFilter &rFilter = GraphicFilter::GetGraphicFilter();
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 16f3fc9..c575deb 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -2606,7 +2606,7 @@ void SVGActionWriter::ImplWriteBmp( const BitmapEx& rBmpEx,
         {
             SvMemoryStream aOStm( 65535, 65535 );
 
-            if( GraphicConverter::Export( aOStm, rBmpEx, CVT_PNG ) == ERRCODE_NONE )
+            if( GraphicConverter::Export( aOStm, rBmpEx, ConvertDataFormat::PNG ) == ERRCODE_NONE )
             {
                 Point                    aPt;
                 Size                     aSz;
diff --git a/include/svx/galtheme.hxx b/include/svx/galtheme.hxx
index f542593..4a00c8c 100644
--- a/include/svx/galtheme.hxx
+++ b/include/svx/galtheme.hxx
@@ -121,7 +121,7 @@ private:
                                     return size_t(-1);
                                 }
     SAL_DLLPRIVATE INetURLObject ImplGetURL( const GalleryObject* pObject ) const;
-    SAL_DLLPRIVATE INetURLObject ImplCreateUniqueURL( SgaObjKind eObjKind, sal_uIntPtr nFormat = CVT_UNKNOWN );
+    SAL_DLLPRIVATE INetURLObject ImplCreateUniqueURL( SgaObjKind eObjKind, ConvertDataFormat nFormat = ConvertDataFormat::Unknown );
     SAL_DLLPRIVATE void         ImplSetModified( bool bModified );
     SAL_DLLPRIVATE void         ImplBroadcast( sal_uIntPtr nUpdatePos );
 
diff --git a/include/vcl/cvtgrf.hxx b/include/vcl/cvtgrf.hxx
index a714b22..e311c39 100644
--- a/include/vcl/cvtgrf.hxx
+++ b/include/vcl/cvtgrf.hxx
@@ -43,8 +43,8 @@ public:
                         GraphicConverter();
                         ~GraphicConverter();
 
-    static sal_uLong        Import( SvStream& rIStm, Graphic& rGraphic, sal_uLong nFormat = CVT_UNKNOWN );
-    static sal_uLong        Export( SvStream& rOStm, const Graphic& rGraphic, sal_uLong nFormat );
+    static sal_uLong        Import( SvStream& rIStm, Graphic& rGraphic, ConvertDataFormat nFormat = ConvertDataFormat::Unknown );
+    static sal_uLong        Export( SvStream& rOStm, const Graphic& rGraphic, ConvertDataFormat nFormat );
 
     ConvertData*        GetConvertData() { return mpConvertData; }
 
diff --git a/include/vcl/salctype.hxx b/include/vcl/salctype.hxx
index 801815d..4fdc6a8 100644
--- a/include/vcl/salctype.hxx
+++ b/include/vcl/salctype.hxx
@@ -24,18 +24,21 @@
 
 #include <vcl/graph.hxx>
 
-#define CVT_UNKNOWN (0x00000000UL)
-#define CVT_BMP     (0x00000001UL)
-#define CVT_GIF     (0x00000002UL)
-#define CVT_JPG     (0x00000003UL)
-#define CVT_MET     (0x00000004UL)
-#define CVT_PCT     (0x00000005UL)
-#define CVT_PNG     (0x00000006UL)
-#define CVT_SVM     (0x00000007UL)
-#define CVT_TIF     (0x00000008UL)
-#define CVT_WMF     (0x00000009UL)
-#define CVT_EMF     (0x0000000aUL)
-#define CVT_SVG     (0x0000000bUL)
+enum class ConvertDataFormat
+{
+    Unknown,
+    BMP,
+    GIF,
+    JPG,
+    MET,
+    PCT,
+    PNG,
+    SVM,
+    TIF,
+    WMF,
+    EMF,
+    SVG
+};
 
 class SvStream;
 
@@ -49,16 +52,16 @@ public:
 
     Graphic             maGraphic;
     SvStream&           mrStm;
-    sal_uLong               mnFormat;
+    ConvertDataFormat   mnFormat;
 
-                        ConvertData( const Graphic& rGraphic, SvStream& rStm, sal_uLong nFormat ) :
+                        ConvertData( const Graphic& rGraphic, SvStream& rStm, ConvertDataFormat nFormat ) :
                             maGraphic( rGraphic ), mrStm( rStm ), mnFormat( nFormat ) {}
                         ~ConvertData() {}
 };
 
 typedef sal_uLong (*SALGRFCVTPROC)( void* pInst,
-                                sal_uLong nInFormat, void* pInBuffer, sal_uLong nInBufSize,
-                                sal_uLong nOutFormat, void** ppOutBuffer );
+                                ConvertDataFormat nInFormat, void* pInBuffer, sal_uLong nInBufSize,
+                                ConvertDataFormat nOutFormat, void** ppOutBuffer );
 
 #endif // INCLUDED_VCL_SALCTYPE_HXX
 
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 832914f..d202f12 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -871,13 +871,13 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia )
             {
                 if ( aType == GRAPHIC_BITMAP )
                 {
-                    (void)GraphicConverter::Export( aStream, rGraphic, CVT_PNG );
+                    (void)GraphicConverter::Export( aStream, rGraphic, ConvertDataFormat::PNG );
                     sMediaType = "image/png";
                     pExtension = ".png";
                 }
                 else
                 {
-                    (void)GraphicConverter::Export( aStream, rGraphic, CVT_EMF );
+                    (void)GraphicConverter::Export( aStream, rGraphic, ConvertDataFormat::EMF );
                     sMediaType = "image/x-emf";
                     pExtension = ".emf";
                 }
diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx
index 68fa2f9..ca19d1b 100644
--- a/sfx2/source/doc/graphhelp.cxx
+++ b/sfx2/source/doc/graphhelp.cxx
@@ -55,7 +55,7 @@
 
 using namespace css;
 
-SvMemoryStream* GraphicHelper::getFormatStrFromGDI_Impl( const GDIMetaFile* pGDIMeta, sal_uInt32 nFormat )
+SvMemoryStream* GraphicHelper::getFormatStrFromGDI_Impl( const GDIMetaFile* pGDIMeta, ConvertDataFormat nFormat )
 {
     SvMemoryStream* pResult = NULL;
     if ( pGDIMeta )
@@ -92,7 +92,7 @@ void* GraphicHelper::getEnhMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta )
         if ( pStream )
         {
             Graphic aGraph( *pGDIMeta );
-            sal_Bool bFailed = (sal_Bool)GraphicConverter::Export( *pStream, aGraph, CVT_EMF );
+            sal_Bool bFailed = (sal_Bool)GraphicConverter::Export( *pStream, aGraph, ConvertDataFormat::EMF );
             pStream->Flush();
             delete pStream;
 
@@ -118,7 +118,7 @@ void* GraphicHelper::getWinMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta, co
     {
         SvMemoryStream* pStream = new SvMemoryStream( 65535, 65535 );
         Graphic aGraph( *pGDIMeta );
-        sal_Bool bFailed = (sal_Bool)GraphicConverter::Export( *pStream, aGraph, CVT_WMF );
+        sal_Bool bFailed = (sal_Bool)GraphicConverter::Export( *pStream, aGraph, ConvertDataFormat::WMF );
         pStream->Flush();
         if ( !bFailed )
         {
diff --git a/sfx2/source/doc/graphhelp.hxx b/sfx2/source/doc/graphhelp.hxx
index 30201ed..8893bfc 100644
--- a/sfx2/source/doc/graphhelp.hxx
+++ b/sfx2/source/doc/graphhelp.hxx
@@ -22,17 +22,18 @@
 
 #include <com/sun/star/uno/Reference.hxx>
 #include <com/sun/star/io/XStream.hpp>
-
 #include <rtl/ustring.hxx>
+
 class SvMemoryStream;
 class GDIMetaFile;
 class BitmapEx;
+enum class ConvertDataFormat;
 
 class GraphicHelper
 {
 public:
 
-    static SvMemoryStream* getFormatStrFromGDI_Impl( const GDIMetaFile* pGDIMeta, sal_uInt32 nFormat );
+    static SvMemoryStream* getFormatStrFromGDI_Impl( const GDIMetaFile* pGDIMeta, ConvertDataFormat nFormat );
 
     static void* getEnhMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta );
 
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 20f15ee..d23b10c 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -2057,7 +2057,7 @@ Any SAL_CALL SfxBaseModel::getTransferData( const datatransfer::DataFlavor& aFla
                 {
                     std::shared_ptr<SvMemoryStream> xStream(
                         GraphicHelper::getFormatStrFromGDI_Impl(
-                            xMetaFile.get(), CVT_EMF ) );
+                            xMetaFile.get(), ConvertDataFormat::EMF ) );
                     if (xStream)
                     {
                         xStream->SetVersion( SOFFICE_FILEFORMAT_CURRENT );
@@ -2092,7 +2092,7 @@ Any SAL_CALL SfxBaseModel::getTransferData( const datatransfer::DataFlavor& aFla
                 {
                     std::shared_ptr<SvMemoryStream> xStream(
                         GraphicHelper::getFormatStrFromGDI_Impl(
-                            xMetaFile.get(), CVT_WMF ) );
+                            xMetaFile.get(), ConvertDataFormat::WMF ) );
 
                     if (xStream)
                     {
@@ -2132,7 +2132,7 @@ Any SAL_CALL SfxBaseModel::getTransferData( const datatransfer::DataFlavor& aFla
                 {
                     std::shared_ptr<SvMemoryStream> xStream(
                         GraphicHelper::getFormatStrFromGDI_Impl(
-                            xMetaFile.get(), CVT_BMP ) );
+                            xMetaFile.get(), ConvertDataFormat::BMP ) );
 
                     if (xStream)
                     {
@@ -2156,7 +2156,7 @@ Any SAL_CALL SfxBaseModel::getTransferData( const datatransfer::DataFlavor& aFla
                 {
                     std::shared_ptr<SvMemoryStream> xStream(
                         GraphicHelper::getFormatStrFromGDI_Impl(
-                            xMetaFile.get(), CVT_PNG ) );
+                            xMetaFile.get(), ConvertDataFormat::PNG ) );
 
                     if (xStream)
                     {
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
index 40d2a04..acdc429 100644
--- a/svtools/source/misc/transfer.cxx
+++ b/svtools/source/misc/transfer.cxx
@@ -359,7 +359,7 @@ Any SAL_CALL TransferableHelper::getTransferData2( const DataFlavor& rFlavor, co
                         Graphic         aGraphic( aMtf );
                         SvMemoryStream  aDstStm( 65535, 65535 );
 
-                        if( GraphicConverter::Export( aDstStm, aGraphic, CVT_EMF ) == ERRCODE_NONE )
+                        if( GraphicConverter::Export( aDstStm, aGraphic, ConvertDataFormat::EMF ) == ERRCODE_NONE )
                         {
                             maAny <<= ( aSeq = Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aDstStm.GetData() ),
                                                                      aDstStm.Seek( STREAM_SEEK_TO_END ) ) );
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index 047b4cc..d4d44db 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -240,7 +240,7 @@ INetURLObject GalleryTheme::ImplGetURL( const GalleryObject* pObject ) const
     return aURL;
 }
 
-INetURLObject GalleryTheme::ImplCreateUniqueURL( SgaObjKind eObjKind, sal_uIntPtr nFormat )
+INetURLObject GalleryTheme::ImplCreateUniqueURL( SgaObjKind eObjKind, ConvertDataFormat nFormat )
 {
     INetURLObject   aDir( GetParent()->GetUserURL() );
     INetURLObject   aInfoFileURL( GetParent()->GetUserURL() );
@@ -266,20 +266,20 @@ INetURLObject GalleryTheme::ImplCreateUniqueURL( SgaObjKind eObjKind, sal_uIntPt
     }
 
     // create extension
-    if( nFormat )
+    if( nFormat != ConvertDataFormat::Unknown )
     {
         switch( nFormat )
         {
-            case( CVT_BMP ): pExt = ".bmp"; break;
-            case( CVT_GIF ): pExt = ".gif"; break;
-            case( CVT_JPG ): pExt = ".jpg"; break;
-            case( CVT_MET ): pExt = ".met"; break;
-            case( CVT_PCT ): pExt = ".pct"; break;
-            case( CVT_PNG ): pExt = ".png"; break;
-            case( CVT_SVM ): pExt = ".svm"; break;
-            case( CVT_TIF ): pExt = ".tif"; break;
-            case( CVT_WMF ): pExt = ".wmf"; break;
-            case( CVT_EMF ): pExt = ".emf"; break;
+            case( ConvertDataFormat::BMP ): pExt = ".bmp"; break;
+            case( ConvertDataFormat::GIF ): pExt = ".gif"; break;
+            case( ConvertDataFormat::JPG ): pExt = ".jpg"; break;
+            case( ConvertDataFormat::MET ): pExt = ".met"; break;
+            case( ConvertDataFormat::PCT ): pExt = ".pct"; break;
+            case( ConvertDataFormat::PNG ): pExt = ".png"; break;
+            case( ConvertDataFormat::SVM ): pExt = ".svm"; break;
+            case( ConvertDataFormat::TIF ): pExt = ".tif"; break;
+            case( ConvertDataFormat::WMF ): pExt = ".wmf"; break;
+            case( ConvertDataFormat::EMF ): pExt = ".emf"; break;
 
             default:
                 pExt = ".grf";
@@ -853,27 +853,27 @@ bool GalleryTheme::InsertGraphic( const Graphic& rGraphic, sal_uIntPtr nInsertPo
 
     if( rGraphic.GetType() != GRAPHIC_NONE )
     {
-        sal_uIntPtr           nExportFormat = CVT_UNKNOWN;
-        const GfxLink   aGfxLink( ( (Graphic&) rGraphic ).GetLink() );
+        ConvertDataFormat nExportFormat = ConvertDataFormat::Unknown;
+        const GfxLink     aGfxLink( ( (Graphic&) rGraphic ).GetLink() );
 
         if( aGfxLink.GetDataSize() )
         {
             switch( aGfxLink.GetType() )
             {
-                case( GFX_LINK_TYPE_EPS_BUFFER ): nExportFormat = CVT_SVM; break;
-                case( GFX_LINK_TYPE_NATIVE_GIF ): nExportFormat = CVT_GIF; break;
+                case( GFX_LINK_TYPE_EPS_BUFFER ): nExportFormat = ConvertDataFormat::SVM; break;
+                case( GFX_LINK_TYPE_NATIVE_GIF ): nExportFormat = ConvertDataFormat::GIF; break;
 
                 // #i15508# added BMP type
                 // could not find/trigger a call to this, but should do no harm
-                case( GFX_LINK_TYPE_NATIVE_BMP ): nExportFormat = CVT_BMP; break;
-
-                case( GFX_LINK_TYPE_NATIVE_JPG ): nExportFormat = CVT_JPG; break;
-                case( GFX_LINK_TYPE_NATIVE_PNG ): nExportFormat = CVT_PNG; break;
-                case( GFX_LINK_TYPE_NATIVE_TIF ): nExportFormat = CVT_TIF; break;
-                case( GFX_LINK_TYPE_NATIVE_WMF ): nExportFormat = CVT_WMF; break;
-                case( GFX_LINK_TYPE_NATIVE_MET ): nExportFormat = CVT_MET; break;
-                case( GFX_LINK_TYPE_NATIVE_PCT ): nExportFormat = CVT_PCT; break;
-                case( GFX_LINK_TYPE_NATIVE_SVG ): nExportFormat = CVT_SVG; break;
+                case( GFX_LINK_TYPE_NATIVE_BMP ): nExportFormat = ConvertDataFormat::BMP; break;
+
+                case( GFX_LINK_TYPE_NATIVE_JPG ): nExportFormat = ConvertDataFormat::JPG; break;
+                case( GFX_LINK_TYPE_NATIVE_PNG ): nExportFormat = ConvertDataFormat::PNG; break;
+                case( GFX_LINK_TYPE_NATIVE_TIF ): nExportFormat = ConvertDataFormat::TIF; break;
+                case( GFX_LINK_TYPE_NATIVE_WMF ): nExportFormat = ConvertDataFormat::WMF; break;
+                case( GFX_LINK_TYPE_NATIVE_MET ): nExportFormat = ConvertDataFormat::MET; break;
+                case( GFX_LINK_TYPE_NATIVE_PCT ): nExportFormat = ConvertDataFormat::PCT; break;
+                case( GFX_LINK_TYPE_NATIVE_SVG ): nExportFormat = ConvertDataFormat::SVG; break;
                 default:
                     break;
             }
@@ -883,12 +883,12 @@ bool GalleryTheme::InsertGraphic( const Graphic& rGraphic, sal_uIntPtr nInsertPo
             if( rGraphic.GetType() == GRAPHIC_BITMAP )
             {
                 if( rGraphic.IsAnimated() )
-                    nExportFormat = CVT_GIF;
+                    nExportFormat = ConvertDataFormat::GIF;
                 else
-                    nExportFormat = CVT_PNG;
+                    nExportFormat = ConvertDataFormat::PNG;
             }
             else
-                nExportFormat = CVT_SVM;
+                nExportFormat = ConvertDataFormat::SVM;
         }
 
         const INetURLObject aURL( ImplCreateUniqueURL( SGA_OBJ_BMP, nExportFormat ) );
@@ -898,7 +898,7 @@ bool GalleryTheme::InsertGraphic( const Graphic& rGraphic, sal_uIntPtr nInsertPo
         {
             pOStm->SetVersion( SOFFICE_FILEFORMAT_50 );
 
-            if( CVT_SVM == nExportFormat )
+            if( ConvertDataFormat::SVM == nExportFormat )
             {
                 GDIMetaFile aMtf( rGraphic.GetGDIMetaFile() );
 
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index 758e324..e7c1a37 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -332,24 +332,24 @@ sal_uLong XOutBitmap::GraphicToBase64(const Graphic& rGraphic, OUString& rOUStri
     SvMemoryStream aOStm;
     OUString aMimeType;
     GfxLink aLink = rGraphic.GetLink();
-    sal_uLong aCvtType;
+    ConvertDataFormat aCvtType;
     switch(  aLink.GetType() )
     {
         case( GFX_LINK_TYPE_NATIVE_JPG ):
-            aCvtType = CVT_JPG;
+            aCvtType = ConvertDataFormat::JPG;
             aMimeType = "image/jpeg";
             break;
         case( GFX_LINK_TYPE_NATIVE_PNG ):
-            aCvtType = CVT_PNG;
+            aCvtType = ConvertDataFormat::PNG;
             aMimeType = "image/png";
             break;
         case( GFX_LINK_TYPE_NATIVE_SVG ):
-            aCvtType = CVT_SVG;
+            aCvtType = ConvertDataFormat::SVG;
             aMimeType = "image/svg+xml";
             break;
         default:
             // save everything else (including gif) into png
-            aCvtType = CVT_PNG;
+            aCvtType = ConvertDataFormat::PNG;
             aMimeType = "image/png";
             break;
     }
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index df86d9a..3080d01 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -3627,7 +3627,7 @@ void RtfAttributeOutput::FlyFrameOLEReplacement(const SwFlyFrameFormat* pFlyFram
     const sal_Char* pBLIPType = OOO_STRING_SVTOOLS_RTF_PNGBLIP;
     const sal_uInt8* pGraphicAry = 0;
     SvMemoryStream aStream;
-    if (GraphicConverter::Export(aStream, *pGraphic, CVT_PNG) != ERRCODE_NONE)
+    if (GraphicConverter::Export(aStream, *pGraphic, ConvertDataFormat::PNG) != ERRCODE_NONE)
         SAL_WARN("sw.rtf", "failed to export the graphic");
     aStream.Seek(STREAM_SEEK_TO_END);
     sal_uInt32 nSize = aStream.Tell();
@@ -3637,7 +3637,7 @@ void RtfAttributeOutput::FlyFrameOLEReplacement(const SwFlyFrameFormat* pFlyFram
     m_aRunText->append("{" OOO_STRING_SVTOOLS_RTF_NONSHPPICT);
     pBLIPType = OOO_STRING_SVTOOLS_RTF_WMETAFILE;
     SvMemoryStream aWmfStream;
-    if (GraphicConverter::Export(aWmfStream, *pGraphic, CVT_WMF) != ERRCODE_NONE)
+    if (GraphicConverter::Export(aWmfStream, *pGraphic, ConvertDataFormat::WMF) != ERRCODE_NONE)
         SAL_WARN("sw.rtf", "failed to export the graphic");
     aWmfStream.Seek(STREAM_SEEK_TO_END);
     nSize = aWmfStream.Tell();
@@ -3739,7 +3739,7 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat
     if (!pGraphicAry)
     {
         if (ERRCODE_NONE == GraphicConverter::Export(aStream, rGraphic,
-                (eGraphicType == GRAPHIC_BITMAP) ? CVT_PNG : CVT_WMF))
+                (eGraphicType == GRAPHIC_BITMAP) ? ConvertDataFormat::PNG : ConvertDataFormat::WMF))
         {
             pBLIPType = (eGraphicType == GRAPHIC_BITMAP) ?
                         OOO_STRING_SVTOOLS_RTF_PNGBLIP : OOO_STRING_SVTOOLS_RTF_WMETAFILE;
@@ -3838,7 +3838,7 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat
     else
     {
         aStream.Seek(0);
-        if (GraphicConverter::Export(aStream, rGraphic, CVT_WMF) != ERRCODE_NONE)
+        if (GraphicConverter::Export(aStream, rGraphic, ConvertDataFormat::WMF) != ERRCODE_NONE)
             SAL_WARN("sw.rtf", "failed to export the graphic");
         pBLIPType = OOO_STRING_SVTOOLS_RTF_WMETAFILE;
         aStream.Seek(STREAM_SEEK_TO_END);
@@ -3855,7 +3855,7 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat
             m_rExport.Strm().WriteCharPtr("}" "{" OOO_STRING_SVTOOLS_RTF_NONSHPPICT);
 
             aStream.Seek(0);
-            if (GraphicConverter::Export(aStream, rGraphic, CVT_WMF) != ERRCODE_NONE)
+            if (GraphicConverter::Export(aStream, rGraphic, ConvertDataFormat::WMF) != ERRCODE_NONE)
                 SAL_WARN("sw.rtf", "failed to export the graphic");
             pBLIPType = OOO_STRING_SVTOOLS_RTF_WMETAFILE;
             aStream.Seek(STREAM_SEEK_TO_END);
@@ -3886,7 +3886,7 @@ void RtfAttributeOutput::BulletDefinition(int /*nId*/, const Graphic& rGraphic,
     m_rExport.Strm().WriteCharPtr(SAL_NEWLINE_STRING);
     const sal_uInt8* pGraphicAry = 0;
     SvMemoryStream aStream;
-    if (GraphicConverter::Export(aStream, rGraphic, CVT_PNG) != ERRCODE_NONE)
+    if (GraphicConverter::Export(aStream, rGraphic, ConvertDataFormat::PNG) != ERRCODE_NONE)
         SAL_WARN("sw.rtf", "failed to export the numbering picture bullet");
     aStream.Seek(STREAM_SEEK_TO_END);
     sal_uInt32 nSize = aStream.Tell();
diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx
index da441f5..d6df7f7 100644
--- a/sw/source/filter/ww8/rtfsdrexport.cxx
+++ b/sw/source/filter/ww8/rtfsdrexport.cxx
@@ -454,7 +454,7 @@ void RtfSdrExport::impl_writeGraphic()
 
     // Export it to a stream.
     SvMemoryStream aStream;
-    GraphicConverter::Export(aStream, aGraphic, CVT_PNG);
+    GraphicConverter::Export(aStream, aGraphic, ConvertDataFormat::PNG);
     aStream.Seek(STREAM_SEEK_TO_END);
     sal_uInt32 nSize = aStream.Tell();
     const sal_uInt8* pGraphicAry = static_cast<sal_uInt8 const*>(aStream.GetData());
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index efa848b..a77e973 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -2187,17 +2187,17 @@ IMPL_LINK( GraphicFilter, FilterCallback, ConvertData*, pData )
         OString aShortName;
         switch( pData->mnFormat )
         {
-            case( CVT_BMP ): aShortName = BMP_SHORTNAME; break;
-            case( CVT_GIF ): aShortName = GIF_SHORTNAME; break;
-            case( CVT_JPG ): aShortName = JPG_SHORTNAME; break;
-            case( CVT_MET ): aShortName = MET_SHORTNAME; break;
-            case( CVT_PCT ): aShortName = PCT_SHORTNAME; break;
-            case( CVT_PNG ): aShortName = PNG_SHORTNAME; break;
-            case( CVT_SVM ): aShortName = SVM_SHORTNAME; break;
-            case( CVT_TIF ): aShortName = TIF_SHORTNAME; break;
-            case( CVT_WMF ): aShortName = WMF_SHORTNAME; break;
-            case( CVT_EMF ): aShortName = EMF_SHORTNAME; break;
-            case( CVT_SVG ): aShortName = SVG_SHORTNAME; break;
+            case( ConvertDataFormat::BMP ): aShortName = BMP_SHORTNAME; break;
+            case( ConvertDataFormat::GIF ): aShortName = GIF_SHORTNAME; break;
+            case( ConvertDataFormat::JPG ): aShortName = JPG_SHORTNAME; break;
+            case( ConvertDataFormat::MET ): aShortName = MET_SHORTNAME; break;
+            case( ConvertDataFormat::PCT ): aShortName = PCT_SHORTNAME; break;
+            case( ConvertDataFormat::PNG ): aShortName = PNG_SHORTNAME; break;
+            case( ConvertDataFormat::SVM ): aShortName = SVM_SHORTNAME; break;
+            case( ConvertDataFormat::TIF ): aShortName = TIF_SHORTNAME; break;
+            case( ConvertDataFormat::WMF ): aShortName = WMF_SHORTNAME; break;
+            case( ConvertDataFormat::EMF ): aShortName = EMF_SHORTNAME; break;
+            case( ConvertDataFormat::SVG ): aShortName = SVG_SHORTNAME; break;
 
             default:
             break;
diff --git a/vcl/source/gdi/cvtgrf.cxx b/vcl/source/gdi/cvtgrf.cxx
index 65cc919..1dcd949 100644
--- a/vcl/source/gdi/cvtgrf.cxx
+++ b/vcl/source/gdi/cvtgrf.cxx
@@ -33,7 +33,7 @@ GraphicConverter::~GraphicConverter()
 {
 }
 
-sal_uLong GraphicConverter::Import( SvStream& rIStm, Graphic& rGraphic, sal_uLong nFormat )
+sal_uLong GraphicConverter::Import( SvStream& rIStm, Graphic& rGraphic, ConvertDataFormat nFormat )
 {
     GraphicConverter*   pCvt = ImplGetSVData()->maGDIData.mpGrfConverter;
     sal_uLong               nRet = ERRCODE_IO_GENERAL;
@@ -54,7 +54,7 @@ sal_uLong GraphicConverter::Import( SvStream& rIStm, Graphic& rGraphic, sal_uLon
     return nRet;
 }
 
-sal_uLong GraphicConverter::Export( SvStream& rOStm, const Graphic& rGraphic, sal_uLong nFormat )
+sal_uLong GraphicConverter::Export( SvStream& rOStm, const Graphic& rGraphic, ConvertDataFormat nFormat )
 {
     GraphicConverter*   pCvt = ImplGetSVData()->maGDIData.mpGrfConverter;
     sal_uLong               nRet = ERRCODE_IO_GENERAL;
diff --git a/vcl/source/gdi/gfxlink.cxx b/vcl/source/gdi/gfxlink.cxx
index 75fd45c..62aa6bf 100644
--- a/vcl/source/gdi/gfxlink.cxx
+++ b/vcl/source/gdi/gfxlink.cxx
@@ -171,30 +171,30 @@ bool GfxLink::LoadNative( Graphic& rGraphic )
 
         if( pData )
         {
-            SvMemoryStream  aMemStm;
-            sal_uLong           nCvtType;
+            SvMemoryStream    aMemStm;
+            ConvertDataFormat nCvtType;
 
             aMemStm.SetBuffer( const_cast<sal_uInt8*>(pData), mnBufSize, false, mnBufSize );
 
             switch( meType )
             {
-                case( GFX_LINK_TYPE_NATIVE_GIF ): nCvtType = CVT_GIF; break;
+                case( GFX_LINK_TYPE_NATIVE_GIF ): nCvtType = ConvertDataFormat::GIF; break;
 
                 // #i15508# added BMP type for better exports (reload when swapped - checked, works)
-                case( GFX_LINK_TYPE_NATIVE_BMP ): nCvtType = CVT_BMP; break;
+                case( GFX_LINK_TYPE_NATIVE_BMP ): nCvtType = ConvertDataFormat::BMP; break;
 
-                case( GFX_LINK_TYPE_NATIVE_JPG ): nCvtType = CVT_JPG; break;
-                case( GFX_LINK_TYPE_NATIVE_PNG ): nCvtType = CVT_PNG; break;
-                case( GFX_LINK_TYPE_NATIVE_TIF ): nCvtType = CVT_TIF; break;
-                case( GFX_LINK_TYPE_NATIVE_WMF ): nCvtType = CVT_WMF; break;
-                case( GFX_LINK_TYPE_NATIVE_MET ): nCvtType = CVT_MET; break;
-                case( GFX_LINK_TYPE_NATIVE_PCT ): nCvtType = CVT_PCT; break;
-                case( GFX_LINK_TYPE_NATIVE_SVG ): nCvtType = CVT_SVG; 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;
 
-                default: nCvtType = CVT_UNKNOWN; break;
+                default: nCvtType = ConvertDataFormat::Unknown; break;
             }
 
-            if( nCvtType && ( GraphicConverter::Import( aMemStm, rGraphic, nCvtType ) == ERRCODE_NONE ) )
+            if( nCvtType != ConvertDataFormat::Unknown && ( GraphicConverter::Import( aMemStm, rGraphic, nCvtType ) == ERRCODE_NONE ) )
                 bRet = true;
         }
     }
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 1c62ab0..c19acc0 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1036,18 +1036,18 @@ bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm )
         else if( sal::static_int_cast<sal_uLong>(meType) >= SYS_WINMETAFILE
                  && sal::static_int_cast<sal_uLong>(meType) <= SYS_MACMETAFILE )
         {
-            Graphic aSysGraphic;
-            sal_uLong   nCvtType;
+            Graphic           aSysGraphic;
+            ConvertDataFormat nCvtType;
 
             switch( sal::static_int_cast<sal_uLong>(meType) )
             {
                 case( SYS_WINMETAFILE ):
-                case( SYS_WNTMETAFILE ): nCvtType = CVT_WMF; break;
-                case( SYS_OS2METAFILE ): nCvtType = CVT_MET; break;
-                case( SYS_MACMETAFILE ): nCvtType = CVT_PCT; break;
+                case( SYS_WNTMETAFILE ): nCvtType = ConvertDataFormat::WMF; break;
+                case( SYS_OS2METAFILE ): nCvtType = ConvertDataFormat::MET; break;
+                case( SYS_MACMETAFILE ): nCvtType = ConvertDataFormat::PCT; break;
 
                 default:
-                    nCvtType = CVT_UNKNOWN;
+                    nCvtType = ConvertDataFormat::Unknown;
                 break;
             }
 
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index cdfccbb..99433c2 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -11522,7 +11522,7 @@ void PDFWriterImpl::drawJPGBitmap( SvStream& rDCTData, bool bIsTrueColor, const
         // need to convert to grayscale;
         // load stream to bitmap and draw the bitmap instead
         Graphic aGraphic;
-        GraphicConverter::Import( rDCTData, aGraphic, CVT_JPG );
+        GraphicConverter::Import( rDCTData, aGraphic, ConvertDataFormat::JPG );
         Bitmap aBmp( aGraphic.GetBitmap() );
         if( !!rMask && rMask.GetSizePixel() == aBmp.GetSizePixel() )
         {


More information about the Libreoffice-commits mailing list