sw/source/core/edit/edfcol.cxx | 36 +++++++++++++------------- sw/source/filter/html/htmlftn.cxx | 2 - sw/source/filter/ww8/docxattributeoutput.cxx | 2 - sw/source/filter/xml/xmlfmt.cxx | 2 - sw/source/filter/xml/xmltbli.cxx | 2 - sw/source/ui/dbui/createaddresslistdialog.cxx | 2 - sw/source/uibase/docvw/HeaderFooterWin.cxx | 19 +++++-------- 7 files changed, 30 insertions(+), 35 deletions(-)
New commits: commit 6af35d077e9b5f5723f90f1589c5d801e79ccd4d Author: Julien Nabet <serval2...@yahoo.fr> AuthorDate: Thu Dec 28 15:00:32 2023 +0100 Commit: Julien Nabet <serval2...@yahoo.fr> CommitDate: Thu Dec 28 19:01:31 2023 +0100 Use emplace_back instead of push_back (sw) Change-Id: I0a7f70ca0e5cc022425bee3661495cf1104f6521 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161384 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2...@yahoo.fr> diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index f02273e07318..65ad4abb8c1f 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -981,7 +981,7 @@ std::vector<svx::ClassificationResult> SwEditShell::CollectAdvancedClassificatio { const OUString aValue = svx::classification::getProperty(xPropertyContainer, aCreator.makeCategoryNameKey()); if (!aValue.isEmpty()) - aResult.push_back({ svx::ClassificationType::CATEGORY, aValue, sBlank, sBlank }); + aResult.emplace_back(svx::ClassificationType::CATEGORY, aValue, sBlank, sBlank); return aResult; } @@ -1008,7 +1008,7 @@ std::vector<svx::ClassificationResult> SwEditShell::CollectAdvancedClassificatio OUString sWeight = (aAny.get<float>() >= awt::FontWeight::BOLD) ? OUString("BOLD") : OUString("NORMAL"); - aResult.push_back({ svx::ClassificationType::PARAGRAPH, sWeight, sBlank, sBlank }); + aResult.emplace_back(svx::ClassificationType::PARAGRAPH, sWeight, sBlank, sBlank); // Process portions while (xTextPortions->hasMoreElements()) @@ -1032,33 +1032,33 @@ std::vector<svx::ClassificationResult> SwEditShell::CollectAdvancedClassificatio { const OUString aValue = svx::classification::getProperty(xPropertyContainer, aName); if (!aValue.isEmpty()) - aResult.push_back({ svx::ClassificationType::TEXT, aValue, sBlank, sBlank }); + aResult.emplace_back(svx::ClassificationType::TEXT, aValue, sBlank, sBlank); } else if (aCreator.isCategoryNameKey(aName)) { const OUString aValue = svx::classification::getProperty(xPropertyContainer, aName); if (!aValue.isEmpty()) - aResult.push_back({ svx::ClassificationType::CATEGORY, aValue, sBlank, sBlank }); + aResult.emplace_back(svx::ClassificationType::CATEGORY, aValue, sBlank, sBlank); bFoundClassificationCategory = true; } else if (aCreator.isCategoryIdentifierKey(aName)) { const OUString aValue = svx::classification::getProperty(xPropertyContainer, aName); if (!aValue.isEmpty()) - aResult.push_back({ svx::ClassificationType::CATEGORY, sBlank, sBlank, aValue }); + aResult.emplace_back(svx::ClassificationType::CATEGORY, sBlank, sBlank, aValue); bFoundClassificationCategory = true; } else if (aCreator.isMarkingKey(aName)) { const OUString aValue = svx::classification::getProperty(xPropertyContainer, aName); if (!aValue.isEmpty()) - aResult.push_back({ svx::ClassificationType::MARKING, aValue, sBlank, sBlank }); + aResult.emplace_back(svx::ClassificationType::MARKING, aValue, sBlank, sBlank); } else if (aCreator.isIntellectualPropertyPartKey(aName)) { const OUString aValue = svx::classification::getProperty(xPropertyContainer, aName); if (!aValue.isEmpty()) - aResult.push_back({ svx::ClassificationType::INTELLECTUAL_PROPERTY_PART, aValue, sBlank, sBlank }); + aResult.emplace_back(svx::ClassificationType::INTELLECTUAL_PROPERTY_PART, aValue, sBlank, sBlank); } } } @@ -1067,7 +1067,7 @@ std::vector<svx::ClassificationResult> SwEditShell::CollectAdvancedClassificatio { const OUString aValue = svx::classification::getProperty(xPropertyContainer, aCreator.makeCategoryNameKey()); if (!aValue.isEmpty()) - aResult.push_back({ svx::ClassificationType::CATEGORY, aValue, sBlank, sBlank }); + aResult.emplace_back(svx::ClassificationType::CATEGORY, aValue, sBlank, sBlank); } return aResult; @@ -1323,23 +1323,23 @@ static std::vector<svx::ClassificationResult> lcl_CollectParagraphClassification static constexpr OUString sBlank(u""_ustr); if (aKeyCreator.isMarkingTextKey(aName)) { - aResult.push_back({ svx::ClassificationType::TEXT, aValue, sBlank, sBlank }); + aResult.emplace_back(svx::ClassificationType::TEXT, aValue, sBlank, sBlank); } else if (aKeyCreator.isCategoryNameKey(aName)) { - aResult.push_back({ svx::ClassificationType::CATEGORY, aValue, sBlank, sBlank }); + aResult.emplace_back(svx::ClassificationType::CATEGORY, aValue, sBlank, sBlank); } else if (aKeyCreator.isCategoryIdentifierKey(aName)) { - aResult.push_back({ svx::ClassificationType::CATEGORY, sBlank, sBlank, aValue }); + aResult.emplace_back(svx::ClassificationType::CATEGORY, sBlank, sBlank, aValue); } else if (aKeyCreator.isMarkingKey(aName)) { - aResult.push_back({ svx::ClassificationType::MARKING, aValue, sBlank, sBlank }); + aResult.emplace_back(svx::ClassificationType::MARKING, aValue, sBlank, sBlank); } else if (aKeyCreator.isIntellectualPropertyPartKey(aName)) { - aResult.push_back({ svx::ClassificationType::INTELLECTUAL_PROPERTY_PART, xTextRange->getString(), sBlank, sBlank }); + aResult.emplace_back(svx::ClassificationType::INTELLECTUAL_PROPERTY_PART, xTextRange->getString(), sBlank, sBlank); } } @@ -1972,27 +1972,27 @@ void SwEditShell::RestoreMetadataFieldsAndValidateParagraphSignatures() if (aKeyCreator.isMarkingTextKey(sName)) { - aResults.push_back({ svx::ClassificationType::TEXT, sValue, sValue, sBlank }); + aResults.emplace_back(svx::ClassificationType::TEXT, sValue, sValue, sBlank); } else if (aKeyCreator.isCategoryNameKey(sName)) { const auto it3 = aStatements.find(ParagraphClassificationAbbrRDFName); const OUString sAbbreviatedName = (it3 != aStatements.end() && !it3->second.isEmpty() ? it3->second : sValue); - aResults.push_back({ svx::ClassificationType::CATEGORY, sValue, sAbbreviatedName, sBlank }); + aResults.emplace_back(svx::ClassificationType::CATEGORY, sValue, sAbbreviatedName, sBlank); } else if (aKeyCreator.isCategoryIdentifierKey(sName)) { const auto it3 = aStatements.find(ParagraphClassificationAbbrRDFName); const OUString sAbbreviatedName = (it3 != aStatements.end() && !it3->second.isEmpty() ? it3->second : sValue); - aResults.push_back({ svx::ClassificationType::CATEGORY, sBlank, sAbbreviatedName, sValue }); + aResults.emplace_back(svx::ClassificationType::CATEGORY, sBlank, sAbbreviatedName, sValue); } else if (aKeyCreator.isMarkingKey(sName)) { - aResults.push_back({ svx::ClassificationType::MARKING, sValue, sValue, sBlank }); + aResults.emplace_back(svx::ClassificationType::MARKING, sValue, sValue, sBlank); } else if (aKeyCreator.isIntellectualPropertyPartKey(sName)) { - aResults.push_back({ svx::ClassificationType::INTELLECTUAL_PROPERTY_PART, sValue, sValue, sBlank }); + aResults.emplace_back(svx::ClassificationType::INTELLECTUAL_PROPERTY_PART, sValue, sValue, sBlank); } } while (nIndex >= 0); diff --git a/sw/source/filter/html/htmlftn.cxx b/sw/source/filter/html/htmlftn.cxx index db24a32bb750..d3c8bbc76ae4 100644 --- a/sw/source/filter/html/htmlftn.cxx +++ b/sw/source/filter/html/htmlftn.cxx @@ -205,7 +205,7 @@ void SwHTMLParser::FinishFootEndNote() m_pPam->GetPoint()->GetContentIndex() - 1, RES_TXTATR_FTN ) ); // In header and footer no footnotes can be inserted. if (pTextFootnote) - m_pFootEndNoteImpl->aTextFootnotes.push_back(SwHTMLTextFootnote(m_pFootEndNoteImpl->sName,pTextFootnote)); + m_pFootEndNoteImpl->aTextFootnotes.emplace_back(m_pFootEndNoteImpl->sName,pTextFootnote); m_pFootEndNoteImpl->sName.clear(); m_pFootEndNoteImpl->sContent.clear(); m_pFootEndNoteImpl->bFixed = false; diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 20738c09967e..5c966234e0e0 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -4654,7 +4654,7 @@ void DocxAttributeOutput::InitTableHelper( ww8::WW8TableNodeInfoInner::Pointer_t void DocxAttributeOutput::StartTable( ww8::WW8TableNodeInfoInner::Pointer_t const & pTableTextNodeInfoInner ) { - m_aTableStyleConfs.push_back({}); + m_aTableStyleConfs.emplace_back(); // In case any paragraph SDT's are open, close them here. EndParaSdtBlock(); diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx index 9bd4d2a5f41b..2ce04b52f63e 100644 --- a/sw/source/filter/xml/xmlfmt.cxx +++ b/sw/source/filter/xml/xmlfmt.cxx @@ -473,7 +473,7 @@ void SwXMLCellStyleContext::AddDataFormat() if (aIter != GetProperties().end()) aIter->maValue <<= nNumberFormat; else - GetProperties().push_back(XMLPropertyState(nIndex, Any(nNumberFormat))); + GetProperties().emplace_back(nIndex, Any(nNumberFormat)); } void SwXMLCellStyleContext::FillPropertySet(const css::uno::Reference<css::beans::XPropertySet>& rPropSet) diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index b2d312cad2e5..bd80223ce906 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -1357,7 +1357,7 @@ void SwXMLTableContext::InsertColumn( sal_Int32 nWidth2, bool bRelWidth2, m_xColumnDefaultCellStyleNames.emplace(); sal_uLong nCount = m_aColumnWidths.size() - 1; while( nCount-- ) - m_xColumnDefaultCellStyleNames->push_back(OUString()); + m_xColumnDefaultCellStyleNames->emplace_back(); } if(pDfltCellStyleName) diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx index e6de5544ce8e..1930d8c68e94 100644 --- a/sw/source/ui/dbui/createaddresslistdialog.cxx +++ b/sw/source/ui/dbui/createaddresslistdialog.cxx @@ -270,7 +270,7 @@ SwCreateAddressListDialog::SwCreateAddressListDialog( "Wrong format of header"); if(sHeader.size() > 2) { - m_pCSVData->aDBColumnHeaders.push_back( OUString(sHeader.substr(1, sHeader.size() -2))); + m_pCSVData->aDBColumnHeaders.emplace_back(sHeader.substr(1, sHeader.size() -2)); } } while (nIndex > 0); diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx b/sw/source/uibase/docvw/HeaderFooterWin.cxx index 64e34e01f6bd..e14074356f32 100644 --- a/sw/source/uibase/docvw/HeaderFooterWin.cxx +++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx @@ -142,8 +142,7 @@ void SwFrameButtonPainter::PaintButton(drawinglayer::primitive2d::Primitive2DCon aFillColor = rSettings.GetDialogColor().getBColor(); aLineColor = rSettings.GetDialogTextColor().getBColor(); - rSeq.push_back(drawinglayer::primitive2d::Primitive2DReference( - new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(B2DPolyPolygon(aPolygon), aFillColor))); + rSeq.emplace_back(new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(B2DPolyPolygon(aPolygon), aFillColor)); } else { @@ -154,13 +153,11 @@ void SwFrameButtonPainter::PaintButton(drawinglayer::primitive2d::Primitive2DCon FillGradientAttribute aFillAttrs(css::awt::GradientStyle_LINEAR, 0.0, 0.0, 0.0, nAngle, basegfx::BColorStops(aLighterColor, aFillColor)); - rSeq.push_back(drawinglayer::primitive2d::Primitive2DReference( - new drawinglayer::primitive2d::FillGradientPrimitive2D(aGradientRect, std::move(aFillAttrs)))); + rSeq.emplace_back(new drawinglayer::primitive2d::FillGradientPrimitive2D(aGradientRect, std::move(aFillAttrs))); } // Create the border lines primitive - rSeq.push_back(drawinglayer::primitive2d::Primitive2DReference( - new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(std::move(aPolygon), aLineColor))); + rSeq.emplace_back(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(std::move(aPolygon), aLineColor)); } SwHeaderFooterDashedLine::SwHeaderFooterDashedLine(SwEditWin* pEditWin, const SwFrame *pFrame, bool bHeader) @@ -372,10 +369,9 @@ void SwHeaderFooterWin::PaintButton() aFontSize.getX(), aFontSize.getY(), double(aTextPos.X()), double(aTextPos.Y()))); - aSeq.push_back(drawinglayer::primitive2d::Primitive2DReference( - new drawinglayer::primitive2d::TextSimplePortionPrimitive2D( + aSeq.emplace_back(new drawinglayer::primitive2d::TextSimplePortionPrimitive2D( aTextMatrix, m_sLabel, 0, m_sLabel.getLength(), - std::vector<double>(), {}, std::move(aFontAttr), css::lang::Locale(), aLineColor))); + std::vector<double>(), {}, std::move(aFontAttr), css::lang::Locale(), aLineColor)); // Create the 'plus' or 'arrow' primitive B2DRectangle aSignArea(B2DPoint(aRect.Right() - BUTTON_WIDTH, 0.0), @@ -423,9 +419,8 @@ void SwHeaderFooterWin::PaintButton() if (Application::GetSettings().GetStyleSettings().GetHighContrastMode()) aSignColor = COL_WHITE.getBColor(); - aSeq.push_back( drawinglayer::primitive2d::Primitive2DReference( - new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D( - B2DPolyPolygon(aSign), aSignColor)) ); + aSeq.emplace_back(new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D( + B2DPolyPolygon(aSign), aSignColor) ); // Create the processor and process the primitives const drawinglayer::geometry::ViewInformation2D aNewViewInfos;