From 884cbe174ee5e343e9ed56093421aad3e467bf57 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 2 Jan 2018 11:00:41 +0200 Subject: RID_* can be extern global variables no need to access them via methods Change-Id: If0d1a65d6f56ce2fc585749d974ba13c9f2749b2 Reviewed-on: https://gerrit.libreoffice.org/47245 Tested-by: Jenkins Reviewed-by: Noel Grandin --- basic/inc/basic.hrc | 2 +- basic/source/classes/sb.cxx | 7 +------ cui/source/options/optdict.cxx | 2 +- cui/source/tabpages/backgrnd.cxx | 2 +- include/basic/sbdef.hxx | 2 +- include/svtools/ehdl.hxx | 4 ++-- include/svtools/soerr.hxx | 4 ++-- include/svx/svxerr.hxx | 4 ++-- oox/source/ppt/pptimport.cxx | 2 +- sd/source/ui/func/futhes.cxx | 2 +- sd/source/ui/view/sdview4.cxx | 2 +- sd/source/ui/view/viewshe2.cxx | 2 +- sfx2/source/appl/appinit.cxx | 6 +++--- sfx2/source/view/ipclient.cxx | 2 +- svtools/source/misc/ehdl.cxx | 26 +++----------------------- svx/source/items/svxerr.cxx | 12 +----------- sw/source/uibase/uiview/viewling.cxx | 4 ++-- uui/source/iahndl-errorhandler.cxx | 4 ++-- 18 files changed, 27 insertions(+), 62 deletions(-) diff --git a/basic/inc/basic.hrc b/basic/inc/basic.hrc index 49eb93cd102d..36fe29f11ef3 100644 --- a/basic/inc/basic.hrc +++ b/basic/inc/basic.hrc @@ -22,7 +22,7 @@ #define NC_(Context, String) (Context "\004" u8##String) -std::pair RID_BASIC_START[] = +std::pair const RID_BASIC_START[] = { { NC_("RID_BASIC_START", "Syntax error."), ERRCODE_BASIC_SYNTAX }, { NC_("RID_BASIC_START", "Return without Gosub."), ERRCODE_BASIC_NO_GOSUB }, diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 1be75c333424..1dcd71704399 100644 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -1560,18 +1560,13 @@ void StarBASIC::SetErrorData( ErrCode nCode, sal_uInt16 nLine, aGlobals.nCol2 = nCol2; } -const ErrMsgCode* getRID_BASIC_START() -{ - return RID_BASIC_START; -} - void StarBASIC::MakeErrorText( ErrCode nId, const OUString& aMsg ) { SolarMutexGuard aSolarGuard; sal_uInt16 nOldID = GetVBErrorCode( nId ); const char* pErrorMsg = nullptr; - for (ErrMsgCode* pItem = RID_BASIC_START; pItem->second; ++pItem) + for (std::pair const *pItem = RID_BASIC_START; pItem->second; ++pItem) { if (nId == pItem->second) { diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx index 8b23f40c5445..1fc1d62ec928 100644 --- a/cui/source/options/optdict.cxx +++ b/cui/source/options/optdict.cxx @@ -177,7 +177,7 @@ IMPL_LINK_NOARG(SvxNewDictionaryDialog, OKHdl_Impl, Button*, void) xNewDic = nullptr; // error: couldn't create new dictionary SfxErrorContext aContext( ERRCTX_SVX_LINGU_DICTIONARY, OUString(), - this, getRID_SVXERRCTX(), SvxResLocale() ); + this, RID_SVXERRCTX, SvxResLocale() ); ErrorHandler::HandleError( *new StringErrorInfo( ERRCODE_SVX_LINGU_DICT_NOTWRITEABLE, sDict ) ); EndDialog(); diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx index 958b4bd591f1..0bd155a15198 100644 --- a/cui/source/tabpages/backgrnd.cxx +++ b/cui/source/tabpages/backgrnd.cxx @@ -879,7 +879,7 @@ void SvxBackgroundTabPage::RaiseLoadError_Impl() SfxErrorContext aContext( ERRCTX_SVX_BACKGROUND, OUString(), this, - getRID_SVXERRCTX(), + RID_SVXERRCTX, SvxResLocale() ); ErrorHandler::HandleError( diff --git a/include/basic/sbdef.hxx b/include/basic/sbdef.hxx index e79c58b6c071..7d677f1c9be6 100644 --- a/include/basic/sbdef.hxx +++ b/include/basic/sbdef.hxx @@ -68,7 +68,7 @@ enum class PropertyMode Set }; -BASIC_DLLPUBLIC const ErrMsgCode* getRID_BASIC_START(); +BASIC_DLLPUBLIC extern std::pair const RID_BASIC_START[]; BASIC_DLLPUBLIC std::locale BasResLocale(); BASIC_DLLPUBLIC OUString BasResId(const char* pId); diff --git a/include/svtools/ehdl.hxx b/include/svtools/ehdl.hxx index a78e9d22d648..2042d70184eb 100644 --- a/include/svtools/ehdl.hxx +++ b/include/svtools/ehdl.hxx @@ -26,8 +26,8 @@ #include typedef std::pair ErrMsgCode; -SVT_DLLPUBLIC const ErrMsgCode* getRID_ERRHDL(); -SVT_DLLPUBLIC const ErrMsgCode* getRID_ERRCTX(); +SVT_DLLPUBLIC extern const ErrMsgCode RID_ERRHDL[]; +SVT_DLLPUBLIC extern const ErrMsgCode RID_ERRCTX[]; namespace vcl { class Window; } diff --git a/include/svtools/soerr.hxx b/include/svtools/soerr.hxx index 96a4677bf5d0..9f39f6ca1563 100644 --- a/include/svtools/soerr.hxx +++ b/include/svtools/soerr.hxx @@ -35,8 +35,8 @@ // error contexts #define ERRCTX_SO_DOVERB 1 -SVT_DLLPUBLIC const ErrMsgCode* getRID_SO_ERROR_HANDLER(); -SVT_DLLPUBLIC const ErrMsgCode* getRID_SO_ERRCTX(); +SVT_DLLPUBLIC extern const ErrMsgCode RID_SO_ERROR_HANDLER[]; +SVT_DLLPUBLIC extern const ErrMsgCode RID_SO_ERRCTX[]; #endif diff --git a/include/svx/svxerr.hxx b/include/svx/svxerr.hxx index e746649ea317..f428a920af61 100644 --- a/include/svx/svxerr.hxx +++ b/include/svx/svxerr.hxx @@ -54,8 +54,8 @@ public: static void ensure(); }; -SVX_DLLPUBLIC const ErrMsgCode* getRID_SVXERRCODE(); -SVX_DLLPUBLIC const ErrMsgCode* getRID_SVXERRCTX(); +SVX_DLLPUBLIC extern const ErrMsgCode RID_SVXERRCODE[]; +SVX_DLLPUBLIC extern const ErrMsgCode RID_SVXERRCTX[]; #endif diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx index adab8e4f1b96..3b622792282e 100644 --- a/oox/source/ppt/pptimport.cxx +++ b/oox/source/ppt/pptimport.cxx @@ -162,7 +162,7 @@ bool PowerPointImport::importDocument() { // Construct a warning message. INetURLObject aURL(getFileUrl()); - SfxErrorContext aContext(ERRCTX_SFX_OPENDOC, aURL.getName(INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset), nullptr, getRID_ERRCTX()); + SfxErrorContext aContext(ERRCTX_SFX_OPENDOC, aURL.getName(INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset), nullptr, RID_ERRCTX); OUString aWarning; aContext.GetString(ERRCODE_NONE.MakeWarning(), aWarning); aWarning += ":\n"; diff --git a/sd/source/ui/func/futhes.cxx b/sd/source/ui/func/futhes.cxx index bc68092aef81..ad1907648d2c 100644 --- a/sd/source/ui/func/futhes.cxx +++ b/sd/source/ui/func/futhes.cxx @@ -67,7 +67,7 @@ rtl::Reference FuThesaurus::Create( ViewShell* pViewSh, ::sd::Window* pW void FuThesaurus::DoExecute( SfxRequest& ) { SfxErrorContext aContext(ERRCTX_SVX_LINGU_THESAURUS, OUString(), - mpWindow, getRID_SVXERRCTX(), SvxResLocale()); + mpWindow, RID_SVXERRCTX, SvxResLocale()); if (mpViewShell && dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr) { diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx index 42bcfa23e141..bf069c64e859 100644 --- a/sd/source/ui/view/sdview4.cxx +++ b/sd/source/ui/view/sdview4.cxx @@ -377,7 +377,7 @@ IMPL_LINK_NOARG(View, DropInsertFileHdl, Timer *, void) if( !mpViewSh ) return; - SfxErrorContext aEc( ERRCTX_ERROR, mpViewSh->GetActiveWindow(), getRID_SO_ERRCTX() ); + SfxErrorContext aEc( ERRCTX_ERROR, mpViewSh->GetActiveWindow(), RID_SO_ERRCTX ); ErrCode nError = ERRCODE_NONE; ::std::vector< OUString >::const_iterator aIter( maDropFileVector.begin() ); diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx index 64a11a91cda0..fd206cb0d1be 100644 --- a/sd/source/ui/view/viewshe2.cxx +++ b/sd/source/ui/view/viewshe2.cxx @@ -718,7 +718,7 @@ bool ViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb) { ErrCode aErrCode = ERRCODE_NONE; - SfxErrorContext aEC(ERRCTX_SO_DOVERB, GetActiveWindow(), getRID_SO_ERRCTX()); + SfxErrorContext aEC(ERRCTX_SO_DOVERB, GetActiveWindow(), RID_SO_ERRCTX); bool bAbort = false; GetDocSh()->SetWaitCursor( true ); SfxViewShell* pViewShell = GetViewShell(); diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx index e190d594d897..218fa03c3656 100644 --- a/sfx2/source/appl/appinit.cxx +++ b/sfx2/source/appl/appinit.cxx @@ -208,13 +208,13 @@ void SfxApplication::Initialize_Impl() Help::EnableExtHelp(); pImpl->m_pToolsErrorHdl = new SfxErrorHandler( - getRID_ERRHDL(), ErrCodeArea::Io, ErrCodeArea::Vcl); + RID_ERRHDL, ErrCodeArea::Io, ErrCodeArea::Vcl); pImpl->m_pSoErrorHdl = new SfxErrorHandler( - getRID_SO_ERROR_HANDLER(), ErrCodeArea::So, ErrCodeArea::So, SvtResLocale()); + RID_SO_ERROR_HANDLER, ErrCodeArea::So, ErrCodeArea::So, SvtResLocale()); #if HAVE_FEATURE_SCRIPTING pImpl->m_pSbxErrorHdl = new SfxErrorHandler( - getRID_BASIC_START(), ErrCodeArea::Sbx, ErrCodeArea::Sbx, BasResLocale()); + RID_BASIC_START, ErrCodeArea::Sbx, ErrCodeArea::Sbx, BasResLocale()); #endif if (!utl::ConfigManager::IsFuzzing()) diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index cd1a4ec77656..86aa5fa35625 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -856,7 +856,7 @@ sal_Int64 SfxInPlaceClient::GetAspect() const ErrCode SfxInPlaceClient::DoVerb( long nVerb ) { - SfxErrorContext aEc(ERRCTX_SO_DOVERB, m_pViewSh->GetWindow(), getRID_SO_ERRCTX()); + SfxErrorContext aEc(ERRCTX_SO_DOVERB, m_pViewSh->GetWindow(), RID_SO_ERRCTX); ErrCode nError = ERRCODE_NONE; if ( m_xImp->m_xObject.is() ) diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx index f73adec3c045..6c2406f57ae8 100644 --- a/svtools/source/misc/ehdl.cxx +++ b/svtools/source/misc/ehdl.cxx @@ -242,7 +242,7 @@ SfxErrorContext::SfxErrorContext( : ErrorContext(pWindow), nCtxId(nCtxIdP), pIds(pIdsP), aResLocale(rResLocaleP) { if (!pIds) - pIds = getRID_ERRCTX(); + pIds = RID_ERRCTX; } @@ -253,7 +253,7 @@ SfxErrorContext::SfxErrorContext( aArg1(aArg1P) { if (!pIds) - pIds = getRID_ERRCTX(); + pIds = RID_ERRCTX; } bool SfxErrorContext::GetString(ErrCode nErrId, OUString &rStr) @@ -281,7 +281,7 @@ bool SfxErrorContext::GetString(ErrCode nErrId, OUString &rStr) if ( bRet ) { sal_uInt16 nId = nErrId.IsWarning() ? ERRCTX_WARNING : ERRCTX_ERROR; - for (const ErrMsgCode* pItem = getRID_ERRCTX(); pItem->second; ++pItem) + for (const ErrMsgCode* pItem = RID_ERRCTX; pItem->second; ++pItem) { if (sal_uInt32(pItem->second) == nId) { @@ -294,24 +294,4 @@ bool SfxErrorContext::GetString(ErrCode nErrId, OUString &rStr) return bRet; } -const ErrMsgCode* getRID_ERRHDL() -{ - return RID_ERRHDL; -} - -const ErrMsgCode* getRID_ERRCTX() -{ - return RID_ERRCTX; -} - -const ErrMsgCode* getRID_SO_ERROR_HANDLER() -{ - return RID_SO_ERROR_HANDLER; -} - -const ErrMsgCode* getRID_SO_ERRCTX() -{ - return RID_SO_ERRCTX; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/items/svxerr.cxx b/svx/source/items/svxerr.cxx index ec8a4059bcbb..b92764a043d9 100644 --- a/svx/source/items/svxerr.cxx +++ b/svx/source/items/svxerr.cxx @@ -25,7 +25,7 @@ SvxErrorHandler::SvxErrorHandler() : SfxErrorHandler( - getRID_SVXERRCODE(), ErrCodeArea::Svx, ErrCodeArea::Svx, SvxResLocale()) + RID_SVXERRCODE, ErrCodeArea::Svx, ErrCodeArea::Svx, SvxResLocale()) { } @@ -40,14 +40,4 @@ void SvxErrorHandler::ensure() theSvxErrorHandler::get(); } -const ErrMsgCode* getRID_SVXERRCODE() -{ - return RID_SVXERRCODE; -} - -const ErrMsgCode* getRID_SVXERRCTX() -{ - return RID_SVXERRCTX; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index dc220a5bb684..3fb3a1e16272 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -424,7 +424,7 @@ void SwView::HyphenateDocument() } SfxErrorContext aContext( ERRCTX_SVX_LINGU_HYPHENATION, OUString(), m_pEditWin, - getRID_SVXERRCTX(), SvxResLocale() ); + RID_SVXERRCTX, SvxResLocale() ); Reference< XHyphenator > xHyph( ::GetHyphenator() ); if (!xHyph.is()) @@ -546,7 +546,7 @@ void SwView::StartThesaurus() return; SfxErrorContext aContext( ERRCTX_SVX_LINGU_THESAURUS, OUString(), m_pEditWin, - getRID_SVXERRCTX(), SvxResLocale() ); + RID_SVXERRCTX, SvxResLocale() ); // Determine language LanguageType eLang = m_pWrtShell->GetCurLang(); diff --git a/uui/source/iahndl-errorhandler.cxx b/uui/source/iahndl-errorhandler.cxx index 1a23b6a81f42..dca09cf4bb7f 100644 --- a/uui/source/iahndl-errorhandler.cxx +++ b/uui/source/iahndl-errorhandler.cxx @@ -156,8 +156,8 @@ UUIInteractionHelper::handleErrorHandlerRequest( enum Source { SOURCE_DEFAULT, SOURCE_SVX, SOURCE_UUI }; static char const * const aManager[3] = { "svt", "svx", "uui" }; static const ErrMsgCode* const aId[3] - = { getRID_ERRHDL(), - getRID_SVXERRCODE(), + = { RID_ERRHDL, + RID_SVXERRCODE, RID_UUI_ERRHDL }; ErrCodeArea nErrorArea = nErrorCode.GetArea(); Source eSource = -- cgit