diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-28 20:25:10 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-29 06:44:46 +0000 |
commit | a15329d53f20bf913fe63c05fc7c53e17bd68e97 (patch) | |
tree | 8d8677f993fec58e0390fbe98b050085ea348492 | |
parent | 5482a582db942fcb02aec57a904ab16d496006f2 (diff) |
loplugin:stringadd in svx
when applying my upcoming patch to also consider O[U]StringBuffer
Change-Id: I043885ed3120ff6f4262f339c69f15e2b2d4a85c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149653
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | svx/source/fmcomp/gridcell.cxx | 8 | ||||
-rw-r--r-- | svx/source/form/databaselocationinput.cxx | 3 | ||||
-rw-r--r-- | svx/source/form/formcontrolfactory.cxx | 12 | ||||
-rw-r--r-- | svx/source/form/formcontroller.cxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdedtv.cxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdmodel.cxx | 3 | ||||
-rw-r--r-- | svx/source/svdraw/svdmrkv.cxx | 56 | ||||
-rw-r--r-- | svx/source/svdraw/svdograf.cxx | 8 | ||||
-rw-r--r-- | svx/source/svdraw/svdoole2.cxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdotxat.cxx | 3 | ||||
-rw-r--r-- | svx/source/svdraw/svdpage.cxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdxcgv.cxx | 4 | ||||
-rw-r--r-- | svx/source/table/accessiblecell.cxx | 9 | ||||
-rw-r--r-- | svx/source/xoutdev/xtabgrdt.cxx | 3 | ||||
-rw-r--r-- | svx/source/xoutdev/xtabhtch.cxx | 3 |
15 files changed, 53 insertions, 75 deletions
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index debea567ada5..2bf339a19135 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -3092,12 +3092,12 @@ void DbFilterField::Update() Reference< XDatabaseMetaData > xMeta = xConnection->getMetaData(); OUString aQuote(xMeta->getIdentifierQuoteString()); - OUStringBuffer aStatement("SELECT DISTINCT "); - aStatement.append(quoteName(aQuote, aName)); + OUStringBuffer aStatement("SELECT DISTINCT " + + quoteName(aQuote, aName)); if (!aFieldName.isEmpty() && aName != aFieldName) { - aStatement.append(" AS "); - aStatement.append(quoteName(aQuote, aFieldName)); + aStatement.append(" AS " + + quoteName(aQuote, aFieldName)); } aStatement.append(" FROM "); diff --git a/svx/source/form/databaselocationinput.cxx b/svx/source/form/databaselocationinput.cxx index ac1f94d8b72b..aa4bab9a3613 100644 --- a/svx/source/form/databaselocationinput.cxx +++ b/svx/source/form/databaselocationinput.cxx @@ -92,8 +92,7 @@ namespace svx OUStringBuffer aExtensionList; for ( auto const & extension : std::as_const(m_aFilterExtensions) ) { - aExtensionList.append( extension ); - aExtensionList.append( ';' ); + aExtensionList.append( extension + ";" ); } m_rLocationInput.SetFilter( aExtensionList.makeStringAndClear() ); _rBrowseButton.connect_clicked(LINK(this, DatabaseLocationInputController_Impl, OnButtonAction)); diff --git a/svx/source/form/formcontrolfactory.cxx b/svx/source/form/formcontrolfactory.cxx index f7310113d9d3..6d0682b38c3c 100644 --- a/svx/source/form/formcontrolfactory.cxx +++ b/svx/source/form/formcontrolfactory.cxx @@ -155,12 +155,7 @@ namespace svxform // now find a free label sal_Int32 i=2; while ( aUsedLabels.find( sLabel ) != aUsedLabels.end() ) - { - OUStringBuffer aBuffer( _rBaseLabel ); - aBuffer.append( " " ); - aBuffer.append( i++ ); - sLabel = aBuffer.makeStringAndClear(); - } + sLabel = _rBaseLabel + " " + OUString::number( i++ ); } catch( const Exception& ) { @@ -685,10 +680,7 @@ namespace svxform OUString sName; do { - OUStringBuffer aBuf( _rBaseName ); - aBuf.append( " " ); - aBuf.append( ++n ); - sName = aBuf.makeStringAndClear(); + sName = OUString::Concat(_rBaseName) + " " + OUString::number( ++n ); } while ( _rxContainer->hasByName( sName ) ); diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx index ba666fd3829d..b1063a46df2f 100644 --- a/svx/source/form/formcontroller.cxx +++ b/svx/source/form/formcontroller.cxx @@ -810,9 +810,7 @@ void FormController::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) cons if ( !aFilter.isEmpty() ) aFilter.append( " OR " ); - aFilter.append( "( " ); - aFilter.append( aRowFilter ); - aFilter.append( " )" ); + aFilter.append( "( " + aRowFilter + " )" ); } } } diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx index 66ab88e786f7..96e61779e04b 100644 --- a/svx/source/svdraw/svdedtv.cxx +++ b/svx/source/svdraw/svdedtv.cxx @@ -966,8 +966,8 @@ void SdrEditView::CopyMarkedObj() } else { - aStr.append(static_cast<sal_Int32>(nCloneErrCnt)); - aStr.append(" drawing objects."); + aStr.append(OString::number(static_cast<sal_Int32>(nCloneErrCnt)) + + " drawing objects."); } aStr.append(" This object's/These objects's connections will not be copied."); diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index 5a577da212b3..6f243113c0e1 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -1002,8 +1002,7 @@ OUString SdrModel::GetMetricString(tools::Long nVal, bool bNoUnitChars, sal_Int3 nDecimalMark = nNumDigits; } - OUStringBuffer aBuf; - aBuf.append(static_cast<sal_Int32>(fLocalValue + 0.5)); + OUStringBuffer aBuf = OUString::number(static_cast<sal_Int32>(fLocalValue + 0.5)); if(nDecimalMark < 0) { diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 02fdbc26230a..873b09400416 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -852,10 +852,10 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S OStringBuffer aExtraInfo; OString handleArrayStr; - aExtraInfo.append("{\"id\":\""); - aExtraInfo.append(reinterpret_cast<sal_IntPtr>(pO)); - aExtraInfo.append("\",\"type\":"); - aExtraInfo.append(static_cast<sal_Int32>(pO->GetObjIdentifier())); + aExtraInfo.append("{\"id\":\"" + + OString::number(reinterpret_cast<sal_IntPtr>(pO)) + + "\",\"type\":" + + OString::number(static_cast<sal_Int32>(pO->GetObjIdentifier()))); // In core, the gridOffset is calculated based on the LogicRect's TopLeft coordinate // In online, we have the SnapRect and we calculate it based on its TopLeft coordinate @@ -871,10 +871,10 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S Point p(aGridOffset.getX(), aGridOffset.getY()); if (convertMapMode) p = o3tl::convert(p, o3tl::Length::mm100, o3tl::Length::twip); - aExtraInfo.append(",\"gridOffsetX\":"); - aExtraInfo.append(nSignX * p.getX()); - aExtraInfo.append(",\"gridOffsetY\":"); - aExtraInfo.append(p.getY()); + aExtraInfo.append(",\"gridOffsetX\":" + + OString::number(nSignX * p.getX()) + + ",\"gridOffsetY\":" + + OString::number(p.getY())); } if (bWriterGraphic) @@ -901,10 +901,8 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S nPos += rProp.getLength() + 1; // '=' if (aExtraInfo.getLength() > 2) // != "{ " aExtraInfo.append(", "); - aExtraInfo.append("\"is"); - aExtraInfo.append(rProp); - aExtraInfo.append("\": "); - aExtraInfo.append(OString::boolean(aObjectCID[nPos] == '1')); + aExtraInfo.append("\"is" + rProp + "\": " + + OString::boolean(aObjectCID[nPos] == '1')); } std::u16string_view sDragMethod = lcl_getDragMethodServiceName(aValue); @@ -916,10 +914,10 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S std::u16string_view sDragParameters = lcl_getDragParameterString(aValue); if (!sDragParameters.empty()) { - aExtraInfo.append(", \"dragInfo\": { "); - aExtraInfo.append("\"dragMethod\": \""); - aExtraInfo.append(OUString(sDragMethod).toUtf8()); - aExtraInfo.append("\""); + aExtraInfo.append(", \"dragInfo\": { " + "\"dragMethod\": \"" + + OUString(sDragMethod).toUtf8() + + "\""); sal_Int32 nStartIndex = 0; std::array<int, 5> aDragParameters; @@ -937,8 +935,8 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S else if (aDragParameters[0] > 100) aDragParameters[0] = 100; - aExtraInfo.append(", \"initialOffset\": "); - aExtraInfo.append(static_cast<sal_Int32>(aDragParameters[0])); + aExtraInfo.append(", \"initialOffset\": " + + OString::number(static_cast<sal_Int32>(aDragParameters[0]))); // drag direction constraint Point aMinPos(aDragParameters[1], aDragParameters[2]); @@ -946,9 +944,9 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S Point aDragDirection = aMaxPos - aMinPos; aDragDirection = o3tl::convert(aDragDirection, o3tl::Length::mm100, o3tl::Length::twip); - aExtraInfo.append(", \"dragDirection\": ["); - aExtraInfo.append(aDragDirection.toString()); - aExtraInfo.append("]"); + aExtraInfo.append(", \"dragDirection\": [" + + aDragDirection.toString() + + "]"); // polygon approximating the pie segment or donut segment if (pO->GetObjIdentifier() == SdrObjKind::PathFill) @@ -991,12 +989,12 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S aSelection.toString() + R"elem(\" preserveAspectRatio=\"xMidYMid\" xmlns=\"http://www.w3.org/2000/svg\">)elem"; - aExtraInfo.append(", \"svg\": \""); - aExtraInfo.append(sSVGElem); - aExtraInfo.append("\\n "); - aExtraInfo.append(sPolygonElem); - aExtraInfo.append("\\n</svg>"); - aExtraInfo.append("\""); // svg + aExtraInfo.append(", \"svg\": \"" + + sSVGElem + + "\\n " + + sPolygonElem + + "\\n</svg>" + "\""); // svg } } } @@ -1107,8 +1105,8 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S if (!aExtraInfo.isEmpty()) { sSelectionTextView = sSelectionText + ", " + aExtraInfo + "}"; - aExtraInfo.append(handleArrayStr); - aExtraInfo.append("}"); + aExtraInfo.append(handleArrayStr + + "}"); sSelectionText += ", " + aExtraInfo; aExtraInfo.setLength(0); } diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index 5b910e523b1c..cdb1b0e8301c 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -665,9 +665,7 @@ OUString SdrGrafObj::TakeObjNameSingul() const if (!aName.isEmpty()) { - sName.append(" '"); - sName.append(aName); - sName.append('\'' ); + sName.append(" '" + aName + "\'" ); } return sName.makeStringAndClear(); @@ -740,9 +738,7 @@ OUString SdrGrafObj::TakeObjNamePlural() const if (!aName.isEmpty()) { - sName.append(" '"); - sName.append(aName); - sName.append('\''); + sName.append(" '" + aName + "\'"); } return sName.makeStringAndClear(); diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 3661aa260d14..fc92248a658b 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -1401,9 +1401,7 @@ OUString SdrOle2Obj::TakeObjNameSingul() const if (!aName.isEmpty()) { - sName.append(" '"); - sName.append(aName); - sName.append('\''); + sName.append(" '" + aName + "\'"); } return sName.makeStringAndClear(); diff --git a/svx/source/svdraw/svdotxat.cxx b/svx/source/svdraw/svdotxat.cxx index be87d5dd7577..35a467327dc9 100644 --- a/svx/source/svdraw/svdotxat.cxx +++ b/svx/source/svdraw/svdotxat.cxx @@ -439,8 +439,7 @@ bool SdrTextObj::HasText() const void SdrTextObj::AppendFamilyToStyleName(OUString& styleName, SfxStyleFamily family) { - OUStringBuffer aFam; - aFam.append(static_cast<sal_Int32>(family)); + OUStringBuffer aFam = OUString::number(static_cast<sal_Int32>(family)); comphelper::string::padToLength(aFam, PADDING_LENGTH_FOR_STYLE_FAMILY , PADDING_CHARACTER_FOR_STYLE_FAMILY); styleName += "|" + aFam; diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 8a3c4049f7bf..280e5d2f8c70 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -223,8 +223,8 @@ void SdrObjList::CopyObjects(const SdrObjList& rSrcList) } else { - aStr.append(static_cast<sal_Int32>(nCloneErrCnt)); - aStr.append(" drawing objects."); + aStr.append(OString::number(static_cast<sal_Int32>(nCloneErrCnt)) + + " drawing objects."); } aStr.append(" Not copying connectors."); diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index 19b06a9d4ca0..bbf100463fc6 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -375,8 +375,8 @@ bool SdrExchangeView::Paste( } else { - aStr.append(static_cast<sal_Int32>(nCloneErrCnt)); - aStr.append(" drawing objects."); + aStr.append(OString::number(static_cast<sal_Int32>(nCloneErrCnt)) + + " drawing objects."); } aStr.append(" Not copying object connectors."); diff --git a/svx/source/table/accessiblecell.cxx b/svx/source/table/accessiblecell.cxx index 98c83c48df86..fc401d29fbfb 100644 --- a/svx/source/table/accessiblecell.cxx +++ b/svx/source/table/accessiblecell.cxx @@ -514,10 +514,11 @@ OUString AccessibleCell::getCellName( sal_Int32 nCol, sal_Int32 nRow ) static_cast<sal_uInt16>(nCol))); else { - aBuf.append( static_cast<sal_Unicode>( 'A' + - (static_cast<sal_uInt16>(nCol) / 26) - 1)); - aBuf.append( static_cast<sal_Unicode>( 'A' + - (static_cast<sal_uInt16>(nCol) % 26))); + aBuf.append( + OUStringChar(static_cast<sal_Unicode>( 'A' + + (static_cast<sal_uInt16>(nCol) / 26) - 1)) + + OUStringChar( static_cast<sal_Unicode>( 'A' + + (static_cast<sal_uInt16>(nCol) % 26))) ); } } else diff --git a/svx/source/xoutdev/xtabgrdt.cxx b/svx/source/xoutdev/xtabgrdt.cxx index e44141d45428..7fee511072c3 100644 --- a/svx/source/xoutdev/xtabgrdt.cxx +++ b/svx/source/xoutdev/xtabgrdt.cxx @@ -66,8 +66,7 @@ uno::Reference< container::XNameContainer > XGradientList::createInstance() bool XGradientList::Create() { - OUStringBuffer aStr(SvxResId(RID_SVXSTR_GRADIENT)); - aStr.append(" 1"); + OUStringBuffer aStr(SvxResId(RID_SVXSTR_GRADIENT) + " 1"); sal_Int32 nLen = aStr.getLength() - 1; // XGradient() default already creates [COL_BLACK, COL_WHITE] as defaults diff --git a/svx/source/xoutdev/xtabhtch.cxx b/svx/source/xoutdev/xtabhtch.cxx index 2091924ea518..1a4219db898b 100644 --- a/svx/source/xoutdev/xtabhtch.cxx +++ b/svx/source/xoutdev/xtabhtch.cxx @@ -64,8 +64,7 @@ uno::Reference< container::XNameContainer > XHatchList::createInstance() bool XHatchList::Create() { - OUStringBuffer aStr(SvxResId(RID_SVXSTR_HATCH)); - aStr.append(" 1"); + OUStringBuffer aStr(SvxResId(RID_SVXSTR_HATCH) + " 1"); sal_Int32 nLen = aStr.getLength() - 1; Insert(std::make_unique<XHatchEntry>(XHatch(COL_BLACK,css::drawing::HatchStyle_SINGLE,100, 0_deg10),aStr.toString())); |