summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'vcl')
-rw-r--r--vcl/qa/cppunit/errorhandler.cxx6
-rw-r--r--vcl/qa/cppunit/jpeg/JpegReaderTest.cxx4
-rw-r--r--vcl/source/filter/graphicfilter.cxx47
-rw-r--r--vcl/source/filter/graphicfilter2.cxx2
-rw-r--r--vcl/source/gdi/cvtgrf.cxx8
-rw-r--r--vcl/source/gdi/impgraph.cxx2
-rw-r--r--vcl/source/gdi/print.cxx4
-rw-r--r--vcl/source/window/errinf.cxx32
8 files changed, 46 insertions, 59 deletions
diff --git a/vcl/qa/cppunit/errorhandler.cxx b/vcl/qa/cppunit/errorhandler.cxx
index fc06ec1869d2..f59abb0f9a96 100644
--- a/vcl/qa/cppunit/errorhandler.cxx
+++ b/vcl/qa/cppunit/errorhandler.cxx
@@ -20,10 +20,10 @@ class MockErrorHandler : private ErrorHandler
protected:
virtual bool CreateString(const ErrorInfo *pErrInfo, OUString &rErrString) const override
{
- if (!(pErrInfo->GetErrorCode() & ERRCODE_DYNAMIC_MASK))
- rErrString = "Non-dynamic error";
- else
+ if (pErrInfo->GetErrorCode().IsDynamic())
rErrString = "Dynamic error";
+ else
+ rErrString = "Non-dynamic error";
return true;
}
diff --git a/vcl/qa/cppunit/jpeg/JpegReaderTest.cxx b/vcl/qa/cppunit/jpeg/JpegReaderTest.cxx
index 127de3c9f0e0..024316c9e739 100644
--- a/vcl/qa/cppunit/jpeg/JpegReaderTest.cxx
+++ b/vcl/qa/cppunit/jpeg/JpegReaderTest.cxx
@@ -96,8 +96,8 @@ Bitmap JpegReaderTest::loadJPG(const OUString& aURL)
GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
Graphic aGraphic;
SvFileStream aFileStream(aURL, StreamMode::READ);
- sal_uInt16 bResult = rFilter.ImportGraphic(aGraphic, aURL, aFileStream);
- CPPUNIT_ASSERT_EQUAL(sal_uInt16(0), bResult);
+ ErrCode bResult = rFilter.ImportGraphic(aGraphic, aURL, aFileStream);
+ CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, bResult);
return aGraphic.GetBitmapEx().GetBitmap();
}
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 0314d3d8ac34..69ac5b1cc527 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -1156,7 +1156,7 @@ void GraphicFilter::ImplInit()
pErrorEx = new FilterErrorEx;
}
-sal_uLong GraphicFilter::ImplSetError( sal_uLong nError, const SvStream* pStm )
+ErrCode GraphicFilter::ImplSetError( ErrCode nError, const SvStream* pStm )
{
pErrorEx->nStreamError = pStm ? pStm->GetError() : ERRCODE_NONE;
return nError;
@@ -1279,11 +1279,11 @@ ErrCode GraphicFilter::CanImportGraphic( const INetURLObject& rPath,
return nRetValue;
}
-sal_uInt16 GraphicFilter::CanImportGraphic( const OUString& rMainUrl, SvStream& rIStream,
+ErrCode GraphicFilter::CanImportGraphic( const OUString& rMainUrl, SvStream& rIStream,
sal_uInt16 nFormat, sal_uInt16* pDeterminedFormat )
{
sal_uLong nStreamPos = rIStream.Tell();
- sal_uInt16 nRes = ImpTestOrFindFormat( rMainUrl, rIStream, nFormat );
+ ErrCode nRes = ImpTestOrFindFormat( rMainUrl, rIStream, nFormat );
rIStream.Seek(nStreamPos);
@@ -1309,7 +1309,7 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const INetURLObject& rP
return nRetValue;
}
-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, WMF_EXTERNALHEADER *pExtHeader )
{
return ImportGraphic( rGraphic, rPath, rIStream, nFormat, pDeterminedFormat, nImportFlags, nullptr, pExtHeader );
@@ -1999,7 +1999,7 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r
#ifndef DISABLE_DYNLOADING
OUString aExternalFilterName(pConfig->GetExternalFilterName(nFormat, true));
#endif
- sal_uInt16 nStatus = ERRCODE_NONE;
+ ErrCode nStatus = ERRCODE_NONE;
GraphicType eType;
Graphic aGraphic( rGraphic );
@@ -2275,7 +2275,7 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r
void GraphicFilter::ResetLastError()
{
- pErrorEx->nStreamError = 0UL;
+ pErrorEx->nStreamError = ERRCODE_NONE;
}
const Link<ConvertData&,bool> GraphicFilter::GetFilterCallback() const
@@ -2311,13 +2311,13 @@ IMPL_LINK( GraphicFilter, FilterCallback, ConvertData&, rData, bool )
{
// Import
nFormat = GetImportFormatNumberForShortName( OStringToOUString( aShortName, RTL_TEXTENCODING_UTF8) );
- bRet = ImportGraphic( rData.maGraphic, OUString(), rData.mrStm, nFormat ) == 0;
+ bRet = ImportGraphic( rData.maGraphic, OUString(), rData.mrStm, nFormat ) == ERRCODE_NONE;
}
else if( !aShortName.isEmpty() )
{
// Export
nFormat = GetExportFormatNumberForShortName( OStringToOUString(aShortName, RTL_TEXTENCODING_UTF8) );
- bRet = ExportGraphic( rData.maGraphic, OUString(), rData.mrStm, nFormat ) == 0;
+ bRet = ExportGraphic( rData.maGraphic, OUString(), rData.mrStm, nFormat ) == ERRCODE_NONE;
}
return bRet;
@@ -2343,7 +2343,7 @@ GraphicFilter& GraphicFilter::GetGraphicFilter()
return theGraphicFilter::get().m_aFilter;
}
-int GraphicFilter::LoadGraphic( const OUString &rPath, const OUString &rFilterName,
+ErrCode GraphicFilter::LoadGraphic( const OUString &rPath, const OUString &rFilterName,
Graphic& rGraphic, GraphicFilter* pFilter,
sal_uInt16* pDeterminedFormat )
{
@@ -2376,33 +2376,20 @@ int GraphicFilter::LoadGraphic( const OUString &rPath, const OUString &rFilterNa
#ifdef DBG_UTIL
OUString aReturnString;
- switch (nRes)
- {
- case ERRCODE_GRFILTER_OPENERROR:
+ if (nRes == ERRCODE_GRFILTER_OPENERROR)
aReturnString="open error";
- break;
- case ERRCODE_GRFILTER_IOERROR:
+ else if (nRes == ERRCODE_GRFILTER_IOERROR)
aReturnString="IO error";
- break;
- case ERRCODE_GRFILTER_FORMATERROR:
+ else if (nRes == ERRCODE_GRFILTER_FORMATERROR)
aReturnString="format error";
- break;
- case ERRCODE_GRFILTER_VERSIONERROR:
+ else if (nRes == ERRCODE_GRFILTER_VERSIONERROR)
aReturnString="version error";
- break;
- case ERRCODE_GRFILTER_FILTERERROR:
+ else if (nRes == ERRCODE_GRFILTER_FILTERERROR)
aReturnString="filter error";
- break;
- case ERRCODE_GRFILTER_ABORT:
+ else if (nRes == ERRCODE_GRFILTER_ABORT)
aReturnString="import aborted";
- break;
- case ERRCODE_GRFILTER_TOOBIG:
+ else if (nRes == ERRCODE_GRFILTER_TOOBIG)
aReturnString="graphic is too big";
- break;
- default:
- // nothing more to do
- break;
- }
SAL_INFO_IF( nRes, "vcl.filter", "Problem importing graphic " << rPath << ". Reason: " << aReturnString );
#endif
@@ -2410,7 +2397,7 @@ int GraphicFilter::LoadGraphic( const OUString &rPath, const OUString &rFilterNa
return nRes;
}
-sal_uInt16 GraphicFilter::compressAsPNG(const Graphic& rGraphic, SvStream& rOutputStream)
+ErrCode GraphicFilter::compressAsPNG(const Graphic& rGraphic, SvStream& rOutputStream)
{
css::uno::Sequence< css::beans::PropertyValue > aFilterData(1);
aFilterData[0].Name = "Compression";
diff --git a/vcl/source/filter/graphicfilter2.cxx b/vcl/source/filter/graphicfilter2.cxx
index 121d9690a861..377111166f25 100644
--- a/vcl/source/filter/graphicfilter2.cxx
+++ b/vcl/source/filter/graphicfilter2.cxx
@@ -260,7 +260,7 @@ bool GraphicDescriptor::ImpDetectJPG( SvStream& rStm, bool bExtendedInfo )
{
rStm.SeekRel( -2 );
- sal_uInt32 nError( rStm.GetError() );
+ ErrCode nError( rStm.GetError() );
bool bScanFailure = false;
bool bScanFinished = false;
diff --git a/vcl/source/gdi/cvtgrf.cxx b/vcl/source/gdi/cvtgrf.cxx
index d803813ac919..50204c1d5666 100644
--- a/vcl/source/gdi/cvtgrf.cxx
+++ b/vcl/source/gdi/cvtgrf.cxx
@@ -32,10 +32,10 @@ GraphicConverter::~GraphicConverter()
{
}
-sal_uLong GraphicConverter::Import( SvStream& rIStm, Graphic& rGraphic, ConvertDataFormat nFormat )
+ErrCode GraphicConverter::Import( SvStream& rIStm, Graphic& rGraphic, ConvertDataFormat nFormat )
{
GraphicConverter* pCvt = ImplGetSVData()->maGDIData.mpGrfConverter;
- sal_uLong nRet = ERRCODE_IO_GENERAL;
+ ErrCode nRet = ERRCODE_IO_GENERAL;
if( pCvt && pCvt->GetFilterHdl().IsSet() )
{
@@ -53,10 +53,10 @@ sal_uLong GraphicConverter::Import( SvStream& rIStm, Graphic& rGraphic, ConvertD
return nRet;
}
-sal_uLong GraphicConverter::Export( SvStream& rOStm, const Graphic& rGraphic, ConvertDataFormat nFormat )
+ErrCode GraphicConverter::Export( SvStream& rOStm, const Graphic& rGraphic, ConvertDataFormat nFormat )
{
GraphicConverter* pCvt = ImplGetSVData()->maGDIData.mpGrfConverter;
- sal_uLong nRet = ERRCODE_IO_GENERAL;
+ ErrCode nRet = ERRCODE_IO_GENERAL;
if( pCvt && pCvt->GetFilterHdl().IsSet() )
{
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index caed1663c776..f5f05e06f1a8 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1509,7 +1509,7 @@ void ReadImpGraphic( SvStream& rIStm, ImpGraphic& rImpGraphic )
}
else
{
- sal_uInt32 nOrigError = rIStm.GetErrorCode();
+ ErrCode nOrigError = rIStm.GetErrorCode();
// try to stream in Svg defining data (length, byte array and evtl. path)
// See below (operator<<) for more information
const sal_uInt32 nSvgMagic((sal_uInt32('s') << 24) | (sal_uInt32('v') << 16) | (sal_uInt32('g') << 8) | sal_uInt32('0'));
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index cb53eb66a005..85c35dc3e0cb 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -1607,9 +1607,9 @@ bool Printer::SetCopyCount( sal_uInt16 nCopy, bool bCollate )
return true;
}
-sal_uLong Printer::ImplSalPrinterErrorCodeToVCL( sal_uLong nError )
+ErrCode Printer::ImplSalPrinterErrorCodeToVCL( sal_uLong nError )
{
- sal_uLong nVCLError;
+ ErrCode nVCLError;
switch ( nError )
{
case 0:
diff --git a/vcl/source/window/errinf.cxx b/vcl/source/window/errinf.cxx
index 06b004b6e2fd..7c1fe5e654d5 100644
--- a/vcl/source/window/errinf.cxx
+++ b/vcl/source/window/errinf.cxx
@@ -93,7 +93,7 @@ ErrorHandler::~ErrorHandler()
rErrorHandlers.end());
}
-bool ErrorHandler::GetErrorString(sal_uInt32 nErrCodeId, OUString& rErrStr)
+bool ErrorHandler::GetErrorString(ErrCode nErrCodeId, OUString& rErrStr)
{
OUString aErr;
@@ -112,7 +112,7 @@ bool ErrorHandler::GetErrorString(sal_uInt32 nErrCodeId, OUString& rErrStr)
return false;
}
-DialogMask ErrorHandler::HandleError(sal_uInt32 nErrCodeId, DialogMask nFlags)
+DialogMask ErrorHandler::HandleError(ErrCode nErrCodeId, DialogMask nFlags)
{
if (nErrCodeId == ERRCODE_NONE || nErrCodeId == ERRCODE_ABORT)
return DialogMask::NONE;
@@ -136,7 +136,7 @@ DialogMask ErrorHandler::HandleError(sal_uInt32 nErrCodeId, DialogMask nFlags)
}
}
- bool bWarning = ((nErrCodeId & ERRCODE_WARNING_MASK) == ERRCODE_WARNING_MASK);
+ bool bWarning = nErrCodeId.IsWarning();
DialogMask nErrFlags = DialogMask::ButtonDefaultsOk | DialogMask::ButtonsOk;
if (bWarning)
nErrFlags |= DialogMask::MessageWarning;
@@ -229,7 +229,7 @@ class ImplDynamicErrorInfo
private:
void RegisterError(DynamicErrorInfo *);
static void UnRegisterError(DynamicErrorInfo const *);
- static ErrorInfo* GetDynamicErrorInfo(sal_uInt32 nId);
+ static ErrorInfo* GetDynamicErrorInfo(ErrCode nId);
ErrCode nErrId;
DialogMask nMask;
@@ -240,8 +240,8 @@ void ImplDynamicErrorInfo::RegisterError(DynamicErrorInfo *pDynErrInfo)
{
// Register dynamic identifier
ErrorRegistry& rData = TheErrorRegistry::get();
- nErrId = (((sal_uInt32)rData.nNextError + 1) << ERRCODE_DYNAMIC_SHIFT) +
- pDynErrInfo->GetErrorCode();
+ nErrId = ErrCode(((sal_uInt32(rData.nNextError) + 1) << ERRCODE_DYNAMIC_SHIFT) +
+ sal_uInt32(pDynErrInfo->GetErrorCode()));
if(rData.ppDynErrInfo[rData.nNextError])
delete rData.ppDynErrInfo[rData.nNextError];
@@ -255,27 +255,27 @@ void ImplDynamicErrorInfo::RegisterError(DynamicErrorInfo *pDynErrInfo)
void ImplDynamicErrorInfo::UnRegisterError(DynamicErrorInfo const *pDynErrInfo)
{
DynamicErrorInfo **ppDynErrInfo = TheErrorRegistry::get().ppDynErrInfo;
- sal_uInt32 nIdx = (((sal_uInt32)(*pDynErrInfo) & ERRCODE_DYNAMIC_MASK) >> ERRCODE_DYNAMIC_SHIFT) - 1;
+ sal_uInt32 nIdx = ErrCode(*pDynErrInfo).GetDynamic() - 1;
DBG_ASSERT(ppDynErrInfo[nIdx] == pDynErrInfo, "ErrHdl: Error not found");
if(ppDynErrInfo[nIdx]==pDynErrInfo)
ppDynErrInfo[nIdx]=nullptr;
}
-ErrorInfo* ImplDynamicErrorInfo::GetDynamicErrorInfo(sal_uInt32 nId)
+ErrorInfo* ImplDynamicErrorInfo::GetDynamicErrorInfo(ErrCode nId)
{
- sal_uInt32 nIdx = ((nId & ERRCODE_DYNAMIC_MASK)>>ERRCODE_DYNAMIC_SHIFT)-1;
+ sal_uInt32 nIdx = nId.GetDynamic() - 1;
DynamicErrorInfo* pDynErrInfo = TheErrorRegistry::get().ppDynErrInfo[nIdx];
- if(pDynErrInfo && (sal_uInt32)(*pDynErrInfo)==nId)
+ if(pDynErrInfo && ErrCode(*pDynErrInfo)==nId)
return pDynErrInfo;
else
- return new ErrorInfo(nId & ~ERRCODE_DYNAMIC_MASK);
+ return new ErrorInfo(nId.StripDynamic());
}
-ErrorInfo *ErrorInfo::GetErrorInfo(sal_uInt32 nId)
+ErrorInfo *ErrorInfo::GetErrorInfo(ErrCode nId)
{
- if(nId & ERRCODE_DYNAMIC_MASK)
+ if(nId.IsDynamic())
return ImplDynamicErrorInfo::GetDynamicErrorInfo(nId);
else
return new ErrorInfo(nId);
@@ -285,7 +285,7 @@ ErrorInfo::~ErrorInfo()
{
}
-DynamicErrorInfo::DynamicErrorInfo(sal_uInt32 nArgUserId, DialogMask nMask)
+DynamicErrorInfo::DynamicErrorInfo(ErrCode nArgUserId, DialogMask nMask)
: ErrorInfo(nArgUserId),
pImpl(new ImplDynamicErrorInfo)
{
@@ -298,7 +298,7 @@ DynamicErrorInfo::~DynamicErrorInfo()
ImplDynamicErrorInfo::UnRegisterError(this);
}
-DynamicErrorInfo::operator sal_uInt32() const
+DynamicErrorInfo::operator ErrCode() const
{
return pImpl->nErrId;
}
@@ -309,7 +309,7 @@ DialogMask DynamicErrorInfo::GetDialogMask() const
}
StringErrorInfo::StringErrorInfo(
- sal_uInt32 nArgUserId, const OUString& aStringP, DialogMask nMask)
+ ErrCode nArgUserId, const OUString& aStringP, DialogMask nMask)
: DynamicErrorInfo(nArgUserId, nMask), aString(aStringP)
{
}