diff options
233 files changed, 1533 insertions, 1597 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index 9219cde9e7cf..0c9568f9eadf 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -425,7 +425,7 @@ void ModulWindow::LoadBasic() GetEditorWindow().Update(); GetEditorWindow().ForceSyntaxTimeout(); GetEditorWindow().DestroyProgress(); - sal_uLong nError = aMedium.GetError(); + ErrCode nError = aMedium.GetError(); if ( nError ) ErrorHandler::HandleError( nError ); } @@ -466,7 +466,7 @@ void ModulWindow::SaveBasicSource() GetEditEngine()->Write( *pStream ); aMedium.Commit(); LeaveWait(); - sal_uLong nError = aMedium.GetError(); + ErrCode nError = aMedium.GetError(); if ( nError ) ErrorHandler::HandleError( nError ); } diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index e66cf58edf4a..47d09e629a44 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -318,7 +318,7 @@ void SAL_CALL BasMgrContainerListenerImpl::elementRemoved( const container::Cont } } -BasicError::BasicError( sal_uInt64 nId, BasicErrorReason nR ) +BasicError::BasicError( ErrCode nId, BasicErrorReason nR ) { nErrorId = nId; nReason = nR; diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 9e6e32a0d02a..af541630b8de 100644 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -401,7 +401,7 @@ const SFX_VB_ErrorItem SFX_VB_ErrorTab[] = { 1005, ERRCODE_BASIC_SETPROP_FAILED }, { 1006, ERRCODE_BASIC_GETPROP_FAILED }, { 1007, ERRCODE_BASIC_COMPAT }, - { 0xFFFF, 0xFFFFFFFFL } // End mark + { 0xFFFF, ErrCode(0xFFFFFFFFUL) } // End mark }; // The StarBASIC factory is a hack. When a SbModule is created, its pointer @@ -1429,7 +1429,7 @@ SbModule* StarBASIC::GetActiveModule() BasicDebugFlags StarBASIC::BreakPoint( sal_Int32 l, sal_Int32 c1, sal_Int32 c2 ) { - SetErrorData( 0, l, c1, c2 ); + SetErrorData( ERRCODE_NONE, l, c1, c2 ); bBreak = true; if( GetSbData()->aBreakHdl.IsSet() ) { @@ -1443,7 +1443,7 @@ BasicDebugFlags StarBASIC::BreakPoint( sal_Int32 l, sal_Int32 c1, sal_Int32 c2 ) BasicDebugFlags StarBASIC::StepPoint( sal_Int32 l, sal_Int32 c1, sal_Int32 c2 ) { - SetErrorData( 0, l, c1, c2 ); + SetErrorData( ERRCODE_NONE, l, c1, c2 ); bBreak = false; if( GetSbData()->aBreakHdl.IsSet() ) { @@ -1483,23 +1483,20 @@ sal_uInt16 StarBASIC::GetVBErrorCode( ErrCode nError ) if( SbiRuntime::isVBAEnabled() ) { - switch( nError ) - { - case ERRCODE_BASIC_ARRAY_FIX: + if ( nError == ERRCODE_BASIC_ARRAY_FIX ) return 10; - case ERRCODE_BASIC_STRING_OVERFLOW: + else if ( nError == ERRCODE_BASIC_STRING_OVERFLOW ) return 14; - case ERRCODE_BASIC_EXPR_TOO_COMPLEX: + else if ( nError == ERRCODE_BASIC_EXPR_TOO_COMPLEX ) return 16; - case ERRCODE_BASIC_OPER_NOT_PERFORM: + else if ( nError == ERRCODE_BASIC_OPER_NOT_PERFORM ) return 17; - case ERRCODE_BASIC_TOO_MANY_DLL: + else if ( nError == ERRCODE_BASIC_TOO_MANY_DLL ) return 47; - case ERRCODE_BASIC_LOOP_NOT_INIT: + else if ( nError == ERRCODE_BASIC_LOOP_NOT_INIT ) return 92; - default: + else nRet = 0; - } } // search loop @@ -1521,7 +1518,7 @@ sal_uInt16 StarBASIC::GetVBErrorCode( ErrCode nError ) ErrCode StarBASIC::GetSfxFromVBError( sal_uInt16 nError ) { - ErrCode nRet = 0; + ErrCode nRet = ERRCODE_NONE; if( SbiRuntime::isVBAEnabled() ) { @@ -1533,7 +1530,7 @@ ErrCode StarBASIC::GetSfxFromVBError( sal_uInt16 nError ) case 8: case 12: case 73: - return 0; + return ERRCODE_NONE; case 10: return ERRCODE_BASIC_ARRAY_FIX; case 14: @@ -1547,7 +1544,7 @@ ErrCode StarBASIC::GetSfxFromVBError( sal_uInt16 nError ) case 92: return ERRCODE_BASIC_LOOP_NOT_INIT; default: - nRet = 0; + nRet = ERRCODE_NONE; } } const SFX_VB_ErrorItem* pErrItem; @@ -1588,7 +1585,7 @@ void StarBASIC::MakeErrorText( ErrCode nId, const OUString& aMsg ) // instantiate the help class ResStringArray aMyStringList(BasResId(RID_BASIC_START)); - sal_uInt32 nErrIdx = aMyStringList.FindIndex(sal_uInt16(nId & ERRCODE_RES_MASK)); + sal_uInt32 nErrIdx = aMyStringList.FindIndex(nId.GetRest()); if (nErrIdx != RESARRAY_INDEX_NOTFOUND) { // merge message with additional text @@ -1643,7 +1640,7 @@ bool StarBASIC::CError( ErrCode code, const OUString& rMsg, // Implementation of the code for the string transport to SFX-Error if( !rMsg.isEmpty() ) { - code = (ErrCode)*new StringErrorInfo( code, rMsg ); + code = *new StringErrorInfo( code, rMsg ); } SetErrorData( code, l, c1, c2 ); GetSbData()->bCompilerError = true; @@ -1665,9 +1662,9 @@ bool StarBASIC::RTError( ErrCode code, const OUString& rMsg, sal_Int32 l, sal_In SolarMutexGuard aSolarGuard; ErrCode c = code; - if( (c & ERRCODE_CLASS_MASK) == ERRCODE_CLASS_COMPILER ) + if( c.GetClass() == ERRCODE_CLASS_COMPILER ) { - c = 0; + c = ERRCODE_NONE; } MakeErrorText( c, rMsg ); @@ -1682,11 +1679,11 @@ bool StarBASIC::RTError( ErrCode code, const OUString& rMsg, sal_Int32 l, sal_In { OUString aTmp = "\'" + OUString::number(SbxErrObject::getUnoErrObject()->getNumber()) + "\'\n" + (!GetSbData()->aErrMsg.isEmpty() ? GetSbData()->aErrMsg : rMsg); - code = (ErrCode)*new StringErrorInfo( code, aTmp ); + code = *new StringErrorInfo( code, aTmp ); } else { - code = (ErrCode)*new StringErrorInfo( code, rMsg ); + code = *new StringErrorInfo( code, rMsg ); } } @@ -1738,7 +1735,7 @@ ErrCode StarBASIC::GetErrBasic() } else { - return 0; + return ERRCODE_NONE; } } diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx index e906cfb19c52..48072debbd15 100644 --- a/basic/source/comp/scanner.cxx +++ b/basic/source/comp/scanner.cxx @@ -85,15 +85,14 @@ void SbiScanner::GenError( ErrCode code ) // in case of EXPECTED or UNEXPECTED it always refers // to the last token, so take the Col1 over sal_Int32 nc = nColLock ? nSavedCol1 : nCol1; - switch( code ) + if ( code.anyOf( + ERRCODE_BASIC_EXPECTED, + ERRCODE_BASIC_UNEXPECTED, + ERRCODE_BASIC_SYMBOL_EXPECTED, + ERRCODE_BASIC_LABEL_EXPECTED) ) { - case ERRCODE_BASIC_EXPECTED: - case ERRCODE_BASIC_UNEXPECTED: - case ERRCODE_BASIC_SYMBOL_EXPECTED: - case ERRCODE_BASIC_LABEL_EXPECTED: nc = nCol1; if( nc > nCol2 ) nCol2 = nc; - break; } bRes = pBasic->CError( code, aError, nLine, nc, nCol2 ); } diff --git a/basic/source/runtime/ddectrl.cxx b/basic/source/runtime/ddectrl.cxx index 3c77fcbe26c0..adb2e7aebf2d 100644 --- a/basic/source/runtime/ddectrl.cxx +++ b/basic/source/runtime/ddectrl.cxx @@ -29,36 +29,36 @@ static const ErrCode nDdeErrMap[] = { - /* DMLERR_ADVACKTIMEOUT */ 0x4000, ERRCODE_BASIC_DDE_TIMEOUT, - /* DMLERR_BUSY */ 0x4001, ERRCODE_BASIC_DDE_BUSY, - /* DMLERR_DATAACKTIMEOUT */ 0x4002, ERRCODE_BASIC_DDE_TIMEOUT, - /* DMLERR_DLL_NOT_INITIALIZED */ 0x4003, ERRCODE_BASIC_DDE_ERROR, - /* DMLERR_DLL_USAGE */ 0x4004, ERRCODE_BASIC_DDE_ERROR, - /* DMLERR_EXECACKTIMEOUT */ 0x4005, ERRCODE_BASIC_DDE_TIMEOUT, - /* DMLERR_INVALIDPARAMETER */ 0x4006, ERRCODE_BASIC_DDE_ERROR, - /* DMLERR_LOW_MEMORY */ 0x4007, ERRCODE_BASIC_DDE_ERROR, - /* DMLERR_MEMORY_ERROR */ 0x4008, ERRCODE_BASIC_DDE_ERROR, - /* DMLERR_NOTPROCESSED */ 0x4009, ERRCODE_BASIC_DDE_NOTPROCESSED, - /* DMLERR_NO_CONV_ESTABLISHED */ 0x400a, ERRCODE_BASIC_DDE_NO_CHANNEL, - /* DMLERR_POKEACKTIMEOUT */ 0x400b, ERRCODE_BASIC_DDE_TIMEOUT, - /* DMLERR_POSTMSG_FAILED */ 0x400c, ERRCODE_BASIC_DDE_QUEUE_OVERFLOW, - /* DMLERR_REENTRANCY */ 0x400d, ERRCODE_BASIC_DDE_ERROR, - /* DMLERR_SERVER_DIED */ 0x400e, ERRCODE_BASIC_DDE_PARTNER_QUIT, - /* DMLERR_SYS_ERROR */ 0x400f, ERRCODE_BASIC_DDE_ERROR, - /* DMLERR_UNADVACKTIMEOUT */ 0x4010, ERRCODE_BASIC_DDE_TIMEOUT, - /* DMLERR_UNFOUND_QUEUE_ID */ 0x4011, ERRCODE_BASIC_DDE_NO_CHANNEL + /* DMLERR_ADVACKTIMEOUT */ ErrCode(0x4000), ERRCODE_BASIC_DDE_TIMEOUT, + /* DMLERR_BUSY */ ErrCode(0x4001), ERRCODE_BASIC_DDE_BUSY, + /* DMLERR_DATAACKTIMEOUT */ ErrCode(0x4002), ERRCODE_BASIC_DDE_TIMEOUT, + /* DMLERR_DLL_NOT_INITIALIZED */ ErrCode(0x4003), ERRCODE_BASIC_DDE_ERROR, + /* DMLERR_DLL_USAGE */ ErrCode(0x4004), ERRCODE_BASIC_DDE_ERROR, + /* DMLERR_EXECACKTIMEOUT */ ErrCode(0x4005), ERRCODE_BASIC_DDE_TIMEOUT, + /* DMLERR_INVALIDPARAMETER */ ErrCode(0x4006), ERRCODE_BASIC_DDE_ERROR, + /* DMLERR_LOW_MEMORY */ ErrCode(0x4007), ERRCODE_BASIC_DDE_ERROR, + /* DMLERR_MEMORY_ERROR */ ErrCode(0x4008), ERRCODE_BASIC_DDE_ERROR, + /* DMLERR_NOTPROCESSED */ ErrCode(0x4009), ERRCODE_BASIC_DDE_NOTPROCESSED, + /* DMLERR_NO_CONV_ESTABLISHED */ ErrCode(0x400a), ERRCODE_BASIC_DDE_NO_CHANNEL, + /* DMLERR_POKEACKTIMEOUT */ ErrCode(0x400b), ERRCODE_BASIC_DDE_TIMEOUT, + /* DMLERR_POSTMSG_FAILED */ ErrCode(0x400c), ERRCODE_BASIC_DDE_QUEUE_OVERFLOW, + /* DMLERR_REENTRANCY */ ErrCode(0x400d), ERRCODE_BASIC_DDE_ERROR, + /* DMLERR_SERVER_DIED */ ErrCode(0x400e), ERRCODE_BASIC_DDE_PARTNER_QUIT, + /* DMLERR_SYS_ERROR */ ErrCode(0x400f), ERRCODE_BASIC_DDE_ERROR, + /* DMLERR_UNADVACKTIMEOUT */ ErrCode(0x4010), ERRCODE_BASIC_DDE_TIMEOUT, + /* DMLERR_UNFOUND_QUEUE_ID */ ErrCode(0x4011), ERRCODE_BASIC_DDE_NO_CHANNEL }; ErrCode SbiDdeControl::GetLastErr( DdeConnection* pConv ) { if( !pConv ) { - return 0; + return ERRCODE_NONE; } long nErr = pConv->GetError(); if( !nErr ) { - return 0; + return ERRCODE_NONE; } if( nErr < DDE_FIRSTERR || nErr > DDE_LASTERR ) { diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx index 472c4321e0ec..fca1a1c17cc7 100644 --- a/basic/source/runtime/iosys.cxx +++ b/basic/source/runtime/iosys.cxx @@ -141,33 +141,23 @@ void SbiStream::MapError() { if( pStrm ) { - switch( pStrm->GetError() ) - { - case ERRCODE_NONE: - nError = 0; - break; - case SVSTREAM_FILE_NOT_FOUND: + ErrCode nEC = pStrm->GetError(); + if (nEC == ERRCODE_NONE) + nError = ERRCODE_NONE; + else if (nEC == SVSTREAM_FILE_NOT_FOUND) nError = ERRCODE_BASIC_FILE_NOT_FOUND; - break; - case SVSTREAM_PATH_NOT_FOUND: + else if (nEC ==SVSTREAM_PATH_NOT_FOUND) nError = ERRCODE_BASIC_PATH_NOT_FOUND; - break; - case SVSTREAM_TOO_MANY_OPEN_FILES: + else if (nEC ==SVSTREAM_TOO_MANY_OPEN_FILES) nError = ERRCODE_BASIC_TOO_MANY_FILES; - break; - case SVSTREAM_ACCESS_DENIED: + else if (nEC ==SVSTREAM_ACCESS_DENIED) nError = ERRCODE_BASIC_ACCESS_DENIED; - break; - case SVSTREAM_INVALID_PARAMETER: + else if (nEC ==SVSTREAM_INVALID_PARAMETER) nError = ERRCODE_BASIC_BAD_ARGUMENT; - break; - case SVSTREAM_OUTOFMEMORY: + else if (nEC ==SVSTREAM_OUTOFMEMORY) nError = ERRCODE_BASIC_NO_MEMORY; - break; - default: + else nError = ERRCODE_BASIC_IO_ERROR; - break; - } } } @@ -656,7 +646,7 @@ SbiIoSystem::SbiIoSystem() i = nullptr; } nChan = 0; - nError = 0; + nError = ERRCODE_NONE; } SbiIoSystem::~SbiIoSystem() @@ -666,13 +656,14 @@ SbiIoSystem::~SbiIoSystem() ErrCode SbiIoSystem::GetError() { - ErrCode n = nError; nError = 0; + ErrCode n = nError; + nError = ERRCODE_NONE; return n; } void SbiIoSystem::Open(short nCh, const OString& rName, StreamMode nMode, SbiStreamFlags nFlags, short nLen) { - nError = 0; + nError = ERRCODE_NONE; if( nCh >= CHANNELS || !nCh ) { nError = ERRCODE_BASIC_BAD_CHANNEL; diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index d33e584dce20..f8c8ed9aec2d 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -480,7 +480,7 @@ void SbiInstance::ErrorVB( sal_Int32 nVBNumber, const OUString& rMsg ) ErrCode n = StarBASIC::GetSfxFromVBError( static_cast< sal_uInt16 >( nVBNumber ) ); if ( !n ) { - n = nVBNumber; // force orig number, probably should have a specific table of vb ( localized ) errors + n = ErrCode(nVBNumber); // force orig number, probably should have a specific table of vb ( localized ) errors } aErrorMsg = rMsg; SbiRuntime::translateErrorToVba( n, aErrorMsg ); @@ -494,7 +494,7 @@ void SbiInstance::setErrorVB( sal_Int32 nVBNumber ) ErrCode n = StarBASIC::GetSfxFromVBError( static_cast< sal_uInt16 >( nVBNumber ) ); if( !n ) { - n = nVBNumber; // force orig number, probably should have a specific table of vb ( localized ) errors + n = ErrCode(nVBNumber); // force orig number, probably should have a specific table of vb ( localized ) errors } aErrorMsg = OUString(); SbiRuntime::translateErrorToVba( n, aErrorMsg ); @@ -773,7 +773,7 @@ bool SbiRuntime::Step() } ErrCode nErrCode = SbxBase::GetError(); - Error( ERRCODE_TOERROR(nErrCode) ); + Error( nErrCode.IgnoreWarning() ); // from 13.2.1997, new error handling: // ATTENTION: nError can be set already even if !nErrCode @@ -931,12 +931,6 @@ sal_Int32 SbiRuntime::translateErrorToVba( ErrCode nError, OUString& rMsg ) // we really need a new vba compatible error list if ( rMsg.isEmpty() ) { - // TEST, has to be vb here always -#ifdef DBG_UTIL - ErrCode nTmp = StarBASIC::GetSfxFromVBError( (sal_uInt16)nError ); - SAL_WARN_IF( nTmp == 0, "basic", "No VB error!" ); -#endif - StarBASIC::MakeErrorText( nError, rMsg ); rMsg = StarBASIC::GetErrorText(); if ( rMsg.isEmpty() ) // no message for err no, need localized resource here @@ -946,7 +940,7 @@ sal_Int32 SbiRuntime::translateErrorToVba( ErrCode nError, OUString& rMsg ) } // no num? most likely then it *is* really a vba err sal_uInt16 nVBErrorCode = StarBASIC::GetVBErrorCode( nError ); - sal_Int32 nVBAErrorNumber = ( nVBErrorCode == 0 ) ? nError : nVBErrorCode; + sal_Int32 nVBAErrorNumber = ( nVBErrorCode == 0 ) ? sal_uInt32(nError) : nVBErrorCode; return nVBAErrorNumber; } diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx index 327e9d33fd01..4346a091ff01 100644 --- a/basic/source/uno/scriptcont.cxx +++ b/basic/source/uno/scriptcont.cxx @@ -914,7 +914,7 @@ bool SfxScriptLibraryContainer::implLoadPasswordLibrary std::unique_ptr<SvStream> pStream(::utl::UcbStreamHelper::CreateStream( xCodeStream )); if ( !pStream || pStream->GetError() ) { - sal_Int32 nError = pStream ? pStream->GetError() : ERRCODE_IO_GENERAL; + sal_uInt32 nError = sal_uInt32(pStream ? pStream->GetError() : ERRCODE_IO_GENERAL); throw task::ErrorCodeIOException( ("utl::UcbStreamHelper::CreateStream failed for \"" + aCodeStreamName + "\": 0x" @@ -1026,7 +1026,7 @@ bool SfxScriptLibraryContainer::implLoadPasswordLibrary std::unique_ptr<SvStream> pStream(::utl::UcbStreamHelper::CreateStream( xCodeStream )); if ( !pStream || pStream->GetError() ) { - sal_Int32 nError = pStream ? pStream->GetError() : ERRCODE_IO_GENERAL; + sal_uInt32 nError = sal_uInt32(pStream ? pStream->GetError() : ERRCODE_IO_GENERAL); throw task::ErrorCodeIOException( ("utl::UcbStreamHelper::CreateStream failed" " for code.bin: 0x" diff --git a/chart2/source/model/filter/XMLFilter.cxx b/chart2/source/model/filter/XMLFilter.cxx index a8edb72827bc..e34e2170f976 100644 --- a/chart2/source/model/filter/XMLFilter.cxx +++ b/chart2/source/model/filter/XMLFilter.cxx @@ -209,7 +209,7 @@ sal_Bool SAL_CALL XMLFilter::filter( { OSL_ENSURE( ! m_xTargetDoc.is(), "source doc is set -> target document should not be set" ); if( impl_Export( m_xSourceDoc, - aDescriptor ) == 0 ) + aDescriptor ) == ERRCODE_NONE ) { m_xSourceDoc = nullptr; bResult = true; @@ -218,7 +218,7 @@ sal_Bool SAL_CALL XMLFilter::filter( else if( m_xTargetDoc.is()) { if( impl_Import( m_xTargetDoc, - aDescriptor ) == 0 ) + aDescriptor ) == ERRCODE_NONE ) { m_xTargetDoc = nullptr; bResult = true; @@ -262,11 +262,11 @@ void SAL_CALL XMLFilter::setSourceDocument( m_xSourceDoc = Document; } -sal_Int32 XMLFilter::impl_Import( +ErrCode XMLFilter::impl_Import( const Reference< lang::XComponent > & xDocumentComp, const Sequence< beans::PropertyValue > & rMediaDescriptor ) { - sal_Int32 nWarning = 0; + ErrCode nWarning = ERRCODE_NONE; OSL_ENSURE( xDocumentComp.is(), "Import: No Model" ); OSL_ENSURE( m_xContext.is(), "Import: No ComponentContext" ); @@ -359,30 +359,31 @@ sal_Int32 XMLFilter::impl_Import( // import meta information if( bOasis ) - nWarning |= impl_ImportStream( + nWarning = impl_ImportStream( sXML_metaStreamName, "com.sun.star.comp.Chart.XMLOasisMetaImporter", xStorage, xSaxParser, xFactory, xGraphicObjectResolver, xImportInfo ); // import styles - nWarning |= impl_ImportStream( + ErrCode nTmpErr = impl_ImportStream( sXML_styleStreamName, bOasis ? OUString("com.sun.star.comp.Chart.XMLOasisStylesImporter") : OUString("com.sun.star.comp.Chart.XMLStylesImporter"), xStorage, xSaxParser, xFactory, xGraphicObjectResolver, xImportInfo ); + nWarning = nWarning != ERRCODE_NONE ? nWarning : nTmpErr; // import content - sal_Int32 nContentWarning = impl_ImportStream( + ErrCode nContentWarning = impl_ImportStream( sXML_contentStreamName, bOasis ? OUString("com.sun.star.comp.Chart.XMLOasisContentImporter") : OUString("com.sun.star.comp.Chart.XMLContentImporter"), xStorage, xSaxParser, xFactory, xGraphicObjectResolver, xImportInfo ); - nWarning |= nContentWarning; + nWarning = nWarning != ERRCODE_NONE ? nWarning : nContentWarning; // import of "content.xml" didn't work - try old "Content.xml" stream - if( nContentWarning != 0 ) + if( nContentWarning != ERRCODE_NONE ) { nWarning = impl_ImportStream( "Content.xml", // old content stream name @@ -401,7 +402,7 @@ sal_Int32 XMLFilter::impl_Import( return nWarning; } -sal_Int32 XMLFilter::impl_ImportStream( +ErrCode XMLFilter::impl_ImportStream( const OUString & rStreamName, const OUString & rServiceName, const Reference< embed::XStorage > & xStorage, @@ -410,12 +411,12 @@ sal_Int32 XMLFilter::impl_ImportStream( const Reference< document::XGraphicObjectResolver > & xGraphicObjectResolver, uno::Reference< beans::XPropertySet >& xImportInfo ) { - sal_Int32 nWarning = ERRCODE_SFX_GENERAL; + ErrCode nWarning = ERRCODE_SFX_GENERAL; Reference< container::XNameAccess > xNameAcc( xStorage, uno::UNO_QUERY ); if( ! (xNameAcc.is() && xNameAcc->hasByName( rStreamName ))) - return 0; + return ERRCODE_NONE; if( xImportInfo.is() ) xImportInfo->setPropertyValue( "StreamName", uno::Any( rStreamName ) ); @@ -483,7 +484,7 @@ sal_Int32 XMLFilter::impl_ImportStream( } // load was successful - nWarning = 0; + nWarning = ERRCODE_NONE; } catch (const xml::sax::SAXParseException&) { @@ -509,14 +510,14 @@ sal_Int32 XMLFilter::impl_ImportStream( return nWarning; } -sal_Int32 XMLFilter::impl_Export( +ErrCode XMLFilter::impl_Export( const Reference< lang::XComponent > & xDocumentComp, const Sequence< beans::PropertyValue > & rMediaDescriptor ) { m_aMediaDescriptor = rMediaDescriptor; //save - sal_Int32 nWarning = 0; + ErrCode nWarning = ERRCODE_NONE; OSL_ENSURE( xDocumentComp.is(), "Export: No Model" ); OSL_ENSURE( m_xContext.is(), "Export: No ComponentContext" ); @@ -613,27 +614,28 @@ sal_Int32 XMLFilter::impl_Export( // export meta information if( bOasis ) - nWarning |= impl_ExportStream( + nWarning = impl_ExportStream( sXML_metaStreamName, "com.sun.star.comp.Chart.XMLOasisMetaExporter", xStorage, xSaxWriter, xServiceFactory, aFilterProperties ); // export styles - nWarning |= impl_ExportStream( + ErrCode nTmp = impl_ExportStream( sXML_styleStreamName, bOasis ? OUString("com.sun.star.comp.Chart.XMLOasisStylesExporter") : OUString("com.sun.star.comp.Chart.XMLStylesExporter"), // soffice 6/7 xStorage, xSaxWriter, xServiceFactory, aFilterProperties ); + nWarning = nWarning != ERRCODE_NONE ? nWarning : nTmp; // export content - sal_Int32 nContentWarning = impl_ExportStream( + ErrCode nContentWarning = impl_ExportStream( sXML_contentStreamName, bOasis ? OUString("com.sun.star.comp.Chart.XMLOasisContentExporter") : OUString("com.sun.star.comp.Chart.XMLContentExporter"), xStorage, xSaxWriter, xServiceFactory, aFilterProperties ); - nWarning |= nContentWarning; + nWarning = nWarning != ERRCODE_NONE ? nWarning : nContentWarning; Reference< lang::XComponent > xComp( xGraphicObjectResolver, uno::UNO_QUERY ); if( xComp.is()) @@ -654,7 +656,7 @@ sal_Int32 XMLFilter::impl_Export( return nWarning; } -sal_Int32 XMLFilter::impl_ExportStream( +ErrCode XMLFilter::impl_ExportStream( const OUString & rStreamName, const OUString & rServiceName, const Reference< embed::XStorage > & xStorage, @@ -720,7 +722,7 @@ sal_Int32 XMLFilter::impl_ExportStream( { ASSERT_EXCEPTION( rEx ); } - return 0; + return ERRCODE_NONE; } void XMLFilter::isOasisFormat(const Sequence< beans::PropertyValue >& _rMediaDescriptor, bool & rOutOASIS ) diff --git a/chart2/source/model/inc/XMLFilter.hxx b/chart2/source/model/inc/XMLFilter.hxx index de69e205b28f..5eef0f5ac708 100644 --- a/chart2/source/model/inc/XMLFilter.hxx +++ b/chart2/source/model/inc/XMLFilter.hxx @@ -30,6 +30,7 @@ #include <com/sun/star/io/XActiveDataSource.hpp> #include <com/sun/star/xml/sax/XWriter.hpp> #include <osl/mutex.hxx> +#include <vcl/errcode.hxx> namespace com { namespace sun { namespace star { @@ -95,10 +96,10 @@ private: // methods /// @return a warning code, or 0 for successful operation - sal_Int32 impl_Import( const css::uno::Reference< css::lang::XComponent > & xDocumentComp, + ErrCode impl_Import( const css::uno::Reference< css::lang::XComponent > & xDocumentComp, const css::uno::Sequence< css::beans::PropertyValue > & aMediaDescriptor ); /// @return a warning code, or 0 for successful operation - sal_Int32 impl_ImportStream( + ErrCode impl_ImportStream( const OUString & rStreamName, const OUString & rServiceName, const css::uno::Reference< css::embed::XStorage > & xStorage, @@ -108,10 +109,10 @@ private: css::uno::Reference< css::beans::XPropertySet >& xPropSet ); /// @return a warning code, or 0 for successful operation - sal_Int32 impl_Export( const css::uno::Reference< css::lang::XComponent > & xDocumentComp, + ErrCode impl_Export( const css::uno::Reference< css::lang::XComponent > & xDocumentComp, const css::uno::Sequence< css::beans::PropertyValue > & aMediaDescriptor ); /// @return a warning code, or 0 for successful operation - sal_Int32 impl_ExportStream( + ErrCode impl_ExportStream( const OUString & rStreamName, const OUString & rServiceName, const css::uno::Reference< css::embed::XStorage > & xStorage, diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx index d4bd7501b56a..5524c260aa3b 100644 --- a/cui/source/tabpages/backgrnd.cxx +++ b/cui/source/tabpages/backgrnd.cxx @@ -1234,7 +1234,7 @@ IMPL_LINK_NOARG(SvxBackgroundTabPage, BrowseHdl_Impl, Button*, void) pImportDlg->SetPath( aBgdGraphicPath, m_pBtnLink->IsChecked() ); pPageImpl->bIsImportDlgInExecute = true; - short nErr = pImportDlg->Execute(); + ErrCode nErr = pImportDlg->Execute(); pPageImpl->bIsImportDlgInExecute = false; if( !nErr ) diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx index 3151ddc8b076..5ea3afe39b2f 100644 --- a/cui/source/tabpages/tpbitmap.cxx +++ b/cui/source/tabpages/tpbitmap.cxx @@ -768,7 +768,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl, Button*, void) Graphic aGraphic; EnterWait(); - int nError = aDlg.GetGraphic( aGraphic ); + ErrCode nError = aDlg.GetGraphic( aGraphic ); LeaveWait(); if( !nError ) @@ -783,7 +783,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl, Button*, void) DBG_ASSERT(pFact, "Dialog creation failed!"); ScopedVclPtr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aURL.GetName().getToken( 0, '.' ), aDesc )); DBG_ASSERT(pDlg, "Dialog creation failed!"); - nError = 1; + nError = ErrCode(1); while( pDlg->Execute() == RET_OK ) { diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx index 6dd868a4a0b1..b5477eeae235 100644 --- a/dbaccess/source/filter/xml/xmlfilter.cxx +++ b/dbaccess/source/filter/xml/xmlfilter.cxx @@ -74,7 +74,7 @@ namespace dbaxml { using namespace ::com::sun::star::util; /// read a component (file + filter version) -sal_Int32 ReadThroughComponent( +ErrCode ReadThroughComponent( const uno::Reference<XInputStream>& xInputStream, const uno::Reference<XComponent>& xModelComponent, const uno::Reference<XComponentContext> & rxContext, @@ -95,7 +95,7 @@ sal_Int32 ReadThroughComponent( // get filter OSL_ENSURE( _xFilter.is(), "Can't instantiate filter component." ); if( !_xFilter.is() ) - return 1; + return ErrCode(1); // connect parser and filter xParser->setDocumentHandler( _xFilter ); @@ -116,11 +116,11 @@ sal_Int32 ReadThroughComponent( #else (void)r; #endif - return 1; + return ErrCode(1); } catch (const SAXException&) { - return 1; + return ErrCode(1); } catch (const packages::zip::ZipIOException&) { @@ -137,7 +137,7 @@ sal_Int32 ReadThroughComponent( /// read a component (storage version) -sal_Int32 ReadThroughComponent( +ErrCode ReadThroughComponent( const uno::Reference< embed::XStorage >& xStorage, const uno::Reference<XComponent>& xModelComponent, const sal_Char* pStreamName, @@ -185,7 +185,7 @@ sal_Int32 ReadThroughComponent( } catch (const uno::Exception&) { - return 1; // TODO/LATER: error handling + return ErrCode(1); // TODO/LATER: error handling } uno::Reference< XInputStream > xInputStream = xDocStream->getInputStream(); @@ -197,7 +197,7 @@ sal_Int32 ReadThroughComponent( } // TODO/LATER: better error handling - return 1; + return ErrCode(1); } @@ -331,7 +331,7 @@ bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) SetNumberFormatsSupplier(xNum); uno::Reference<XComponent> xModel(GetModel(),UNO_QUERY); - sal_Int32 nRet = ReadThroughComponent( xStorage + ErrCode nRet = ReadThroughComponent( xStorage ,xModel ,"settings.xml" ,"Settings.xml" @@ -358,18 +358,14 @@ bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) } else { - switch( nRet ) + if ( nRet == ERRCODE_IO_BROKENPACKAGE ) + ;// TODO/LATER: no way to transport the error outside from the filter! + else { - case ERRCODE_IO_BROKENPACKAGE: - // TODO/LATER: no way to transport the error outside from the filter! - break; - default: - { - // TODO/LATER: this is completely wrong! Filter code should never call ErrorHandler directly! But for now this is the only way! - ErrorHandler::HandleError( nRet ); - if( nRet & ERRCODE_WARNING_MASK ) - bRet = true; - } + // TODO/LATER: this is completely wrong! Filter code should never call ErrorHandler directly! But for now this is the only way! + ErrorHandler::HandleError( nRet ); + if( nRet.IsWarning() ) + bRet = true; } } } diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 41bd367cd1b8..286b93e66e79 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1346,7 +1346,7 @@ static bool lo_runMacro( LibreOfficeKit* pThis, const char *pURL) if (aErr.Name == "ErrorCode") { - sal_uInt32 nErrCode = ERRCODE_NONE; + sal_uInt32 nErrCode = 0; // ERRCODE_NONE aErr.Value >>= nErrCode; pLib->maLastExceptionMsg = "An error occurred running macro (error code: " + OUString::number( nErrCode ) + ")"; diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 714c4db704dc..6328ad6d0ae8 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -1468,7 +1468,7 @@ void EditEngine::SetText( const OUString& rText ) pImpEditEngine->FormatAndUpdate(); } -sal_uLong EditEngine::Read( SvStream& rInput, const OUString& rBaseURL, EETextFormat eFormat, SvKeyValueIterator* pHTTPHeaderAttrs /* = NULL */ ) +ErrCode EditEngine::Read( SvStream& rInput, const OUString& rBaseURL, EETextFormat eFormat, SvKeyValueIterator* pHTTPHeaderAttrs /* = NULL */ ) { bool bUndoEnabled = pImpEditEngine->IsUndoEnabled(); pImpEditEngine->EnableUndo( false ); diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index f44d432db3ae..d43131ee7b5a 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -539,7 +539,7 @@ void EditView::Redo() pImpEditView->pEditEngine->Redo( this ); } -sal_uInt32 EditView::Read( SvStream& rInput, EETextFormat eFormat, SvKeyValueIterator* pHTTPHeaderAttrs ) +ErrCode EditView::Read( SvStream& rInput, EETextFormat eFormat, SvKeyValueIterator* pHTTPHeaderAttrs ) { EditSelection aOldSel( pImpEditView->GetEditSelection() ); pImpEditView->DrawSelection(); diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index ecf51531c585..e56b0ef25f61 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -633,8 +633,8 @@ private: EditPaM ReadXML( SvStream& rInput, EditSelection aSel ); EditPaM ReadHTML( SvStream& rInput, const OUString& rBaseURL, EditSelection aSel, SvKeyValueIterator* pHTTPHeaderAttrs ); EditPaM ReadBin( SvStream& rInput, EditSelection aSel ); - sal_uInt32 WriteText( SvStream& rOutput, EditSelection aSel ); - sal_uInt32 WriteRTF( SvStream& rOutput, EditSelection aSel ); + ErrCode WriteText( SvStream& rOutput, EditSelection aSel ); + ErrCode WriteRTF( SvStream& rOutput, EditSelection aSel ); sal_uInt32 WriteXML(SvStream& rOutput, const EditSelection& rSel); sal_uInt32 WriteBin(SvStream& rOutput, const EditSelection& rSel, bool bStoreUnicode = false); diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index b7c33d0e7588..660b4b506319 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -220,7 +220,7 @@ void ImpEditEngine::Write(SvStream& rOutput, EETextFormat eFormat, const EditSel } } -sal_uInt32 ImpEditEngine::WriteText( SvStream& rOutput, EditSelection aSel ) +ErrCode ImpEditEngine::WriteText( SvStream& rOutput, EditSelection aSel ) { sal_Int32 nStartNode, nEndNode; bool bRange = aSel.HasRange(); @@ -304,7 +304,7 @@ sal_uInt32 ImpEditEngine::WriteXML(SvStream& rOutput, const EditSelection& rSel) return 0; } -sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) +ErrCode ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) { DBG_ASSERT( GetUpdateMode(), "WriteRTF for UpdateMode = sal_False!" ); CheckIdleFormatter(); diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index b351a79c01b6..0d2955cdae65 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -3392,8 +3392,7 @@ SvxBrushItem::SvxBrushItem(SvStream& rStream, sal_uInt16 nVersion, sal_uInt16 _n if( SVSTREAM_FILEFORMAT_ERROR == rStream.GetError() ) { rStream.ResetError(); - rStream.SetError( ERRCODE_SVX_GRAPHIC_WRONG_FILEFORMAT| - ERRCODE_WARNING_MASK ); + rStream.SetError( ERRCODE_SVX_GRAPHIC_WRONG_FILEFORMAT.MakeWarning() ); } } diff --git a/editeng/source/misc/SvXMLAutoCorrectExport.cxx b/editeng/source/misc/SvXMLAutoCorrectExport.cxx index 28a7b8505e76..b69640617565 100644 --- a/editeng/source/misc/SvXMLAutoCorrectExport.cxx +++ b/editeng/source/misc/SvXMLAutoCorrectExport.cxx @@ -39,7 +39,7 @@ SvXMLAutoCorrectExport::SvXMLAutoCorrectExport( XML_NAMESPACE_BLOCKLIST ); } -sal_uInt32 SvXMLAutoCorrectExport::exportDoc(enum XMLTokenEnum /*eClass*/) +ErrCode SvXMLAutoCorrectExport::exportDoc(enum XMLTokenEnum /*eClass*/) { GetDocHandler()->startDocument(); @@ -67,7 +67,7 @@ sal_uInt32 SvXMLAutoCorrectExport::exportDoc(enum XMLTokenEnum /*eClass*/) } } GetDocHandler()->endDocument(); - return 0; + return ERRCODE_NONE; } SvXMLExceptionListExport::SvXMLExceptionListExport( @@ -83,7 +83,7 @@ SvXMLExceptionListExport::SvXMLExceptionListExport( XML_NAMESPACE_BLOCKLIST ); } -sal_uInt32 SvXMLExceptionListExport::exportDoc(enum XMLTokenEnum /*eClass*/) +ErrCode SvXMLExceptionListExport::exportDoc(enum XMLTokenEnum /*eClass*/) { GetDocHandler()->startDocument(); @@ -104,7 +104,7 @@ sal_uInt32 SvXMLExceptionListExport::exportDoc(enum XMLTokenEnum /*eClass*/) } } GetDocHandler()->endDocument(); - return 0; + return ERRCODE_NONE; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/misc/SvXMLAutoCorrectExport.hxx b/editeng/source/misc/SvXMLAutoCorrectExport.hxx index 53ddb2b97088..6c15f81ee913 100644 --- a/editeng/source/misc/SvXMLAutoCorrectExport.hxx +++ b/editeng/source/misc/SvXMLAutoCorrectExport.hxx @@ -36,7 +36,7 @@ public: const OUString &rFileName, css::uno::Reference< css::xml::sax::XDocumentHandler> &rHandler); - sal_uInt32 exportDoc(enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID) override; + ErrCode exportDoc(enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID) override; void ExportAutoStyles_() override {} void ExportMasterStyles_ () override {} void ExportContent_() override {} @@ -55,7 +55,7 @@ public: const OUString &rFileName, css::uno::Reference< css::xml::sax::XDocumentHandler> &rHandler); - sal_uInt32 exportDoc(enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID) override; + ErrCode exportDoc(enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID) override; void ExportAutoStyles_() override {} void ExportMasterStyles_ () override {} void ExportContent_() override {} diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index 0a63ff17fbb3..791212d2d602 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -1093,7 +1093,7 @@ void Outliner::InvalidateBullet(sal_Int32 nPara) } } -sal_uLong Outliner::Read( SvStream& rInput, const OUString& rBaseURL, sal_uInt16 eFormat, SvKeyValueIterator* pHTTPHeaderAttrs ) +ErrCode Outliner::Read( SvStream& rInput, const OUString& rBaseURL, sal_uInt16 eFormat, SvKeyValueIterator* pHTTPHeaderAttrs ) { bool bOldUndo = pEditEngine->IsUndoEnabled(); @@ -1105,7 +1105,7 @@ sal_uLong Outliner::Read( SvStream& rInput, const OUString& rBaseURL, sal_uInt16 Clear(); ImplBlockInsertionCallbacks( true ); - sal_uLong nRet = pEditEngine->Read( rInput, rBaseURL, (EETextFormat)eFormat, pHTTPHeaderAttrs ); + ErrCode nRet = pEditEngine->Read( rInput, rBaseURL, (EETextFormat)eFormat, pHTTPHeaderAttrs ); bFirstParaIsEmpty = false; diff --git a/filter/source/graphic/GraphicExportFilter.cxx b/filter/source/graphic/GraphicExportFilter.cxx index c14ecdc20563..15dea5400298 100644 --- a/filter/source/graphic/GraphicExportFilter.cxx +++ b/filter/source/graphic/GraphicExportFilter.cxx @@ -119,7 +119,7 @@ sal_Bool SAL_CALL GraphicExportFilter::filter( const Sequence<PropertyValue>& rD SvMemoryStream aMemStream; const GraphicConversionParameters aParameters(aTargetSizePixel, true, true); - const sal_uInt16 nResult = rFilter.ExportGraphic( aGraphic.GetBitmapEx(aParameters), OUString(), aMemStream, nFilterFormat, &aFilterData ); + const ErrCode nResult = rFilter.ExportGraphic( aGraphic.GetBitmapEx(aParameters), OUString(), aMemStream, nFilterFormat, &aFilterData ); if ( nResult == ERRCODE_NONE ) { diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx index cad566aeb667..2a591fd88fc6 100644 --- a/filter/source/graphicfilter/eps/eps.cxx +++ b/filter/source/graphicfilter/eps/eps.cxx @@ -349,7 +349,7 @@ bool PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, Filter rTargetStream.WriteUInt32( 0 ).WriteUInt32( 0 ).WriteUInt32( 0 ).WriteUInt32( 0 ) .WriteUInt32( nStreamPosition + 26 ).WriteUInt32( 0 ).WriteUInt16( 0xffff ); - sal_uInt32 nErrCode; + ErrCode nErrCode; if ( mbGrayScale ) { BitmapEx aTempBitmapEx( rGraphic.GetBitmapEx() ); diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 6aa7842e4d14..bd42cd8cac1b 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -1444,7 +1444,7 @@ bool EscherPropertyContainer::CreateGraphicProperties( { Graphic aGraphic; SvMemoryStream aTemp( const_cast<sal_Int8 *>(pAry), nAryLen, StreamMode::READ ); - sal_uInt32 nErrCode = GraphicConverter::Import( aTemp, aGraphic, ConvertDataFormat::WMF ); + ErrCode nErrCode = GraphicConverter::Import( aTemp, aGraphic, ConvertDataFormat::WMF ); if ( nErrCode == ERRCODE_NONE ) { xGraphicObject.reset(new GraphicObject(aGraphic)); @@ -1584,7 +1584,7 @@ bool EscherPropertyContainer::CreateGraphicProperties( if ( pIn ) { Graphic aGraphic; - sal_uInt32 nErrCode = GraphicConverter::Import( *pIn, aGraphic ); + ErrCode nErrCode = GraphicConverter::Import( *pIn, aGraphic ); if ( nErrCode == ERRCODE_NONE ) { @@ -4265,7 +4265,7 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const OStrin GraphicType eGraphicType = aGraphic.GetType(); if ( ( eGraphicType == GraphicType::Bitmap ) || ( eGraphicType == GraphicType::GdiMetafile ) ) { - sal_uInt32 nErrCode; + ErrCode nErrCode; if ( !aGraphic.IsAnimated() ) nErrCode = GraphicConverter::Export( aStream, aGraphic, ( eGraphicType == GraphicType::Bitmap ) ? ConvertDataFormat::PNG : ConvertDataFormat::EMF ); else diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx index 5d692a578b32..1920d063f103 100644 --- a/filter/source/svg/svgfilter.hxx +++ b/filter/source/svg/svgfilter.hxx @@ -99,7 +99,7 @@ protected: virtual void ExportAutoStyles_() override {} virtual void ExportContent_() override {} virtual void ExportMasterStyles_() override {} - virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum /* eClass */ ) override { return 0; } + virtual ErrCode exportDoc( enum ::xmloff::token::XMLTokenEnum /* eClass */ ) override { return ERRCODE_NONE; } }; class ObjectRepresentation diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 54b17462c40e..c6fd863a4968 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -951,7 +951,7 @@ bool LoadEnv::impl_furtherDocsAllowed() css::uno::UNO_QUERY_THROW); css::task::ErrorCodeRequest aErrorCode; - aErrorCode.ErrCode = ERRCODE_SFX_NOMOREDOCUMENTSALLOWED; + aErrorCode.ErrCode = sal_uInt32(ERRCODE_SFX_NOMOREDOCUMENTSALLOWED); aInteraction <<= aErrorCode; xInteraction->handle( InteractionRequest::CreateRequest(aInteraction, lContinuations) ); } diff --git a/include/basic/basmgr.hxx b/include/basic/basmgr.hxx index 97ebcdddc056..4dfc8833669b 100644 --- a/include/basic/basmgr.hxx +++ b/include/basic/basmgr.hxx @@ -48,14 +48,14 @@ enum class BasicErrorReason class BASIC_DLLPUBLIC BasicError { private: - sal_uInt64 nErrorId; + ErrCode nErrorId; BasicErrorReason nReason; public: BasicError( const BasicError& rErr ); - BasicError( sal_uInt64 nId, BasicErrorReason nR ); + BasicError( ErrCode nId, BasicErrorReason nR ); - sal_uInt64 GetErrorId() const { return nErrorId; } + ErrCode GetErrorId() const { return nErrorId; } }; class ErrorManager; diff --git a/include/basic/sberrors.hxx b/include/basic/sberrors.hxx index 95ccfa1c6cc3..a3a10da70f65 100644 --- a/include/basic/sberrors.hxx +++ b/include/basic/sberrors.hxx @@ -54,227 +54,227 @@ #define ERRCODE_BASIC_NOT_A_COLL ERRCODE_SBX_NOT_A_COLL // Object not a collection // Append Basic specific error messages to ERRCODE_AREA_SBX -#define ERRCODE_BASIC_NO_GOSUB ((LAST_SBX_ERROR_ID+1UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_NO_GOSUB ErrCode((LAST_SBX_ERROR_ID+1UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Return without Gosub -#define ERRCODE_BASIC_REDO_FROM_START ((LAST_SBX_ERROR_ID+2UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_REDO_FROM_START ErrCode((LAST_SBX_ERROR_ID+2UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Redo form start (SB internal) -#define ERRCODE_BASIC_NO_MEMORY ((LAST_SBX_ERROR_ID+3UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_NO_MEMORY ErrCode((LAST_SBX_ERROR_ID+3UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Out of memory -#define ERRCODE_BASIC_ALREADY_DIM ((LAST_SBX_ERROR_ID+4UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_ALREADY_DIM ErrCode((LAST_SBX_ERROR_ID+4UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Array already dimensioned -#define ERRCODE_BASIC_DUPLICATE_DEF ((LAST_SBX_ERROR_ID+5UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_DUPLICATE_DEF ErrCode((LAST_SBX_ERROR_ID+5UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Duplicate definition -#define ERRCODE_BASIC_VAR_UNDEFINED ((LAST_SBX_ERROR_ID+6UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_VAR_UNDEFINED ErrCode((LAST_SBX_ERROR_ID+6UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Variable undefined (SB) -#define ERRCODE_BASIC_USER_ABORT ((LAST_SBX_ERROR_ID+7UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_USER_ABORT ErrCode((LAST_SBX_ERROR_ID+7UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // User interrupt occurred -#define ERRCODE_BASIC_BAD_RESUME ((LAST_SBX_ERROR_ID+8UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_BAD_RESUME ErrCode((LAST_SBX_ERROR_ID+8UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Resume without error -#define ERRCODE_BASIC_STACK_OVERFLOW ((LAST_SBX_ERROR_ID+9UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_STACK_OVERFLOW ErrCode((LAST_SBX_ERROR_ID+9UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Out of stack space -#define ERRCODE_BASIC_BAD_DLL_LOAD ((LAST_SBX_ERROR_ID+10UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_BAD_DLL_LOAD ErrCode((LAST_SBX_ERROR_ID+10UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Error in loading DLL -#define ERRCODE_BASIC_BAD_DLL_CALL ((LAST_SBX_ERROR_ID+11UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_BAD_DLL_CALL ErrCode((LAST_SBX_ERROR_ID+11UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Bad DLL calling convention -#define ERRCODE_BASIC_BAD_CHANNEL ((LAST_SBX_ERROR_ID+12UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_BAD_CHANNEL ErrCode((LAST_SBX_ERROR_ID+12UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Bad file name or number -#define ERRCODE_BASIC_FILE_NOT_FOUND ((LAST_SBX_ERROR_ID+13UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_FILE_NOT_FOUND ErrCode((LAST_SBX_ERROR_ID+13UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // File not found -#define ERRCODE_BASIC_BAD_FILE_MODE ((LAST_SBX_ERROR_ID+14UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_BAD_FILE_MODE ErrCode((LAST_SBX_ERROR_ID+14UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Bad file mode -#define ERRCODE_BASIC_FILE_ALREADY_OPEN ((LAST_SBX_ERROR_ID+15UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_FILE_ALREADY_OPEN ErrCode((LAST_SBX_ERROR_ID+15UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // File already open -#define ERRCODE_BASIC_IO_ERROR ((LAST_SBX_ERROR_ID+16UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_IO_ERROR ErrCode((LAST_SBX_ERROR_ID+16UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Device I/O error -#define ERRCODE_BASIC_FILE_EXISTS ((LAST_SBX_ERROR_ID+17UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_FILE_EXISTS ErrCode((LAST_SBX_ERROR_ID+17UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // File already exists -#define ERRCODE_BASIC_BAD_RECORD_LENGTH ((LAST_SBX_ERROR_ID+18UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_BAD_RECORD_LENGTH ErrCode((LAST_SBX_ERROR_ID+18UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // bad record length -#define ERRCODE_BASIC_DISK_FULL ((LAST_SBX_ERROR_ID+19UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_DISK_FULL ErrCode((LAST_SBX_ERROR_ID+19UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // disk full -#define ERRCODE_BASIC_READ_PAST_EOF ((LAST_SBX_ERROR_ID+20UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_READ_PAST_EOF ErrCode((LAST_SBX_ERROR_ID+20UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Input past end of file -#define ERRCODE_BASIC_BAD_RECORD_NUMBER ((LAST_SBX_ERROR_ID+21UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_BAD_RECORD_NUMBER ErrCode((LAST_SBX_ERROR_ID+21UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Bad record number -#define ERRCODE_BASIC_TOO_MANY_FILES ((LAST_SBX_ERROR_ID+22UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_TOO_MANY_FILES ErrCode((LAST_SBX_ERROR_ID+22UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Too many files -#define ERRCODE_BASIC_NO_DEVICE ((LAST_SBX_ERROR_ID+23UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_NO_DEVICE ErrCode((LAST_SBX_ERROR_ID+23UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Device not available -#define ERRCODE_BASIC_ACCESS_DENIED ((LAST_SBX_ERROR_ID+24UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_ACCESS_DENIED ErrCode((LAST_SBX_ERROR_ID+24UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Permission denied -#define ERRCODE_BASIC_NOT_READY ((LAST_SBX_ERROR_ID+25UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_NOT_READY ErrCode((LAST_SBX_ERROR_ID+25UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Disk not ready -#define ERRCODE_BASIC_NOT_IMPLEMENTED ((LAST_SBX_ERROR_ID+26UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_NOT_IMPLEMENTED ErrCode((LAST_SBX_ERROR_ID+26UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Feature not implemented -#define ERRCODE_BASIC_DIFFERENT_DRIVE ((LAST_SBX_ERROR_ID+27UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_DIFFERENT_DRIVE ErrCode((LAST_SBX_ERROR_ID+27UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // No rename with different drive -#define ERRCODE_BASIC_ACCESS_ERROR ((LAST_SBX_ERROR_ID+28UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_ACCESS_ERROR ErrCode((LAST_SBX_ERROR_ID+28UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Path/File access error -#define ERRCODE_BASIC_PATH_NOT_FOUND ((LAST_SBX_ERROR_ID+29UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_PATH_NOT_FOUND ErrCode((LAST_SBX_ERROR_ID+29UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Path not found -#define ERRCODE_BASIC_BAD_PATTERN ((LAST_SBX_ERROR_ID+30UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_BAD_PATTERN ErrCode((LAST_SBX_ERROR_ID+30UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Invalid pattern string -#define ERRCODE_BASIC_IS_NULL ((LAST_SBX_ERROR_ID+31UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_IS_NULL ErrCode((LAST_SBX_ERROR_ID+31UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Invalid use of Null // DDE messages from 250-299 -#define ERRCODE_BASIC_DDE_ERROR ((LAST_SBX_ERROR_ID+32UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_DDE_ERROR ErrCode((LAST_SBX_ERROR_ID+32UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) -#define ERRCODE_BASIC_DDE_WAITINGACK ((LAST_SBX_ERROR_ID+33UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_DDE_WAITINGACK ErrCode((LAST_SBX_ERROR_ID+33UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) -#define ERRCODE_BASIC_DDE_OUTOFCHANNELS ((LAST_SBX_ERROR_ID+34UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_DDE_OUTOFCHANNELS ErrCode((LAST_SBX_ERROR_ID+34UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) -#define ERRCODE_BASIC_DDE_NO_RESPONSE ((LAST_SBX_ERROR_ID+35UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_DDE_NO_RESPONSE ErrCode((LAST_SBX_ERROR_ID+35UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) -#define ERRCODE_BASIC_DDE_MULT_RESPONSES ((LAST_SBX_ERROR_ID+36UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_DDE_MULT_RESPONSES ErrCode((LAST_SBX_ERROR_ID+36UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) -#define ERRCODE_BASIC_DDE_CHANNEL_LOCKED ((LAST_SBX_ERROR_ID+37UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_DDE_CHANNEL_LOCKED ErrCode((LAST_SBX_ERROR_ID+37UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) -#define ERRCODE_BASIC_DDE_NOTPROCESSED ((LAST_SBX_ERROR_ID+38UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_DDE_NOTPROCESSED ErrCode((LAST_SBX_ERROR_ID+38UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) -#define ERRCODE_BASIC_DDE_TIMEOUT ((LAST_SBX_ERROR_ID+39UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_DDE_TIMEOUT ErrCode((LAST_SBX_ERROR_ID+39UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) -#define ERRCODE_BASIC_DDE_USER_INTERRUPT ((LAST_SBX_ERROR_ID+40UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_DDE_USER_INTERRUPT ErrCode((LAST_SBX_ERROR_ID+40UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) -#define ERRCODE_BASIC_DDE_BUSY ((LAST_SBX_ERROR_ID+41UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_DDE_BUSY ErrCode((LAST_SBX_ERROR_ID+41UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) -#define ERRCODE_BASIC_DDE_NO_DATA ((LAST_SBX_ERROR_ID+42UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_DDE_NO_DATA ErrCode((LAST_SBX_ERROR_ID+42UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) -#define ERRCODE_BASIC_DDE_WRONG_DATA_FORMAT ((LAST_SBX_ERROR_ID+43UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_DDE_WRONG_DATA_FORMAT ErrCode((LAST_SBX_ERROR_ID+43UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) -#define ERRCODE_BASIC_DDE_PARTNER_QUIT ((LAST_SBX_ERROR_ID+44UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_DDE_PARTNER_QUIT ErrCode((LAST_SBX_ERROR_ID+44UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) -#define ERRCODE_BASIC_DDE_CONV_CLOSED ((LAST_SBX_ERROR_ID+45UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_DDE_CONV_CLOSED ErrCode((LAST_SBX_ERROR_ID+45UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) -#define ERRCODE_BASIC_DDE_NO_CHANNEL ((LAST_SBX_ERROR_ID+46UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_DDE_NO_CHANNEL ErrCode((LAST_SBX_ERROR_ID+46UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) -#define ERRCODE_BASIC_DDE_INVALID_LINK ((LAST_SBX_ERROR_ID+47UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_DDE_INVALID_LINK ErrCode((LAST_SBX_ERROR_ID+47UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) -#define ERRCODE_BASIC_DDE_QUEUE_OVERFLOW ((LAST_SBX_ERROR_ID+48UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_DDE_QUEUE_OVERFLOW ErrCode((LAST_SBX_ERROR_ID+48UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) -#define ERRCODE_BASIC_DDE_LINK_ALREADY_EST ((LAST_SBX_ERROR_ID+49UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_DDE_LINK_ALREADY_EST ErrCode((LAST_SBX_ERROR_ID+49UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) -#define ERRCODE_BASIC_DDE_LINK_INV_TOPIC ((LAST_SBX_ERROR_ID+50UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_DDE_LINK_INV_TOPIC ErrCode((LAST_SBX_ERROR_ID+50UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) -#define ERRCODE_BASIC_DDE_DLL_NOT_FOUND ((LAST_SBX_ERROR_ID+51UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_DDE_DLL_NOT_FOUND ErrCode((LAST_SBX_ERROR_ID+51UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) -#define ERRCODE_BASIC_NEEDS_OBJECT ((LAST_SBX_ERROR_ID+52UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_NEEDS_OBJECT ErrCode((LAST_SBX_ERROR_ID+52UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Object required -#define ERRCODE_BASIC_BAD_ORDINAL ((LAST_SBX_ERROR_ID+53UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_BAD_ORDINAL ErrCode((LAST_SBX_ERROR_ID+53UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Invalid ordinal -#define ERRCODE_BASIC_DLLPROC_NOT_FOUND ((LAST_SBX_ERROR_ID+54UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_DLLPROC_NOT_FOUND ErrCode((LAST_SBX_ERROR_ID+54UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Specified DLL function not found -#define ERRCODE_BASIC_BAD_CLIPBD_FORMAT ((LAST_SBX_ERROR_ID+55UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_BAD_CLIPBD_FORMAT ErrCode((LAST_SBX_ERROR_ID+55UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Invalid clipboard format // Debugger messages from 700-799 -#define ERRCODE_BASIC_PROPERTY_NOT_FOUND ((LAST_SBX_ERROR_ID+56UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_PROPERTY_NOT_FOUND ErrCode((LAST_SBX_ERROR_ID+56UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Class not have property -#define ERRCODE_BASIC_METHOD_NOT_FOUND ((LAST_SBX_ERROR_ID+57UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_METHOD_NOT_FOUND ErrCode((LAST_SBX_ERROR_ID+57UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Class does not have method -#define ERRCODE_BASIC_ARG_MISSING ((LAST_SBX_ERROR_ID+58UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_ARG_MISSING ErrCode((LAST_SBX_ERROR_ID+58UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Missing required argument -#define ERRCODE_BASIC_BAD_NUMBER_OF_ARGS ((LAST_SBX_ERROR_ID+59UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_BAD_NUMBER_OF_ARGS ErrCode((LAST_SBX_ERROR_ID+59UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Bad number of arguments -#define ERRCODE_BASIC_METHOD_FAILED ((LAST_SBX_ERROR_ID+60UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_METHOD_FAILED ErrCode((LAST_SBX_ERROR_ID+60UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Method failed -#define ERRCODE_BASIC_SETPROP_FAILED ((LAST_SBX_ERROR_ID+61UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_SETPROP_FAILED ErrCode((LAST_SBX_ERROR_ID+61UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Unable to set property -#define ERRCODE_BASIC_GETPROP_FAILED ((LAST_SBX_ERROR_ID+62UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_GETPROP_FAILED ErrCode((LAST_SBX_ERROR_ID+62UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) // Unable to get property // Compiler Errors (do not occur at runtime) // These IDs can shift at any time -#define ERRCODE_BASIC_UNEXPECTED ((LAST_SBX_ERROR_ID+63UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_UNEXPECTED ErrCode((LAST_SBX_ERROR_ID+63UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Unexpected symbol: xx -#define ERRCODE_BASIC_EXPECTED ((LAST_SBX_ERROR_ID+64UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_EXPECTED ErrCode((LAST_SBX_ERROR_ID+64UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Expected: xx -#define ERRCODE_BASIC_SYMBOL_EXPECTED ((LAST_SBX_ERROR_ID+65UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_SYMBOL_EXPECTED ErrCode((LAST_SBX_ERROR_ID+65UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Symbol expected -#define ERRCODE_BASIC_VAR_EXPECTED ((LAST_SBX_ERROR_ID+66UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_VAR_EXPECTED ErrCode((LAST_SBX_ERROR_ID+66UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Variable expected -#define ERRCODE_BASIC_LABEL_EXPECTED ((LAST_SBX_ERROR_ID+67UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_LABEL_EXPECTED ErrCode((LAST_SBX_ERROR_ID+67UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Label expected -#define ERRCODE_BASIC_LVALUE_EXPECTED ((LAST_SBX_ERROR_ID+68UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_LVALUE_EXPECTED ErrCode((LAST_SBX_ERROR_ID+68UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Lvalue expected -#define ERRCODE_BASIC_VAR_DEFINED ((LAST_SBX_ERROR_ID+69UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_VAR_DEFINED ErrCode((LAST_SBX_ERROR_ID+69UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Variable xxx already defined -#define ERRCODE_BASIC_PROC_DEFINED ((LAST_SBX_ERROR_ID+70UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_PROC_DEFINED ErrCode((LAST_SBX_ERROR_ID+70UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Procedure xx already defined -#define ERRCODE_BASIC_LABEL_DEFINED ((LAST_SBX_ERROR_ID+71UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_LABEL_DEFINED ErrCode((LAST_SBX_ERROR_ID+71UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Label xxx already defined -#define ERRCODE_BASIC_UNDEF_VAR ((LAST_SBX_ERROR_ID+72UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_UNDEF_VAR ErrCode((LAST_SBX_ERROR_ID+72UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Variable xx undefined -#define ERRCODE_BASIC_UNDEF_ARRAY ((LAST_SBX_ERROR_ID+73UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_UNDEF_ARRAY ErrCode((LAST_SBX_ERROR_ID+73UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Array or function xx undefined -#define ERRCODE_BASIC_UNDEF_PROC ((LAST_SBX_ERROR_ID+74UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_UNDEF_PROC ErrCode((LAST_SBX_ERROR_ID+74UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Procedure xxx undefined -#define ERRCODE_BASIC_UNDEF_LABEL ((LAST_SBX_ERROR_ID+75UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_UNDEF_LABEL ErrCode((LAST_SBX_ERROR_ID+75UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Label xxx undefined -#define ERRCODE_BASIC_UNDEF_TYPE ((LAST_SBX_ERROR_ID+76UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_UNDEF_TYPE ErrCode((LAST_SBX_ERROR_ID+76UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Unknown user defined type xxx -#define ERRCODE_BASIC_BAD_EXIT ((LAST_SBX_ERROR_ID+77UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_BAD_EXIT ErrCode((LAST_SBX_ERROR_ID+77UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Exit XXX expected -#define ERRCODE_BASIC_BAD_BLOCK ((LAST_SBX_ERROR_ID+78UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_BAD_BLOCK ErrCode((LAST_SBX_ERROR_ID+78UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Unterminated statement block: missing XX -#define ERRCODE_BASIC_BAD_BRACKETS ((LAST_SBX_ERROR_ID+79UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_BAD_BRACKETS ErrCode((LAST_SBX_ERROR_ID+79UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Parentheses do not match -#define ERRCODE_BASIC_BAD_DECLARATION ((LAST_SBX_ERROR_ID+80UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_BAD_DECLARATION ErrCode((LAST_SBX_ERROR_ID+80UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Symbol xx defined differently -#define ERRCODE_BASIC_BAD_PARAMETERS ((LAST_SBX_ERROR_ID+81UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_BAD_PARAMETERS ErrCode((LAST_SBX_ERROR_ID+81UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Parameters do not match -#define ERRCODE_BASIC_BAD_CHAR_IN_NUMBER ((LAST_SBX_ERROR_ID+82UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_BAD_CHAR_IN_NUMBER ErrCode((LAST_SBX_ERROR_ID+82UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Bad character in number -#define ERRCODE_BASIC_MUST_HAVE_DIMS ((LAST_SBX_ERROR_ID+83UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_MUST_HAVE_DIMS ErrCode((LAST_SBX_ERROR_ID+83UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Array needs dimensioning -#define ERRCODE_BASIC_NO_IF ((LAST_SBX_ERROR_ID+84UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_NO_IF ErrCode((LAST_SBX_ERROR_ID+84UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Else/Endif without If -#define ERRCODE_BASIC_NOT_IN_SUBR ((LAST_SBX_ERROR_ID+85UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_NOT_IN_SUBR ErrCode((LAST_SBX_ERROR_ID+85UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // xxx not allowed within a sub -#define ERRCODE_BASIC_NOT_IN_MAIN ((LAST_SBX_ERROR_ID+86UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_NOT_IN_MAIN ErrCode((LAST_SBX_ERROR_ID+86UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // xxx not allowed outside a sub -#define ERRCODE_BASIC_WRONG_DIMS ((LAST_SBX_ERROR_ID+87UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_WRONG_DIMS ErrCode((LAST_SBX_ERROR_ID+87UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Dimensions do not match -#define ERRCODE_BASIC_BAD_OPTION ((LAST_SBX_ERROR_ID+88UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_BAD_OPTION ErrCode((LAST_SBX_ERROR_ID+88UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Unknown option: xxx -#define ERRCODE_BASIC_CONSTANT_REDECLARED ((LAST_SBX_ERROR_ID+89UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_CONSTANT_REDECLARED ErrCode((LAST_SBX_ERROR_ID+89UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Constant xx redeclared -#define ERRCODE_BASIC_PROG_TOO_LARGE ((LAST_SBX_ERROR_ID+90UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_PROG_TOO_LARGE ErrCode((LAST_SBX_ERROR_ID+90UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Program is too large -#define ERRCODE_BASIC_NO_STRINGS_ARRAYS ((LAST_SBX_ERROR_ID+91UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_NO_STRINGS_ARRAYS ErrCode((LAST_SBX_ERROR_ID+91UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) -#define ERRCODE_BASIC_EXCEPTION ((LAST_SBX_ERROR_ID+92UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_EXCEPTION ErrCode((LAST_SBX_ERROR_ID+92UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_RUNTIME) -#define ERRCODE_BASMGR_STDLIBOPEN (LAST_SBX_ERROR_ID+93UL) | ERRCODE_AREA_SBX -#define ERRCODE_BASMGR_STDLIBSAVE (LAST_SBX_ERROR_ID+94UL) | ERRCODE_AREA_SBX -#define ERRCODE_BASMGR_LIBLOAD (LAST_SBX_ERROR_ID+95UL) | ERRCODE_AREA_SBX -#define ERRCODE_BASMGR_LIBCREATE (LAST_SBX_ERROR_ID+96UL) | ERRCODE_AREA_SBX -#define ERRCODE_BASMGR_LIBSAVE (LAST_SBX_ERROR_ID+97UL) | ERRCODE_AREA_SBX -#define ERRCODE_BASMGR_LIBDEL (LAST_SBX_ERROR_ID+98UL) | ERRCODE_AREA_SBX -#define ERRCODE_BASMGR_MGROPEN (LAST_SBX_ERROR_ID+99UL) | ERRCODE_AREA_SBX -#define ERRCODE_BASMGR_MGRSAVE (LAST_SBX_ERROR_ID+100UL) | ERRCODE_AREA_SBX -#define ERRCODE_BASMGR_REMOVELIB (LAST_SBX_ERROR_ID+101UL) | ERRCODE_AREA_SBX -#define ERRCODE_BASMGR_UNLOADLIB (LAST_SBX_ERROR_ID+102UL) | ERRCODE_AREA_SBX +#define ERRCODE_BASMGR_STDLIBOPEN ErrCode((LAST_SBX_ERROR_ID+93UL) | ERRCODE_AREA_SBX) +#define ERRCODE_BASMGR_STDLIBSAVE ErrCode((LAST_SBX_ERROR_ID+94UL) | ERRCODE_AREA_SBX) +#define ERRCODE_BASMGR_LIBLOAD ErrCode((LAST_SBX_ERROR_ID+95UL) | ERRCODE_AREA_SBX) +#define ERRCODE_BASMGR_LIBCREATE ErrCode((LAST_SBX_ERROR_ID+96UL) | ERRCODE_AREA_SBX) +#define ERRCODE_BASMGR_LIBSAVE ErrCode((LAST_SBX_ERROR_ID+97UL) | ERRCODE_AREA_SBX) +#define ERRCODE_BASMGR_LIBDEL ErrCode((LAST_SBX_ERROR_ID+98UL) | ERRCODE_AREA_SBX) +#define ERRCODE_BASMGR_MGROPEN ErrCode((LAST_SBX_ERROR_ID+99UL) | ERRCODE_AREA_SBX) +#define ERRCODE_BASMGR_MGRSAVE ErrCode((LAST_SBX_ERROR_ID+100UL) | ERRCODE_AREA_SBX) +#define ERRCODE_BASMGR_REMOVELIB ErrCode((LAST_SBX_ERROR_ID+101UL) | ERRCODE_AREA_SBX) +#define ERRCODE_BASMGR_UNLOADLIB ErrCode((LAST_SBX_ERROR_ID+102UL) | ERRCODE_AREA_SBX) -#define ERRCODE_BASIC_ARRAY_FIX ((LAST_SBX_ERROR_ID+104UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_ARRAY_FIX ErrCode((LAST_SBX_ERROR_ID+104UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // This array is fixed -#define ERRCODE_BASIC_STRING_OVERFLOW ((LAST_SBX_ERROR_ID+105UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_STRING_OVERFLOW ErrCode((LAST_SBX_ERROR_ID+105UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Out of string space -#define ERRCODE_BASIC_EXPR_TOO_COMPLEX ((LAST_SBX_ERROR_ID+106UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_EXPR_TOO_COMPLEX ErrCode((LAST_SBX_ERROR_ID+106UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Expression too complex -#define ERRCODE_BASIC_OPER_NOT_PERFORM ((LAST_SBX_ERROR_ID+107UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_OPER_NOT_PERFORM ErrCode((LAST_SBX_ERROR_ID+107UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Can't perform requested operation -#define ERRCODE_BASIC_TOO_MANY_DLL ((LAST_SBX_ERROR_ID+108UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_TOO_MANY_DLL ErrCode((LAST_SBX_ERROR_ID+108UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // Too many dll application clients -#define ERRCODE_BASIC_LOOP_NOT_INIT ((LAST_SBX_ERROR_ID+109UL) | ERRCODE_AREA_SBX | \ +#define ERRCODE_BASIC_LOOP_NOT_INIT ErrCode((LAST_SBX_ERROR_ID+109UL) | ERRCODE_AREA_SBX | \ ERRCODE_CLASS_COMPILER) // For loop not initialized -#define ERRCODE_BASIC_COMPAT ((LAST_SBX_ERROR_ID+103UL)| ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) +#define ERRCODE_BASIC_COMPAT ErrCode((LAST_SBX_ERROR_ID+103UL)| ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Grid messages from 30000-30999 // OLE messages from 31000-31999 diff --git a/include/basic/sbxdef.hxx b/include/basic/sbxdef.hxx index 973a472640fa..e524f7e225c6 100644 --- a/include/basic/sbxdef.hxx +++ b/include/basic/sbxdef.hxx @@ -130,35 +130,35 @@ enum class SbxNameType { // Type of the questioned name of a variable // New error codes per define #define ERRCODE_SBX_OK ERRCODE_NONE // processed -#define ERRCODE_SBX_SYNTAX (1UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_COMPILER) -#define ERRCODE_SBX_NOTIMP (2UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_NOTSUPPORTED) -#define ERRCODE_SBX_OVERFLOW (3UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // overflow -#define ERRCODE_SBX_BOUNDS (4UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Invalid array index -#define ERRCODE_SBX_ZERODIV (5UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Division by zero -#define ERRCODE_SBX_CONVERSION (6UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // wrong data type -#define ERRCODE_SBX_BAD_PARAMETER (7UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // invalid Parameter -#define ERRCODE_SBX_PROC_UNDEFINED (8UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Sub or Func not def -#define ERRCODE_SBX_ERROR (9UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_UNKNOWN) // generic object error -#define ERRCODE_SBX_NO_OBJECT (10UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Object var not object -#define ERRCODE_SBX_CANNOT_LOAD (11UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_CREATE) // Object init/load fail -#define ERRCODE_SBX_BAD_INDEX (12UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Invalid object index -#define ERRCODE_SBX_NO_ACTIVE_OBJECT (13UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // Object not active -#define ERRCODE_SBX_BAD_PROP_VALUE (14UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Bad property value -#define ERRCODE_SBX_PROP_READONLY (15UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_READ) // Property is read only -#define ERRCODE_SBX_PROP_WRITEONLY (16UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_WRITE) // Property is write only -#define ERRCODE_SBX_INVALID_OBJECT (17UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // Invalid object reference -#define ERRCODE_SBX_NO_METHOD (18UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Property or Method unknown -#define ERRCODE_SBX_INVALID_USAGE_OBJECT (19UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // Invalid object usage -#define ERRCODE_SBX_NO_OLE (20UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // No OLE-Object -#define ERRCODE_SBX_BAD_METHOD (21UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Method not supported -#define ERRCODE_SBX_OLE_ERROR (22UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // OLE Automation Error -#define ERRCODE_SBX_BAD_ACTION (23UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_NOTSUPPORTED) // Action not supported -#define ERRCODE_SBX_NO_NAMED_ARGS (24UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // No named arguments -#define ERRCODE_SBX_BAD_LOCALE (25UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_NOTSUPPORTED) // Locale not supported -#define ERRCODE_SBX_NAMED_NOT_FOUND (26UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Unknown named argument -#define ERRCODE_SBX_NOT_OPTIONAL (27UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Argument not optional -#define ERRCODE_SBX_WRONG_ARGS (28UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Invalid number of arguments -#define ERRCODE_SBX_NOT_A_COLL (29UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Object contains no elements +#define ERRCODE_SBX_SYNTAX ErrCode(1UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_COMPILER) +#define ERRCODE_SBX_NOTIMP ErrCode(2UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_NOTSUPPORTED) +#define ERRCODE_SBX_OVERFLOW ErrCode(3UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // overflow +#define ERRCODE_SBX_BOUNDS ErrCode(4UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Invalid array index +#define ERRCODE_SBX_ZERODIV ErrCode(5UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Division by zero +#define ERRCODE_SBX_CONVERSION ErrCode(6UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // wrong data type +#define ERRCODE_SBX_BAD_PARAMETER ErrCode(7UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // invalid Parameter +#define ERRCODE_SBX_PROC_UNDEFINED ErrCode(8UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Sub or Func not def +#define ERRCODE_SBX_ERROR ErrCode(9UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_UNKNOWN) // generic object error +#define ERRCODE_SBX_NO_OBJECT ErrCode(10UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Object var not object +#define ERRCODE_SBX_CANNOT_LOAD ErrCode(11UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_CREATE) // Object init/load fail +#define ERRCODE_SBX_BAD_INDEX ErrCode(12UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Invalid object index +#define ERRCODE_SBX_NO_ACTIVE_OBJECT ErrCode(13UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // Object not active +#define ERRCODE_SBX_BAD_PROP_VALUE ErrCode(14UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Bad property value +#define ERRCODE_SBX_PROP_READONLY ErrCode(15UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_READ) // Property is read only +#define ERRCODE_SBX_PROP_WRITEONLY ErrCode(16UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_WRITE) // Property is write only +#define ERRCODE_SBX_INVALID_OBJECT ErrCode(17UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // Invalid object reference +#define ERRCODE_SBX_NO_METHOD ErrCode(18UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Property or Method unknown +#define ERRCODE_SBX_INVALID_USAGE_OBJECT ErrCode(19UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // Invalid object usage +#define ERRCODE_SBX_NO_OLE ErrCode(20UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // No OLE-Object +#define ERRCODE_SBX_BAD_METHOD ErrCode(21UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Method not supported +#define ERRCODE_SBX_OLE_ERROR ErrCode(22UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // OLE Automation Error +#define ERRCODE_SBX_BAD_ACTION ErrCode(23UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_NOTSUPPORTED) // Action not supported +#define ERRCODE_SBX_NO_NAMED_ARGS ErrCode(24UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // No named arguments +#define ERRCODE_SBX_BAD_LOCALE ErrCode(25UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_NOTSUPPORTED) // Locale not supported +#define ERRCODE_SBX_NAMED_NOT_FOUND ErrCode(26UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Unknown named argument +#define ERRCODE_SBX_NOT_OPTIONAL ErrCode(27UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Argument not optional +#define ERRCODE_SBX_WRONG_ARGS ErrCode(28UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Invalid number of arguments +#define ERRCODE_SBX_NOT_A_COLL ErrCode(29UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Object contains no elements #define LAST_SBX_ERROR_ID 29UL #ifndef __RSC diff --git a/include/editeng/editdata.hxx b/include/editeng/editdata.hxx index 40bb2de969c4..4c493865659f 100644 --- a/include/editeng/editdata.hxx +++ b/include/editeng/editdata.hxx @@ -55,9 +55,9 @@ enum class EEAnchorMode { EDITENG_DLLPUBLIC extern const size_t EE_APPEND; // Error messages for Read / Write Method -#define EE_READWRITE_OK (ERRCODE_NONE) -#define EE_READWRITE_WRONGFORMAT (SVSTREAM_ERRBASE_USER+1) -#define EE_READWRITE_GENERALERROR (SVSTREAM_ERRBASE_USER+2) +#define EE_READWRITE_OK ERRCODE_NONE +#define EE_READWRITE_WRONGFORMAT ErrCode(SVSTREAM_ERRBASE_USER+1) +#define EE_READWRITE_GENERALERROR ErrCode(SVSTREAM_ERRBASE_USER+2) #define EDITUNDO_REMOVECHARS 100 #define EDITUNDO_CONNECTPARAS 101 diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx index ff9bed37e27c..05ccb792d5f6 100644 --- a/include/editeng/editeng.hxx +++ b/include/editeng/editeng.hxx @@ -39,6 +39,7 @@ #include <editeng/eedata.hxx> #include <o3tl/typed_flags_set.hxx> #include <svl/languageoptions.hxx> +#include <vcl/errcode.hxx> #include <functional> namespace com { namespace sun { namespace star { @@ -364,8 +365,7 @@ public: void Draw( OutputDevice* pOutDev, const tools::Rectangle& rOutRect, const Point& rStartDocPos, bool bClip ); void Draw( OutputDevice* pOutDev, const Point& rStartPos, short nOrientation = 0 ); - // sal_uInt32: Error code of the stream. - sal_uLong Read( SvStream& rInput, const OUString& rBaseURL, EETextFormat, SvKeyValueIterator* pHTTPHeaderAttrs = nullptr ); + ErrCode Read( SvStream& rInput, const OUString& rBaseURL, EETextFormat, SvKeyValueIterator* pHTTPHeaderAttrs = nullptr ); void Write( SvStream& rOutput, EETextFormat ); void SetStatusEventHdl( const Link<EditStatus&,void>& rLink ); diff --git a/include/editeng/editerr.hxx b/include/editeng/editerr.hxx index f020d01a4855..041e5320e547 100644 --- a/include/editeng/editerr.hxx +++ b/include/editeng/editerr.hxx @@ -21,9 +21,9 @@ #include <vcl/errcode.hxx> -#define ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS (2UL | ERRCODE_AREA_SVX) +#define ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS ErrCode(2UL | ERRCODE_AREA_SVX) -#define ERRCODE_SVX_GRAPHIC_WRONG_FILEFORMAT (8UL | ERRCODE_AREA_SVX | \ +#define ERRCODE_SVX_GRAPHIC_WRONG_FILEFORMAT ErrCode(8UL | ERRCODE_AREA_SVX | \ ERRCODE_CLASS_READ ) #endif diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx index 61dc4949ae63..f402730653a0 100644 --- a/include/editeng/editview.hxx +++ b/include/editeng/editview.hxx @@ -29,6 +29,7 @@ #include <tools/gen.hxx> #include <tools/link.hxx> #include <vcl/cursor.hxx> +#include <vcl/errcode.hxx> #include <editeng/editstat.hxx> #include <svl/languageoptions.hxx> #include <LibreOfficeKit/LibreOfficeKitTypes.h> @@ -187,7 +188,7 @@ public: void RemoveCharAttribs( sal_Int32 nPara, sal_uInt16 nWhich ); void RemoveAttribsKeepLanguages( bool bRemoveParaAttribs ); - sal_uInt32 Read( SvStream& rInput, EETextFormat eFormat, SvKeyValueIterator* pHTTPHeaderAttrs ); + ErrCode Read( SvStream& rInput, EETextFormat eFormat, SvKeyValueIterator* pHTTPHeaderAttrs ); void SetBackgroundColor( const Color& rColor ); Color GetBackgroundColor() const; diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index dd83ed03c9cd..d5f5d7e3b9bc 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -892,7 +892,7 @@ public: sal_Int32 GetLineLen( sal_Int32 nParagraph, sal_Int32 nLine ) const; sal_uLong GetLineHeight( sal_Int32 nParagraph ); - sal_uLong Read( SvStream& rInput, const OUString& rBaseURL, sal_uInt16, SvKeyValueIterator* pHTTPHeaderAttrs = nullptr ); + ErrCode Read( SvStream& rInput, const OUString& rBaseURL, sal_uInt16, SvKeyValueIterator* pHTTPHeaderAttrs = nullptr ); ::svl::IUndoManager& GetUndoManager(); ::svl::IUndoManager* SetUndoManager(::svl::IUndoManager* pNew); diff --git a/include/sfx2/app.hxx b/include/sfx2/app.hxx index cba04af4a281..0b83b0561fcd 100644 --- a/include/sfx2/app.hxx +++ b/include/sfx2/app.hxx @@ -153,8 +153,8 @@ public: /** * @param pArgs Takes ownership */ - sal_uIntPtr LoadTemplate( SfxObjectShellLock& xDoc, const OUString& rFileName, SfxItemSet* pArgs ); - vcl::Window* GetTopWindow() const; + ErrCode LoadTemplate( SfxObjectShellLock& xDoc, const OUString& rFileName, SfxItemSet* pArgs ); + vcl::Window* GetTopWindow() const; // members SfxFilterMatcher& GetFilterMatcher(); diff --git a/include/sfx2/docfile.hxx b/include/sfx2/docfile.hxx index 352cbac471b1..38d5f691a133 100644 --- a/include/sfx2/docfile.hxx +++ b/include/sfx2/docfile.hxx @@ -141,12 +141,12 @@ public: void Download( const Link<void*,void>& aLink = Link<void*,void>()); void SetDoneLink( const Link<void*,void>& rLink ); - sal_uInt32 GetErrorCode() const; - sal_uInt32 GetError() const - { return ERRCODE_TOERROR(GetErrorCode()); } - sal_uInt32 GetLastStorageCreationState(); + ErrCode GetErrorCode() const; + ErrCode GetError() const + { return GetErrorCode().IgnoreWarning(); } + ErrCode GetLastStorageCreationState(); - void SetError(sal_uInt32 nError); + void SetError(ErrCode nError); void CloseInStream(); bool CloseOutStream(); diff --git a/include/sfx2/docinf.hxx b/include/sfx2/docinf.hxx index 19a1075d2dd0..a1c03eb08371 100644 --- a/include/sfx2/docinf.hxx +++ b/include/sfx2/docinf.hxx @@ -22,6 +22,7 @@ #include <sal/config.h> #include <sfx2/dllapi.h> #include <sal/types.h> +#include <vcl/errcode.hxx> #include <com/sun/star/uno/Reference.hxx> @@ -42,7 +43,7 @@ namespace sfx2 { @param i_xDocProps Document meta-data @param i_pStorage OLE Storage */ -sal_uInt32 SFX2_DLLPUBLIC LoadOlePropertySet( +ErrCode SFX2_DLLPUBLIC LoadOlePropertySet( const css::uno::Reference< css::document::XDocumentProperties>& i_xDocProps, SotStorage* i_pStorage ); diff --git a/include/sfx2/fcontnr.hxx b/include/sfx2/fcontnr.hxx index 996f8aca4f42..414e88044f5e 100644 --- a/include/sfx2/fcontnr.hxx +++ b/include/sfx2/fcontnr.hxx @@ -83,10 +83,10 @@ public: SAL_DLLPRIVATE static bool IsFilterInstalled_Impl( const std::shared_ptr<const SfxFilter>& pFilter ); DECL_DLLPRIVATE_LINK( MaybeFileHdl_Impl, OUString*, bool ); - sal_uInt32 GuessFilterIgnoringContent( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>& ) const; - sal_uInt32 GuessFilter( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>& , SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; - sal_uInt32 GuessFilterControlDefaultUI( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>&, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; - sal_uInt32 DetectFilter( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>& ) const; + ErrCode GuessFilterIgnoringContent( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>& ) const; + ErrCode GuessFilter( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>& , SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; + ErrCode GuessFilterControlDefaultUI( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>&, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; + ErrCode DetectFilter( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>& ) const; std::shared_ptr<const SfxFilter> GetFilter4Mime( const OUString& rMime, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED) const; std::shared_ptr<const SfxFilter> GetFilter4ClipBoardId( SotClipboardFormatId nId, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx index fc13b6a0b345..5b97ce138570 100644 --- a/include/sfx2/objsh.hxx +++ b/include/sfx2/objsh.hxx @@ -296,9 +296,9 @@ public: SAL_DLLPRIVATE void SetMacroMode_Impl(bool bModal=true); void ResetError(); - sal_uInt32 GetError() const; - sal_uInt32 GetErrorCode() const; - void SetError(sal_uInt32 rErr); + ErrCode GetError() const; + ErrCode GetErrorCode() const; + void SetError(ErrCode rErr); /** * Initialize bare minimum just enough for unit test runs. @@ -420,7 +420,7 @@ public: const css::uno::Sequence< css::beans::PropertyValue >& GetModifyPasswordInfo() const; bool SetModifyPasswordInfo( const css::uno::Sequence< css::beans::PropertyValue >& aInfo ); - static sal_uInt32 HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDoc ); + static ErrCode HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDoc ); virtual bool PrepareClose(bool bUI = true); virtual HiddenInformation GetHiddenInformationState( HiddenInformation nStates ); @@ -684,7 +684,7 @@ public: SAL_DLLPRIVATE static bool UseInteractionToHandleError( const css::uno::Reference< css::task::XInteractionHandler >& xHandler, - sal_uInt32 nError ); + ErrCode nError ); SAL_DLLPRIVATE const SfxObjectShell_Impl* Get_Impl() const { return pImpl.get(); } SAL_DLLPRIVATE void SetCreateMode_Impl( SfxObjectCreateMode nMode ); diff --git a/include/sfx2/opengrf.hxx b/include/sfx2/opengrf.hxx index 9533a86f9b20..542e573304cf 100644 --- a/include/sfx2/opengrf.hxx +++ b/include/sfx2/opengrf.hxx @@ -31,12 +31,12 @@ public: SvxOpenGraphicDialog ( const OUString& rTitle ); ~SvxOpenGraphicDialog (); - short Execute(); + ErrCode Execute(); void SetPath( const OUString& rPath, bool bLinkState ); OUString GetPath() const; - int GetGraphic(Graphic&) const; + ErrCode GetGraphic(Graphic&) const; void EnableLink(bool); void AsLink(bool); diff --git a/include/sfx2/sfxbasemodel.hxx b/include/sfx2/sfxbasemodel.hxx index 6620fed6f1e5..e721a77e35f4 100644 --- a/include/sfx2/sfxbasemodel.hxx +++ b/include/sfx2/sfxbasemodel.hxx @@ -730,7 +730,7 @@ private: SAL_DLLPRIVATE void loadCmisProperties(); - SAL_DLLPRIVATE SfxMedium* handleLoadError( sal_uInt32 nError, SfxMedium* pMedium ); + SAL_DLLPRIVATE SfxMedium* handleLoadError( ErrCode nError, SfxMedium* pMedium ); // private variables and methods diff --git a/include/sot/storage.hxx b/include/sot/storage.hxx index f659149d9f42..2aa3ac0131d8 100644 --- a/include/sot/storage.hxx +++ b/include/sot/storage.hxx @@ -105,7 +105,7 @@ public: return m_nVersion; } - ErrCode GetError() const { return ERRCODE_TOERROR(m_nError); } + ErrCode GetError() const { return m_nError.IgnoreWarning(); } void SetError( ErrCode nErrorCode ) { if( m_nError == ERRCODE_NONE ) diff --git a/include/svtools/ehdl.hxx b/include/svtools/ehdl.hxx index 681a22ac2872..51f78bf27506 100644 --- a/include/svtools/ehdl.hxx +++ b/include/svtools/ehdl.hxx @@ -39,7 +39,7 @@ public: SfxErrorContext( sal_uInt16 nCtxIdP, const OUString &aArg1, vcl::Window *pWin=nullptr, sal_uInt16 nResIdP=USHRT_MAX, ResMgr *pMgrP=nullptr); - bool GetString(sal_uInt32 nErrId, OUString &rStr) override; + bool GetString(ErrCode nErrId, OUString &rStr) override; private: sal_uInt16 nCtxId; @@ -51,16 +51,16 @@ private: class SVT_DLLPUBLIC SfxErrorHandler : private ErrorHandler { public: - SfxErrorHandler(sal_uInt16 nId, sal_uLong lStart, sal_uLong lEnd, ResMgr *pMgr=nullptr); + SfxErrorHandler(sal_uInt16 nId, ErrCode lStart, ErrCode lEnd, ResMgr *pMgr=nullptr); virtual ~SfxErrorHandler() override; protected: - bool GetErrorString(sal_uLong lErrId, OUString &) const; + bool GetErrorString(ErrCode lErrId, OUString &) const; private: - sal_uLong lStart; - sal_uLong lEnd; + ErrCode lStart; + ErrCode lEnd; sal_uInt16 nId; ResMgr *pMgr; std::unique_ptr<ResMgr> diff --git a/include/svtools/sfxecode.hxx b/include/svtools/sfxecode.hxx index 6fde5916271a..625a50e42a5c 100644 --- a/include/svtools/sfxecode.hxx +++ b/include/svtools/sfxecode.hxx @@ -21,27 +21,27 @@ #include <vcl/errcode.hxx> -#define ERRCODE_SFX_NOTATEMPLATE (ERRCODE_AREA_SFX|ERRCODE_CLASS_FORMAT|2) -#define ERRCODE_SFX_GENERAL (ERRCODE_AREA_SFX|ERRCODE_CLASS_GENERAL|3) -#define ERRCODE_SFX_DOLOADFAILED (ERRCODE_AREA_SFX|ERRCODE_CLASS_READ|4) -#define ERRCODE_SFX_ALREADYOPEN (ERRCODE_AREA_SFX|ERRCODE_CLASS_ALREADYEXISTS|10) -#define ERRCODE_SFX_WRONGPASSWORD (ERRCODE_AREA_SFX|ERRCODE_CLASS_READ|11) -#define ERRCODE_SFX_DOCUMENTREADONLY (ERRCODE_AREA_SFX|ERRCODE_CLASS_WRITE|12) -#define ERRCODE_SFX_OLEGENERAL (ERRCODE_AREA_SFX|ERRCODE_CLASS_NONE|14) -#define ERRCODE_SFX_TEMPLATENOTFOUND (ERRCODE_AREA_SFX|ERRCODE_CLASS_NOTEXISTS|15) +#define ERRCODE_SFX_NOTATEMPLATE ErrCode(ERRCODE_AREA_SFX|ERRCODE_CLASS_FORMAT|2) +#define ERRCODE_SFX_GENERAL ErrCode(ERRCODE_AREA_SFX|ERRCODE_CLASS_GENERAL|3) +#define ERRCODE_SFX_DOLOADFAILED ErrCode(ERRCODE_AREA_SFX|ERRCODE_CLASS_READ|4) +#define ERRCODE_SFX_ALREADYOPEN ErrCode(ERRCODE_AREA_SFX|ERRCODE_CLASS_ALREADYEXISTS|10) +#define ERRCODE_SFX_WRONGPASSWORD ErrCode(ERRCODE_AREA_SFX|ERRCODE_CLASS_READ|11) +#define ERRCODE_SFX_DOCUMENTREADONLY ErrCode(ERRCODE_AREA_SFX|ERRCODE_CLASS_WRITE|12) +#define ERRCODE_SFX_OLEGENERAL ErrCode(ERRCODE_AREA_SFX|ERRCODE_CLASS_NONE|14) +#define ERRCODE_SFX_TEMPLATENOTFOUND ErrCode(ERRCODE_AREA_SFX|ERRCODE_CLASS_NOTEXISTS|15) -#define ERRCODE_SFX_CANTCREATECONTENT (ERRCODE_AREA_SFX|ERRCODE_CLASS_CREATE|21) -#define ERRCODE_SFX_INVALIDSYNTAX (ERRCODE_AREA_SFX|ERRCODE_CLASS_PATH|36) -#define ERRCODE_SFX_CANTCREATEFOLDER (ERRCODE_AREA_SFX|ERRCODE_CLASS_CREATE|37) -#define ERRCODE_SFX_CANTGETPASSWD (ERRCODE_AREA_SFX| ERRCODE_CLASS_READ | 42) -#define ERRCODE_SFX_NOMOREDOCUMENTSALLOWED (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 44) -#define ERRCODE_SFX_CANTCREATEBACKUP (ERRCODE_AREA_SFX | ERRCODE_CLASS_CREATE | 50) -#define ERRCODE_SFX_MACROS_SUPPORT_DISABLED (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 51) -#define ERRCODE_SFX_DOCUMENT_MACRO_DISABLED (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 52) -#define ERRCODE_SFX_SHARED_NOPASSWORDCHANGE (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 54) -#define ERRCODE_SFX_INCOMPLETE_ENCRYPTION (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 55) -#define ERRCODE_SFX_DOCUMENT_MACRO_DISABLED_MAC (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 56) -#define ERRCODE_SFX_FORMAT_ROWCOL (ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 57) +#define ERRCODE_SFX_CANTCREATECONTENT ErrCode(ERRCODE_AREA_SFX|ERRCODE_CLASS_CREATE|21) +#define ERRCODE_SFX_INVALIDSYNTAX ErrCode(ERRCODE_AREA_SFX|ERRCODE_CLASS_PATH|36) +#define ERRCODE_SFX_CANTCREATEFOLDER ErrCode(ERRCODE_AREA_SFX|ERRCODE_CLASS_CREATE|37) +#define ERRCODE_SFX_CANTGETPASSWD ErrCode(ERRCODE_AREA_SFX| ERRCODE_CLASS_READ | 42) +#define ERRCODE_SFX_NOMOREDOCUMENTSALLOWED ErrCode(ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 44) +#define ERRCODE_SFX_CANTCREATEBACKUP ErrCode(ERRCODE_AREA_SFX | ERRCODE_CLASS_CREATE | 50) +#define ERRCODE_SFX_MACROS_SUPPORT_DISABLED ErrCode(ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 51) +#define ERRCODE_SFX_DOCUMENT_MACRO_DISABLED ErrCode(ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 52) +#define ERRCODE_SFX_SHARED_NOPASSWORDCHANGE ErrCode(ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 54) +#define ERRCODE_SFX_INCOMPLETE_ENCRYPTION ErrCode(ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 55) +#define ERRCODE_SFX_DOCUMENT_MACRO_DISABLED_MAC ErrCode(ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 56) +#define ERRCODE_SFX_FORMAT_ROWCOL ErrCode(ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 57) // Various diff --git a/include/svtools/soerr.hxx b/include/svtools/soerr.hxx index 7dc3347f3598..dfc1b88f3ed8 100644 --- a/include/svtools/soerr.hxx +++ b/include/svtools/soerr.hxx @@ -24,15 +24,15 @@ // error codes #define RID_SO_ERROR_HANDLER 32000 -#define SO_ERR() (ERRCODE_AREA_SO | ERRCODE_CLASS_SO) -#define SO_WRN() (ERRCODE_AREA_SO | ERRCODE_CLASS_SO | ERRCODE_WARNING_MASK) - -#define ERRCODE_SO_GENERALERROR (SO_ERR() | 1) -#define ERRCODE_SO_FALSE (SO_WRN() | 23) -#define ERRCODE_SO_PENDING (SO_ERR() | 25) -#define ERRCODE_SO_CANNOT_DOVERB_NOW (SO_WRN() | 28) -#define ERRCODE_SO_NOVERBS (SO_ERR() | 30) -#define ERRCODE_SO_NOTIMPL (SO_ERR() | 33) +#define SO_ERR(x) ErrCode(ERRCODE_AREA_SO | ERRCODE_CLASS_SO | x) +#define SO_WRN(x) ErrCode(ERRCODE_AREA_SO | ERRCODE_CLASS_SO | ERRCODE_WARNING_MASK | x) + +#define ERRCODE_SO_GENERALERROR SO_ERR(1) +#define ERRCODE_SO_FALSE SO_WRN(23) +#define ERRCODE_SO_PENDING SO_ERR(25) +#define ERRCODE_SO_CANNOT_DOVERB_NOW SO_WRN(28) +#define ERRCODE_SO_NOVERBS SO_ERR(30) +#define ERRCODE_SO_NOTIMPL SO_ERR(33) // error contexts #define RID_SO_ERRCTX 32001 diff --git a/include/svx/svxerr.hxx b/include/svx/svxerr.hxx index f8c0ffae98c5..2c9fb5c08922 100644 --- a/include/svx/svxerr.hxx +++ b/include/svx/svxerr.hxx @@ -23,47 +23,47 @@ // define ---------------------------------------------------------------- -#define ERRCODE_SVX_LINGU_THESAURUSNOTEXISTS (1UL | ERRCODE_AREA_SVX | \ +#define ERRCODE_SVX_LINGU_THESAURUSNOTEXISTS ErrCode(1UL | ERRCODE_AREA_SVX | \ ERRCODE_CLASS_NOTEXISTS) -#define ERRCODE_SVX_LINGU_LINGUNOTEXISTS (3UL | ERRCODE_AREA_SVX | \ +#define ERRCODE_SVX_LINGU_LINGUNOTEXISTS ErrCode(3UL | ERRCODE_AREA_SVX | \ ERRCODE_CLASS_NOTEXISTS ) -#define ERRCODE_SVX_LINGU_HYPHENNOTEXISTS (4UL | ERRCODE_AREA_SVX | \ +#define ERRCODE_SVX_LINGU_HYPHENNOTEXISTS ErrCode(4UL | ERRCODE_AREA_SVX | \ ERRCODE_CLASS_NOTEXISTS ) -#define ERRCODE_SVX_LINGU_DICT_NOTREADABLE (5UL | ERRCODE_AREA_SVX | \ +#define ERRCODE_SVX_LINGU_DICT_NOTREADABLE ErrCode(5UL | ERRCODE_AREA_SVX | \ ERRCODE_CLASS_READ ) -#define ERRCODE_SVX_LINGU_DICT_NOTWRITEABLE (6UL | ERRCODE_AREA_SVX | \ +#define ERRCODE_SVX_LINGU_DICT_NOTWRITEABLE ErrCode(6UL | ERRCODE_AREA_SVX | \ ERRCODE_CLASS_WRITE ) -#define ERRCODE_SVX_GRAPHIC_NOTREADABLE (7UL | ERRCODE_AREA_SVX | \ +#define ERRCODE_SVX_GRAPHIC_NOTREADABLE ErrCode(7UL | ERRCODE_AREA_SVX | \ ERRCODE_CLASS_READ ) -#define ERRCODE_SVX_LINGU_NOLANGUAGE (9UL | ERRCODE_AREA_SVX | \ +#define ERRCODE_SVX_LINGU_NOLANGUAGE ErrCode(9UL | ERRCODE_AREA_SVX | \ ERRCODE_CLASS_NOTEXISTS ) -#define ERRCODE_SVX_FORMS_NOIOSERVICES (10UL | ERRCODE_AREA_SVX ) -#define ERRCODE_SVX_FORMS_READWRITEFAILED (11UL | ERRCODE_AREA_SVX ) +#define ERRCODE_SVX_FORMS_NOIOSERVICES ErrCode(10UL | ERRCODE_AREA_SVX ) +#define ERRCODE_SVX_FORMS_READWRITEFAILED ErrCode(11UL | ERRCODE_AREA_SVX ) -#define ERRCODE_SVX_BULLETITEM_NOBULLET (12UL | ERRCODE_AREA_SVX ) +#define ERRCODE_SVX_BULLETITEM_NOBULLET ErrCode(12UL | ERRCODE_AREA_SVX ) -#define ERRCODE_SVX_MODIFIED_VBASIC_STORAGE (13UL | ERRCODE_AREA_SVX \ +#define ERRCODE_SVX_MODIFIED_VBASIC_STORAGE ErrCode(13UL | ERRCODE_AREA_SVX \ | ERRCODE_WARNING_MASK \ | ERRCODE_CLASS_WRITE ) -#define ERRCODE_SVX_VBASIC_STORAGE_EXIST (14UL | ERRCODE_AREA_SVX \ +#define ERRCODE_SVX_VBASIC_STORAGE_EXIST ErrCode(14UL | ERRCODE_AREA_SVX \ | ERRCODE_WARNING_MASK \ | ERRCODE_CLASS_WRITE ) /** Error message: "Wrong password." */ -#define ERRCODE_SVX_WRONGPASS (15UL | ERRCODE_AREA_SVX | ERRCODE_CLASS_NONE) +#define ERRCODE_SVX_WRONGPASS ErrCode(15UL | ERRCODE_AREA_SVX | ERRCODE_CLASS_NONE) /** Error message: "Read error. Unsupported encryption method." */ -#define ERRCODE_SVX_READ_FILTER_CRYPT (16UL | ERRCODE_AREA_SVX | ERRCODE_CLASS_READ) +#define ERRCODE_SVX_READ_FILTER_CRYPT ErrCode(16UL | ERRCODE_AREA_SVX | ERRCODE_CLASS_READ) /** Error message: "Read error. Passwort encrypted Powerpoint documents..." */ -#define ERRCODE_SVX_READ_FILTER_PPOINT (17UL | ERRCODE_AREA_SVX | ERRCODE_CLASS_READ) +#define ERRCODE_SVX_READ_FILTER_PPOINT ErrCode(17UL | ERRCODE_AREA_SVX | ERRCODE_CLASS_READ) /** Error message: "Warning. Passwort protection is not supported when..." */ -#define ERRCODE_SVX_EXPORT_FILTER_CRYPT (18UL | ERRCODE_AREA_SVX | ERRCODE_CLASS_EXPORT | ERRCODE_WARNING_MASK) +#define ERRCODE_SVX_EXPORT_FILTER_CRYPT ErrCode(18UL | ERRCODE_AREA_SVX | ERRCODE_CLASS_EXPORT | ERRCODE_WARNING_MASK) // both codes will be used twice : with ERRCODE_CLASS_READ- and ERRCODE_CLASS_WRITE-bits diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx index b47d150aca29..a6c5adbea898 100644 --- a/include/tools/stream.hxx +++ b/include/tools/stream.hxx @@ -161,7 +161,7 @@ private: ///< into the derived stream (cf. PutBack) bool m_isSwap; bool m_isEof; - sal_uInt32 m_nError; + ErrCode m_nError; SvStreamEndian m_nEndian; SvStreamCompressFlags m_nCompressMode; LineEnd m_eLineDelimiter; @@ -206,10 +206,9 @@ public: SvLockBytes* GetLockBytes() const { return m_xLockBytes.get(); } - sal_uInt32 GetError() const { return ERRCODE_TOERROR(m_nError); } - sal_uInt32 GetErrorCode() const { return m_nError; } - - void SetError( sal_uInt32 nErrorCode ); + ErrCode GetError() const { return m_nError.IgnoreWarning(); } + ErrCode GetErrorCode() const { return m_nError; } + void SetError( ErrCode nErrorCode ); virtual void ResetError(); void SetEndian( SvStreamEndian SvStreamEndian ); diff --git a/include/vbahelper/vbahelper.hxx b/include/vbahelper/vbahelper.hxx index 0aa29ecd6e79..909382d01c78 100644 --- a/include/vbahelper/vbahelper.hxx +++ b/include/vbahelper/vbahelper.hxx @@ -32,6 +32,7 @@ #include <vbahelper/vbadllapi.h> #include <vcl/pointr.hxx> #include <vcl/ptrstyle.hxx> +#include <vcl/errcode.hxx> namespace com { namespace sun { namespace star { namespace awt { class XControl; } @@ -262,16 +263,16 @@ class VBAHELPER_DLLPUBLIC DebugHelper { public: /// @throws css::script::BasicErrorException - static void basicexception( const css::uno::Exception& ex, int err, const OUString& /*additionalArgument*/ ); + static void basicexception( const css::uno::Exception& ex, ErrCode err, const OUString& /*additionalArgument*/ ); /// @throws css::script::BasicErrorException - static void basicexception( int err, const OUString& additionalArgument ); + static void basicexception( ErrCode err, const OUString& additionalArgument ); /// @throws css::script::BasicErrorException static void basicexception( const css::uno::Exception& ex ); /// @throws css::script::BasicErrorException - static void runtimeexception( int err ); + static void runtimeexception( ErrCode err ); }; } // vba diff --git a/include/vcl/cvtgrf.hxx b/include/vcl/cvtgrf.hxx index a615951b5094..b4d7641a0dd8 100644 --- a/include/vcl/cvtgrf.hxx +++ b/include/vcl/cvtgrf.hxx @@ -39,8 +39,8 @@ public: GraphicConverter(); ~GraphicConverter(); - static sal_uLong Import( SvStream& rIStm, Graphic& rGraphic, ConvertDataFormat nFormat = ConvertDataFormat::Unknown ); - static sal_uLong Export( SvStream& rOStm, const Graphic& rGraphic, ConvertDataFormat nFormat ); + static ErrCode Import( SvStream& rIStm, Graphic& rGraphic, ConvertDataFormat nFormat = ConvertDataFormat::Unknown ); + static ErrCode Export( SvStream& rOStm, const Graphic& rGraphic, ConvertDataFormat nFormat ); void SetFilterHdl( const Link<ConvertData&,bool>& rLink ) { maFilterHdl = rLink; } const Link<ConvertData&,bool>& GetFilterHdl() const { return maFilterHdl; } diff --git a/include/vcl/errcode.hxx b/include/vcl/errcode.hxx index ecd7c788c0cd..1ea3b304e8c9 100644 --- a/include/vcl/errcode.hxx +++ b/include/vcl/errcode.hxx @@ -21,12 +21,13 @@ #define INCLUDED_VCL_ERRCODE_HXX #ifndef __RSC +#include <rtl/ustring.hxx> #include <tools/solar.h> -#define CAST_TO_UINT32(a) ((sal_uInt32)(a)) -#else -#define CAST_TO_UINT32(a) (a) +#include <tools/toolsdllapi.h> +#include <ostream> #endif + /* 01234567012345670123456701234567 @@ -46,65 +47,134 @@ Warning || || | Code */ -#define ERRCODE_ERROR_MASK 0x3fffffffUL -#define ERRCODE_WARNING_MASK 0x80000000UL -#define ERRCODE_RES_MASK 0x7fff - -#define ERRCODE_CLASS_SHIFT 8 -#define ERRCODE_AREA_SHIFT 13 -#define ERRCODE_DYNAMIC_SHIFT 26 - -#define ERRCODE_CLASS_MASK CAST_TO_UINT32(31UL <<ERRCODE_CLASS_SHIFT) - -#define ERRCODE_DYNAMIC_START CAST_TO_UINT32(1UL <<ERRCODE_DYNAMIC_SHIFT) -#define ERRCODE_DYNAMIC_COUNT 31UL -#define ERRCODE_DYNAMIC_MASK CAST_TO_UINT32(31UL <<ERRCODE_DYNAMIC_SHIFT) +#define ERRCODE_ERROR_MASK 0x3fffffffUL +#define ERRCODE_WARNING_MASK 0x80000000UL +#define ERRCODE_RES_MASK 0x7fff -#ifdef __RSC +#define ERRCODE_CLASS_SHIFT 8 +#define ERRCODE_AREA_SHIFT 13 +#define ERRCODE_DYNAMIC_SHIFT 26 -#define ERRCODE_TOERROR(x) \ - ((x & ERRCODE_WARNING_MASK) ? 0 : (x & ERRCODE_ERROR_MASK)) +#define ERRCODE_CLASS_MASK (31UL << ERRCODE_CLASS_SHIFT) -#else +#define ERRCODE_DYNAMIC_START ( 1UL << ERRCODE_DYNAMIC_SHIFT) +#define ERRCODE_DYNAMIC_COUNT 31UL +#define ERRCODE_DYNAMIC_MASK (31UL << ERRCODE_DYNAMIC_SHIFT) -typedef sal_uInt32 ErrCode; +/** we get included in contexts that don't have access to config_typesizes.h or C++11 */ +#ifndef __RSC -inline sal_uInt32 ERRCODE_TOERROR( ErrCode x ) +class ErrCode final +{ +public: + explicit constexpr ErrCode(sal_uInt32 value) : m_value(value) {} + constexpr ErrCode() : m_value(0) {} + + explicit operator sal_uInt32() const { return m_value; } + explicit operator bool() const { return m_value != 0; } + + bool operator<(ErrCode const & other) const { return m_value < other.m_value; } + bool operator<=(ErrCode const & other) const { return m_value <= other.m_value; } + bool operator>(ErrCode const & other) const { return m_value > other.m_value; } + bool operator>=(ErrCode const & other) const { return m_value >= other.m_value; } + bool operator==(ErrCode const & other) const { return m_value == other.m_value; } + bool operator!=(ErrCode const & other) const { return m_value != other.m_value; } + + /** convert to ERRCODE_NONE if it's a warning, else return the error */ + ErrCode IgnoreWarning() const { + return (m_value & ERRCODE_WARNING_MASK) + ? ErrCode(0UL) + : ErrCode(static_cast<sal_uInt32>(m_value & ERRCODE_ERROR_MASK)); + } + + bool IsWarning() const { + return m_value & ERRCODE_WARNING_MASK; + } + + ErrCode MakeWarning() const { + return ErrCode(m_value & ERRCODE_WARNING_MASK); + } + + bool IsError() { + return m_value && !IsWarning(); + } + + bool IsDynamic() const { + return m_value & ERRCODE_DYNAMIC_MASK; + } + + sal_uInt32 GetDynamic() const { + return (m_value & ERRCODE_DYNAMIC_MASK) >> ERRCODE_DYNAMIC_SHIFT; + } + + ErrCode StripDynamic() const { + return ErrCode(m_value & ~ERRCODE_DYNAMIC_MASK); + } + + sal_uInt16 GetRest() const { + return m_value & ERRCODE_RES_MASK; + } + + sal_uInt32 GetClass() const { + return m_value & ERRCODE_CLASS_MASK; + } + + OUString toHexString() const { + return "0x" + OUString::number(m_value, 16); + } + + bool anyOf(ErrCode v) const { + return *this == v; + } + + template<typename... Args> + bool anyOf(ErrCode first, Args... args) const { + return *this == first || anyOf(args...); + } +private: + sal_uInt32 m_value; +}; + +inline std::ostream& operator<<(std::ostream& os, const ErrCode& err) { - return ((x & ERRCODE_WARNING_MASK) ? 0 : (x & ERRCODE_ERROR_MASK)); + os << sal_uInt32(err); return os; } +#else +#define ErrCode(X) (X) #endif -#define ERRCODE_AREA_TOOLS CAST_TO_UINT32(0UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_SV CAST_TO_UINT32(1UL << ERRCODE_AREA_SHIFT) -#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_TOOLS (0 << ERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_SV (1 << ERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_SFX (2 << ERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_INET (3 << ERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_IO ERRCODE_AREA_TOOLS +#define ERRCODE_AREA_VCL (4 << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_LIB1 CAST_TO_UINT32(8UL << ERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_LIB1 (8 << ERRCODE_AREA_SHIFT) #define ERRCODE_AREA_SVX ERRCODE_AREA_LIB1 #define ERRCODE_AREA_SVX_END (ERRCODE_AREA_SO-1) -#define ERRCODE_AREA_SO CAST_TO_UINT32(9UL << ERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_SO (9 << ERRCODE_AREA_SHIFT) #define ERRCODE_AREA_SO_END (ERRCODE_AREA_SBX-1) -#define ERRCODE_AREA_SBX CAST_TO_UINT32(10UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_SBX_END CAST_TO_UINT32((11UL << ERRCODE_AREA_SHIFT) - 1) -#define ERRCODE_AREA_DB CAST_TO_UINT32(11UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_DB_END CAST_TO_UINT32((12UL << ERRCODE_AREA_SHIFT) - 1) -#define ERRCODE_AREA_JAVA CAST_TO_UINT32(12UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_JAVA_END CAST_TO_UINT32((13UL << ERRCODE_AREA_SHIFT) - 1) -#define ERRCODE_AREA_UUI CAST_TO_UINT32(13UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_UUI_END CAST_TO_UINT32((14UL << ERRCODE_AREA_SHIFT) - 1) -#define ERRCODE_AREA_LIB2 CAST_TO_UINT32(14UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_LIB2_END CAST_TO_UINT32((15UL << ERRCODE_AREA_SHIFT) - 1) - -#define ERRCODE_AREA_APP1 CAST_TO_UINT32(32UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_APP2 CAST_TO_UINT32(40UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_APP3 CAST_TO_UINT32(48UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_APP4 CAST_TO_UINT32(56UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_APP5 CAST_TO_UINT32(64UL << ERRCODE_AREA_SHIFT) -#define ERRCODE_AREA_APP6 CAST_TO_UINT32(72UL << ERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_SBX (10 << ERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_SBX_END ((11 << ERRCODE_AREA_SHIFT) - 1) +#define ERRCODE_AREA_DB (11 << ERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_DB_END ((12 << ERRCODE_AREA_SHIFT) - 1) +#define ERRCODE_AREA_JAVA (12 << ERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_JAVA_END ((13 << ERRCODE_AREA_SHIFT) - 1) +#define ERRCODE_AREA_UUI (13 << ERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_UUI_END ((14 << ERRCODE_AREA_SHIFT) - 1) +#define ERRCODE_AREA_LIB2 (14 << ERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_LIB2_END ((15 << ERRCODE_AREA_SHIFT) - 1) +#define ERRCODE_AREA_CHAOS (15 << ERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_CHAOS_END ((16 << ERRCODE_AREA_SHIFT) - 1) + +#define ERRCODE_AREA_APP1 (32 << ERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_APP2 (40 << ERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_APP3 (48 << ERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_APP4 (56 << ERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_APP5 (64 << ERRCODE_AREA_SHIFT) +#define ERRCODE_AREA_APP6 (72 << ERRCODE_AREA_SHIFT) #define ERRCODE_AREA_SC ERRCODE_AREA_APP1 #define ERRCODE_AREA_SC_END (ERRCODE_AREA_APP2-1) @@ -117,150 +187,112 @@ inline sal_uInt32 ERRCODE_TOERROR( ErrCode x ) #define ERRCODE_AREA_OFA_END (ERRCODE_AREA_APP6-1) -#define ERRCODE_CLASS_NONE CAST_TO_UINT32(0UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_ABORT CAST_TO_UINT32(1UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_GENERAL CAST_TO_UINT32(2UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_NOTEXISTS CAST_TO_UINT32(3UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_ALREADYEXISTS CAST_TO_UINT32(4UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_ACCESS CAST_TO_UINT32(5UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_PATH CAST_TO_UINT32(6UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_LOCKING CAST_TO_UINT32(7UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_PARAMETER CAST_TO_UINT32(8UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_SPACE CAST_TO_UINT32(9UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_NOTSUPPORTED CAST_TO_UINT32(10UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_READ CAST_TO_UINT32(11UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_WRITE CAST_TO_UINT32(12UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_UNKNOWN CAST_TO_UINT32(13UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_VERSION CAST_TO_UINT32(14UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_FORMAT CAST_TO_UINT32(15UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_CREATE CAST_TO_UINT32(16UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_IMPORT CAST_TO_UINT32(17UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_EXPORT CAST_TO_UINT32(18UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_FILTER CAST_TO_UINT32(19UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_SO CAST_TO_UINT32(20UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_SBX CAST_TO_UINT32(21UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_RUNTIME CAST_TO_UINT32(22UL << ERRCODE_CLASS_SHIFT) -#define ERRCODE_CLASS_COMPILER CAST_TO_UINT32(23UL << ERRCODE_CLASS_SHIFT) - -#define ERRCODE_NONE CAST_TO_UINT32(0UL) -#define ERRCODE_ABORT ERRCODE_IO_ABORT - -#define ERRCODE_IO_MISPLACEDCHAR CAST_TO_UINT32(1UL |ERRCODE_CLASS_PARAMETER|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_NOTEXISTS CAST_TO_UINT32(2UL |ERRCODE_CLASS_NOTEXISTS|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_ALREADYEXISTS CAST_TO_UINT32(3UL |ERRCODE_CLASS_ALREADYEXISTS|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_NOTADIRECTORY CAST_TO_UINT32(4UL |ERRCODE_CLASS_PARAMETER|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_NOTAFILE CAST_TO_UINT32(5UL |ERRCODE_CLASS_PARAMETER|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_INVALIDDEVICE CAST_TO_UINT32(6UL |ERRCODE_CLASS_PATH|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_ACCESSDENIED CAST_TO_UINT32(7UL |ERRCODE_CLASS_ACCESS|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_LOCKVIOLATION CAST_TO_UINT32(8UL |ERRCODE_CLASS_LOCKING|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_OUTOFSPACE CAST_TO_UINT32(9UL |ERRCODE_CLASS_SPACE|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_ISWILDCARD CAST_TO_UINT32(11UL|ERRCODE_CLASS_PARAMETER|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_NOTSUPPORTED CAST_TO_UINT32(12UL|ERRCODE_CLASS_NOTSUPPORTED|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_GENERAL CAST_TO_UINT32(13UL|ERRCODE_CLASS_GENERAL|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_TOOMANYOPENFILES CAST_TO_UINT32(14UL|ERRCODE_CLASS_SPACE|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_CANTREAD CAST_TO_UINT32(15UL|ERRCODE_CLASS_READ|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_CANTWRITE CAST_TO_UINT32(16UL|ERRCODE_CLASS_WRITE|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_OUTOFMEMORY CAST_TO_UINT32(17UL|ERRCODE_CLASS_SPACE|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_CANTSEEK CAST_TO_UINT32(18UL|ERRCODE_CLASS_GENERAL|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_CANTTELL CAST_TO_UINT32(19UL|ERRCODE_CLASS_GENERAL|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_WRONGVERSION CAST_TO_UINT32(20UL|ERRCODE_CLASS_VERSION|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_WRONGFORMAT CAST_TO_UINT32(21UL|ERRCODE_CLASS_FORMAT|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_INVALIDCHAR CAST_TO_UINT32(22UL|ERRCODE_CLASS_PARAMETER|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_UNKNOWN CAST_TO_UINT32(23UL|ERRCODE_CLASS_UNKNOWN|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_INVALIDACCESS CAST_TO_UINT32(24UL|ERRCODE_CLASS_ACCESS|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_CANTCREATE CAST_TO_UINT32(25UL|ERRCODE_CLASS_CREATE|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_INVALIDPARAMETER CAST_TO_UINT32(26UL|ERRCODE_CLASS_PARAMETER|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_ABORT CAST_TO_UINT32(27UL|ERRCODE_CLASS_ABORT|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_NOTEXISTSPATH CAST_TO_UINT32(28UL |ERRCODE_CLASS_NOTEXISTS|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_PENDING CAST_TO_UINT32(29UL |ERRCODE_CLASS_NOTEXISTS|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_RECURSIVE CAST_TO_UINT32(30UL |ERRCODE_CLASS_PARAMETER|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_NAMETOOLONG CAST_TO_UINT32(31UL |ERRCODE_CLASS_PARAMETER|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_INVALIDLENGTH CAST_TO_UINT32(32UL |ERRCODE_CLASS_PARAMETER|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_CURRENTDIR CAST_TO_UINT32(33UL |ERRCODE_CLASS_PARAMETER|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_NOTSAMEDEVICE CAST_TO_UINT32(34UL |ERRCODE_CLASS_PARAMETER|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_DEVICENOTREADY CAST_TO_UINT32(35UL |ERRCODE_CLASS_READ|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_BADCRC CAST_TO_UINT32(36UL |ERRCODE_CLASS_READ|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_WRITEPROTECTED CAST_TO_UINT32(37UL |ERRCODE_CLASS_ACCESS|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_BROKENPACKAGE CAST_TO_UINT32(38UL |ERRCODE_CLASS_FORMAT|\ - ERRCODE_AREA_IO) -#define ERRCODE_IO_NOTSTORABLEINBINARYFORMAT CAST_TO_UINT32(39UL |ERRCODE_CLASS_FORMAT|\ - ERRCODE_AREA_IO) +#define ERRCODE_CLASS_NONE ( 0 << ERRCODE_CLASS_SHIFT) +#define ERRCODE_CLASS_ABORT ( 1 << ERRCODE_CLASS_SHIFT) +#define ERRCODE_CLASS_GENERAL ( 2 << ERRCODE_CLASS_SHIFT) +#define ERRCODE_CLASS_NOTEXISTS ( 3 << ERRCODE_CLASS_SHIFT) +#define ERRCODE_CLASS_ALREADYEXISTS ( 4 << ERRCODE_CLASS_SHIFT) +#define ERRCODE_CLASS_ACCESS ( 5 << ERRCODE_CLASS_SHIFT) +#define ERRCODE_CLASS_PATH ( 6 << ERRCODE_CLASS_SHIFT) +#define ERRCODE_CLASS_LOCKING ( 7 << ERRCODE_CLASS_SHIFT) +#define ERRCODE_CLASS_PARAMETER ( 8 << ERRCODE_CLASS_SHIFT) +#define ERRCODE_CLASS_SPACE ( 9 << ERRCODE_CLASS_SHIFT) +#define ERRCODE_CLASS_NOTSUPPORTED (10 << ERRCODE_CLASS_SHIFT) +#define ERRCODE_CLASS_READ (11 << ERRCODE_CLASS_SHIFT) +#define ERRCODE_CLASS_WRITE (12 << ERRCODE_CLASS_SHIFT) +#define ERRCODE_CLASS_UNKNOWN (13 << ERRCODE_CLASS_SHIFT) +#define ERRCODE_CLASS_VERSION (14 << ERRCODE_CLASS_SHIFT) +#define ERRCODE_CLASS_FORMAT (15 << ERRCODE_CLASS_SHIFT) +#define ERRCODE_CLASS_CREATE (16 << ERRCODE_CLASS_SHIFT) +#define ERRCODE_CLASS_IMPORT (17 << ERRCODE_CLASS_SHIFT) +#define ERRCODE_CLASS_EXPORT (18 << ERRCODE_CLASS_SHIFT) +#define ERRCODE_CLASS_SO (20 << ERRCODE_CLASS_SHIFT) +#define ERRCODE_CLASS_SBX (21 << ERRCODE_CLASS_SHIFT) +#define ERRCODE_CLASS_RUNTIME (22 << ERRCODE_CLASS_SHIFT) +#define ERRCODE_CLASS_COMPILER (23 << ERRCODE_CLASS_SHIFT) + +#define ERRCODE_NONE ErrCode(0UL) + +#define ERRCODE_IO_MISPLACEDCHAR ErrCode(1UL | ERRCODE_CLASS_PARAMETER | ERRCODE_AREA_IO) +#define ERRCODE_IO_NOTEXISTS ErrCode(2UL | ERRCODE_CLASS_NOTEXISTS | ERRCODE_AREA_IO) +#define ERRCODE_IO_ALREADYEXISTS ErrCode(3UL | ERRCODE_CLASS_ALREADYEXISTS | ERRCODE_AREA_IO) +#define ERRCODE_IO_NOTADIRECTORY ErrCode(4UL | ERRCODE_CLASS_PARAMETER | ERRCODE_AREA_IO) +#define ERRCODE_IO_NOTAFILE ErrCode(5UL | ERRCODE_CLASS_PARAMETER | ERRCODE_AREA_IO) +#define ERRCODE_IO_INVALIDDEVICE ErrCode(6UL | ERRCODE_CLASS_PATH | ERRCODE_AREA_IO) +#define ERRCODE_IO_ACCESSDENIED ErrCode(7UL | ERRCODE_CLASS_ACCESS | ERRCODE_AREA_IO) +#define ERRCODE_IO_LOCKVIOLATION ErrCode(8UL | ERRCODE_CLASS_LOCKING | ERRCODE_AREA_IO) +#define ERRCODE_IO_OUTOFSPACE ErrCode(9UL | ERRCODE_CLASS_SPACE | ERRCODE_AREA_IO) +#define ERRCODE_IO_ISWILDCARD ErrCode(11UL | ERRCODE_CLASS_PARAMETER | ERRCODE_AREA_IO) +#define ERRCODE_IO_NOTSUPPORTED ErrCode(12UL | ERRCODE_CLASS_NOTSUPPORTED | ERRCODE_AREA_IO) +#define ERRCODE_IO_GENERAL ErrCode(13UL | ERRCODE_CLASS_GENERAL | ERRCODE_AREA_IO) +#define ERRCODE_IO_TOOMANYOPENFILES ErrCode(14UL | ERRCODE_CLASS_SPACE | ERRCODE_AREA_IO) +#define ERRCODE_IO_CANTREAD ErrCode(15UL | ERRCODE_CLASS_READ | ERRCODE_AREA_IO) +#define ERRCODE_IO_CANTWRITE ErrCode(16UL | ERRCODE_CLASS_WRITE | ERRCODE_AREA_IO) +#define ERRCODE_IO_OUTOFMEMORY ErrCode(17UL | ERRCODE_CLASS_SPACE | ERRCODE_AREA_IO) +#define ERRCODE_IO_CANTSEEK ErrCode(18UL | ERRCODE_CLASS_GENERAL | ERRCODE_AREA_IO) +#define ERRCODE_IO_CANTTELL ErrCode(19UL | ERRCODE_CLASS_GENERAL | ERRCODE_AREA_IO) +#define ERRCODE_IO_WRONGVERSION ErrCode(20UL | ERRCODE_CLASS_VERSION | ERRCODE_AREA_IO) +#define ERRCODE_IO_WRONGFORMAT ErrCode(21UL | ERRCODE_CLASS_FORMAT | ERRCODE_AREA_IO) +#define ERRCODE_IO_INVALIDCHAR ErrCode(22UL | ERRCODE_CLASS_PARAMETER | ERRCODE_AREA_IO) +#define ERRCODE_IO_UNKNOWN ErrCode(23UL | ERRCODE_CLASS_UNKNOWN | ERRCODE_AREA_IO) +#define ERRCODE_IO_INVALIDACCESS ErrCode(24UL | ERRCODE_CLASS_ACCESS | ERRCODE_AREA_IO) +#define ERRCODE_IO_CANTCREATE ErrCode(25UL | ERRCODE_CLASS_CREATE | ERRCODE_AREA_IO) +#define ERRCODE_IO_INVALIDPARAMETER ErrCode(26UL | ERRCODE_CLASS_PARAMETER | ERRCODE_AREA_IO) +#define ERRCODE_IO_ABORT ErrCode(27UL | ERRCODE_CLASS_ABORT | ERRCODE_AREA_IO) +#define ERRCODE_IO_NOTEXISTSPATH ErrCode(28UL | ERRCODE_CLASS_NOTEXISTS | ERRCODE_AREA_IO) +#define ERRCODE_IO_PENDING ErrCode(29UL | ERRCODE_CLASS_NOTEXISTS | ERRCODE_AREA_IO) +#define ERRCODE_IO_RECURSIVE ErrCode(30UL | ERRCODE_CLASS_PARAMETER | ERRCODE_AREA_IO) +#define ERRCODE_IO_NAMETOOLONG ErrCode(31UL | ERRCODE_CLASS_PARAMETER | ERRCODE_AREA_IO) +#define ERRCODE_IO_INVALIDLENGTH ErrCode(32UL | ERRCODE_CLASS_PARAMETER | ERRCODE_AREA_IO) +#define ERRCODE_IO_CURRENTDIR ErrCode(33UL | ERRCODE_CLASS_PARAMETER | ERRCODE_AREA_IO) +#define ERRCODE_IO_NOTSAMEDEVICE ErrCode(34UL | ERRCODE_CLASS_PARAMETER | ERRCODE_AREA_IO) +#define ERRCODE_IO_DEVICENOTREADY ErrCode(35UL | ERRCODE_CLASS_READ | ERRCODE_AREA_IO) +#define ERRCODE_IO_BADCRC ErrCode(36UL | ERRCODE_CLASS_READ | ERRCODE_AREA_IO) +#define ERRCODE_IO_WRITEPROTECTED ErrCode(37UL | ERRCODE_CLASS_ACCESS | ERRCODE_AREA_IO) +#define ERRCODE_IO_BROKENPACKAGE ErrCode(38UL | ERRCODE_CLASS_FORMAT | ERRCODE_AREA_IO) +#define ERRCODE_IO_NOTSTORABLEINBINARYFORMAT ErrCode(39UL | ERRCODE_CLASS_FORMAT | ERRCODE_AREA_IO) // StreamErrorCodes -#define SVSTREAM_GENERALERROR ERRCODE_IO_GENERAL -#define SVSTREAM_FILE_NOT_FOUND ERRCODE_IO_NOTEXISTS -#define SVSTREAM_PATH_NOT_FOUND ERRCODE_IO_NOTEXISTSPATH -#define SVSTREAM_TOO_MANY_OPEN_FILES ERRCODE_IO_TOOMANYOPENFILES -#define SVSTREAM_ACCESS_DENIED ERRCODE_IO_ACCESSDENIED -#define SVSTREAM_SHARING_VIOLATION ERRCODE_IO_LOCKVIOLATION -#define SVSTREAM_LOCKING_VIOLATION ERRCODE_IO_LOCKVIOLATION -#define SVSTREAM_SHARE_BUFF_EXCEEDED ERRCODE_IO_LOCKVIOLATION +#define SVSTREAM_GENERALERROR ERRCODE_IO_GENERAL +#define SVSTREAM_FILE_NOT_FOUND ERRCODE_IO_NOTEXISTS +#define SVSTREAM_PATH_NOT_FOUND ERRCODE_IO_NOTEXISTSPATH +#define SVSTREAM_TOO_MANY_OPEN_FILES ERRCODE_IO_TOOMANYOPENFILES +#define SVSTREAM_ACCESS_DENIED ERRCODE_IO_ACCESSDENIED +#define SVSTREAM_SHARING_VIOLATION ERRCODE_IO_LOCKVIOLATION +#define SVSTREAM_LOCKING_VIOLATION ERRCODE_IO_LOCKVIOLATION +#define SVSTREAM_SHARE_BUFF_EXCEEDED ERRCODE_IO_LOCKVIOLATION -#define SVSTREAM_INVALID_ACCESS ERRCODE_IO_INVALIDACCESS -#define SVSTREAM_INVALID_HANDLE ERRCODE_IO_GENERAL -#define SVSTREAM_CANNOT_MAKE ERRCODE_IO_CANTCREATE -#define SVSTREAM_INVALID_PARAMETER ERRCODE_IO_INVALIDPARAMETER +#define SVSTREAM_INVALID_ACCESS ERRCODE_IO_INVALIDACCESS +#define SVSTREAM_INVALID_HANDLE ERRCODE_IO_GENERAL +#define SVSTREAM_CANNOT_MAKE ERRCODE_IO_CANTCREATE +#define SVSTREAM_INVALID_PARAMETER ERRCODE_IO_INVALIDPARAMETER -#define SVSTREAM_READ_ERROR ERRCODE_IO_CANTREAD -#define SVSTREAM_WRITE_ERROR ERRCODE_IO_CANTWRITE -#define SVSTREAM_SEEK_ERROR ERRCODE_IO_CANTSEEK +#define SVSTREAM_READ_ERROR ERRCODE_IO_CANTREAD +#define SVSTREAM_WRITE_ERROR ERRCODE_IO_CANTWRITE +#define SVSTREAM_SEEK_ERROR ERRCODE_IO_CANTSEEK -#define SVSTREAM_OUTOFMEMORY ERRCODE_IO_OUTOFMEMORY +#define SVSTREAM_OUTOFMEMORY ERRCODE_IO_OUTOFMEMORY -#define SVSTREAM_FILEFORMAT_ERROR ERRCODE_IO_WRONGFORMAT -#define SVSTREAM_WRONGVERSION ERRCODE_IO_WRONGVERSION +#define SVSTREAM_FILEFORMAT_ERROR ERRCODE_IO_WRONGFORMAT +#define SVSTREAM_WRONGVERSION ERRCODE_IO_WRONGVERSION -#define SVSTREAM_DISK_FULL ERRCODE_IO_OUTOFSPACE +#define SVSTREAM_DISK_FULL ERRCODE_IO_OUTOFSPACE // For the EditEngine: -#define SVSTREAM_ERRBASE_USER ERRCODE_AREA_LIB1 +#define SVSTREAM_ERRBASE_USER ERRCODE_AREA_LIB1 + +#define PRINTER_ABORT ERRCODE_IO_ABORT +#define PRINTER_GENERALERROR ERRCODE_IO_GENERAL -#define PRINTER_ABORT ERRCODE_IO_ABORT -#define PRINTER_GENERALERROR ERRCODE_IO_GENERAL +#define ERRCODE_ABORT ERRCODE_IO_ABORT -#define ERRCODE_INET_NAME_RESOLVE (ERRCODE_AREA_INET | ERRCODE_CLASS_READ | 1) -#define ERRCODE_INET_CONNECT (ERRCODE_AREA_INET | ERRCODE_CLASS_READ | 2) -#define ERRCODE_INET_READ (ERRCODE_AREA_INET | ERRCODE_CLASS_READ | 3) -#define ERRCODE_INET_WRITE (ERRCODE_AREA_INET | ERRCODE_CLASS_WRITE| 4) -#define ERRCODE_INET_GENERAL (ERRCODE_AREA_INET | ERRCODE_CLASS_WRITE |5) -#define ERRCODE_INET_OFFLINE (ERRCODE_AREA_INET | ERRCODE_CLASS_READ |6) +#define ERRCODE_INET_NAME_RESOLVE ErrCode(ERRCODE_AREA_INET | ERRCODE_CLASS_READ | 1) +#define ERRCODE_INET_CONNECT ErrCode(ERRCODE_AREA_INET | ERRCODE_CLASS_READ | 2) +#define ERRCODE_INET_READ ErrCode(ERRCODE_AREA_INET | ERRCODE_CLASS_READ | 3) +#define ERRCODE_INET_WRITE ErrCode(ERRCODE_AREA_INET | ERRCODE_CLASS_WRITE| 4) +#define ERRCODE_INET_GENERAL ErrCode(ERRCODE_AREA_INET | ERRCODE_CLASS_WRITE| 5) +#define ERRCODE_INET_OFFLINE ErrCode(ERRCODE_AREA_INET | ERRCODE_CLASS_READ | 6) #endif diff --git a/include/vcl/errinf.hxx b/include/vcl/errinf.hxx index c55011dd0b5d..996afd23f8f1 100644 --- a/include/vcl/errinf.hxx +++ b/include/vcl/errinf.hxx @@ -131,8 +131,8 @@ public: @return what sort of dialog to use, with what buttons */ - static DialogMask HandleError(sal_uInt32 nId, DialogMask nMask = DialogMask::MAX); - static bool GetErrorString(sal_uInt32 nId, OUString& rStr); + static DialogMask HandleError(ErrCode nId, DialogMask nMask = DialogMask::MAX); + static bool GetErrorString(ErrCode nId, OUString& rStr); protected: virtual bool CreateString(const ErrorInfo*, OUString &) const = 0; @@ -142,16 +142,16 @@ protected: class SAL_WARN_UNUSED VCL_DLLPUBLIC ErrorInfo { public: - ErrorInfo(sal_uInt32 nArgUserId) : + ErrorInfo(ErrCode nArgUserId) : nUserId(nArgUserId) {} virtual ~ErrorInfo(); - sal_uInt32 GetErrorCode() const { return nUserId; } + ErrCode GetErrorCode() const { return nUserId; } - static ErrorInfo* GetErrorInfo(sal_uInt32); + static ErrorInfo* GetErrorInfo(ErrCode); private: - sal_uInt32 nUserId; + ErrCode nUserId; }; class SAL_WARN_UNUSED VCL_DLLPUBLIC DynamicErrorInfo : public ErrorInfo @@ -159,10 +159,10 @@ class SAL_WARN_UNUSED VCL_DLLPUBLIC DynamicErrorInfo : public ErrorInfo friend class ImplDynamicErrorInfo; public: - DynamicErrorInfo(sal_uInt32 nUserId, DialogMask nMask); + DynamicErrorInfo(ErrCode nUserId, DialogMask nMask); virtual ~DynamicErrorInfo() override; - operator sal_uInt32() const; + operator ErrCode() const; DialogMask GetDialogMask() const; private: @@ -173,7 +173,7 @@ private: class SAL_WARN_UNUSED VCL_DLLPUBLIC StringErrorInfo : public DynamicErrorInfo { public: - StringErrorInfo(sal_uInt32 nUserId, + StringErrorInfo(ErrCode nUserId, const OUString& aStringP, DialogMask nMask = DialogMask::NONE); @@ -187,7 +187,7 @@ private: class SAL_WARN_UNUSED VCL_DLLPUBLIC TwoStringErrorInfo: public DynamicErrorInfo { public: - TwoStringErrorInfo(sal_uInt32 nUserID, const OUString & rTheArg1, + TwoStringErrorInfo(ErrCode nUserID, const OUString & rTheArg1, const OUString & rTheArg2, DialogMask nMask): DynamicErrorInfo(nUserID, nMask), aArg1(rTheArg1), aArg2(rTheArg2) {} @@ -210,7 +210,7 @@ public: ErrorContext(vcl::Window *pWin); virtual ~ErrorContext(); - virtual bool GetString(sal_uInt32 nErrId, OUString& rCtxStr) = 0; + virtual bool GetString(ErrCode nErrId, OUString& rCtxStr) = 0; vcl::Window* GetParent(); static ErrorContext* GetContext(); diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx index fa112d71066c..d67237975ae1 100644 --- a/include/vcl/graphicfilter.hxx +++ b/include/vcl/graphicfilter.hxx @@ -36,13 +36,13 @@ class SvStream; struct WMF_EXTERNALHEADER; struct ConvertData; -#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 ERRCODE_GRFILTER_OPENERROR ErrCode(ERRCODE_AREA_VCL | ERRCODE_CLASS_GENERAL | 1) +#define ERRCODE_GRFILTER_IOERROR ErrCode(ERRCODE_AREA_VCL | ERRCODE_CLASS_GENERAL | 2) +#define ERRCODE_GRFILTER_FORMATERROR ErrCode(ERRCODE_AREA_VCL | ERRCODE_CLASS_GENERAL | 3) +#define ERRCODE_GRFILTER_VERSIONERROR ErrCode(ERRCODE_AREA_VCL | ERRCODE_CLASS_GENERAL | 4) +#define ERRCODE_GRFILTER_FILTERERROR ErrCode(ERRCODE_AREA_VCL | ERRCODE_CLASS_GENERAL | 5) +#define ERRCODE_GRFILTER_ABORT ErrCode(ERRCODE_AREA_VCL | ERRCODE_CLASS_GENERAL | 6) +#define ERRCODE_GRFILTER_TOOBIG ErrCode(ERRCODE_AREA_VCL | ERRCODE_CLASS_GENERAL | 7) #define GRFILTER_OUTHINT_GREY 1 @@ -220,9 +220,9 @@ public: /** Information about errors during the GraphicFilter operation. */ struct FilterErrorEx { - sal_uLong nStreamError; + ErrCode nStreamError; - FilterErrorEx() : nStreamError( 0UL ) {} + FilterErrorEx() : nStreamError( ERRCODE_NONE ) {} }; /** Class to import and export graphic formats. */ @@ -271,11 +271,11 @@ public: sal_uInt16 nFormat = GRFILTER_FORMAT_DONTKNOW, sal_uInt16 * pDeterminedFormat = nullptr, GraphicFilterImportFlags nImportFlags = GraphicFilterImportFlags::NONE ); - sal_uInt16 CanImportGraphic( const OUString& rPath, SvStream& rStream, + ErrCode CanImportGraphic( const OUString& rPath, SvStream& rStream, sal_uInt16 nFormat, sal_uInt16 * pDeterminedFormat); - sal_uInt16 ImportGraphic( Graphic& rGraphic, const OUString& rPath, + ErrCode ImportGraphic( Graphic& rGraphic, const OUString& rPath, SvStream& rStream, sal_uInt16 nFormat = GRFILTER_FORMAT_DONTKNOW, sal_uInt16 * pDeterminedFormat = nullptr, GraphicFilterImportFlags nImportFlags = GraphicFilterImportFlags::NONE, @@ -298,12 +298,12 @@ public: const Link<ConvertData&,bool> GetFilterCallback() const; static GraphicFilter& GetGraphicFilter(); - static int LoadGraphic( const OUString& rPath, const OUString& rFilter, + static ErrCode LoadGraphic( const OUString& rPath, const OUString& rFilter, Graphic& rGraphic, GraphicFilter* pFilter = nullptr, sal_uInt16* pDeterminedFormat = nullptr ); - sal_uInt16 compressAsPNG(const Graphic& rGraphic, SvStream& rOutputStream); + ErrCode compressAsPNG(const Graphic& rGraphic, SvStream& rOutputStream); protected: OUString aFilterPath; @@ -311,7 +311,7 @@ protected: private: void ImplInit(); - sal_uLong ImplSetError( sal_uLong nError, const SvStream* pStm = nullptr ); + ErrCode ImplSetError( ErrCode nError, const SvStream* pStm = nullptr ); ErrCode ImpTestOrFindFormat( const OUString& rPath, SvStream& rStream, sal_uInt16& rFormat ); DECL_LINK( FilterCallback, ConvertData&, bool ); diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index 90faa219190b..4de18652f0a8 100644 --- a/include/vcl/print.hxx +++ b/include/vcl/print.hxx @@ -193,7 +193,7 @@ private: JobSetup maJobSetup; Point maPageOffset; Size maPaperSize; - sal_uLong mnError; + ErrCode mnError; sal_uInt16 mnPageQueueSize; sal_uInt16 mnCopyCount; bool mbDefPrinter; @@ -215,7 +215,7 @@ private: SAL_DLLPRIVATE bool StartJob( const OUString& rJobName, std::shared_ptr<vcl::PrinterController>& ); - static SAL_DLLPRIVATE sal_uLong + static SAL_DLLPRIVATE ErrCode ImplSalPrinterErrorCodeToVCL( sal_uLong nError ); private: diff --git a/include/xmloff/xmlexp.hxx b/include/xmloff/xmlexp.hxx index c8d0ffe41524..edfd17e4f9e3 100644 --- a/include/xmloff/xmlexp.hxx +++ b/include/xmloff/xmlexp.hxx @@ -60,6 +60,7 @@ #include <xmloff/ProgressBarHelper.hxx> #include <cppuhelper/implbase.hxx> #include <tools/fldunit.hxx> +#include <vcl/errcode.hxx> #include <list> #include <memory> @@ -398,7 +399,7 @@ public: void addChaffWhenEncryptedStorage(); // Export the document. - virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ); + virtual ErrCode exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ); virtual void addDataStyle(const sal_Int32 nNumberFormat, bool bTimeFormat = false ); virtual void exportDataStyles(); diff --git a/linguistic/source/convdicxml.cxx b/linguistic/source/convdicxml.cxx index 438b455afde3..e5ac95339348 100644 --- a/linguistic/source/convdicxml.cxx +++ b/linguistic/source/convdicxml.cxx @@ -295,7 +295,7 @@ bool ConvDicXMLExport::Export() } -sal_uInt32 ConvDicXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum /*eClass*/ ) +ErrCode ConvDicXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum /*eClass*/ ) { GetNamespaceMap_().Add( "tcd", XML_NAMESPACE_TCD_STRING, XML_NAMESPACE_TCD ); diff --git a/linguistic/source/convdicxml.hxx b/linguistic/source/convdicxml.hxx index 019dc03fdd06..8463d190a0e2 100644 --- a/linguistic/source/convdicxml.hxx +++ b/linguistic/source/convdicxml.hxx @@ -56,7 +56,7 @@ public: void ExportAutoStyles_() override {} void ExportMasterStyles_() override {} void ExportContent_() override; - sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ) override; + ErrCode exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ) override; bool Export(); }; diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx index 488c62bf454a..dd32758e2482 100644 --- a/linguistic/source/dicimp.cxx +++ b/linguistic/source/dicimp.cxx @@ -226,7 +226,7 @@ DictionaryNeo::~DictionaryNeo() { } -sal_uLong DictionaryNeo::loadEntries(const OUString &rMainURL) +ErrCode DictionaryNeo::loadEntries(const OUString &rMainURL) { MutexGuard aGuard( GetLinguMutex() ); @@ -238,7 +238,7 @@ sal_uLong DictionaryNeo::loadEntries(const OUString &rMainURL) bNeedEntries = false; if (rMainURL.isEmpty()) - return 0; + return ERRCODE_NONE; uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); @@ -254,7 +254,7 @@ sal_uLong DictionaryNeo::loadEntries(const OUString &rMainURL) SAL_WARN( "linguistic", "failed to get input stream" ); } if (!xStream.is()) - return static_cast< sal_uLong >(-1); + return ErrCode(sal_uInt32(-1)); SvStreamPtr pStream = SvStreamPtr( utl::UcbStreamHelper::CreateStream( xStream ) ); @@ -262,8 +262,8 @@ sal_uLong DictionaryNeo::loadEntries(const OUString &rMainURL) bool bNegativ; LanguageType nLang; nDicVersion = ReadDicVersion(pStream, nLang, bNegativ); - sal_uLong nErr = pStream->GetError(); - if (0 != nErr) + ErrCode nErr = pStream->GetError(); + if (nErr != ERRCODE_NONE) return nErr; nLanguage = nLang; @@ -286,12 +286,12 @@ sal_uLong DictionaryNeo::loadEntries(const OUString &rMainURL) if (!pStream->IsEof()) { pStream->ReadUInt16( nLen ); - if (0 != (nErr = pStream->GetError())) + if (ERRCODE_NONE != (nErr = pStream->GetError())) return nErr; if ( nLen < BUFSIZE ) { pStream->ReadBytes(aWordBuf, nLen); - if (0 != (nErr = pStream->GetError())) + if (ERRCODE_NONE != (nErr = pStream->GetError())) return nErr; *(aWordBuf + nLen) = 0; } @@ -314,13 +314,13 @@ sal_uLong DictionaryNeo::loadEntries(const OUString &rMainURL) pStream->ReadUInt16( nLen ); if (pStream->IsEof()) break; - if (0 != (nErr = pStream->GetError())) + if (ERRCODE_NONE != (nErr = pStream->GetError())) return nErr; if (nLen < BUFSIZE) { pStream->ReadBytes(aWordBuf, nLen); - if (0 != (nErr = pStream->GetError())) + if (ERRCODE_NONE != (nErr = pStream->GetError())) return nErr; } else @@ -367,12 +367,12 @@ static OString formatForSave(const uno::Reference< XDictionaryEntry > &xEntry, return aStr.makeStringAndClear(); } -sal_uLong DictionaryNeo::saveEntries(const OUString &rURL) +ErrCode DictionaryNeo::saveEntries(const OUString &rURL) { MutexGuard aGuard( GetLinguMutex() ); if (rURL.isEmpty()) - return 0; + return ERRCODE_NONE; DBG_ASSERT(!INetURLObject( rURL ).HasError(), "lng : invalid URL"); uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); @@ -388,7 +388,7 @@ sal_uLong DictionaryNeo::saveEntries(const OUString &rURL) DBG_ASSERT( false, "failed to get input stream" ); } if (!xStream.is()) - return static_cast< sal_uLong >(-1); + return ErrCode(sal_uInt32(-1)); SvStreamPtr pStream = SvStreamPtr( utl::UcbStreamHelper::CreateStream( xStream ) ); @@ -396,8 +396,8 @@ sal_uLong DictionaryNeo::saveEntries(const OUString &rURL) rtl_TextEncoding eEnc = RTL_TEXTENCODING_UTF8; pStream->WriteLine(OString(pVerOOo7)); - sal_uLong nErr = pStream->GetError(); - if (0 != nErr) + ErrCode nErr = pStream->GetError(); + if (nErr != ERRCODE_NONE) return nErr; /* XXX: the <none> case could be differentiated, is it absence or * undetermined or multiple? Earlier versions did not know about 'und' and @@ -410,22 +410,22 @@ sal_uLong DictionaryNeo::saveEntries(const OUString &rURL) aLine.append(OUStringToOString(LanguageTag::convertToBcp47(nLanguage), eEnc)); pStream->WriteLine(aLine.makeStringAndClear()); } - if (0 != (nErr = pStream->GetError())) + if (ERRCODE_NONE != (nErr = pStream->GetError())) return nErr; if (eDicType == DictionaryType_POSITIVE) pStream->WriteLine(OString("type: positive")); else pStream->WriteLine(OString("type: negative")); - if (0 != (nErr = pStream->GetError())) + if (ERRCODE_NONE != (nErr = pStream->GetError())) return nErr; pStream->WriteLine(OString("---")); - if (0 != (nErr = pStream->GetError())) + if (ERRCODE_NONE != (nErr = pStream->GetError())) return nErr; for (Reference<XDictionaryEntry> & aEntrie : aEntries) { OString aOutStr = formatForSave(aEntrie, eEnc); pStream->WriteLine (aOutStr); - if (0 != (nErr = pStream->GetError())) + if (ERRCODE_NONE != (nErr = pStream->GetError())) return nErr; } @@ -444,7 +444,7 @@ sal_uLong DictionaryNeo::saveEntries(const OUString &rURL) catch (const uno::Exception &) { DBG_ASSERT( false, "failed to write stream" ); - return static_cast< sal_uLong >(-1); + return ErrCode(sal_uInt32(-1)); } return nErr; diff --git a/linguistic/source/dicimp.hxx b/linguistic/source/dicimp.hxx index 6fef2c4f10b1..10beccdf7043 100644 --- a/linguistic/source/dicimp.hxx +++ b/linguistic/source/dicimp.hxx @@ -27,6 +27,7 @@ #include <cppuhelper/implbase.hxx> #include <comphelper/interfacecontainer2.hxx> #include <tools/solar.h> +#include <vcl/errcode.hxx> #include "defs.hxx" #include "linguistic/misc.hxx" @@ -62,8 +63,8 @@ class DictionaryNeo : void launchEvent(sal_Int16 nEvent, const css::uno::Reference< css::linguistic2::XDictionaryEntry >& xEntry); - sal_uLong loadEntries(const OUString &rMainURL); - sal_uLong saveEntries(const OUString &rMainURL); + ErrCode loadEntries(const OUString &rMainURL); + ErrCode saveEntries(const OUString &rMainURL); static int cmpDicEntry(const OUString &rWord1, const OUString &rWord2, bool bSimilarOnly = false); diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx index 6e3717fc9f10..6bd7c15b6831 100644 --- a/oox/source/ppt/pptimport.cxx +++ b/oox/source/ppt/pptimport.cxx @@ -147,7 +147,7 @@ bool PowerPointImport::importDocument() INetURLObject aURL(getFileUrl()); SfxErrorContext aContext(ERRCTX_SFX_OPENDOC, aURL.getName(INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset), nullptr, RID_ERRCTX); OUString aWarning; - aContext.GetString(ERRCODE_WARNING_MASK, aWarning); + aContext.GetString(ERRCODE_NONE.MakeWarning(), aWarning); aWarning += ":\n"; static ResMgr* pResMgr = ResMgr::CreateResMgr("svx", Application::GetSettings().GetUILanguageTag()); aWarning += ResId(RID_SVXSTR_WARN_MISSING_SMARTART, *pResMgr).toString(); diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx index c6f4d69b501c..db0e0e033cd0 100644 --- a/reportdesign/source/filter/xml/xmlfilter.cxx +++ b/reportdesign/source/filter/xml/xmlfilter.cxx @@ -112,7 +112,7 @@ void RptMLMasterStylesContext_Impl::EndElement() } /// read a component (file + filter version) -sal_Int32 ReadThroughComponent( +ErrCode ReadThroughComponent( const uno::Reference<XInputStream>& xInputStream, const uno::Reference<XComponent>& xModelComponent, const sal_Char* /*pStreamName*/, @@ -134,7 +134,7 @@ sal_Int32 ReadThroughComponent( // get filter OSL_ENSURE( _xFilter.is(), "Can't instantiate filter component." ); if( !_xFilter.is() ) - return 1; + return ErrCode(1); // connect parser and filter xParser->setDocumentHandler( _xFilter ); @@ -161,11 +161,11 @@ sal_Int32 ReadThroughComponent( #else (void)r; #endif - return 1; + return ErrCode(1); } catch (const SAXException&) { - return 1; + return ErrCode(1); } catch (const packages::zip::ZipIOException&) { @@ -173,19 +173,19 @@ sal_Int32 ReadThroughComponent( } catch (const IOException&) { - return 1; + return ErrCode(1); } catch (const Exception&) { - return 1; + return ErrCode(1); } // success! - return 0; + return ERRCODE_NONE; } /// read a component (storage version) -sal_Int32 ReadThroughComponent( +ErrCode ReadThroughComponent( const uno::Reference< embed::XStorage >& xStorage, const uno::Reference<XComponent>& xModelComponent, const sal_Char* pStreamName, @@ -215,12 +215,12 @@ sal_Int32 ReadThroughComponent( // do we even have an alternative name? if ( nullptr == pCompatibilityStreamName ) - return 0; + return ERRCODE_NONE; // if so, does the stream exist? sStreamName = OUString::createFromAscii(pCompatibilityStreamName); if ( !xStorage->hasByName( sStreamName ) || !xStorage->isStreamElement( sStreamName ) ) - return 0; + return ERRCODE_NONE; } // get input stream @@ -235,7 +235,7 @@ sal_Int32 ReadThroughComponent( } catch (const uno::Exception&) { - return 1; // TODO/LATER: error handling + return ErrCode(1); // TODO/LATER: error handling } sal_Int32 nArgs = 0; @@ -270,7 +270,7 @@ sal_Int32 ReadThroughComponent( } // TODO/LATER: better error handling - return 1; + return ErrCode(1); } @@ -510,7 +510,7 @@ bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) static const char s_sMeta[] = "meta.xml"; static const char s_sStreamName[] = "StreamName"; xProp->setPropertyValue(s_sStreamName, uno::makeAny(OUString(s_sMeta))); - sal_Int32 nRet = ReadThroughComponent( xStorage + ErrCode nRet = ReadThroughComponent( xStorage ,xModel ,"meta.xml" ,"Meta.xml" @@ -531,7 +531,7 @@ bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) xProp->setPropertyValue(s_sOld,uno::makeAny(true)); } - if ( nRet == 0 ) + if ( nRet == ERRCODE_NONE ) { xProp->setPropertyValue(s_sStreamName, uno::makeAny(OUString("settings.xml"))); nRet = ReadThroughComponent( xStorage @@ -545,7 +545,7 @@ bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) ,xProp ); } - if ( nRet == 0 ) + if ( nRet == ERRCODE_NONE ) { xProp->setPropertyValue(s_sStreamName, uno::makeAny(OUString("styles.xml"))); nRet = ReadThroughComponent(xStorage @@ -559,7 +559,7 @@ bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) ,xProp); } - if ( nRet == 0 ) + if ( nRet == ERRCODE_NONE ) { xProp->setPropertyValue(s_sStreamName, uno::makeAny(OUString("content.xml"))); nRet = ReadThroughComponent( xStorage @@ -575,7 +575,8 @@ bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) } - bRet = nRet == 0; + bRet = false; + nRet = ERRCODE_NONE; if ( bRet ) { @@ -583,22 +584,14 @@ bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) } else { - switch( nRet ) + if( nRet == ERRCODE_IO_BROKENPACKAGE && xStorage.is() ) + ; // TODO/LATER: no way to transport the error outside from the filter! + else { - case ERRCODE_IO_BROKENPACKAGE: - if( xStorage.is() ) - { - // TODO/LATER: no way to transport the error outside from the filter! - break; - } - SAL_FALLTHROUGH; - default: - { - // TODO/LATER: this is completely wrong! Filter code should never call ErrorHandler directly! But for now this is the only way! - ErrorHandler::HandleError( nRet ); - if( nRet & ERRCODE_WARNING_MASK ) - bRet = true; - } + // TODO/LATER: this is completely wrong! Filter code should never call ErrorHandler directly! But for now this is the only way! + ErrorHandler::HandleError( nRet ); + if( nRet.IsWarning() ) + bRet = true; } } } diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 57f06cb89fad..0d2ed2a07cb7 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -386,7 +386,7 @@ private: ScMarkData maPreviewSelection; sal_Int64 nUnoObjectId; // counted up for UNO objects - sal_uInt32 nRangeOverflowType; // used in (xml) loading for overflow warnings + ErrCode nRangeOverflowType; // used in (xml) loading for overflow warnings ScRange aEmbedRange; ScAddress aCurTextWidthCalcPos; @@ -1944,9 +1944,9 @@ public: bool GetHasMacroFunc() const { return bHasMacroFunc; } void SetHasMacroFunc(bool bSet) { bHasMacroFunc = bSet; } - void SetRangeOverflowType(sal_uInt32 nType) { nRangeOverflowType = nType; } - bool HasRangeOverflow() const { return nRangeOverflowType != 0; } - SC_DLLPUBLIC sal_uInt32 GetRangeOverflowType() const { return nRangeOverflowType; } + void SetRangeOverflowType(ErrCode nType) { nRangeOverflowType = nType; } + bool HasRangeOverflow() const { return nRangeOverflowType != ERRCODE_NONE; } + SC_DLLPUBLIC ErrCode GetRangeOverflowType() const { return nRangeOverflowType; } // for broadcasting/listening void SetInsertingFromOtherDoc( bool bVal ) { bInsertingFromOtherDoc = bVal; } diff --git a/sc/inc/filter.hxx b/sc/inc/filter.hxx index 750af6986d8f..04a0f4206985 100644 --- a/sc/inc/filter.hxx +++ b/sc/inc/filter.hxx @@ -48,7 +48,7 @@ enum ExportFormatExcel { ExpBiff2, ExpBiff3, ExpBiff4, ExpBiff4W, ExpBiff5, ExpB class ScEEAbsImport { public: virtual ~ScEEAbsImport() {} - virtual sal_uLong Read( SvStream& rStream, const OUString& rBaseURL ) = 0; + virtual ErrCode Read( SvStream& rStream, const OUString& rBaseURL ) = 0; virtual ScRange GetRange() = 0; virtual void WriteToDocument( bool bSizeColsRows = false, double nOutputFactor = 1.0, diff --git a/sc/inc/scerrors.hxx b/sc/inc/scerrors.hxx index 0c16534f0b1e..859d5a0befca 100644 --- a/sc/inc/scerrors.hxx +++ b/sc/inc/scerrors.hxx @@ -23,59 +23,59 @@ #include <vcl/errcode.hxx> // ERRCODE_CLASS_READ - file related, displays "Read-Error" in MsgBox -#define SCERR_IMPORT_CONNECT ( 1 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) -#define SCERR_IMPORT_OPEN ( 2 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) -#define SCERR_IMPORT_UNKNOWN ( 3 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_CONNECT ErrCode( 1 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_OPEN ErrCode( 2 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_UNKNOWN ErrCode( 3 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) // out of memory -#define SCERR_IMPORT_OUTOFMEM ( 4 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_OUTOFMEM ErrCode( 4 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) // unknown WK? format (Lotus 1-2-3) -#define SCERR_IMPORT_UNKNOWN_WK ( 5 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_UNKNOWN_WK ErrCode( 5 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) // format error during reading (no formula error!) -#define SCERR_IMPORT_FORMAT ( 6 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_FORMAT ErrCode( 6 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) // filter not implemented -#define SCERR_IMPORT_NI ( 7 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_NI ErrCode( 7 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) // unknown BIFF format (Excel) -#define SCERR_IMPORT_UNKNOWN_BIFF ( 8 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) -#define SCERR_IMPORT_NI_BIFF ( 9 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_UNKNOWN_BIFF ErrCode( 8 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_NI_BIFF ErrCode( 9 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) // file password protected -#define SCERR_IMPORT_FILEPASSWD ( 10 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_FILEPASSWD ErrCode( 10 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) // internal error -#define SCERR_IMPORT_INTERNAL ( 11 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) -#define SCERR_IMPORT_8K_LIMIT ( 12 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) -#define SCWARN_IMPORT_OPEN_FM3 ( 13 | ERRCODE_CLASS_READ | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) -#define SCWARN_IMPORT_WRONG_FM3 ( 14 | ERRCODE_CLASS_READ | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) -#define SCWARN_IMPORT_INFOLOST ( 15 | ERRCODE_CLASS_READ | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) -#define SCERR_IMPORT_FILE_ROWCOL ( 16 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) -#define SCERR_IMPORT_FORMAT_ROWCOL ( 17 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) -#define SCWARN_IMPORT_FILE_ROWCOL ( 18 | ERRCODE_CLASS_READ | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_INTERNAL ErrCode( 11 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_8K_LIMIT ErrCode( 12 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCWARN_IMPORT_OPEN_FM3 ErrCode( 13 | ERRCODE_CLASS_READ | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) +#define SCWARN_IMPORT_WRONG_FM3 ErrCode( 14 | ERRCODE_CLASS_READ | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) +#define SCWARN_IMPORT_INFOLOST ErrCode( 15 | ERRCODE_CLASS_READ | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_FILE_ROWCOL ErrCode( 16 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_FORMAT_ROWCOL ErrCode( 17 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCWARN_IMPORT_FILE_ROWCOL ErrCode( 18 | ERRCODE_CLASS_READ | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) // ERRCODE_CLASS_WRITE - file related, displays "Write-Error" in MsgBox -#define SCERR_EXPORT_CONNECT ( 1 | ERRCODE_CLASS_WRITE | ERRCODE_AREA_SC ) -#define SCERR_EXPORT_DATA ( 2 | ERRCODE_CLASS_WRITE | ERRCODE_AREA_SC ) -#define SCERR_EXPORT_ENCODING ( 3 | ERRCODE_CLASS_WRITE | ERRCODE_AREA_SC ) -#define SCERR_EXPORT_FIELDWIDTH ( 4 | ERRCODE_CLASS_WRITE | ERRCODE_AREA_SC ) -#define SCERR_EXPORT_SQLEXCEPTION ( 5 | ERRCODE_CLASS_WRITE | ERRCODE_AREA_SC ) +#define SCERR_EXPORT_CONNECT ErrCode( 1 | ERRCODE_CLASS_WRITE | ERRCODE_AREA_SC ) +#define SCERR_EXPORT_DATA ErrCode( 2 | ERRCODE_CLASS_WRITE | ERRCODE_AREA_SC ) +#define SCERR_EXPORT_ENCODING ErrCode( 3 | ERRCODE_CLASS_WRITE | ERRCODE_AREA_SC ) +#define SCERR_EXPORT_FIELDWIDTH ErrCode( 4 | ERRCODE_CLASS_WRITE | ERRCODE_AREA_SC ) +#define SCERR_EXPORT_SQLEXCEPTION ErrCode( 5 | ERRCODE_CLASS_WRITE | ERRCODE_AREA_SC ) // ERRCODE_CLASS_IMPORT - does not display "Read-Error" in MsgBox // overflow of cell coordinates // table restricted to valid area (?) -#define SCWARN_IMPORT_RANGE_OVERFLOW ( 1 | ERRCODE_CLASS_IMPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) -#define SCWARN_IMPORT_ROW_OVERFLOW ( 2 | ERRCODE_CLASS_IMPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) -#define SCWARN_IMPORT_COLUMN_OVERFLOW ( 3 | ERRCODE_CLASS_IMPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) -#define SCWARN_IMPORT_SHEET_OVERFLOW ( 4 | ERRCODE_CLASS_IMPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) -#define SCWARN_IMPORT_CELL_OVERFLOW ( 5 | ERRCODE_CLASS_IMPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) -#define SCWARN_IMPORT_FEATURES_LOST ( 6 | ERRCODE_CLASS_IMPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) +#define SCWARN_IMPORT_RANGE_OVERFLOW ErrCode( 1 | ERRCODE_CLASS_IMPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) +#define SCWARN_IMPORT_ROW_OVERFLOW ErrCode( 2 | ERRCODE_CLASS_IMPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) +#define SCWARN_IMPORT_COLUMN_OVERFLOW ErrCode( 3 | ERRCODE_CLASS_IMPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) +#define SCWARN_IMPORT_SHEET_OVERFLOW ErrCode( 4 | ERRCODE_CLASS_IMPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) +#define SCWARN_IMPORT_CELL_OVERFLOW ErrCode( 5 | ERRCODE_CLASS_IMPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) +#define SCWARN_IMPORT_FEATURES_LOST ErrCode( 6 | ERRCODE_CLASS_IMPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) // ERRCODE_CLASS_EXPORT - does not display "Write-Error" in MsgBox -#define SCWARN_EXPORT_NONCONVERTIBLE_CHARS ( 1 | ERRCODE_CLASS_EXPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) -#define SCWARN_EXPORT_ASCII ( 2 | ERRCODE_CLASS_EXPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) -#define SCWARN_EXPORT_MAXROW ( 3 | ERRCODE_CLASS_EXPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) -#define SCWARN_EXPORT_MAXCOL ( 4 | ERRCODE_CLASS_EXPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) -#define SCWARN_EXPORT_MAXTAB ( 5 | ERRCODE_CLASS_EXPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) -#define SCWARN_EXPORT_DATALOST ( 6 | ERRCODE_CLASS_EXPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) +#define SCWARN_EXPORT_NONCONVERTIBLE_CHARS ErrCode( 1 | ERRCODE_CLASS_EXPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) +#define SCWARN_EXPORT_ASCII ErrCode( 2 | ERRCODE_CLASS_EXPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) +#define SCWARN_EXPORT_MAXROW ErrCode( 3 | ERRCODE_CLASS_EXPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) +#define SCWARN_EXPORT_MAXCOL ErrCode( 4 | ERRCODE_CLASS_EXPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) +#define SCWARN_EXPORT_MAXTAB ErrCode( 5 | ERRCODE_CLASS_EXPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) +#define SCWARN_EXPORT_DATALOST ErrCode( 6 | ERRCODE_CLASS_EXPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) // ERRCODE_CLASS_GENERAL -#define SCWARN_CORE_HARD_RECALC ( 1 | ERRCODE_CLASS_GENERAL | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) +#define SCWARN_CORE_HARD_RECALC ErrCode( 1 | ERRCODE_CLASS_GENERAL | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) #endif diff --git a/sc/inc/xmlwrap.hxx b/sc/inc/xmlwrap.hxx index 080264c753db..d2da6068ee4b 100644 --- a/sc/inc/xmlwrap.hxx +++ b/sc/inc/xmlwrap.hxx @@ -68,7 +68,7 @@ class ScXMLImportWrapper css::uno::Reference< css::task::XStatusIndicator> GetStatusIndicator(); - sal_uInt32 ImportFromComponent(const css::uno::Reference<css::uno::XComponentContext>& xContext, + ErrCode ImportFromComponent(const css::uno::Reference<css::uno::XComponentContext>& xContext, css::uno::Reference<css::frame::XModel>& xModel, css::uno::Reference<css::xml::sax::XParser>& xParser, css::xml::sax::InputSource& aParserInput, diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index ed957bbf2db0..5eef8b5a167f 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -586,7 +586,7 @@ void ScHTMLExport::WriteBody() { // Save graphic as (JPG) file aGrfNm = aStreamPath; - sal_uInt16 nErr = XOutBitmap::WriteGraphic( *pGrf, aGrfNm, + ErrCode nErr = XOutBitmap::WriteGraphic( *pGrf, aGrfNm, "JPG", XOutFlags::UseNativeIfPossible ); if( !nErr ) // Contains errors, as we have nothing to output { diff --git a/sc/source/filter/html/htmlexp2.cxx b/sc/source/filter/html/htmlexp2.cxx index 9b751d3b7ee3..3b9179b081f4 100644 --- a/sc/source/filter/html/htmlexp2.cxx +++ b/sc/source/filter/html/htmlexp2.cxx @@ -185,7 +185,7 @@ void ScHTMLExport::WriteImage( OUString& rLinkName, const Graphic& rGrf, // Save as a PNG OUString aGrfNm( aStreamPath ); nXOutFlags |= XOutFlags::UseNativeIfPossible; - sal_uInt16 nErr = XOutBitmap::WriteGraphic( rGrf, aGrfNm, + ErrCode nErr = XOutBitmap::WriteGraphic( rGrf, aGrfNm, "PNG", nXOutFlags ); // If it worked, create a URL for the IMG tag diff --git a/sc/source/filter/html/htmlimp.cxx b/sc/source/filter/html/htmlimp.cxx index 41c9d6cd0a5c..5dc06c5a8054 100644 --- a/sc/source/filter/html/htmlimp.cxx +++ b/sc/source/filter/html/htmlimp.cxx @@ -47,7 +47,7 @@ ErrCode ScFormatFilterPluginImpl::ScImportHTML( SvStream &rStream, const OUStrin bool bConvertDate ) { ScHTMLImport aImp( pDoc, rBaseURL, rRange, bCalcWidthHeight ); - ErrCode nErr = (ErrCode) aImp.Read( rStream, rBaseURL ); + ErrCode nErr = aImp.Read( rStream, rBaseURL ); ScRange aR = aImp.GetRange(); rRange.aEnd = aR.aEnd; aImp.WriteToDocument( true, nOutputFactor, pFormatter, bConvertDate ); diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index fa3e2d8f8f51..87d444436546 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -254,7 +254,7 @@ ScHTMLLayoutParser::~ScHTMLLayoutParser() } } -sal_uLong ScHTMLLayoutParser::Read( SvStream& rStream, const OUString& rBaseURL ) +ErrCode ScHTMLLayoutParser::Read( SvStream& rStream, const OUString& rBaseURL ) { Link<HtmlImportInfo&,void> aOldLink = pEdit->GetHtmlImportHdl(); pEdit->SetHtmlImportHdl( LINK( this, ScHTMLLayoutParser, HTMLImportHdl ) ); @@ -282,7 +282,7 @@ sal_uLong ScHTMLLayoutParser::Read( SvStream& rStream, const OUString& rBaseURL } } - sal_uLong nErr = pEdit->Read( rStream, rBaseURL, EE_FORMAT_HTML, pAttributes ); + ErrCode nErr = pEdit->Read( rStream, rBaseURL, EE_FORMAT_HTML, pAttributes ); pEdit->SetHtmlImportHdl( aOldLink ); // Create column width @@ -2828,7 +2828,7 @@ ScHTMLQueryParser::~ScHTMLQueryParser() { } -sal_uLong ScHTMLQueryParser::Read( SvStream& rStrm, const OUString& rBaseURL ) +ErrCode ScHTMLQueryParser::Read( SvStream& rStrm, const OUString& rBaseURL ) { SvKeyValueIteratorRef xValues; SvKeyValueIterator* pAttributes = nullptr; @@ -2856,7 +2856,7 @@ sal_uLong ScHTMLQueryParser::Read( SvStream& rStrm, const OUString& rBaseURL ) Link<HtmlImportInfo&,void> aOldLink = pEdit->GetHtmlImportHdl(); pEdit->SetHtmlImportHdl( LINK( this, ScHTMLQueryParser, HTMLImportHdl ) ); - sal_uLong nErr = pEdit->Read( rStrm, rBaseURL, EE_FORMAT_HTML, pAttributes ); + ErrCode nErr = pEdit->Read( rStrm, rBaseURL, EE_FORMAT_HTML, pAttributes ); pEdit->SetHtmlImportHdl( aOldLink ); mxGlobTable->Recalc(); diff --git a/sc/source/filter/inc/eeimport.hxx b/sc/source/filter/inc/eeimport.hxx index 75ac0902ca58..c65db788e7d7 100644 --- a/sc/source/filter/inc/eeimport.hxx +++ b/sc/source/filter/inc/eeimport.hxx @@ -54,7 +54,7 @@ public: ScEEImport( ScDocument* pDoc, const ScRange& rRange ); virtual ~ScEEImport() override; - virtual sal_uLong Read( SvStream& rStream, const OUString& rBaseURL ) override; + virtual ErrCode Read( SvStream& rStream, const OUString& rBaseURL ) override; virtual ScRange GetRange() override { return maRange; } virtual void WriteToDocument( bool bSizeColsRows = false, double nOutputFactor = 1.0, diff --git a/sc/source/filter/inc/eeparser.hxx b/sc/source/filter/inc/eeparser.hxx index b60e633fd9ba..2b19f41672c0 100644 --- a/sc/source/filter/inc/eeparser.hxx +++ b/sc/source/filter/inc/eeparser.hxx @@ -118,7 +118,7 @@ public: ScEEParser( EditEngine* ); virtual ~ScEEParser(); - virtual sal_uLong Read( SvStream&, const OUString& rBaseURL ) = 0; + virtual ErrCode Read( SvStream&, const OUString& rBaseURL ) = 0; const ColWidthsMap& GetColWidths() const { return maColWidths; } ColWidthsMap& GetColWidths() { return maColWidths; } diff --git a/sc/source/filter/inc/htmlpars.hxx b/sc/source/filter/inc/htmlpars.hxx index f807c06ee604..1598f7d5daae 100644 --- a/sc/source/filter/inc/htmlpars.hxx +++ b/sc/source/filter/inc/htmlpars.hxx @@ -85,7 +85,7 @@ public: explicit ScHTMLParser( EditEngine* pEditEngine, ScDocument* pDoc ); virtual ~ScHTMLParser() override; - virtual sal_uLong Read( SvStream& rStrm, const OUString& rBaseURL ) override = 0; + virtual ErrCode Read( SvStream& rStrm, const OUString& rBaseURL ) override = 0; ScHTMLStyles& GetStyles() { return maStyles;} ScDocument& GetDoc() { return *mpDoc;} @@ -214,7 +214,7 @@ private: public: ScHTMLLayoutParser( EditEngine*, const OUString& rBaseURL, const Size& aPageSize, ScDocument* ); virtual ~ScHTMLLayoutParser() override; - virtual sal_uLong Read( SvStream&, const OUString& rBaseURL ) override; + virtual ErrCode Read( SvStream&, const OUString& rBaseURL ) override; virtual const ScHTMLTable* GetGlobalTable() const override; }; @@ -570,7 +570,7 @@ public: explicit ScHTMLQueryParser( EditEngine* pEditEngine, ScDocument* pDoc ); virtual ~ScHTMLQueryParser() override; - virtual sal_uLong Read( SvStream& rStrm, const OUString& rBaseURL ) override; + virtual ErrCode Read( SvStream& rStrm, const OUString& rBaseURL ) override; /** Returns the "global table" which contains the entire HTML document. */ virtual const ScHTMLTable* GetGlobalTable() const override; diff --git a/sc/source/filter/inc/rtfparse.hxx b/sc/source/filter/inc/rtfparse.hxx index a22d603d7a5d..9d6b052e62d5 100644 --- a/sc/source/filter/inc/rtfparse.hxx +++ b/sc/source/filter/inc/rtfparse.hxx @@ -73,7 +73,7 @@ private: public: ScRTFParser( EditEngine* ); virtual ~ScRTFParser() override; - virtual sal_uLong Read( SvStream&, const OUString& rBaseURL ) override; + virtual ErrCode Read( SvStream&, const OUString& rBaseURL ) override; }; #endif diff --git a/sc/source/filter/inc/scflt.hxx b/sc/source/filter/inc/scflt.hxx index b42265184a21..f1640a3ed8f4 100644 --- a/sc/source/filter/inc/scflt.hxx +++ b/sc/source/filter/inc/scflt.hxx @@ -26,9 +26,9 @@ #include <tools/solar.h> // Error numbers -#define errUnknownFormat 1 -#define errUnknownID 2 -#define errOutOfMemory 3 +#define errUnknownFormat ErrCode(1) +#define errUnknownID ErrCode(2) +#define errOutOfMemory ErrCode(3) // Identifiers in FileFormat #define ColWidthID 1 @@ -601,10 +601,10 @@ public: class Sc10FontCollection : public ScCollection { protected: - sal_uLong nError; + ErrCode nError; public: Sc10FontCollection( SvStream& rStream ); - sal_uLong GetError() { return nError; } + ErrCode GetError() { return nError; } Sc10FontData* At(sal_uInt16 nIndex) { return static_cast<Sc10FontData*>(ScCollection::At(nIndex)); } private: using ScCollection::At; @@ -635,10 +635,10 @@ public: class Sc10NameCollection : public ScCollection { protected: - sal_uLong nError; + ErrCode nError; public: Sc10NameCollection(SvStream& rStream); - sal_uLong GetError() { return nError; } + ErrCode GetError() { return nError; } Sc10NameData* At(sal_uInt16 nIndex) { return static_cast<Sc10NameData*>(ScCollection::At(nIndex)); } private: using ScCollection::At; @@ -686,10 +686,10 @@ virtual ScDataObject* Clone() const override { return new Sc10PatternData( class Sc10PatternCollection : public ScCollection { protected: - sal_uLong nError; + ErrCode nError; public: Sc10PatternCollection(SvStream& rStream); - sal_uLong GetError() { return nError; } + ErrCode GetError() { return nError; } Sc10PatternData* At(sal_uInt16 nIndex) { return static_cast<Sc10PatternData*>(ScCollection::At(nIndex)); } private: using ScCollection::At; @@ -714,11 +714,11 @@ virtual ScDataObject* Clone() const override { return new Sc10DataBaseData class Sc10DataBaseCollection : public ScCollection { protected: - sal_uLong nError; + ErrCode nError; sal_Char ActName[32]; public: Sc10DataBaseCollection(SvStream& rStream); - sal_uLong GetError() { return nError; } + ErrCode GetError() { return nError; } Sc10DataBaseData* At(sal_uInt16 nIndex) { return static_cast<Sc10DataBaseData*>(ScCollection::At(nIndex)); } private: using ScCollection::At; @@ -760,7 +760,7 @@ class Sc10Import Sc10NameCollection* pNameCollection; Sc10PatternCollection* pPatternCollection; Sc10DataBaseCollection* pDataBaseCollection; - sal_uLong nError; + ErrCode nError; SCTAB nShowTab; ScViewOptions aSc30ViewOpt; ScfStreamProgressBar* pPrgrsBar; @@ -769,7 +769,7 @@ public: Sc10Import( SvStream& rStr, ScDocument* pDocument ); ~Sc10Import(); - sal_uLong Import(); + ErrCode Import(); void LoadFileHeader(); void LoadFileInfo(); void LoadEditStateInfo(); diff --git a/sc/source/filter/lotus/lotread.cxx b/sc/source/filter/lotus/lotread.cxx index 003b82d7c424..9d4dfab84bb3 100644 --- a/sc/source/filter/lotus/lotread.cxx +++ b/sc/source/filter/lotus/lotread.cxx @@ -92,7 +92,7 @@ ErrCode ImportLotus::Read() else { eAkt = S_END; // TODO: add here something for <= WK1! - eRet = 0xFFFFFFFF; + eRet = ErrCode(0xFFFFFFFF); } } break; diff --git a/sc/source/filter/lotus/lotus.cxx b/sc/source/filter/lotus/lotus.cxx index f9d6c8128765..8a7c8493225b 100644 --- a/sc/source/filter/lotus/lotus.cxx +++ b/sc/source/filter/lotus/lotus.cxx @@ -51,10 +51,10 @@ ErrCode ScFormatFilterPluginImpl::ScImportLotus123( SfxMedium& rMedium, ScDocume if( bWithWK3 ) eRet = aLotusImport.Read(); else - eRet = 0xFFFFFFFF; // force WK1 /WKS + eRet = ErrCode(0xFFFFFFFF); // force WK1 /WKS // WARNING: QUICK-HACK for WK1 / WKS <-> WK3 / WK4 - if( eRet == 0xFFFFFFFF ) + if( eRet == ErrCode(0xFFFFFFFF) ) { pStream->Seek( 0UL ); diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx index 0e6eab3bc56c..87b3a0426809 100644 --- a/sc/source/filter/rtf/eeimpars.cxx +++ b/sc/source/filter/rtf/eeimpars.cxx @@ -76,9 +76,9 @@ ScEEImport::~ScEEImport() // Is guaranteed as ScEEImport is base class } -sal_uLong ScEEImport::Read( SvStream& rStream, const OUString& rBaseURL ) +ErrCode ScEEImport::Read( SvStream& rStream, const OUString& rBaseURL ) { - sal_uLong nErr = mpParser->Read( rStream, rBaseURL ); + ErrCode nErr = mpParser->Read( rStream, rBaseURL ); SCCOL nEndCol; SCROW nEndRow; diff --git a/sc/source/filter/rtf/rtfimp.cxx b/sc/source/filter/rtf/rtfimp.cxx index bb269686b693..ecd86a537846 100644 --- a/sc/source/filter/rtf/rtfimp.cxx +++ b/sc/source/filter/rtf/rtfimp.cxx @@ -28,7 +28,7 @@ ErrCode ScFormatFilterPluginImpl::ScImportRTF( SvStream &rStream, const OUString& rBaseURL, ScDocument *pDoc, ScRange& rRange ) { ScRTFImport aImp( pDoc, rRange ); - ErrCode nErr = (ErrCode) aImp.Read( rStream, rBaseURL ); + ErrCode nErr = aImp.Read( rStream, rBaseURL ); ScRange aR = aImp.GetRange(); rRange.aEnd = aR.aEnd; aImp.WriteToDocument(); diff --git a/sc/source/filter/rtf/rtfparse.cxx b/sc/source/filter/rtf/rtfparse.cxx index d5262fd13a16..523b2ef32c54 100644 --- a/sc/source/filter/rtf/rtfparse.cxx +++ b/sc/source/filter/rtf/rtfparse.cxx @@ -55,11 +55,11 @@ ScRTFParser::~ScRTFParser() maDefaultList.clear(); } -sal_uLong ScRTFParser::Read( SvStream& rStream, const OUString& rBaseURL ) +ErrCode ScRTFParser::Read( SvStream& rStream, const OUString& rBaseURL ) { Link<RtfImportInfo&,void> aOldLink = pEdit->GetRtfImportHdl(); pEdit->SetRtfImportHdl( LINK( this, ScRTFParser, RTFImportHdl ) ); - sal_uLong nErr = pEdit->Read( rStream, rBaseURL, EE_FORMAT_RTF ); + ErrCode nErr = pEdit->Read( rStream, rBaseURL, EE_FORMAT_RTF ); if ( nRtfLastToken == RTF_PAR ) { if ( !maList.empty() ) diff --git a/sc/source/filter/starcalc/scflt.cxx b/sc/source/filter/starcalc/scflt.cxx index bd41c17c90f7..c6b9b199a645 100644 --- a/sc/source/filter/starcalc/scflt.cxx +++ b/sc/source/filter/starcalc/scflt.cxx @@ -369,10 +369,10 @@ static OUString lcl_MakeOldPageStyleFormatName( sal_uInt16 i ) return aName; } -template < typename T > sal_uLong insert_new( ScCollection* pCollection, SvStream& rStream ) +template < typename T > ErrCode insert_new( ScCollection* pCollection, SvStream& rStream ) { std::unique_ptr<T> pData(new (::std::nothrow) T( rStream)); - sal_uLong nError = rStream.GetError(); + ErrCode nError = rStream.GetError(); if (pData) { if (!nError) @@ -948,7 +948,7 @@ Sc10Import::~Sc10Import() "*Sc10Import::Sc10Import(): Progressbar lebt noch!?" ); } -sal_uLong Sc10Import::Import() +ErrCode Sc10Import::Import() { pPrgrsBar = new ScfStreamProgressBar( rStream, pDoc->GetDocumentShell() ); @@ -2404,7 +2404,7 @@ ErrCode ScFormatFilterPluginImpl::ScImportStarCalc10( SvStream& rStream, ScDocum { rStream.Seek( 0UL ); Sc10Import aImport( rStream, pDocument ); - return ( ErrCode ) aImport.Import(); + return aImport.Import(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 4d6c02cf7528..89fb12331df3 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -4979,7 +4979,7 @@ void ScXMLExport::IncrementProgressBar(bool bFlush, sal_Int32 nInc) } } -sal_uInt32 ScXMLExport::exportDoc( enum XMLTokenEnum eClass ) +ErrCode ScXMLExport::exportDoc( enum XMLTokenEnum eClass ) { if( getExportFlags() & (SvXMLExportFlags::FONTDECLS|SvXMLExportFlags::STYLES| SvXMLExportFlags::MASTERSTYLES|SvXMLExportFlags::CONTENT) ) diff --git a/sc/source/filter/xml/xmlexprt.hxx b/sc/source/filter/xml/xmlexprt.hxx index a02a6ee3dffe..675b8183fd07 100644 --- a/sc/source/filter/xml/xmlexprt.hxx +++ b/sc/source/filter/xml/xmlexprt.hxx @@ -256,7 +256,7 @@ public: XMLNumberFormatAttributesExportHelper* GetNumberFormatAttributesExportHelper(); // Export the document. - virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ) override; + virtual ErrCode exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ) override; // XExporter virtual void SAL_CALL setSourceDocument( const css::uno::Reference< css::lang::XComponent >& xDoc ) override; diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index 437264636bc8..2bcbd62b9e69 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -3424,7 +3424,7 @@ sal_Int32 ScXMLImport::GetByteOffset() return nOffset; } -void ScXMLImport::SetRangeOverflowType(sal_uInt32 nType) +void ScXMLImport::SetRangeOverflowType(ErrCode nType) { // #i31130# Overflow is stored in the document, because the ScXMLImport object // isn't available in ScXMLImportWrapper::ImportFromComponent when using the diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx index be204c1f8deb..d11e36cc73a5 100644 --- a/sc/source/filter/xml/xmlimprt.hxx +++ b/sc/source/filter/xml/xmlimprt.hxx @@ -1179,7 +1179,7 @@ public: sal_Int32 GetByteOffset(); - void SetRangeOverflowType(sal_uInt32 nType); + void SetRangeOverflowType(ErrCode nType); static sal_Int32 GetRangeType(const OUString& sRangeType); void SetNamedRanges(); diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx index 880c2f5320ea..92295e09f993 100644 --- a/sc/source/filter/xml/xmlwrap.cxx +++ b/sc/source/filter/xml/xmlwrap.cxx @@ -97,7 +97,7 @@ uno::Reference <task::XStatusIndicator> ScXMLImportWrapper::GetStatusIndicator() return xStatusIndicator; } -sal_uInt32 ScXMLImportWrapper::ImportFromComponent(const uno::Reference<uno::XComponentContext>& xContext, +ErrCode ScXMLImportWrapper::ImportFromComponent(const uno::Reference<uno::XComponentContext>& xContext, uno::Reference<frame::XModel>& xModel, uno::Reference<xml::sax::XParser>& xParser, xml::sax::InputSource& aParserInput, const OUString& sComponentName, const OUString& sDocName, @@ -158,8 +158,8 @@ sal_uInt32 ScXMLImportWrapper::ImportFromComponent(const uno::Reference<uno::XCo xInfoSet->setPropertyValue( sPropName, uno::makeAny( sStream ) ); } - sal_uInt32 nReturn = ERRCODE_NONE; - rDoc.SetRangeOverflowType(0); // is modified by the importer if limits are exceeded + ErrCode nReturn = ERRCODE_NONE; + rDoc.SetRangeOverflowType(ERRCODE_NONE); // is modified by the importer if limits are exceeded uno::Reference<xml::sax::XDocumentHandler> xDocHandler( xContext->getServiceManager()->createInstanceWithArgumentsAndContext( @@ -415,7 +415,7 @@ bool ScXMLImportWrapper::Import( ImportFlags nMode, ErrCode& rError ) } // #i103539#: always read meta.xml for generator - sal_uInt32 nMetaRetval(0); + ErrCode nMetaRetval(ERRCODE_NONE); if (nMode & ImportFlags::Metadata) { uno::Sequence<uno::Any> aMetaArgs(1); @@ -454,7 +454,7 @@ bool ScXMLImportWrapper::Import( ImportFlags nMode, ErrCode& rError ) pStylesArgs[2] <<= xStatusIndicator; pStylesArgs[3] <<= xObjectResolver; - sal_uInt32 nSettingsRetval(0); + ErrCode nSettingsRetval(ERRCODE_NONE); if (nMode & ImportFlags::Settings) { // Settings must be loaded first because of the printer setting, @@ -475,7 +475,7 @@ bool ScXMLImportWrapper::Import( ImportFlags nMode, ErrCode& rError ) SAL_INFO( "sc.filter", "settings import end" ); } - sal_uInt32 nStylesRetval(0); + ErrCode nStylesRetval(ERRCODE_NONE); if (nMode & ImportFlags::Styles) { SAL_INFO( "sc.filter", "styles import start" ); @@ -489,7 +489,7 @@ bool ScXMLImportWrapper::Import( ImportFlags nMode, ErrCode& rError ) SAL_INFO( "sc.filter", "styles import end" ); } - sal_uInt32 nDocRetval(0); + ErrCode nDocRetval(ERRCODE_NONE); if (nMode & ImportFlags::Content) { if (mrDocShell.GetCreateMode() == SfxObjectCreateMode::INTERNAL) diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index 60324562b4d1..db43a50e0268 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -176,8 +176,8 @@ ScModule::ScModule( SfxObjectFactory* pFact ) : // Between OfficeApplication::Init and ScGlobal::Init SvxErrorHandler::ensure(); pErrorHdl = new SfxErrorHandler( RID_ERRHDLSC, - ERRCODE_AREA_SC, - ERRCODE_AREA_APP2-1, + ErrCode(ERRCODE_AREA_SC), + ErrCode(ERRCODE_AREA_APP2-1), GetResMgr() ); aSpellIdle.SetPriority(TaskPriority::LOWER); diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 8ccfffa058a9..36ce03fdf3f2 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -1128,7 +1128,7 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) if (!GetError()) SetError(eError); - if( ( eError & ERRCODE_WARNING_MASK ) == ERRCODE_WARNING_MASK ) + if( eError.IsWarning() ) bRet = true; } else @@ -1284,7 +1284,7 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) } ScDocRowHeightUpdater::TabRanges aRecalcRanges(0); - sal_uLong eError = DBaseImport( rMedium.GetPhysicalName(), + ErrCode eError = DBaseImport( rMedium.GetPhysicalName(), ScGlobal::GetCharsetValue(sItStr), aColWidthParam, *aRecalcRanges.mpRanges ); aRecalcRowRangesArray.push_back(aRecalcRanges); @@ -1331,7 +1331,7 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) if (!GetError()) SetError(eError); - if( ( eError & ERRCODE_WARNING_MASK ) == ERRCODE_WARNING_MASK ) + if( eError.IsWarning() ) bRet = true; } else @@ -1377,7 +1377,7 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) { if (!GetError()) SetError(eError); - if( ( eError & ERRCODE_WARNING_MASK ) == ERRCODE_WARNING_MASK ) + if( eError.IsWarning() ) bRet = true; } else @@ -1404,7 +1404,7 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) if (!GetError()) SetError(eError); - if( ( eError & ERRCODE_WARNING_MASK ) == ERRCODE_WARNING_MASK ) + if( eError.IsWarning() ) bRet = true; } else @@ -1456,7 +1456,7 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) if (!GetError()) SetError(eError); - if( ( eError & ERRCODE_WARNING_MASK ) == ERRCODE_WARNING_MASK ) + if( eError.IsWarning() ) bRet = true; } else @@ -2288,7 +2288,7 @@ bool ScDocShell::ConvertTo( SfxMedium &rMed ) SetError(eError); // don't return false for warnings - bRet = ((eError & ERRCODE_WARNING_MASK) == ERRCODE_WARNING_MASK) || (eError == ERRCODE_NONE); + bRet = eError.IsWarning() || (eError == ERRCODE_NONE); } else { @@ -2353,10 +2353,10 @@ bool ScDocShell::ConvertTo( SfxMedium &rMed ) rMed.CloseOutStream(); bool bHasMemo = false; - sal_uLong eError = DBaseExport( + ErrCode eError = DBaseExport( rMed.GetPhysicalName(), ScGlobal::GetCharsetValue(sCharSet), bHasMemo); - if ( eError != ERRCODE_NONE && (eError & ERRCODE_WARNING_MASK) ) + if ( eError != ERRCODE_NONE && eError.IsWarning() ) { eError = ERRCODE_NONE; } diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 869513e6f0b0..513fc1467eb8 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -739,7 +739,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) ScDocShell* pOtherDocSh = new ScDocShell; SfxObjectShellLock aDocShTablesRef = pOtherDocSh; pOtherDocSh->DoLoad( pMed ); - sal_uLong nErr = pOtherDocSh->GetErrorCode(); + ErrCode nErr = pOtherDocSh->GetErrorCode(); if (nErr) ErrorHandler::HandleError( nErr ); // also warnings diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index 85d73f4070d7..170c94213a66 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -104,7 +104,7 @@ using ::std::vector; namespace { - sal_uLong lcl_getDBaseConnection(uno::Reference<sdbc::XDriverManager2>& _rDrvMgr, uno::Reference<sdbc::XConnection>& _rConnection, OUString& _rTabName, const OUString& rFullFileName, rtl_TextEncoding eCharSet) + ErrCode lcl_getDBaseConnection(uno::Reference<sdbc::XDriverManager2>& _rDrvMgr, uno::Reference<sdbc::XConnection>& _rConnection, OUString& _rTabName, const OUString& rFullFileName, rtl_TextEncoding eCharSet) { INetURLObject aURL; aURL.SetSmartProtocol( INetProtocol::File ); @@ -147,7 +147,7 @@ namespace })); _rConnection = _rDrvMgr->getConnectionWithInfo( aConnUrl, aProps ); - return 0L; + return ERRCODE_NONE; } } @@ -287,7 +287,7 @@ static void lcl_setScalesToColumns(ScDocument& rDoc, const vector<long>& rScales #endif // HAVE_FEATURE_DBCONNECTIVITY -sal_uLong ScDocShell::DBaseImport( const OUString& rFullFileName, rtl_TextEncoding eCharSet, +ErrCode ScDocShell::DBaseImport( const OUString& rFullFileName, rtl_TextEncoding eCharSet, ScColWidthParam aColWidthParam[MAXCOLCOUNT], ScFlatBoolRowSegments& rRowHeightsRecalc ) { #if !HAVE_FEATURE_DBCONNECTIVITY @@ -299,7 +299,7 @@ sal_uLong ScDocShell::DBaseImport( const OUString& rFullFileName, rtl_TextEncodi return ERRCODE_IO_GENERAL; #else - sal_uLong nErr = ERRCODE_NONE; + ErrCode nErr = ERRCODE_NONE; // Try to get the Text Encoding from the driver if( eCharSet == RTL_TEXTENCODING_IBM_850 ) @@ -312,7 +312,7 @@ sal_uLong ScDocShell::DBaseImport( const OUString& rFullFileName, rtl_TextEncodi OUString aTabName; uno::Reference<sdbc::XDriverManager2> xDrvMan; uno::Reference<sdbc::XConnection> xConnection; - sal_uLong nRet = lcl_getDBaseConnection(xDrvMan,xConnection,aTabName,rFullFileName,eCharSet); + ErrCode nRet = lcl_getDBaseConnection(xDrvMan,xConnection,aTabName,rFullFileName,eCharSet); if ( !xConnection.is() || !xDrvMan.is() ) return nRet; ::utl::DisposableComponent aConnectionHelper(xConnection); @@ -755,7 +755,7 @@ inline void lcl_getLongVarCharString( #endif // HAVE_FEATURE_DBCONNECTIVITY -sal_uLong ScDocShell::DBaseExport( const OUString& rFullFileName, rtl_TextEncoding eCharSet, bool& bHasMemo ) +ErrCode ScDocShell::DBaseExport( const OUString& rFullFileName, rtl_TextEncoding eCharSet, bool& bHasMemo ) { #if !HAVE_FEATURE_DBCONNECTIVITY (void) rFullFileName; @@ -768,7 +768,7 @@ sal_uLong ScDocShell::DBaseExport( const OUString& rFullFileName, rtl_TextEncodi INetURLObject aDeleteObj( rFullFileName, INetProtocol::File ); KillFile( aDeleteObj ); - sal_uLong nErr = ERRCODE_NONE; + ErrCode nErr = ERRCODE_NONE; SCCOL nFirstCol, nLastCol; SCROW nFirstRow, nLastRow; @@ -811,7 +811,7 @@ sal_uLong ScDocShell::DBaseExport( const OUString& rFullFileName, rtl_TextEncodi { uno::Reference<sdbc::XDriverManager2> xDrvMan; uno::Reference<sdbc::XConnection> xConnection; - sal_uLong nRet = lcl_getDBaseConnection(xDrvMan,xConnection,aTabName,rFullFileName,eCharSet); + ErrCode nRet = lcl_getDBaseConnection(xDrvMan,xConnection,aTabName,rFullFileName,eCharSet); if ( !xConnection.is() || !xDrvMan.is() ) return nRet; ::utl::DisposableComponent aConnectionHelper(xConnection); diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx index a48ec836a83f..ba26384d9f55 100644 --- a/sc/source/ui/drawfunc/fuins1.cxx +++ b/sc/source/ui/drawfunc/fuins1.cxx @@ -254,7 +254,7 @@ FuInsertGraphic::FuInsertGraphic( ScTabViewShell* pViewSh, if( aDlg.Execute() == ERRCODE_NONE ) { Graphic aGraphic; - int nError = aDlg.GetGraphic(aGraphic); + ErrCode nError = aDlg.GetGraphic(aGraphic); if( nError == ERRCODE_NONE ) { OUString aFileName = aDlg.GetPath(); diff --git a/sc/source/ui/drawfunc/graphsh.cxx b/sc/source/ui/drawfunc/graphsh.cxx index 5f7a264850fc..75d45567bcf3 100644 --- a/sc/source/ui/drawfunc/graphsh.cxx +++ b/sc/source/ui/drawfunc/graphsh.cxx @@ -308,7 +308,7 @@ void ScGraphicShell::ExecuteChangePicture( SAL_UNUSED_PARAMETER SfxRequest& /*rR if( aDlg.Execute() == ERRCODE_NONE ) { Graphic aGraphic; - int nError = aDlg.GetGraphic(aGraphic); + ErrCode nError = aDlg.GetGraphic(aGraphic); if( nError == ERRCODE_NONE ) { SdrGrafObj* pNewObject = pGraphicObj->Clone(); diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index 5e2cbb8a5db2..b7f1016c8f49 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -131,10 +131,10 @@ class SC_DLLPUBLIC ScDocShell final: public SfxObjectShell, public SfxListener SAL_DLLPRIVATE static bool SaveCurrentChart( SfxMedium& rMedium ); - SAL_DLLPRIVATE sal_uLong DBaseImport( const OUString& rFullFileName, rtl_TextEncoding eCharSet, + SAL_DLLPRIVATE ErrCode DBaseImport( const OUString& rFullFileName, rtl_TextEncoding eCharSet, ScColWidthParam aColWidthParam[MAXCOLCOUNT], ScFlatBoolRowSegments& rRowHeightsRecalc ); - SAL_DLLPRIVATE sal_uLong DBaseExport( - const OUString& rFullFileName, rtl_TextEncoding eCharSet, bool& bHasMemo ); + SAL_DLLPRIVATE ErrCode DBaseExport( + const OUString& rFullFileName, rtl_TextEncoding eCharSet, bool& bHasMemo ); SAL_DLLPRIVATE static bool MoveFile( const INetURLObject& rSource, const INetURLObject& rDest ); SAL_DLLPRIVATE static bool KillFile( const INetURLObject& rURL ); diff --git a/sc/source/ui/miscdlgs/instbdlg.cxx b/sc/source/ui/miscdlgs/instbdlg.cxx index 27e6ff5f56dc..cab40f8976c1 100644 --- a/sc/source/ui/miscdlgs/instbdlg.cxx +++ b/sc/source/ui/miscdlgs/instbdlg.cxx @@ -333,7 +333,7 @@ IMPL_LINK( ScInsertTableDlg, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg pDocShTables->DoLoad( pMed ); SetPointer( aOldPtr ); - sal_uLong nErr = pDocShTables->GetErrorCode(); + ErrCode nErr = pDocShTables->GetErrorCode(); if ( nErr ) ErrorHandler::HandleError( nErr ); // warnings, too diff --git a/sc/source/ui/miscdlgs/linkarea.cxx b/sc/source/ui/miscdlgs/linkarea.cxx index 180e089f305e..2e214d14271b 100644 --- a/sc/source/ui/miscdlgs/linkarea.cxx +++ b/sc/source/ui/miscdlgs/linkarea.cxx @@ -141,7 +141,7 @@ void ScLinkedAreaDlg::LoadDocument( const OUString& rFile, const OUString& rFilt pSourceShell = aLoader.GetDocShell(); if ( pSourceShell ) { - sal_uLong nErr = pSourceShell->GetErrorCode(); + ErrCode nErr = pSourceShell->GetErrorCode(); if (nErr) ErrorHandler::HandleError( nErr ); // including warnings @@ -226,7 +226,7 @@ IMPL_LINK( ScLinkedAreaDlg, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, aSourceRef = pSourceShell; pSourceShell->DoLoad( pMed ); - sal_uLong nErr = pSourceShell->GetErrorCode(); + ErrCode nErr = pSourceShell->GetErrorCode(); if (nErr) ErrorHandler::HandleError( nErr ); // including warnings diff --git a/sc/source/ui/unoobj/warnpassword.cxx b/sc/source/ui/unoobj/warnpassword.cxx index 6e1583df4506..befa90aedd61 100644 --- a/sc/source/ui/unoobj/warnpassword.cxx +++ b/sc/source/ui/unoobj/warnpassword.cxx @@ -42,10 +42,10 @@ bool ScWarnPassword::WarningOnPassword( SfxMedium& rMedium ) Reference< XInteractionHandler > xHandler( rMedium.GetInteractionHandler()); if( xHandler.is() ) { - Any aException( makeAny(InteractiveAppException("", + Any aException( InteractiveAppException("", Reference <XInterface> (), InteractionClassification_QUERY, - ERRCODE_SVX_EXPORT_FILTER_CRYPT))); + sal_uInt32(ERRCODE_SVX_EXPORT_FILTER_CRYPT))); rtl::Reference< ucbhelper::SimpleInteractionRequest > xRequest = new ucbhelper::SimpleInteractionRequest( diff --git a/sc/source/ui/vba/vbachart.cxx b/sc/source/ui/vba/vbachart.cxx index 0d49bde2def7..1d48529ffb00 100644 --- a/sc/source/ui/vba/vbachart.cxx +++ b/sc/source/ui/vba/vbachart.cxx @@ -212,7 +212,7 @@ ScVbaChart::getChartType() } catch ( const uno::Exception& ) { - throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), ERRCODE_BASIC_METHOD_FAILED, OUString() ); + throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_METHOD_FAILED), OUString() ); } return nChartType; } @@ -336,7 +336,7 @@ try } break; default: - throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), ERRCODE_BASIC_CONVERSION, OUString() ); + throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_CONVERSION), OUString() ); } switch (_nChartType) @@ -538,7 +538,7 @@ try } catch ( const uno::Exception& ) { - throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), ERRCODE_BASIC_METHOD_FAILED, OUString() ); + throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_METHOD_FAILED), OUString() ); } } @@ -554,7 +554,7 @@ ScVbaChart::Activate() if ( pChartObj ) pChartObj->Activate(); else - throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), ERRCODE_BASIC_METHOD_FAILED, "no ChartObject as parent" ); + throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_METHOD_FAILED), "no ChartObject as parent" ); } void SAL_CALL @@ -617,7 +617,7 @@ ScVbaChart::setSourceData( const css::uno::Reference< ::ooo::vba::excel::XRange } catch (const uno::Exception&) { - throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), ERRCODE_BASIC_METHOD_FAILED, OUString() ); + throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_METHOD_FAILED), OUString() ); } } @@ -655,12 +655,12 @@ ScVbaChart::setPlotBy( ::sal_Int32 _nPlotBy ) mxDiagramPropertySet->setPropertyValue( DATAROWSOURCE, uno::makeAny( chart::ChartDataRowSource_COLUMNS) ); break; default: - throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), ERRCODE_BASIC_METHOD_FAILED, OUString() ); + throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_METHOD_FAILED), OUString() ); } } catch (const uno::Exception&) { - throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), ERRCODE_BASIC_METHOD_FAILED, OUString() ); + throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_METHOD_FAILED), OUString() ); } } @@ -682,7 +682,7 @@ ScVbaChart::getPlotBy( ) } catch (const uno::Exception&) { - throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), ERRCODE_BASIC_METHOD_FAILED, OUString() ); + throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_METHOD_FAILED), OUString() ); } } @@ -698,7 +698,7 @@ ScVbaChart::setDiagram( const OUString& _sDiagramType ) } catch ( const uno::Exception& ) { - throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), ERRCODE_BASIC_METHOD_FAILED, OUString() ); + throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_METHOD_FAILED), OUString() ); } } @@ -814,7 +814,7 @@ ScVbaChart::getHasTitle( ) } catch (const uno::Exception&) { - throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), ERRCODE_BASIC_METHOD_FAILED, OUString() ); + throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_METHOD_FAILED), OUString() ); } return bHasTitle; } @@ -828,7 +828,7 @@ ScVbaChart::setHasTitle( sal_Bool bTitle ) } catch (const uno::Exception&) { - throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), ERRCODE_BASIC_METHOD_FAILED, OUString() ); + throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_METHOD_FAILED), OUString() ); } } @@ -843,7 +843,7 @@ ScVbaChart::getHasLegend( ) } catch (const uno::Exception&) { - throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), ERRCODE_BASIC_METHOD_FAILED, OUString() ); + throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_METHOD_FAILED), OUString() ); } return bHasLegend; } @@ -857,7 +857,7 @@ ScVbaChart::setHasLegend( sal_Bool bLegend ) } catch (const uno::Exception&) { - throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), ERRCODE_BASIC_METHOD_FAILED, OUString() ); + throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_METHOD_FAILED), OUString() ); } } @@ -948,7 +948,7 @@ ScVbaChart::getSolidType(sal_Int32 _nDeep, sal_Int32 _nVertiStacked, sal_Int32 _ } catch (const uno::Exception&) { - throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), ERRCODE_BASIC_METHOD_FAILED, OUString() ); + throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_METHOD_FAILED), OUString() ); } } @@ -971,7 +971,7 @@ ScVbaChart::getStockUpDownValue(sal_Int32 _nUpDown, sal_Int32 _nNotUpDown) catch (const uno::Exception&) { OUString aTemp; // temporary needed for g++ 3.3.5 - script::BasicErrorException( aTemp, uno::Reference< uno::XInterface >(), ERRCODE_BASIC_METHOD_FAILED, OUString() ); + script::BasicErrorException( aTemp, uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_METHOD_FAILED), OUString() ); } return _nNotUpDown; } @@ -989,7 +989,7 @@ ScVbaChart::hasMarkers() catch (const uno::Exception&) { OUString aTemp; // temporary needed for g++ 3.3.5 - script::BasicErrorException( aTemp, uno::Reference< uno::XInterface >(), ERRCODE_BASIC_METHOD_FAILED, OUString() ); + script::BasicErrorException( aTemp, uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_METHOD_FAILED), OUString() ); } return bHasMarkers; } diff --git a/sc/source/ui/vba/vbachartobject.cxx b/sc/source/ui/vba/vbachartobject.cxx index d512895f791c..0cf8f2dd7f7c 100644 --- a/sc/source/ui/vba/vbachartobject.cxx +++ b/sc/source/ui/vba/vbachartobject.cxx @@ -72,7 +72,7 @@ ScVbaChartObject::setShape() } catch (uno::Exception& ) { - throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), ERRCODE_BASIC_METHOD_FAILED, OUString() ); + throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_METHOD_FAILED), OUString() ); } return nullptr; } @@ -99,7 +99,7 @@ ScVbaChartObject::Delete() if (pChartObjectsImpl) pChartObjectsImpl->removeByName( getPersistName() ); else - throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), ERRCODE_BASIC_METHOD_FAILED, "Parent is not ChartObjects" ); + throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_METHOD_FAILED), "Parent is not ChartObjects" ); } void @@ -116,7 +116,7 @@ ScVbaChartObject::Activate() } catch (uno::Exception& ) { - throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), ERRCODE_BASIC_METHOD_FAILED, "ChartObject Activate internal error" ); + throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_METHOD_FAILED), "ChartObject Activate internal error" ); } } diff --git a/sc/source/ui/vba/vbachartobjects.cxx b/sc/source/ui/vba/vbachartobjects.cxx index 185e597e257a..970c9802442d 100644 --- a/sc/source/ui/vba/vbachartobjects.cxx +++ b/sc/source/ui/vba/vbachartobjects.cxx @@ -120,7 +120,7 @@ ScVbaChartObjects::getChartObjectNames() } catch (uno::Exception& ) { - throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), ERRCODE_BASIC_METHOD_FAILED, OUString() ); + throw script::BasicErrorException( OUString(), uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_METHOD_FAILED), OUString() ); } return sChartNames; } diff --git a/sc/source/ui/vba/vbatitle.hxx b/sc/source/ui/vba/vbatitle.hxx index a4da150287c7..972579f41d49 100644 --- a/sc/source/ui/vba/vbatitle.hxx +++ b/sc/source/ui/vba/vbatitle.hxx @@ -70,7 +70,7 @@ public: } catch ( css::uno::Exception& ) { - throw css::script::BasicErrorException( OUString(), css::uno::Reference< css::uno::XInterface >(), ERRCODE_BASIC_METHOD_FAILED, OUString() ); + throw css::script::BasicErrorException( OUString(), css::uno::Reference< css::uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_METHOD_FAILED), OUString() ); } } OUString SAL_CALL getText( ) SAL_OVERRIDE @@ -82,7 +82,7 @@ public: } catch ( css::uno::Exception& ) { - throw css::script::BasicErrorException( OUString(), css::uno::Reference< css::uno::XInterface >(), ERRCODE_BASIC_METHOD_FAILED, OUString() ); + throw css::script::BasicErrorException( OUString(), css::uno::Reference< css::uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_METHOD_FAILED), OUString() ); } return sText; } @@ -111,7 +111,7 @@ public: } catch (css::uno::Exception& ) { - throw css::script::BasicErrorException( OUString(), css::uno::Reference< css::uno::XInterface >(), ERRCODE_BASIC_METHOD_FAILED, OUString() ); + throw css::script::BasicErrorException( OUString(), css::uno::Reference< css::uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_METHOD_FAILED), OUString() ); } } ::sal_Int32 SAL_CALL getOrientation( ) SAL_OVERRIDE @@ -123,7 +123,7 @@ public: } catch (css::uno::Exception& ) { - throw css::script::BasicErrorException( OUString(), css::uno::Reference< css::uno::XInterface >(), ERRCODE_BASIC_METHOD_FAILED, OUString() ); + throw css::script::BasicErrorException( OUString(), css::uno::Reference< css::uno::XInterface >(), sal_uInt32(ERRCODE_BASIC_METHOD_FAILED), OUString() ); } return static_cast< sal_Int32 >(nSOOrientation / 100) ; } diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index a1b196d6e0dc..0123464a3252 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -158,7 +158,7 @@ void ScTabViewShell::ActivateObject( SdrOle2Obj* pObj, long nVerb ) if ( !pClient ) pClient = new ScClient( this, pWin, GetSdrView()->GetModel(), pObj ); - if ( !(nErr & ERRCODE_ERROR_MASK) && xObj.is() ) + if ( !nErr.IgnoreWarning() && xObj.is() ) { tools::Rectangle aRect = pObj->GetLogicRect(); diff --git a/sd/inc/sderror.hxx b/sd/inc/sderror.hxx index 009bb9f35d57..4f52035a13c0 100644 --- a/sd/inc/sderror.hxx +++ b/sd/inc/sderror.hxx @@ -31,21 +31,12 @@ #define WARN_SD_WRITE_BASE (WARN_SD_BASE | ERRCODE_CLASS_WRITE ) // Import errors -#define ERR_FORMAT_ROWCOL (ERROR_SD_READ_BASE | 1) -#define ERR_FORMAT_FILE_ROWCOL (ERROR_SD_READ_BASE | 2) +#define ERR_FORMAT_ROWCOL ErrCode(ERROR_SD_READ_BASE | 1) +#define ERR_FORMAT_FILE_ROWCOL ErrCode(ERROR_SD_READ_BASE | 2) // ----- Warnings --------------------------- -#define WARN_FORMAT_FILE_ROWCOL (WARN_SD_READ_BASE | 100) - -#ifndef __RSC - -inline bool IsWarning( sal_uLong nErr ) -{ - return 0 != ( nErr & ERRCODE_WARNING_MASK ); -} - -#endif +#define WARN_FORMAT_FILE_ROWCOL ErrCode(WARN_SD_READ_BASE | 100) #endif diff --git a/sd/inc/sdgrffilter.hxx b/sd/inc/sdgrffilter.hxx index a64896d4d4b2..2846914e24cd 100644 --- a/sd/inc/sdgrffilter.hxx +++ b/sd/inc/sdgrffilter.hxx @@ -36,7 +36,7 @@ public: bool Import(); bool Export() override; - static void HandleGraphicFilterError( ErrCode nFilterError, sal_uLong nStreamError ); + static void HandleGraphicFilterError( ErrCode nFilterError, ErrCode nStreamError ); }; #endif // INCLUDED_SD_INC_SDGRFFILTER_HXX diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx index 93c80c101803..5b5af603e3a5 100644 --- a/sd/source/filter/grf/sdgrffilter.cxx +++ b/sd/source/filter/grf/sdgrffilter.cxx @@ -86,7 +86,7 @@ using namespace ::sfx2; class SdGRFFilter_ImplInteractionHdl : public ::cppu::WeakImplHelper< css::task::XInteractionHandler > { css::uno::Reference< css::task::XInteractionHandler > m_xInter; - sal_uInt16 nFilterError; + ErrCode nFilterError; public: @@ -95,7 +95,7 @@ class SdGRFFilter_ImplInteractionHdl : public ::cppu::WeakImplHelper< css::task: nFilterError( ERRCODE_NONE ) {} - sal_uInt16 GetErrorCode() const { return nFilterError; }; + ErrCode GetErrorCode() const { return nFilterError; }; virtual void SAL_CALL handle( const css::uno::Reference< css::task::XInteractionRequest >& ) override; }; @@ -107,7 +107,7 @@ void SdGRFFilter_ImplInteractionHdl::handle( const css::uno::Reference< css::tas css::drawing::GraphicFilterRequest aErr; if ( xRequest->getRequest() >>= aErr ) - nFilterError = (sal_uInt16)aErr.ErrCode; + nFilterError = ErrCode(aErr.ErrCode); else m_xInter->handle( xRequest ); } @@ -122,40 +122,32 @@ SdGRFFilter::~SdGRFFilter() { } -void SdGRFFilter::HandleGraphicFilterError( ErrCode nFilterError, sal_uLong nStreamError ) +void SdGRFFilter::HandleGraphicFilterError( ErrCode nFilterError, ErrCode nStreamError ) { - sal_uInt16 nId; - - switch( nFilterError ) + if( ERRCODE_NONE != nStreamError ) { - case ERRCODE_GRFILTER_OPENERROR: - nId = STR_IMPORT_GRFILTER_OPENERROR; - break; - case ERRCODE_GRFILTER_IOERROR: - nId = STR_IMPORT_GRFILTER_IOERROR; - break; - case ERRCODE_GRFILTER_FORMATERROR: - nId = STR_IMPORT_GRFILTER_FORMATERROR; - break; - case ERRCODE_GRFILTER_VERSIONERROR: - nId = STR_IMPORT_GRFILTER_VERSIONERROR; - break; - case ERRCODE_GRFILTER_TOOBIG: - nId = STR_IMPORT_GRFILTER_TOOBIG; - break; - case 0 : - nId = 0; - break; - - default: - case ERRCODE_GRFILTER_FILTERERROR: - nId = STR_IMPORT_GRFILTER_FILTERERROR; - break; + ErrorHandler::HandleError( nStreamError ); + return; } - if( ERRCODE_NONE != nStreamError ) - ErrorHandler::HandleError( nStreamError ); - else if( STR_IMPORT_GRFILTER_IOERROR == nId ) + sal_uInt16 nId; + + if( nFilterError == ERRCODE_GRFILTER_OPENERROR ) + nId = STR_IMPORT_GRFILTER_OPENERROR; + else if( nFilterError == ERRCODE_GRFILTER_IOERROR ) + nId = STR_IMPORT_GRFILTER_IOERROR; + else if( nFilterError == ERRCODE_GRFILTER_FORMATERROR ) + nId = STR_IMPORT_GRFILTER_FORMATERROR; + else if( nFilterError == ERRCODE_GRFILTER_VERSIONERROR ) + nId = STR_IMPORT_GRFILTER_VERSIONERROR; + else if( nFilterError == ERRCODE_GRFILTER_TOOBIG ) + nId = STR_IMPORT_GRFILTER_TOOBIG; + else if( nFilterError == ERRCODE_NONE ) + nId = 0; + else + nId = STR_IMPORT_GRFILTER_FILTERERROR; + + if( STR_IMPORT_GRFILTER_IOERROR == nId ) ErrorHandler::HandleError( ERRCODE_IO_GENERAL ); else { @@ -173,7 +165,7 @@ bool SdGRFFilter::Import() bool bRet = false; SvStream* pIStm = mrMedium.GetInStream(); - sal_uInt16 nReturn = pIStm ? rGraphicFilter.ImportGraphic( aGraphic, aFileName, *pIStm, nFilter ) : 1; + ErrCode nReturn = pIStm ? rGraphicFilter.ImportGraphic( aGraphic, aFileName, *pIStm, nFilter ) : ErrCode(1); if( nReturn ) HandleGraphicFilterError( nReturn, rGraphicFilter.GetLastError().nStreamError ); diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx index aef32f6bd961..e80256f82d87 100644 --- a/sd/source/filter/html/htmlex.cxx +++ b/sd/source/filter/html/htmlex.cxx @@ -138,7 +138,7 @@ public: EasyFile(); ~EasyFile(); - sal_uLong createStream( const OUString& rUrl, SvStream*& rpStr ); + ErrCode createStream( const OUString& rUrl, SvStream*& rpStr ); void createFileName( const OUString& rUrl, OUString& rFileName ); void close(); }; @@ -1158,7 +1158,7 @@ bool HtmlExport::CreateHtmlTextForPresPages() the given filename */ bool HtmlExport::WriteHtml( const OUString& rFileName, bool bAddExtension, const OUString& rHtmlData ) { - sal_uLong nErr = 0; + ErrCode nErr = ERRCODE_NONE; OUString aFileName( rFileName ); if( bAddExtension ) @@ -1169,7 +1169,7 @@ bool HtmlExport::WriteHtml( const OUString& rFileName, bool bAddExtension, const SvStream* pStr; OUString aFull(maExportPath + aFileName); nErr = aFile.createStream(aFull , pStr); - if(nErr == 0) + if(nErr == ERRCODE_NONE) { OString aStr(OUStringToOString(rHtmlData, RTL_TEXTENCODING_UTF8)); @@ -1177,10 +1177,10 @@ bool HtmlExport::WriteHtml( const OUString& rFileName, bool bAddExtension, const aFile.close(); } - if( nErr != 0 ) + if( nErr != ERRCODE_NONE ) ErrorHandler::HandleError(nErr); - return nErr == 0; + return nErr == ERRCODE_NONE; } /** creates a outliner text for the title objects of a page @@ -2868,7 +2868,7 @@ bool HtmlExport::CopyScript( const OUString& rPath, const OUString& rSource, con meEC.SetContext( STR_HTMLEXP_ERROR_OPEN_FILE, rSource ); - sal_uLong nErr = 0; + ErrCode nErr = ERRCODE_NONE; SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::READ ); if( pIStm ) @@ -2892,7 +2892,7 @@ bool HtmlExport::CopyScript( const OUString& rPath, const OUString& rSource, con delete pIStm; } - if( nErr != 0 ) + if( nErr != ERRCODE_NONE ) { ErrorHandler::HandleError( nErr ); return (bool) nErr; @@ -2913,7 +2913,7 @@ bool HtmlExport::CopyScript( const OUString& rPath, const OUString& rSource, con EasyFile aFile; SvStream* pStr; nErr = aFile.createStream(aDest, pStr); - if(nErr == 0) + if(nErr == ERRCODE_NONE) { OString aStr(OUStringToOString(aScript, RTL_TEXTENCODING_UTF8)); @@ -2925,10 +2925,10 @@ bool HtmlExport::CopyScript( const OUString& rPath, const OUString& rSource, con if (mpProgress) mpProgress->SetState(++mnPagesWritten); - if( nErr != 0 ) + if( nErr != ERRCODE_NONE ) ErrorHandler::HandleError( nErr ); - return nErr == 0; + return nErr == ERRCODE_NONE; } static const char * ASP_Scripts[] = { "common.inc", "webcast.asp", "show.asp", "savepic.asp", "poll.asp", "editpic.asp" }; @@ -2999,8 +2999,8 @@ bool HtmlExport::CreateImageNumberFile() meEC.SetContext( STR_HTMLEXP_ERROR_CREATE_FILE, aFileName ); EasyFile aFile; SvStream* pStr; - sal_uLong nErr = aFile.createStream(aFull, pStr); - if(nErr == 0) + ErrCode nErr = aFile.createStream(aFull, pStr); + if(nErr == ERRCODE_NONE) { pStr->WriteCharPtr( "1" ); aFile.close(); @@ -3009,10 +3009,10 @@ bool HtmlExport::CreateImageNumberFile() if (mpProgress) mpProgress->SetState(++mnPagesWritten); - if( nErr != 0 ) + if( nErr != ERRCODE_NONE ) ErrorHandler::HandleError( nErr ); - return nErr == 0; + return nErr == ERRCODE_NONE; } OUString HtmlExport::InsertSound( const OUString& rSoundFile ) @@ -3040,7 +3040,7 @@ bool HtmlExport::CopyFile( const OUString& rSourceFile, const OUString& rDestFil if( Error != osl::FileBase::E_None ) { - ErrorHandler::HandleError(Error); + ErrorHandler::HandleError(ErrCode(Error)); return false; } else @@ -3132,7 +3132,7 @@ EasyFile::~EasyFile() close(); } -sal_uLong EasyFile::createStream( const OUString& rUrl, SvStream* &rpStr ) +ErrCode EasyFile::createStream( const OUString& rUrl, SvStream* &rpStr ) { if(bOpen) close(); @@ -3140,7 +3140,7 @@ sal_uLong EasyFile::createStream( const OUString& rUrl, SvStream* &rpStr ) OUString aFileName; createFileName( rUrl, aFileName ); - sal_uLong nErr = 0; + ErrCode nErr = ERRCODE_NONE; pOStm = ::utl::UcbStreamHelper::CreateStream( aFileName, StreamMode::WRITE | StreamMode::TRUNC ); if( pOStm ) { @@ -3152,7 +3152,7 @@ sal_uLong EasyFile::createStream( const OUString& rUrl, SvStream* &rpStr ) nErr = ERRCODE_SFX_CANTCREATECONTENT; } - if( nErr != 0 ) + if( nErr != ERRCODE_NONE ) { bOpen = false; delete pOStm; @@ -3195,7 +3195,7 @@ HtmlErrorContext::HtmlErrorContext() mnResId = 0; } -bool HtmlErrorContext::GetString( sal_uInt32, OUString& rCtxStr ) +bool HtmlErrorContext::GetString( ErrCode, OUString& rCtxStr ) { DBG_ASSERT( mnResId != 0, "No error context set" ); if( mnResId == 0 ) diff --git a/sd/source/filter/html/htmlex.hxx b/sd/source/filter/html/htmlex.hxx index 754aeb8e5787..8a470979330f 100644 --- a/sd/source/filter/html/htmlex.hxx +++ b/sd/source/filter/html/htmlex.hxx @@ -68,7 +68,7 @@ private: public: explicit HtmlErrorContext(); - virtual bool GetString( sal_uInt32 nErrId, OUString& rCtxStr ) override; + virtual bool GetString( ErrCode nErrId, OUString& rCtxStr ) override; void SetContext( sal_uInt16 nResId, const OUString& rURL ); void SetContext( sal_uInt16 nResId, const OUString& rURL1, const OUString& rURL2 ); diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx index ef9f1a264f18..29313c60f32d 100644 --- a/sd/source/filter/xml/sdxmlwrp.cxx +++ b/sd/source/filter/xml/sdxmlwrp.cxx @@ -78,7 +78,7 @@ using namespace com::sun::star::lang; using namespace com::sun::star::document; using namespace comphelper; -#define SD_XML_READERROR 1234 +#define SD_XML_READERROR ErrCode(1234) char const sXML_export_impress_meta_oasis_service[] = "com.sun.star.comp.Impress.XMLOasisMetaExporter"; char const sXML_export_impress_styles_oasis_service[] = "com.sun.star.comp.Impress.XMLOasisStylesExporter"; @@ -166,7 +166,7 @@ SdXMLFilter::~SdXMLFilter() namespace { -sal_Int32 ReadThroughComponent( +ErrCode ReadThroughComponent( const Reference<io::XInputStream>& xInputStream, const Reference<XComponent>& xModelComponent, const OUString& rStreamName, @@ -288,10 +288,10 @@ sal_Int32 ReadThroughComponent( } // success! - return 0; + return ERRCODE_NONE; } -sal_Int32 ReadThroughComponent( +ErrCode ReadThroughComponent( const uno::Reference < embed::XStorage >& xStorage, const Reference<XComponent>& xModelComponent, const sal_Char* pStreamName, @@ -323,7 +323,7 @@ sal_Int32 ReadThroughComponent( // do we even have an alternative name? if ( nullptr == pCompatibilityStreamName ) - return 0; + return ERRCODE_NONE; // if so, does the stream exist? sStreamName = OUString::createFromAscii(pCompatibilityStreamName); @@ -336,7 +336,7 @@ sal_Int32 ReadThroughComponent( } if (! bContainsStream ) - return 0; + return ERRCODE_NONE; } // set Base URL @@ -446,7 +446,7 @@ void fixupOutlinePlaceholderNumberingDepths(SdDrawDocument* pDoc) bool SdXMLFilter::Import( ErrCode& nError ) { - sal_uInt32 nRet = 0; + ErrCode nRet = ERRCODE_NONE; // Get service factory Reference< uno::XComponentContext > rxContext = @@ -549,7 +549,7 @@ bool SdXMLFilter::Import( ErrCode& nError ) if( !xStorage.is() ) nRet = SD_XML_READERROR; - if( 0 == nRet ) + if( ERRCODE_NONE == nRet ) { pGraphicHelper = SvXMLGraphicHelper::Create( xStorage, SvXMLGraphicHelperMode::Read, @@ -568,7 +568,7 @@ bool SdXMLFilter::Import( ErrCode& nError ) SAL_INFO_IF(baseURI.isEmpty(), "sd.filter", "SdXMLFilter: no base URL"); xInfoSet->setPropertyValue("BaseURI", makeAny(baseURI)); - if( 0 == nRet && SfxObjectCreateMode::EMBEDDED == mrDocShell.GetCreateMode() ) + if( ERRCODE_NONE == nRet && SfxObjectCreateMode::EMBEDDED == mrDocShell.GetCreateMode() ) { OUString aName; if ( mrMedium.GetItemSet() ) @@ -588,7 +588,7 @@ bool SdXMLFilter::Import( ErrCode& nError ) if (SDXMLMODE_Organizer == meFilterMode) xInfoSet->setPropertyValue("OrganizerMode", uno::makeAny(true)); - if( 0 == nRet ) + if( ERRCODE_NONE == nRet ) { // prepare filter arguments @@ -608,8 +608,8 @@ bool SdXMLFilter::Import( ErrCode& nError ) XML_SERVICES* pServices = getServices( true, IsDraw(), mnStoreVer ); - sal_uInt32 nWarn = 0; - sal_uInt32 nWarn2 = 0; + ErrCode nWarn = ERRCODE_NONE; + ErrCode nWarn2 = ERRCODE_NONE; // read storage streams // #i103539#: always read meta.xml for generator nWarn = ReadThroughComponent( @@ -658,27 +658,19 @@ bool SdXMLFilter::Import( ErrCode& nError ) if( mxModel.is() ) mxModel->unlockControllers(); - if( nRet == 0 ) + if( nRet == ERRCODE_NONE ) pDoc->UpdateAllLinks(); - switch( nRet ) + if( nRet.anyOf( ERRCODE_NONE, SD_XML_READERROR ) ) + ; + else if( nRet == ERRCODE_IO_BROKENPACKAGE && xStorage.is() ) + nError = ERRCODE_IO_BROKENPACKAGE; + else { - case 0: break; - case SD_XML_READERROR: break; - case ERRCODE_IO_BROKENPACKAGE: - if( xStorage.is() ) - { - nError = ERRCODE_IO_BROKENPACKAGE; - break; - } - SAL_FALLTHROUGH; - default: - { - // TODO/LATER: this is completely wrong! Filter code should never call ErrorHandler directly! - ErrorHandler::HandleError( nRet ); - if( IsWarning( nRet ) ) - nRet = 0; - } + // TODO/LATER: this is completely wrong! Filter code should never call ErrorHandler directly! + ErrorHandler::HandleError( nRet ); + if( nRet.IsWarning() ) + nRet = ERRCODE_NONE; } // clear unused named items from item pool @@ -738,7 +730,7 @@ bool SdXMLFilter::Import( ErrCode& nError ) bool bTransform = false; - if( nRet == 0 ) + if( nRet == ERRCODE_NONE ) { if( !sBuildId.isEmpty() ) { @@ -782,7 +774,7 @@ bool SdXMLFilter::Import( ErrCode& nError ) pDoc->EnableUndo(true); mrDocShell.ClearUndoBuffer(); - return nRet == 0; + return nRet == ERRCODE_NONE; } bool SdXMLFilter::Export() diff --git a/sd/source/ui/app/sdmod.cxx b/sd/source/ui/app/sdmod.cxx index 689ba7569b15..f8d0ee660771 100644 --- a/sd/source/ui/app/sdmod.cxx +++ b/sd/source/ui/app/sdmod.cxx @@ -85,8 +85,8 @@ SdModule::SdModule(SfxObjectFactory* pFact1, SfxObjectFactory* pFact2 ) StartListening( *SfxGetpApp() ); SvxErrorHandler::ensure(); mpErrorHdl = new SfxErrorHandler( RID_SD_ERRHDL, - ERRCODE_AREA_SD, - ERRCODE_AREA_SD_END, + ErrCode(ERRCODE_AREA_SD), + ErrCode(ERRCODE_AREA_SD_END), GetResMgr() ); // Create a new ref device and (by calling SetReferenceDevice()) diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx index 094becb271fc..12945863ea8f 100644 --- a/sd/source/ui/app/sdmod1.cxx +++ b/sd/source/ui/app/sdmod1.cxx @@ -433,7 +433,7 @@ SfxFrame* SdModule::CreateFromTemplate( const OUString& rTemplatePath, const Ref SfxItemSet* pSet = new SfxAllItemSet( SfxGetpApp()->GetPool() ); pSet->Put( SfxBoolItem( SID_TEMPLATE, true ) ); - sal_uLong lErr = SfxGetpApp()->LoadTemplate( xDocShell, rTemplatePath, pSet ); + ErrCode lErr = SfxGetpApp()->LoadTemplate( xDocShell, rTemplatePath, pSet ); SfxObjectShell* pDocShell = xDocShell; @@ -566,19 +566,17 @@ OutlineToImpressFinalizer::OutlineToImpressFinalizer ( // Check the error code and stop copying the stream data when an // error has occurred. - switch (nErrorCode) + if (nErrorCode == ERRCODE_NONE) { - case ERRCODE_NONE: - if (nReadByteCount == 0) - bLoop = false; - break; - case ERRCODE_IO_PENDING: - break; - - default: + if (nReadByteCount == 0) bLoop = false; - nReadByteCount = 0; - break; + } + else if (nErrorCode == ERRCODE_IO_PENDING) + ; + else + { + bLoop = false; + nReadByteCount = 0; } // Append the read bytes to the end of the memory stream. @@ -606,9 +604,7 @@ void OutlineToImpressFinalizer::operator() (bool) sd::OutlineView* pView = static_cast<sd::OutlineView*>(pOutlineShell->GetView()); // mba: the stream can't contain any relative URLs, because we don't // have any information about a BaseURL! - if ( pOutlineShell->ReadRtf(*mpStream) == 0 ) - { - } + pOutlineShell->ReadRtf(*mpStream); // Call UpdatePreview once for every slide to resync the // document with the outliner of the OutlineViewShell. diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index cb562673ef43..afaacaf55dec 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -585,7 +585,7 @@ bool DrawDocShell::SaveAs( SfxMedium& rMedium ) if( GetCreateMode() == SfxObjectCreateMode::STANDARD ) SfxObjectShell::SetVisArea( ::tools::Rectangle() ); - sal_uInt32 nVBWarning = ERRCODE_NONE; + ErrCode nVBWarning = ERRCODE_NONE; bool bRet = SfxObjectShell::SaveAs( rMedium ); if( bRet ) diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx index d8c620e6f7f6..711aa064351a 100644 --- a/sd/source/ui/func/fuinsfil.cxx +++ b/sd/source/ui/func/fuinsfil.cxx @@ -456,7 +456,7 @@ void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium) assert(pStream && "No InStream!"); pStream->Seek( 0 ); - sal_uLong nErr = pOutliner->Read( *pStream, pMedium->GetBaseURL(), nFormat, mpDocSh->GetHeaderAttributes() ); + ErrCode nErr = pOutliner->Read( *pStream, pMedium->GetBaseURL(), nFormat, mpDocSh->GetHeaderAttributes() ); if (nErr || pOutliner->GetEditEngine().GetText().isEmpty()) { @@ -600,7 +600,7 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium) DBG_ASSERT( pStream, "No InStream!" ); pStream->Seek( 0 ); - sal_uLong nErr = pOutliner->Read(*pStream, pMedium->GetBaseURL(), nFormat, mpDocSh->GetHeaderAttributes()); + ErrCode nErr = pOutliner->Read(*pStream, pMedium->GetBaseURL(), nFormat, mpDocSh->GetHeaderAttributes()); if (nErr || pOutliner->GetEditEngine().GetText().isEmpty()) { diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx index 024afcc41ac4..fe040185b4e6 100644 --- a/sd/source/ui/func/fupage.cxx +++ b/sd/source/ui/func/fupage.cxx @@ -312,7 +312,7 @@ const SfxItemSet* FuPage::ExecuteDialog( vcl::Window* pParent ) if( aDlg.Execute() == ERRCODE_NONE ) { Graphic aGraphic; - int nError = aDlg.GetGraphic(aGraphic); + ErrCode nError = aDlg.GetGraphic(aGraphic); if( nError == ERRCODE_NONE ) { pTempSet.reset( new SfxItemSet( mpDoc->GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{}) ); diff --git a/sd/source/ui/inc/OutlineViewShell.hxx b/sd/source/ui/inc/OutlineViewShell.hxx index 10ff97c9a074..179853283af6 100644 --- a/sd/source/ui/inc/OutlineViewShell.hxx +++ b/sd/source/ui/inc/OutlineViewShell.hxx @@ -111,7 +111,7 @@ public: virtual bool KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin) override; virtual void MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin) override; - sal_uLong ReadRtf(SvStream& rInput); + ErrCode ReadRtf(SvStream& rInput); virtual void WriteUserDataSequence ( css::uno::Sequence < css::beans::PropertyValue >&, bool bBrowse ) override; virtual void ReadUserDataSequence ( const css::uno::Sequence < css::beans::PropertyValue >&, bool bBrowse ) override; diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index 328c2b101857..14b9022abc1c 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -1752,9 +1752,9 @@ void OutlineViewShell::UpdateOutlineObject( SdPage* pPage, Paragraph* pPara ) /** * Fill Outliner from Stream */ -sal_uLong OutlineViewShell::ReadRtf(SvStream& rInput) +ErrCode OutlineViewShell::ReadRtf(SvStream& rInput) { - sal_uLong bRet = 0; + ErrCode bRet = ERRCODE_NONE; ::Outliner& rOutl = pOlView->GetOutliner(); diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx index 3d98ee66ea4f..4f8b8be7fec2 100644 --- a/sd/source/ui/view/sdview4.cxx +++ b/sd/source/ui/view/sdview4.cxx @@ -392,7 +392,7 @@ IMPL_LINK_NOARG(View, DropInsertFileHdl, Timer *, void) return; SfxErrorContext aEc( ERRCTX_ERROR, mpViewSh->GetActiveWindow(), RID_SO_ERRCTX ); - ErrCode nError = 0; + ErrCode nError = ERRCODE_NONE; ::std::vector< OUString >::const_iterator aIter( maDropFileVector.begin() ); diff --git a/sdext/source/pdfimport/misc/pwdinteract.cxx b/sdext/source/pdfimport/misc/pwdinteract.cxx index 4b6d4a82c3a0..00bd5deb0c69 100644 --- a/sdext/source/pdfimport/misc/pwdinteract.cxx +++ b/sdext/source/pdfimport/misc/pwdinteract.cxx @@ -133,7 +133,7 @@ private: return uno::makeAny( task::ErrorCodeRequest( OUString(), uno::Reference< uno::XInterface >(), - ERRCODE_IO_WRONGVERSION)); + sal_uInt32(ERRCODE_IO_WRONGVERSION))); //TODO: should be something more informative than crudely reused // ERRCODE_IO_WRONGVERSION } diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx index e6e7596a01aa..e098600f70a6 100644 --- a/sfx2/source/appl/appinit.cxx +++ b/sfx2/source/appl/appinit.cxx @@ -211,7 +211,7 @@ void SfxApplication::Initialize_Impl() Help::EnableExtHelp(); pImpl->m_pToolsErrorHdl = new SfxErrorHandler( - RID_ERRHDL, ERRCODE_AREA_TOOLS, ERRCODE_AREA_LIB1); + RID_ERRHDL, ErrCode(ERRCODE_AREA_TOOLS), ErrCode(ERRCODE_AREA_LIB1)); #if HAVE_FEATURE_SCRIPTING pImpl->pBasicResMgr = ResMgr::CreateResMgr("sb"); @@ -219,10 +219,10 @@ void SfxApplication::Initialize_Impl() pImpl->pSvtResMgr = ResMgr::CreateResMgr("svt"); pImpl->m_pSoErrorHdl = new SfxErrorHandler( - RID_SO_ERROR_HANDLER, ERRCODE_AREA_SO, ERRCODE_AREA_SO_END, pImpl->pSvtResMgr ); + RID_SO_ERROR_HANDLER, ErrCode(ERRCODE_AREA_SO), ErrCode(ERRCODE_AREA_SO_END), pImpl->pSvtResMgr ); #if HAVE_FEATURE_SCRIPTING pImpl->m_pSbxErrorHdl = new SfxErrorHandler( - RID_BASIC_START, ERRCODE_AREA_SBX, ERRCODE_AREA_SBX_END, pImpl->pBasicResMgr ); + RID_BASIC_START, ErrCode(ERRCODE_AREA_SBX), ErrCode(ERRCODE_AREA_SBX_END), pImpl->pBasicResMgr ); #endif if (!utl::ConfigManager::IsAvoidConfig()) diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index d4717a16d733..9821f16e56b0 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -170,7 +170,7 @@ private: } -sal_uInt32 CheckPasswd_Impl +ErrCode CheckPasswd_Impl ( SfxObjectShell* pDoc, SfxMedium* pFile // the Medium and its Password shold be obtained @@ -184,7 +184,7 @@ sal_uInt32 CheckPasswd_Impl If the set does not exist the it is created. */ { - sal_uIntPtr nRet = ERRCODE_NONE; + ErrCode nRet = ERRCODE_NONE; if( ( !pFile->GetFilter() || pFile->IsStorage() ) ) { @@ -271,7 +271,7 @@ sal_uInt32 CheckPasswd_Impl } -sal_uIntPtr SfxApplication::LoadTemplate( SfxObjectShellLock& xDoc, const OUString &rFileName, SfxItemSet* pSet ) +ErrCode SfxApplication::LoadTemplate( SfxObjectShellLock& xDoc, const OUString &rFileName, SfxItemSet* pSet ) { std::shared_ptr<const SfxFilter> pFilter; SfxMedium aMedium( rFileName, ( StreamMode::READ | StreamMode::SHARE_DENYNONE ) ); @@ -286,8 +286,8 @@ sal_uIntPtr SfxApplication::LoadTemplate( SfxObjectShellLock& xDoc, const OUStri } aMedium.UseInteractionHandler( true ); - sal_uIntPtr nErr = GetFilterMatcher().GuessFilter( aMedium, pFilter, SfxFilterFlags::TEMPLATE, SfxFilterFlags::NONE ); - if ( 0 != nErr) + ErrCode nErr = GetFilterMatcher().GuessFilter( aMedium, pFilter, SfxFilterFlags::TEMPLATE, SfxFilterFlags::NONE ); + if ( ERRCODE_NONE != nErr) { delete pSet; return ERRCODE_SFX_NOTATEMPLATE; @@ -488,7 +488,7 @@ void SfxApplication::NewDocExec_Impl( SfxRequest& rReq ) } } - sal_uIntPtr lErr = 0; + ErrCode lErr = ERRCODE_NONE; SfxItemSet* pSet = new SfxAllItemSet( GetPool() ); pSet->Put( SfxBoolItem( SID_TEMPLATE, true ) ); if ( !bDirect ) @@ -506,7 +506,7 @@ void SfxApplication::NewDocExec_Impl( SfxRequest& rReq ) if ( lErr != ERRCODE_NONE ) { - sal_uIntPtr lFatalErr = ERRCODE_TOERROR(lErr); + ErrCode lFatalErr = lErr.IgnoreWarning(); if ( lFatalErr ) ErrorHandler::HandleError(lErr); } @@ -639,7 +639,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) pBlackListItem->GetStringList( aBlackList ); - sal_uIntPtr nErr = sfx2::FileOpenDialog_Impl( + ErrCode nErr = sfx2::FileOpenDialog_Impl( nDialogType, eDialogFlags, OUString(), aURLList, aFilter, pSet, &aPath, nDialog, sStandardDir, aBlackList ); @@ -716,9 +716,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) css::task::ErrorCodeRequest aRequest; if (aRule.m_xRequest->getRequest() >>= aRequest) { - if (aRequest.ErrCode == - sal::static_int_cast< sal_Int32 >( - ERRCODE_SFX_NOMOREDOCUMENTSALLOWED)) + if (aRequest.ErrCode == sal_Int32(sal_uInt32(ERRCODE_SFX_NOMOREDOCUMENTSALLOWED))) break; } } diff --git a/sfx2/source/appl/macroloader.cxx b/sfx2/source/appl/macroloader.cxx index ce1e85e0c88b..7621ea7665b8 100644 --- a/sfx2/source/appl/macroloader.cxx +++ b/sfx2/source/appl/macroloader.cxx @@ -159,7 +159,7 @@ uno::Any SAL_CALL SfxMacroLoader::dispatchWithReturnValue( beans::PropertyValue aErrorCode; aErrorCode.Name = "ErrorCode"; - aErrorCode.Value <<= nErr; + aErrorCode.Value <<= sal_uInt32(nErr); aRet <<= aErrorCode; } diff --git a/sfx2/source/appl/opengrf.cxx b/sfx2/source/appl/opengrf.cxx index ef3a060d99cc..51ce43006f71 100644 --- a/sfx2/source/appl/opengrf.cxx +++ b/sfx2/source/appl/opengrf.cxx @@ -57,20 +57,16 @@ using namespace ::cppu; sal_uInt16 SvxOpenGrfErr2ResId( ErrCode err ) { - switch( err ) - { - case ERRCODE_GRFILTER_OPENERROR: - return RID_SVXSTR_GRFILTER_OPENERROR; - case ERRCODE_GRFILTER_IOERROR: - return RID_SVXSTR_GRFILTER_IOERROR; - case ERRCODE_GRFILTER_VERSIONERROR: - return RID_SVXSTR_GRFILTER_VERSIONERROR; - case ERRCODE_GRFILTER_FILTERERROR: - return RID_SVXSTR_GRFILTER_FILTERERROR; - case ERRCODE_GRFILTER_FORMATERROR: - default: - return RID_SVXSTR_GRFILTER_FORMATERROR; - } + if (err == ERRCODE_GRFILTER_OPENERROR) + return RID_SVXSTR_GRFILTER_OPENERROR; + else if (err == ERRCODE_GRFILTER_IOERROR) + return RID_SVXSTR_GRFILTER_IOERROR; + else if (err == ERRCODE_GRFILTER_VERSIONERROR) + return RID_SVXSTR_GRFILTER_VERSIONERROR; + else if (err == ERRCODE_GRFILTER_FILTERERROR) + return RID_SVXSTR_GRFILTER_FILTERERROR; + else + return RID_SVXSTR_GRFILTER_FORMATERROR; } @@ -104,9 +100,9 @@ SvxOpenGraphicDialog::~SvxOpenGraphicDialog() } -short SvxOpenGraphicDialog::Execute() +ErrCode SvxOpenGraphicDialog::Execute() { - sal_uInt16 nImpRet; + ErrCode nImpRet; bool bQuitLoop(false); while( !bQuitLoop && @@ -174,7 +170,7 @@ short SvxOpenGraphicDialog::Execute() } // cancel - return -1; + return ErrCode(sal_uInt32(-1)); } @@ -243,7 +239,7 @@ bool SvxOpenGraphicDialog::IsAsLink() const } -int SvxOpenGraphicDialog::GetGraphic(Graphic& rGraphic) const +ErrCode SvxOpenGraphicDialog::GetGraphic(Graphic& rGraphic) const { return mpImpl->aFileDlg.GetGraphic(rGraphic); } diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx index fa6b2ec7661b..ed12ff58cab4 100644 --- a/sfx2/source/bastyp/fltfnc.cxx +++ b/sfx2/source/bastyp/fltfnc.cxx @@ -351,7 +351,7 @@ std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetAnyFilter( SfxFilterFlags } -sal_uInt32 SfxFilterMatcher::GuessFilterIgnoringContent( +ErrCode SfxFilterMatcher::GuessFilterIgnoringContent( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>& rpFilter ) const { @@ -379,13 +379,13 @@ sal_uInt32 SfxFilterMatcher::GuessFilterIgnoringContent( } -sal_uInt32 SfxFilterMatcher::GuessFilter( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>& rpFilter, SfxFilterFlags nMust, SfxFilterFlags nDont ) const +ErrCode SfxFilterMatcher::GuessFilter( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>& rpFilter, SfxFilterFlags nMust, SfxFilterFlags nDont ) const { return GuessFilterControlDefaultUI( rMedium, rpFilter, nMust, nDont ); } -sal_uInt32 SfxFilterMatcher::GuessFilterControlDefaultUI( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>& rpFilter, SfxFilterFlags nMust, SfxFilterFlags nDont ) const +ErrCode SfxFilterMatcher::GuessFilterControlDefaultUI( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>& rpFilter, SfxFilterFlags nMust, SfxFilterFlags nDont ) const { std::shared_ptr<const SfxFilter> pOldFilter = rpFilter; @@ -512,7 +512,7 @@ bool SfxFilterMatcher::IsFilterInstalled_Impl( const std::shared_ptr<const SfxFi } -sal_uInt32 SfxFilterMatcher::DetectFilter( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>& rpFilter ) const +ErrCode SfxFilterMatcher::DetectFilter( SfxMedium& rMedium, std::shared_ptr<const SfxFilter>& rpFilter ) const /* [Description] Here the Filter selection box is pulled up. Otherwise GuessFilter diff --git a/sfx2/source/doc/DocumentMetadataAccess.cxx b/sfx2/source/doc/DocumentMetadataAccess.cxx index 8fb8220bb1c6..00404ec9acb2 100644 --- a/sfx2/source/doc/DocumentMetadataAccess.cxx +++ b/sfx2/source/doc/DocumentMetadataAccess.cxx @@ -1300,14 +1300,13 @@ DocumentMetadataAccess::storeMetadataToMedium( const bool bOk = aMedium.Commit(); aMedium.Close(); if ( !bOk ) { - sal_uInt32 nError = aMedium.GetError(); + ErrCode nError = aMedium.GetError(); if ( nError == ERRCODE_NONE ) { nError = ERRCODE_IO_GENERAL; } task::ErrorCodeIOException ex( - ("DocumentMetadataAccess::storeMetadataToMedium Commit failed: " - "0x" + OUString::number(nError, 16)), - uno::Reference< uno::XInterface >(), nError); + "DocumentMetadataAccess::storeMetadataToMedium Commit failed: " + nError.toHexString(), + uno::Reference< uno::XInterface >(), sal_uInt32(nError)); throw lang::WrappedTargetException(OUString(), *this, uno::makeAny(ex)); } diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index fa34dc6e498a..b222b8639161 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -1949,15 +1949,14 @@ SfxDocumentMetaData::storeToMedium(const OUString & URL, const bool bOk = aMedium.Commit(); aMedium.Close(); if ( !bOk ) { - sal_uInt32 nError = aMedium.GetError(); + ErrCode nError = aMedium.GetError(); if ( nError == ERRCODE_NONE ) { nError = ERRCODE_IO_GENERAL; } throw css::task::ErrorCodeIOException( - ("SfxDocumentMetaData::storeToMedium <" + URL + "> Commit failed: " - "0x" + OUString::number(nError, 16)), - css::uno::Reference< css::uno::XInterface >(), nError); + "SfxDocumentMetaData::storeToMedium <" + URL + "> Commit failed: " + nError.toHexString(), + css::uno::Reference< css::uno::XInterface >(), sal_uInt32(nError)); } } diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index b86dba5a7d58..ae39a016c5cf 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -167,7 +167,7 @@ class SfxMedium_Impl { public: StreamMode m_nStorOpenMode; - sal_uInt32 m_eError; + ErrCode m_eError; ::ucbhelper::Content aContent; bool bUpdatePickList:1; @@ -224,7 +224,7 @@ public: uno::Reference<io::XStream> m_xLockingStream; uno::Reference<task::XInteractionHandler> xInteraction; - sal_uInt32 nLastStorageError; + ErrCode nLastStorageError; OUString m_aBackupURL; @@ -276,7 +276,7 @@ SfxMedium_Impl::SfxMedium_Impl() : pOrigFilter( nullptr ), aExpireTime( Date( Date::SYSTEM ) + 10, tools::Time( tools::Time::SYSTEM ) ), pTempFile( nullptr ), - nLastStorageError( 0 ), + nLastStorageError( ERRCODE_NONE ), m_nSignatureState( SignatureState::NOSIGNATURES ) { aDoneLink.CreateMutex(); @@ -301,19 +301,19 @@ void SfxMedium::ResetError() pImpl->m_pOutStream->ResetError(); } -sal_uInt32 SfxMedium::GetLastStorageCreationState() +ErrCode SfxMedium::GetLastStorageCreationState() { return pImpl->nLastStorageError; } -void SfxMedium::SetError(sal_uInt32 nError) +void SfxMedium::SetError(ErrCode nError) { pImpl->m_eError = nError; } -sal_uInt32 SfxMedium::GetErrorCode() const +ErrCode SfxMedium::GetErrorCode() const { - sal_uInt32 lError = pImpl->m_eError; + ErrCode lError = pImpl->m_eError; if(!lError && pImpl->m_pInStream) lError = pImpl->m_pInStream->GetErrorCode(); if(!lError && pImpl->m_pOutStream) @@ -1694,7 +1694,7 @@ void SfxMedium::TransactedTransferForFS_Impl( const INetURLObject& aSource, pImpl->m_eError = ERRCODE_IO_GENERAL; } - if( !pImpl->m_eError || (pImpl->m_eError & ERRCODE_WARNING_MASK) ) + if( !pImpl->m_eError || pImpl->m_eError.IsWarning() ) { if ( pImpl->xStorage.is() ) CloseStorage(); @@ -1859,7 +1859,7 @@ void SfxMedium::Transfer_Impl() SAL_WARN( "sfx.doc", "The medium name is not convertible!" ); } - if ( !aNameURL.isEmpty() && ( !pImpl->m_eError || (pImpl->m_eError & ERRCODE_WARNING_MASK) ) ) + if ( !aNameURL.isEmpty() && ( !pImpl->m_eError || pImpl->m_eError.IsWarning() ) ) { SAL_INFO( "sfx.doc", "SfxMedium::Transfer_Impl, copying to target" ); @@ -2026,7 +2026,7 @@ void SfxMedium::Transfer_Impl() pImpl->m_eError = ERRCODE_IO_GENERAL; } - if ( !pImpl->m_eError || (pImpl->m_eError & ERRCODE_WARNING_MASK) ) + if ( !pImpl->m_eError || pImpl->m_eError.IsWarning() ) { // free resources, otherwise the transfer may fail if ( pImpl->xStorage.is() ) @@ -2122,7 +2122,7 @@ void SfxMedium::Transfer_Impl() } } - if ( ( !pImpl->m_eError || (pImpl->m_eError & ERRCODE_WARNING_MASK) ) && !pImpl->pTempFile ) + if ( ( !pImpl->m_eError || pImpl->m_eError.IsWarning() ) && !pImpl->pTempFile ) { // without a TempFile the physical and logical name should be the same after successful transfer if (osl::FileBase::getSystemPathFromFileURL( @@ -2464,8 +2464,8 @@ void SfxMedium::GetMedium_Impl() pImpl->bDownloadDone = true; pImpl->aDoneLink.ClearPendingCall(); - sal_uIntPtr nError = GetError(); - pImpl->aDoneLink.Call( reinterpret_cast<void*>(nError) ); + ErrCode nError = GetError(); + pImpl->aDoneLink.Call( reinterpret_cast<void*>(sal_uInt32(nError)) ); } } @@ -3430,7 +3430,7 @@ void SfxMedium::CreateTempFile( bool bReplace ) if ( pImpl->m_pOutStream ) { char *pBuf = new char [8192]; - sal_uInt32 nErr = ERRCODE_NONE; + ErrCode nErr = ERRCODE_NONE; pImpl->m_pInStream->Seek(0); pImpl->m_pOutStream->Seek(0); diff --git a/sfx2/source/doc/docinf.cxx b/sfx2/source/doc/docinf.cxx index 3241a0146e55..f73407735c45 100644 --- a/sfx2/source/doc/docinf.cxx +++ b/sfx2/source/doc/docinf.cxx @@ -44,7 +44,7 @@ using namespace ::com::sun::star; namespace sfx2 { -sal_uInt32 LoadOlePropertySet( +ErrCode LoadOlePropertySet( const uno::Reference< document::XDocumentProperties>& i_xDocProps, SotStorage* i_pStorage ) { diff --git a/sfx2/source/doc/docinsert.cxx b/sfx2/source/doc/docinsert.cxx index 5957b0fa4d92..8209b4a1f4cb 100644 --- a/sfx2/source/doc/docinsert.cxx +++ b/sfx2/source/doc/docinsert.cxx @@ -119,7 +119,7 @@ SfxMedium* DocumentInserter::CreateMedium(char const*const pFallbackHack) pMatcher.reset(new SfxFilterMatcher()); std::shared_ptr<const SfxFilter> pFilter; - sal_uInt32 nError = pMatcher->DetectFilter( *pMedium, pFilter ); + ErrCode nError = pMatcher->DetectFilter( *pMedium, pFilter ); // tdf#101813 hack: check again if it's a global document if (ERRCODE_NONE != nError && pFallbackHack) { @@ -153,7 +153,7 @@ SfxMediumList* DocumentInserter::CreateMediumList() SfxFilterMatcher aMatcher( m_sDocFactory ); std::shared_ptr<const SfxFilter> pFilter; - sal_uInt32 nError = aMatcher.DetectFilter( *pMedium, pFilter ); + ErrCode nError = aMatcher.DetectFilter( *pMedium, pFilter ); if ( nError == ERRCODE_NONE && pFilter ) pMedium->SetFilter( pFilter ); else diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx index f9ba5ac180f8..da009871b2aa 100644 --- a/sfx2/source/doc/docmacromode.cxx +++ b/sfx2/source/doc/docmacromode.cxx @@ -83,13 +83,13 @@ namespace sfx2 namespace { - void lcl_showGeneralSfxErrorOnce( const Reference< XInteractionHandler >& rxHandler, const sal_Int32 nSfxErrorCode, bool& rbAlreadyShown ) + void lcl_showGeneralSfxErrorOnce( const Reference< XInteractionHandler >& rxHandler, ErrCode nSfxErrorCode, bool& rbAlreadyShown ) { if ( rbAlreadyShown ) return; ErrorCodeRequest aErrorCodeRequest; - aErrorCodeRequest.ErrCode = nSfxErrorCode; + aErrorCodeRequest.ErrCode = sal_uInt32(nSfxErrorCode); SfxMedium::CallApproveHandler( rxHandler, makeAny( aErrorCodeRequest ), false ); rbAlreadyShown = true; diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx index 190a2e75e847..7e78818c0732 100644 --- a/sfx2/source/doc/graphhelp.cxx +++ b/sfx2/source/doc/graphhelp.cxx @@ -95,11 +95,11 @@ void* GraphicHelper::getEnhMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta ) if ( pStream ) { Graphic aGraph( *pGDIMeta ); - bool bFailed = GraphicConverter::Export( *pStream, aGraph, ConvertDataFormat::EMF ); + ErrCode nFailed = GraphicConverter::Export( *pStream, aGraph, ConvertDataFormat::EMF ); pStream->Flush(); delete pStream; - if ( !bFailed ) + if ( !nFailed ) pResult = GetEnhMetaFileA( aWinFile.getStr() ); } } @@ -121,9 +121,9 @@ void* GraphicHelper::getWinMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta, co { SvMemoryStream pStream( 65535, 65535 ); Graphic aGraph( *pGDIMeta ); - bool bFailed = GraphicConverter::Export( pStream, aGraph, ConvertDataFormat::WMF ); + ErrCode nFailed = GraphicConverter::Export( pStream, aGraph, ConvertDataFormat::WMF ); pStream.Flush(); - if ( !bFailed ) + if ( !nFailed ) { sal_Int32 nLength = pStream.Seek( STREAM_SEEK_TO_END ); if ( nLength > 22 ) diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 1df20de8d694..7adac1e93a7d 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -166,7 +166,7 @@ sal_Int8 getStoreModeFromSlotName( const OUString& aSlotName ) throw task::ErrorCodeIOException( ("getStoreModeFromSlotName(\"" + aSlotName + "): ERRCODE_IO_INVALIDPARAMETER"), - uno::Reference< uno::XInterface >(), ERRCODE_IO_INVALIDPARAMETER ); + uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_IO_INVALIDPARAMETER) ); return nResult; } @@ -601,7 +601,7 @@ bool ModelData_Impl::ExecuteFilterDialog_Impl( const OUString& aFilterName ) ("ModelData_Impl::ExecuteFilterDialog_Impl:" " ERRCODE_IO_ABORT"), uno::Reference< uno::XInterface >(), - ERRCODE_IO_ABORT); + sal_uInt32(ERRCODE_IO_ABORT)); } } } @@ -617,7 +617,7 @@ bool ModelData_Impl::ExecuteFilterDialog_Impl( const OUString& aFilterName ) throw task::ErrorCodeIOException( ("ModelData_Impl::ExecuteFilterDialog_Impl: NoSuchElementException" " \"" + e.Message + "\": ERRCODE_IO_ABORT"), - uno::Reference< uno::XInterface >(), ERRCODE_IO_INVALIDPARAMETER); + uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_IO_INVALIDPARAMETER)); } catch( const task::ErrorCodeIOException& ) { @@ -799,7 +799,7 @@ bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, throw task::ErrorCodeIOException( "ModelData_Impl::OutputFileDialog: ERRCODE_IO_INVALIDPARAMETER", uno::Reference< uno::XInterface >(), - ERRCODE_IO_INVALIDPARAMETER); + sal_uInt32(ERRCODE_IO_INVALIDPARAMETER)); // no target file name is specified // we need to show the file dialog @@ -967,7 +967,7 @@ bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, { throw task::ErrorCodeIOException( "ModelData_Impl::OutputFileDialog: ERRCODE_IO_ABORT", - uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT); + uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_IO_ABORT)); } // the following two arguments can not be converted in MediaDescriptor, @@ -1302,7 +1302,7 @@ bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& xMo if ( ( nStoreMode & SAVEAS_REQUESTED ) && aModelData.CheckSaveAcceptable( STATUS_SAVEAS ) == STATUS_NO_ACTION ) throw task::ErrorCodeIOException( "SfxStoringHelper::GUIStoreModel: ERRCODE_IO_ABORT", - uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT); + uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_IO_ABORT)); } else if ( nStoreMode & SAVE_REQUESTED ) { @@ -1312,7 +1312,7 @@ bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& xMo if ( nStatusSave == STATUS_NO_ACTION ) throw task::ErrorCodeIOException( "SfxStoringHelper::GUIStoreModel: ERRCODE_IO_ABORT", - uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT); + uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_IO_ABORT)); else if ( nStatusSave == STATUS_SAVE ) { // check whether it is possible to use save operation @@ -1323,7 +1323,7 @@ bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& xMo { throw task::ErrorCodeIOException( "SfxStoringHelper::GUIStoreModel: ERRCODE_IO_ABORT", - uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT); + uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_IO_ABORT)); } else if ( nStatusSave != STATUS_SAVE ) { @@ -1348,7 +1348,7 @@ bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& xMo // the user has decided not to store the document throw task::ErrorCodeIOException( "SfxStoringHelper::GUIStoreModel: ERRCODE_IO_ABORT", - uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT); + uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_IO_ABORT)); } } } @@ -1387,7 +1387,7 @@ bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& xMo if ( !aFilterProps.getLength() ) throw task::ErrorCodeIOException( "SfxStoringHelper::GUIStoreModel: ERRCODE_IO_INVALIDPARAMETER", - uno::Reference< uno::XInterface >(), ERRCODE_IO_INVALIDPARAMETER); + uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_IO_INVALIDPARAMETER)); ::comphelper::SequenceAsHashMap aFilterPropsHM( aFilterProps ); OUString aFilterName = aFilterPropsHM.getUnpackedValueOrDefault( "Name", OUString() ); @@ -1537,7 +1537,7 @@ bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& xMo SAL_WARN( "sfx.doc", "This code must be unreachable!" ); throw task::ErrorCodeIOException( "SfxStoringHelper::GUIStoreModel: ERRCODE_IO_INVALIDPARAMETER", - uno::Reference< uno::XInterface >(), ERRCODE_IO_INVALIDPARAMETER); + uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_IO_INVALIDPARAMETER)); } ::comphelper::SequenceAsHashMap::const_iterator aIter = diff --git a/sfx2/source/doc/new.cxx b/sfx2/source/doc/new.cxx index 3c5716e9eed3..e10986bf6111 100644 --- a/sfx2/source/doc/new.cxx +++ b/sfx2/source/doc/new.cxx @@ -216,11 +216,10 @@ IMPL_LINK_NOARG(SfxNewFileDialog_Impl, Update, Timer*, void) { SfxErrorContext eEC(ERRCTX_SFX_LOADTEMPLATE,pAntiImpl); SfxApplication *pSfxApp = SfxGetpApp(); - sal_uIntPtr lErr; SfxItemSet* pSet = new SfxAllItemSet(pSfxApp->GetPool()); pSet->Put(SfxBoolItem(SID_TEMPLATE, true)); pSet->Put(SfxBoolItem(SID_PREVIEW, true)); - lErr = pSfxApp->LoadTemplate(xDocShell, aFileName, pSet); + ErrCode lErr = pSfxApp->LoadTemplate(xDocShell, aFileName, pSet); if (lErr) ErrorHandler::HandleError(lErr); if (!xDocShell.Is()) diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 7ff7253dfe3b..952bd34f66f2 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -197,7 +197,7 @@ void SfxObjectShell::FlushDocInfo() (delay > 0) || !url.isEmpty() ); } -void SfxObjectShell::SetError(sal_uInt32 lErr) +void SfxObjectShell::SetError(ErrCode lErr) { if (pImpl->lErr==ERRCODE_NONE) { @@ -205,14 +205,14 @@ void SfxObjectShell::SetError(sal_uInt32 lErr) } } -sal_uInt32 SfxObjectShell::GetError() const +ErrCode SfxObjectShell::GetError() const { - return ERRCODE_TOERROR(GetErrorCode()); + return GetErrorCode().IgnoreWarning(); } -sal_uInt32 SfxObjectShell::GetErrorCode() const +ErrCode SfxObjectShell::GetErrorCode() const { - sal_uInt32 lError=pImpl->lErr; + ErrCode lError=pImpl->lErr; if(!lError && GetMedium()) lError=GetMedium()->GetErrorCode(); return lError; @@ -220,7 +220,7 @@ sal_uInt32 SfxObjectShell::GetErrorCode() const void SfxObjectShell::ResetError() { - pImpl->lErr=0; + pImpl->lErr=ERRCODE_NONE; SfxMedium * pMed = GetMedium(); if( pMed ) pMed->ResetError(); @@ -965,7 +965,7 @@ void SfxObjectShell::CheckEncryption_Impl( const uno::Reference< task::XInteract { // this is an encrypted document with nonencrypted streams inside, show the warning css::task::ErrorCodeRequest aErrorCode; - aErrorCode.ErrCode = ERRCODE_SFX_INCOMPLETE_ENCRYPTION; + aErrorCode.ErrCode = sal_uInt32(ERRCODE_SFX_INCOMPLETE_ENCRYPTION); SfxMedium::CallApproveHandler( xHandler, uno::makeAny( aErrorCode ), false ); pImpl->m_bIncomplEncrWarnShown = true; @@ -1656,7 +1656,7 @@ void SfxObjectShell::InPlaceActivate( bool ) bool SfxObjectShell::UseInteractionToHandleError( const uno::Reference< task::XInteractionHandler >& xHandler, - sal_uInt32 nError ) + ErrCode nError ) { bool bResult = false; @@ -1672,7 +1672,7 @@ bool SfxObjectShell::UseInteractionToHandleError( lContinuations[1].set( static_cast< task::XInteractionContinuation* >( pApprove ), uno::UNO_QUERY ); task::ErrorCodeRequest aErrorCode; - aErrorCode.ErrCode = nError; + aErrorCode.ErrCode = sal_uInt32(nError); aInteraction <<= aErrorCode; xHandler->handle(::framework::InteractionRequest::CreateRequest (aInteraction,lContinuations)); bResult = pAbort->wasSelected(); diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index fea3af2af67b..dc2cfa229ed1 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -519,7 +519,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) // at the end of the method aModelGuard.Init_Impl( uno::Reference< util::XCloseable >( GetModel(), uno::UNO_QUERY ) ); - sal_uInt32 nErrorCode = ERRCODE_NONE; + ErrCode nErrorCode = ERRCODE_NONE; // by default versions should be preserved always except in case of an explicit // SaveAs via GUI, so the flag must be set accordingly @@ -633,7 +633,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) // the user has decided not to store the document throw task::ErrorCodeIOException( "SfxObjectShell::ExecFile_Impl: ERRCODE_IO_ABORT", - uno::Reference< uno::XInterface >(), ERRCODE_IO_ABORT); + uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_IO_ABORT)); } // merge aDispatchArgs to the request @@ -654,7 +654,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) } catch( const task::ErrorCodeIOException& aErrorEx ) { - nErrorCode = (sal_uInt32)aErrorEx.ErrCode; + nErrorCode = ErrCode(aErrorEx.ErrCode); } catch( Exception& ) { @@ -664,7 +664,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) // by default versions should be preserved always except in case of an explicit // SaveAs via GUI, so the flag must be reset to guarantee this pImpl->bPreserveVersions = true; - sal_uIntPtr lErr=GetErrorCode(); + ErrCode lErr=GetErrorCode(); if ( !lErr && nErrorCode ) lErr = nErrorCode; @@ -790,7 +790,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) } SetModified( false ); - sal_uIntPtr lErr = GetErrorCode(); + ErrCode lErr = GetErrorCode(); ErrorHandler::HandleError(lErr); rReq.SetReturnValue( SfxBoolItem(0, true) ); diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index ea77377f54b5..2f87356dcaa1 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -658,7 +658,7 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed ) bool bHasStorage = IsPackageStorageFormat_Impl( *pMedium ); if ( pMedium->GetFilter() ) { - sal_uInt32 nError = HandleFilter( pMedium, this ); + ErrCode nError = HandleFilter( pMedium, this ); if ( nError != ERRCODE_NONE ) SetError(nError); @@ -868,9 +868,9 @@ bool SfxObjectShell::DoLoadExternal( SfxMedium *pMed ) return LoadExternal(*pMedium); } -sal_uInt32 SfxObjectShell::HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDoc ) +ErrCode SfxObjectShell::HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDoc ) { - sal_uInt32 nError = ERRCODE_NONE; + ErrCode nError = ERRCODE_NONE; SfxItemSet* pSet = pMedium->GetItemSet(); const SfxStringItem* pOptions = SfxItemSet::GetItem<SfxStringItem>(pSet, SID_FILE_FILTEROPTIONS, false); const SfxUnoAnyItem* pData = SfxItemSet::GetItem<SfxUnoAnyItem>(pSet, SID_FILTER_DATA, false); diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 2e2d0d325d93..e2ebee05f9bb 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -1543,8 +1543,8 @@ void SAL_CALL SfxBaseModel::storeSelf( const Sequence< beans::PropertyValue > DELETEZ( pParams ); - sal_uInt32 nErrCode = m_pData->m_pObjectShell->GetError() ? m_pData->m_pObjectShell->GetError() - : ERRCODE_IO_CANTWRITE; + ErrCode nErrCode = m_pData->m_pObjectShell->GetError() ? m_pData->m_pObjectShell->GetError() + : ERRCODE_IO_CANTWRITE; m_pData->m_pObjectShell->ResetError(); if ( bRet ) @@ -1559,8 +1559,8 @@ void SAL_CALL SfxBaseModel::storeSelf( const Sequence< beans::PropertyValue > SfxGetpApp()->NotifyEvent( SfxEventHint( SfxEventHintId::SaveDocFailed, GlobalEventConfig::GetEventName(GlobalEventId::SAVEDOCFAILED), m_pData->m_pObjectShell.get() ) ); throw task::ErrorCodeIOException( - "SfxBaseModel::storeSelf: 0x" + OUString::number(nErrCode, 16), - Reference< XInterface >(), nErrCode); + "SfxBaseModel::storeSelf: " + nErrCode.toHexString(), + Reference< XInterface >(), sal_uInt32(nErrCode)); } } @@ -1705,14 +1705,14 @@ void SAL_CALL SfxBaseModel::initNew() throw frame::DoubleInitializationException(); bool bRes = m_pData->m_pObjectShell->DoInitNew(); - sal_uInt32 nErrCode = m_pData->m_pObjectShell->GetError() ? - m_pData->m_pObjectShell->GetError() : ERRCODE_IO_CANTCREATE; + ErrCode nErrCode = m_pData->m_pObjectShell->GetError() ? + m_pData->m_pObjectShell->GetError() : ERRCODE_IO_CANTCREATE; m_pData->m_pObjectShell->ResetError(); if ( !bRes ) throw task::ErrorCodeIOException( - "SfxBaseModel::initNew: 0x" + OUString::number(nErrCode, 16), - Reference< XInterface >(), nErrCode); + "SfxBaseModel::initNew: " + nErrCode.toHexString(), + Reference< XInterface >(), sal_uInt32(nErrCode)); } } @@ -1760,7 +1760,7 @@ void SAL_CALL SfxBaseModel::load( const Sequence< beans::PropertyValue >& seqA SfxMedium* pMedium = new SfxMedium( seqArguments ); - sal_uInt32 nError = ERRCODE_NONE; + ErrCode nError = ERRCODE_NONE; OUString aFilterProvider = getFilterProvider(*pMedium); if (!aFilterProvider.isEmpty()) { @@ -2584,7 +2584,7 @@ void SfxBaseModel::loadCmisProperties( ) } } -SfxMedium* SfxBaseModel::handleLoadError( sal_uInt32 nError, SfxMedium* pMedium ) +SfxMedium* SfxBaseModel::handleLoadError( ErrCode nError, SfxMedium* pMedium ) { if (!nError) { @@ -2597,7 +2597,7 @@ SfxMedium* SfxBaseModel::handleLoadError( sal_uInt32 nError, SfxMedium* pMedium if( pSilentItem ) bSilent = pSilentItem->GetValue(); - bool bWarning = ((nError & ERRCODE_WARNING_MASK) == ERRCODE_WARNING_MASK); + bool bWarning = nError.IsWarning(); if ( nError != ERRCODE_IO_BROKENPACKAGE && !bSilent ) { // broken package was handled already @@ -2620,8 +2620,8 @@ SfxMedium* SfxBaseModel::handleLoadError( sal_uInt32 nError, SfxMedium* pMedium { nError = nError ? nError : ERRCODE_IO_CANTREAD; throw task::ErrorCodeIOException( - "SfxBaseModel::handleLoadError: 0x" + OUString::number(nError, 16), - Reference< XInterface >(), nError); + "SfxBaseModel::handleLoadError: 0x" + nError.toHexString(), + Reference< XInterface >(), sal_uInt32(nError)); } return pMedium; @@ -2902,7 +2902,7 @@ void SfxBaseModel::impl_store( const OUString& sURL else { // if the password is changed a special error should be used in case of shared document - throw task::ErrorCodeIOException("Can not change password for shared document.", uno::Reference< uno::XInterface >(), ERRCODE_SFX_SHARED_NOPASSWORDCHANGE ); + throw task::ErrorCodeIOException("Can not change password for shared document.", uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_SFX_SHARED_NOPASSWORDCHANGE) ); } } #endif @@ -2982,7 +2982,7 @@ void SfxBaseModel::impl_store( const OUString& sURL pItemSet.reset(); - sal_uInt32 nErrCode = m_pData->m_pObjectShell->GetErrorCode(); + ErrCode nErrCode = m_pData->m_pObjectShell->GetErrorCode(); if ( !bRet && !nErrCode ) { SAL_WARN("sfx.doc", "Storing has failed, no error is set!"); @@ -3001,7 +3001,7 @@ void SfxBaseModel::impl_store( const OUString& sURL SfxErrorContext aEc( ERRCTX_SFX_SAVEASDOC, m_pData->m_pObjectShell->GetTitle() ); task::ErrorCodeRequest aErrorCode; - aErrorCode.ErrCode = nErrCode; + aErrorCode.ErrCode = sal_uInt32(nErrCode); SfxMedium::CallApproveHandler( xHandler, makeAny( aErrorCode ), false ); } } @@ -3031,9 +3031,8 @@ void SfxBaseModel::impl_store( const OUString& sURL m_pData->m_pObjectShell.get() ) ); throw task::ErrorCodeIOException( - ("SfxBaseModel::impl_store <" + sURL + "> failed: 0x" - + OUString::number(nErrCode, 16)), - Reference< XInterface >(), nErrCode); + "SfxBaseModel::impl_store <" + sURL + "> failed: " + nErrCode.toHexString(), + Reference< XInterface >(), sal_uInt32(nErrCode)); } } } @@ -3610,11 +3609,11 @@ void SAL_CALL SfxBaseModel::loadFromStorage( const Reference< embed::XStorage >& // load document if ( !m_pData->m_pObjectShell->DoLoad(pMedium) ) { - sal_uInt32 nError = m_pData->m_pObjectShell->GetErrorCode(); + ErrCode nError = m_pData->m_pObjectShell->GetErrorCode(); nError = nError ? nError : ERRCODE_IO_CANTREAD; throw task::ErrorCodeIOException( - "SfxBaseModel::loadFromStorage: 0x" + OUString::number(nError, 16), - Reference< XInterface >(), nError); + "SfxBaseModel::loadFromStorage: " + nError.toHexString(), + Reference< XInterface >(), sal_uInt32(nError)); } loadCmisProperties( ); } @@ -3664,7 +3663,7 @@ void SAL_CALL SfxBaseModel::storeToStorage( const Reference< embed::XStorage >& } } - sal_uInt32 nError = m_pData->m_pObjectShell->GetErrorCode(); + ErrCode nError = m_pData->m_pObjectShell->GetErrorCode(); m_pData->m_pObjectShell->ResetError(); // the warnings are currently not transported @@ -3672,8 +3671,8 @@ void SAL_CALL SfxBaseModel::storeToStorage( const Reference< embed::XStorage >& { nError = nError ? nError : ERRCODE_IO_GENERAL; throw task::ErrorCodeIOException( - "SfxBaseModel::storeToStorage: 0x" + OUString::number(nError, 16), - Reference< XInterface >(), nError); + "SfxBaseModel::storeToStorage: " + nError.toHexString(), + Reference< XInterface >(), sal_uInt32(nError)); } } @@ -3689,12 +3688,11 @@ void SAL_CALL SfxBaseModel::switchToStorage( const Reference< embed::XStorage >& { if ( !m_pData->m_pObjectShell->SwitchPersistance( xStorage ) ) { - sal_uInt32 nError = m_pData->m_pObjectShell->GetErrorCode(); + ErrCode nError = m_pData->m_pObjectShell->GetErrorCode(); nError = nError ? nError : ERRCODE_IO_GENERAL; throw task::ErrorCodeIOException( - ("SfxBaseModel::switchToStorage: 0x" - + OUString::number(nError, 16)), - Reference< XInterface >(), nError); + "SfxBaseModel::switchToStorage: " + nError.toHexString(), + Reference< XInterface >(), sal_uInt32(nError)); } else { diff --git a/sfx2/source/inc/appopen.hxx b/sfx2/source/inc/appopen.hxx index eca47c903b27..a6f20e82938c 100644 --- a/sfx2/source/inc/appopen.hxx +++ b/sfx2/source/inc/appopen.hxx @@ -27,7 +27,7 @@ class SfxItemPool; class SfxMedium; class SfxObjectShell; -sal_uInt32 CheckPasswd_Impl( SfxObjectShell* pDoc, SfxMedium* pFile ); +ErrCode CheckPasswd_Impl( SfxObjectShell* pDoc, SfxMedium* pFile ); void SetTemplate_Impl( const OUString&, const OUString&, SfxObjectShell* ); diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index bdb5036ed060..4f7cec72dd64 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -96,7 +96,7 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess m_bConfigOptionsChecked:1; // whether or not the user options are checked after the Options dialog is closed. IndexBitSet aBitSet; - sal_uInt32 lErr; + ErrCode lErr; SfxEventHintId nEventId; // If Open/Create as to be sent // before Activate AutoReloadTimer_Impl *pReloadTimer; diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index 60a20a717040..126adb9b9ff7 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -848,7 +848,7 @@ ErrCode SfxInPlaceClient::DoVerb( long nVerb ) } catch( const task::ErrorCodeIOException& aErrorEx ) { - nError = (sal_uInt32)aErrorEx.ErrCode; + nError = ErrCode(aErrorEx.ErrCode); } catch( uno::Exception& ) { diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx index 8aafc348ecb7..7c2109cf6d3a 100644 --- a/starmath/source/mathmlexport.cxx +++ b/starmath/source/mathmlexport.cxx @@ -421,7 +421,7 @@ Math_XMLContentExporter_get_implementation(css::uno::XComponentContext* context, return cppu::acquire(new SmXMLExport(context, "com.sun.star.comp.Math.XMLContentExporter", SvXMLExportFlags::OASIS|SvXMLExportFlags::CONTENT)); } -sal_uInt32 SmXMLExport::exportDoc(enum XMLTokenEnum eClass) +ErrCode SmXMLExport::exportDoc(enum XMLTokenEnum eClass) { if ( !(getExportFlags() & SvXMLExportFlags::CONTENT) ) { diff --git a/starmath/source/mathmlexport.hxx b/starmath/source/mathmlexport.hxx index b0ebbe6d1aab..449f6c49763f 100644 --- a/starmath/source/mathmlexport.hxx +++ b/starmath/source/mathmlexport.hxx @@ -105,7 +105,7 @@ public: void ExportAutoStyles_() override {} void ExportMasterStyles_() override {} void ExportContent_() override; - sal_uInt32 exportDoc(enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID) override; + ErrCode exportDoc(enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID) override; virtual void GetViewSettings(css::uno::Sequence<css::beans::PropertyValue>& aProps) override; virtual void GetConfigurationSettings(css::uno::Sequence<css::beans::PropertyValue>& aProps) override; diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index c79d91295c98..093e72b3e690 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -96,9 +96,9 @@ SmNode* popOrZero(SmNodeStack& rStack) } -sal_uInt32 SmXMLImportWrapper::Import(SfxMedium &rMedium) +ErrCode SmXMLImportWrapper::Import(SfxMedium &rMedium) { - sal_uInt32 nError = ERRCODE_SFX_DOLOADFAILED; + ErrCode nError = ERRCODE_SFX_DOLOADFAILED; uno::Reference<uno::XComponentContext> xContext( comphelper::getProcessComponentContext() ); @@ -250,7 +250,7 @@ sal_uInt32 SmXMLImportWrapper::Import(SfxMedium &rMedium) /// read a component (file + filter version) -sal_uInt32 SmXMLImportWrapper::ReadThroughComponent( +ErrCode SmXMLImportWrapper::ReadThroughComponent( const Reference<io::XInputStream>& xInputStream, const Reference<XComponent>& xModelComponent, Reference<uno::XComponentContext> & rxContext, @@ -258,7 +258,7 @@ sal_uInt32 SmXMLImportWrapper::ReadThroughComponent( const sal_Char* pFilterName, bool bEncrypted ) { - sal_uInt32 nError = ERRCODE_SFX_DOLOADFAILED; + ErrCode nError = ERRCODE_SFX_DOLOADFAILED; OSL_ENSURE(xInputStream.is(), "input stream missing"); OSL_ENSURE(xModelComponent.is(), "document missing"); OSL_ENSURE(rxContext.is(), "factory missing"); @@ -346,7 +346,7 @@ sal_uInt32 SmXMLImportWrapper::ReadThroughComponent( } -sal_uInt32 SmXMLImportWrapper::ReadThroughComponent( +ErrCode SmXMLImportWrapper::ReadThroughComponent( const uno::Reference< embed::XStorage >& xStorage, const Reference<XComponent>& xModelComponent, const sal_Char* pStreamName, diff --git a/starmath/source/mathmlimport.hxx b/starmath/source/mathmlimport.hxx index 94036043123e..c1fc11fb9863 100644 --- a/starmath/source/mathmlimport.hxx +++ b/starmath/source/mathmlimport.hxx @@ -48,9 +48,9 @@ public: explicit SmXMLImportWrapper(css::uno::Reference<css::frame::XModel> &rRef) : xModel(rRef) {} - sal_uInt32 Import(SfxMedium &rMedium); + ErrCode Import(SfxMedium &rMedium); - static sal_uInt32 ReadThroughComponent( + static ErrCode ReadThroughComponent( const css::uno::Reference< css::io::XInputStream >& xInputStream, const css::uno::Reference< css::lang::XComponent >& xModelComponent, css::uno::Reference< css::uno::XComponentContext > & rxContext, @@ -58,7 +58,7 @@ public: const sal_Char* pFilterName, bool bEncrypted ); - static sal_uInt32 ReadThroughComponent( + static ErrCode ReadThroughComponent( const css::uno::Reference< css::embed::XStorage >& xStorage, const css::uno::Reference< css::lang::XComponent >& xModelComponent, const sal_Char* pStreamName, diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx index 57b75f475875..eb432c7ce2e7 100644 --- a/svtools/source/misc/ehdl.cxx +++ b/svtools/source/misc/ehdl.cxx @@ -139,7 +139,7 @@ static DialogMask aWndFunc( } -SfxErrorHandler::SfxErrorHandler(sal_uInt16 nIdP, sal_uLong lStartP, sal_uLong lEndP, ResMgr *pMgrP) : +SfxErrorHandler::SfxErrorHandler(sal_uInt16 nIdP, ErrCode lStartP, ErrCode lEndP, ResMgr *pMgrP) : lStart(lStartP), lEnd(lEndP), nId(nIdP), pMgr(pMgrP), pFreeMgr( nullptr ) @@ -167,7 +167,7 @@ bool SfxErrorHandler::CreateString(const ErrorInfo *pErr, OUString &rStr) const */ { - sal_uLong nErrCode = pErr->GetErrorCode() & ERRCODE_ERROR_MASK; + ErrCode nErrCode = pErr->GetErrorCode().IgnoreWarning(); if( nErrCode>=lEnd || nErrCode<=lStart ) return false; if(GetErrorString(nErrCode, rStr)) @@ -213,7 +213,7 @@ void SfxErrorHandler::GetClassString(sal_uLong lClassId, OUString &rStr) } } -bool SfxErrorHandler::GetErrorString(sal_uLong lErrId, OUString &rStr) const +bool SfxErrorHandler::GetErrorString(ErrCode lErrId, OUString &rStr) const /* [Description] @@ -229,7 +229,7 @@ bool SfxErrorHandler::GetErrorString(sal_uLong lErrId, OUString &rStr) const rStr = RID_ERRHDL_CLASS; ResStringArray aEr(ResId(nId, *pMgr)); - sal_uInt32 nErrIdx = aEr.FindIndex((sal_uInt16)lErrId); + sal_uInt32 nErrIdx = aEr.FindIndex((sal_uInt16)(sal_uInt32)lErrId); if (nErrIdx != RESARRAY_INDEX_NOTFOUND) { rStr = rStr.replaceAll("$(ERROR)", aEr.GetString(nErrIdx)); @@ -241,7 +241,7 @@ bool SfxErrorHandler::GetErrorString(sal_uLong lErrId, OUString &rStr) const if( bRet ) { OUString aErrStr; - GetClassString(lErrId & ERRCODE_CLASS_MASK, + GetClassString((sal_uInt32)lErrId & ERRCODE_CLASS_MASK, aErrStr); if(!aErrStr.isEmpty()) aErrStr += ".\n"; @@ -271,7 +271,7 @@ SfxErrorContext::SfxErrorContext( } -bool SfxErrorContext::GetString(sal_uInt32 nErrId, OUString &rStr) +bool SfxErrorContext::GetString(ErrCode nErrId, OUString &rStr) /* [Description] @@ -305,7 +305,7 @@ bool SfxErrorContext::GetString(sal_uInt32 nErrId, OUString &rStr) if ( bRet ) { - sal_uInt16 nId = ( nErrId & ERRCODE_WARNING_MASK ) ? ERRCTX_WARNING : ERRCTX_ERROR; + sal_uInt16 nId = nErrId.IsWarning() ? ERRCTX_WARNING : ERRCTX_ERROR; ResStringArray aEr(ResId(RID_ERRCTX, *pMgr)); rStr = rStr.replaceAll("$(ERR)", aEr.GetString(nId)); } diff --git a/svx/qa/unit/xoutdev.cxx b/svx/qa/unit/xoutdev.cxx index a680bd4ebac2..2cc088609104 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>(ERRCODE_NONE), GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, aURL, aStream)); + CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, aURL, aStream)); // Export it. utl::TempFile aTempFile; diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx index 6c6cb6467bf9..e64dd30470d9 100644 --- a/svx/source/dialog/imapdlg.cxx +++ b/svx/source/dialog/imapdlg.cxx @@ -475,7 +475,7 @@ void SvxIMapDlg::DoOpen() if( pIStm->GetError() ) { - SfxErrorContext eEC(ERRCODE_SFX_GENERAL,this); + SfxErrorContext eEC(ERRCTX_ERROR, this); ErrorHandler::HandleError( ERRCODE_IO_GENERAL ); } else diff --git a/svx/source/items/svxerr.cxx b/svx/source/items/svxerr.cxx index fff31650fb4b..308f70ae5f9b 100644 --- a/svx/source/items/svxerr.cxx +++ b/svx/source/items/svxerr.cxx @@ -26,7 +26,7 @@ SvxErrorHandler::SvxErrorHandler() : SfxErrorHandler( - RID_SVXERRCODE, ERRCODE_AREA_SVX, ERRCODE_AREA_SVX_END, &DIALOG_MGR() ) + RID_SVXERRCODE, ErrCode(ERRCODE_AREA_SVX), ErrCode(ERRCODE_AREA_SVX_END), &DIALOG_MGR() ) { } diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx index e82242591617..065b656cdb5a 100644 --- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx +++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx @@ -204,7 +204,7 @@ IMPL_LINK_NOARG(AreaPropertyPanelBase, ClickImportBitmapHdl, Button*, void) { Graphic aGraphic; EnterWait(); - int nError = aDlg.GetGraphic( aGraphic ); + ErrCode nError = aDlg.GetGraphic( aGraphic ); LeaveWait(); if( nError == ERRCODE_NONE ) { diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index c0bf4332cbbe..41ba358aefb1 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -1058,7 +1058,7 @@ sal_Bool SAL_CALL GraphicExporter::filter( const Sequence< PropertyValue >& aDes lContinuations[0].set(static_cast< XInteractionContinuation* >(pApprove), UNO_QUERY); GraphicFilterRequest aErrorCode; - aErrorCode.ErrCode = nStatus; + aErrorCode.ErrCode = sal_uInt32(nStatus); aInteraction <<= aErrorCode; aSettings.mxInteractionHandler->handle( framework::InteractionRequest::CreateRequest( aInteraction, lContinuations ) ); } diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx index 07619419abfe..a611baff4bf8 100644 --- a/svx/source/xoutdev/_xoutbmp.cxx +++ b/svx/source/xoutdev/_xoutbmp.cxx @@ -375,7 +375,7 @@ bool XOutBitmap::GraphicToBase64(const Graphic& rGraphic, OUString& rOUString) aMimeType = "image/png"; break; } - sal_uLong nErr = GraphicConverter::Export(aOStm,rGraphic,aCvtType); + ErrCode nErr = GraphicConverter::Export(aOStm,rGraphic,aCvtType); if ( nErr ) { SAL_WARN("svx", "XOutBitmap::GraphicToBase64() invalid Graphic? error: " << nErr ); diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx index 801ef8324840..60b25f9c2918 100644 --- a/sw/inc/docsh.hxx +++ b/sw/inc/docsh.hxx @@ -277,8 +277,8 @@ public: void ToggleLayoutMode(SwView* pView); - sal_uLong LoadStylesFromFile( const OUString& rURL, SwgReaderOption& rOpt, - bool bUnoCall ); + ErrCode LoadStylesFromFile( const OUString& rURL, SwgReaderOption& rOpt, + bool bUnoCall ); void InvalidateModel(); void ReactivateModel(); diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx index a84c73c568fd..0a48eabafb61 100644 --- a/sw/inc/shellio.hxx +++ b/sw/inc/shellio.hxx @@ -162,7 +162,7 @@ public: SwReader( const css::uno::Reference < css::embed::XStorage >&, const OUString& rFilename, SwPaM& ); // The only export interface is SwReader::Read(...)!!! - sal_uLong Read( const Reader& ); + ErrCode Read( const Reader& ); // Ask for glossaries. bool HasGlossaries( const Reader& ); @@ -257,7 +257,7 @@ public: void setSotStorageRef(const tools::SvRef<SotStorage>& pStgRef) { pStg = pStgRef; }; private: - virtual sal_uLong Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &)=0; + virtual ErrCode Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &)=0; // Everyone who does not need the streams / storages open // has to override the method (W4W!!). @@ -267,7 +267,7 @@ private: class AsciiReader: public Reader { friend class SwReader; - virtual sal_uLong Read( SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) override; + virtual ErrCode Read( SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) override; public: AsciiReader(): Reader() {} }; @@ -290,7 +290,7 @@ class SwImpBlocks; class SW_DLLPUBLIC SwTextBlocks { std::unique_ptr<SwImpBlocks> pImp; - sal_uLong nErr; + ErrCode nErr; public: SwTextBlocks( const OUString& ); @@ -300,7 +300,7 @@ public: void ClearDoc(); // Delete Doc-contents. OUString GetName(); void SetName( const OUString& ); - sal_uLong GetError() const { return nErr; } + ErrCode GetError() const { return nErr; } OUString GetBaseURL() const; void SetBaseURL( const OUString& rURL ); @@ -315,7 +315,7 @@ public: bool Delete( sal_uInt16 ); void Rename( sal_uInt16, const OUString*, const OUString* ); - sal_uLong CopyBlock( SwTextBlocks& rSource, OUString& rSrcShort, + ErrCode CopyBlock( SwTextBlocks& rSource, OUString& rSrcShort, const OUString& rLong ); bool BeginGetDoc( sal_uInt16 ); // Read text modules. @@ -379,7 +379,7 @@ protected: void PutNumFormatFontsInAttrPool(); void PutEditEngFontsInAttrPool(); - virtual sal_uLong WriteStream() = 0; + virtual ErrCode WriteStream() = 0; void SetBaseURL( const OUString& rURL ) { sBaseURL = rURL; } IDocumentSettingAccess& getIDocumentSettingAccess(); @@ -407,10 +407,10 @@ public: Writer(); virtual ~Writer() override; - virtual sal_uLong Write( SwPaM&, SfxMedium&, const OUString* ); - sal_uLong Write( SwPaM&, SvStream&, const OUString* ); - virtual sal_uLong Write( SwPaM&, const css::uno::Reference < css::embed::XStorage >&, const OUString*, SfxMedium* = nullptr ); - virtual sal_uLong Write( SwPaM&, SotStorage&, const OUString* ); + virtual ErrCode Write( SwPaM&, SfxMedium&, const OUString* ); + ErrCode Write( SwPaM&, SvStream&, const OUString* ); + virtual ErrCode Write( SwPaM&, const css::uno::Reference < css::embed::XStorage >&, const OUString*, SfxMedium* = nullptr ); + virtual ErrCode Write( SwPaM&, SotStorage&, const OUString* ); virtual void SetupFilterOptions(SfxMedium& rMedium); @@ -464,9 +464,9 @@ protected: css::uno::Reference < css::embed::XStorage > xStg; // Create error at call. - virtual sal_uLong WriteStream() override; - virtual sal_uLong WriteStorage() = 0; - virtual sal_uLong WriteMedium( SfxMedium& ) = 0; + virtual ErrCode WriteStream() override; + virtual ErrCode WriteStorage() = 0; + virtual ErrCode WriteMedium( SfxMedium& ) = 0; using Writer::Write; @@ -475,8 +475,8 @@ public: virtual bool IsStgWriter() const override; - virtual sal_uLong Write( SwPaM&, const css::uno::Reference < css::embed::XStorage >&, const OUString*, SfxMedium* = nullptr ) override; - virtual sal_uLong Write( SwPaM&, SotStorage&, const OUString* ) override; + virtual ErrCode Write( SwPaM&, const css::uno::Reference < css::embed::XStorage >&, const OUString*, SfxMedium* = nullptr ) override; + virtual ErrCode Write( SwPaM&, SotStorage&, const OUString* ) override; SotStorage& GetStorage() const { return *pStg; } }; @@ -497,7 +497,7 @@ class SW_DLLPUBLIC SwWriter bool bWriteAll; public: - sal_uLong Write( WriterRef& rxWriter, const OUString* = nullptr); + ErrCode Write( WriterRef& rxWriter, const OUString* = nullptr); SwWriter( SvStream&, SwCursorShell &, bool bWriteAll = false ); SwWriter( SvStream&, SwDoc & ); @@ -511,8 +511,8 @@ public: typedef Reader* (*FnGetReader)(); typedef void (*FnGetWriter)(const OUString&, const OUString& rBaseURL, WriterRef&); -sal_uLong SaveOrDelMSVBAStorage( SfxObjectShell&, SotStorage&, bool, const OUString& ); -sal_uLong GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS ); +ErrCode SaveOrDelMSVBAStorage( SfxObjectShell&, SotStorage&, bool, const OUString& ); +ErrCode GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS ); struct SwReaderWriterEntry { diff --git a/sw/inc/swerror.h b/sw/inc/swerror.h index a49663312051..4ecd4ac21f56 100644 --- a/sw/inc/swerror.h +++ b/sw/inc/swerror.h @@ -22,9 +22,8 @@ #include <vcl/errcode.hxx> -#define ERROR_SW_BASE (ERRCODE_AREA_SW) -#define ERROR_SW_READ_BASE (ERROR_SW_BASE | ERRCODE_CLASS_READ) -#define ERROR_SW_WRITE_BASE (ERROR_SW_BASE | ERRCODE_CLASS_WRITE) +#define ERROR_SW_READ_BASE (ERRCODE_AREA_SW | ERRCODE_CLASS_READ) +#define ERROR_SW_WRITE_BASE (ERRCODE_AREA_SW | ERRCODE_CLASS_WRITE) #define WARN_SW_BASE (ERRCODE_AREA_SW | ERRCODE_WARNING_MASK) #define WARN_SW_READ_BASE (WARN_SW_BASE | ERRCODE_CLASS_READ ) @@ -32,65 +31,56 @@ // Import Errors -#define ERR_SWG_FILE_FORMAT_ERROR (ERROR_SW_READ_BASE | 1 ) -#define ERR_SWG_READ_ERROR (ERROR_SW_READ_BASE | 2 ) +#define ERR_SWG_FILE_FORMAT_ERROR ErrCode(ERROR_SW_READ_BASE | 1 ) +#define ERR_SWG_READ_ERROR ErrCode(ERROR_SW_READ_BASE | 2 ) -#define ERR_SW6_INPUT_FILE (ERROR_SW_READ_BASE | 4 ) -#define ERR_SW6_NOWRITER_FILE (ERROR_SW_READ_BASE | 5 ) -#define ERR_SW6_UNEXPECTED_EOF (ERROR_SW_READ_BASE | 6 ) -#define ERR_SW6_PASSWD (ERROR_SW_READ_BASE | 7 ) +#define ERR_SW6_INPUT_FILE ErrCode(ERROR_SW_READ_BASE | 4 ) +#define ERR_SW6_NOWRITER_FILE ErrCode(ERROR_SW_READ_BASE | 5 ) +#define ERR_SW6_UNEXPECTED_EOF ErrCode(ERROR_SW_READ_BASE | 6 ) +#define ERR_SW6_PASSWD ErrCode(ERROR_SW_READ_BASE | 7 ) -#define ERR_WW6_NO_WW6_FILE_ERR (ERROR_SW_READ_BASE | 8 ) -#define ERR_WW6_FASTSAVE_ERR (ERROR_SW_READ_BASE | 9 ) +#define ERR_WW6_NO_WW6_FILE_ERR ErrCode(ERROR_SW_READ_BASE | 8 ) +#define ERR_WW6_FASTSAVE_ERR ErrCode(ERROR_SW_READ_BASE | 9 ) -#define ERR_FORMAT_ROWCOL (ERROR_SW_READ_BASE | 12) +#define ERR_FORMAT_ROWCOL ErrCode(ERROR_SW_READ_BASE | 12) -#define ERR_SWG_NEW_VERSION (ERROR_SW_READ_BASE | 13) -#define ERR_WW8_NO_WW8_FILE_ERR (ERROR_SW_READ_BASE | 14) +#define ERR_SWG_NEW_VERSION ErrCode(ERROR_SW_READ_BASE | 13) +#define ERR_WW8_NO_WW8_FILE_ERR ErrCode(ERROR_SW_READ_BASE | 14) -#define ERR_FORMAT_FILE_ROWCOL (ERROR_SW_READ_BASE | 15) +#define ERR_FORMAT_FILE_ROWCOL ErrCode(ERROR_SW_READ_BASE | 15) // Export errors -#define ERR_SWG_WRITE_ERROR (ERROR_SW_WRITE_BASE | 30 ) -#define ERR_SWG_OLD_GLOSSARY (ERROR_SW_WRITE_BASE | 31 ) -#define ERR_WRITE_ERROR_FILE (ERROR_SW_WRITE_BASE | 35 ) +#define ERR_SWG_WRITE_ERROR ErrCode(ERROR_SW_WRITE_BASE | 30 ) +#define ERR_SWG_OLD_GLOSSARY ErrCode(ERROR_SW_WRITE_BASE | 31 ) +#define ERR_WRITE_ERROR_FILE ErrCode(ERROR_SW_WRITE_BASE | 35 ) // Import/Export errors -#define ERR_SWG_INTERNAL_ERROR (ERROR_SW_BASE | 50 ) +#define ERR_SWG_INTERNAL_ERROR ErrCode(ERRCODE_AREA_SW | 50 ) -#define ERR_TXTBLOCK_NEWFILE_ERROR (ERROR_SW_BASE|ERRCODE_CLASS_LOCKING | 55 ) +#define ERR_TXTBLOCK_NEWFILE_ERROR ErrCode(ERRCODE_AREA_SW|ERRCODE_CLASS_LOCKING | 55 ) // other errors and errorclasses -#define ERR_AUTOPATH_ERROR (ERROR_SW_BASE|ERRCODE_CLASS_PATH | 55 ) -#define ERR_TBLSPLIT_ERROR (ERROR_SW_BASE|ERRCODE_CLASS_NONE| 56 ) -#define ERR_TBLINSCOL_ERROR (ERROR_SW_BASE|ERRCODE_CLASS_NONE| 57 ) -#define ERR_TBLDDECHG_ERROR (ERROR_SW_BASE|ERRCODE_CLASS_NONE| 58 ) +#define ERR_AUTOPATH_ERROR ErrCode(ERRCODE_AREA_SW|ERRCODE_CLASS_PATH | 55 ) +#define ERR_TBLSPLIT_ERROR ErrCode(ERRCODE_AREA_SW|ERRCODE_CLASS_NONE| 56 ) +#define ERR_TBLINSCOL_ERROR ErrCode(ERRCODE_AREA_SW|ERRCODE_CLASS_NONE| 57 ) +#define ERR_TBLDDECHG_ERROR ErrCode(ERRCODE_AREA_SW|ERRCODE_CLASS_NONE| 58 ) // Import - Warnings -#define WARN_SWG_NO_DRAWINGS (WARN_SW_READ_BASE | 70 ) -#define WARN_WW6_FASTSAVE_ERR (WARN_SW_READ_BASE | 71 ) +#define WARN_SWG_NO_DRAWINGS ErrCode(WARN_SW_READ_BASE | 70 ) +#define WARN_WW6_FASTSAVE_ERR ErrCode(WARN_SW_READ_BASE | 71 ) // continued below // Import & Export - Warnings -#define WARN_SWG_FEATURES_LOST (WARN_SW_BASE | 72 ) -#define WARN_SWG_OLE (WARN_SW_BASE | 73 ) +#define WARN_SWG_FEATURES_LOST ErrCode(WARN_SW_BASE | 72 ) +#define WARN_SWG_OLE ErrCode(WARN_SW_BASE | 73 ) #define WARN_SWG_POOR_LOAD (WARN_SW_BASE | 74 ) // Export warnings -#define WARN_SWG_HTML_NO_MACROS (WARN_SW_WRITE_BASE |75) -#define WARN_WRITE_ERROR_FILE (WARN_SW_WRITE_BASE |76) +#define WARN_SWG_HTML_NO_MACROS ErrCode(WARN_SW_WRITE_BASE |75) +#define WARN_WRITE_ERROR_FILE ErrCode(WARN_SW_WRITE_BASE |76) // More Import & Export - Warnings -#define WARN_FORMAT_FILE_ROWCOL (WARN_SW_READ_BASE | 77) - -#ifndef __RSC - -inline bool IsError( sal_uLong nErr ) -{ - return nErr && 0 == ( ERRCODE_WARNING_MASK & nErr ); -} - -#endif +#define WARN_FORMAT_FILE_ROWCOL ErrCode(WARN_SW_READ_BASE | 77) #endif diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 4654c2b0d968..0bd0ba789c19 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -749,7 +749,7 @@ void SwUiWriterTest::testImportRTF() SwReader aReader(aStream, OUString(), OUString(), *pWrtShell->GetCursor()); Reader* pRTFReader = SwReaderWriter::GetRtfReader(); CPPUNIT_ASSERT(pRTFReader != nullptr); - CPPUNIT_ASSERT_EQUAL(sal_uLong(0), aReader.Read(*pRTFReader)); + CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, aReader.Read(*pRTFReader)); sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); CPPUNIT_ASSERT_EQUAL(OUString("fooHello world!"), pDoc->GetNodes()[nIndex - 1]->GetTextNode()->GetText()); @@ -1992,7 +1992,7 @@ void SwUiWriterTest::testTdf78742() SfxMedium aMedium(path, StreamMode::READ | StreamMode::SHARE_DENYWRITE); SfxFilterMatcher aMatcher("com.sun.star.text.TextDocument"); std::shared_ptr<const SfxFilter> pFilter; - sal_uInt32 filter = aMatcher.DetectFilter(aMedium, pFilter); + ErrCode filter = aMatcher.DetectFilter(aMedium, pFilter); CPPUNIT_ASSERT_EQUAL(ERRCODE_IO_ABORT, filter); //it should not return any Filter CPPUNIT_ASSERT(!pFilter); @@ -2000,8 +2000,8 @@ void SwUiWriterTest::testTdf78742() SfxMedium aMedium2(path, StreamMode::READ | StreamMode::SHARE_DENYWRITE); SfxFilterMatcher aMatcher2; std::shared_ptr<const SfxFilter> pFilter2; - sal_uInt32 filter2 = aMatcher2.DetectFilter(aMedium2, pFilter2); - CPPUNIT_ASSERT_EQUAL(ERRCODE_CLASS_NONE, filter2); + ErrCode filter2 = aMatcher2.DetectFilter(aMedium2, pFilter2); + CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, filter2); //Filter should be returned with proper Name CPPUNIT_ASSERT_EQUAL(OUString("calc8"), pFilter2->GetFilterName()); //testing with service type and any .odt file @@ -2009,8 +2009,8 @@ void SwUiWriterTest::testTdf78742() SfxMedium aMedium3(path2, StreamMode::READ | StreamMode::SHARE_DENYWRITE); SfxFilterMatcher aMatcher3("com.sun.star.text.TextDocument"); std::shared_ptr<const SfxFilter> pFilter3; - sal_uInt32 filter3 = aMatcher3.DetectFilter(aMedium3, pFilter3); - CPPUNIT_ASSERT_EQUAL(ERRCODE_CLASS_NONE, filter3); + ErrCode filter3 = aMatcher3.DetectFilter(aMedium3, pFilter3); + CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, filter3); //Filter should be returned with proper Name CPPUNIT_ASSERT_EQUAL(OUString("writer8"), pFilter3->GetFilterName()); } diff --git a/sw/source/core/doc/swserv.cxx b/sw/source/core/doc/swserv.cxx index 9c7432dbebaa..f18d00453a65 100644 --- a/sw/source/core/doc/swserv.cxx +++ b/sw/source/core/doc/swserv.cxx @@ -92,7 +92,7 @@ bool SwServerObject::GetData( uno::Any & rData, // Create stream SvMemoryStream aMemStm( 65535, 65535 ); SwWriter aWrt( aMemStm, *pPam, false ); - if( !IsError( aWrt.Write( xWrt )) ) + if( !aWrt.Write( xWrt ).IsError() ) { aMemStm.WriteChar( '\0' ); // append a zero char rData <<= uno::Sequence< sal_Int8 >( diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 79e181f6770f..b074a6a38bf1 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -1408,7 +1408,7 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd ) // TODO/MBA: it's impossible to set a BaseURL here! SwReader aTmpReader( aStrm, OUString(), pDoc->GetDocShell()->GetMedium()->GetBaseURL(), *pPam ); - if( !IsError( aTmpReader.Read( *pRead ) )) + if( ! aTmpReader.Read( *pRead ).IsError() ) { rSection.SetConnectFlag(); } diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx index 3dd2d8cfaca0..7c49f728d3d6 100644 --- a/sw/source/core/edit/edglss.cxx +++ b/sw/source/core/edit/edglss.cxx @@ -305,7 +305,7 @@ bool SwEditShell::GetSelectedText( OUString &rBuf, int nHndlParaBrk ) xWrt->SetAsciiOptions( aAsciiOpt ); xWrt->bUCS2_WithStartChar = false; - if (!IsError(aWriter.Write(xWrt))) + if ( ! aWriter.Write(xWrt).IsError() ) { aStream.WriteUInt16( '\0' ); diff --git a/sw/source/core/inc/SwXMLBlockExport.hxx b/sw/source/core/inc/SwXMLBlockExport.hxx index 5d7f8a1ab0c6..7e9e74a17736 100644 --- a/sw/source/core/inc/SwXMLBlockExport.hxx +++ b/sw/source/core/inc/SwXMLBlockExport.hxx @@ -36,7 +36,7 @@ public: const OUString &rFileName, css::uno::Reference< css::xml::sax::XDocumentHandler> &rHandler); - sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ) override; + ErrCode exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ) override; void ExportAutoStyles_() override {} void ExportMasterStyles_ () override {} void ExportContent_() override {} @@ -54,7 +54,7 @@ public: const OUString &rFileName, css::uno::Reference< css::xml::sax::XDocumentHandler> &rHandler); - sal_uInt32 exportDoc(enum ::xmloff::token::XMLTokenEnum /*eClass*/) override {return 0;} + ErrCode exportDoc(enum ::xmloff::token::XMLTokenEnum /*eClass*/) override { return ERRCODE_NONE; } void exportDoc(const OUString & rText); void ExportAutoStyles_() override {} void ExportMasterStyles_ () override {} diff --git a/sw/source/core/inc/SwXMLTextBlocks.hxx b/sw/source/core/inc/SwXMLTextBlocks.hxx index 67e571142e05..e4305c071c20 100644 --- a/sw/source/core/inc/SwXMLTextBlocks.hxx +++ b/sw/source/core/inc/SwXMLTextBlocks.hxx @@ -59,41 +59,41 @@ public: virtual void AddName( const OUString&, const OUString&, bool bOnlyText = false ) override; static OUString GeneratePackageName ( const OUString& rShort ); virtual ~SwXMLTextBlocks() override; - virtual sal_uLong Delete( sal_uInt16 ) override; - virtual sal_uLong Rename( sal_uInt16, const OUString&, const OUString& ) override; - virtual sal_uLong CopyBlock( SwImpBlocks& rImp, OUString& rShort, const OUString& rLong) override; + virtual ErrCode Delete( sal_uInt16 ) override; + virtual ErrCode Rename( sal_uInt16, const OUString&, const OUString& ) override; + virtual ErrCode CopyBlock( SwImpBlocks& rImp, OUString& rShort, const OUString& rLong) override; virtual void ClearDoc() override; - virtual sal_uLong GetDoc( sal_uInt16 ) override; - virtual sal_uLong BeginPutDoc( const OUString&, const OUString& ) override; - virtual sal_uLong PutDoc() override; - virtual sal_uLong PutText( const OUString&, const OUString&, const OUString& ) override; - virtual sal_uLong MakeBlockList() override; + virtual ErrCode GetDoc( sal_uInt16 ) override; + virtual ErrCode BeginPutDoc( const OUString&, const OUString& ) override; + virtual ErrCode PutDoc() override; + virtual ErrCode PutText( const OUString&, const OUString&, const OUString& ) override; + virtual ErrCode MakeBlockList() override; virtual FileType GetFileType() const override; - virtual sal_uLong OpenFile( bool bReadOnly = true ) override; + virtual ErrCode OpenFile( bool bReadOnly = true ) override; virtual void CloseFile() override; static bool IsFileUCBStorage( const OUString & rFileName); // Methods for the new Autocorrecter - sal_uLong GetText( const OUString& rShort, OUString& ); + ErrCode GetText( const OUString& rShort, OUString& ); virtual bool IsOnlyTextBlock( const OUString& rShort ) const override; bool IsOnlyTextBlock( sal_uInt16 nIdx ) const; void SetIsTextOnly( const OUString& rShort, bool bNewValue ); - virtual sal_uLong GetMacroTable( sal_uInt16, SvxMacroTableDtor& rMacroTable ) override; - virtual sal_uLong SetMacroTable( sal_uInt16 nIdx, + virtual ErrCode GetMacroTable( sal_uInt16, SvxMacroTableDtor& rMacroTable ) override; + virtual ErrCode SetMacroTable( sal_uInt16 nIdx, const SvxMacroTableDtor& rMacroTable ) override; virtual bool PutMuchEntries( bool bOn ) override; public: SwDoc* GetDoc() const { return m_pDoc; } //void SetDoc( SwDoc * pNewDoc); - sal_uLong StartPutBlock( const OUString& rShort, const OUString& rPackageName ); - sal_uLong PutBlock(); - sal_uLong GetBlockText( const OUString& rShort, OUString& rText ); - sal_uLong PutBlockText( const OUString& rShort, const OUString& rText, const OUString& rPackageName ); + ErrCode StartPutBlock( const OUString& rShort, const OUString& rPackageName ); + ErrCode PutBlock(); + ErrCode GetBlockText( const OUString& rShort, OUString& rText ); + ErrCode PutBlockText( const OUString& rShort, const OUString& rText, const OUString& rPackageName ); void MakeBlockText( const OUString& rText ); }; diff --git a/sw/source/core/inc/swblocks.hxx b/sw/source/core/inc/swblocks.hxx index a75e0bbac6fc..d0eaa4ab9670 100644 --- a/sw/source/core/inc/swblocks.hxx +++ b/sw/source/core/inc/swblocks.hxx @@ -103,22 +103,22 @@ public: const OUString& GetBaseURL() const { return m_sBaseURL;} void SetBaseURL( const OUString& rURL ) { m_sBaseURL = rURL; } - virtual sal_uLong Delete( sal_uInt16 ) = 0; - virtual sal_uLong Rename( sal_uInt16, const OUString&, const OUString& ) = 0; - virtual sal_uLong CopyBlock( SwImpBlocks& rImp, OUString& rShort, const OUString& rLong) = 0; - virtual sal_uLong GetDoc( sal_uInt16 ) = 0; - virtual sal_uLong BeginPutDoc( const OUString&, const OUString& ) = 0; - virtual sal_uLong PutDoc() = 0; - virtual sal_uLong PutText( const OUString&, const OUString&, const OUString& ) = 0; - virtual sal_uLong MakeBlockList() = 0; - - virtual sal_uLong OpenFile( bool bReadOnly = true ) = 0; + virtual ErrCode Delete( sal_uInt16 ) = 0; + virtual ErrCode Rename( sal_uInt16, const OUString&, const OUString& ) = 0; + virtual ErrCode CopyBlock( SwImpBlocks& rImp, OUString& rShort, const OUString& rLong) = 0; + virtual ErrCode GetDoc( sal_uInt16 ) = 0; + virtual ErrCode BeginPutDoc( const OUString&, const OUString& ) = 0; + virtual ErrCode PutDoc() = 0; + virtual ErrCode PutText( const OUString&, const OUString&, const OUString& ) = 0; + virtual ErrCode MakeBlockList() = 0; + + virtual ErrCode OpenFile( bool bReadOnly = true ) = 0; virtual void CloseFile() = 0; virtual bool IsOnlyTextBlock( const OUString& rShort ) const; - virtual sal_uLong GetMacroTable( sal_uInt16 nIdx, SvxMacroTableDtor& rMacroTable ); - virtual sal_uLong SetMacroTable( sal_uInt16 nIdx, + virtual ErrCode GetMacroTable( sal_uInt16 nIdx, SvxMacroTableDtor& rMacroTable ); + virtual ErrCode SetMacroTable( sal_uInt16 nIdx, const SvxMacroTableDtor& rMacroTable ); virtual bool PutMuchEntries( bool bOn ); }; diff --git a/sw/source/core/sw3io/swacorr.cxx b/sw/source/core/sw3io/swacorr.cxx index 7299193b1800..6f90feee716d 100644 --- a/sw/source/core/sw3io/swacorr.cxx +++ b/sw/source/core/sw3io/swacorr.cxx @@ -36,10 +36,10 @@ using namespace ::com::sun::star; */ bool SwAutoCorrect::GetLongText( const OUString& rShort, OUString& rLong ) { - sal_uLong nRet = 0; + ErrCode nRet = ERRCODE_NONE; assert( m_pTextBlocks ); nRet = m_pTextBlocks->GetText( rShort, rLong ); - return !IsError( nRet ) && !rLong.isEmpty(); + return !nRet.IsError() && !rLong.isEmpty(); } void SwAutoCorrect::refreshBlockList( const uno::Reference< embed::XStorage >& rStg ) @@ -69,22 +69,22 @@ bool SwAutoCorrect::PutText( const uno::Reference < embed::XStorage >& rStg, return false; SwDocShell& rDShell = static_cast<SwDocShell&>(rObjSh); - sal_uLong nRet = 0; + ErrCode nRet = ERRCODE_NONE; // mba: relative URLs don't make sense here SwXMLTextBlocks aBlk( rStg, rFileName ); SwDoc* pDoc = aBlk.GetDoc(); nRet = aBlk.BeginPutDoc( rShort, rShort ); - if( !IsError( nRet ) ) + if( ! nRet.IsError() ) { rDShell.GetEditShell()->CopySelToDoc( pDoc ); nRet = aBlk.PutDoc(); aBlk.AddName ( rShort, rShort ); - if( !IsError( nRet ) ) + if( ! nRet.IsError() ) nRet = aBlk.GetText( rShort, rLong ); } - return !IsError( nRet ); + return ! nRet.IsError(); } SwAutoCorrect::SwAutoCorrect( const SvxAutoCorrect& rACorr ) diff --git a/sw/source/core/swg/SwXMLBlockExport.cxx b/sw/source/core/swg/SwXMLBlockExport.cxx index 6e62df74ff55..43dc87b634a9 100644 --- a/sw/source/core/swg/SwXMLBlockExport.cxx +++ b/sw/source/core/swg/SwXMLBlockExport.cxx @@ -39,7 +39,7 @@ SwXMLBlockListExport::SwXMLBlockListExport( XML_NAMESPACE_BLOCKLIST ); } -sal_uInt32 SwXMLBlockListExport::exportDoc(enum XMLTokenEnum ) +ErrCode SwXMLBlockListExport::exportDoc(enum XMLTokenEnum ) { GetDocHandler()->startDocument(); diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx index 231fe15e9ded..500a3eac3c8b 100644 --- a/sw/source/core/swg/SwXMLTextBlocks.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks.cxx @@ -161,7 +161,7 @@ void SwXMLTextBlocks::AddName( const OUString& rShort, const OUString& rLong, m_bInfoChanged = true; } -sal_uLong SwXMLTextBlocks::Delete( sal_uInt16 n ) +ErrCode SwXMLTextBlocks::Delete( sal_uInt16 n ) { const OUString aPckName (m_aNames[n]->aPackageName); uno::Reference < container::XNameAccess > xAccess( xBlkRoot, uno::UNO_QUERY ); @@ -174,21 +174,21 @@ sal_uLong SwXMLTextBlocks::Delete( sal_uInt16 n ) uno::Reference < embed::XTransactedObject > xTrans( xBlkRoot, uno::UNO_QUERY ); if ( xTrans.is() ) xTrans->commit(); - return 0; + return ERRCODE_NONE; } catch (const uno::Exception&) { return ERR_SWG_WRITE_ERROR; } } - return 0; + return ERRCODE_NONE; } -sal_uLong SwXMLTextBlocks::Rename( sal_uInt16 nIdx, const OUString& rNewShort, const OUString& ) +ErrCode SwXMLTextBlocks::Rename( sal_uInt16 nIdx, const OUString& rNewShort, const OUString& ) { OSL_ENSURE( xBlkRoot.is(), "No storage set" ); if(!xBlkRoot.is()) - return 0; + return ERRCODE_NONE; OUString aOldName (m_aNames[nIdx]->aPackageName); m_aShort = rNewShort; aPackageName = GeneratePackageName( m_aShort ); @@ -230,13 +230,13 @@ sal_uLong SwXMLTextBlocks::Rename( sal_uInt16 nIdx, const OUString& rNewShort, c xTrans->commit(); // No need to commit xBlkRoot here as SwTextBlocks::Rename calls // WriteInfo which does the commit - return 0; + return ERRCODE_NONE; } -sal_uLong SwXMLTextBlocks::CopyBlock( SwImpBlocks& rDestImp, OUString& rShort, +ErrCode SwXMLTextBlocks::CopyBlock( SwImpBlocks& rDestImp, OUString& rShort, const OUString& rLong) { - sal_uLong nError = 0; + ErrCode nError = ERRCODE_NONE; OpenFile(); rDestImp.OpenFile(false); const OUString aGroup( rShort ); @@ -285,11 +285,11 @@ sal_uLong SwXMLTextBlocks::CopyBlock( SwImpBlocks& rDestImp, OUString& rShort, return nError; } -sal_uLong SwXMLTextBlocks::StartPutBlock( const OUString& rShort, const OUString& rPackageName ) +ErrCode SwXMLTextBlocks::StartPutBlock( const OUString& rShort, const OUString& rPackageName ) { OSL_ENSURE( xBlkRoot.is(), "No storage set" ); if(!xBlkRoot.is()) - return 0; + return ERRCODE_NONE; GetIndex ( rShort ); try { @@ -303,10 +303,10 @@ sal_uLong SwXMLTextBlocks::StartPutBlock( const OUString& rShort, const OUString catch (const uno::Exception&) { } - return 0; + return ERRCODE_NONE; } -sal_uLong SwXMLTextBlocks::BeginPutDoc( const OUString& rShort, const OUString& rLong ) +ErrCode SwXMLTextBlocks::BeginPutDoc( const OUString& rShort, const OUString& rLong ) { // Store in base class m_aShort = rShort; @@ -316,9 +316,9 @@ sal_uLong SwXMLTextBlocks::BeginPutDoc( const OUString& rShort, const OUString& return StartPutBlock (rShort, aPackageName); } -sal_uLong SwXMLTextBlocks::PutBlock() +ErrCode SwXMLTextBlocks::PutBlock() { - sal_uLong nRes = 0; // dead variable, this always returns 0 + ErrCode nRes = ERRCODE_NONE; // dead variable, this always returns 0 SwXmlFlags nCommitFlags = nFlags; WriterRef xWrt; @@ -389,26 +389,26 @@ sal_uLong SwXMLTextBlocks::PutBlock() } //TODO/LATER: error handling - return 0; + return ERRCODE_NONE; } -sal_uLong SwXMLTextBlocks::PutDoc() +ErrCode SwXMLTextBlocks::PutDoc() { SwPaM* pPaM = MakePaM(); - sal_uLong nErr = PutBlock(); + ErrCode nErr = PutBlock(); delete pPaM; return nErr; } -sal_uLong SwXMLTextBlocks::GetText( const OUString& rShort, OUString& rText ) +ErrCode SwXMLTextBlocks::GetText( const OUString& rShort, OUString& rText ) { return GetBlockText( rShort, rText ); } -sal_uLong SwXMLTextBlocks::MakeBlockList() +ErrCode SwXMLTextBlocks::MakeBlockList() { WriteInfo(); - return 0; + return ERRCODE_NONE; } bool SwXMLTextBlocks::PutMuchEntries( bool bOn ) @@ -422,7 +422,7 @@ bool SwXMLTextBlocks::PutMuchEntries( bool bOn ) } else if( !IsFileChanged() ) { - bRet = 0 == OpenFile( false ); + bRet = ERRCODE_NONE == OpenFile( false ); if( bRet ) { nFlags |= SwXmlFlags::NoRootCommit; @@ -454,9 +454,9 @@ bool SwXMLTextBlocks::PutMuchEntries( bool bOn ) return bRet; } -sal_uLong SwXMLTextBlocks::OpenFile( bool bRdOnly ) +ErrCode SwXMLTextBlocks::OpenFile( bool bRdOnly ) { - sal_uLong nRet = 0; + ErrCode nRet = ERRCODE_NONE; try { uno::Reference < embed::XStorage > refStg = comphelper::OStorageHelper::GetStorageFromURL( m_aFile, @@ -466,7 +466,7 @@ sal_uLong SwXMLTextBlocks::OpenFile( bool bRdOnly ) catch (const uno::Exception&) { //TODO/LATER: error handling - nRet = 1; + nRet = ErrCode(1); } return nRet; @@ -547,10 +547,10 @@ OUString SwXMLTextBlocks::GeneratePackageName ( const OUString& rShort ) return aBuf.makeStringAndClear(); } -sal_uLong SwXMLTextBlocks::PutText( const OUString& rShort, const OUString& rName, +ErrCode SwXMLTextBlocks::PutText( const OUString& rShort, const OUString& rName, const OUString& rText ) { - sal_uLong nRes = 0; + ErrCode nRes = ERRCODE_NONE; m_aShort = rShort; m_aLong = rName; m_aCurrentText = rText; diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx index 1b792cbd25b9..861de5d197d5 100644 --- a/sw/source/core/swg/SwXMLTextBlocks1.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx @@ -54,7 +54,7 @@ using ::xmloff::token::XML_BLOCK_LIST; using ::xmloff::token::XML_UNFORMATTED_TEXT; using ::xmloff::token::GetXMLToken; -sal_uLong SwXMLTextBlocks::GetDoc( sal_uInt16 nIdx ) +ErrCode SwXMLTextBlocks::GetDoc( sal_uInt16 nIdx ) { OUString aFolderName ( GetPackageName ( nIdx ) ); @@ -145,7 +145,7 @@ sal_uLong SwXMLTextBlocks::GetDoc( sal_uInt16 nIdx ) xRoot = nullptr; } - return 0; + return ERRCODE_NONE; } // event description for autotext events; this constant should really be @@ -157,7 +157,7 @@ const struct SvEventDescription aAutotextEvents[] = { 0, nullptr } }; -sal_uLong SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx, +ErrCode SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx, SvxMacroTableDtor& rMacroTable ) { // set current auto text @@ -165,12 +165,12 @@ sal_uLong SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx, m_aLong = m_aNames[nIdx]->aLong; aPackageName = m_aNames[nIdx]->aPackageName; - sal_uLong nRet = 0; + ErrCode nRet = ERRCODE_NONE; // open stream in proper sub-storage CloseFile(); nRet = OpenFile(); - if ( 0 == nRet ) + if ( ERRCODE_NONE == nRet ) { try { @@ -241,7 +241,7 @@ sal_uLong SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx, } // and finally, copy macro into table - if (0 == nRet) + if (ERRCODE_NONE == nRet) pDescriptor->copyMacrosIntoTable(rMacroTable); } else @@ -262,9 +262,9 @@ sal_uLong SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx, return nRet; } -sal_uLong SwXMLTextBlocks::GetBlockText( const OUString& rShort, OUString& rText ) +ErrCode SwXMLTextBlocks::GetBlockText( const OUString& rShort, OUString& rText ) { - sal_uLong n = 0; + ErrCode n = ERRCODE_NONE; OUString aFolderName = GeneratePackageName ( rShort ); OUString aStreamName = aFolderName + ".xml"; rText.clear(); @@ -329,7 +329,7 @@ sal_uLong SwXMLTextBlocks::GetBlockText( const OUString& rShort, OUString& rText return n; } -sal_uLong SwXMLTextBlocks::PutBlockText( const OUString& rShort, +ErrCode SwXMLTextBlocks::PutBlockText( const OUString& rShort, const OUString& rText, const OUString& rPackageName ) { GetIndex ( rShort ); @@ -346,7 +346,7 @@ sal_uLong SwXMLTextBlocks::PutBlockText( const OUString& rShort, comphelper::getProcessComponentContext(); uno::Reference < xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext); - sal_uLong nRes = 0; + ErrCode nRes = ERRCODE_NONE; try { @@ -453,7 +453,7 @@ void SwXMLTextBlocks::ReadInfo() } void SwXMLTextBlocks::WriteInfo() { - if ( xBlkRoot.is() || 0 == OpenFile ( false ) ) + if ( xBlkRoot.is() || ERRCODE_NONE == OpenFile ( false ) ) { uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); @@ -500,7 +500,7 @@ void SwXMLTextBlocks::WriteInfo() } } -sal_uLong SwXMLTextBlocks::SetMacroTable( +ErrCode SwXMLTextBlocks::SetMacroTable( sal_uInt16 nIdx, const SvxMacroTableDtor& rMacroTable ) { @@ -510,7 +510,7 @@ sal_uLong SwXMLTextBlocks::SetMacroTable( aPackageName = m_aNames[nIdx]->aPackageName; // start XML autotext event export - sal_uLong nRes = 0; + ErrCode nRes = ERRCODE_NONE; uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); @@ -526,7 +526,7 @@ sal_uLong SwXMLTextBlocks::SetMacroTable( CloseFile(); // close (it may be open in read-only-mode) nRes = OpenFile ( false ); - if ( 0 == nRes ) + if ( ERRCODE_NONE == nRes ) { try { diff --git a/sw/source/core/swg/swblocks.cxx b/sw/source/core/swg/swblocks.cxx index 0c9c31675f71..dfdfd9e5232b 100644 --- a/sw/source/core/swg/swblocks.cxx +++ b/sw/source/core/swg/swblocks.cxx @@ -217,14 +217,14 @@ bool SwImpBlocks::IsOnlyTextBlock( const OUString& ) const return false; } -sal_uLong SwImpBlocks::GetMacroTable( sal_uInt16, SvxMacroTableDtor& ) +ErrCode SwImpBlocks::GetMacroTable( sal_uInt16, SvxMacroTableDtor& ) { - return 0; + return ERRCODE_NONE; } -sal_uLong SwImpBlocks::SetMacroTable( sal_uInt16 , const SvxMacroTableDtor& ) +ErrCode SwImpBlocks::SetMacroTable( sal_uInt16 , const SvxMacroTableDtor& ) { - return 0; + return ERRCODE_NONE; } bool SwImpBlocks::PutMuchEntries( bool ) @@ -308,7 +308,7 @@ bool SwTextBlocks::Delete( sal_uInt16 n ) { if( pImp->IsFileChanged() ) nErr = ERR_TXTBLOCK_NEWFILE_ERROR; - else if( 0 == (nErr = pImp->OpenFile( false ) )) + else if( ERRCODE_NONE == (nErr = pImp->OpenFile( false ) )) { nErr = pImp->Delete( n ); if( !nErr ) @@ -324,7 +324,7 @@ bool SwTextBlocks::Delete( sal_uInt16 n ) pImp->CloseFile(); pImp->Touch(); - return ( nErr == 0 ); + return ( nErr == ERRCODE_NONE ); } return false; } @@ -349,7 +349,7 @@ void SwTextBlocks::Rename( sal_uInt16 n, const OUString* s, const OUString* l ) if( pImp->IsFileChanged() ) nErr = ERR_TXTBLOCK_NEWFILE_ERROR; - else if( 0 == ( nErr = pImp->OpenFile( false ))) + else if( ERRCODE_NONE == ( nErr = pImp->OpenFile( false ))) { // Set the new entry in the list before we do that! aNew = GetAppCharClass().uppercase( aNew ); @@ -368,7 +368,7 @@ void SwTextBlocks::Rename( sal_uInt16 n, const OUString* s, const OUString* l ) } } -sal_uLong SwTextBlocks::CopyBlock( SwTextBlocks& rSource, OUString& rSrcShort, +ErrCode SwTextBlocks::CopyBlock( SwTextBlocks& rSource, OUString& rSrcShort, const OUString& rLong ) { bool bIsOld = false; @@ -393,7 +393,7 @@ bool SwTextBlocks::BeginGetDoc( sal_uInt16 n ) { if( pImp->IsFileChanged() ) nErr = ERR_TXTBLOCK_NEWFILE_ERROR; - else if( 0 == ( nErr = pImp->OpenFile())) + else if( ERRCODE_NONE == ( nErr = pImp->OpenFile())) { pImp->ClearDoc(); nErr = pImp->GetDoc( n ); @@ -402,7 +402,7 @@ bool SwTextBlocks::BeginGetDoc( sal_uInt16 n ) else pImp->m_nCurrentIndex = n; } - return ( nErr == 0 ); + return ( nErr == ERRCODE_NONE ); } return false; } @@ -424,7 +424,7 @@ bool SwTextBlocks::BeginPutDoc( const OUString& s, const OUString& l ) nErr = ERR_TXTBLOCK_NEWFILE_ERROR; else nErr = pImp->OpenFile( false ); - bOk = 0 == nErr; + bOk = ERRCODE_NONE == nErr; } if( bOk ) { @@ -434,7 +434,7 @@ bool SwTextBlocks::BeginPutDoc( const OUString& s, const OUString& l ) if( nErr ) pImp->CloseFile(); } - return 0 == nErr; + return ERRCODE_NONE == nErr; } sal_uInt16 SwTextBlocks::PutDoc() @@ -479,7 +479,7 @@ sal_uInt16 SwTextBlocks::PutText( const OUString& rShort, const OUString& rName, nErr = ERR_TXTBLOCK_NEWFILE_ERROR; else nErr = pImp->OpenFile( false ); - bOk = 0 == nErr; + bOk = ERRCODE_NONE == nErr; } if( bOk ) { @@ -571,7 +571,7 @@ bool SwTextBlocks::GetMacroTable( sal_uInt16 nIdx, SvxMacroTableDtor& rMacroTabl { bool bRet = true; if ( pImp && !pImp->m_bInPutMuchBlocks ) - bRet = ( 0 == pImp->GetMacroTable( nIdx, rMacroTable ) ); + bRet = ( ERRCODE_NONE == pImp->GetMacroTable( nIdx, rMacroTable ) ); return bRet; } @@ -579,7 +579,7 @@ bool SwTextBlocks::SetMacroTable( sal_uInt16 nIdx, const SvxMacroTableDtor& rMac { bool bRet = true; if ( pImp && !pImp->m_bInPutMuchBlocks ) - bRet = ( 0 == pImp->SetMacroTable( nIdx, rMacroTable ) ); + bRet = ( ERRCODE_NONE == pImp->SetMacroTable( nIdx, rMacroTable ) ); return bRet; } diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 71faf3dbb0bd..91ee7438b020 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -1065,7 +1065,7 @@ void InsertFile(SwUnoCursor* pUnoCursor, const OUString& rURL, SwNodeIndex aSave( pUnoCursor->GetPoint()->nNode, -1 ); sal_Int32 nContent = pUnoCursor->GetPoint()->nContent.GetIndex(); - sal_uInt32 nErrno = pRdr->Read( *pRead ); // and paste the document + ErrCode nErrno = pRdr->Read( *pRead ); // and paste the document if(!nErrno) { diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index cf009a9b4d10..070d481a8878 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -187,7 +187,7 @@ void SwUnoCursorHelper::GetTextFromPam(SwPaM & rPam, OUString & rBuffer) const bool bOldShowProgress = xWrt->bShowProgress; xWrt->bShowProgress = false; - if( !IsError( aWriter.Write( xWrt ) ) ) + if( ! aWriter.Write( xWrt ).IsError() ) { const sal_uInt64 lUniLen = aStream.GetSize()/sizeof( sal_Unicode ); if (lUniLen < static_cast<sal_uInt64>(SAL_MAX_INT32-1)) diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 826806bea226..e9a666bd7102 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -541,7 +541,7 @@ void SwXStyleFamilies::loadStylesFromURL(const OUString& rURL, else if(rProperty.Name == UNO_NAME_LOAD_TEXT_STYLES) aOpt.SetTextFormats(bValue); } - const sal_uLong nErr = m_pDocShell->LoadStylesFromFile( rURL, aOpt, true ); + const ErrCode nErr = m_pDocShell->LoadStylesFromFile( rURL, aOpt, true ); if(nErr) throw io::IOException(); } diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx index e03ae3921ae0..ab5512b7976d 100644 --- a/sw/source/filter/ascii/parasc.cxx +++ b/sw/source/filter/ascii/parasc.cxx @@ -60,7 +60,7 @@ class SwASCIIParser SvtScriptType nScript; bool bNewDoc; - sal_uLong ReadChars(); + ErrCode ReadChars(); void InsertText( const OUString& rStr ); SwASCIIParser(const SwASCIIParser&) = delete; @@ -71,11 +71,11 @@ public: bool bReadNewDoc, const SwAsciiOptions& rOpts ); ~SwASCIIParser(); - sal_uLong CallParser(); + ErrCode CallParser(); }; // Call for the general reader interface -sal_uLong AsciiReader::Read( SwDoc &rDoc, const OUString&, SwPaM &rPam, const OUString & ) +ErrCode AsciiReader::Read( SwDoc &rDoc, const OUString&, SwPaM &rPam, const OUString & ) { if( !pStrm ) { @@ -85,7 +85,7 @@ sal_uLong AsciiReader::Read( SwDoc &rDoc, const OUString&, SwPaM &rPam, const OU SwASCIIParser* pParser = new SwASCIIParser( &rDoc, rPam, *pStrm, !bInsertMode, aOpt.GetASCIIOpts() ); - sal_uLong nRet = pParser->CallParser(); + ErrCode nRet = pParser->CallParser(); delete pParser; // after Read reset the options @@ -138,7 +138,7 @@ SwASCIIParser::~SwASCIIParser() } // Calling the parser -sal_uLong SwASCIIParser::CallParser() +ErrCode SwASCIIParser::CallParser() { rInput.Seek(STREAM_SEEK_TO_END); rInput.ResetError(); @@ -169,7 +169,7 @@ sal_uLong SwASCIIParser::CallParser() pDoc->SetTextFormatColl(*pPam, pColl); } - sal_uLong nError = ReadChars(); + ErrCode nError = ReadChars(); if( pItemSet ) { @@ -249,7 +249,7 @@ sal_uLong SwASCIIParser::CallParser() return nError; } -sal_uLong SwASCIIParser::ReadChars() +ErrCode SwASCIIParser::ReadChars() { sal_Unicode *pStt = nullptr, *pEnd = nullptr, *pLastStt = nullptr; long nReadCnt = 0, nLineLen = 0; @@ -291,7 +291,7 @@ sal_uLong SwASCIIParser::ReadChars() hConverter = rtl_createTextToUnicodeConverter( currentCharSet ); OSL_ENSURE( hConverter, "no string convert available" ); if (!hConverter) - return ERROR_SW_READ_BASE; + return ErrCode(ERROR_SW_READ_BASE); bSwapUnicode = false; hContext = rtl_createTextToUnicodeContext( hConverter ); } diff --git a/sw/source/filter/ascii/wrtasc.cxx b/sw/source/filter/ascii/wrtasc.cxx index 00ed3e928fbd..7a23d1970fba 100644 --- a/sw/source/filter/ascii/wrtasc.cxx +++ b/sw/source/filter/ascii/wrtasc.cxx @@ -83,7 +83,7 @@ SwASCWriter::SwASCWriter( const OUString& rFltNm ) SwASCWriter::~SwASCWriter() {} -sal_uLong SwASCWriter::WriteStream() +ErrCode SwASCWriter::WriteStream() { if( bASCII_ParaAsCR ) // If predefined m_sLineEnd = "\015"; diff --git a/sw/source/filter/ascii/wrtasc.hxx b/sw/source/filter/ascii/wrtasc.hxx index 82d2b108f498..cb0fdc191bb2 100644 --- a/sw/source/filter/ascii/wrtasc.hxx +++ b/sw/source/filter/ascii/wrtasc.hxx @@ -30,7 +30,7 @@ class SwASCWriter : public Writer { OUString m_sLineEnd; - virtual sal_uLong WriteStream() override; + virtual ErrCode WriteStream() override; public: SwASCWriter( const OUString& rFilterName ); diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx index a1459c780fa3..f112ee9a77cb 100644 --- a/sw/source/filter/basflt/fltini.cxx +++ b/sw/source/filter/basflt/fltini.cxx @@ -647,8 +647,8 @@ extern "C" { Reader *ImportDOC(); void ExportDOC( const OUString&, const OUString& rBaseURL, WriterRef& ); Reader *ImportDOCX(); - sal_uLong SaveOrDelMSVBAStorage_ww8( SfxObjectShell&, SotStorage&, sal_Bool, const OUString& ); - sal_uLong GetSaveWarningOfMSVBAStorage_ww8( SfxObjectShell& ); + sal_uInt32 SaveOrDelMSVBAStorage_ww8( SfxObjectShell&, SotStorage&, sal_Bool, const OUString& ); + sal_uInt32 GetSaveWarningOfMSVBAStorage_ww8( SfxObjectShell& ); } #endif @@ -725,27 +725,27 @@ Reader* GetDOCXReader() #endif } -typedef sal_uLong ( SAL_CALL *SaveOrDel )( SfxObjectShell&, SotStorage&, sal_Bool, const OUString& ); -typedef sal_uLong ( SAL_CALL *GetSaveWarning )( SfxObjectShell& ); +typedef sal_uInt32 ( SAL_CALL *SaveOrDel )( SfxObjectShell&, SotStorage&, sal_Bool, const OUString& ); +typedef sal_uInt32 ( SAL_CALL *GetSaveWarning )( SfxObjectShell& ); -sal_uLong SaveOrDelMSVBAStorage( SfxObjectShell& rDoc, SotStorage& rStor, bool bSaveInto, const OUString& rStorageName ) +ErrCode SaveOrDelMSVBAStorage( SfxObjectShell& rDoc, SotStorage& rStor, bool bSaveInto, const OUString& rStorageName ) { #ifndef DISABLE_DYNLOADING SaveOrDel pFunction = reinterpret_cast<SaveOrDel>( SwGlobals::getFilters().GetMswordLibSymbol( "SaveOrDelMSVBAStorage_ww8" ) ); if( pFunction ) - return pFunction( rDoc, rStor, bSaveInto, rStorageName ); + return ErrCode(pFunction( rDoc, rStor, bSaveInto, rStorageName )); return ERRCODE_NONE; #else return SaveOrDelMSVBAStorage_ww8( rDoc, rStor, bSaveInto, rStorageName ); #endif } -sal_uLong GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS ) +ErrCode GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS ) { #ifndef DISABLE_DYNLOADING GetSaveWarning pFunction = reinterpret_cast<GetSaveWarning>( SwGlobals::getFilters().GetMswordLibSymbol( "GetSaveWarningOfMSVBAStorage_ww8" ) ); if( pFunction ) - return pFunction( rDocS ); + return ErrCode(pFunction( rDocS )); return ERRCODE_NONE; #else return GetSaveWarningOfMSVBAStorage_ww8( rDocS ); diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index 615c0d938780..3e2a3ec4393c 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -62,7 +62,7 @@ using namespace ::com::sun::star; -sal_uLong SwReader::Read( const Reader& rOptions ) +ErrCode SwReader::Read( const Reader& rOptions ) { // copy variables Reader* po = const_cast<Reader*>(&rOptions); @@ -83,7 +83,7 @@ sal_uLong SwReader::Read( const Reader& rOptions ) return ERR_SWG_FILE_FORMAT_ERROR; } - sal_uLong nError = 0L; + ErrCode nError = ERRCODE_NONE; GetDoc(); @@ -181,7 +181,7 @@ sal_uLong SwReader::Read( const Reader& rOptions ) mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( RedlineFlags::Ignore ); - if( !IsError( nError )) // set the End position already + if( ! nError.IsError() ) // set the End position already { --aEndPos; pCNd = aEndPos.GetNode().GetContentNode(); @@ -727,7 +727,7 @@ SwWriter::SwWriter(SfxMedium& rMedium, SwDoc &rDocument) { } -sal_uLong SwWriter::Write( WriterRef& rxWriter, const OUString* pRealFileName ) +ErrCode SwWriter::Write( WriterRef& rxWriter, const OUString* pRealFileName ) { // #i73788# SwPauseThreadStarting aPauseThreadStarting; @@ -851,7 +851,7 @@ sal_uLong SwWriter::Write( WriterRef& rxWriter, const OUString* pRealFileName ) const bool bOrigPurgeOle = pOutDoc->getIDocumentSettingAccess().get(DocumentSettingId::PURGE_OLE); pOutDoc->getIDocumentSettingAccess().set(DocumentSettingId::PURGE_OLE, false); - sal_uLong nError = 0; + ErrCode nError = ERRCODE_NONE; if( pMedium ) nError = rxWriter->Write( *pPam, *pMedium, pRealFileName ); else if( pStg.is() ) @@ -884,7 +884,7 @@ sal_uLong SwWriter::Write( WriterRef& rxWriter, const OUString* pRealFileName ) { delete pPam; // delete the created Pam // Everything was written successfully? Tell the document! - if ( !IsError( nError ) && !xDoc.is() ) + if ( !nError.IsError() && !xDoc.is() ) { rDoc.getIDocumentState().ResetModified(); // #i38810# - reset also flag, that indicates updated links diff --git a/sw/source/filter/docx/swdocxreader.cxx b/sw/source/filter/docx/swdocxreader.cxx index 3f2bb22b4d26..25ee0567a95e 100644 --- a/sw/source/filter/docx/swdocxreader.cxx +++ b/sw/source/filter/docx/swdocxreader.cxx @@ -48,7 +48,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT Reader* SAL_CALL ImportDOCX() return new SwDOCXReader; } -sal_uLong SwDOCXReader::Read( SwDoc& /* rDoc */, const OUString& /* rBaseURL */, SwPaM& /* rPaM */, const OUString& /* FileName */ ) +ErrCode SwDOCXReader::Read( SwDoc& /* rDoc */, const OUString& /* rBaseURL */, SwPaM& /* rPaM */, const OUString& /* FileName */ ) { return ERR_SWG_READ_ERROR; } diff --git a/sw/source/filter/docx/swdocxreader.hxx b/sw/source/filter/docx/swdocxreader.hxx index 6c6dab0b2d1b..6418194bbdd0 100644 --- a/sw/source/filter/docx/swdocxreader.hxx +++ b/sw/source/filter/docx/swdocxreader.hxx @@ -35,7 +35,7 @@ public: virtual bool ReadGlossaries( SwTextBlocks& rBlocks, bool bSaveRelFiles ) const override; private: - virtual sal_uLong Read( SwDoc&, const OUString&, SwPaM&, const OUString& ) override; + virtual ErrCode Read( SwDoc&, const OUString&, SwPaM&, const OUString& ) override; static bool MakeEntries( SwDoc *pD, SwTextBlocks &rBlocks ); }; diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index 1987153b18aa..1c020e270922 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -3161,7 +3161,7 @@ static Writer& OutCSS1_SvxBrush( Writer& rWrt, const SfxPoolItem& rHt, { if( !XOutBitmap::GraphicToBase64(*pGrf, aGraphicInBase64) ) { - rHTMLWrt.m_nWarn = WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE; + rHTMLWrt.m_nWarn = ErrCode(WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE); } } aLink.clear(); diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index 9a736f05822a..5c4746f18b8c 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -1360,7 +1360,7 @@ Writer& OutHTML_Image( Writer& rWrt, const SwFrameFormat &rFrameFormat, OUString aGraphicInBase64; if ( !XOutBitmap::GraphicToBase64(rGraphic, aGraphicInBase64) ) { - rHTMLWrt.m_nWarn = WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE; + rHTMLWrt.m_nWarn = ErrCode(WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE); } OStringBuffer sBuffer; @@ -1438,7 +1438,7 @@ Writer& OutHTML_BulletImage( Writer& rWrt, { if( !XOutBitmap::GraphicToBase64(*pGrf, aGraphicInBase64) ) { - rHTMLWrt.m_nWarn = WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE; + rHTMLWrt.m_nWarn = ErrCode(WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE); } } } @@ -1728,10 +1728,10 @@ static Writer & OutHTML_FrameFormatAsImage( Writer& rWrt, const SwFrameFormat& r XOutBitmap::WriteGraphic( aGraphic, GraphicURL, "JPG", (XOutFlags::UseGifIfPossible| - XOutFlags::UseNativeIfPossible) ) != 0 ) + XOutFlags::UseNativeIfPossible) ) != ERRCODE_NONE ) { // empty or incorrect, because there is nothing to output - rHTMLWrt.m_nWarn = WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE; + rHTMLWrt.m_nWarn = ErrCode(WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE); return rWrt; } @@ -1796,11 +1796,11 @@ static Writer& OutHTML_FrameFormatGrfNode( Writer& rWrt, const SwFrameFormat& rF aMM100Size = OutputDevice::LogicToLogic( rSize.GetSize(), MapMode( MapUnit::MapTwip ), MapMode( MapUnit::Map100thMM )); - sal_uInt16 nErr = XOutBitmap::WriteGraphic( pGrfNd->GetGrf(), aGraphicURL, + ErrCode nErr = XOutBitmap::WriteGraphic( pGrfNd->GetGrf(), aGraphicURL, "JPG", nFlags, &aMM100Size ); if( nErr ) { - rHTMLWrt.m_nWarn = WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE; + rHTMLWrt.m_nWarn = ErrCode(WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE); return rWrt; } aGraphicURL = URIHelper::SmartRel2Abs( diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx index 48ae575cf327..981a479b9490 100644 --- a/sw/source/filter/html/htmlplug.cxx +++ b/sw/source/filter/html/htmlplug.cxx @@ -1313,13 +1313,13 @@ Writer& OutHTML_FrameFormatOLENodeGrf( Writer& rWrt, const SwFrameFormat& rFrame if(pTempFileName) aGraphicURL = *pTempFileName; - sal_uInt16 nErr = XOutBitmap::WriteGraphic( aGraphic, aGraphicURL, + ErrCode nErr = XOutBitmap::WriteGraphic( aGraphic, aGraphicURL, "JPG", (XOutFlags::UseGifIfPossible | XOutFlags::UseNativeIfPossible) ); if( nErr ) // error, don't write anything { - rHTMLWrt.m_nWarn = WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE; + rHTMLWrt.m_nWarn = ErrCode(WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE); return rWrt; } aGraphicURL = URIHelper::SmartRel2Abs( diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 7b1e42963dad..a431b466f9b3 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -189,7 +189,7 @@ bool HTMLReader::SetStrmStgPtr() } // Aufruf fuer die allg. Reader-Schnittstelle -sal_uLong HTMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPam, const OUString & rName ) +ErrCode HTMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPam, const OUString & rName ) { if( !pStrm ) { @@ -212,7 +212,7 @@ sal_uLong HTMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPam, // so nobody steals the document! rDoc.acquire(); - sal_uLong nRet = 0; + ErrCode nRet = ERRCODE_NONE; tools::SvRef<SwHTMLParser> xParser = new SwHTMLParser( &rDoc, rPam, *pStrm, rName, rBaseURL, !bInsertMode, pMedium, IsReadUTF8(), diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 4ba96bb823dd..adf1d388912d 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -185,7 +185,7 @@ void SwHTMLWriter::SetupFilterOptions(SfxMedium& rMedium) } } -sal_uLong SwHTMLWriter::WriteStream() +ErrCode SwHTMLWriter::WriteStream() { SvxHtmlOptions& rHtmlOptions = SvxHtmlOptions::Get(); @@ -1226,7 +1226,7 @@ void SwHTMLWriter::OutBackground( const SvxBrushItem *pBrushItem, bool bGraphic { if( !XOutBitmap::GraphicToBase64(*pGrf, aGraphicInBase64) ) { - m_nWarn = WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE; + m_nWarn = ErrCode(WARN_SWG_POOR_LOAD | WARN_SW_WRITE_BASE); } Strm().WriteCharPtr( " " OOO_STRING_SVTOOLS_HTML_O_background "=\"" ); Strm().WriteCharPtr( OOO_STRING_SVTOOLS_HTML_O_data ":" ); diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx index 6061bd4c2eec..45edb4e7e71a 100644 --- a/sw/source/filter/html/wrthtml.hxx +++ b/sw/source/filter/html/wrthtml.hxx @@ -271,7 +271,7 @@ class SwHTMLWriter : public Writer void CollectLinkTargets(); protected: - sal_uLong WriteStream() override; + ErrCode WriteStream() override; void SetupFilterOptions(SfxMedium& rMedium) override; public: @@ -302,7 +302,7 @@ public: sal_uInt32 m_aFontHeights[7]; // font heights 1-7 - sal_uInt32 m_nWarn; // warning code + ErrCode m_nWarn; // warning code sal_uInt32 m_nLastLFPos; // last position of LF HtmlTokenId m_nLastParaToken; // to hold paragraphs together diff --git a/sw/source/filter/inc/fltini.hxx b/sw/source/filter/inc/fltini.hxx index 7b5fa11001e4..a5b7f1569a4d 100644 --- a/sw/source/filter/inc/fltini.hxx +++ b/sw/source/filter/inc/fltini.hxx @@ -33,7 +33,7 @@ class HTMLReader: public Reader { // we don't want to have the streams/storages open virtual bool SetStrmStgPtr() override; - virtual sal_uLong Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) override; + virtual ErrCode Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) override; virtual OUString GetTemplateName() const override; public: HTMLReader(); @@ -41,7 +41,7 @@ public: class XMLReader : public Reader { - virtual sal_uLong Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) override; + virtual ErrCode Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) override; public: virtual int GetReaderType() override; diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx index d0567a4f7ba1..cb578d4ebc53 100644 --- a/sw/source/filter/rtf/swparrtf.cxx +++ b/sw/source/filter/rtf/swparrtf.cxx @@ -40,10 +40,10 @@ using namespace ::com::sun::star; /// Glue class to call RtfImport as an internal filter, needed by copy&paste support. class SwRTFReader : public Reader { - sal_uLong Read(SwDoc&, const OUString& rBaseURL, SwPaM&, const OUString&) override; + ErrCode Read(SwDoc&, const OUString& rBaseURL, SwPaM&, const OUString&) override; }; -sal_uLong SwRTFReader::Read(SwDoc& rDoc, const OUString& /*rBaseURL*/, SwPaM& rPam, const OUString&) +ErrCode SwRTFReader::Read(SwDoc& rDoc, const OUString& /*rBaseURL*/, SwPaM& rPam, const OUString&) { if (!pStrm) return ERR_SWG_READ_ERROR; @@ -86,7 +86,7 @@ sal_uLong SwRTFReader::Read(SwDoc& rDoc, const OUString& /*rBaseURL*/, SwPaM& rP { "InsertMode", uno::Any(true) }, { "TextInsertModeRange", uno::Any(xInsertTextRange) } })); - sal_uLong ret(0); + ErrCode ret = ERRCODE_NONE; try { xFilter->filter(aDescriptor); diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx index c46132263491..dab18534b15b 100644 --- a/sw/source/filter/writer/writer.cxx +++ b/sw/source/filter/writer/writer.cxx @@ -240,11 +240,11 @@ SvStream& Writer::OutULong( SvStream& rStrm, sal_uLong nVal ) return lcl_OutLongExt(rStrm, nVal, false); } -sal_uLong Writer::Write( SwPaM& rPaM, SvStream& rStrm, const OUString* pFName ) +ErrCode Writer::Write( SwPaM& rPaM, SvStream& rStrm, const OUString* pFName ) { if ( IsStgWriter() ) { - sal_uLong nResult = ERRCODE_ABORT; + ErrCode nResult = ERRCODE_ABORT; try { tools::SvRef<SotStorage> aRef = new SotStorage( rStrm ); @@ -268,7 +268,7 @@ sal_uLong Writer::Write( SwPaM& rPaM, SvStream& rStrm, const OUString* pFName ) // for comparison secure to the current Pam pOrigPam = &rPaM; - sal_uLong nRet = WriteStream(); + ErrCode nRet = WriteStream(); ResetWriter(); @@ -278,7 +278,7 @@ sal_uLong Writer::Write( SwPaM& rPaM, SvStream& rStrm, const OUString* pFName ) void Writer::SetupFilterOptions(SfxMedium& /*rMedium*/) {} -sal_uLong Writer::Write( SwPaM& rPam, SfxMedium& rMedium, const OUString* pFileName ) +ErrCode Writer::Write( SwPaM& rPam, SfxMedium& rMedium, const OUString* pFileName ) { SetupFilterOptions(rMedium); // This method must be overridden in SwXMLWriter a storage from medium will be used there. @@ -286,13 +286,13 @@ sal_uLong Writer::Write( SwPaM& rPam, SfxMedium& rMedium, const OUString* pFileN return Write( rPam, *rMedium.GetOutStream(), pFileName ); } -sal_uLong Writer::Write( SwPaM& /*rPam*/, SotStorage&, const OUString* ) +ErrCode Writer::Write( SwPaM& /*rPam*/, SotStorage&, const OUString* ) { OSL_ENSURE( false, "Write in Storages on a stream?" ); return ERR_SWG_WRITE_ERROR; } -sal_uLong Writer::Write( SwPaM&, const uno::Reference < embed::XStorage >&, const OUString*, SfxMedium* ) +ErrCode Writer::Write( SwPaM&, const uno::Reference < embed::XStorage >&, const OUString*, SfxMedium* ) { OSL_ENSURE( false, "Write in Storages on a stream?" ); return ERR_SWG_WRITE_ERROR; @@ -487,13 +487,13 @@ bool Writer::GetBookmarks(const SwContentNode& rNd, sal_Int32 nStt, } // Storage-specific -sal_uLong StgWriter::WriteStream() +ErrCode StgWriter::WriteStream() { OSL_ENSURE( false, "Write in Storages on a stream?" ); return ERR_SWG_WRITE_ERROR; } -sal_uLong StgWriter::Write( SwPaM& rPaM, SotStorage& rStg, const OUString* pFName ) +ErrCode StgWriter::Write( SwPaM& rPaM, SotStorage& rStg, const OUString* pFName ) { SetStream(nullptr); pStg = &rStg; @@ -505,7 +505,7 @@ sal_uLong StgWriter::Write( SwPaM& rPaM, SotStorage& rStg, const OUString* pFNam // for comparison secure to the current Pam pOrigPam = &rPaM; - sal_uLong nRet = WriteStorage(); + ErrCode nRet = WriteStorage(); pStg = nullptr; ResetWriter(); @@ -513,7 +513,7 @@ sal_uLong StgWriter::Write( SwPaM& rPaM, SotStorage& rStg, const OUString* pFNam return nRet; } -sal_uLong StgWriter::Write( SwPaM& rPaM, const uno::Reference < embed::XStorage >& rStg, const OUString* pFName, SfxMedium* pMedium ) +ErrCode StgWriter::Write( SwPaM& rPaM, const uno::Reference < embed::XStorage >& rStg, const OUString* pFName, SfxMedium* pMedium ) { SetStream(nullptr); pStg = nullptr; @@ -526,7 +526,7 @@ sal_uLong StgWriter::Write( SwPaM& rPaM, const uno::Reference < embed::XStorage // for comparison secure to the current Pam pOrigPam = &rPaM; - sal_uLong nRet = pMedium ? WriteMedium( *pMedium ) : WriteStorage(); + ErrCode nRet = pMedium ? WriteMedium( *pMedium ) : WriteStorage(); pStg = nullptr; ResetWriter(); diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index 8b2de89d8bc7..e83f11e584c4 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -1369,7 +1369,7 @@ private: public: SwRTFWriter(const OUString& rFilterName, const OUString& rBaseURL); - sal_uLong WriteStream() override; + ErrCode WriteStream() override; }; SwRTFWriter::SwRTFWriter(const OUString& rFltName, const OUString& rBaseURL) @@ -1379,12 +1379,12 @@ SwRTFWriter::SwRTFWriter(const OUString& rFltName, const OUString& rBaseURL) m_bOutOutlineOnly = rFltName.startsWith("O"); } -sal_uLong SwRTFWriter::WriteStream() +ErrCode SwRTFWriter::WriteStream() { SwPaM aPam(*pCurPam->End(), *pCurPam->Start()); RtfExport aExport(nullptr, pDoc, &aPam, pCurPam, this, m_bOutOutlineOnly); aExport.ExportDocument(true); - return 0; + return ERRCODE_NONE; } extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL ExportRTF(const OUString& rFltName, const OUString& rBaseURL, WriterRef& xRet) diff --git a/sw/source/filter/ww8/rtfexportfilter.hxx b/sw/source/filter/ww8/rtfexportfilter.hxx index c58bf2b89554..5b626344e900 100644 --- a/sw/source/filter/ww8/rtfexportfilter.hxx +++ b/sw/source/filter/ww8/rtfexportfilter.hxx @@ -30,9 +30,9 @@ class RtfWriter : public Writer { protected: - sal_uLong WriteStream() override + ErrCode WriteStream() override { - return 0; + return ERRCODE_NONE; } }; diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 2048387249e8..7b1a06f741aa 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3445,7 +3445,7 @@ void WW8Export::PrepareStorage() } } -sal_uLong SwWW8Writer::WriteStorage() +ErrCode SwWW8Writer::WriteStorage() { // #i34818# - update layout (if present), for SwWriteTable SwViewShell* pViewShell = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell(); @@ -3473,19 +3473,19 @@ sal_uLong SwWW8Writer::WriteStorage() } ::EndProgress( pDoc->GetDocShell() ); - return 0; + return ERRCODE_NONE; } -sal_uLong SwWW8Writer::WriteMedium( SfxMedium& ) +ErrCode SwWW8Writer::WriteMedium( SfxMedium& ) { return WriteStorage(); } -sal_uLong SwWW8Writer::Write( SwPaM& rPaM, SfxMedium& rMed, +ErrCode SwWW8Writer::Write( SwPaM& rPaM, SfxMedium& rMed, const OUString* pFileName ) { mpMedium = &rMed; - sal_uLong nRet = StgWriter::Write( rPaM, rMed, pFileName ); + ErrCode nRet = StgWriter::Write( rPaM, rMed, pFileName ); mpMedium = nullptr; return nRet; } @@ -3625,10 +3625,10 @@ SwWW8Writer::~SwWW8Writer() { } -extern "C" SAL_DLLPUBLIC_EXPORT sal_uLong SAL_CALL SaveOrDelMSVBAStorage_ww8( SfxObjectShell& rDoc, SotStorage& rStor, sal_Bool bSaveInto, const OUString& rStorageName ) +extern "C" SAL_DLLPUBLIC_EXPORT sal_uInt32 SAL_CALL SaveOrDelMSVBAStorage_ww8( SfxObjectShell& rDoc, SotStorage& rStor, sal_Bool bSaveInto, const OUString& rStorageName ) { SvxImportMSVBasic aTmp( rDoc, rStor ); - return aTmp.SaveOrDelMSVBAStorage( bSaveInto, rStorageName ); + return sal_uInt32(aTmp.SaveOrDelMSVBAStorage( bSaveInto, rStorageName )); } extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL ExportDOC( const OUString& rFltName, const OUString& rBaseURL, WriterRef& xRet ) @@ -3636,9 +3636,9 @@ extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL ExportDOC( const OUString& rFltNam xRet = new SwWW8Writer( rFltName, rBaseURL ); } -extern "C" SAL_DLLPUBLIC_EXPORT sal_uLong SAL_CALL GetSaveWarningOfMSVBAStorage_ww8( SfxObjectShell &rDocS ) +extern "C" SAL_DLLPUBLIC_EXPORT sal_uInt32 SAL_CALL GetSaveWarningOfMSVBAStorage_ww8( SfxObjectShell &rDocS ) { - return SvxImportMSVBasic::GetSaveWarningOfMSVBAStorage( rDocS ); + return sal_uInt32(SvxImportMSVBasic::GetSaveWarningOfMSVBAStorage( rDocS )); } bool WW8_WrPlcFootnoteEdn::WriteText( WW8Export& rWrt ) diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 0957e33220fd..bb371dcdc5b7 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -899,8 +899,8 @@ public: SwWW8Writer(const OUString& rFltName, const OUString& rBaseURL); virtual ~SwWW8Writer() override; - virtual sal_uLong WriteStorage() override; - virtual sal_uLong WriteMedium( SfxMedium& ) override; + virtual ErrCode WriteStorage() override; + virtual ErrCode WriteMedium( SfxMedium& ) override; // TODO most probably we want to be able to get these in // MSExportFilterBase @@ -932,7 +932,7 @@ public: bool InitStd97CodecUpdateMedium( ::msfilter::MSCodec_Std97& rCodec ); using StgWriter::Write; - virtual sal_uLong Write( SwPaM&, SfxMedium&, const OUString* ) override; + virtual ErrCode Write( SwPaM&, SfxMedium&, const OUString* ) override; //Seems not an expected to provide method to access the private member SfxMedium* GetMedia() { return mpMedium; } diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 30cf48d92935..a12f89e25dd9 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -4870,9 +4870,9 @@ void SwWW8ImplReader::ReadGlobalTemplateSettings( const OUString& sCreatedFrom, } } -sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss) +ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss) { - sal_uLong nErrRet = 0; + ErrCode nErrRet = ERRCODE_NONE; m_rDoc.SetDocumentType( SwDoc::DOCTYPE_MSWORD ); if (m_bNewDoc && m_pStg && !pGloss) @@ -5382,10 +5382,10 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss) return nErrRet; } -sal_uLong SwWW8ImplReader::SetSubStreams(tools::SvRef<SotStorageStream> &rTableStream, +ErrCode SwWW8ImplReader::SetSubStreams(tools::SvRef<SotStorageStream> &rTableStream, tools::SvRef<SotStorageStream> &rDataStream) { - sal_uLong nErrRet = 0; + ErrCode nErrRet = ERRCODE_NONE; // 6 stands for "6 OR 7", 7 stands for "ONLY 7" switch (m_pWwFib->m_nVersion) { @@ -5657,9 +5657,9 @@ static bool lclReadCryptoAPIHeader(msfilter::RC4EncryptionInfo &info, SvStream & return true; } -sal_uLong SwWW8ImplReader::LoadThroughDecryption(WW8Glossary *pGloss) +ErrCode SwWW8ImplReader::LoadThroughDecryption(WW8Glossary *pGloss) { - sal_uLong nErrRet = 0; + ErrCode nErrRet = ERRCODE_NONE; if (pGloss) m_pWwFib = pGloss->GetFib(); else @@ -5727,7 +5727,7 @@ sal_uLong SwWW8ImplReader::LoadThroughDecryption(WW8Glossary *pGloss) // if initialization has failed the EncryptionData should be empty if ( aEncryptionData.getLength() && aCtx.VerifyKey( m_pWwFib->m_nKey, m_pWwFib->m_nHash ) ) { - nErrRet = 0; + nErrRet = ERRCODE_NONE; pTempMain = MakeTemp(aDecryptMain); m_pStrm->Seek(0); @@ -5794,7 +5794,7 @@ sal_uLong SwWW8ImplReader::LoadThroughDecryption(WW8Glossary *pGloss) if (aEncryptionData.getLength() && xCtx->VerifyKey(info.verifier.encryptedVerifier, info.verifier.encryptedVerifierHash)) { - nErrRet = 0; + nErrRet = ERRCODE_NONE; pTempMain = MakeTemp(aDecryptMain); @@ -5830,7 +5830,7 @@ sal_uLong SwWW8ImplReader::LoadThroughDecryption(WW8Glossary *pGloss) } } - if (nErrRet == 0) + if (nErrRet == ERRCODE_NONE) { m_pStrm = &aDecryptMain; @@ -6083,9 +6083,9 @@ void SwWW8ImplReader::GetSmartTagInfo(SwFltRDFMark& rMark) rMark.SetAttributes(aAttributes); } -sal_uLong SwWW8ImplReader::LoadDoc(WW8Glossary *pGloss) +ErrCode SwWW8ImplReader::LoadDoc(WW8Glossary *pGloss) { - sal_uLong nErrRet = 0; + ErrCode nErrRet = ERRCODE_NONE; { static const sal_Char* aNames[ 13 ] = { @@ -6217,7 +6217,7 @@ bool SAL_CALL TestImportDOC(SvStream &rStream, const OUString &rFltName) SwPaM aPaM( aIdx ); aPaM.GetPoint()->nContent.Assign(aIdx.GetNode().GetContentNode(), 0); pD->SetInReading(true); - bool bRet = xReader->Read(*pD, OUString(), aPaM, OUString()) == 0; + bool bRet = xReader->Read(*pD, OUString(), aPaM, OUString()) == ERRCODE_NONE; pD->SetInReading(false); return bRet; @@ -6238,9 +6238,9 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportWW2(SvStream &rStream) return TestImportDOC(rStream, "WW6"); } -sal_uLong WW8Reader::OpenMainStream( tools::SvRef<SotStorageStream>& rRef, sal_uInt16& rBuffSize ) +ErrCode WW8Reader::OpenMainStream( tools::SvRef<SotStorageStream>& rRef, sal_uInt16& rBuffSize ) { - sal_uLong nRet = ERR_SWG_READ_ERROR; + ErrCode nRet = ERR_SWG_READ_ERROR; OSL_ENSURE( pStg.get(), "Where is my Storage?" ); rRef = pStg->OpenSotStream( "WordDocument", StreamMode::READ | StreamMode::SHARE_DENYALL); @@ -6251,7 +6251,7 @@ sal_uLong WW8Reader::OpenMainStream( tools::SvRef<SotStorageStream>& rRef, sal_u sal_uInt16 nOld = rRef->GetBufferSize(); rRef->SetBufferSize( rBuffSize ); rBuffSize = nOld; - nRet = 0; + nRet = ERRCODE_NONE; } else nRet = rRef->GetError(); @@ -6259,7 +6259,7 @@ sal_uLong WW8Reader::OpenMainStream( tools::SvRef<SotStorageStream>& rRef, sal_u return nRet; } -sal_uLong WW8Reader::Read(SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, const OUString & /* FileName */) +ErrCode WW8Reader::Read(SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, const OUString & /* FileName */) { sal_uInt16 nOldBuffSize = 32768; bool bNew = !bInsertMode; // New Doc (no inserting) @@ -6267,7 +6267,7 @@ sal_uLong WW8Reader::Read(SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, co tools::SvRef<SotStorageStream> refStrm; // So that no one else can steal the Stream SvStream* pIn = pStrm; - sal_uLong nRet = 0; + ErrCode nRet = ERRCODE_NONE; sal_uInt8 nVersion = 8; const OUString sFltName = GetFltName(); diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index b859a030ef5b..f64509bf1421 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -130,8 +130,8 @@ struct WW8LFOInfo; class WW8Reader : public StgReader { - virtual sal_uLong Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) override; - sal_uLong OpenMainStream( tools::SvRef<SotStorageStream>& rRef, sal_uInt16& rBuffSize ); + virtual ErrCode Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) override; + ErrCode OpenMainStream( tools::SvRef<SotStorageStream>& rRef, sal_uInt16& rBuffSize ); public: virtual int GetReaderType() override; @@ -1513,9 +1513,9 @@ private: //This converts MS Asian Typography information into OOo's void ImportDopTypography(const WW8DopTypography &rTypo); - sal_uLong LoadThroughDecryption(WW8Glossary *pGloss); - sal_uLong SetSubStreams(tools::SvRef<SotStorageStream> &rTableStream, tools::SvRef<SotStorageStream> &rDataStream); - sal_uLong CoreLoad(WW8Glossary *pGloss); + ErrCode LoadThroughDecryption(WW8Glossary *pGloss); + ErrCode SetSubStreams(tools::SvRef<SotStorageStream> &rTableStream, tools::SvRef<SotStorageStream> &rDataStream); + ErrCode CoreLoad(WW8Glossary *pGloss); void ReadDocVars(); @@ -1871,7 +1871,7 @@ public: // really private, but can only be done public const OUString& GetBaseURL() const { return m_sBaseURL; } // load a complete doc file - sal_uLong LoadDoc(WW8Glossary *pGloss=nullptr); + ErrCode LoadDoc(WW8Glossary *pGloss=nullptr); rtl_TextEncoding GetCurrentCharSet(); rtl_TextEncoding GetCurrentCJKCharSet(); rtl_TextEncoding GetCharSetFromLanguage(); diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 64f7aceb3e5a..68b3870d83fc 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -2165,7 +2165,7 @@ void WW8PLCF::GeneratePLCF(SvStream& rSt, sal_Int32 nPN, sal_Int32 ncpN) rSt.ReadInt32( nFc ); pPLCF_PosArray[i] = nFc; - failure = rSt.GetError(); + failure = bool(rSt.GetError()); } } @@ -2191,7 +2191,7 @@ void WW8PLCF::GeneratePLCF(SvStream& rSt, sal_Int32 nPN, sal_Int32 ncpN) rSt.ReadInt32( nFc ); pPLCF_PosArray[nIMax] = nFc; // end of the last Fkp - failure = rSt.GetError(); + failure = bool(rSt.GetError()); } while(false); } diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx index 9a1b277c8480..22ae96e0d85a 100644 --- a/sw/source/filter/ww8/ww8scan.hxx +++ b/sw/source/filter/ww8/ww8scan.hxx @@ -1113,7 +1113,7 @@ public: /* error status */ - sal_uLong m_nFibError; + ErrCode m_nFibError; /* data read from FIB by Ctor (corresponds only approximately to the real structure @@ -1599,7 +1599,7 @@ struct WW8Dop { public: /* Error Status */ - sal_uLong nDopError; + ErrCode nDopError; /* Corresponds only roughly to the actual structure of the Winword DOP, the winword FIB version matters to what exists. diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index a288f7949f4b..8282b081c2e8 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -126,7 +126,7 @@ namespace { /// read a component (file + filter version) -sal_Int32 ReadThroughComponent( +ErrCode ReadThroughComponent( uno::Reference<io::XInputStream> const & xInputStream, uno::Reference<XComponent> const & xModelComponent, const OUString& rStreamName, @@ -273,11 +273,11 @@ sal_Int32 ReadThroughComponent( } // success! - return 0; + return ERRCODE_NONE; } // read a component (storage version) -sal_Int32 ReadThroughComponent( +ErrCode ReadThroughComponent( uno::Reference<embed::XStorage> const & xStorage, uno::Reference<XComponent> const & xModelComponent, const sal_Char* pStreamName, @@ -309,7 +309,7 @@ sal_Int32 ReadThroughComponent( // do we even have an alternative name? if ( nullptr == pCompatibilityStreamName ) - return 0; + return ERRCODE_NONE; // if so, does the stream exist? sStreamName = OUString::createFromAscii(pCompatibilityStreamName); @@ -322,7 +322,7 @@ sal_Int32 ReadThroughComponent( } if (! bContainsStream ) - return 0; + return ERRCODE_NONE; } // set Base URL @@ -490,7 +490,7 @@ static void lcl_ConvertSdrOle2ObjsToSdrGrafObjs(SwDoc& _rDoc) } } -sal_uLong XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, const OUString & rName ) +ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, const OUString & rName ) { // needed for relative URLs, but in clipboard copy/paste there may be none // and also there is the SwXMLTextBlocks special case @@ -768,7 +768,7 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, c } (void)rDoc.acquire(); // prevent deletion - sal_uInt32 nRet = 0; + ErrCode nRet = ERRCODE_NONE; // save redline mode into import info property set const OUString sShowChanges("ShowChanges"); @@ -799,7 +799,7 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, c makeAny( bTextDocInOOoFileFormat ) ); } - sal_uInt32 nWarnRDF = 0; + ErrCode nWarnRDF = ERRCODE_NONE; if ( !(IsOrganizerMode() || IsBlockMode() || aOpt.IsFormatsOnly() || bInsertMode) ) { @@ -837,13 +837,13 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, c // read storage streams // #i103539#: always read meta.xml for generator - sal_uInt32 const nWarn = ReadThroughComponent( + ErrCode const nWarn = ReadThroughComponent( xStorage, xModelComp, "meta.xml", "Meta.xml", xContext, (bOASIS ? "com.sun.star.comp.Writer.XMLOasisMetaImporter" : "com.sun.star.comp.Writer.XMLMetaImporter"), aEmptyArgs, rName, false ); - sal_uInt32 nWarn2 = 0; + ErrCode nWarn2 = ERRCODE_NONE; if( !(IsOrganizerMode() || IsBlockMode() || aOpt.IsFormatsOnly() || bInsertMode) ) { diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx index f49af4ffeae3..d7690b57cae9 100644 --- a/sw/source/filter/xml/wrtxml.cxx +++ b/sw/source/filter/xml/wrtxml.cxx @@ -69,7 +69,7 @@ SwXMLWriter::~SwXMLWriter() { } -sal_uInt32 SwXMLWriter::Write_( const uno::Reference < task::XStatusIndicator >& xStatusIndicator, +ErrCode SwXMLWriter::Write_( const uno::Reference < task::XStatusIndicator >& xStatusIndicator, const OUString& aDocHierarchicalName ) { // Get service factory @@ -425,15 +425,15 @@ sal_uInt32 SwXMLWriter::Write_( const uno::Reference < task::XStatusIndicator >& return WARN_SWG_FEATURES_LOST; } - return 0; + return ERRCODE_NONE; } -sal_uLong SwXMLWriter::WriteStorage() +ErrCode SwXMLWriter::WriteStorage() { return Write_( uno::Reference < task::XStatusIndicator >(), OUString() ); } -sal_uLong SwXMLWriter::WriteMedium( SfxMedium& aTargetMedium ) +ErrCode SwXMLWriter::WriteMedium( SfxMedium& aTargetMedium ) { uno::Reference < task::XStatusIndicator > xStatusIndicator; OUString aName; @@ -449,7 +449,7 @@ sal_uLong SwXMLWriter::WriteMedium( SfxMedium& aTargetMedium ) return Write_( xStatusIndicator, aName ); } -sal_uLong SwXMLWriter::Write( SwPaM& rPaM, SfxMedium& rMed, +ErrCode SwXMLWriter::Write( SwPaM& rPaM, SfxMedium& rMed, const OUString* pFileName ) { return IsStgWriter() diff --git a/sw/source/filter/xml/wrtxml.hxx b/sw/source/filter/xml/wrtxml.hxx index 558b21fd4521..1dbd9f63dfa0 100644 --- a/sw/source/filter/xml/wrtxml.hxx +++ b/sw/source/filter/xml/wrtxml.hxx @@ -39,20 +39,20 @@ namespace com { namespace sun { namespace star { class SwXMLWriter : public StgWriter { - sal_uInt32 Write_( const css::uno::Reference < css::task::XStatusIndicator>&, const OUString& ); + ErrCode Write_( const css::uno::Reference < css::task::XStatusIndicator>&, const OUString& ); using StgWriter::Write; protected: - virtual sal_uLong WriteStorage() override; - virtual sal_uLong WriteMedium( SfxMedium& aTargetMedium ) override; + virtual ErrCode WriteStorage() override; + virtual ErrCode WriteMedium( SfxMedium& aTargetMedium ) override; public: SwXMLWriter( const OUString& rBaseURL ); virtual ~SwXMLWriter() override; - virtual sal_uLong Write( SwPaM&, SfxMedium&, const OUString* ) override; + virtual ErrCode Write( SwPaM&, SfxMedium&, const OUString* ) override; private: diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index fa7abe2d94e0..6d41045d0b8c 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -96,7 +96,7 @@ SwXMLExport::SwXMLExport( InitItemExport(); } -sal_uInt32 SwXMLExport::exportDoc( enum XMLTokenEnum eClass ) +ErrCode SwXMLExport::exportDoc( enum XMLTokenEnum eClass ) { if( !GetModel().is() ) return ERR_SWG_WRITE_ERROR; @@ -286,7 +286,7 @@ sal_uInt32 SwXMLExport::exportDoc( enum XMLTokenEnum eClass ) ( nRedlineFlags & RedlineFlags::ShowMask ) | RedlineFlags::ShowInsert ); } - sal_uInt32 nRet = SvXMLExport::exportDoc( eClass ); + ErrCode nRet = SvXMLExport::exportDoc( eClass ); // now we can restore the redline mode (if we changed it previously) if( bSaveRedline ) diff --git a/sw/source/filter/xml/xmlexp.hxx b/sw/source/filter/xml/xmlexp.hxx index c08b0e2b33b0..778cf20931c4 100644 --- a/sw/source/filter/xml/xmlexp.hxx +++ b/sw/source/filter/xml/xmlexp.hxx @@ -114,7 +114,7 @@ public: virtual ~SwXMLExport() override; - virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ) override; + virtual ErrCode exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ) override; inline const SvXMLUnitConverter& GetTwipUnitConverter() const; diff --git a/sw/source/ui/app/error.src b/sw/source/ui/app/error.src index bca00c9503dc..35d774455b5f 100644 --- a/sw/source/ui/app/error.src +++ b/sw/source/ui/app/error.src @@ -36,7 +36,7 @@ String STR_ERROR_CLPBRD_READ Text [ en-US ] = "Error reading from the clipboard." ; }; -#define ERR_CODE( class, err ) (class | (err - ERROR_SW_BASE)) +#define ERR_CODE( class, err ) (class | (err - ERRCODE_AREA_SW)) #define WARN_CODE( class, err ) (class | ( err - WARN_SW_BASE)) StringArray RID_SW_ERRHDL diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx index 366a42be3e78..2004445fc7c9 100644 --- a/sw/source/ui/dbui/mmresultdialogs.cxx +++ b/sw/source/ui/dbui/mmresultdialogs.cxx @@ -593,14 +593,14 @@ IMPL_LINK(SwMMResultSaveDialog, SaveOutputHdl_Impl, Button*, pButton, void) pValues[0].Value <<= sFilter; uno::Reference< frame::XStorable > xStore( pTargetView->GetDocShell()->GetModel(), uno::UNO_QUERY); - sal_uInt32 nErrorCode = ERRCODE_NONE; + ErrCode nErrorCode = ERRCODE_NONE; try { xStore->storeToURL( sPath, aValues ); } catch (const task::ErrorCodeIOException& rErrorEx) { - nErrorCode = (sal_uInt32)rErrorEx.ErrCode; + nErrorCode = ErrCode(rErrorEx.ErrCode); } catch (const Exception&) { @@ -650,14 +650,14 @@ IMPL_LINK(SwMMResultSaveDialog, SaveOutputHdl_Impl, Button*, pButton, void) pValues[0].Value <<= pSfxFlt->GetFilterName(); uno::Reference< frame::XStorable > xStore( pTargetView->GetDocShell()->GetModel(), uno::UNO_QUERY); - sal_uInt32 nErrorCode = ERRCODE_NONE; + ErrCode nErrorCode = ERRCODE_NONE; try { xStore->storeToURL( sTargetTempURL, aValues ); } catch (const task::ErrorCodeIOException& rErrorEx) { - nErrorCode = (sal_uInt32)rErrorEx.ErrCode; + nErrorCode = ErrCode(rErrorEx.ErrCode); } catch (const Exception&) { diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index fc112a080bff..714b20cac102 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -154,9 +154,9 @@ bool SwDocShell::InsertGeneratedStream(SfxMedium & rMedium, Reader *const pRead = StartConvertFrom(rMedium, &pReader, nullptr, &aPam); if (!pRead) return false; - sal_uLong const nError = pReader->Read(*pRead); + ErrCode const nError = pReader->Read(*pRead); delete pReader; - return 0 == nError; + return ERRCODE_NONE == nError; } // Prepare loading @@ -255,7 +255,7 @@ bool SwDocShell::ConvertFrom( SfxMedium& rMedium ) // Restore the pool default if reading a saved document. m_pDoc->RemoveAllFormatLanguageDependencies(); - sal_uLong nErr = pRdr->Read( *pRead ); + ErrCode nErr = pRdr->Read( *pRead ); // Maybe put away one old Doc if (m_pDoc != pRdr->GetDoc()) @@ -277,7 +277,7 @@ bool SwDocShell::ConvertFrom( SfxMedium& rMedium ) SW_MOD()->SetEmbeddedLoadSave( false ); SetError(nErr); - bool bOk = !IsError( nErr ); + bool bOk = !nErr.IsError(); if (bOk && !m_pDoc->IsInLoadAsynchron()) { @@ -307,13 +307,13 @@ bool SwDocShell::Save() m_pDoc->getIDocumentSettingAccess().set(DocumentSettingId::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, false); } - sal_uLong nErr = ERR_SWG_WRITE_ERROR, nVBWarning = ERRCODE_NONE; + ErrCode nErr = ERR_SWG_WRITE_ERROR, nVBWarning = ERRCODE_NONE; if( SfxObjectShell::Save() ) { switch( GetCreateMode() ) { case SfxObjectCreateMode::INTERNAL: - nErr = 0; + nErr = ERRCODE_NONE; break; case SfxObjectCreateMode::ORGANIZER: @@ -374,7 +374,7 @@ bool SwDocShell::Save() { pFrame->GetBindings().SetState(SfxBoolItem(SID_DOC_MODIFIED, false)); } - return !IsError( nErr ); + return !nErr.IsError(); } // Save using the Defaultformat @@ -446,7 +446,7 @@ bool SwDocShell::SaveAs( SfxMedium& rMedium ) m_pDoc->getIDocumentSettingAccess().set(DocumentSettingId::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, false); } - sal_uLong nErr = ERR_SWG_WRITE_ERROR, nVBWarning = ERRCODE_NONE; + ErrCode nErr = ERR_SWG_WRITE_ERROR, nVBWarning = ERRCODE_NONE; uno::Reference < embed::XStorage > xStor = rMedium.GetOutputStorage(); if( SfxObjectShell::SaveAs( rMedium ) ) { @@ -514,7 +514,7 @@ bool SwDocShell::SaveAs( SfxMedium& rMedium ) } SetError(nErr ? nErr : nVBWarning); - return !IsError( nErr ); + return !nErr.IsError(); } // Save all Formats @@ -552,7 +552,7 @@ bool SwDocShell::ConvertTo( SfxMedium& rMedium ) m_pView->GetPostItMgr()->UpdateDataOnActiveSidebarWin(); } - sal_uLong nVBWarning = 0; + ErrCode nVBWarning = ERRCODE_NONE; if (m_pDoc->ContainsMSVBasic()) { @@ -711,7 +711,7 @@ bool SwDocShell::ConvertTo( SfxMedium& rMedium ) SfxObjectCreateMode::EMBEDDED == GetCreateMode()); // Span Context in order to suppress the Selection's View - sal_uLong nErrno; + ErrCode nErrno; const OUString aFileName( rMedium.GetName() ); // No View, so the whole Document! @@ -741,7 +741,7 @@ bool SwDocShell::ConvertTo( SfxMedium& rMedium ) if( pSrcView ) { pSrcView->SaveContentTo(rMedium); - nErrno = 0; + nErrno = ERRCODE_NONE; } else { @@ -755,7 +755,7 @@ bool SwDocShell::ConvertTo( SfxMedium& rMedium ) if( !rMedium.IsStorage() ) rMedium.CloseOutStream(); - return !IsError( nErrno ); + return ! nErrno.IsError(); } // Hands off diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index ad675dfd9b0c..89bf88550bd3 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -715,7 +715,7 @@ void SwDocShell::Execute(SfxRequest& rReq) pStrm->SetBufferSize( 16348 ); SwWriter aWrt( *pStrm, *pSmryDoc ); ErrCode eErr = aWrt.Write( xWrt ); - if( !ERRCODE_TOERROR( eErr ) ) + if( !eErr.IgnoreWarning() ) { uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); uno::Reference< frame::XDispatchProvider > xProv = drawing::ModuleDispatcher::create( xContext ); @@ -776,7 +776,7 @@ void SwDocShell::Execute(SfxRequest& rReq) SwWriter aWrt( *pStrm, *GetDoc() ); ErrCode eErr = aWrt.Write( xWrt ); EnableSetModified( bEnable ); - if( !ERRCODE_TOERROR( eErr ) ) + if( !eErr.IgnoreWarning() ) { pStrm->Seek( STREAM_SEEK_TO_END ); pStrm->WriteChar( '\0' ); @@ -1434,10 +1434,10 @@ void SwDocShell::ReloadFromHtml( const OUString& rStreamName, SwSrcView* pSrcVie m_pDoc->getIDocumentState().ResetModified(); } -sal_uLong SwDocShell::LoadStylesFromFile( const OUString& rURL, +ErrCode SwDocShell::LoadStylesFromFile( const OUString& rURL, SwgReaderOption& rOpt, bool bUnoCall ) { - sal_uLong nErr = 0; + ErrCode nErr = ERRCODE_NONE; // Set filter: SfxFilterMatcher aMatcher( SwDocShell::Factory().GetFactoryName() ); diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx index a670ff8eb7a0..4419abf03cf2 100644 --- a/sw/source/uibase/app/docshini.cxx +++ b/sw/source/uibase/app/docshini.cxx @@ -522,7 +522,7 @@ bool SwDocShell::Load( SfxMedium& rMedium ) } SwWait aWait( *this, true ); - sal_uInt32 nErr = ERR_SWG_READ_ERROR; + ErrCode nErr = ERR_SWG_READ_ERROR; switch( GetCreateMode() ) { case SfxObjectCreateMode::ORGANIZER: @@ -582,7 +582,7 @@ bool SwDocShell::Load( SfxMedium& rMedium ) InitDrawModelAndDocShell(this, m_pDoc ? m_pDoc->getIDocumentDrawModelAccess().GetDrawModel() : nullptr); SetError(nErr); - bRet = !IsError( nErr ); + bRet = !nErr.IsError(); if (bRet && !m_pDoc->IsInLoadAsynchron() && GetCreateMode() == SfxObjectCreateMode::STANDARD) @@ -606,7 +606,7 @@ bool SwDocShell::LoadFrom( SfxMedium& rMedium ) AddLink(); // set Link and update Data!! do { // middle check loop - sal_uInt32 nErr = ERR_SWG_READ_ERROR; + ErrCode nErr = ERR_SWG_READ_ERROR; OUString aStreamName = "styles.xml"; uno::Reference < container::XNameAccess > xAccess( rMedium.GetStorage(), uno::UNO_QUERY ); if ( xAccess->hasByName( aStreamName ) && rMedium.GetStorage()->isStreamElement( aStreamName ) ) @@ -631,7 +631,7 @@ bool SwDocShell::LoadFrom( SfxMedium& rMedium ) } SetError(nErr); - bRet = !IsError( nErr ); + bRet = !nErr.IsError(); } while( false ); diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx index 9b5c6f6debb5..e9b4cb53b571 100644 --- a/sw/source/uibase/app/swmodule.cxx +++ b/sw/source/uibase/app/swmodule.cxx @@ -170,8 +170,8 @@ SwModule::SwModule( SfxObjectFactory* pWebFact, pSwResMgr = GetResMgr(); SvxErrorHandler::ensure(); m_pErrorHandler = new SfxErrorHandler( RID_SW_ERRHDL, - ERRCODE_AREA_SW, - ERRCODE_AREA_SW_END, + ErrCode(ERRCODE_AREA_SW), + ErrCode(ERRCODE_AREA_SW_END), pSwResMgr ); m_pModuleConfig = new SwModuleOptions; diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx index 78293eca2a4d..0d024d7f02ec 100644 --- a/sw/source/uibase/dochdl/gloshdl.cxx +++ b/sw/source/uibase/dochdl/gloshdl.cxx @@ -222,11 +222,11 @@ bool SwGlossaryHdl::CopyOrMove( const OUString& rSourceGroupName, OUString& rSou //The index must be determined here because rSourceShortName maybe changed in CopyBlock sal_uInt16 nDeleteIdx = pSourceGroup->GetIndex( rSourceShortName ); OSL_ENSURE(USHRT_MAX != nDeleteIdx, "entry not found"); - sal_uLong nRet = pSourceGroup->CopyBlock( *pDestGroup, rSourceShortName, rLongName ); + ErrCode nRet = pSourceGroup->CopyBlock( *pDestGroup, rSourceShortName, rLongName ); if(!nRet && bMove) { // the index must be existing - nRet = pSourceGroup->Delete( nDeleteIdx ) ? 0 : 1; + nRet = pSourceGroup->Delete( nDeleteIdx ) ? ERRCODE_NONE : ErrCode(1); } delete pSourceGroup; delete pDestGroup; @@ -643,7 +643,7 @@ bool SwGlossaryHdl::Rename(const OUString& rOldShort, const OUString& rNewShortN (nOldIdx == USHRT_MAX || nOldIdx == nIdx )) { pGlossary->Rename( nIdx, &rNewShortName, &rNewName ); - bRet = pGlossary->GetError() == 0; + bRet = pGlossary->GetError() == ERRCODE_NONE; } if( !pCurGrp ) delete pGlossary; diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 94d9bb8296d2..8b1033b76bf3 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -751,7 +751,7 @@ bool SwTransferable::WriteObject( tools::SvRef<SotStorageStream>& xStream, #endif SwWriter aWrt( *xStream, *pDoc ); - if( !IsError( aWrt.Write( xWrt )) ) + if( ! aWrt.Write( xWrt ).IsError() ) { xStream->WriteChar( '\0' ); // terminate with a zero xStream->Commit(); @@ -1684,7 +1684,7 @@ bool SwTransferable::PasteFileContent( TransferableDataHelper& rData, const SwPosition& rInsPos = *rSh.GetCursor()->Start(); SwReader aReader( *pStream, aEmptyOUStr, OUString(), *rSh.GetCursor() ); rSh.SaveTableBoxContent( &rInsPos ); - if( IsError( aReader.Read( *pRead )) ) + if( aReader.Read( *pRead ).IsError() ) nResId = STR_ERROR_CLPBRD_READ; else { @@ -1776,7 +1776,7 @@ bool SwTransferable::PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh, { SwPaM &rPAM = *rSh.GetCursor(); SwReader aReader( xStore, aEmptyOUStr, rPAM ); - if( !IsError( aReader.Read( *pRead )) ) + if( ! aReader.Read( *pRead ).IsError() ) bRet = true; else if( bMsg ) ScopedVclPtrInstance<MessageDialog>(nullptr, SwResId(STR_ERROR_CLPBRD_READ), VclMessageType::Info)->Execute(); diff --git a/sw/source/uibase/misc/glosdoc.cxx b/sw/source/uibase/misc/glosdoc.cxx index cc7fe903235d..53ea0b2e932a 100644 --- a/sw/source/uibase/misc/glosdoc.cxx +++ b/sw/source/uibase/misc/glosdoc.cxx @@ -293,7 +293,7 @@ SwTextBlocks* SwGlossaries::GetGlosDoc( const OUString &rName, bool bCreate ) co if( pTmp->GetError() ) { ErrorHandler::HandleError( pTmp->GetError() ); - bOk = !IsError( pTmp->GetError() ); + bOk = ! pTmp->GetError().IsError(); } if( bOk && pTmp->GetName().isEmpty() ) @@ -419,7 +419,7 @@ void SwGlossaries::UpdateGlosPath(bool bFull) void SwGlossaries::ShowError() { - sal_uInt32 nPathError = *new StringErrorInfo(ERR_AUTOPATH_ERROR, + ErrCode nPathError = *new StringErrorInfo(ERR_AUTOPATH_ERROR, lcl_makePath(m_aInvalidPaths), DialogMask::ButtonsOk ); ErrorHandler::HandleError( nPathError ); } diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx index 350181edf917..8a9b33502201 100644 --- a/sw/source/uibase/shells/drawsh.cxx +++ b/sw/source/uibase/shells/drawsh.cxx @@ -129,7 +129,7 @@ void SwDrawShell::InsertPictureFromFile(SdrObject& rObject) if(ERRCODE_NONE == aDlg.Execute()) { Graphic aGraphic; - int nError(aDlg.GetGraphic(aGraphic)); + ErrCode nError = aDlg.GetGraphic(aGraphic); if(ERRCODE_NONE == nError) { diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx index afbf0cf24e29..0dd88e045083 100644 --- a/sw/source/uibase/uiview/srcview.cxx +++ b/sw/source/uibase/uiview/srcview.cxx @@ -825,7 +825,7 @@ void SwSrcView::Load(SwDocShell* pDocShell) const OUString sWriteName = pDocShell->HasName() ? pMedium->GetName() : sFileURL; - sal_uLong nRes = aWriter.Write(xWriter, &sWriteName); + ErrCode nRes = aWriter.Write(xWriter, &sWriteName); if(nRes) { ErrorHandler::HandleError(ErrCode(nRes)); diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 1fc001e2830d..2250d4985c2d 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -468,27 +468,18 @@ bool SwView::InsertGraphicDlg( SfxRequest& rReq ) } sal_uInt32 nResId(0); - switch( nError ) - { - case ERRCODE_GRFILTER_OPENERROR: - nResId = STR_GRFILTER_OPENERROR; - break; - case ERRCODE_GRFILTER_IOERROR: - nResId = STR_GRFILTER_IOERROR; - break; - case ERRCODE_GRFILTER_FORMATERROR: - nResId = STR_GRFILTER_FORMATERROR; - break; - case ERRCODE_GRFILTER_VERSIONERROR: - nResId = STR_GRFILTER_VERSIONERROR; - break; - case ERRCODE_GRFILTER_FILTERERROR: - nResId = STR_GRFILTER_FILTERERROR; - break; - case ERRCODE_GRFILTER_TOOBIG: - nResId = STR_GRFILTER_TOOBIG; - break; - } + if( nError == ERRCODE_GRFILTER_OPENERROR ) + nResId = STR_GRFILTER_OPENERROR; + else if( nError == ERRCODE_GRFILTER_IOERROR ) + nResId = STR_GRFILTER_IOERROR; + else if( nError ==ERRCODE_GRFILTER_FORMATERROR ) + nResId = STR_GRFILTER_FORMATERROR; + else if( nError ==ERRCODE_GRFILTER_VERSIONERROR ) + nResId = STR_GRFILTER_VERSIONERROR; + else if( nError ==ERRCODE_GRFILTER_FILTERERROR ) + nResId = STR_GRFILTER_FILTERERROR; + else if( nError ==ERRCODE_GRFILTER_TOOBIG ) + nResId = STR_GRFILTER_TOOBIG; rSh.EndAction(); rSh.UnlockPaint(); @@ -2156,7 +2147,7 @@ long SwView::InsertMedium( sal_uInt16 nSlotId, SfxMedium* pMedium, sal_Int16 nVe SfxObjectShellRef aRef( pDocSh ); - sal_uInt32 nError = SfxObjectShell::HandleFilter( pMedium, pDocSh ); + ErrCode nError = SfxObjectShell::HandleFilter( pMedium, pDocSh ); // #i16722# aborted? if(nError != ERRCODE_NONE) { @@ -2176,7 +2167,7 @@ long SwView::InsertMedium( sal_uInt16 nSlotId, SfxMedium* pMedium, sal_Int16 nVe SwDoc *pDoc = pDocSh->GetDoc(); if( pRead && pDocSh->GetDoc() ) nUndoCheck = lcl_PageDescWithHeader( *pDoc ); - sal_uLong nErrno; + ErrCode nErrno; { //Scope for SwWait-Object, to be able to execute slots //outside this scope. SwWait aWait( *GetDocShell(), true ); @@ -2195,7 +2186,7 @@ long SwView::InsertMedium( sal_uInt16 nSlotId, SfxMedium* pMedium, sal_Int16 nVe SwXTextRange::CreateXTextRange(*pDoc, *m_pWrtShell->GetCursor()->GetPoint(), nullptr)); nErrno = pDocSh->ImportFrom(*pMedium, xInsertPosition) - ? 0 : ERR_SWG_READ_ERROR; + ? ERRCODE_NONE : ERR_SWG_READ_ERROR; } } @@ -2221,7 +2212,7 @@ long SwView::InsertMedium( sal_uInt16 nSlotId, SfxMedium* pMedium, sal_Int16 nVe if( nErrno ) { ErrorHandler::HandleError( nErrno ); - nFound = IsError( nErrno ) ? -1 : 0; + nFound = nErrno.IsError() ? -1 : 0; } else nFound = 0; diff --git a/test/source/screenshot_test.cxx b/test/source/screenshot_test.cxx index 84275b5f34d5..4e9e3723641f 100644 --- a/test/source/screenshot_test.cxx +++ b/test/source/screenshot_test.cxx @@ -74,7 +74,7 @@ void ScreenshotTest::implSaveScreenshot(const Bitmap& rScreenshot, const OString OUString aFullPath = m_directories.getPathFromWorkdir(OUStringToOString(aDirname + "/" + aBasename + ".png",RTL_TEXTENCODING_UTF8).getStr()); SvFileStream aNew(aFullPath, StreamMode::WRITE | StreamMode::TRUNC); - CPPUNIT_ASSERT_MESSAGE(OUStringToOString("Failed to open " + OUString::number(aNew.GetErrorCode()), RTL_TEXTENCODING_UTF8).getStr(), aNew.IsOpen()); + CPPUNIT_ASSERT_MESSAGE(OUStringToOString("Failed to open " + OUString::number(sal_uInt32(aNew.GetErrorCode())), RTL_TEXTENCODING_UTF8).getStr(), aNew.IsOpen()); vcl::PNGWriter aPNGWriter(rScreenshot); aPNGWriter.Write(aNew); diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index a91e6bf16341..871d8f69b5ac 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -373,7 +373,7 @@ void SvStream::ClearError() m_nError = ERRCODE_NONE; } -void SvStream::SetError( sal_uInt32 nErrorCode ) +void SvStream::SetError( ErrCode nErrorCode ) { if (m_nError == ERRCODE_NONE) m_nError = nErrorCode; @@ -1552,7 +1552,7 @@ bool SvStream::SetStreamSize(sal_uInt64 const nSize) #ifdef DBG_UTIL DBG_ASSERT(Tell()==nFPos,"SetStreamSize failed"); #endif - return (m_nError == 0); + return (m_nError == ERRCODE_NONE); } SvStream& endl( SvStream& rStr ) diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx index bb5d3de9fff7..d3f79e6c3712 100644 --- a/tools/source/stream/strmunx.cxx +++ b/tools/source/stream/strmunx.cxx @@ -177,9 +177,9 @@ public: StreamData() : rHandle( nullptr ) { } }; -static sal_uInt32 GetSvError( int nErrno ) +static ErrCode GetSvError( int nErrno ) { - static struct { int nErr; sal_uInt32 sv; } errArr[] = + static struct { int nErr; ErrCode sv; } errArr[] = { { 0, ERRCODE_NONE }, { EACCES, SVSTREAM_ACCESS_DENIED }, @@ -214,7 +214,7 @@ static sal_uInt32 GetSvError( int nErrno ) { (int)0xFFFF, SVSTREAM_GENERALERROR } }; - sal_uInt32 nRetVal = SVSTREAM_GENERALERROR; // default error + ErrCode nRetVal = SVSTREAM_GENERALERROR; // default error int i=0; do { @@ -229,9 +229,9 @@ static sal_uInt32 GetSvError( int nErrno ) return nRetVal; } -static sal_uInt32 GetSvError( oslFileError nErrno ) +static ErrCode GetSvError( oslFileError nErrno ) { - static struct { oslFileError nErr; sal_uInt32 sv; } errArr[] = + static struct { oslFileError nErr; ErrCode sv; } errArr[] = { { osl_File_E_None, ERRCODE_NONE }, { osl_File_E_ACCES, SVSTREAM_ACCESS_DENIED }, @@ -254,7 +254,7 @@ static sal_uInt32 GetSvError( oslFileError nErrno ) { (oslFileError)0xFFFF, SVSTREAM_GENERALERROR } }; - sal_uInt32 nRetVal = SVSTREAM_GENERALERROR; // default error + ErrCode nRetVal = SVSTREAM_GENERALERROR; // default error int i=0; do { diff --git a/tools/source/stream/strmwnt.cxx b/tools/source/stream/strmwnt.cxx index cfd84f39d7bc..5b7009eda1a5 100644 --- a/tools/source/stream/strmwnt.cxx +++ b/tools/source/stream/strmwnt.cxx @@ -44,9 +44,9 @@ public: } }; -static std::size_t GetSvError( DWORD nWntError ) +static ErrCode GetSvError( DWORD nWntError ) { - static struct { DWORD wnt; std::size_t sv; } errArr[] = + static struct { DWORD wnt; ErrCode sv; } errArr[] = { { ERROR_SUCCESS, ERRCODE_NONE }, { ERROR_ACCESS_DENIED, SVSTREAM_ACCESS_DENIED }, @@ -86,7 +86,7 @@ static std::size_t GetSvError( DWORD nWntError ) { (DWORD)0xFFFFFFFF, SVSTREAM_GENERALERROR } }; - std::size_t nRetVal = SVSTREAM_GENERALERROR; // default error + ErrCode nRetVal = SVSTREAM_GENERALERROR; // default error int i=0; do { @@ -339,7 +339,7 @@ void SvFileStream::Open( const OUString& rFilename, StreamMode nMode ) if( (pInstanceData->hFile==INVALID_HANDLE_VALUE) && (nAccessMode & GENERIC_WRITE)) { - std::size_t nErr = ::GetSvError( GetLastError() ); + ErrCode nErr = ::GetSvError( GetLastError() ); if(nErr==SVSTREAM_ACCESS_DENIED || nErr==SVSTREAM_SHARING_VIOLATION) { nMode &= (~StreamMode::WRITE); diff --git a/uui/source/iahndl-errorhandler.cxx b/uui/source/iahndl-errorhandler.cxx index 5c0c389607f1..72236f972f25 100644 --- a/uui/source/iahndl-errorhandler.cxx +++ b/uui/source/iahndl-errorhandler.cxx @@ -156,11 +156,11 @@ UUIInteractionHelper::handleErrorHandlerRequest( = { RID_ERRHDL, RID_SVXERRCODE, RID_UUI_ERRHDL }; - ErrCode nErrorId = nErrorCode & ~ERRCODE_WARNING_MASK; - Source eSource = nErrorId < ERRCODE_AREA_LIB1 ? + ErrCode nErrorId = nErrorCode.IgnoreWarning(); + Source eSource = nErrorId < ErrCode(ERRCODE_AREA_LIB1) ? SOURCE_DEFAULT : - nErrorId >= ERRCODE_AREA_SVX - && nErrorId <= ERRCODE_AREA_SVX_END ? + nErrorId >= ErrCode(ERRCODE_AREA_SVX) + && nErrorId <= ErrCode(ERRCODE_AREA_SVX_END) ? SOURCE_SVX : SOURCE_UUI; diff --git a/uui/source/iahndl-ssl.cxx b/uui/source/iahndl-ssl.cxx index c3b48ed0d19d..6ace40b53192 100644 --- a/uui/source/iahndl-ssl.cxx +++ b/uui/source/iahndl-ssl.cxx @@ -220,7 +220,7 @@ executeSSLWarnDialog( { ResId aResId(RID_UUI_ERRHDL, *xManager.get()); if (ErrorResource(aResId).getString( - ERRCODE_AREA_UUI_UNKNOWNAUTH + failure + DESCRIPTION_1, + ErrCode(sal_uInt32(ERRCODE_AREA_UUI_UNKNOWNAUTH) + failure + DESCRIPTION_1), aMessage_1)) { aMessage_1 = UUIInteractionHelper::replaceMessageWithArguments( @@ -230,7 +230,7 @@ executeSSLWarnDialog( OUString aTitle; if (ErrorResource(aResId).getString( - ERRCODE_AREA_UUI_UNKNOWNAUTH + failure + TITLE, aTitle)) + ErrCode(sal_uInt32(ERRCODE_AREA_UUI_UNKNOWNAUTH) + failure + TITLE), aTitle)) { xDialog->SetText(aTitle); } diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index 2fa698b14ea7..6febfae49664 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -486,7 +486,7 @@ UUIInteractionHelper::handleRequest_impl( { std::vector< OUString > aArguments; handleErrorHandlerRequest( aAppException.Classification, - aAppException.Code, + ErrCode(aAppException.Code), aArguments, rRequest->getContinuations(), bObtainErrorStringOnly, @@ -725,7 +725,7 @@ UUIInteractionHelper::handleRequest_impl( task::ErrorCodeRequest aErrorCodeRequest; if (aAnyRequest >>= aErrorCodeRequest) { - handleGenericErrorRequest( aErrorCodeRequest.ErrCode, + handleGenericErrorRequest( ErrCode(aErrorCodeRequest.ErrCode), rRequest->getContinuations(), bObtainErrorStringOnly, bHasErrorString, @@ -736,7 +736,7 @@ UUIInteractionHelper::handleRequest_impl( task::ErrorCodeIOException aErrorCodeIOException; if (aAnyRequest >>= aErrorCodeIOException) { - handleGenericErrorRequest( aErrorCodeIOException.ErrCode, + handleGenericErrorRequest( ErrCode(aErrorCodeIOException.ErrCode), rRequest->getContinuations(), bObtainErrorStringOnly, bHasErrorString, @@ -1075,7 +1075,7 @@ UUIInteractionHelper::handleNameClashResolveRequest( void UUIInteractionHelper::handleGenericErrorRequest( - sal_Int32 nErrorCode, + ErrCode nErrorCode, uno::Sequence< uno::Reference< task::XInteractionContinuation > > const & rContinuations, bool bObtainErrorStringOnly, @@ -1101,8 +1101,8 @@ UUIInteractionHelper::handleGenericErrorRequest( // Note: It's important to convert the transported long to the // required unsigned long value. Otherwhise using as flag field // can fail ... - ErrCode nError = static_cast< ErrCode >(nErrorCode); - bool bWarning = !ERRCODE_TOERROR(nError); + ErrCode nError(nErrorCode); + bool bWarning = !nError.IgnoreWarning(); if ( nError == ERRCODE_SFX_INCOMPLETE_ENCRYPTION ) { @@ -1274,7 +1274,7 @@ bool ErrorResource::getString(ErrCode nErrorCode, OUString &rString) const { - sal_uInt32 nIdx = m_aStringArray.FindIndex(nErrorCode & ERRCODE_RES_MASK); + sal_uInt32 nIdx = m_aStringArray.FindIndex(nErrorCode.GetRest()); if (nIdx == RESARRAY_INDEX_NOTFOUND) return false; rString = m_aStringArray.GetString(nIdx); diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx index 87c662766ea1..558951b3ef90 100644 --- a/uui/source/iahndl.hxx +++ b/uui/source/iahndl.hxx @@ -199,7 +199,7 @@ private: void handleGenericErrorRequest( - sal_Int32 nErrorCode, + ErrCode nErrorCode, css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > const & rContinuations, bool bObtainErrorStringOnly, diff --git a/uui/source/ids.hrc b/uui/source/ids.hrc index 635c708d3d8c..d019907c8d65 100644 --- a/uui/source/ids.hrc +++ b/uui/source/ids.hrc @@ -71,76 +71,76 @@ #define STR_TITLE_ENTER_PASSWORD (RID_UUI_START + 65) #define STR_PASSWORD_MISMATCH (RID_UUI_START + 66) -#define ERRCODE_UUI_IO_ABORT (ERRCODE_AREA_UUI + 0) -#define ERRCODE_UUI_IO_ACCESSDENIED (ERRCODE_AREA_UUI + 1) -#define ERRCODE_UUI_IO_ALREADYEXISTS (ERRCODE_AREA_UUI + 2) -#define ERRCODE_UUI_IO_BADCRC (ERRCODE_AREA_UUI + 3) -#define ERRCODE_UUI_IO_CANTCREATE (ERRCODE_AREA_UUI + 4) -#define ERRCODE_UUI_IO_CANTREAD (ERRCODE_AREA_UUI + 5) -#define ERRCODE_UUI_IO_CANTSEEK (ERRCODE_AREA_UUI + 6) -#define ERRCODE_UUI_IO_CANTTELL (ERRCODE_AREA_UUI + 7) -#define ERRCODE_UUI_IO_CANTWRITE (ERRCODE_AREA_UUI + 8) -#define ERRCODE_UUI_IO_CURRENTDIR (ERRCODE_AREA_UUI + 9) -#define ERRCODE_UUI_IO_NOTREADY (ERRCODE_AREA_UUI + 10) -#define ERRCODE_UUI_IO_NOTSAMEDEVICE (ERRCODE_AREA_UUI + 11) -#define ERRCODE_UUI_IO_GENERAL (ERRCODE_AREA_UUI + 12) -#define ERRCODE_UUI_IO_INVALIDACCESS (ERRCODE_AREA_UUI + 13) -#define ERRCODE_UUI_IO_INVALIDCHAR (ERRCODE_AREA_UUI + 14) -#define ERRCODE_UUI_IO_INVALIDDEVICE (ERRCODE_AREA_UUI + 15) -#define ERRCODE_UUI_IO_INVALIDLENGTH (ERRCODE_AREA_UUI + 16) -#define ERRCODE_UUI_IO_INVALIDPARAMETER (ERRCODE_AREA_UUI + 17) -#define ERRCODE_UUI_IO_ISWILDCARD (ERRCODE_AREA_UUI + 18) -#define ERRCODE_UUI_IO_LOCKVIOLATION (ERRCODE_AREA_UUI + 19) -#define ERRCODE_UUI_IO_MISPLACEDCHAR (ERRCODE_AREA_UUI + 20) -#define ERRCODE_UUI_IO_NAMETOOLONG (ERRCODE_AREA_UUI + 21) -#define ERRCODE_UUI_IO_NOTEXISTS (ERRCODE_AREA_UUI + 22) -#define ERRCODE_UUI_IO_NOTEXISTSPATH (ERRCODE_AREA_UUI + 23) -#define ERRCODE_UUI_IO_NOTSUPPORTED (ERRCODE_AREA_UUI + 24) -#define ERRCODE_UUI_IO_NOTADIRECTORY (ERRCODE_AREA_UUI + 25) -#define ERRCODE_UUI_IO_NOTAFILE (ERRCODE_AREA_UUI + 26) -#define ERRCODE_UUI_IO_OUTOFSPACE (ERRCODE_AREA_UUI + 27) -#define ERRCODE_UUI_IO_TOOMANYOPENFILES (ERRCODE_AREA_UUI + 28) -#define ERRCODE_UUI_IO_OUTOFMEMORY (ERRCODE_AREA_UUI + 29) -#define ERRCODE_UUI_IO_PENDING (ERRCODE_AREA_UUI + 30) -#define ERRCODE_UUI_IO_RECURSIVE (ERRCODE_AREA_UUI + 31) -#define ERRCODE_UUI_IO_UNKNOWN (ERRCODE_AREA_UUI + 32) -#define ERRCODE_UUI_IO_WRITEPROTECTED (ERRCODE_AREA_UUI + 33) -#define ERRCODE_UUI_IO_WRONGFORMAT (ERRCODE_AREA_UUI + 34) -#define ERRCODE_UUI_IO_WRONGVERSION (ERRCODE_AREA_UUI + 35) -#define ERRCODE_UUI_IO_NOTEXISTS_VOLUME (ERRCODE_AREA_UUI + 36) -#define ERRCODE_UUI_IO_NOTEXISTS_FOLDER (ERRCODE_AREA_UUI + 37) -#define ERRCODE_UUI_WRONGJAVA (ERRCODE_AREA_UUI + 38) -#define ERRCODE_UUI_WRONGJAVA_VERSION (ERRCODE_AREA_UUI + 39) -#define ERRCODE_UUI_WRONGJAVA_MIN (ERRCODE_AREA_UUI + 40) -#define ERRCODE_UUI_WRONGJAVA_VERSION_MIN (ERRCODE_AREA_UUI + 41) -#define ERRCODE_UUI_BADPARTNERSHIP (ERRCODE_AREA_UUI + 42) -#define ERRCODE_UUI_BADPARTNERSHIP_NAME (ERRCODE_AREA_UUI + 43) -#define ERRCODE_UUI_IO_NOTREADY_VOLUME (ERRCODE_AREA_UUI + 44) -#define ERRCODE_UUI_IO_NOTREADY_REMOVABLE (ERRCODE_AREA_UUI + 45) -#define ERRCODE_UUI_IO_NOTREADY_VOLUME_REMOVABLE (ERRCODE_AREA_UUI + 46) -#define ERRCODE_UUI_WRONGMEDIUM (ERRCODE_AREA_UUI + 47) -#define ERRCODE_UUI_IO_CANTCREATE_NONAME (ERRCODE_AREA_UUI + 48) -#define ERRCODE_UUI_IO_TARGETALREADYEXISTS (ERRCODE_AREA_UUI + 49) -#define ERRCODE_UUI_IO_UNSUPPORTEDOVERWRITE (ERRCODE_AREA_UUI + 50) -#define ERRCODE_UUI_IO_BROKENPACKAGE (ERRCODE_AREA_UUI + 51) -#define ERRCODE_UUI_IO_BROKENPACKAGE_CANTREPAIR (ERRCODE_AREA_UUI + 52) -#define ERRCODE_UUI_CONFIGURATION_BROKENDATA_NOREMOVE (ERRCODE_AREA_UUI + 53) -#define ERRCODE_UUI_CONFIGURATION_BROKENDATA_WITHREMOVE (ERRCODE_AREA_UUI + 54) -#define ERRCODE_UUI_CONFIGURATION_BACKENDMISSING (ERRCODE_AREA_UUI + 55) -#define ERRCODE_UUI_CONFIGURATION_BACKENDMISSING_WITHRECOVER (ERRCODE_AREA_UUI + 56) -#define ERRCODE_UUI_INVALID_XFORMS_SUBMISSION_DATA (ERRCODE_AREA_UUI + 57) -#define ERRCODE_UUI_IO_MODULESIZEEXCEEDED (ERRCODE_AREA_UUI + 58) -#define ERRCODE_UUI_LOCKING_LOCKED (ERRCODE_AREA_UUI + 59) -#define ERRCODE_UUI_LOCKING_LOCKED_SELF (ERRCODE_AREA_UUI + 60) -#define ERRCODE_UUI_LOCKING_NOT_LOCKED (ERRCODE_AREA_UUI + 61) -#define ERRCODE_UUI_LOCKING_LOCK_EXPIRED (ERRCODE_AREA_UUI + 62) -#define ERRCODE_UUI_CANNOT_ACTIVATE_FACTORY (ERRCODE_AREA_UUI + 63) +#define ERRCODE_UUI_IO_ABORT ErrCode(ERRCODE_AREA_UUI + 0) +#define ERRCODE_UUI_IO_ACCESSDENIED ErrCode(ERRCODE_AREA_UUI + 1) +#define ERRCODE_UUI_IO_ALREADYEXISTS ErrCode(ERRCODE_AREA_UUI + 2) +#define ERRCODE_UUI_IO_BADCRC ErrCode(ERRCODE_AREA_UUI + 3) +#define ERRCODE_UUI_IO_CANTCREATE ErrCode(ERRCODE_AREA_UUI + 4) +#define ERRCODE_UUI_IO_CANTREAD ErrCode(ERRCODE_AREA_UUI + 5) +#define ERRCODE_UUI_IO_CANTSEEK ErrCode(ERRCODE_AREA_UUI + 6) +#define ERRCODE_UUI_IO_CANTTELL ErrCode(ERRCODE_AREA_UUI + 7) +#define ERRCODE_UUI_IO_CANTWRITE ErrCode(ERRCODE_AREA_UUI + 8) +#define ERRCODE_UUI_IO_CURRENTDIR ErrCode(ERRCODE_AREA_UUI + 9) +#define ERRCODE_UUI_IO_NOTREADY ErrCode(ERRCODE_AREA_UUI + 10) +#define ERRCODE_UUI_IO_NOTSAMEDEVICE ErrCode(ERRCODE_AREA_UUI + 11) +#define ERRCODE_UUI_IO_GENERAL ErrCode(ERRCODE_AREA_UUI + 12) +#define ERRCODE_UUI_IO_INVALIDACCESS ErrCode(ERRCODE_AREA_UUI + 13) +#define ERRCODE_UUI_IO_INVALIDCHAR ErrCode(ERRCODE_AREA_UUI + 14) +#define ERRCODE_UUI_IO_INVALIDDEVICE ErrCode(ERRCODE_AREA_UUI + 15) +#define ERRCODE_UUI_IO_INVALIDLENGTH ErrCode(ERRCODE_AREA_UUI + 16) +#define ERRCODE_UUI_IO_INVALIDPARAMETER ErrCode(ERRCODE_AREA_UUI + 17) +#define ERRCODE_UUI_IO_ISWILDCARD ErrCode(ERRCODE_AREA_UUI + 18) +#define ERRCODE_UUI_IO_LOCKVIOLATION ErrCode(ERRCODE_AREA_UUI + 19) +#define ERRCODE_UUI_IO_MISPLACEDCHAR ErrCode(ERRCODE_AREA_UUI + 20) +#define ERRCODE_UUI_IO_NAMETOOLONG ErrCode(ERRCODE_AREA_UUI + 21) +#define ERRCODE_UUI_IO_NOTEXISTS ErrCode(ERRCODE_AREA_UUI + 22) +#define ERRCODE_UUI_IO_NOTEXISTSPATH ErrCode(ERRCODE_AREA_UUI + 23) +#define ERRCODE_UUI_IO_NOTSUPPORTED ErrCode(ERRCODE_AREA_UUI + 24) +#define ERRCODE_UUI_IO_NOTADIRECTORY ErrCode(ERRCODE_AREA_UUI + 25) +#define ERRCODE_UUI_IO_NOTAFILE ErrCode(ERRCODE_AREA_UUI + 26) +#define ERRCODE_UUI_IO_OUTOFSPACE ErrCode(ERRCODE_AREA_UUI + 27) +#define ERRCODE_UUI_IO_TOOMANYOPENFILES ErrCode(ERRCODE_AREA_UUI + 28) +#define ERRCODE_UUI_IO_OUTOFMEMORY ErrCode(ERRCODE_AREA_UUI + 29) +#define ERRCODE_UUI_IO_PENDING ErrCode(ERRCODE_AREA_UUI + 30) +#define ERRCODE_UUI_IO_RECURSIVE ErrCode(ERRCODE_AREA_UUI + 31) +#define ERRCODE_UUI_IO_UNKNOWN ErrCode(ERRCODE_AREA_UUI + 32) +#define ERRCODE_UUI_IO_WRITEPROTECTED ErrCode(ERRCODE_AREA_UUI + 33) +#define ERRCODE_UUI_IO_WRONGFORMAT ErrCode(ERRCODE_AREA_UUI + 34) +#define ERRCODE_UUI_IO_WRONGVERSION ErrCode(ERRCODE_AREA_UUI + 35) +#define ERRCODE_UUI_IO_NOTEXISTS_VOLUME ErrCode(ERRCODE_AREA_UUI + 36) +#define ERRCODE_UUI_IO_NOTEXISTS_FOLDER ErrCode(ERRCODE_AREA_UUI + 37) +#define ERRCODE_UUI_WRONGJAVA ErrCode(ERRCODE_AREA_UUI + 38) +#define ERRCODE_UUI_WRONGJAVA_VERSION ErrCode(ERRCODE_AREA_UUI + 39) +#define ERRCODE_UUI_WRONGJAVA_MIN ErrCode(ERRCODE_AREA_UUI + 40) +#define ERRCODE_UUI_WRONGJAVA_VERSION_MIN ErrCode(ERRCODE_AREA_UUI + 41) +#define ERRCODE_UUI_BADPARTNERSHIP ErrCode(ERRCODE_AREA_UUI + 42) +#define ERRCODE_UUI_BADPARTNERSHIP_NAME ErrCode(ERRCODE_AREA_UUI + 43) +#define ERRCODE_UUI_IO_NOTREADY_VOLUME ErrCode(ERRCODE_AREA_UUI + 44) +#define ERRCODE_UUI_IO_NOTREADY_REMOVABLE ErrCode(ERRCODE_AREA_UUI + 45) +#define ERRCODE_UUI_IO_NOTREADY_VOLUME_REMOVABLE ErrCode(ERRCODE_AREA_UUI + 46) +#define ERRCODE_UUI_WRONGMEDIUM ErrCode(ERRCODE_AREA_UUI + 47) +#define ERRCODE_UUI_IO_CANTCREATE_NONAME ErrCode(ERRCODE_AREA_UUI + 48) +#define ERRCODE_UUI_IO_TARGETALREADYEXISTS ErrCode(ERRCODE_AREA_UUI + 49) +#define ERRCODE_UUI_IO_UNSUPPORTEDOVERWRITE ErrCode(ERRCODE_AREA_UUI + 50) +#define ERRCODE_UUI_IO_BROKENPACKAGE ErrCode(ERRCODE_AREA_UUI + 51) +#define ERRCODE_UUI_IO_BROKENPACKAGE_CANTREPAIR ErrCode(ERRCODE_AREA_UUI + 52) +#define ERRCODE_UUI_CONFIGURATION_BROKENDATA_NOREMOVE ErrCode(ERRCODE_AREA_UUI + 53) +#define ERRCODE_UUI_CONFIGURATION_BROKENDATA_WITHREMOVE ErrCode(ERRCODE_AREA_UUI + 54) +#define ERRCODE_UUI_CONFIGURATION_BACKENDMISSING ErrCode(ERRCODE_AREA_UUI + 55) +#define ERRCODE_UUI_CONFIGURATION_BACKENDMISSING_WITHRECOVER ErrCode(ERRCODE_AREA_UUI + 56) +#define ERRCODE_UUI_INVALID_XFORMS_SUBMISSION_DATA ErrCode(ERRCODE_AREA_UUI + 57) +#define ERRCODE_UUI_IO_MODULESIZEEXCEEDED ErrCode(ERRCODE_AREA_UUI + 58) +#define ERRCODE_UUI_LOCKING_LOCKED ErrCode(ERRCODE_AREA_UUI + 59) +#define ERRCODE_UUI_LOCKING_LOCKED_SELF ErrCode(ERRCODE_AREA_UUI + 60) +#define ERRCODE_UUI_LOCKING_NOT_LOCKED ErrCode(ERRCODE_AREA_UUI + 61) +#define ERRCODE_UUI_LOCKING_LOCK_EXPIRED ErrCode(ERRCODE_AREA_UUI + 62) +#define ERRCODE_UUI_CANNOT_ACTIVATE_FACTORY ErrCode(ERRCODE_AREA_UUI + 63) #define ERRCODE_AREA_UUI_UNKNOWNAUTH 25000 #define SSLWARN_TYPE_DOMAINMISMATCH 10 #define SSLWARN_TYPE_EXPIRED 20 #define SSLWARN_TYPE_INVALID 30 -#define ERRCODE_UUI_UNKNOWNAUTH_UNTRUSTED (ERRCODE_AREA_UUI_UNKNOWNAUTH + 1) +#define ERRCODE_UUI_UNKNOWNAUTH_UNTRUSTED ErrCode(ERRCODE_AREA_UUI_UNKNOWNAUTH + 1) #define ERRCODE_UUI_SSLWARN_EXPIRED_1 (ERRCODE_AREA_UUI_UNKNOWNAUTH + SSLWARN_TYPE_EXPIRED + 1) #define TITLE_UUI_SSLWARN_EXPIRED (ERRCODE_AREA_UUI_UNKNOWNAUTH + SSLWARN_TYPE_EXPIRED + 3) diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index 31549918acfe..5f84f7a89e1c 100644 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -1043,13 +1043,13 @@ void ShapeHelper::setTop(double _fTop) xShape->setPosition(aPoint); } -void DebugHelper::basicexception( const css::uno::Exception& ex, int err, const OUString& /*additionalArgument*/ ) +void DebugHelper::basicexception( const css::uno::Exception& ex, ErrCode err, const OUString& /*additionalArgument*/ ) { // #TODO #FIXME ( do we want to support additionalArg here ) - throw css::script::BasicErrorException( ex.Message, css::uno::Reference< css::uno::XInterface >(), err, OUString() ); + throw css::script::BasicErrorException( ex.Message, css::uno::Reference< css::uno::XInterface >(), sal_uInt32(err), OUString() ); } -void DebugHelper::basicexception( int err, const OUString& additionalArgument ) +void DebugHelper::basicexception( ErrCode err, const OUString& additionalArgument ) { basicexception( css::uno::Exception(), err, additionalArgument ); } @@ -1059,10 +1059,10 @@ void DebugHelper::basicexception( const css::uno::Exception& ex ) basicexception( ex, ERRCODE_BASIC_INTERNAL_ERROR, OUString() ); } -void DebugHelper::runtimeexception( int err ) +void DebugHelper::runtimeexception( ErrCode err ) { // #TODO #FIXME ( do we want to support additionalArg here ) - throw css::uno::RuntimeException( css::uno::Exception().Message + " " + OUString::number(err), + throw css::uno::RuntimeException( css::uno::Exception().Message + " " + OUString::number(sal_uInt32(err)), css::uno::Reference< css::uno::XInterface >() ); } 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) { } diff --git a/xmloff/inc/MetaExportComponent.hxx b/xmloff/inc/MetaExportComponent.hxx index 239f52ca67ce..34278d87631a 100644 --- a/xmloff/inc/MetaExportComponent.hxx +++ b/xmloff/inc/MetaExportComponent.hxx @@ -38,7 +38,7 @@ public: protected: // export the events off all autotexts - virtual sal_uInt32 exportDoc( + virtual ErrCode exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = xmloff::token::XML_TOKEN_INVALID ) override; // accept XDocumentProperties in addition to XModel diff --git a/xmloff/inc/SchXMLExport.hxx b/xmloff/inc/SchXMLExport.hxx index c06ad7ffedad..8792ea8acfc5 100644 --- a/xmloff/inc/SchXMLExport.hxx +++ b/xmloff/inc/SchXMLExport.hxx @@ -42,7 +42,7 @@ private: rtl::Reference<SchXMLExportHelper> maExportHelper; protected: - virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ) override; + virtual ErrCode exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ) override; virtual void ExportAutoStyles_() override; virtual void ExportMasterStyles_() override; diff --git a/xmloff/inc/xmlversion.hxx b/xmloff/inc/xmlversion.hxx index 8c33b306a28c..8feb0cb5cec2 100644 --- a/xmloff/inc/xmlversion.hxx +++ b/xmloff/inc/xmlversion.hxx @@ -43,7 +43,7 @@ public: const OUString &rFileName, css::uno::Reference< css::xml::sax::XDocumentHandler > &rHandler ); - sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ) override; + ErrCode exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ) override; void ExportAutoStyles_() override {} void ExportMasterStyles_ () override {} void ExportContent_() override {} diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index cec2ceeaf143..74ff16fb6d31 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -3527,7 +3527,7 @@ SchXMLExport::~SchXMLExport() } } -sal_uInt32 SchXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) +ErrCode SchXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) { maExportHelper->SetSourceShellID(GetSourceShellID()); maExportHelper->SetDestinationShellID(GetDestinationShellID()); diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index f139fafbea65..d4f396c963ae 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -1250,7 +1250,7 @@ void SvXMLExport::addChaffWhenEncryptedStorage() } } -sal_uInt32 SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) +ErrCode SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) { bool bOwnGraphicResolver = false; bool bOwnEmbeddedResolver = false; @@ -1452,7 +1452,7 @@ sal_uInt32 SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) xComp->dispose(); } - return 0; + return ERRCODE_NONE; } void SvXMLExport::ResetNamespaceMap() diff --git a/xmloff/source/meta/MetaExportComponent.cxx b/xmloff/source/meta/MetaExportComponent.cxx index cab4c928609c..1f939d99434d 100644 --- a/xmloff/source/meta/MetaExportComponent.cxx +++ b/xmloff/source/meta/MetaExportComponent.cxx @@ -69,7 +69,7 @@ void SAL_CALL XMLMetaExportComponent::setSourceDocument( const ::com::sun::star: } } -sal_uInt32 XMLMetaExportComponent::exportDoc( enum XMLTokenEnum ) +ErrCode XMLMetaExportComponent::exportDoc( enum XMLTokenEnum ) { uno::Reference< xml::sax::XDocumentHandler > xDocHandler = GetDocHandler(); @@ -155,7 +155,7 @@ sal_uInt32 XMLMetaExportComponent::exportDoc( enum XMLTokenEnum ) ExportMeta_(); } xDocHandler->endDocument(); - return 0; + return ERRCODE_NONE; } void XMLMetaExportComponent::ExportMeta_() diff --git a/xmloff/source/meta/xmlversion.cxx b/xmloff/source/meta/xmlversion.cxx index f71ee9c0ec87..7c66faac4e96 100644 --- a/xmloff/source/meta/xmlversion.cxx +++ b/xmloff/source/meta/xmlversion.cxx @@ -54,7 +54,7 @@ XMLVersionListExport::XMLVersionListExport( xmloff::token::GetXMLToken(xmloff::token::XML_N_VERSIONS_LIST), XML_NAMESPACE_FRAMEWORK ); } -sal_uInt32 XMLVersionListExport::exportDoc( enum ::xmloff::token::XMLTokenEnum ) +ErrCode XMLVersionListExport::exportDoc( enum ::xmloff::token::XMLTokenEnum ) { GetDocHandler()->startDocument(); @@ -96,7 +96,7 @@ sal_uInt32 XMLVersionListExport::exportDoc( enum ::xmloff::token::XMLTokenEnum ) } } GetDocHandler()->endDocument(); - return 0; + return ERRCODE_NONE; } XMLVersionListImport::XMLVersionListImport( diff --git a/xmloff/source/text/XMLAutoTextEventExport.cxx b/xmloff/source/text/XMLAutoTextEventExport.cxx index 2d409a48dca6..70d6ebf48a5e 100644 --- a/xmloff/source/text/XMLAutoTextEventExport.cxx +++ b/xmloff/source/text/XMLAutoTextEventExport.cxx @@ -99,7 +99,7 @@ void XMLAutoTextEventExport::initialize( } -sal_uInt32 XMLAutoTextEventExport::exportDoc( enum XMLTokenEnum ) +ErrCode XMLAutoTextEventExport::exportDoc( enum XMLTokenEnum ) { if( !(getExportFlags() & SvXMLExportFlags::OASIS) ) { @@ -149,7 +149,7 @@ sal_uInt32 XMLAutoTextEventExport::exportDoc( enum XMLTokenEnum ) GetDocHandler()->endDocument(); } - return 0; + return ERRCODE_NONE; } bool XMLAutoTextEventExport::hasEvents() diff --git a/xmloff/source/text/XMLAutoTextEventExport.hxx b/xmloff/source/text/XMLAutoTextEventExport.hxx index 014ce926ee28..bea57fd47ddc 100644 --- a/xmloff/source/text/XMLAutoTextEventExport.hxx +++ b/xmloff/source/text/XMLAutoTextEventExport.hxx @@ -63,7 +63,7 @@ public: protected: /// export the events off all autotexts - virtual sal_uInt32 exportDoc( + virtual ErrCode exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = xmloff::token::XML_TOKEN_INVALID ) override; /// does the document have any events ? |