diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-14 14:27:57 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-15 14:33:57 +0200 |
commit | f13c6ad5f020a196a0e3aa6f28bda3dc185d465b (patch) | |
tree | f9aaab122974d36c134fb1723ec3c1c8df51eeef /sc/source/ui | |
parent | 9270f74466d0eb841babaa24997f608631c70341 (diff) |
new loplugin:bufferadd
look for OUStringBuffer append sequences that can be turned
into creating an OUString with + operations
Change-Id: Ica840dc096000307b4a105fb4d9ec7588a15ade6
Reviewed-on: https://gerrit.libreoffice.org/80809
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 7 | ||||
-rw-r--r-- | sc/source/ui/app/inputwin.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/scabstdlg.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/dbgui/pfiltdlg.cxx | 7 | ||||
-rw-r--r-- | sc/source/ui/docshell/documentlinkmgr.cxx | 20 | ||||
-rw-r--r-- | sc/source/ui/formdlg/formula.cxx | 7 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/datafdlg.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/navipi/content.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun6.cxx | 17 |
9 files changed, 33 insertions, 52 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 111c57d9f105..6d897489bfcc 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -1551,11 +1551,8 @@ static OUString lcl_Calculate( const OUString& rFormula, ScDocument* pDoc, const if ( pCalc->GetCode()->GetCodeLen() <= 1 ) { // ==1: Single one is as a Parameter always a Range // ==0: It might be one, if ... - OUStringBuffer aBraced; - aBraced.append('('); - aBraced.append(rFormula); - aBraced.append(')'); - pCalc.reset( new ScSimpleFormulaCalculator( pDoc, rPos, aBraced.makeStringAndClear(), false ) ); + OUString aBraced = "(" + rFormula + ")"; + pCalc.reset( new ScSimpleFormulaCalculator( pDoc, rPos, aBraced, false ) ); } else bColRowName = false; diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index ebfe92e781f8..4ff8735e0950 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -2028,11 +2028,7 @@ namespace { OUString createLocalRangeName(const OUString& rName, const OUString& rTableName) { - OUStringBuffer aString (rName); - aString.append(" ("); - aString.append(rTableName); - aString.append(")"); - return aString.makeStringAndClear(); + return rName + " (" + rTableName + ")"; } } diff --git a/sc/source/ui/attrdlg/scabstdlg.cxx b/sc/source/ui/attrdlg/scabstdlg.cxx index 1b5e0ddde237..3d74406e0f4a 100644 --- a/sc/source/ui/attrdlg/scabstdlg.cxx +++ b/sc/source/ui/attrdlg/scabstdlg.cxx @@ -41,10 +41,9 @@ ScAbstractDialogFactory* ScAbstractDialogFactory::Create() #ifndef DISABLE_DYNLOADING static ::osl::Module aDialogLibrary; - OUStringBuffer aStrBuf; - aStrBuf.append( SVLIBRARY("scui") ); + OUString aStrBuf = SVLIBRARY("scui"); - if ( aDialogLibrary.is() || aDialogLibrary.loadRelative( &thisModule, aStrBuf.makeStringAndClear(), + if ( aDialogLibrary.is() || aDialogLibrary.loadRelative( &thisModule, aStrBuf, SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_LAZY ) ) fp = reinterpret_cast<ScAbstractDialogFactory* (SAL_CALL*)()>( aDialogLibrary.getFunctionSymbol( "ScCreateDialogFactory" )); diff --git a/sc/source/ui/dbgui/pfiltdlg.cxx b/sc/source/ui/dbgui/pfiltdlg.cxx index e53f0cfc43a7..8ab7a954f440 100644 --- a/sc/source/ui/dbgui/pfiltdlg.cxx +++ b/sc/source/ui/dbgui/pfiltdlg.cxx @@ -126,11 +126,8 @@ void ScPivotFilterDlg::Init( const SfxItemSet& rArgSet ) theDbName = pDBData->GetName(); } - OUStringBuffer aBuf; - aBuf.append(" ("); - aBuf.append(theDbName); - aBuf.append(')'); - m_xFtDbArea->set_label(aBuf.makeStringAndClear()); + OUString sLabel = " (" + theDbName + ")"; + m_xFtDbArea->set_label(sLabel); } else { diff --git a/sc/source/ui/docshell/documentlinkmgr.cxx b/sc/source/ui/docshell/documentlinkmgr.cxx index 479d1b0e56b2..cb3467c8bb69 100644 --- a/sc/source/ui/docshell/documentlinkmgr.cxx +++ b/sc/source/ui/docshell/documentlinkmgr.cxx @@ -193,18 +193,18 @@ bool DocumentLinkManager::updateDdeOrOleOrWebServiceLinks(weld::Window* pWin) const OUString& aElem = pDdeLink->GetItem(); const OUString& aType = pDdeLink->GetAppl(); - OUStringBuffer aBuf; - aBuf.append(ScResId(SCSTR_DDEDOC_NOT_LOADED)); - aBuf.append("\n\n"); - aBuf.append("Source : "); - aBuf.append(aFile); - aBuf.append("\nElement : "); - aBuf.append(aElem); - aBuf.append("\nType : "); - aBuf.append(aType); + OUString sMessage = + ScResId(SCSTR_DDEDOC_NOT_LOADED) + + "\n\n" + "Source : " + + aFile + + "\nElement : " + + aElem + + "\nType : " + + aType; std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin, VclMessageType::Warning, VclButtonsType::Ok, - aBuf.makeStringAndClear())); + sMessage)); xBox->run(); } } diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx index b87662fb98d1..d71351840b85 100644 --- a/sc/source/ui/formdlg/formula.cxx +++ b/sc/source/ui/formdlg/formula.cxx @@ -309,12 +309,9 @@ bool ScFormulaDlg::calculateValue( const OUString& rStrExp, OUString& rStrResult if ( pFCell->GetCode()->GetCodeLen() <= 1 ) { // ==1: area // ==0: would be an area if... - OUStringBuffer aBraced; - aBraced.append('('); - aBraced.append(rStrExp); - aBraced.append(')'); + OUString aBraced = "(" + rStrExp + ")"; pFCell.reset( new ScSimpleFormulaCalculator( - m_pDoc, m_CursorPos, aBraced.makeStringAndClear(), bMatrixFormula)); + m_pDoc, m_CursorPos, aBraced, bMatrixFormula)); pFCell->SetLimitString(true); } else diff --git a/sc/source/ui/miscdlgs/datafdlg.cxx b/sc/source/ui/miscdlgs/datafdlg.cxx index 1e0fed27c45f..44f0ef4d7e00 100644 --- a/sc/source/ui/miscdlgs/datafdlg.cxx +++ b/sc/source/ui/miscdlgs/datafdlg.cxx @@ -213,11 +213,11 @@ void ScDataFormDlg::FillCtrls() if (nCurrentRow <= nEndRow) { - OUStringBuffer aBuf; - aBuf.append(static_cast<sal_Int32>(nCurrentRow - nStartRow)); - aBuf.append(" / "); - aBuf.append(static_cast<sal_Int32>(nEndRow - nStartRow)); - m_xFixedText->set_label(aBuf.makeStringAndClear()); + OUString sLabel = + OUString::number(static_cast<sal_Int32>(nCurrentRow - nStartRow)) + + " / " + + OUString::number(static_cast<sal_Int32>(nEndRow - nStartRow)); + m_xFixedText->set_label(sLabel); } else m_xFixedText->set_label(sNewRecord); diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index c26808a26ece..8d120a9194f5 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -863,11 +863,7 @@ namespace { OUString createLocalRangeName(const OUString& rName, const OUString& rTableName) { - OUStringBuffer aString (rName); - aString.append(" ("); - aString.append(rTableName); - aString.append(")"); - return aString.makeStringAndClear(); + return rName + " (" + rTableName + ")"; } } diff --git a/sc/source/ui/view/viewfun6.cxx b/sc/source/ui/view/viewfun6.cxx index 0374f4f14ff0..0e3cfde39e24 100644 --- a/sc/source/ui/view/viewfun6.cxx +++ b/sc/source/ui/view/viewfun6.cxx @@ -180,16 +180,15 @@ void ScViewFunc::DetectiveMarkPred() if (pPath && ScRefTokenHelper::getRangeFromToken(aRange, p, aCurPos, true)) { OUString aTabName = p->GetString().getString(); - OUStringBuffer aBuf; - aBuf.append(*pPath); - aBuf.append('#'); - aBuf.append(aTabName); - aBuf.append('.'); - OUString aRangeStr(aRange.Format(ScRefFlags::VALID)); - aBuf.append(aRangeStr); - - ScGlobal::OpenURL(aBuf.makeStringAndClear(), OUString()); + OUString sUrl = + *pPath + + "#" + + aTabName + + "." + + aRangeStr; + + ScGlobal::OpenURL(sUrl, OUString()); } return; } |