diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-08-15 17:26:28 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-08-16 09:10:21 +0200 |
commit | caa828da96b120f5a3c979237081c29f8c2f3848 (patch) | |
tree | d0c0b4c2207f93e71d156ad6fad9c13a15859a5f /vcl | |
parent | 6917ebc39fb1c4f412ae9fea4e2d858a1b351c47 (diff) |
Avoid unnecessary OUString copies
Change-Id: Ic76c9b75bcc72d8ae6a54d6ebba49acb77073bea
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/edit/textdoc.cxx | 9 | ||||
-rw-r--r-- | vcl/source/edit/texteng.cxx | 6 |
2 files changed, 6 insertions, 9 deletions
diff --git a/vcl/source/edit/textdoc.cxx b/vcl/source/edit/textdoc.cxx index d13c5f91a12d..10315efe00e3 100644 --- a/vcl/source/edit/textdoc.cxx +++ b/vcl/source/edit/textdoc.cxx @@ -436,8 +436,7 @@ OUString TextDoc::GetText( const sal_Unicode* pSep ) const for ( sal_uInt32 nNode = 0; nNode < nNodes; ++nNode ) { TextNode* pNode = maTextNodes[ nNode ]; - OUString aTmp( pNode->GetText() ); - aASCIIText += aTmp; + aASCIIText += pNode->GetText(); if ( pSep && ( nNode != nLastNode ) ) aASCIIText += pSep; } @@ -447,13 +446,11 @@ OUString TextDoc::GetText( const sal_Unicode* pSep ) const OUString TextDoc::GetText( sal_uInt32 nPara ) const { - OUString aText; - TextNode* pNode = ( nPara < maTextNodes.size() ) ? maTextNodes[ nPara ] : 0; if ( pNode ) - aText = pNode->GetText(); + return pNode->GetText(); - return aText; + return OUString(); } sal_uLong TextDoc::GetTextLen( const sal_Unicode* pSep, const TextSelection* pSel ) const diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index 9f2d3a777008..90343f19b02d 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -699,9 +699,9 @@ TextPaM TextEngine::ImpInsertText( sal_Unicode c, const TextSelection& rCurSel, // the text that needs to be checked is only the one // before the current cursor position OUString aOldText( mpDoc->GetText( aPaM.GetPara() ).copy(0, nTmpPos) ); - OUString aNewText( aOldText ); if (aCTLOptions.IsCTLSequenceCheckingTypeAndReplace()) { + OUString aNewText( aOldText ); xISC->correctInputSequence( aNewText, nTmpPos - 1, c, nCheckMode ); // find position of first character that has changed @@ -2530,7 +2530,7 @@ bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML OUStringBuffer aText; if ( !bHTML ) { - aText = OUString( pNode->GetText().copy( nStartPos, nEndPos-nStartPos ) ); + aText = pNode->GetText().copy( nStartPos, nEndPos-nStartPos ); } else { @@ -2551,7 +2551,7 @@ bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML nTmpEnd = pAttr ? pAttr->GetStart() : nEndPos; // Text before Attribute - aText.append( OUString( pNode->GetText().copy( nTmpStart, nTmpEnd-nTmpStart ) ) ); + aText.append( pNode->GetText().copy( nTmpStart, nTmpEnd-nTmpStart ) ); if ( pAttr ) { |