include/sfx2/ipclient.hxx | 2 +- include/svtools/ehdl.hxx | 5 ----- sc/source/ui/view/tabvwshb.cxx | 4 ++-- sfx2/source/view/ipclient.cxx | 7 +++---- svtools/source/misc/ehdl.cxx | 14 +++----------- sw/source/uibase/table/tablemgr.cxx | 2 +- 6 files changed, 10 insertions(+), 24 deletions(-)
New commits: commit 66123b319da98c6ecabcd9635eb2ed9c3de99f35 Author: Noel Grandin <[email protected]> AuthorDate: Fri Oct 6 08:48:24 2023 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Fri Oct 6 09:53:07 2023 +0200 use more ErrCodeMsg instead of a sideband mechanism to convey extra error message around Change-Id: Ibd1fc8629c5b10bc6f9e6cbd30e8a20156ac13b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157630 Reviewed-by: Mike Kaganski <[email protected]> Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/include/sfx2/ipclient.hxx b/include/sfx2/ipclient.hxx index b95018c5614c..2e58f5e339bc 100644 --- a/include/sfx2/ipclient.hxx +++ b/include/sfx2/ipclient.hxx @@ -82,7 +82,7 @@ public: static SfxInPlaceClient* GetClient( SfxObjectShell const * pDoc, const css::uno::Reference < css::embed::XEmbeddedObject >& xObject ); sal_Int64 GetAspect() const; sal_Int64 GetObjectMiscStatus() const; - ErrCode DoVerb(sal_Int32 nVerb); + ErrCodeMsg DoVerb(sal_Int32 nVerb); void VisAreaChanged(); void ResetObject(); bool IsUIActive() const; diff --git a/include/svtools/ehdl.hxx b/include/svtools/ehdl.hxx index 1f3b8d6cb17e..1e70ee1ca55e 100644 --- a/include/svtools/ehdl.hxx +++ b/include/svtools/ehdl.hxx @@ -23,8 +23,6 @@ #include <svtools/svtresid.hxx> #include <vcl/errinf.hxx> -#include <unordered_map> - typedef std::pair<TranslateId, ErrCode> ErrMsgCode; SVT_DLLPUBLIC extern const ErrMsgCode RID_ERRHDL[]; SVT_DLLPUBLIC extern const ErrMsgCode RID_ERRCTX[]; @@ -42,14 +40,11 @@ public: const ErrMsgCode* pIds = nullptr, const std::locale& rResLocaleP = SvtResLocale()); bool GetString(const ErrCodeMsg& nErrId, OUString &rStr) override; - void SetExtendedMessage(ErrCode nErrId, const OUString& rStr); - private: sal_uInt16 nCtxId; const ErrMsgCode* pIds; std::locale aResLocale; OUString aArg1; - std::unordered_map<sal_uInt32, OUString> m_extMessages; }; class SVT_DLLPUBLIC SfxErrorHandler : private ErrorHandler diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index 04c97bcea64f..f0415d03d9aa 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -159,7 +159,7 @@ void ScTabViewShell::ActivateObject(SdrOle2Obj* pObj, sal_Int32 nVerb) uno::Reference < embed::XEmbeddedObject > xObj = pObj->GetObjRef(); vcl::Window* pWin = GetActiveWin(); - ErrCode nErr = ERRCODE_NONE; + ErrCodeMsg nErr = ERRCODE_NONE; bool bErrorShown = false; { @@ -174,7 +174,7 @@ void ScTabViewShell::ActivateObject(SdrOle2Obj* pObj, sal_Int32 nVerb) if (bNegativeX) pClient->SetNegativeX(true); - if ( (sal_uInt32(nErr) & ERRCODE_ERROR_MASK) == 0 && xObj.is() ) + if ( (sal_uInt32(nErr.GetCode()) & ERRCODE_ERROR_MASK) == 0 && xObj.is() ) { tools::Rectangle aRect = pObj->GetLogicRect(); diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index 260bdff77f34..d8c27ea02558 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -894,10 +894,10 @@ sal_Int64 SfxInPlaceClient::GetAspect() const return m_xImp->m_nAspect; } -ErrCode SfxInPlaceClient::DoVerb(sal_Int32 nVerb) +ErrCodeMsg SfxInPlaceClient::DoVerb(sal_Int32 nVerb) { SfxErrorContext aEc(ERRCTX_SO_DOVERB, m_pViewSh->GetFrameWeld(), RID_SO_ERRCTX); - ErrCode nError = ERRCODE_NONE; + ErrCodeMsg nError = ERRCODE_NONE; if ( m_xImp->m_xObject.is() ) { @@ -996,8 +996,7 @@ ErrCode SfxInPlaceClient::DoVerb(sal_Int32 nVerb) catch (uno::Exception const&) { TOOLS_WARN_EXCEPTION("embeddedobj", "SfxInPlaceClient::DoVerb: -9 fallback path"); - nError = ERRCODE_SO_GENERALERROR; - aEc.SetExtendedMessage(ERRCODE_SO_GENERALERROR, e.Message); + nError = ErrCodeMsg(ERRCODE_SO_GENERALERROR, e.Message); } } } diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx index ab602be60aaf..59613089a514 100644 --- a/svtools/source/misc/ehdl.cxx +++ b/svtools/source/misc/ehdl.cxx @@ -283,19 +283,11 @@ bool SfxErrorContext::GetString(const ErrCodeMsg& nErr, OUString &rStr) } } - if (bRet) - if (auto it = m_extMessages.find(sal_uInt32(nErr.GetCode())); it != m_extMessages.end()) - rStr += "\n" + it->second; + // SfxInPlaceClient::DoVerb adds some extra info to report + if (bRet && nErr.GetCode() == ERRCODE_SO_GENERALERROR && !nErr.GetArg1().isEmpty()) + rStr += "\n" + nErr.GetArg1(); return bRet; } -void SfxErrorContext::SetExtendedMessage(ErrCode nErrId, const OUString& rStr) -{ - if (rStr.isEmpty()) - m_extMessages.erase(sal_uInt32(nErrId)); - else - m_extMessages[sal_uInt32(nErrId)] = rStr; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/table/tablemgr.cxx b/sw/source/uibase/table/tablemgr.cxx index 854fa30ab6ce..8df92dae563b 100644 --- a/sw/source/uibase/table/tablemgr.cxx +++ b/sw/source/uibase/table/tablemgr.cxx @@ -252,7 +252,7 @@ uno::Reference< frame::XModel > SwTableFUNC::InsertChart( m_pSh->CalcAndSetScale( aEmbObjRef ); //#50270# We don't need to handle errors, //this does the DoVerb in the SfxViewShell. - ErrCode nErr = pClient->DoVerb(embed::EmbedVerbs::MS_OLEVERB_SHOW); + ErrCodeMsg nErr = pClient->DoVerb(embed::EmbedVerbs::MS_OLEVERB_SHOW); (void) nErr; // #i121334#
