Kaydet (Commit) caa828da authored tarafından Matteo Casalin's avatar Matteo Casalin

Avoid unnecessary OUString copies

Change-Id: Ic76c9b75bcc72d8ae6a54d6ebba49acb77073bea
üst 6917ebc3
......@@ -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
......
......@@ -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 )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment