From cb92e6440cebbdf307e5740325d04d9656440fd8 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 5 Sep 2013 10:41:27 +0100 Subject: match original intent of String::Erase(String::Search)) the single argument String::Erase erased from the passed in index to the end of the string Search returns STRING_NOTFOUND on failure, which results in String::Erase erasing nothing and so leaving the original string untouched. Change-Id: I83939fce2a92c38fbfb62196b7248908117c1e69 --- svx/source/dialog/fntctrl.cxx | 6 +++++- svx/source/dialog/pagectrl.cxx | 2 +- svx/source/form/datanavi.cxx | 4 +++- svx/source/svdraw/svdotext.cxx | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) (limited to 'svx') diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx index c19acdbdc89b..04d175b59c7c 100644 --- a/svx/source/dialog/fntctrl.cxx +++ b/svx/source/dialog/fntctrl.cxx @@ -719,7 +719,11 @@ void SvxFontPrevWindow::Paint( const Rectangle& ) pImpl->aText = GetText(); if ( pImpl->aText.getLength() > (TEXT_WIDTH-1) ) - pImpl->aText = pImpl->aText.replaceAt( pImpl->aText.indexOf(" ", TEXT_WIDTH), 1, "" ); + { + sal_Int32 nSpaceIdx = pImpl->aText.indexOf(" ", TEXT_WIDTH); + if (nSpaceIdx != -1) + pImpl->aText = pImpl->aText.copy(0, nSpaceIdx); + } } // calculate text width scaling diff --git a/svx/source/dialog/pagectrl.cxx b/svx/source/dialog/pagectrl.cxx index a08f8fed1650..d645628ff58a 100644 --- a/svx/source/dialog/pagectrl.cxx +++ b/svx/source/dialog/pagectrl.cxx @@ -300,7 +300,7 @@ void SvxPageWindow::DrawPage( const Point& rOrg, const sal_Bool bSecond, const s sText += OUString(cArrow); for(sal_uInt16 i = 0; i < sText.getLength(); i++) { - OUString sDraw(sText.copy(0,1)); + OUString sDraw(sText.copy(i,1)); long nHDiff = 0; long nCharWidth = GetTextWidth(sDraw); bool bHorizontal = 0 == aMove.Y(); diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx index 66cffbab0d55..58f74cbba934 100644 --- a/svx/source/form/datanavi.cxx +++ b/svx/source/form/datanavi.cxx @@ -3464,7 +3464,9 @@ namespace svxform sTemp = m_aRefED.GetText(); m_xSubmission->setPropertyValue( PN_SUBMISSION_REF, makeAny( sTemp ) ); OUString sEntry = m_aBindLB.GetSelectEntry(); - sEntry = sEntry.replaceFirst( ":", "" ); + sal_Int32 nColonIdx = sEntry.indexOf(':'); + if (nColonIdx != -1) + sEntry = sEntry.copy(0, nColonIdx); sTemp = sEntry; m_xSubmission->setPropertyValue( PN_SUBMISSION_BIND, makeAny( sTemp ) ); sTemp = lcl_ReplaceString::get().toAPI( m_aReplaceLB.GetSelectEntry() ); diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index 1615b04c2e21..feefd80e7ecb 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -1011,7 +1011,7 @@ OUString SdrTextObj::TakeObjNameSingul() const if(aStr2.getLength() > 10) { - aStr2 = aStr2.replaceAt(8, 1, ""); + aStr2 = aStr2.copy(0, 8); aStr2 += "..."; } -- cgit