diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-08 11:12:00 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-09 05:47:36 +0000 |
commit | bcad173faaffd3a3c1e6737d94d2108cf590338d (patch) | |
tree | 8370b2186548de7302eb9109ce6ac520ecf17c3b /tools | |
parent | afc755fa61cfd9645c4ed2507bdc3a06b721ed5c (diff) |
Reapply "create ErrorHandlerFlags scoped enum for error handling flags""
This effectively reverts commit 32cae6a2eaa41568888df9c8fc5605debd8d704a.
Change-Id: I15bb0a5c4acaeee6d47dd93a71601d9687d701bc
Reviewed-on: https://gerrit.libreoffice.org/34028
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/source/ref/errinf.cxx | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/tools/source/ref/errinf.cxx b/tools/source/ref/errinf.cxx index 4e205ec7d75f..04464a4f5e02 100644 --- a/tools/source/ref/errinf.cxx +++ b/tools/source/ref/errinf.cxx @@ -47,8 +47,8 @@ struct TheEDcrData: public rtl::Static<EDcrData, TheEDcrData> {}; class DynamicErrorInfo_Impl { - sal_uIntPtr lErrId; - sal_uInt16 nMask; + ErrCode lErrId; + ErrorHandlerFlags nMask; void RegisterEDcr(DynamicErrorInfo *); static void UnRegisterEDcr(DynamicErrorInfo const *); @@ -110,7 +110,7 @@ DynamicErrorInfo::operator sal_uIntPtr() const return pImpl->lErrId; } -DynamicErrorInfo::DynamicErrorInfo(sal_uIntPtr lArgUserId, sal_uInt16 nMask) +DynamicErrorInfo::DynamicErrorInfo(sal_uIntPtr lArgUserId, ErrorHandlerFlags nMask) : ErrorInfo(lArgUserId), pImpl(new DynamicErrorInfo_Impl) { @@ -133,13 +133,13 @@ ErrorInfo* DynamicErrorInfo_Impl::GetDynamicErrorInfo(sal_uIntPtr lId) return new ErrorInfo(lId & ~ERRCODE_DYNAMIC_MASK); } -sal_uInt16 DynamicErrorInfo::GetDialogMask() const +ErrorHandlerFlags DynamicErrorInfo::GetDialogMask() const { return pImpl->nMask; } StringErrorInfo::StringErrorInfo( - sal_uIntPtr UserId, const OUString& aStringP, sal_uInt16 nMask) + sal_uIntPtr UserId, const OUString& aStringP, ErrorHandlerFlags nMask) : DynamicErrorInfo(UserId, nMask), aString(aStringP) { } @@ -226,25 +226,25 @@ void ErrorHandler::RegisterDisplay(BasicDisplayErrorFunc *aDsp) 1. nFlags, 2. Resource Flags 3. Dynamic Flags - 4. Default ERRCODE_BUTTON_OK, ERRCODE_MSG_ERROR + 4. Default ButtonsOk, MessageError - @param lId error id + @param nErrCodeId error id @param nFlags error flags. @param bJustCreateString ??? @param rError ??? @return ??? */ -sal_uInt16 ErrorHandler::HandleError_Impl( - sal_uIntPtr lId, sal_uInt16 nFlags, bool bJustCreateString, OUString & rError) +ErrorHandlerFlags ErrorHandler::HandleError_Impl( + sal_uIntPtr nErrCodeId, ErrorHandlerFlags nFlags, bool bJustCreateString, OUString & rError) { OUString aErr; OUString aAction; - if(!lId || lId == ERRCODE_ABORT) - return 0; + if(!nErrCodeId || nErrCodeId == ERRCODE_ABORT) + return ErrorHandlerFlags::NONE; EDcrData &rData = TheEDcrData::get(); vcl::Window *pParent = nullptr; - ErrorInfo *pInfo = ErrorInfo::GetErrorInfo(lId); + ErrorInfo *pInfo = ErrorInfo::GetErrorInfo(nErrCodeId); if (!rData.contexts.empty()) { rData.contexts.front()->GetString(pInfo->GetErrorCode(), aAction); @@ -257,18 +257,18 @@ sal_uInt16 ErrorHandler::HandleError_Impl( } } - bool bWarning = ((lId & ERRCODE_WARNING_MASK) == ERRCODE_WARNING_MASK); - sal_uInt16 nErrFlags = ERRCODE_BUTTON_DEF_OK | ERRCODE_BUTTON_OK; + bool bWarning = ((nErrCodeId & ERRCODE_WARNING_MASK) == ERRCODE_WARNING_MASK); + ErrorHandlerFlags nErrFlags = ErrorHandlerFlags::ButtonDefaultsOk | ErrorHandlerFlags::ButtonsOk; if (bWarning) - nErrFlags |= ERRCODE_MSG_WARNING; + nErrFlags |= ErrorHandlerFlags::MessageWarning; else - nErrFlags |= ERRCODE_MSG_ERROR; + nErrFlags |= ErrorHandlerFlags::MessageError; DynamicErrorInfo* pDynPtr=dynamic_cast<DynamicErrorInfo*>(pInfo); if(pDynPtr) { - sal_uInt16 nDynFlags = pDynPtr->GetDialogMask(); - if( nDynFlags ) + ErrorHandlerFlags nDynFlags = pDynPtr->GetDialogMask(); + if( nDynFlags != ErrorHandlerFlags::NONE ) nErrFlags = nDynFlags; } @@ -277,7 +277,7 @@ sal_uInt16 ErrorHandler::HandleError_Impl( if (bJustCreateString) { rError = aErr; - return 1; + return ErrorHandlerFlags::ButtonsOk; } else { @@ -295,11 +295,11 @@ sal_uInt16 ErrorHandler::HandleError_Impl( if(!rData.bIsWindowDsp) { (*reinterpret_cast<BasicDisplayErrorFunc*>(rData.pDsp))(aErr,aAction); - return 0; + return ErrorHandlerFlags::NONE; } else { - if (nFlags != USHRT_MAX) + if (nFlags != ErrorHandlerFlags::MAX) nErrFlags = nFlags; return (*reinterpret_cast<WindowDisplayErrorFunc*>(rData.pDsp))( pParent, nErrFlags, aErr, aAction); @@ -311,27 +311,27 @@ sal_uInt16 ErrorHandler::HandleError_Impl( // Error 1 is General Error in the Sfx if(pInfo->GetErrorCode()!=1) { - HandleError_Impl(1, USHRT_MAX, bJustCreateString, rError); + HandleError_Impl(1, ErrorHandlerFlags::MAX, bJustCreateString, rError); } else { OSL_FAIL("Error 1 nicht gehandeled"); } delete pInfo; - return 0; + return ErrorHandlerFlags::NONE; } // static bool ErrorHandler::GetErrorString(sal_uIntPtr lId, OUString& rStr) { - return (bool)HandleError_Impl( lId, USHRT_MAX, true, rStr ); + return HandleError_Impl( lId, ErrorHandlerFlags::MAX, true, rStr ) != ErrorHandlerFlags::NONE; } /** Handles an error. @see ErrorHandler::HandleError_Impl */ -sal_uInt16 ErrorHandler::HandleError(sal_uIntPtr lId, sal_uInt16 nFlags) +ErrorHandlerFlags ErrorHandler::HandleError(sal_uIntPtr lId, ErrorHandlerFlags nFlags) { OUString aDummy; return HandleError_Impl( lId, nFlags, false, aDummy ); |