summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Branch <andyb1.lod@gmail.com>2013-02-20 20:43:58 +0000
committerMichael Stahl <mstahl@redhat.com>2013-02-21 12:33:56 +0000
commit868cb16417f7a4c9bdbb55b6262eddad3db6dc14 (patch)
treef9f41143fb185cc46adce85bb0a4de0c741bfcb6
parent437b044caea90badab6f99dc609ea07e37dc5feb (diff)
fdo#57950: Remove some chained appends in filter in sw/access
Change-Id: I9f3b44d6ea154d628dd59e31d9403097809a2853 Reviewed-on: https://gerrit.libreoffice.org/2300 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--sw/source/core/access/accmap.cxx4
-rw-r--r--sw/source/core/access/accportions.cxx20
-rw-r--r--sw/source/core/access/acctable.cxx26
3 files changed, 13 insertions, 37 deletions
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 4f737a84c7df..513c1957e097 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -175,9 +175,7 @@ void SwDrawModellListener_Impl::Notify( SfxBroadcaster& /*rBC*/,
{
(void)r;
#if OSL_DEBUG_LEVEL > 0
- rtl::OStringBuffer aError(RTL_CONSTASCII_STRINGPARAM("Runtime exception caught while notifying shape.:\n"));
- aError.append(rtl::OUStringToOString(r.Message, RTL_TEXTENCODING_ASCII_US));
- OSL_FAIL( aError.getStr() );
+ OSL_FAIL( "Runtime exception caught while notifying shape.:\n" + OUStringToOString(r.Message, RTL_TEXTENCODING_ASCII_US) );
#endif
}
}
diff --git a/sw/source/core/access/accportions.cxx b/sw/source/core/access/accportions.cxx
index 8e1e2fff9081..5b2e0ac39e83 100644
--- a/sw/source/core/access/accportions.cxx
+++ b/sw/source/core/access/accportions.cxx
@@ -141,40 +141,34 @@ void SwAccessiblePortionData::Special(
// construct string with representation; either directly from
// rText, or use resources for special case portions
- String sDisplay;
+ OUString sDisplay;
switch( nType )
{
case POR_POSTITS:
case POR_FLYCNT:
case POR_GRFNUM:
- sDisplay = rtl::OUString(sal_Unicode(0xfffc));
+ sDisplay = OUString(sal_Unicode(0xfffc));
break;
case POR_NUMBER:
{
- OUStringBuffer aTmpBuffer( rText.Len() + 1 );
- aTmpBuffer.append( rText );
- aTmpBuffer.append( sal_Unicode(' ') );
- sDisplay = aTmpBuffer.makeStringAndClear();
+ sDisplay = OUString( rText ) + " ";
break;
}
// #i111768# - apply patch from kstribley:
// Include the control characters.
case POR_CONTROLCHAR:
{
- OUStringBuffer aTmpBuffer( rText.Len() + 1 );
- aTmpBuffer.append( rText );
- aTmpBuffer.append( pTxtNode->GetTxt()[nModelPosition] );
- sDisplay = aTmpBuffer.makeStringAndClear();
+ sDisplay = OUString( rText ) + OUString( pTxtNode->GetTxt()[nModelPosition] );
break;
}
default:
- sDisplay = rText;
+ sDisplay = OUString( rText );
break;
}
// ignore zero/zero portions (except for terminators)
- if( (nLength == 0) && (sDisplay.Len() == 0) && (nType != POR_TERMINATE) )
+ if( (nLength == 0) && (sDisplay.getLength() == 0) && (nType != POR_TERMINATE) )
return;
// special treatment for zero length portion at the beginning:
@@ -194,7 +188,7 @@ void SwAccessiblePortionData::Special(
aPortionAttrs.push_back( nAttr );
// update buffer + nModelPosition
- aBuffer.append( OUString(sDisplay) );
+ aBuffer.append( sDisplay );
nModelPosition += nLength;
// remember 'last' special portion (unless it's our own 'closing'
diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx
index 1db6a3896d53..d50c806d3436 100644
--- a/sw/source/core/access/acctable.cxx
+++ b/sw/source/core/access/acctable.cxx
@@ -692,12 +692,7 @@ SwAccessibleTable::SwAccessibleTable(
const_cast< SwFrmFmt * >( pFrmFmt )->Add( this );
const String& rName = pFrmFmt->GetName();
- OUStringBuffer aBuffer( rName.Len() + 4 );
- aBuffer.append( OUString(rName) );
- aBuffer.append( static_cast<sal_Unicode>( '-' ) );
- aBuffer.append( static_cast<sal_Int32>( pTabFrm->GetPhyPageNum() ) );
-
- SetName( aBuffer.makeStringAndClear() );
+ SetName( OUString( rName ) + "-" + OUString::number( pTabFrm->GetPhyPageNum() ) );
OUString sArg1( static_cast< const SwTabFrm * >( GetFrm() )
->GetFmt()->GetName() );
@@ -728,12 +723,9 @@ void SwAccessibleTable::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew
OUString sOldName( GetName() );
const String& rNewTabName = pFrmFmt->GetName();
- OUStringBuffer aBuffer( rNewTabName.Len() + 4 );
- aBuffer.append( OUString(rNewTabName) );
- aBuffer.append( static_cast<sal_Unicode>( '-' ) );
- aBuffer.append( static_cast<sal_Int32>( pTabFrm->GetPhyPageNum() ) );
- SetName( aBuffer.makeStringAndClear() );
+ SetName( OUString(rNewTabName) + "-" + OUString::number( pTabFrm->GetPhyPageNum() ) );
+
if( sOldName != GetName() )
{
AccessibleEventObject aEvent;
@@ -1611,17 +1603,9 @@ SwAccessibleTableColHeaders::SwAccessibleTableColHeaders( SwAccessibleMap *pMap2
const_cast< SwFrmFmt * >( pFrmFmt )->Add( this );
const String& rName = pFrmFmt->GetName();
- OUStringBuffer aBuffer( rName.Len() + 15 + 6 );
- aBuffer.append( OUString(rName) );
- aBuffer.append( rtl::OUString("-ColumnHeaders-") );
- aBuffer.append( static_cast<sal_Int32>( pTabFrm->GetPhyPageNum() ) );
-
- SetName( aBuffer.makeStringAndClear() );
+ SetName( OUString(rName) + "-ColumnHeaders-" + OUString::number( pTabFrm->GetPhyPageNum() ) );
- OUStringBuffer aBuffer2( rName.Len() + 14 );
- aBuffer2.append( OUString(rName) );
- aBuffer2.append( rtl::OUString("-ColumnHeaders") );
- OUString sArg1( aBuffer2.makeStringAndClear() );
+ OUString sArg1( OUString(rName) + "-ColumnHeaders" );
OUString sArg2( GetFormattedPageNumber() );
OUString sDesc2 = GetResource( STR_ACCESS_TABLE_DESC, &sArg1, &sArg2 );