[Libreoffice-commits] core.git: sfx2/source svx/source

Caolán McNamara caolanm at redhat.com
Thu Sep 5 03:53:02 PDT 2013


 sfx2/source/appl/appdde.cxx          |    6 ++----
 sfx2/source/appl/helpinterceptor.cxx |    4 ++--
 sfx2/source/appl/newhelp.cxx         |    3 ++-
 svx/source/dialog/fntctrl.cxx        |    6 +++++-
 svx/source/dialog/pagectrl.cxx       |    2 +-
 svx/source/form/datanavi.cxx         |    4 +++-
 svx/source/svdraw/svdotext.cxx       |    2 +-
 7 files changed, 16 insertions(+), 11 deletions(-)

New commits:
commit cb92e6440cebbdf307e5740325d04d9656440fd8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Sep 5 10:41:27 2013 +0100

    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

diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx
index cf9a739..f3efec1 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 40044ab..fc05688 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 5b09cdb..1b231fc 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 c19acdb..04d175b 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 a08f8fe..d645628 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 66cffba..58f74cbb 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 1615b04..feefd80 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 += "...";
             }
 


More information about the Libreoffice-commits mailing list