diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-09-05 10:41:27 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-09-05 11:52:40 +0100 |
commit | cb92e6440cebbdf307e5740325d04d9656440fd8 (patch) | |
tree | a56bf907c81133cd7336c05619b6417a9317267b | |
parent | f58cf57213a300ced1369b17daebc2e9e8251c06 (diff) |
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
-rw-r--r-- | sfx2/source/appl/appdde.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/appl/helpinterceptor.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/appl/newhelp.cxx | 3 | ||||
-rw-r--r-- | svx/source/dialog/fntctrl.cxx | 6 | ||||
-rw-r--r-- | svx/source/dialog/pagectrl.cxx | 2 | ||||
-rw-r--r-- | svx/source/form/datanavi.cxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdotext.cxx | 2 |
7 files changed, 16 insertions, 11 deletions
diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx index cf9a7394aa58..f3efec169948 100644 --- a/sfx2/source/appl/appdde.cxx +++ b/sfx2/source/appl/appdde.cxx @@ -122,15 +122,13 @@ bool ImplDdeService::MakeTopic( const OUString& rNm ) // First only loop over the ObjectShells to find those // with the specific name: sal_Bool bRet = sal_False; - OUString sNm( rNm ); - sNm = sNm.toAsciiLowerCase(); + OUString sNm( rNm.toAsciiLowerCase() ); TypeId aType( TYPE(SfxObjectShell) ); SfxObjectShell* pShell = SfxObjectShell::GetFirst( &aType ); while( pShell ) { OUString sTmp( pShell->GetTitle(SFX_TITLE_FULLNAME) ); - sTmp = sTmp.toAsciiLowerCase(); - if( sTmp == sNm ) + if( sNm == sTmp.toAsciiLowerCase() ) { SFX_APP()->AddDdeTopic( pShell ); bRet = true; diff --git a/sfx2/source/appl/helpinterceptor.cxx b/sfx2/source/appl/helpinterceptor.cxx index 40044ab99f19..fc0568808f42 100644 --- a/sfx2/source/appl/helpinterceptor.cxx +++ b/sfx2/source/appl/helpinterceptor.cxx @@ -235,8 +235,8 @@ Sequence< OUString > SAL_CALL HelpInterceptor_Impl::getInterceptedURLs() void SAL_CALL HelpInterceptor_Impl::dispatch( const URL& aURL, const Sequence< ::com::sun::star::beans::PropertyValue >& ) throw( RuntimeException ) { - sal_Bool bBack = ( OUString( ".uno:Backward" ) == OUString( aURL.Complete ) ); - if ( bBack || OUString( ".uno:Forward" ) == OUString( aURL.Complete ) ) + sal_Bool bBack = ( OUString( ".uno:Backward" ) == aURL.Complete ); + if ( bBack || OUString( ".uno:Forward" ) == aURL.Complete ) { if ( m_pHistory ) { diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 5b09cdbb3353..1b231fc9d126 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -1615,7 +1615,8 @@ void SfxHelpIndexWindow_Impl::SetActiveFactory() for ( sal_uInt16 i = 0; i < aActiveLB.GetEntryCount(); ++i ) { OUString* pFactory = (OUString*)(sal_uIntPtr)aActiveLB.GetEntryData(i); - if ( pFactory->toAsciiLowerCase() == pIPage->GetFactory() ) + *pFactory = pFactory->toAsciiLowerCase(); + if ( *pFactory == pIPage->GetFactory() ) { if ( aActiveLB.GetSelectEntryPos() != i ) { 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 += "..."; } |