diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-07-10 08:59:45 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-07-10 09:50:05 +0100 |
commit | 6a9dc1a045d9f18255c3cb8a7bdbefdf226d8a37 (patch) | |
tree | c2210335f595fc903f9d703b4102ac794482c513 /cppcanvas | |
parent | 3729d47fe10bdf2bdd482bc8826a744145a9e6a0 (diff) |
remove last XubString uses in cppcanvas
Change-Id: I2ebc11a972f9a806889e13e7f69e20cd91d2ae6e
Diffstat (limited to 'cppcanvas')
-rw-r--r-- | cppcanvas/source/mtfrenderer/implrenderer.cxx | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index a85239140b0e..b26c0fb01522 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -299,29 +299,28 @@ namespace return nChar; } - void convertToLocalizedNumerals( XubString& rStr, - LanguageType eTextLanguage ) + OUString convertToLocalizedNumerals(const OUString& rStr, + LanguageType eTextLanguage) { - const sal_Unicode* pBase = rStr.GetBuffer(); - const sal_Unicode* pBegin = pBase + 0; - const xub_StrLen nEndIndex = rStr.Len(); - const sal_Unicode* pEnd = pBase + nEndIndex; + OUStringBuffer aBuf(rStr); - for( ; pBegin < pEnd; ++pBegin ) + for (sal_Int32 i = 0; i < aBuf.getLength(); ++i) { // TODO: are there non-digit localizations? - if( (*pBegin >= '0') && (*pBegin <= '9') ) + sal_Unicode nOrigChar = aBuf[i]; + if( (nOrigChar >= '0') && (nOrigChar <= '9') ) { // translate characters to local preference - sal_Unicode cChar = getLocalizedChar( *pBegin, eTextLanguage ); - if( cChar != *pBegin ) - rStr.SetChar( sal::static_int_cast<sal_uInt16>(pBegin - pBase), cChar ); + sal_Unicode cChar = getLocalizedChar(nOrigChar, eTextLanguage); + if (cChar != nOrigChar) + aBuf[i] = cChar; } } + + return aBuf.makeStringAndClear(); } } - namespace cppcanvas { namespace internal @@ -2557,10 +2556,10 @@ namespace cppcanvas case META_TEXT_ACTION: { MetaTextAction* pAct = static_cast<MetaTextAction*>(pCurrAct); - XubString sText = XubString( pAct->GetText() ); + OUString sText = pAct->GetText(); - if( rVDev.GetDigitLanguage()) - convertToLocalizedNumerals ( sText,rVDev.GetDigitLanguage() ); + if (rVDev.GetDigitLanguage()) + sText = convertToLocalizedNumerals(sText, rVDev.GetDigitLanguage()); createTextAction( pAct->GetPoint(), @@ -2576,10 +2575,10 @@ namespace cppcanvas case META_TEXTARRAY_ACTION: { MetaTextArrayAction* pAct = static_cast<MetaTextArrayAction*>(pCurrAct); - XubString sText = XubString( pAct->GetText() ); + OUString sText = pAct->GetText(); - if( rVDev.GetDigitLanguage()) - convertToLocalizedNumerals ( sText,rVDev.GetDigitLanguage() ); + if (rVDev.GetDigitLanguage()) + sText = convertToLocalizedNumerals(sText, rVDev.GetDigitLanguage()); createTextAction( pAct->GetPoint(), @@ -2654,10 +2653,10 @@ namespace cppcanvas case META_STRETCHTEXT_ACTION: { MetaStretchTextAction* pAct = static_cast<MetaStretchTextAction*>(pCurrAct); - XubString sText = XubString( pAct->GetText() ); + OUString sText = pAct->GetText(); - if( rVDev.GetDigitLanguage()) - convertToLocalizedNumerals ( sText,rVDev.GetDigitLanguage() ); + if (rVDev.GetDigitLanguage()) + sText = convertToLocalizedNumerals(sText, rVDev.GetDigitLanguage()); const sal_uInt16 nLen( pAct->GetLen() == (sal_uInt16)STRING_LEN ? pAct->GetText().getLength() - pAct->GetIndex() : pAct->GetLen() ); |