summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-07-28 11:28:52 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-07-28 17:22:52 +0200
commitd407304544cdb2edc3cbdb4e56d49f3ceda79c38 (patch)
tree765668628540687b669d67b14d824adb893c1308 /cui
parentfa87224130a4ab6c4b79f993cc990adc4be0465b (diff)
loplugin:stringloop cui,dbaccess
Change-Id: I32b63d2435d36b869823ea022ebd7f8347a46ea0 Reviewed-on: https://gerrit.libreoffice.org/58211 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/customize/cfg.cxx6
-rw-r--r--cui/source/dialogs/FontFeaturesDialog.cxx16
-rw-r--r--cui/source/dialogs/SpellDialog.cxx16
-rw-r--r--cui/source/dialogs/multipat.cxx20
-rw-r--r--cui/source/dialogs/screenshotannotationdlg.cxx6
-rw-r--r--cui/source/dialogs/scriptdlg.cxx10
-rw-r--r--cui/source/options/optaboutconfig.cxx38
-rw-r--r--cui/source/options/optjava.cxx8
-rw-r--r--cui/source/options/optpath.cxx20
9 files changed, 70 insertions, 70 deletions
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 466b2caa877d..29f8641eacef 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -3345,16 +3345,16 @@ void SvxIconSelectorDialog::ImportGraphics(
if ( rejectedCount != 0 )
{
- OUString message;
+ OUStringBuffer message;
OUString fPath;
if (rejectedCount > 1)
fPath = rPaths[0].copy(8) + "/";
for ( sal_Int32 i = 0; i < rejectedCount; ++i )
{
- message += fPath + rejected[i] + "\n";
+ message.append(fPath).append(rejected[i]).append("\n");
}
- SvxIconChangeDialog aDialog(GetFrameWeld(), message);
+ SvxIconChangeDialog aDialog(GetFrameWeld(), message.makeStringAndClear());
(void)aDialog.run();
}
}
diff --git a/cui/source/dialogs/FontFeaturesDialog.cxx b/cui/source/dialogs/FontFeaturesDialog.cxx
index 676f216e25ec..21c71ce753b7 100644
--- a/cui/source/dialogs/FontFeaturesDialog.cxx
+++ b/cui/source/dialogs/FontFeaturesDialog.cxx
@@ -177,7 +177,7 @@ IMPL_LINK_NOARG(FontFeaturesDialog, ComboBoxSelectedHdl, ComboBox&, void) { upda
OUString FontFeaturesDialog::createFontNameWithFeatures()
{
OUString sResultFontName;
- OUString sNameSuffix;
+ OUStringBuffer sNameSuffix;
bool bFirst = true;
for (FontFeatureItem& rItem : m_aFeatureItems)
@@ -187,11 +187,11 @@ OUString FontFeaturesDialog::createFontNameWithFeatures()
if (rItem.m_pCheck->IsChecked())
{
if (!bFirst)
- sNameSuffix += OUString(vcl::font::FeatureSeparator);
+ sNameSuffix.append(OUString(vcl::font::FeatureSeparator));
else
bFirst = false;
- sNameSuffix += vcl::font::featureCodeAsString(rItem.m_aFeatureCode);
+ sNameSuffix.append(vcl::font::featureCodeAsString(rItem.m_aFeatureCode));
}
}
else if (rItem.m_pCombo && rItem.m_pText)
@@ -200,19 +200,19 @@ OUString FontFeaturesDialog::createFontNameWithFeatures()
if (nSelection > 0)
{
if (!bFirst)
- sNameSuffix += OUString(vcl::font::FeatureSeparator);
+ sNameSuffix.append(OUString(vcl::font::FeatureSeparator));
else
bFirst = false;
- sNameSuffix += vcl::font::featureCodeAsString(rItem.m_aFeatureCode);
- sNameSuffix += "=";
- sNameSuffix += OUString::number(nSelection);
+ sNameSuffix.append(vcl::font::featureCodeAsString(rItem.m_aFeatureCode));
+ sNameSuffix.append("=");
+ sNameSuffix.append(OUString::number(nSelection));
}
}
}
sResultFontName = vcl::font::trimFontNameFeatures(m_sFontName);
if (!sNameSuffix.isEmpty())
- sResultFontName += OUString(vcl::font::FeaturePrefix) + sNameSuffix;
+ sResultFontName += OUString(vcl::font::FeaturePrefix) + sNameSuffix.makeStringAndClear();
return sResultFontName;
}
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index 073095d01c5f..7552ce613fcb 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -1034,14 +1034,14 @@ bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence, bool bRecheck)
if(!aSentence.empty())
{
- OUString sText;
+ OUStringBuffer sText;
for (auto const& elem : aSentence)
{
// hidden text has to be ignored
if(!elem.bIsHidden)
- sText += elem.sText;
+ sText.append(elem.sText);
}
- m_pSentenceED->SetText(sText);
+ m_pSentenceED->SetText(sText.makeStringAndClear());
sal_Int32 nStartPosition = 0;
sal_Int32 nEndPosition = 0;
@@ -1882,22 +1882,22 @@ svx::SpellPortions SentenceEditWindow_Impl::CreateSpellPortions() const
const sal_uInt32 nPara = pTextEngine->GetParagraphCount();
if (nPara > 1)
{
- OUString aLeftOverText;
+ OUStringBuffer aLeftOverText;
for (sal_uInt32 i = 1; i < nPara; ++i)
{
- aLeftOverText += "\x0a"; // the manual line break...
- aLeftOverText += pTextEngine->GetText(i);
+ aLeftOverText.append("\x0a"); // the manual line break...
+ aLeftOverText.append(pTextEngine->GetText(i));
}
if (pError)
{ // we need to add a new portion containing the left-over text
svx::SpellPortion aPortion2;
aPortion2.eLanguage = eLang;
- aPortion2.sText = aLeftOverText;
+ aPortion2.sText = aLeftOverText.makeStringAndClear();
aRet.push_back( aPortion2 );
}
else
{ // we just need to append the left-over text to the last portion (which had no errors)
- aRet[ aRet.size() - 1 ].sText += aLeftOverText;
+ aRet[ aRet.size() - 1 ].sText += aLeftOverText.makeStringAndClear();
}
}
}
diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx
index ec1ecffa957f..a5f0734b85f2 100644
--- a/cui/source/dialogs/multipat.cxx
+++ b/cui/source/dialogs/multipat.cxx
@@ -246,7 +246,7 @@ void SvxMultiPathDialog::dispose()
OUString SvxMultiPathDialog::GetPath() const
{
- OUString sNewPath;
+ OUStringBuffer sNewPath;
sal_Unicode cDelim = SVT_SEARCHPATH_DELIMITER;
OUString sWritable;
@@ -258,29 +258,29 @@ OUString SvxMultiPathDialog::GetPath() const
else
{
if ( !sNewPath.isEmpty() )
- sNewPath += OUStringLiteral1(cDelim);
- sNewPath += *static_cast<OUString*>(pEntry->GetUserData());
+ sNewPath.append(cDelim);
+ sNewPath.append( *static_cast<OUString*>(pEntry->GetUserData()) );
}
}
if ( !sNewPath.isEmpty() )
- sNewPath += OUStringLiteral1(cDelim);
- sNewPath += sWritable;
+ sNewPath.append(cDelim);
+ sNewPath.append(sWritable);
- return sNewPath;
+ return sNewPath.makeStringAndClear();
}
OUString SvxPathSelectDialog::GetPath() const
{
- OUString sNewPath;
+ OUStringBuffer sNewPath;
for (int i = 0; i < m_xPathLB->n_children(); ++i)
{
if ( !sNewPath.isEmpty() )
- sNewPath += OUStringLiteral1(SVT_SEARCHPATH_DELIMITER);
- sNewPath += m_xPathLB->get_id(i);
+ sNewPath.append(SVT_SEARCHPATH_DELIMITER);
+ sNewPath.append( m_xPathLB->get_id(i));
}
- return sNewPath;
+ return sNewPath.makeStringAndClear();
}
void SvxMultiPathDialog::SetPath( const OUString& rPath )
diff --git a/cui/source/dialogs/screenshotannotationdlg.cxx b/cui/source/dialogs/screenshotannotationdlg.cxx
index d0fa722fe0d5..86e53c89e081 100644
--- a/cui/source/dialogs/screenshotannotationdlg.cxx
+++ b/cui/source/dialogs/screenshotannotationdlg.cxx
@@ -599,14 +599,14 @@ IMPL_LINK(ScreenshotAnnotationDlg_Impl, pictureFrameListener, VclWindowEvent&, r
maSelected.insert(mpHilighted);
}
- OUString aBookmarks;
+ OUStringBuffer aBookmarks(maMainMarkupText);
for (auto&& rCandidate : maSelected)
{
OUString aHelpId = OStringToOUString( rCandidate->GetHelpId(), RTL_TEXTENCODING_UTF8 );
- aBookmarks += lcl_Bookmark( aHelpId );
+ aBookmarks.append(lcl_Bookmark( aHelpId ));
}
- mpText->SetText( maMainMarkupText + aBookmarks );
+ mpText->SetText( aBookmarks.makeStringAndClear() );
bRepaint = true;
}
break;
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index 18ee71314a1f..7e6d8ac97d0e 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -1090,12 +1090,12 @@ bool SvxScriptOrgDialog::getBoolProperty( Reference< beans::XPropertySet > const
OUString SvxScriptOrgDialog::getListOfChildren( const Reference< browse::XBrowseNode >& node, int depth )
{
- OUString result = "\n";
+ OUStringBuffer result = "\n";
for( int i=0;i<=depth;i++ )
{
- result += "\t";
+ result.append("\t");
}
- result += node->getName();
+ result.append(node->getName());
try
{
@@ -1105,7 +1105,7 @@ OUString SvxScriptOrgDialog::getListOfChildren( const Reference< browse::XBrowse
= node->getChildNodes();
for ( sal_Int32 n = 0; n < children.getLength(); n++ )
{
- result += getListOfChildren( children[ n ] , depth+1 );
+ result.append( getListOfChildren( children[ n ] , depth+1 ) );
}
}
}
@@ -1114,7 +1114,7 @@ OUString SvxScriptOrgDialog::getListOfChildren( const Reference< browse::XBrowse
// ignore, will return an empty string
}
- return result;
+ return result.makeStringAndClear();
}
Selection_hash SvxScriptOrgDialog::m_lastSelection;
diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx
index 54348cbe63f1..2d81d02f4ee2 100644
--- a/cui/source/options/optaboutconfig.cxx
+++ b/cui/source/options/optaboutconfig.cxx
@@ -310,7 +310,7 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
);
OUString sType = aNode.getValueTypeName();
- OUString sValue;
+ OUStringBuffer sValue;
if (it != m_modifiedPrefBoxEntries.end())
sValue = static_cast< SvLBoxString& >( (*it)->GetItem(4) ).GetText();
@@ -347,9 +347,9 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
{
if( j != 0 )
{
- sValue += ",";
+ sValue.append(",");
}
- sValue += OUString::boolean( seq[j] );
+ sValue.append(OUString::boolean( seq[j] ));
}
}
else if( sType == "[]byte" )
@@ -361,9 +361,9 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
static_cast<sal_uInt8>(seq[j]), 16 );
if( s.getLength() == 1 )
{
- sValue += "0";
+ sValue.append("0");
}
- sValue += s.toAsciiUpperCase();
+ sValue.append(s.toAsciiUpperCase());
}
}
else if( sType == "[][]byte" )
@@ -373,7 +373,7 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
{
if( j != 0 )
{
- sValue += ",";
+ sValue.append(",");
}
for( sal_Int32 k = 0; k != seq[j].getLength(); ++k )
{
@@ -381,9 +381,9 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
static_cast<sal_uInt8>(seq[j][k]), 16 );
if( s.getLength() == 1 )
{
- sValue += "0";
+ sValue.append("0");
}
- sValue += s.toAsciiUpperCase();
+ sValue.append(s.toAsciiUpperCase());
}
}
}
@@ -394,9 +394,9 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
{
if( j != 0 )
{
- sValue += ",";
+ sValue.append(",");
}
- sValue += OUString::number( seq[j] );
+ sValue.append(OUString::number( seq[j] ));
}
}
else if( sType == "[]long" )
@@ -406,9 +406,9 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
{
if( j != 0 )
{
- sValue += ",";
+ sValue.append(",");
}
- sValue += OUString::number( seq[j] );
+ sValue.append(OUString::number( seq[j] ));
}
}
else if( sType == "[]hyper" )
@@ -418,9 +418,9 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
{
if( j != 0 )
{
- sValue += ",";
+ sValue.append(",");
}
- sValue += OUString::number( seq[j] );
+ sValue.append(OUString::number( seq[j] ));
}
}
else if( sType == "[]double" )
@@ -430,9 +430,9 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
{
if( j != 0 )
{
- sValue += ",";
+ sValue.append(",");
}
- sValue += OUString::number( seq[j] );
+ sValue.append(OUString::number( seq[j] ));
}
}
else if( sType == "[]string" )
@@ -442,9 +442,9 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
{
if( j != 0 )
{
- sValue += ",";
+ sValue.append(",");
}
- sValue += seq[j];
+ sValue.append(seq[j]);
}
}
else
@@ -470,7 +470,7 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
for(int j = 1; j < lineage; ++j)
index = sPath.indexOf("/", index + 1);
- InsertEntry(sPath, sPath.copy(index+1), seqItems[i], sType, sValue, pParentEntry, !bLoadAll);
+ InsertEntry(sPath, sPath.copy(index+1), seqItems[i], sType, sValue.makeStringAndClear(), pParentEntry, !bLoadAll);
}
}
}
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index dd76e58280d0..6c72fb818e5e 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -984,15 +984,15 @@ bool SvxJavaClassPathDlg::IsPathDuplicate( const OUString& _rPath )
OUString SvxJavaClassPathDlg::GetClassPath() const
{
- OUString sPath;
+ OUStringBuffer sPath;
int nCount = m_xPathList->n_children();
for (int i = 0; i < nCount; ++i)
{
if (!sPath.isEmpty())
- sPath += OUStringLiteral1(CLASSPATH_DELIMITER);
- sPath += m_xPathList->get_text(i);
+ sPath.append(CLASSPATH_DELIMITER);
+ sPath.append(m_xPathList->get_text(i));
}
- return sPath;
+ return sPath.makeStringAndClear();
}
void SvxJavaClassPathDlg::SetClassPath( const OUString& _rPath )
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx
index cca312d78608..24f167b94bba 100644
--- a/cui/source/options/optpath.cxx
+++ b/cui/source/options/optpath.cxx
@@ -147,24 +147,23 @@ static OUString getCfgName_Impl( sal_uInt16 _nHandle )
static OUString Convert_Impl( const OUString& rValue )
{
- OUString aReturn;
if (rValue.isEmpty())
- return aReturn;
+ return OUString();
sal_Int32 nPos = 0;
-
+ OUStringBuffer aReturn;
for (;;)
{
OUString aValue = rValue.getToken( 0, MULTIPATH_DELIMITER, nPos );
INetURLObject aObj( aValue );
if ( aObj.GetProtocol() == INetProtocol::File )
- aReturn += aObj.PathToFileName();
+ aReturn.append(aObj.PathToFileName());
if ( nPos < 0 )
break;
- aReturn += OUStringLiteral1(MULTIPATH_DELIMITER);
+ aReturn.append(MULTIPATH_DELIMITER);
}
- return aReturn;
+ return aReturn.makeStringAndClear();
}
// functions -------------------------------------------------------------
@@ -438,7 +437,8 @@ IMPL_LINK_NOARG(SvxPathTabPage, StandardHdl_Impl, Button*, void)
}
while ( nOldPos >= 0 );
- OUString sUserPath, sWritablePath;
+ OUString sWritablePath;
+ OUStringBuffer sUserPath;
if ( !sTemp.isEmpty() )
{
sal_Int32 nNextPos = 0;
@@ -452,13 +452,13 @@ IMPL_LINK_NOARG(SvxPathTabPage, StandardHdl_Impl, Button*, void)
break;
}
if ( !sUserPath.isEmpty() )
- sUserPath += OUStringLiteral1(MULTIPATH_DELIMITER);
- sUserPath += sToken;
+ sUserPath.append(MULTIPATH_DELIMITER);
+ sUserPath.append(sToken);
}
}
pPathBox->SetEntryText( Convert_Impl( sTemp ), pEntry, 1 );
pPathImpl->eState = SfxItemState::SET;
- pPathImpl->sUserPath = sUserPath;
+ pPathImpl->sUserPath = sUserPath.makeStringAndClear();
pPathImpl->sWritablePath = sWritablePath;
}
pEntry = pPathBox->NextSelected( pEntry );