From 1577d93102ab87952309eafefa497aa88e97de21 Mon Sep 17 00:00:00 2001 From: Matteo Casalin Date: Thu, 25 Dec 2014 17:35:22 +0100 Subject: Optimize consecutive token accesses in OUStrings Change-Id: I988d80665bc61d1a0a96614790735d83bd9e5dde --- sw/source/core/fields/ddetbl.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sw') diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx index 1f963fe8c6c9..a13560386e2a 100644 --- a/sw/source/core/fields/ddetbl.cxx +++ b/sw/source/core/fields/ddetbl.cxx @@ -109,10 +109,12 @@ void SwDDETable::ChangeContent() SwDDEFieldType* pDDEType = static_cast(aDepend.GetRegisteredIn()); OUString aExpand = comphelper::string::remove(pDDEType->GetExpansion(), '\r'); + sal_Int32 nExpandTokenPos = 0; for( sal_uInt16 n = 0; n < aLines.size(); ++n ) { - OUString aLine = aExpand.getToken( n, '\n' ); + OUString aLine = aExpand.getToken( 0, '\n', nExpandTokenPos ); + sal_Int32 nLineTokenPos = 0; SwTableLine* pLine = aLines[ n ]; for( sal_uInt16 i = 0; i < pLine->GetTabBoxes().size(); ++i ) { @@ -123,7 +125,7 @@ void SwDDETable::ChangeContent() OSL_ENSURE( pTxtNode, "No Node" ); SwIndex aCntIdx( pTxtNode, 0 ); pTxtNode->EraseText( aCntIdx ); - pTxtNode->InsertText( aLine.getToken( i, '\t' ), aCntIdx ); + pTxtNode->InsertText( aLine.getToken( 0, '\t', nLineTokenPos ), aCntIdx ); SwTableBoxFmt* pBoxFmt = static_cast(pBox->GetFrmFmt()); pBoxFmt->LockModify(); -- cgit