[Libreoffice-commits] core.git: avmedia/source cui/source editeng/source embeddedobj/source filter/source include/svx include/vcl oox/source sc/source sd/inc sd/source sfx2/source svgio/source svtools/source svx/qa svx/source sw/inc sw/source vcl/source xmlsecurity/workben

Noel Grandin noel.grandin at collabora.co.uk
Fri Jun 2 07:01:15 UTC 2017


 avmedia/source/opengl/oglplayer.cxx               |    2 
 cui/source/tabpages/backgrnd.cxx                  |    2 
 editeng/source/items/frmitems.cxx                 |    4 
 embeddedobj/source/msole/graphconvert.cxx         |    2 
 filter/source/graphic/GraphicExportFilter.cxx     |    2 
 filter/source/msfilter/msdffimp.cxx               |    8 -
 include/svx/xoutbmp.hxx                           |    4 
 include/vcl/errcode.hxx                           |    1 
 include/vcl/graphicfilter.hxx                     |   28 +--
 oox/source/drawingml/shape.cxx                    |    2 
 sc/source/filter/html/htmlpars.cxx                |    2 
 sc/source/ui/drawfunc/fuins1.cxx                  |    8 -
 sc/source/ui/drawfunc/graphsh.cxx                 |    4 
 sd/inc/sdgrffilter.hxx                            |    2 
 sd/source/filter/grf/sdgrffilter.cxx              |   16 +-
 sd/source/ui/func/fuinsert.cxx                    |    8 -
 sd/source/ui/func/fupage.cxx                      |    4 
 sfx2/source/appl/fileobj.cxx                      |    6 
 sfx2/source/appl/opengrf.cxx                      |   18 +-
 sfx2/source/doc/graphhelp.cxx                     |    2 
 svgio/source/svgreader/svgimagenode.cxx           |    4 
 svtools/source/filter/exportdialog.cxx            |    2 
 svtools/source/graphic/provider.cxx               |    2 
 svtools/source/misc/transfer.cxx                  |    2 
 svx/qa/unit/xoutdev.cxx                           |    2 
 svx/source/sidebar/area/AreaPropertyPanelBase.cxx |    4 
 svx/source/unodraw/UnoGraphicExporter.cxx         |   10 -
 svx/source/xoutdev/_xoutbmp.cxx                   |   25 +--
 sw/inc/view.hxx                                   |    2 
 sw/source/core/doc/notxtfrm.cxx                   |    2 
 sw/source/core/graphic/ndgrf.cxx                  |    4 
 sw/source/filter/html/htmlgrin.cxx                |    4 
 sw/source/filter/ww8/wrtww8gr.cxx                 |    4 
 sw/source/uibase/dochdl/swdtflvr.cxx              |    4 
 sw/source/uibase/shells/drawsh.cxx                |    4 
 sw/source/uibase/uiview/view2.cxx                 |   22 +-
 vcl/source/app/settings.cxx                       |    2 
 vcl/source/filter/graphicfilter.cxx               |  176 +++++++++++-----------
 vcl/source/image/Image.cxx                        |    2 
 xmlsecurity/workben/pdfverify.cxx                 |    2 
 40 files changed, 203 insertions(+), 201 deletions(-)

New commits:
commit 0265bdb92e5dbb5ba851a3d89eb8722bdaf081be
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Jun 1 16:47:00 2017 +0200

    convert GRFILTER constants to ERRCODE_GRFILTER_
    
    since various code mixes these constants in with ErrCode values from
    other code, let us just make it into real ErrCode values.
    
    Change-Id: Ifa3d0f7526172609a44e6749bed9f730ab6b1a95
    Reviewed-on: https://gerrit.libreoffice.org/38313
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index 18b4e9437d66..644a8db76d00 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -94,7 +94,7 @@ bool OGLPlayer::create( const OUString& rURL )
                 // Load images as bitmaps
                 GraphicFilter aFilter;
                 Graphic aGraphic;
-                if( aFilter.ImportGraphic(aGraphic, INetURLObject(sFilesURL)) != GRFILTER_OK )
+                if( aFilter.ImportGraphic(aGraphic, INetURLObject(sFilesURL)) != ERRCODE_NONE )
                 {
                     rFile.buffer = nullptr;
                     rFile.imagewidth = 0;
diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx
index 407550d2bf3f..b727860bc6f4 100644
--- a/cui/source/tabpages/backgrnd.cxx
+++ b/cui/source/tabpages/backgrnd.cxx
@@ -981,7 +981,7 @@ void SvxBackgroundTabPage::RaiseLoadError_Impl()
 bool SvxBackgroundTabPage::LoadLinkedGraphic_Impl()
 {
     bool bResult = ( !aBgdGraphicPath.isEmpty() ) &&
-                   ( GRFILTER_OK == GraphicFilter::LoadGraphic( aBgdGraphicPath,
+                   ( ERRCODE_NONE == GraphicFilter::LoadGraphic( aBgdGraphicPath,
                                                  aBgdGraphicFilter,
                                                  aBgdGraphic ) );
     return bResult;
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 18a8cd955c78..b351a79c01b6 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -3814,7 +3814,7 @@ const GraphicObject* SvxBrushItem::GetGraphicObject(OUString const & referer) co
         // tdf#94088 if we have a stream, try to load it directly as graphic
         if (xStream && !xStream->GetError())
         {
-            if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, maStrLink, *xStream,
+            if (ERRCODE_NONE == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, maStrLink, *xStream,
                 GRFILTER_FORMAT_DONTKNOW, nullptr, GraphicFilterImportFlags::DontSetLogsizeForJpeg))
             {
                 bGraphicLoaded = true;
@@ -3832,7 +3832,7 @@ const GraphicObject* SvxBrushItem::GetGraphicObject(OUString const & referer) co
                 std::unique_ptr<SvMemoryStream> const xMemStream(aGraphicURL.getData());
                 if (xMemStream)
                 {
-                    if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, "", *xMemStream))
+                    if (ERRCODE_NONE == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, "", *xMemStream))
                     {
                         bGraphicLoaded = true;
 
diff --git a/embeddedobj/source/msole/graphconvert.cxx b/embeddedobj/source/msole/graphconvert.cxx
index f27d7481fba3..a8e0cc669804 100644
--- a/embeddedobj/source/msole/graphconvert.cxx
+++ b/embeddedobj/source/msole/graphconvert.cxx
@@ -54,7 +54,7 @@ bool ConvertBufferToFormat( void* pBuf,
         SvMemoryStream aMemoryStream(pBuf, nBufSize, StreamMode::READ);
         GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
         sal_uInt16 nRetFormat = 0;
-        if (rFilter.CanImportGraphic(OUString(), aMemoryStream, GRFILTER_FORMAT_DONTKNOW, &nRetFormat) == GRFILTER_OK &&
+        if (rFilter.CanImportGraphic(OUString(), aMemoryStream, GRFILTER_FORMAT_DONTKNOW, &nRetFormat) == ERRCODE_NONE &&
                 rFilter.GetImportFormatMediaType(nRetFormat) == aMimeType)
         {
             aResult <<= uno::Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemoryStream.GetData() ), aMemoryStream.Seek( STREAM_SEEK_TO_END ) );
diff --git a/filter/source/graphic/GraphicExportFilter.cxx b/filter/source/graphic/GraphicExportFilter.cxx
index 65f70ba18a06..c14ecdc20563 100644
--- a/filter/source/graphic/GraphicExportFilter.cxx
+++ b/filter/source/graphic/GraphicExportFilter.cxx
@@ -121,7 +121,7 @@ sal_Bool SAL_CALL GraphicExportFilter::filter( const Sequence<PropertyValue>& rD
 
     const sal_uInt16 nResult = rFilter.ExportGraphic( aGraphic.GetBitmapEx(aParameters), OUString(), aMemStream, nFilterFormat, &aFilterData );
 
-    if ( nResult == GRFILTER_OK )
+    if ( nResult == ERRCODE_NONE )
     {
         SvOutputStream aOutputStream( mxOutputStream );
         aMemStream.Seek(0);
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index b61f6c8d6c23..11f83205f1b3 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -6328,7 +6328,7 @@ bool SvxMSDffManager::GetBLIPDirect( SvStream& rBLIPStream, Graphic& rData, tool
 {
     sal_uLong nOldPos = rBLIPStream.Tell();
 
-    int nRes = GRFILTER_OPENERROR;  // initialize error variable
+    ErrCode nRes = ERRCODE_GRFILTER_OPENERROR;  // initialize error variable
 
     // check whether it's really a BLIP
     sal_uInt32 nLength;
@@ -6452,7 +6452,7 @@ bool SvxMSDffManager::GetBLIPDirect( SvStream& rBLIPStream, Graphic& rData, tool
             if( ReadDIB(aNew, *pGrStream, false) )
             {
                 rData = Graphic( aNew );
-                nRes = GRFILTER_OK;
+                nRes = ERRCODE_NONE;
             }
         }
         else
@@ -6466,7 +6466,7 @@ bool SvxMSDffManager::GetBLIPDirect( SvStream& rBLIPStream, Graphic& rData, tool
             //
             // For pict graphics we will furthermore scale the metafile, because font scaling leads to error if the
             // dxarray is empty (this has been solved in wmf/emf but not for pict)
-            if( bMtfBLIP && ( GRFILTER_OK == nRes ) && ( rData.GetType() == GraphicType::GdiMetafile ) && ( ( nInst & 0xFFFE ) == 0x542 ) )
+            if( bMtfBLIP && ( ERRCODE_NONE == nRes ) && ( rData.GetType() == GraphicType::GdiMetafile ) && ( ( nInst & 0xFFFE ) == 0x542 ) )
             {
                 if ( ( aMtfSize100.Width() >= 1000 ) && ( aMtfSize100.Height() >= 1000 ) )
                 {   // #75956#, scaling does not work properly, if the graphic is less than 1cm
@@ -6491,7 +6491,7 @@ bool SvxMSDffManager::GetBLIPDirect( SvStream& rBLIPStream, Graphic& rData, tool
     }
     rBLIPStream.Seek( nOldPos );    // restore old FilePos of the strem
 
-    return ( GRFILTER_OK == nRes ); // return result
+    return ( ERRCODE_NONE == nRes ); // return result
 }
 
 /* also static */
diff --git a/include/svx/xoutbmp.hxx b/include/svx/xoutbmp.hxx
index 28748cb0cd2f..25164e273254 100644
--- a/include/svx/xoutbmp.hxx
+++ b/include/svx/xoutbmp.hxx
@@ -58,12 +58,12 @@ public:
 
     static Graphic      MirrorGraphic( const Graphic& rGraphic, const BmpMirrorFlags nMirrorFlags );
     static Animation    MirrorAnimation( const Animation& rAnimation, bool bHMirr, bool bVMirr );
-    static sal_uInt16   WriteGraphic( const Graphic& rGraphic, OUString& rFileName,
+    static ErrCode      WriteGraphic( const Graphic& rGraphic, OUString& rFileName,
                                       const OUString& rFilterName, const XOutFlags nFlags,
                                       const Size* pMtfSize_100TH_MM = nullptr );
     static bool         GraphicToBase64(const Graphic& rGraphic, OUString& rOUString);
 
-    static sal_uInt16   ExportGraphic( const Graphic& rGraphic, const INetURLObject& rURL,
+    static ErrCode      ExportGraphic( const Graphic& rGraphic, const INetURLObject& rURL,
                                        GraphicFilter& rFilter, const sal_uInt16 nFormat,
                                        const css::uno::Sequence< css::beans::PropertyValue >* pFilterData = nullptr );
 
diff --git a/include/vcl/errcode.hxx b/include/vcl/errcode.hxx
index 22ab86fbf22c..ba739e069753 100644
--- a/include/vcl/errcode.hxx
+++ b/include/vcl/errcode.hxx
@@ -81,6 +81,7 @@ inline sal_uInt32 ERRCODE_TOERROR( ErrCode x )
 #define ERRCODE_AREA_SFX                 CAST_TO_UINT32(2UL   << ERRCODE_AREA_SHIFT)
 #define ERRCODE_AREA_INET                CAST_TO_UINT32(3UL   << ERRCODE_AREA_SHIFT)
 #define ERRCODE_AREA_IO                   ERRCODE_AREA_TOOLS
+#define ERRCODE_AREA_VCL                 CAST_TO_UINT32(4UL   << ERRCODE_AREA_SHIFT)
 
 #define ERRCODE_AREA_LIB1                CAST_TO_UINT32(8UL   << ERRCODE_AREA_SHIFT)
 #define ERRCODE_AREA_SVX                 ERRCODE_AREA_LIB1
diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
index c4c6c4359ce9..f2b07db11047 100644
--- a/include/vcl/graphicfilter.hxx
+++ b/include/vcl/graphicfilter.hxx
@@ -25,6 +25,7 @@
 #include <vcl/dllapi.h>
 #include <vcl/field.hxx>
 #include <vcl/graph.hxx>
+#include <vcl/errcode.hxx>
 #include <o3tl/typed_flags_set.hxx>
 
 #include <com/sun/star/uno/Sequence.h>
@@ -35,14 +36,13 @@ class SvStream;
 struct WMF_EXTERNALHEADER;
 struct ConvertData;
 
-#define GRFILTER_OK                 0
-#define GRFILTER_OPENERROR          1
-#define GRFILTER_IOERROR            2
-#define GRFILTER_FORMATERROR        3
-#define GRFILTER_VERSIONERROR       4
-#define GRFILTER_FILTERERROR        5
-#define GRFILTER_ABORT              6
-#define GRFILTER_TOOBIG             7
+#define ERRCODE_GRFILTER_OPENERROR    (ERRCODE_AREA_VCL | ERRCODE_CLASS_GENERAL | 1)
+#define ERRCODE_GRFILTER_IOERROR      (ERRCODE_AREA_VCL | ERRCODE_CLASS_GENERAL | 2)
+#define ERRCODE_GRFILTER_FORMATERROR  (ERRCODE_AREA_VCL | ERRCODE_CLASS_GENERAL | 3)
+#define ERRCODE_GRFILTER_VERSIONERROR (ERRCODE_AREA_VCL | ERRCODE_CLASS_GENERAL | 4)
+#define ERRCODE_GRFILTER_FILTERERROR  (ERRCODE_AREA_VCL | ERRCODE_CLASS_GENERAL | 5)
+#define ERRCODE_GRFILTER_ABORT        (ERRCODE_AREA_VCL | ERRCODE_CLASS_GENERAL | 6)
+#define ERRCODE_GRFILTER_TOOBIG       (ERRCODE_AREA_VCL | ERRCODE_CLASS_GENERAL | 7)
 
 #define GRFILTER_OUTHINT_GREY       1
 
@@ -258,18 +258,18 @@ public:
     OUString        GetExportWildcard( sal_uInt16 nFormat );
     bool            IsExportPixelFormat( sal_uInt16 nFormat );
 
-    sal_uInt16          ExportGraphic( const Graphic& rGraphic, const INetURLObject& rPath,
+    ErrCode             ExportGraphic( const Graphic& rGraphic, const INetURLObject& rPath,
                                        sal_uInt16 nFormat,
                                        const css::uno::Sequence< css::beans::PropertyValue >* pFilterData = nullptr );
-    sal_uInt16          ExportGraphic( const Graphic& rGraphic, const OUString& rPath,
+    ErrCode             ExportGraphic( const Graphic& rGraphic, const OUString& rPath,
                                        SvStream& rOStm, sal_uInt16 nFormat,
                                        const css::uno::Sequence< css::beans::PropertyValue >* pFilterData = nullptr );
 
-    sal_uInt16          CanImportGraphic( const INetURLObject& rPath,
+    ErrCode             CanImportGraphic( const INetURLObject& rPath,
                                       sal_uInt16 nFormat,
                                       sal_uInt16 * pDeterminedFormat);
 
-    sal_uInt16          ImportGraphic( Graphic& rGraphic, const INetURLObject& rPath,
+    ErrCode             ImportGraphic( Graphic& rGraphic, const INetURLObject& rPath,
                                    sal_uInt16 nFormat = GRFILTER_FORMAT_DONTKNOW,
                                    sal_uInt16 * pDeterminedFormat = nullptr, GraphicFilterImportFlags nImportFlags = GraphicFilterImportFlags::NONE );
 
@@ -288,7 +288,7 @@ public:
     /// The resulting graphic is added to rGraphics on success, nullptr is added on failure.
     void ImportGraphics(std::vector< std::shared_ptr<Graphic> >& rGraphics, const std::vector< std::shared_ptr<SvStream> >& rStreams);
 
-    sal_uInt16          ImportGraphic( Graphic& rGraphic, const OUString& rPath,
+    ErrCode             ImportGraphic( Graphic& rGraphic, const OUString& rPath,
                                    SvStream& rStream,
                                    sal_uInt16 nFormat,
                                    sal_uInt16 * pDeterminedFormat, GraphicFilterImportFlags nImportFlags,
@@ -314,7 +314,7 @@ protected:
 private:
     void            ImplInit();
     sal_uLong       ImplSetError( sal_uLong nError, const SvStream* pStm = nullptr );
-    sal_uInt16      ImpTestOrFindFormat( const OUString& rPath, SvStream& rStream, sal_uInt16& rFormat );
+    ErrCode         ImpTestOrFindFormat( const OUString& rPath, SvStream& rStream, sal_uInt16& rFormat );
 
                     DECL_LINK( FilterCallback, ConvertData&, bool );
 
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 774bcedc878a..edf7bf164f70 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1243,7 +1243,7 @@ Reference < XShape > Shape::renderDiagramToGraphic( XmlFilterBase& rFilterBase )
 
         Graphic aGraphic;
         GraphicFilter aFilter( false );
-        if ( aFilter.ImportGraphic( aGraphic, "", aTempStream, GRFILTER_FORMAT_NOTFOUND, nullptr, GraphicFilterImportFlags::NONE, static_cast < Sequence < PropertyValue >* > ( nullptr ) ) != GRFILTER_OK )
+        if ( aFilter.ImportGraphic( aGraphic, "", aTempStream, GRFILTER_FORMAT_NOTFOUND, nullptr, GraphicFilterImportFlags::NONE, static_cast < Sequence < PropertyValue >* > ( nullptr ) ) != ERRCODE_NONE )
         {
             SAL_WARN( "oox.drawingml", "Shape::renderDiagramToGraphic: Unable to import rendered stream into graphic object" );
             return xShape;
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 2ff1e9305c7a..fa3e2d8f8f51 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -1377,7 +1377,7 @@ void ScHTMLLayoutParser::Image( HtmlImportInfo* pInfo )
     sal_uInt16 nFormat;
     Graphic* pGraphic = new Graphic;
     GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
-    if ( GRFILTER_OK != GraphicFilter::LoadGraphic( pImage->aURL, pImage->aFilterName,
+    if ( ERRCODE_NONE != GraphicFilter::LoadGraphic( pImage->aURL, pImage->aFilterName,
             *pGraphic, &rFilter, &nFormat ) )
     {
         delete pGraphic;
diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx
index 3c9c5bcfb862..a48ec836a83f 100644
--- a/sc/source/ui/drawfunc/fuins1.cxx
+++ b/sc/source/ui/drawfunc/fuins1.cxx
@@ -241,8 +241,8 @@ FuInsertGraphic::FuInsertGraphic( ScTabViewShell*   pViewSh,
             bAsLink = static_cast<const SfxBoolItem*>(pItem)->GetValue();
 
         Graphic aGraphic;
-        int nError = GraphicFilter::LoadGraphic( aFileName, aFilterName, aGraphic, &GraphicFilter::GetGraphicFilter() );
-        if ( nError == GRFILTER_OK )
+        ErrCode nError = GraphicFilter::LoadGraphic( aFileName, aFilterName, aGraphic, &GraphicFilter::GetGraphicFilter() );
+        if ( nError == ERRCODE_NONE )
         {
             lcl_InsertGraphic( aGraphic, aFileName, aFilterName, bAsLink, true, pViewSh, pWindow, pView );
         }
@@ -251,11 +251,11 @@ FuInsertGraphic::FuInsertGraphic( ScTabViewShell*   pViewSh,
     {
         SvxOpenGraphicDialog aDlg(ScResId(STR_INSERTGRAPHIC));
 
-        if( aDlg.Execute() == GRFILTER_OK )
+        if( aDlg.Execute() == ERRCODE_NONE )
         {
             Graphic aGraphic;
             int nError = aDlg.GetGraphic(aGraphic);
-            if( nError == GRFILTER_OK )
+            if( nError == ERRCODE_NONE )
             {
                 OUString aFileName = aDlg.GetPath();
                 OUString aFilterName = aDlg.GetCurrentFilter();
diff --git a/sc/source/ui/drawfunc/graphsh.cxx b/sc/source/ui/drawfunc/graphsh.cxx
index 418347d190fd..5f7a264850fc 100644
--- a/sc/source/ui/drawfunc/graphsh.cxx
+++ b/sc/source/ui/drawfunc/graphsh.cxx
@@ -305,11 +305,11 @@ void ScGraphicShell::ExecuteChangePicture( SAL_UNUSED_PARAMETER SfxRequest& /*rR
             SdrGrafObj* pGraphicObj = static_cast<SdrGrafObj*>(pObj);
             SvxOpenGraphicDialog aDlg(ScResId(STR_INSERTGRAPHIC));
 
-            if( aDlg.Execute() == GRFILTER_OK )
+            if( aDlg.Execute() == ERRCODE_NONE )
             {
                 Graphic aGraphic;
                 int nError = aDlg.GetGraphic(aGraphic);
-                if( nError == GRFILTER_OK )
+                if( nError == ERRCODE_NONE )
                 {
                     SdrGrafObj* pNewObject = pGraphicObj->Clone();
                     pNewObject->SetGraphic( aGraphic );
diff --git a/sd/inc/sdgrffilter.hxx b/sd/inc/sdgrffilter.hxx
index fdd2bc04f6cd..a64896d4d4b2 100644
--- a/sd/inc/sdgrffilter.hxx
+++ b/sd/inc/sdgrffilter.hxx
@@ -36,7 +36,7 @@ public:
     bool    Import();
     bool    Export() override;
 
-    static void HandleGraphicFilterError( sal_uInt16 nFilterError, sal_uLong nStreamError );
+    static void HandleGraphicFilterError( ErrCode nFilterError, sal_uLong nStreamError );
 };
 
 #endif // INCLUDED_SD_INC_SDGRFFILTER_HXX
diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx
index 7e668a0ab53f..93c80c101803 100644
--- a/sd/source/filter/grf/sdgrffilter.cxx
+++ b/sd/source/filter/grf/sdgrffilter.cxx
@@ -92,7 +92,7 @@ class SdGRFFilter_ImplInteractionHdl : public ::cppu::WeakImplHelper< css::task:
 
     explicit SdGRFFilter_ImplInteractionHdl( css::uno::Reference< css::task::XInteractionHandler > const & xInteraction ) :
         m_xInter( xInteraction ),
-        nFilterError( GRFILTER_OK )
+        nFilterError( ERRCODE_NONE )
         {}
 
     sal_uInt16 GetErrorCode() const { return nFilterError; };
@@ -122,25 +122,25 @@ SdGRFFilter::~SdGRFFilter()
 {
 }
 
-void SdGRFFilter::HandleGraphicFilterError( sal_uInt16 nFilterError, sal_uLong nStreamError )
+void SdGRFFilter::HandleGraphicFilterError( ErrCode nFilterError, sal_uLong nStreamError )
 {
     sal_uInt16 nId;
 
     switch( nFilterError )
     {
-        case GRFILTER_OPENERROR:
+        case ERRCODE_GRFILTER_OPENERROR:
             nId = STR_IMPORT_GRFILTER_OPENERROR;
             break;
-        case GRFILTER_IOERROR:
+        case ERRCODE_GRFILTER_IOERROR:
             nId = STR_IMPORT_GRFILTER_IOERROR;
             break;
-        case GRFILTER_FORMATERROR:
+        case ERRCODE_GRFILTER_FORMATERROR:
             nId = STR_IMPORT_GRFILTER_FORMATERROR;
             break;
-        case GRFILTER_VERSIONERROR:
+        case ERRCODE_GRFILTER_VERSIONERROR:
             nId = STR_IMPORT_GRFILTER_VERSIONERROR;
             break;
-        case GRFILTER_TOOBIG:
+        case ERRCODE_GRFILTER_TOOBIG:
             nId = STR_IMPORT_GRFILTER_TOOBIG;
             break;
         case 0 :
@@ -148,7 +148,7 @@ void SdGRFFilter::HandleGraphicFilterError( sal_uInt16 nFilterError, sal_uLong n
             break;
 
         default:
-        case GRFILTER_FILTERERROR:
+        case ERRCODE_GRFILTER_FILTERERROR:
             nId = STR_IMPORT_GRFILTER_FILTERERROR;
             break;
     }
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index d8f9d04a7fb6..d7077b57ed8c 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -121,7 +121,7 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq )
     Graphic aGraphic;
 
     bool bAsLink = false;
-    int nError = GRFILTER_OPENERROR;
+    ErrCode nError = ERRCODE_GRFILTER_OPENERROR;
 
     const SfxItemSet* pArgs = rReq.GetArgs();
     const SfxPoolItem* pItem;
@@ -143,7 +143,7 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq )
     {
         SvxOpenGraphicDialog    aDlg(SdResId(STR_INSERTGRAPHIC));
 
-        if( aDlg.Execute() != GRFILTER_OK )
+        if( aDlg.Execute() != ERRCODE_NONE )
             return; // cancel dialog
 
         nError = aDlg.GetGraphic(aGraphic);
@@ -152,7 +152,7 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq )
         aFilterName = aDlg.GetCurrentFilter();
     }
 
-    if( nError == GRFILTER_OK )
+    if( nError == ERRCODE_NONE )
     {
         if( mpViewShell && dynamic_cast< DrawViewShell *>( mpViewShell ) !=  nullptr)
         {
@@ -213,7 +213,7 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq )
     }
     else
     {
-        SdGRFFilter::HandleGraphicFilterError( (sal_uInt16)nError, GraphicFilter::GetGraphicFilter().GetLastError().nStreamError );
+        SdGRFFilter::HandleGraphicFilterError( nError, GraphicFilter::GetGraphicFilter().GetLastError().nStreamError );
     }
 }
 
diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx
index 40095175025e..77ad9e4a990c 100644
--- a/sd/source/ui/func/fupage.cxx
+++ b/sd/source/ui/func/fupage.cxx
@@ -310,11 +310,11 @@ const SfxItemSet* FuPage::ExecuteDialog( vcl::Window* pParent )
     {
         SvxOpenGraphicDialog aDlg(SdResId(STR_SET_BACKGROUND_PICTURE));
 
-        if( aDlg.Execute() == GRFILTER_OK )
+        if( aDlg.Execute() == ERRCODE_NONE )
         {
             Graphic     aGraphic;
             int nError = aDlg.GetGraphic(aGraphic);
-            if( nError == GRFILTER_OK )
+            if( nError == ERRCODE_NONE )
             {
                 pTempSet.reset( new SfxItemSet( mpDoc->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST, 0) );
 
diff --git a/sfx2/source/appl/fileobj.cxx b/sfx2/source/appl/fileobj.cxx
index af5bdb8758b9..084461658c43 100644
--- a/sfx2/source/appl/fileobj.cxx
+++ b/sfx2/source/appl/fileobj.cxx
@@ -296,7 +296,7 @@ bool SvFileObject::GetGraphic_Impl( Graphic& rGrf, SvStream* pStream )
                             ? rGF.GetImportFormatNumber( sFilter )
                             : GRFILTER_FORMAT_DONTKNOW;
 
-    int nRes;
+    ErrCode nRes;
 
     // To avoid that a native link is created
     if( !rGrf.IsLink() &&
@@ -304,7 +304,7 @@ bool SvFileObject::GetGraphic_Impl( Graphic& rGrf, SvStream* pStream )
         rGrf.SetLink( GfxLink() );
 
     if( !pStream )
-        nRes = xMed.is() ? GRFILTER_OPENERROR
+        nRes = xMed.is() ? ERRCODE_GRFILTER_OPENERROR
                          : rGF.ImportGraphic( rGrf, INetURLObject(sFileNm),
                             nFilter );
     else
@@ -326,7 +326,7 @@ bool SvFileObject::GetGraphic_Impl( Graphic& rGrf, SvStream* pStream )
             SAL_WARN( "sfx.appl", "Graphic error [" << nRes << "] - [" << sFileNm << "]" );
     }
 
-    return GRFILTER_OK == nRes;
+    return ERRCODE_NONE == nRes;
 }
 
 /** detect the filter of the given file
diff --git a/sfx2/source/appl/opengrf.cxx b/sfx2/source/appl/opengrf.cxx
index c2871ba641cb..ef3a060d99cc 100644
--- a/sfx2/source/appl/opengrf.cxx
+++ b/sfx2/source/appl/opengrf.cxx
@@ -55,19 +55,19 @@ using namespace ::com::sun::star::uno;
 using namespace ::cppu;
 
 
-sal_uInt16  SvxOpenGrfErr2ResId(    short   err     )
+sal_uInt16  SvxOpenGrfErr2ResId( ErrCode err )
 {
     switch( err )
     {
-        case GRFILTER_OPENERROR:
+        case ERRCODE_GRFILTER_OPENERROR:
             return RID_SVXSTR_GRFILTER_OPENERROR;
-        case GRFILTER_IOERROR:
+        case ERRCODE_GRFILTER_IOERROR:
             return RID_SVXSTR_GRFILTER_IOERROR;
-        case GRFILTER_VERSIONERROR:
+        case ERRCODE_GRFILTER_VERSIONERROR:
             return RID_SVXSTR_GRFILTER_VERSIONERROR;
-        case GRFILTER_FILTERERROR:
+        case ERRCODE_GRFILTER_FILTERERROR:
             return RID_SVXSTR_GRFILTER_FILTERERROR;
-        case GRFILTER_FORMATERROR:
+        case ERRCODE_GRFILTER_FORMATERROR:
         default:
             return RID_SVXSTR_GRFILTER_FORMATERROR;
     }
@@ -135,7 +135,7 @@ short SvxOpenGraphicDialog::Execute()
                 else
                     nImpRet = rFilter.CanImportGraphic( aObj, nFormatNum, &nRetFormat );
 
-                if ( GRFILTER_OK != nImpRet )
+                if ( ERRCODE_NONE != nImpRet )
                 {
                     if ( !pStream )
                         nImpRet = rFilter.CanImportGraphic( aObj, GRFILTER_FORMAT_DONTKNOW, &nRetFormat );
@@ -146,11 +146,11 @@ short SvxOpenGraphicDialog::Execute()
             }
             else
             {
-                if( (nImpRet=rFilter.CanImportGraphic( aObj, nFormatNum, &nRetFormat )) != GRFILTER_OK )
+                if( (nImpRet=rFilter.CanImportGraphic( aObj, nFormatNum, &nRetFormat )) != ERRCODE_NONE )
                     nImpRet = rFilter.CanImportGraphic( aObj, GRFILTER_FORMAT_DONTKNOW, &nRetFormat );
             }
 
-            if ( GRFILTER_OK == nImpRet )
+            if ( ERRCODE_NONE == nImpRet )
                 nFound = nRetFormat;
 
             // could not load?
diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx
index 696bfd7af4da..8d443844e9f1 100644
--- a/sfx2/source/doc/graphhelp.cxx
+++ b/sfx2/source/doc/graphhelp.cxx
@@ -197,7 +197,7 @@ bool GraphicHelper::getThumbnailFormatFromGDI_Impl(GDIMetaFile* pMetaFile, const
 
     GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
 
-    if (rFilter.compressAsPNG(aResultBitmap, *pStream.get()) != GRFILTER_OK)
+    if (rFilter.compressAsPNG(aResultBitmap, *pStream.get()) != ERRCODE_NONE)
         return false;
 
     pStream->Flush();
diff --git a/svgio/source/svgreader/svgimagenode.cxx b/svgio/source/svgreader/svgimagenode.cxx
index 298f5e50fe41..49fd8e79aed2 100644
--- a/svgio/source/svgreader/svgimagenode.cxx
+++ b/svgio/source/svgreader/svgimagenode.cxx
@@ -219,7 +219,7 @@ namespace svgio
                             SvMemoryStream aStream(aPass.getArray(), aPass.getLength(), StreamMode::READ);
                             Graphic aGraphic;
 
-                            if(GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(
+                            if(ERRCODE_NONE == GraphicFilter::GetGraphicFilter().ImportGraphic(
                                 aGraphic,
                                 OUString(),
                                 aStream))
@@ -246,7 +246,7 @@ namespace svgio
                             SvFileStream aStream(aAbsUrl, StreamMode::STD_READ);
                             Graphic aGraphic;
 
-                            if(GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(
+                            if(ERRCODE_NONE == GraphicFilter::GetGraphicFilter().ImportGraphic(
                                    aGraphic,
                                    aAbsUrl,
                                    aStream))
diff --git a/svtools/source/filter/exportdialog.cxx b/svtools/source/filter/exportdialog.cxx
index 94ff492a9ab5..49c4fd8621b6 100644
--- a/svtools/source/filter/exportdialog.cxx
+++ b/svtools/source/filter/exportdialog.cxx
@@ -463,7 +463,7 @@ Bitmap ExportDialog::GetGraphicBitmap( SvStream& rInputStream )
     Bitmap aRet;
     Graphic aGraphic;
     GraphicFilter aFilter( false );
-    if ( aFilter.ImportGraphic( aGraphic, "", rInputStream, GRFILTER_FORMAT_NOTFOUND, nullptr, GraphicFilterImportFlags::NONE, static_cast<css::uno::Sequence< css::beans::PropertyValue >*>(nullptr) ) == GRFILTER_OK )
+    if ( aFilter.ImportGraphic( aGraphic, "", rInputStream, GRFILTER_FORMAT_NOTFOUND, nullptr, GraphicFilterImportFlags::NONE, static_cast<css::uno::Sequence< css::beans::PropertyValue >*>(nullptr) ) == ERRCODE_NONE )
     {
         aRet = aGraphic.GetBitmap();
     }
diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx
index fa34c5c712d6..7355e6268f9a 100644
--- a/svtools/source/graphic/provider.cxx
+++ b/svtools/source/graphic/provider.cxx
@@ -422,7 +422,7 @@ uno::Reference< ::graphic::XGraphic > SAL_CALL GraphicProvider::queryGraphic( co
                 pExtHeader = &aExtHeader;
 
             if( ( rFilter.ImportGraphic( aVCLGraphic, aPath, *pIStm,
-                                         GRFILTER_FORMAT_DONTKNOW, nullptr, GraphicFilterImportFlags::NONE, pExtHeader ) == GRFILTER_OK ) &&
+                                         GRFILTER_FORMAT_DONTKNOW, nullptr, GraphicFilterImportFlags::NONE, pExtHeader ) == ERRCODE_NONE ) &&
                 ( aVCLGraphic.GetType() != GraphicType::NONE ) )
             {
                 ::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic;
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
index e43534a12727..955e9b8d3276 100644
--- a/svtools/source/misc/transfer.cxx
+++ b/svtools/source/misc/transfer.cxx
@@ -1563,7 +1563,7 @@ bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapEx& r
             // it's a JPEG, import to BitmapEx
             GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
             Graphic aGraphic;
-            if (rFilter.ImportGraphic(aGraphic, "", *xStm) == GRFILTER_OK)
+            if (rFilter.ImportGraphic(aGraphic, "", *xStm) == ERRCODE_NONE)
                 rBmpEx = aGraphic.GetBitmapEx();
         }
 
diff --git a/svx/qa/unit/xoutdev.cxx b/svx/qa/unit/xoutdev.cxx
index f2bbb3c42440..a680bd4ebac2 100644
--- a/svx/qa/unit/xoutdev.cxx
+++ b/svx/qa/unit/xoutdev.cxx
@@ -47,7 +47,7 @@ void XOutdevTest::testPdfGraphicExport()
     test::Directories aDirectories;
     OUString aURL = aDirectories.getURLFromSrc("svx/qa/unit/data/graphic.pdf");
     SvFileStream aStream(aURL, StreamMode::READ);
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(GRFILTER_OK), GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, aURL, aStream));
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(ERRCODE_NONE), GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, aURL, aStream));
 
     // Export it.
     utl::TempFile aTempFile;
diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
index 90140dfdb894..e82242591617 100644
--- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
@@ -200,13 +200,13 @@ IMPL_LINK_NOARG(AreaPropertyPanelBase, ClickImportBitmapHdl, Button*, void)
 {
     SvxOpenGraphicDialog aDlg( "Import" );
     aDlg.EnableLink(false);
-    if( aDlg.Execute() == GRFILTER_OK )
+    if( aDlg.Execute() == ERRCODE_NONE )
     {
         Graphic aGraphic;
         EnterWait();
         int nError = aDlg.GetGraphic( aGraphic );
         LeaveWait();
-        if( nError == GRFILTER_OK )
+        if( nError == ERRCODE_NONE )
         {
             const SvxBitmapListItem aItem( *static_cast<const SvxBitmapListItem*>(SfxObjectShell::Current()->GetItem(SID_BITMAP_LIST)));
             XBitmapListRef pList = aItem.GetBitmapList();
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index 17eabdd5c360..e4ae5760b944 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -1013,15 +1013,15 @@ sal_Bool SAL_CALL GraphicExporter::filter( const Sequence< PropertyValue >& aDes
     // create the output stuff
     Graphic aGraphic;
 
-    sal_uInt16 nStatus = GetGraphic( aSettings, aGraphic, bVectorType ) ? GRFILTER_OK : GRFILTER_FILTERERROR;
+    ErrCode nStatus = GetGraphic( aSettings, aGraphic, bVectorType ) ? ERRCODE_NONE : ERRCODE_GRFILTER_FILTERERROR;
 
-    if( nStatus == GRFILTER_OK )
+    if( nStatus == ERRCODE_NONE )
     {
         // export graphic only if it has a size
         const Size aGraphSize( aGraphic.GetPrefSize() );
         if ( ( aGraphSize.Width() == 0 ) || ( aGraphSize.Height() == 0 ) )
         {
-            nStatus = GRFILTER_FILTERERROR;
+            nStatus = ERRCODE_GRFILTER_FILTERERROR;
         }
         else
         {
@@ -1054,7 +1054,7 @@ sal_Bool SAL_CALL GraphicExporter::filter( const Sequence< PropertyValue >& aDes
         }
     }
 
-    if ( aSettings.mxInteractionHandler.is() && ( nStatus != GRFILTER_OK ) )
+    if ( aSettings.mxInteractionHandler.is() && ( nStatus != ERRCODE_NONE ) )
     {
         Any aInteraction;
         Sequence< css::uno::Reference< css::task::XInteractionContinuation > > lContinuations(1);
@@ -1066,7 +1066,7 @@ sal_Bool SAL_CALL GraphicExporter::filter( const Sequence< PropertyValue >& aDes
         aInteraction <<= aErrorCode;
         aSettings.mxInteractionHandler->handle( framework::InteractionRequest::CreateRequest( aInteraction, lContinuations ) );
     }
-    return nStatus == GRFILTER_OK;
+    return nStatus == ERRCODE_NONE;
 }
 
 void SAL_CALL GraphicExporter::cancel()
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index fd105064b55c..6205b6533b6a 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -117,7 +117,7 @@ Graphic XOutBitmap::MirrorGraphic( const Graphic& rGraphic, const BmpMirrorFlags
     return aRetGraphic;
 }
 
-sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName,
+ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName,
                                  const OUString& rFilterName, const XOutFlags nFlags,
                                  const Size* pMtfSize_100TH_MM )
 {
@@ -127,7 +127,8 @@ sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileNam
         Graphic         aGraphic;
         OUString        aExt;
         GraphicFilter&  rFilter = GraphicFilter::GetGraphicFilter();
-        sal_uInt16          nErr = GRFILTER_FILTERERROR, nFilter = GRFILTER_FORMAT_NOTFOUND;
+        ErrCode         nErr = ERRCODE_GRFILTER_FILTERERROR;
+        sal_uInt16      nFilter = GRFILTER_FORMAT_NOTFOUND;
         bool            bTransparent = rGraphic.IsTransparent(), bAnimated = rGraphic.IsAnimated();
 
         DBG_ASSERT( aURL.GetProtocol() != INetProtocol::NotValid, "XOutBitmap::WriteGraphic(...): invalid URL" );
@@ -169,7 +170,7 @@ sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileNam
 
                 if(!aMedium.GetError())
                 {
-                    nErr = GRFILTER_OK;
+                    nErr = ERRCODE_NONE;
                 }
             }
         }
@@ -188,11 +189,11 @@ sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileNam
                 pOutStream->WriteBytes(aPdfData.getConstArray(), aPdfData.getLength());
                 aMedium.Commit();
                 if (!aMedium.GetError())
-                    nErr = GRFILTER_OK;
+                    nErr = ERRCODE_NONE;
             }
         }
 
-        if( GRFILTER_OK != nErr )
+        if( ERRCODE_NONE != nErr )
         {
             if( ( nFlags & XOutFlags::UseNativeIfPossible ) &&
                 !( nFlags & XOutFlags::MirrorHorz ) &&
@@ -231,13 +232,13 @@ sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileNam
                         aMedium.Commit();
 
                         if( !aMedium.GetError() )
-                            nErr = GRFILTER_OK;
+                            nErr = ERRCODE_NONE;
                     }
                 }
             }
         }
 
-        if( GRFILTER_OK != nErr )
+        if( ERRCODE_NONE != nErr )
         {
             OUString  aFilter( rFilterName );
             bool    bWriteTransGrf = ( aFilter.equalsIgnoreAsciiCase( "transgrf" ) ) ||
@@ -344,7 +345,7 @@ sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileNam
     }
     else
     {
-        return GRFILTER_OK;
+        return ERRCODE_NONE;
     }
 }
 
@@ -406,7 +407,7 @@ bool XOutBitmap::GraphicToBase64(const Graphic& rGraphic, OUString& rOUString)
     return true;
 }
 
-sal_uInt16 XOutBitmap::ExportGraphic( const Graphic& rGraphic, const INetURLObject& rURL,
+ErrCode XOutBitmap::ExportGraphic( const Graphic& rGraphic, const INetURLObject& rURL,
                                   GraphicFilter& rFilter, const sal_uInt16 nFormat,
                                   const css::uno::Sequence< css::beans::PropertyValue >* pFilterData )
 {
@@ -414,7 +415,7 @@ sal_uInt16 XOutBitmap::ExportGraphic( const Graphic& rGraphic, const INetURLObje
 
     SfxMedium   aMedium( rURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::WRITE | StreamMode::SHARE_DENYNONE | StreamMode::TRUNC );
     SvStream*   pOStm = aMedium.GetOutStream();
-    sal_uInt16      nRet = GRFILTER_IOERROR;
+    ErrCode     nRet = ERRCODE_GRFILTER_IOERROR;
 
     if( pOStm )
     {
@@ -425,8 +426,8 @@ sal_uInt16 XOutBitmap::ExportGraphic( const Graphic& rGraphic, const INetURLObje
         pGrfFilter = nullptr;
         aMedium.Commit();
 
-        if( aMedium.GetError() && ( GRFILTER_OK == nRet  ) )
-            nRet = GRFILTER_IOERROR;
+        if( aMedium.GetError() && ( ERRCODE_NONE == nRet  ) )
+            nRet = ERRCODE_GRFILTER_IOERROR;
     }
 
     return nRet;
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index 55f87ec82937..23136b765819 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -615,7 +615,7 @@ public:
     void StateFormatPaintbrush(SfxItemSet &);
 
     //public fuer D&D
-    int     InsertGraphic( const OUString &rPath, const OUString &rFilter,
+    ErrCode     InsertGraphic( const OUString &rPath, const OUString &rFilter,
                             bool bLink, GraphicFilter *pFlt );
 
     void ExecuteScan( SfxRequest& rReq );
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 4156753cf966..811b0ceb1c7e 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -800,7 +800,7 @@ void paintGraphicUsingPrimitivesHelper(vcl::RenderContext & rOutputDevice,
             Graphic aTempGraphic;
             INetURLObject aURL(rGrfObj.GetLink());
 
-            if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(aTempGraphic, aURL))
+            if (ERRCODE_NONE == GraphicFilter::GetGraphicFilter().ImportGraphic(aTempGraphic, aURL))
             {
                 if(aTempGraphic.IsLink() && GfxLinkType::NativeJpg == aTempGraphic.GetLink().GetType())
                 {
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 72c4c3cc3f76..49052dfa0e23 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -769,9 +769,9 @@ void SwGrfNode::ReleaseLink()
             // data we have (but without knowing the original format)
             GraphicFilter& rFlt = GraphicFilter::GetGraphicFilter();
             Graphic aNew;
-            int nRes = GraphicFilter::LoadGraphic( aFileName, OUString(), aNew, &rFlt);
+            ErrCode nRes = GraphicFilter::LoadGraphic( aFileName, OUString(), aNew, &rFlt);
 
-            if(GRFILTER_OK == nRes)
+            if(ERRCODE_NONE == nRes)
             {
                 maGrfObj.SetGraphic(aNew);
             }
diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx
index 153d1e31e346..12f035d83b76 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -457,13 +457,13 @@ IMAGE_SETEVENT:
         std::unique_ptr<SvMemoryStream> const pStream(aGraphicURL.getData());
         if (pStream)
         {
-            if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, "", *pStream))
+            if (ERRCODE_NONE == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, "", *pStream))
                 sGrfNm.clear();
         }
     }
     else if (m_sBaseURL.isEmpty()) // sBaseURL is empty if the source is clipboard
     {
-        if (GRFILTER_OK == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, aGraphicURL))
+        if (ERRCODE_NONE == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, aGraphicURL))
             sGrfNm.clear();
     }
 
diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx
index d509c8af8c35..e11013186485 100644
--- a/sw/source/filter/ww8/wrtww8gr.cxx
+++ b/sw/source/filter/ww8/wrtww8gr.cxx
@@ -169,13 +169,13 @@ bool WW8Export::TestOleNeedsGraphic(const SwAttrSet& rSet,
                 {
                     Graphic aGr1;
                     GraphicFilter& rGF = GraphicFilter::GetGraphicFilter();
-                    if( rGF.ImportGraphic( aGr1, OUString(), *pGraphicStream ) == GRFILTER_OK )
+                    if( rGF.ImportGraphic( aGr1, OUString(), *pGraphicStream ) == ERRCODE_NONE )
                     {
                         Graphic aGr2;
                         delete pGraphicStream;
                         pGraphicStream =
                                 ::utl::UcbStreamHelper::CreateStream( aCnt.GetGraphicStream( pRet->GetObjRef() ) );
-                        if( pGraphicStream && rGF.ImportGraphic( aGr2, OUString(), *pGraphicStream ) == GRFILTER_OK )
+                        if( pGraphicStream && rGF.ImportGraphic( aGr2, OUString(), *pGraphicStream ) == ERRCODE_NONE )
                         {
                             if ( aGr1 == aGr2 )
                                 bGraphicNeeded = false;
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index a21b3648dd72..edcad002edc8 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -1950,7 +1950,7 @@ bool SwTransferable::PasteTargetURL( TransferableDataHelper& rData,
             //!!! check at FileSystem - only then it make sense to test graphics !!!
             Graphic aGraphic;
             GraphicFilter &rFlt = GraphicFilter::GetGraphicFilter();
-            bRet = GRFILTER_OK == GraphicFilter::LoadGraphic( sURL, aEmptyOUStr, aGraphic, &rFlt );
+            bRet = ERRCODE_NONE == GraphicFilter::LoadGraphic( sURL, aEmptyOUStr, aGraphic, &rFlt );
 
             if( bRet )
             {
@@ -2313,7 +2313,7 @@ bool SwTransferable::PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
     {
         //!!! check at FileSystem - only then it makes sense to test the graphics !!!
         GraphicFilter &rFlt = GraphicFilter::GetGraphicFilter();
-        bRet = GRFILTER_OK == GraphicFilter::LoadGraphic( aBkmk.GetURL(), aEmptyOUStr,
+        bRet = ERRCODE_NONE == GraphicFilter::LoadGraphic( aBkmk.GetURL(), aEmptyOUStr,
                                             aGraphic, &rFlt );
 
         if( !bRet && SwPasteSdr::SetAttr == nAction &&
diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx
index 0d529b38d81d..b1b97df5368c 100644
--- a/sw/source/uibase/shells/drawsh.cxx
+++ b/sw/source/uibase/shells/drawsh.cxx
@@ -126,12 +126,12 @@ void SwDrawShell::InsertPictureFromFile(SdrObject& rObject)
     {
         SvxOpenGraphicDialog aDlg(SwResId(STR_INSERT_GRAPHIC));
 
-        if(GRFILTER_OK == aDlg.Execute())
+        if(ERRCODE_NONE == aDlg.Execute())
         {
             Graphic aGraphic;
             int nError(aDlg.GetGraphic(aGraphic));
 
-            if(GRFILTER_OK == nError)
+            if(ERRCODE_NONE == nError)
             {
                 const bool bAsLink(aDlg.IsAsLink());
                 SdrObject* pResult = &rObject;
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index a677c3ac9ad6..117dd7fbd969 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -212,20 +212,20 @@ OUString SwView::GetPageStr(sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, const OUStr
     return aStr;
 }
 
-int SwView::InsertGraphic( const OUString &rPath, const OUString &rFilter,
+ErrCode SwView::InsertGraphic( const OUString &rPath, const OUString &rFilter,
                                 bool bLink, GraphicFilter *pFilter )
 {
     SwWait aWait( *GetDocShell(), true );
 
     Graphic aGraphic;
-    int aResult = GRFILTER_OK;
+    ErrCode aResult = ERRCODE_NONE;
     if( !pFilter )
     {
         pFilter = &GraphicFilter::GetGraphicFilter();
     }
     aResult = GraphicFilter::LoadGraphic( rPath, rFilter, aGraphic, pFilter );
 
-    if( GRFILTER_OK == aResult )
+    if( ERRCODE_NONE == aResult )
     {
         GraphicNativeMetadata aMetadata;
         if ( aMetadata.read(aGraphic) )
@@ -449,10 +449,10 @@ bool SwView::InsertGraphicDlg( SfxRequest& rReq )
 
         rSh.StartUndo(SwUndoId::INSERT, &aRewriter);
 
-        int nError = InsertGraphic( aFileName, aFilterName, bAsLink, &GraphicFilter::GetGraphicFilter() );
+        ErrCode nError = InsertGraphic( aFileName, aFilterName, bAsLink, &GraphicFilter::GetGraphicFilter() );
 
         // format not equal to current filter (with autodetection)
-        if( nError == GRFILTER_FORMATERROR )
+        if( nError == ERRCODE_GRFILTER_FORMATERROR )
             nError = InsertGraphic( aFileName, OUString(), bAsLink, &GraphicFilter::GetGraphicFilter() );
 
         // #i123922# no new FrameFormat for replace mode, only when new object was created,
@@ -470,22 +470,22 @@ bool SwView::InsertGraphicDlg( SfxRequest& rReq )
         sal_uInt32 nResId(0);
         switch( nError )
         {
-            case GRFILTER_OPENERROR:
+            case ERRCODE_GRFILTER_OPENERROR:
                 nResId = STR_GRFILTER_OPENERROR;
                 break;
-            case GRFILTER_IOERROR:
+            case ERRCODE_GRFILTER_IOERROR:
                 nResId = STR_GRFILTER_IOERROR;
                 break;
-            case GRFILTER_FORMATERROR:
+            case ERRCODE_GRFILTER_FORMATERROR:
                 nResId = STR_GRFILTER_FORMATERROR;
                 break;
-            case GRFILTER_VERSIONERROR:
+            case ERRCODE_GRFILTER_VERSIONERROR:
                 nResId = STR_GRFILTER_VERSIONERROR;
                 break;
-            case GRFILTER_FILTERERROR:
+            case ERRCODE_GRFILTER_FILTERERROR:
                 nResId = STR_GRFILTER_FILTERERROR;
                 break;
-            case GRFILTER_TOOBIG:
+            case ERRCODE_GRFILTER_TOOBIG:
                 nResId = STR_GRFILTER_TOOBIG;
                 break;
         }
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 0a34aff66561..95b3a2a2de22 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -2122,7 +2122,7 @@ static BitmapEx readBitmapEx( const OUString& rPath )
 
     // import the image
     Graphic aGraphic;
-    if ( GraphicFilter::LoadGraphic( aPath, OUString(), aGraphic ) != GRFILTER_OK )
+    if ( GraphicFilter::LoadGraphic( aPath, OUString(), aGraphic ) != ERRCODE_NONE )
         return BitmapEx();
     return aGraphic.GetBitmapEx();
 }
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index d7eb5d7f7a4b..495d85d6b8c9 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -773,7 +773,7 @@ static bool ImpPeekGraphicFormat( SvStream& rStream, OUString& rFormatExtension,
     return bTest && !bSomethingTested;
 }
 
-sal_uInt16 GraphicFilter::ImpTestOrFindFormat( const OUString& rPath, SvStream& rStream, sal_uInt16& rFormat )
+ErrCode GraphicFilter::ImpTestOrFindFormat( const OUString& rPath, SvStream& rStream, sal_uInt16& rFormat )
 {
     // determine or check the filter/format by reading into it
     if( rFormat == GRFILTER_FORMAT_DONTKNOW )
@@ -783,7 +783,7 @@ sal_uInt16 GraphicFilter::ImpTestOrFindFormat( const OUString& rPath, SvStream&
         {
             rFormat = pConfig->GetImportFormatNumberForExtension( aFormatExt );
             if( rFormat != GRFILTER_FORMAT_DONTKNOW )
-                return GRFILTER_OK;
+                return ERRCODE_NONE;
         }
         // determine filter by file extension
         if( !rPath.isEmpty() )
@@ -791,16 +791,16 @@ sal_uInt16 GraphicFilter::ImpTestOrFindFormat( const OUString& rPath, SvStream&
             OUString aExt( ImpGetExtension( rPath ) );
             rFormat = pConfig->GetImportFormatNumberForExtension( aExt );
             if( rFormat != GRFILTER_FORMAT_DONTKNOW )
-                return GRFILTER_OK;
+                return ERRCODE_NONE;
         }
-        return GRFILTER_FORMATERROR;
+        return ERRCODE_GRFILTER_FORMATERROR;
     }
     else
     {
         OUString aTmpStr( pConfig->GetImportFormatExtension( rFormat ) );
         aTmpStr = aTmpStr.toAsciiUpperCase();
         if( !ImpPeekGraphicFormat( rStream, aTmpStr, true ) )
-            return GRFILTER_FORMATERROR;
+            return ERRCODE_GRFILTER_FORMATERROR;
         if ( pConfig->GetImportFormatExtension( rFormat ).equalsIgnoreAsciiCase( "pcd" ) )
         {
             sal_Int32 nBase = 2;    // default Base0
@@ -814,7 +814,7 @@ sal_uInt16 GraphicFilter::ImpTestOrFindFormat( const OUString& rPath, SvStream&
         }
     }
 
-    return GRFILTER_OK;
+    return ERRCODE_NONE;
 }
 
 static Graphic ImpGetScaledGraphic( const Graphic& rGraphic, FilterConfigItem& rConfigItem )
@@ -1266,10 +1266,10 @@ bool GraphicFilter::IsExportPixelFormat( sal_uInt16 nFormat )
     return pConfig->IsExportPixelFormat( nFormat );
 }
 
-sal_uInt16 GraphicFilter::CanImportGraphic( const INetURLObject& rPath,
+ErrCode GraphicFilter::CanImportGraphic( const INetURLObject& rPath,
                                         sal_uInt16 nFormat, sal_uInt16* pDeterminedFormat )
 {
-    sal_uInt16  nRetValue = GRFILTER_FORMATERROR;
+    ErrCode  nRetValue = ERRCODE_GRFILTER_FORMATERROR;
     SAL_WARN_IF( rPath.GetProtocol() == INetProtocol::NotValid, "vcl.filter", "GraphicFilter::CanImportGraphic() : ProtType == INetProtocol::NotValid" );
 
     OUString    aMainUrl( rPath.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
@@ -1289,17 +1289,17 @@ sal_uInt16 GraphicFilter::CanImportGraphic( const OUString& rMainUrl, SvStream&
 
     rIStream.Seek(nStreamPos);
 
-    if( nRes==GRFILTER_OK && pDeterminedFormat!=nullptr )
+    if( nRes==ERRCODE_NONE && pDeterminedFormat!=nullptr )
         *pDeterminedFormat = nFormat;
 
-    return (sal_uInt16) ImplSetError( nRes, &rIStream );
+    return ImplSetError( nRes, &rIStream );
 }
 
 //SJ: TODO, we need to create a GraphicImporter component
-sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const INetURLObject& rPath,
+ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const INetURLObject& rPath,
                                      sal_uInt16 nFormat, sal_uInt16 * pDeterminedFormat, GraphicFilterImportFlags nImportFlags )
 {
-    sal_uInt16 nRetValue = GRFILTER_FORMATERROR;
+    ErrCode nRetValue = ERRCODE_GRFILTER_FORMATERROR;
     SAL_WARN_IF( rPath.GetProtocol() == INetProtocol::NotValid, "vcl.filter", "GraphicFilter::ImportGraphic() : ProtType == INetProtocol::NotValid" );
 
     OUString    aMainUrl( rPath.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
@@ -1328,7 +1328,7 @@ struct GraphicImportContext
     /// Write pixel data using this access.
     std::unique_ptr<Bitmap::ScopedWriteAccess> m_pAccess;
     /// Signals if import finished correctly.
-    sal_uInt16 m_nStatus = GRFILTER_FILTERERROR;
+    ErrCode m_nStatus = ERRCODE_GRFILTER_FILTERERROR;
     /// Original graphic format.
     GfxLinkType m_eLinkType = GfxLinkType::NONE;
     /// Position of the stream before reading the data.
@@ -1362,7 +1362,7 @@ void GraphicImportTask::doWork()
 void GraphicImportTask::doImport(GraphicImportContext& rContext)
 {
     if (!ImportJPEG(*rContext.m_pStream, *rContext.m_pGraphic, rContext.m_nImportFlags | GraphicFilterImportFlags::UseExistingBitmap, rContext.m_pAccess.get()))
-        rContext.m_nStatus = GRFILTER_FILTERERROR;
+        rContext.m_nStatus = ERRCODE_GRFILTER_FILTERERROR;
     else
         rContext.m_eLinkType = GfxLinkType::NativeJpg;
 }
@@ -1384,7 +1384,7 @@ void GraphicFilter::ImportGraphics(std::vector< std::shared_ptr<Graphic> >& rGra
         {
             rContext.m_pStream = pStream;
             rContext.m_pGraphic = std::make_shared<Graphic>();
-            rContext.m_nStatus = GRFILTER_OK;
+            rContext.m_nStatus = ERRCODE_NONE;
 
             // Detect the format.
             ResetLastError();
@@ -1394,7 +1394,7 @@ void GraphicFilter::ImportGraphics(std::vector< std::shared_ptr<Graphic> >& rGra
             pStream->Seek(rContext.m_nStreamBegin);
 
             // Import the graphic.
-            if (rContext.m_nStatus == GRFILTER_OK && !pStream->GetError())
+            if (rContext.m_nStatus == ERRCODE_NONE && !pStream->GetError())
             {
                 OUString aFilterName = pConfig->GetImportFilterName(nFormat);
 
@@ -1403,7 +1403,7 @@ void GraphicFilter::ImportGraphics(std::vector< std::shared_ptr<Graphic> >& rGra
                     rContext.m_nImportFlags = GraphicFilterImportFlags::SetLogsizeForJpeg;
 
                     if (!ImportJPEG( *pStream, *rContext.m_pGraphic, rContext.m_nImportFlags | GraphicFilterImportFlags::OnlyCreateBitmap, nullptr))
-                        rContext.m_nStatus = GRFILTER_FILTERERROR;
+                        rContext.m_nStatus = ERRCODE_GRFILTER_FILTERERROR;
                     else
                     {
                         Bitmap& rBitmap = const_cast<Bitmap&>(rContext.m_pGraphic->GetBitmapExRef().GetBitmapRef());
@@ -1416,7 +1416,7 @@ void GraphicFilter::ImportGraphics(std::vector< std::shared_ptr<Graphic> >& rGra
                     }
                 }
                 else
-                    rContext.m_nStatus = GRFILTER_FILTERERROR;
+                    rContext.m_nStatus = ERRCODE_GRFILTER_FILTERERROR;
             }
         }
     }
@@ -1428,7 +1428,7 @@ void GraphicFilter::ImportGraphics(std::vector< std::shared_ptr<Graphic> >& rGra
     {
         rContext.m_pAccess.reset(nullptr);
 
-        if (rContext.m_nStatus == GRFILTER_OK && (rContext.m_eLinkType != GfxLinkType::NONE) && !rContext.m_pGraphic->GetContext())
+        if (rContext.m_nStatus == ERRCODE_NONE && (rContext.m_eLinkType != GfxLinkType::NONE) && !rContext.m_pGraphic->GetContext())
         {
             std::unique_ptr<sal_uInt8[]> pGraphicContent;
 
@@ -1443,28 +1443,28 @@ void GraphicFilter::ImportGraphics(std::vector< std::shared_ptr<Graphic> >& rGra
                 }
                 catch (const std::bad_alloc&)
                 {
-                    rContext.m_nStatus = GRFILTER_TOOBIG;
+                    rContext.m_nStatus = ERRCODE_GRFILTER_TOOBIG;
                 }
 
-                if (rContext.m_nStatus == GRFILTER_OK)
+                if (rContext.m_nStatus == ERRCODE_NONE)
                 {
                     rContext.m_pStream->Seek(rContext.m_nStreamBegin);
                     rContext.m_pStream->ReadBytes(pGraphicContent.get(), nGraphicContentSize);
                 }
             }
 
-            if (rContext.m_nStatus == GRFILTER_OK)
+            if (rContext.m_nStatus == ERRCODE_NONE)
                 rContext.m_pGraphic->SetLink(GfxLink(std::move(pGraphicContent), nGraphicContentSize, rContext.m_eLinkType));
         }
 
-        if (rContext.m_nStatus != GRFILTER_OK)
+        if (rContext.m_nStatus != ERRCODE_NONE)
             rContext.m_pGraphic = nullptr;
 
         rGraphics.push_back(rContext.m_pGraphic);
     }
 }
 
-sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath, SvStream& rIStream,
+ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath, SvStream& rIStream,
                                      sal_uInt16 nFormat, sal_uInt16* pDeterminedFormat, GraphicFilterImportFlags nImportFlags,
                                      css::uno::Sequence< css::beans::PropertyValue >* pFilterData,
                                      WMF_EXTERNALHEADER *pExtHeader )
@@ -1472,7 +1472,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
     OUString                       aFilterName;
     OUString                       aExternalFilterName;
     sal_uLong                      nStreamBegin;
-    sal_uInt16                     nStatus;
+    ErrCode                        nStatus;
     std::shared_ptr<GraphicReader> pContext = rGraphic.GetContext();
     GfxLinkType                    eLinkType = GfxLinkType::NONE;
     bool                           bDummyContext = rGraphic.IsDummyContext();
@@ -1531,19 +1531,19 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
             nStreamBegin = rIStream.Tell();
 
         nStatus = ImpTestOrFindFormat( rPath, rIStream, nFormat );
-        // if pending, return GRFILTER_OK in order to request more bytes
+        // if pending, return ERRCODE_NONE in order to request more bytes
         if( rIStream.GetError() == ERRCODE_IO_PENDING )
         {
             rGraphic.SetDummyContext(true);
             rIStream.ResetError();
             rIStream.Seek( nStreamBegin );
-            return (sal_uInt16) ImplSetError( GRFILTER_OK );
+            return ImplSetError( ERRCODE_NONE );
         }
 
         rIStream.Seek( nStreamBegin );
 
-        if( ( nStatus != GRFILTER_OK ) || rIStream.GetError() )
-            return (sal_uInt16) ImplSetError( ( nStatus != GRFILTER_OK ) ? nStatus : GRFILTER_OPENERROR, &rIStream );
+        if( ( nStatus != ERRCODE_NONE ) || rIStream.GetError() )
+            return ImplSetError( ( nStatus != ERRCODE_NONE ) ? nStatus : ERRCODE_GRFILTER_OPENERROR, &rIStream );
 
         if( pDeterminedFormat )
             *pDeterminedFormat = nFormat;
@@ -1557,7 +1557,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
             aFilterName = pContext->GetUpperFilterName();
 
         nStreamBegin = 0;
-        nStatus = GRFILTER_OK;
+        nStatus = ERRCODE_NONE;
     }
 
     // read graphic
@@ -1569,7 +1569,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
                 rGraphic.SetDummyContext( false );
 
             if( !ImportGIF( rIStream, rGraphic ) )
-                nStatus = GRFILTER_FILTERERROR;
+                nStatus = ERRCODE_GRFILTER_FILTERERROR;
             else
                 eLinkType = GfxLinkType::NativeGif;
         }
@@ -1623,7 +1623,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
             {
                 BitmapEx aBmpEx( aPNGReader.Read( aPreviewSizeHint ) );
                 if ( aBmpEx.IsEmpty() )
-                    nStatus = GRFILTER_FILTERERROR;
+                    nStatus = ERRCODE_GRFILTER_FILTERERROR;
                 else
                 {
                     rGraphic = aBmpEx;
@@ -1643,14 +1643,14 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
 
             sal_uInt64 nPosition = rIStream.Tell();
             if( !ImportJPEG( rIStream, rGraphic, nImportFlags | GraphicFilterImportFlags::OnlyCreateBitmap, nullptr ) )
-                nStatus = GRFILTER_FILTERERROR;
+                nStatus = ERRCODE_GRFILTER_FILTERERROR;
             else
             {
                 Bitmap& rBitmap = const_cast<Bitmap&>(rGraphic.GetBitmapExRef().GetBitmapRef());
                 Bitmap::ScopedWriteAccess pWriteAccess(rBitmap);
                 rIStream.Seek(nPosition);
                 if( !ImportJPEG( rIStream, rGraphic, nImportFlags | GraphicFilterImportFlags::UseExistingBitmap, &pWriteAccess ) )
-                    nStatus = GRFILTER_FILTERERROR;
+                    nStatus = ERRCODE_GRFILTER_FILTERERROR;
                 else
                     eLinkType = GfxLinkType::NativeJpg;
             }
@@ -1722,7 +1722,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
             }
             else
             {
-                nStatus = GRFILTER_FILTERERROR;
+                nStatus = ERRCODE_GRFILTER_FILTERERROR;
             }
         }
         else if( aFilterName.equalsIgnoreAsciiCase( IMP_XBM ) )
@@ -1731,7 +1731,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
                 rGraphic.SetDummyContext( false );
 
             if( !ImportXBM( rIStream, rGraphic ) )
-                nStatus = GRFILTER_FILTERERROR;
+                nStatus = ERRCODE_GRFILTER_FILTERERROR;
         }
         else if( aFilterName.equalsIgnoreAsciiCase( IMP_XPM ) )
         {
@@ -1739,7 +1739,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
                 rGraphic.SetDummyContext( false );
 
             if( !ImportXPM( rIStream, rGraphic ) )
-                nStatus = GRFILTER_FILTERERROR;
+                nStatus = ERRCODE_GRFILTER_FILTERERROR;
         }
         else if( aFilterName.equalsIgnoreAsciiCase( IMP_BMP ) ||
                     aFilterName.equalsIgnoreAsciiCase( IMP_SVMETAFILE ) )
@@ -1748,7 +1748,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
             ReadGraphic( rIStream, rGraphic );
             if( rIStream.GetError() )
             {
-                nStatus = GRFILTER_FORMATERROR;
+                nStatus = ERRCODE_GRFILTER_FORMATERROR;
             }
             else if (aFilterName.equalsIgnoreAsciiCase(IMP_BMP))
             {
@@ -1760,7 +1760,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
         {
             ReadGraphic( rIStream, rGraphic );
             if( rIStream.GetError() )
-                nStatus = GRFILTER_FORMATERROR;
+                nStatus = ERRCODE_GRFILTER_FORMATERROR;
             else
             {
                 rGraphic.SetDefaultType();
@@ -1773,7 +1773,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
         {
             GDIMetaFile aMtf;
             if( !ConvertWMFToGDIMetaFile( rIStream, aMtf, nullptr, pExtHeader ) )
-                nStatus = GRFILTER_FORMATERROR;
+                nStatus = ERRCODE_GRFILTER_FORMATERROR;
             else
             {
                 rGraphic = aMtf;
@@ -1792,17 +1792,17 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
                 {
                     SvMemoryStream aTempStream;
                     if( aTempStream.GetError() )
-                        return GRFILTER_OPENERROR;
+                        return ERRCODE_GRFILTER_OPENERROR;
 
                     if( !SgfBMapFilter( rIStream, aTempStream ) )
-                        nStatus = GRFILTER_FILTERERROR;
+                        nStatus = ERRCODE_GRFILTER_FILTERERROR;
                     else
                     {
                         aTempStream.Seek( 0L );
                         ReadGraphic( aTempStream, rGraphic );
 
                         if( aTempStream.GetError() )
-                            nStatus = GRFILTER_FILTERERROR;
+                            nStatus = ERRCODE_GRFILTER_FILTERERROR;
                     }
                 }
                 break;
@@ -1811,7 +1811,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
                 {
                     GDIMetaFile aMtf;
                     if( !SgfVectFilter( rIStream, aMtf ) )
-                        nStatus = GRFILTER_FILTERERROR;
+                        nStatus = ERRCODE_GRFILTER_FILTERERROR;
                     else
                         rGraphic = Graphic( aMtf );
                 }
@@ -1820,14 +1820,14 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
                 case SGF_STARDRAW:
                 {
                     if( nVersion != SGV_VERSION )
-                        nStatus = GRFILTER_VERSIONERROR;
+                        nStatus = ERRCODE_GRFILTER_VERSIONERROR;
                     else
                     {
                         GDIMetaFile aMtf;
                         if( !SgfSDrwFilter( rIStream, aMtf,
                                 INetURLObject(aFilterPath) ) )
                         {
-                            nStatus = GRFILTER_FILTERERROR;
+                            nStatus = ERRCODE_GRFILTER_FILTERERROR;
                         }
                         else
                             rGraphic = Graphic( aMtf );
@@ -1837,7 +1837,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
 
                 default:
                 {
-                    nStatus = GRFILTER_FORMATERROR;
+                    nStatus = ERRCODE_GRFILTER_FORMATERROR;
                 }
                 break;
             }
@@ -1845,12 +1845,12 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
         else if (aFilterName == IMP_PDF)
         {
             if (!vcl::ImportPDF(rIStream, rGraphic))
-                nStatus = GRFILTER_FILTERERROR;
+                nStatus = ERRCODE_GRFILTER_FILTERERROR;
             else
                 eLinkType = GfxLinkType::NativePdf;
         }
         else
-            nStatus = GRFILTER_FILTERERROR;
+            nStatus = ERRCODE_GRFILTER_FILTERERROR;
     }
     else
     {
@@ -1862,13 +1862,13 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
         for( i = 0; ( i < nTokenCount ) && ( pFilter == nullptr ); i++ )
             pFilter = rCache.GetFilter(aFilterPath.getToken(i, ';'), aFilterName, aExternalFilterName);
         if( !pFilter )
-            nStatus = GRFILTER_FILTERERROR;
+            nStatus = ERRCODE_GRFILTER_FILTERERROR;
         else
         {
             PFilterCall pFunc = pFilter->GetImportFunction();
 
             if( !pFunc )
-                nStatus = GRFILTER_FILTERERROR;
+                nStatus = ERRCODE_GRFILTER_FILTERERROR;
             else
             {
                 OUString aShortName;
@@ -1882,7 +1882,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
                     }
                 }
                 if( !(*pFunc)( rIStream, rGraphic, pFilterConfigItem.get() ) )
-                    nStatus = GRFILTER_FORMATERROR;
+                    nStatus = ERRCODE_GRFILTER_FORMATERROR;
                 else
                 {
                     // try to set link type if format matches
@@ -1900,7 +1900,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
         }
     }
 
-    if( nStatus == GRFILTER_OK && bCreateNativeLink && ( eLinkType != GfxLinkType::NONE ) && !rGraphic.GetContext() && !bLinkSet )
+    if( nStatus == ERRCODE_NONE && bCreateNativeLink && ( eLinkType != GfxLinkType::NONE ) && !rGraphic.GetContext() && !bLinkSet )
     {
         if (!pGraphicContent)
         {
@@ -1915,24 +1915,24 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
                 }
                 catch (const std::bad_alloc&)
                 {
-                    nStatus = GRFILTER_TOOBIG;
+                    nStatus = ERRCODE_GRFILTER_TOOBIG;
                 }
 
-                if( nStatus == GRFILTER_OK )
+                if( nStatus == ERRCODE_NONE )
                 {
                     rIStream.Seek(nStreamBegin);
                     rIStream.ReadBytes(pGraphicContent.get(), nGraphicContentSize);
                 }
             }
         }
-        if( nStatus == GRFILTER_OK )
+        if( nStatus == ERRCODE_NONE )
         {
             rGraphic.SetLink( GfxLink( std::move(pGraphicContent), nGraphicContentSize, eLinkType ) );
         }
     }
 
     // Set error code or try to set native buffer
-    if( nStatus != GRFILTER_OK )
+    if( nStatus != ERRCODE_NONE )
     {
         ImplSetError( nStatus, &rIStream );
         rIStream.Seek( nStreamBegin );
@@ -1942,11 +1942,11 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
     return nStatus;
 }
 
-sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const INetURLObject& rPath,
+ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const INetURLObject& rPath,
     sal_uInt16 nFormat, const css::uno::Sequence< css::beans::PropertyValue >* pFilterData )
 {
     SAL_INFO( "vcl.filter", "GraphicFilter::ExportGraphic() (thb)" );
-    sal_uInt16  nRetValue = GRFILTER_FORMATERROR;
+    ErrCode  nRetValue = ERRCODE_GRFILTER_FORMATERROR;
     SAL_WARN_IF( rPath.GetProtocol() == INetProtocol::NotValid, "vcl.filter", "GraphicFilter::ExportGraphic() : ProtType == INetProtocol::NotValid" );
     bool bAlreadyExists = DirEntryExists( rPath );
 
@@ -1957,7 +1957,7 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const INetURLO
         nRetValue = ExportGraphic( rGraphic, aMainUrl, *xStream, nFormat, pFilterData );
         xStream.reset();
 
-        if( ( GRFILTER_OK != nRetValue ) && !bAlreadyExists )
+        if( ( ERRCODE_NONE != nRetValue ) && !bAlreadyExists )
             KillDirEntry( aMainUrl );
     }
     return nRetValue;
@@ -1971,7 +1971,7 @@ extern "C" bool etiGraphicExport( SvStream& rStream, Graphic& rGraphic, FilterCo
 
 #endif
 
-sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& rPath,
+ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& rPath,
     SvStream& rOStm, sal_uInt16 nFormat, const css::uno::Sequence< css::beans::PropertyValue >* pFilterData )
 {
     SAL_INFO( "vcl.filter", "GraphicFilter::ExportGraphic() (thb)" );
@@ -1995,14 +1995,14 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString
         }
     }
     if( nFormat >= nFormatCount )
-        return (sal_uInt16) ImplSetError( GRFILTER_FORMATERROR );
+        return ImplSetError( ERRCODE_GRFILTER_FORMATERROR );
 
     FilterConfigItem aConfigItem( const_cast<css::uno::Sequence< css::beans::PropertyValue >*>(pFilterData) );
     OUString aFilterName( pConfig->GetExportFilterName( nFormat ) );
 #ifndef DISABLE_DYNLOADING
     OUString aExternalFilterName(pConfig->GetExternalFilterName(nFormat, true));
 #endif
-    sal_uInt16      nStatus = GRFILTER_OK;
+    sal_uInt16      nStatus = ERRCODE_NONE;
     GraphicType eType;
     Graphic     aGraphic( rGraphic );
 
@@ -2050,8 +2050,8 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString
         }
     }
     if( rOStm.GetError() )
-        nStatus = GRFILTER_IOERROR;
-    if( GRFILTER_OK == nStatus )
+        nStatus = ERRCODE_GRFILTER_IOERROR;
+    if( ERRCODE_NONE == nStatus )
     {
         if ( pConfig->IsExportInternalFilter( nFormat ) )
         {
@@ -2069,7 +2069,7 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString
                 WriteDIB(aBmp, rOStm, bRleCoding, true);
 
                 if( rOStm.GetError() )
-                    nStatus = GRFILTER_IOERROR;
+                    nStatus = ERRCODE_GRFILTER_IOERROR;
             }
             else if( aFilterName.equalsIgnoreAsciiCase( EXP_SVMETAFILE ) )
             {
@@ -2083,35 +2083,35 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString
                 aMTF.Write( rOStm );
 
                 if( rOStm.GetError() )
-                    nStatus = GRFILTER_IOERROR;
+                    nStatus = ERRCODE_GRFILTER_IOERROR;
             }
             else if ( aFilterName.equalsIgnoreAsciiCase( EXP_WMF ) )
             {
                 // #i119735# just use GetGDIMetaFile, it will create a bufferd version of contained bitmap now automatically
                 if ( !ConvertGDIMetaFileToWMF( aGraphic.GetGDIMetaFile(), rOStm, &aConfigItem ) )
-                    nStatus = GRFILTER_FORMATERROR;
+                    nStatus = ERRCODE_GRFILTER_FORMATERROR;
 
                 if( rOStm.GetError() )
-                    nStatus = GRFILTER_IOERROR;
+                    nStatus = ERRCODE_GRFILTER_IOERROR;
             }
             else if ( aFilterName.equalsIgnoreAsciiCase( EXP_EMF ) )
             {
                 // #i119735# just use GetGDIMetaFile, it will create a bufferd version of contained bitmap now automatically
                 if ( !ConvertGDIMetaFileToEMF(aGraphic.GetGDIMetaFile(), rOStm))
-                    nStatus = GRFILTER_FORMATERROR;
+                    nStatus = ERRCODE_GRFILTER_FORMATERROR;
 
                 if( rOStm.GetError() )
-                    nStatus = GRFILTER_IOERROR;
+                    nStatus = ERRCODE_GRFILTER_IOERROR;
             }
             else if( aFilterName.equalsIgnoreAsciiCase( EXP_JPEG ) )
             {
                 bool bExportedGrayJPEG = false;
                 if( !ExportJPEG( rOStm, aGraphic, pFilterData, &bExportedGrayJPEG ) )
-                    nStatus = GRFILTER_FORMATERROR;
+                    nStatus = ERRCODE_GRFILTER_FORMATERROR;
                 nExpGraphHint = bExportedGrayJPEG ? GRFILTER_OUTHINT_GREY : 0;
 
                 if( rOStm.GetError() )
-                    nStatus = GRFILTER_IOERROR;
+                    nStatus = ERRCODE_GRFILTER_IOERROR;
             }
             else if ( aFilterName.equalsIgnoreAsciiCase( EXP_PNG ) )
             {
@@ -2164,7 +2164,7 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString
                 aPNGWriter.Write( rOStm );
 
                 if( rOStm.GetError() )
-                    nStatus = GRFILTER_IOERROR;
+                    nStatus = ERRCODE_GRFILTER_IOERROR;
             }
             else if( aFilterName.equalsIgnoreAsciiCase( EXP_SVG ) )
             {
@@ -2179,7 +2179,7 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString
 
                     if( rOStm.GetError() )
                     {
-                        nStatus = GRFILTER_IOERROR;
+                        nStatus = ERRCODE_GRFILTER_IOERROR;
                     }
                     else
                     {
@@ -2225,12 +2225,12 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString
                     }
                     catch(const css::uno::Exception&)
                     {
-                        nStatus = GRFILTER_IOERROR;
+                        nStatus = ERRCODE_GRFILTER_IOERROR;
                     }
                 }
             }
             else
-                nStatus = GRFILTER_FILTERERROR;
+                nStatus = ERRCODE_GRFILTER_FILTERERROR;
         }
         else
         {
@@ -2261,15 +2261,15 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString
                 if( pFunc )
                 {
                     if ( !(*pFunc)( rOStm, aGraphic, &aConfigItem ) )
-                        nStatus = GRFILTER_FORMATERROR;
+                        nStatus = ERRCODE_GRFILTER_FORMATERROR;
                     break;
                 }
                 else
-                    nStatus = GRFILTER_FILTERERROR;
+                    nStatus = ERRCODE_GRFILTER_FILTERERROR;
             }
         }
     }
-    if( nStatus != GRFILTER_OK )
+    if( nStatus != ERRCODE_NONE )
     {
         ImplSetError( nStatus, &rOStm );
     }
@@ -2371,7 +2371,7 @@ int GraphicFilter::LoadGraphic( const OUString &rPath, const OUString &rFilterNa
         pStream = ::utl::UcbStreamHelper::CreateStream( rPath, StreamMode::READ );
     }
 
-    int nRes = GRFILTER_OK;
+    ErrCode nRes = ERRCODE_NONE;
     if ( !pStream )
         nRes = pFilter->ImportGraphic( rGraphic, aURL, nFilter, pDeterminedFormat );
     else
@@ -2382,25 +2382,25 @@ int GraphicFilter::LoadGraphic( const OUString &rPath, const OUString &rFilterNa
 
     switch (nRes)
     {
-        case GRFILTER_OPENERROR:
+        case ERRCODE_GRFILTER_OPENERROR:
             aReturnString="open error";
             break;
-        case GRFILTER_IOERROR:
+        case ERRCODE_GRFILTER_IOERROR:
             aReturnString="IO error";
             break;
-        case GRFILTER_FORMATERROR:
+        case ERRCODE_GRFILTER_FORMATERROR:
             aReturnString="format error";
             break;
-        case GRFILTER_VERSIONERROR:
+        case ERRCODE_GRFILTER_VERSIONERROR:
             aReturnString="version error";
             break;
-        case GRFILTER_FILTERERROR:
+        case ERRCODE_GRFILTER_FILTERERROR:
             aReturnString="filter error";
             break;
-        case GRFILTER_ABORT:
+        case ERRCODE_GRFILTER_ABORT:
             aReturnString="import aborted";
             break;
-        case GRFILTER_TOOBIG:
+        case ERRCODE_GRFILTER_TOOBIG:
             aReturnString="graphic is too big";
             break;
         default:
diff --git a/vcl/source/image/Image.cxx b/vcl/source/image/Image.cxx
index 9f6e764870b3..2a81e8a59f02 100644
--- a/vcl/source/image/Image.cxx
+++ b/vcl/source/image/Image.cxx
@@ -58,7 +58,7 @@ Image::Image(const OUString & rFileUrl)
     osl::FileBase::getSystemPathFromFileURL(rFileUrl, aPath);
     Graphic aGraphic;
     const OUString aFilterName(IMP_PNG);
-    if (GRFILTER_OK == GraphicFilter::LoadGraphic(aPath, aFilterName, aGraphic))
+    if (ERRCODE_NONE == GraphicFilter::LoadGraphic(aPath, aFilterName, aGraphic))
     {
         ImplInit(aGraphic.GetBitmapEx());
     }
diff --git a/xmlsecurity/workben/pdfverify.cxx b/xmlsecurity/workben/pdfverify.cxx
index 7b64e42c2a49..7b369709201c 100644
--- a/xmlsecurity/workben/pdfverify.cxx
+++ b/xmlsecurity/workben/pdfverify.cxx
@@ -38,7 +38,7 @@ void generatePreview(const OString& rPdfPath, const OString& rPngPath)
     osl::FileBase::getFileURLFromSystemPath(OUString::fromUtf8(rPdfPath), aInURL);
     SvFileStream aInStream(aInURL, StreamMode::READ);
     WMF_EXTERNALHEADER* pExtHeader = nullptr;
-    if (rFilter.ImportGraphic(aGraphic, OUString(), aInStream, GRFILTER_FORMAT_DONTKNOW, nullptr, GraphicFilterImportFlags::NONE, pExtHeader) != GRFILTER_OK)
+    if (rFilter.ImportGraphic(aGraphic, OUString(), aInStream, GRFILTER_FORMAT_DONTKNOW, nullptr, GraphicFilterImportFlags::NONE, pExtHeader) != ERRCODE_NONE)
         return;
 
     BitmapEx aBitmapEx = aGraphic.GetBitmapEx();


More information about the Libreoffice-commits mailing list