diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-01 17:03:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-01 21:40:17 +0200 |
commit | 52f69445c55c9af8ad97bee6da335b4592d56d4d (patch) | |
tree | d88b7e629213b157af2113b64e54aaf08fc2cfc7 /sc/source/ui/optdlg | |
parent | 28580110807a38e3ba6f8385f22871b8dfe0a910 (diff) |
loplugin:stringloop in sc
Change-Id: I12c020d5dd75d9c8ffcb7a2e8d6ff310628fa04d
Reviewed-on: https://gerrit.libreoffice.org/58432
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui/optdlg')
-rw-r--r-- | sc/source/ui/optdlg/tpusrlst.cxx | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx index 6b13e971cc1b..bc5b96ef428f 100644 --- a/sc/source/ui/optdlg/tpusrlst.cxx +++ b/sc/source/ui/optdlg/tpusrlst.cxx @@ -277,16 +277,16 @@ void ScTpUserLists::UpdateEntries( size_t nList ) { const ScUserListData& rList = (*pUserLists)[nList]; std::size_t nSubCount = rList.GetSubCount(); - OUString aEntryListStr; + OUStringBuffer aEntryListStr; for ( size_t i=0; i<nSubCount; i++ ) { if ( i!=0 ) - aEntryListStr += OUStringLiteral1(CR); - aEntryListStr += rList.GetSubStr(i); + aEntryListStr.append(CR); + aEntryListStr.append(rList.GetSubStr(i)); } - mpEdEntries->SetText(convertLineEnd(aEntryListStr, GetSystemLineEnd())); + mpEdEntries->SetText(convertLineEnd(aEntryListStr.makeStringAndClear(), GetSystemLineEnd())); } else { @@ -296,18 +296,18 @@ void ScTpUserLists::UpdateEntries( size_t nList ) void ScTpUserLists::MakeListStr( OUString& rListStr ) { - OUString aStr; + OUStringBuffer aStr; sal_Int32 nToken = comphelper::string::getTokenCount(rListStr, LF); for(sal_Int32 i=0; i<nToken; i++) { OUString aString = comphelper::string::strip(rListStr.getToken(i, LF), ' '); - aStr += aString; - aStr += OUStringLiteral1(cDelimiter); + aStr.append(aString); + aStr.append(cDelimiter); } - aStr = comphelper::string::strip(aStr, cDelimiter); + aStr.strip(cDelimiter); sal_Int32 nLen = aStr.getLength(); rListStr.clear(); @@ -367,53 +367,51 @@ void ScTpUserLists::CopyListFromArea( const ScRefAddress& rStartPos, if ( nCellDir != RET_CANCEL ) { bool bValueIgnored = false; - OUString aStrList; - OUString aStrField; if ( nCellDir == SCRET_COLS ) { for ( SCCOL col=nStartCol; col<=nEndCol; col++ ) { + OUStringBuffer aStrList; for ( SCROW row=nStartRow; row<=nEndRow; row++ ) { if ( pDoc->HasStringData( col, row, nTab ) ) { - aStrField = pDoc->GetString(col, row, nTab); + OUString aStrField = pDoc->GetString(col, row, nTab); if ( !aStrField.isEmpty() ) { - aStrList += aStrField + "\n"; + aStrList.append(aStrField).append("\n"); } } else bValueIgnored = true; } if ( !aStrList.isEmpty() ) - AddNewList( aStrList ); - aStrList.clear(); + AddNewList( aStrList.makeStringAndClear() ); } } else { for ( SCROW row=nStartRow; row<=nEndRow; row++ ) { + OUStringBuffer aStrList; for ( SCCOL col=nStartCol; col<=nEndCol; col++ ) { if ( pDoc->HasStringData( col, row, nTab ) ) { - aStrField = pDoc->GetString(col, row, nTab); + OUString aStrField = pDoc->GetString(col, row, nTab); if ( !aStrField.isEmpty() ) { - aStrList += aStrField + "\n"; + aStrList.append(aStrField).append("\n"); } } else bValueIgnored = true; } if ( !aStrList.isEmpty() ) - AddNewList( aStrList ); - aStrList.clear(); + AddNewList( aStrList.makeStringAndClear() ); } } |