diff options
author | Noel Grandin <noel@peralex.com> | 2012-10-04 17:13:24 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-10-09 21:15:07 +0000 |
commit | 58528348fad0609c4d7af7943bc76df4261b8508 (patch) | |
tree | dbb99737098ec6315b97ee82e28df198e6c5c23d /svtools | |
parent | 227d385fcdaf30ef4bd294d99b088ef533372d58 (diff) |
String->OUString in tools::ErrorContext
Change-Id: Ibd0cd3e8d7281b5abde420df5cc1d51e9354069c
Reviewed-on: https://gerrit.libreoffice.org/769
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/inc/svtools/ehdl.hxx | 8 | ||||
-rw-r--r-- | svtools/source/misc/ehdl.cxx | 53 |
2 files changed, 30 insertions, 31 deletions
diff --git a/svtools/inc/svtools/ehdl.hxx b/svtools/inc/svtools/ehdl.hxx index 7438882a59cd..4b06a6e9d781 100644 --- a/svtools/inc/svtools/ehdl.hxx +++ b/svtools/inc/svtools/ehdl.hxx @@ -38,7 +38,7 @@ public: SfxErrorContext( sal_uInt16 nCtxIdP, const String &aArg1, Window *pWin=0, sal_uInt16 nResIdP=USHRT_MAX, ResMgr *pMgrP=0); - virtual sal_Bool GetString(sal_uLong nErrId, String &rStr); + virtual sal_Bool GetString(sal_uLong nErrId, OUString &rStr); private: sal_uInt16 nCtxId; @@ -54,8 +54,8 @@ public: ~SfxErrorHandler(); protected: - virtual sal_Bool GetErrorString(sal_uLong lErrId, String &, sal_uInt16&) const; - virtual sal_Bool GetMessageString(sal_uLong lErrId, String &, sal_uInt16&) const; + virtual sal_Bool GetErrorString(sal_uLong lErrId, OUString &, sal_uInt16&) const; + virtual sal_Bool GetMessageString(sal_uLong lErrId, OUString &, sal_uInt16&) const; private: @@ -67,7 +67,7 @@ private: SVT_DLLPRIVATE sal_Bool GetClassString(sal_uLong lErrId, String &) const; virtual sal_Bool CreateString( - const ErrorInfo *, String &, sal_uInt16 &) const; + const ErrorInfo *, OUString &, sal_uInt16 &) const; }; #endif diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx index b23feb7d10c4..97b81fde8de5 100644 --- a/svtools/source/misc/ehdl.cxx +++ b/svtools/source/misc/ehdl.cxx @@ -42,8 +42,8 @@ static sal_uInt16 aWndFunc( Window *pWin, // Parent des Dialoges sal_uInt16 nFlags, - const String &rErr, // Fehlertext - const String &rAction) // Actiontext + const OUString &rErr, // Fehlertext + const OUString &rAction) // Actiontext /* [Beschreibung] @@ -175,7 +175,7 @@ SfxErrorHandler::~SfxErrorHandler() //------------------------------------------------------------------------- sal_Bool SfxErrorHandler::CreateString( - const ErrorInfo *pErr, String &rStr, sal_uInt16& nFlags) const + const ErrorInfo *pErr, OUString &rStr, sal_uInt16& nFlags) const /* [Beschreibung] @@ -192,13 +192,12 @@ sal_Bool SfxErrorHandler::CreateString( { if(GetMessageString(nErrCode, rStr, nFlags)) { - for (xub_StrLen i = 0; i < rStr.Len();) + for (xub_StrLen i = 0; i < rStr.getLength();) { - i = rStr.SearchAndReplace(rtl::OUString("$(ARG1)"), - pMsgInfo->GetMessageArg(), i); - if (i == STRING_NOTFOUND) + if( rStr.indexOf(OUString("$(ARG1)"), i) == -1 ) break; - i = i + pMsgInfo->GetMessageArg().Len(); + rStr = rStr.replaceAll("$(ARG1)", pMsgInfo->GetMessageArg(), i); + i = i + pMsgInfo->GetMessageArg().getLength(); } return sal_True; } @@ -207,32 +206,32 @@ sal_Bool SfxErrorHandler::CreateString( { StringErrorInfo *pStringInfo=PTR_CAST(StringErrorInfo,pErr); if(pStringInfo) - for (xub_StrLen i = 0; i < rStr.Len();) + for (xub_StrLen i = 0; i < rStr.getLength();) { - i = rStr.SearchAndReplace(rtl::OUString("$(ARG1)"), - pStringInfo->GetErrorString(), i); - if (i == STRING_NOTFOUND) + if( rStr.indexOf("$(ARG1)", i) == -1 ) break; - i = i + pStringInfo->GetErrorString().Len(); + rStr = rStr.replaceAll(rtl::OUString("$(ARG1)"), + pStringInfo->GetErrorString(), i); + i = i + pStringInfo->GetErrorString().getLength(); } else { TwoStringErrorInfo * pTwoStringInfo = PTR_CAST(TwoStringErrorInfo, pErr); if (pTwoStringInfo) - for (sal_uInt16 i = 0; i < rStr.Len();) + for (sal_uInt16 i = 0; i < rStr.getLength();) { - sal_uInt16 nArg1Pos = rStr.Search(rtl::OUString("$(ARG1)"), i); - sal_uInt16 nArg2Pos = rStr.Search(rtl::OUString("$(ARG2)"), i); + sal_uInt16 nArg1Pos = rStr.indexOf(rtl::OUString("$(ARG1)"), i); + sal_uInt16 nArg2Pos = rStr.indexOf(rtl::OUString("$(ARG2)"), i); if (nArg1Pos < nArg2Pos) { - rStr.Replace(nArg1Pos, 7, pTwoStringInfo->GetArg1()); - i = nArg1Pos + pTwoStringInfo->GetArg1().Len(); + rStr = rStr.replaceAt(nArg1Pos, 7, pTwoStringInfo->GetArg1()); + i = nArg1Pos + pTwoStringInfo->GetArg1().getLength(); } else if (nArg2Pos < nArg1Pos) { - rStr.Replace(nArg2Pos, 7, pTwoStringInfo->GetArg2()); - i = nArg2Pos + pTwoStringInfo->GetArg2().Len(); + rStr = rStr.replaceAt(nArg2Pos, 7, pTwoStringInfo->GetArg2()); + i = nArg2Pos + pTwoStringInfo->GetArg2().getLength(); } else break; } @@ -329,7 +328,7 @@ sal_Bool SfxErrorHandler::GetClassString(sal_uLong lClassId, String &rStr) const //------------------------------------------------------------------------- sal_Bool SfxErrorHandler::GetMessageString( - sal_uLong lErrId, String &rStr, sal_uInt16 &nFlags) const + sal_uLong lErrId, OUString &rStr, sal_uInt16 &nFlags) const /* [Beschreibung] @@ -359,7 +358,7 @@ sal_Bool SfxErrorHandler::GetMessageString( //------------------------------------------------------------------------- sal_Bool SfxErrorHandler::GetErrorString( - sal_uLong lErrId, String &rStr, sal_uInt16 &nFlags) const + sal_uLong lErrId, OUString &rStr, sal_uInt16 &nFlags) const /* [Beschreibung] Erzeugt den Fehlerstring fuer den eigentlichen Fehler ohne @@ -383,7 +382,7 @@ sal_Bool SfxErrorHandler::GetErrorString( sal_uInt16 nResFlags = aErrorString.GetFlags(); if ( nResFlags ) nFlags = nResFlags; - rStr.SearchAndReplace(rtl::OUString("$(ERROR)"), aErrorString.GetString()); + rStr = rStr.replaceAll(rtl::OUString("$(ERROR)"), aErrorString.GetString()); bRet = sal_True; } else @@ -397,7 +396,7 @@ sal_Bool SfxErrorHandler::GetErrorString( aErrStr); if(aErrStr.Len()) aErrStr += rtl::OUString(".\n"); - rStr.SearchAndReplace(rtl::OUString("$(CLASS)"),aErrStr); + rStr = rStr.replaceAll(rtl::OUString("$(CLASS)"),aErrStr); } return bRet; @@ -427,7 +426,7 @@ SfxErrorContext::SfxErrorContext( //------------------------------------------------------------------------- -sal_Bool SfxErrorContext::GetString(sal_uLong nErrId, String &rStr) +sal_Bool SfxErrorContext::GetString(sal_uLong nErrId, OUString &rStr) /* [Beschreibung] @@ -452,7 +451,7 @@ sal_Bool SfxErrorContext::GetString(sal_uLong nErrId, String &rStr) if ( aTestEr ) { rStr = ( (ResString)aTestEr ).GetString(); - rStr.SearchAndReplace(rtl::OUString("$(ARG1)"), aArg1 ); + rStr = rStr.replaceAll(rtl::OUString("$(ARG1)"), aArg1 ); bRet = true; } else @@ -466,7 +465,7 @@ sal_Bool SfxErrorContext::GetString(sal_uLong nErrId, String &rStr) sal_uInt16 nId = ( nErrId & ERRCODE_WARNING_MASK ) ? ERRCTX_WARNING : ERRCTX_ERROR; ResId aSfxResId( RID_ERRCTX, *pMgr ); ErrorResource_Impl aEr( aSfxResId, nId ); - rStr.SearchAndReplace( rtl::OUString("$(ERR)"), ( (ResString)aEr ).GetString() ); + rStr = rStr.replaceAll( rtl::OUString("$(ERR)"), ( (ResString)aEr ).GetString() ); } } |