diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-14 09:25:24 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-15 10:36:36 +0200 |
commit | 2484de6728bd11bb7949003d112f1ece2223c7a1 (patch) | |
tree | 1296534e396da284b38d2c478dcd2b31c4714179 /sw | |
parent | 88375fd36899d21d3309cf8333712e02a87d3a91 (diff) |
Remove non-const Sequence::begin()/end() in internal code
... to avoid hidden cost of multiple COW checks, because they
call getArray() internally.
This obsoletes [loplugin:sequenceloop].
Also rename toNonConstRange to asNonConstRange, to reflect that
the result is a view of the sequence, not an independent object.
TODO: also drop non-const operator[], but introduce operator[]
in SequenceRange.
Change-Id: Idd5fd7a3400fe65274d2a6343025e2ef8911635d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123518
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw')
29 files changed, 49 insertions, 47 deletions
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx index 01f36765a18a..761cfdf7d4b7 100644 --- a/sw/qa/extras/globalfilter/globalfilter.cxx +++ b/sw/qa/extras/globalfilter/globalfilter.cxx @@ -771,7 +771,7 @@ void Test::testMSCharBackgroundEditing() xRun->setPropertyValue("CharHighlight", uno::makeAny(static_cast<sal_Int32>(COL_TRANSPARENT))); // Remove shading marker uno::Sequence<beans::PropertyValue> aGrabBag = getProperty<uno::Sequence<beans::PropertyValue> >(xRun,"CharInteropGrabBag"); - for (beans::PropertyValue& rProp : aGrabBag) + for (beans::PropertyValue& rProp : asNonConstRange(aGrabBag)) { if (rProp.Name == "CharShadingMarker") { diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index 31631d7d1579..eb48b60262c0 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -861,7 +861,7 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, testHighlightEdit_numbering) uno::Sequence<beans::PropertyValue> aGrabBag; aMap["CharInteropGrabBag"] >>= aGrabBag; - for (beans::PropertyValue& rProp : aGrabBag) + for (beans::PropertyValue& rProp : asNonConstRange(aGrabBag)) { // The shading is no longer defined from import, so clear that flag. // BackColor 0xff00ff will now attempt to export as highlight, since we set that in SvtFilterOptions. diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 3b59da527c3f..62808b697d49 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1717,7 +1717,7 @@ CPPUNIT_TEST_FIXTURE(Test, testVmlAdjustments) uno::Sequence<drawing::EnhancedCustomShapeAdjustmentValue> aAdjustmentValues = aGeometry["AdjustmentValues"].get<uno::Sequence<drawing::EnhancedCustomShapeAdjustmentValue>>(); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aAdjustmentValues.getLength()); - drawing::EnhancedCustomShapeAdjustmentValue aAdjustmentValue = *aAdjustmentValues.begin(); + drawing::EnhancedCustomShapeAdjustmentValue aAdjustmentValue = *std::cbegin(aAdjustmentValues); CPPUNIT_ASSERT_EQUAL(sal_Int32(17639), aAdjustmentValue.Value.get<sal_Int32>()); } diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index e31c343d321d..6be041d8c585 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -1604,7 +1604,8 @@ uno::Sequence< PropertyValue > SwAccessibleParagraph::getDefaultAttributes( uno::Sequence< PropertyValue > aValues( aDefAttrSeq.size() + ( bProvideMMToPixelRatio ? 1 : 0 ) ); - std::transform(aDefAttrSeq.begin(), aDefAttrSeq.end(), aValues.begin(), + auto pValues = aValues.getArray(); + std::transform(aDefAttrSeq.begin(), aDefAttrSeq.end(), pValues, [](const auto& rEntry) -> PropertyValue { return rEntry.second; }); // #i92233# @@ -1618,7 +1619,7 @@ uno::Sequence< PropertyValue > SwAccessibleParagraph::getDefaultAttributes( rPropVal.Value <<= fRatio; rPropVal.Handle = -1; rPropVal.State = beans::PropertyState_DEFAULT_VALUE; - aValues[ aValues.getLength() - 1 ] = rPropVal; + pValues[ aValues.getLength() - 1 ] = rPropVal; } return aValues; diff --git a/sw/source/core/unocore/SwXTextDefaults.cxx b/sw/source/core/unocore/SwXTextDefaults.cxx index cc6177bbb154..b4107f5f15a6 100644 --- a/sw/source/core/unocore/SwXTextDefaults.cxx +++ b/sw/source/core/unocore/SwXTextDefaults.cxx @@ -175,7 +175,7 @@ Sequence< PropertyState > SAL_CALL SwXTextDefaults::getPropertyStates( const Seq const sal_Int32 nCount = rPropertyNames.getLength(); Sequence < PropertyState > aRet ( nCount ); - std::transform(rPropertyNames.begin(), rPropertyNames.end(), aRet.begin(), + std::transform(rPropertyNames.begin(), rPropertyNames.end(), aRet.getArray(), [this](const OUString& rName) -> PropertyState { return getPropertyState(rName); }); return aRet; diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index 1e04b4d8848d..4c096178bab4 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -872,7 +872,7 @@ uno::Reference< chart2::data::XDataSource > SwChartDataProvider::Impl_createData uno::Reference<chart2::data::XLabeledDataSequence>* pOld_LDS = aOld_LDS.getArray(); sal_Int32 nNewCnt = 0; - for (sal_Int32 nIdx : aSequenceMapping) + for (sal_Int32 nIdx : std::as_const(aSequenceMapping)) { // check that index to be used is valid // and has not yet been used @@ -1233,7 +1233,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwChartDataProvider::detectArgume // build value for 'SequenceMapping' uno::Sequence< sal_Int32 > aSortedMapping( aSequenceMapping ); - auto [begin, end] = toNonConstRange(aSortedMapping); + auto [begin, end] = asNonConstRange(aSortedMapping); std::sort(begin, end); bool bNeedSequenceMapping = false; for (sal_Int32 i = 0; i < aSequenceMapping.getLength(); ++i) @@ -2038,7 +2038,7 @@ uno::Sequence< OUString > SAL_CALL SwChartDataSequence::getTextualData() uno::Sequence< OUString > vTextData(vCells.size()); std::transform(vCells.begin(), vCells.end(), - vTextData.begin(), + vTextData.getArray(), [] (decltype(vCells)::value_type& xCell) { return static_cast<SwXCell*>(xCell.get())->getString(); }); return vTextData; @@ -2051,7 +2051,7 @@ uno::Sequence< uno::Any > SAL_CALL SwChartDataSequence::getData() uno::Sequence< uno::Any > vAnyData(vCells.size()); std::transform(vCells.begin(), vCells.end(), - vAnyData.begin(), + vAnyData.getArray(), [] (decltype(vCells)::value_type& xCell) { return static_cast<SwXCell*>(xCell.get())->GetAny(); }); return vAnyData; @@ -2064,7 +2064,7 @@ uno::Sequence< double > SAL_CALL SwChartDataSequence::getNumericalData() uno::Sequence< double > vNumData(vCells.size()); std::transform(vCells.begin(), vCells.end(), - vNumData.begin(), + vNumData.getArray(), [] (decltype(vCells)::value_type& xCell) { return static_cast<SwXCell*>(xCell.get())->GetForcedNumericalValue(); }); return vNumData; diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index 56111d9817ef..4d04857e7199 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -2647,9 +2647,9 @@ css::drawing::PolyPolygonBezierCoords SwXShape::ConvertPolyPolygonBezierToLayout const basegfx::B2DHomMatrix aMatrix(basegfx::utils::createTranslateB2DHomMatrix( aTranslateDiff.X, aTranslateDiff.Y)); - for(drawing::PointSequence& rInnerSequence : aConvertedPath.Coordinates) + for(drawing::PointSequence& rInnerSequence : asNonConstRange(aConvertedPath.Coordinates)) { - for(awt::Point& rPoint : rInnerSequence) + for(awt::Point& rPoint : asNonConstRange(rInnerSequence)) { basegfx::B2DPoint aNewCoordinatePair(rPoint.X, rPoint.Y); aNewCoordinatePair *= aMatrix; diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index a68a3b167b85..729a2581075a 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -825,7 +825,7 @@ SwXFieldMaster::getPropertyValue(const OUString& rPropertyName) std::vector<SwFormatField*> vpFields; pType->GatherFields(vpFields); uno::Sequence<uno::Reference <text::XDependentTextField> > aSeq(vpFields.size()); - std::transform(vpFields.begin(), vpFields.end(), aSeq.begin(), + std::transform(vpFields.begin(), vpFields.end(), aSeq.getArray(), [this](SwFormatField* pF) { return uno::Reference<text::XDependentTextField>(SwXTextField::CreateXTextField(m_pImpl->m_pDoc, pF), uno::UNO_QUERY); }); aRet <<= aSeq; } diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index dd540870d8c3..dd6de80c47af 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -2385,7 +2385,7 @@ uno::Sequence< beans::PropertyState > SwXFrame::getPropertyStates( { SolarMutexGuard aGuard; uno::Sequence< beans::PropertyState > aStates(aPropertyNames.getLength()); - auto [pStates, end] = toNonConstRange(aStates); + auto [pStates, end] = asNonConstRange(aStates); SwFrameFormat* pFormat = GetFrameFormat(); if(pFormat) { diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx index f56fd117c395..4e4c95b177d2 100644 --- a/sw/source/core/unocore/unoftn.cxx +++ b/sw/source/core/unocore/unoftn.cxx @@ -50,7 +50,7 @@ GetSupportedServiceNamesImpl( { uno::Sequence< OUString > ret(static_cast<sal_Int32>(nServices)); - std::transform(pServices, pServices + nServices, ret.begin(), + std::transform(pServices, pServices + nServices, ret.getArray(), [](const char* pService) -> OUString { return OUString::createFromAscii(pService); }); return ret; diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index c5e28f738dbb..0f12e6f84c6c 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -2238,7 +2238,7 @@ SwXTextCursor::getPropertyValues( const uno::Sequence< OUString >& aPropertyName { // a banal implementation for now uno::Sequence< uno::Any > aValues( aPropertyNames.getLength() ); - std::transform(aPropertyNames.begin(), aPropertyNames.end(), aValues.begin(), + std::transform(aPropertyNames.begin(), aPropertyNames.end(), aValues.getArray(), [this](const OUString& rName) -> uno::Any { return getPropertyValue( rName ); }); return aValues; } diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx index 326f8cc2a6ea..ea35d6140ed6 100644 --- a/sw/source/core/unocore/unoparagraph.cxx +++ b/sw/source/core/unocore/unoparagraph.cxx @@ -711,7 +711,7 @@ SwXParagraph::getPropertyValuesTolerant( // copy temporary result to final result type const sal_Int32 nLen = aTmpRes.getLength(); uno::Sequence< beans::GetPropertyTolerantResult > aRes( nLen ); - std::copy(aTmpRes.begin(), aTmpRes.end(), aRes.begin()); + std::copy(aTmpRes.begin(), aTmpRes.end(), aRes.getArray()); return aRes; } diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx index a76af4e240fc..1e3ec60182e1 100644 --- a/sw/source/core/unocore/unoport.cxx +++ b/sw/source/core/unocore/unoport.cxx @@ -554,7 +554,7 @@ uno::Sequence< beans::GetPropertyTolerantResult > SAL_CALL SwXTextPortion::getPr // copy temporary result to final result type sal_Int32 nLen = aTmpRes.getLength(); uno::Sequence< beans::GetPropertyTolerantResult > aRes( nLen ); - std::copy(aTmpRes.begin(), aTmpRes.end(), aRes.begin()); + std::copy(aTmpRes.begin(), aTmpRes.end(), aRes.getArray()); return aRes; } diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index a0de46793064..2401c17322cd 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -510,7 +510,7 @@ uno::Sequence< OUString > SwXStyleFamilies::getElementNames() auto pEntries(lcl_GetStyleFamilyEntries()); uno::Sequence<OUString> aNames(pEntries->size()); std::transform(pEntries->begin(), pEntries->end(), - aNames.begin(), [] (const StyleFamilyEntry& e) { return e.m_sName; }); + aNames.getArray(), [] (const StyleFamilyEntry& e) { return e.m_sName; }); return aNames; } @@ -2257,7 +2257,7 @@ uno::Any SwXStyle::GetStyleProperty<FN_UNO_PARA_STYLE_CONDITIONS>(const SfxItemP static_assert(COND_COMMAND_COUNT == 28, "invalid size of command count?"); uno::Sequence<beans::NamedValue> aSeq(COND_COMMAND_COUNT); sal_uInt16 nIndex = 0; - for(auto& rNV : aSeq) + for(auto& rNV : asNonConstRange(aSeq)) { rNV.Name = GetCommandContextByIndex(nIndex++); rNV.Value <<= OUString(); diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 5c8f9ae31ba8..cb370088e713 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -3562,10 +3562,10 @@ uno::Sequence<uno::Sequence<uno::Any>> SAL_CALL SwXCellRange::getDataArray() uno::Sequence< uno::Sequence< uno::Any > > aRowSeq(nRowCount); auto vCells(GetCells()); auto pCurrentCell(vCells.begin()); - for(auto& rRow : aRowSeq) + for(auto& rRow : asNonConstRange(aRowSeq)) { rRow = uno::Sequence< uno::Any >(nColCount); - for(auto& rCellAny : rRow) + for(auto& rCellAny : asNonConstRange(rRow)) { auto pCell(static_cast<SwXCell*>(pCurrentCell->get())); if(!pCell) @@ -3631,10 +3631,10 @@ SwXCellRange::getData() uno::Sequence< uno::Sequence< double > > vRows(nRowCount); auto vCells(GetCells()); auto pCurrentCell(vCells.begin()); - for(auto& rRow : vRows) + for(auto& rRow : asNonConstRange(vRows)) { rRow = uno::Sequence<double>(nColCount); - for(auto& rValue : rRow) + for(auto& rValue : asNonConstRange(rRow)) { if(!(*pCurrentCell)) throw uno::RuntimeException("Table too complex", static_cast<cppu::OWeakObject*>(this)); @@ -3710,7 +3710,7 @@ SwXCellRange::Impl::GetLabelDescriptions(SwXCellRange & rThis, bool bRow) auto xLabelRange(rThis.getCellRangeByPosition(nLeft, nTop, nRight, nBottom)); auto vCells(static_cast<SwXCellRange*>(xLabelRange.get())->GetCells()); uno::Sequence<OUString> vResult(vCells.size()); - std::transform(vCells.begin(), vCells.end(), vResult.begin(), + std::transform(vCells.begin(), vCells.end(), vResult.getArray(), [](uno::Reference<table::XCell> xCell) -> OUString { return uno::Reference<text::XText>(xCell, uno::UNO_QUERY_THROW)->getString(); }); return vResult; } diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 73d720e9ed79..f8bf63264e62 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -302,7 +302,7 @@ eF_ResT SwWW8ImplReader::Read_F_FormListBox( WW8FieldDesc* pF, OUString& rStr) if ( pFieldmark != nullptr ) { uno::Sequence< OUString > vListEntries(aFormula.maListEntries.size()); - std::copy(aFormula.maListEntries.begin(), aFormula.maListEntries.end(), vListEntries.begin()); + std::copy(aFormula.maListEntries.begin(), aFormula.maListEntries.end(), vListEntries.getArray()); (*pFieldmark->GetParameters())[ODF_FORMDROPDOWN_LISTENTRY] <<= vListEntries; sal_Int32 nIndex = aFormula.mfDropdownIndex < aFormula.maListEntries.size() ? aFormula.mfDropdownIndex : 0; (*pFieldmark->GetParameters())[ODF_FORMDROPDOWN_RESULT] <<= nIndex; diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx index 1bbee52b77aa..a1f9625c6936 100644 --- a/sw/source/filter/xml/wrtxml.cxx +++ b/sw/source/filter/xml/wrtxml.cxx @@ -558,8 +558,9 @@ bool SwXMLWriter::WriteThroughComponent( // prepare arguments (prepend doc handler to given arguments) Sequence<Any> aArgs( 1 + rArguments.getLength() ); - aArgs[0] <<= xSaxWriter; - std::copy(rArguments.begin(), rArguments.end(), std::next(aArgs.begin())); + auto pArgs = aArgs.getArray(); + *pArgs <<= xSaxWriter; + std::copy(rArguments.begin(), rArguments.end(), std::next(pArgs)); // get filter component uno::Reference< document::XExporter > xExporter( diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx index 2a902d85a2b0..45875291acff 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.cxx +++ b/sw/source/ui/dbui/mmaddressblockpage.cxx @@ -362,7 +362,7 @@ const uno::Sequence< OUString >& SwSelectAddressBlockDialog::GetAddressBlocks if(nSelect) { uno::Sequence< OUString >aTemp(m_aAddressBlocks.getLength()); - auto it = aTemp.begin(); + auto it = aTemp.getArray(); *it = std::as_const(m_aAddressBlocks)[nSelect]; it = std::copy_n(std::cbegin(m_aAddressBlocks), nSelect - 1, std::next(it)); std::copy(std::next(std::cbegin(m_aAddressBlocks), nSelect + 1), std::cend(m_aAddressBlocks), it); diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx index 63a05e81bd7b..a2e899a77910 100644 --- a/sw/source/ui/envelp/mailmrge.cxx +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -528,7 +528,7 @@ bool SwMailMergeDlg::ExecQryShell() uno::Reference< XResultSet > xRes(xRowLocate,UNO_QUERY); pImpl->xSelSupp->getSelection() >>= m_aSelection; if ( xRowLocate.is() ) { - for (Any& rRow : m_aSelection) { + for (Any& rRow : asNonConstRange(m_aSelection)) { if ( xRowLocate->moveToBookmark(rRow) ) rRow <<= xRes->getRow(); } diff --git a/sw/source/ui/vba/vbadocumentproperties.cxx b/sw/source/ui/vba/vbadocumentproperties.cxx index 846c8c999304..931890a9848f 100644 --- a/sw/source/ui/vba/vbadocumentproperties.cxx +++ b/sw/source/ui/vba/vbadocumentproperties.cxx @@ -338,7 +338,7 @@ public: uno::Sequence< beans::NamedValue > stats( m_xDocProps->getDocumentStatistics()); - auto [begin, end] = toNonConstRange(stats); + auto [begin, end] = asNonConstRange(stats); auto pStat = std::find_if(begin, end, [&rPropName](const beans::NamedValue& rStat) { return rPropName == rStat.Name; }); if (pStat != end) @@ -841,7 +841,7 @@ public: { const uno::Sequence< beans::Property > aProps = mxUserDefinedProp->getPropertySetInfo()->getProperties(); uno::Sequence< OUString > aNames( aProps.getLength() ); - std::transform(aProps.begin(), aProps.end(), aNames.begin(), + std::transform(aProps.begin(), aProps.end(), aNames.getArray(), [](const beans::Property& rProp) -> OUString { return rProp.Name; }); return aNames; } diff --git a/sw/source/ui/vba/vbafilterpropsfromformat.hxx b/sw/source/ui/vba/vbafilterpropsfromformat.hxx index dbf07b155955..cde1da0b4dc0 100644 --- a/sw/source/ui/vba/vbafilterpropsfromformat.hxx +++ b/sw/source/ui/vba/vbafilterpropsfromformat.hxx @@ -31,7 +31,7 @@ namespace inline bool setFilterPropsFromFormat(sal_Int32 nFormat, css::uno::Sequence<css::beans::PropertyValue>& rProps) { - auto[begin, end] = toNonConstRange(rProps); + auto[begin, end] = asNonConstRange(rProps); auto pProp = std::find_if(begin, end, [](const css::beans::PropertyValue& rProp) { return rProp.Name == "FilterName"; }); diff --git a/sw/source/ui/vba/vbatabstops.cxx b/sw/source/ui/vba/vbatabstops.cxx index 0046814305d9..b790db76805b 100644 --- a/sw/source/ui/vba/vbatabstops.cxx +++ b/sw/source/ui/vba/vbatabstops.cxx @@ -202,7 +202,7 @@ uno::Reference< word::XTabStop > SAL_CALL SwVbaTabStops::Add( float Position, co aTab.FillChar = cLeader; uno::Sequence< style::TabStop > aOldTabs = lcl_getTabStops( mxParaProps ); - auto [begin, end] = toNonConstRange(aOldTabs); + auto [begin, end] = asNonConstRange(aOldTabs); style::TabStop* pOldTab = std::find_if(begin, end, [nPosition](const style::TabStop& rTab) { return rTab.Position == nPosition; }); @@ -217,7 +217,7 @@ uno::Reference< word::XTabStop > SAL_CALL SwVbaTabStops::Add( float Position, co sal_Int32 nTabs = aOldTabs.getLength(); uno::Sequence< style::TabStop > aNewTabs( nTabs + 1 ); - auto it = aNewTabs.begin(); + auto it = aNewTabs.getArray(); *it = aTab; std::copy(begin, end, std::next(it)); lcl_setTabStops( mxParaProps, aNewTabs ); diff --git a/sw/source/uibase/dbui/dbtree.cxx b/sw/source/uibase/dbui/dbtree.cxx index 0af160098e08..941df07e1ec7 100644 --- a/sw/source/uibase/dbui/dbtree.cxx +++ b/sw/source/uibase/dbui/dbtree.cxx @@ -150,7 +150,7 @@ void SwDBTreeList::InitTreeList() auto const sort = comphelper::string::NaturalStringSorter( comphelper::getProcessComponentContext(), Application::GetSettings().GetUILanguageTag().getLocale()); - auto [begin, end] = toNonConstRange(aDBNames); + auto [begin, end] = asNonConstRange(aDBNames); std::sort( begin, end, [&sort](OUString const & x, OUString const & y) diff --git a/sw/source/uibase/dbui/mmconfigitem.cxx b/sw/source/uibase/dbui/mmconfigitem.cxx index 4dd6d7e0a5c4..36986ba59f5e 100644 --- a/sw/source/uibase/dbui/mmconfigitem.cxx +++ b/sw/source/uibase/dbui/mmconfigitem.cxx @@ -333,7 +333,7 @@ SwMailMergeConfigItem_Impl::SwMailMergeConfigItem_Impl() : if(m_aSavedDocuments.hasElements()) { uno::Sequence< OUString > aTempDocuments(m_aSavedDocuments.getLength()); - auto begin = aTempDocuments.begin(); + auto begin = aTempDocuments.getArray(); OUString* pTempDocuments = std::copy_if(std::cbegin(m_aSavedDocuments), std::cend(m_aSavedDocuments), begin, [](const OUString& rDoc) { return SWUnoHelper::UCB_IsFile( rDoc ); }); sal_Int32 nIndex = static_cast<sal_Int32>(std::distance(begin, pTempDocuments)); @@ -585,7 +585,7 @@ Sequence< OUString> SwMailMergeConfigItem_Impl::GetAddressBlocks( bool bConvertToConfig) const { Sequence< OUString> aRet(m_aAddressBlocks.size()); - std::transform(m_aAddressBlocks.begin(), m_aAddressBlocks.end(), aRet.begin(), + std::transform(m_aAddressBlocks.begin(), m_aAddressBlocks.end(), aRet.getArray(), [this, bConvertToConfig](const OUString& rBlock) -> OUString { OUString sBlock = rBlock; if(bConvertToConfig) @@ -619,7 +619,7 @@ Sequence< OUString> SwMailMergeConfigItem_Impl::GetGreetings( eType == SwMailMergeConfigItem::MALE ? m_aMaleGreetingLines : m_aNeutralGreetingLines; Sequence< OUString> aRet(rGreetings.size()); - std::transform(rGreetings.begin(), rGreetings.end(), aRet.begin(), + std::transform(rGreetings.begin(), rGreetings.end(), aRet.getArray(), [this, bConvertToConfig](const OUString& rGreeting) -> OUString { OUString sGreeting = rGreeting; if(bConvertToConfig) diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx index 634bedb8c1c0..013c65198f1f 100644 --- a/sw/source/uibase/fldui/fldmgr.cxx +++ b/sw/source/uibase/fldui/fldmgr.cxx @@ -738,7 +738,7 @@ OUString SwFieldMgr::GetFormatStr(SwFieldTypesEnum nTypeId, sal_uInt32 nFormatId { if (m_xNumberingInfo.is()) { - Sequence<sal_Int16> aTypes = m_xNumberingInfo->getSupportedNumberingTypes(); + const Sequence<sal_Int16> aTypes = m_xNumberingInfo->getSupportedNumberingTypes(); sal_Int32 nOffset = aSwFields[nPos].nFormatLength; sal_uInt32 nValidEntry = 0; for (const sal_Int16 nCurrent : aTypes) @@ -818,7 +818,7 @@ sal_uInt16 SwFieldMgr::GetFormatId(SwFieldTypesEnum nTypeId, sal_uInt32 nFormatI } else if (m_xNumberingInfo.is()) { - Sequence<sal_Int16> aTypes = m_xNumberingInfo->getSupportedNumberingTypes(); + const Sequence<sal_Int16> aTypes = m_xNumberingInfo->getSupportedNumberingTypes(); sal_Int32 nOffset = aSwFields[nPos].nFormatLength; sal_Int32 nValidEntry = 0; for (const sal_Int16 nCurrent : aTypes) diff --git a/sw/source/uibase/misc/numberingtypelistbox.cxx b/sw/source/uibase/misc/numberingtypelistbox.cxx index 5f4c45bb8dfc..94a26bcb9ffc 100644 --- a/sw/source/uibase/misc/numberingtypelistbox.cxx +++ b/sw/source/uibase/misc/numberingtypelistbox.cxx @@ -101,7 +101,7 @@ void SwNumberingTypeListBox::Reload(SwInsertNumTypes nTypeFlags) if (!(nTypeFlags & SwInsertNumTypes::Extended)) return; - for (sal_Int16 nCurrent : aTypes) + for (sal_Int16 nCurrent : std::as_const(aTypes)) { if (nCurrent > style::NumberingType::CHARS_LOWER_LETTER_N) { diff --git a/sw/source/uibase/uno/unodispatch.cxx b/sw/source/uibase/uno/unodispatch.cxx index d185f982ccfc..e21810038ccc 100644 --- a/sw/source/uibase/uno/unodispatch.cxx +++ b/sw/source/uibase/uno/unodispatch.cxx @@ -105,7 +105,7 @@ uno::Sequence< uno::Reference< frame::XDispatch > > SwXDispatchProviderIntercept { DispatchMutexLock_Impl aLock; uno::Sequence< uno::Reference< frame::XDispatch> > aReturn(aDescripts.getLength()); - std::transform(aDescripts.begin(), aDescripts.end(), aReturn.begin(), + std::transform(aDescripts.begin(), aDescripts.end(), aReturn.getArray(), [this](const frame::DispatchDescriptor& rDescr) -> uno::Reference<frame::XDispatch> { return queryDispatch(rDescr.FeatureURL, rDescr.FrameName, rDescr.SearchFlags); }); return aReturn; diff --git a/sw/source/uibase/uno/unomodule.cxx b/sw/source/uibase/uno/unomodule.cxx index a64f1951e0f5..da821aece71a 100644 --- a/sw/source/uibase/uno/unomodule.cxx +++ b/sw/source/uibase/uno/unomodule.cxx @@ -107,7 +107,7 @@ uno::Sequence< uno::Reference< frame::XDispatch > > SAL_CALL SwUnoModule::queryD sal_Int32 nCount = seqDescripts.getLength(); uno::Sequence< uno::Reference< frame::XDispatch > > lDispatcher( nCount ); - std::transform(seqDescripts.begin(), seqDescripts.end(), lDispatcher.begin(), + std::transform(seqDescripts.begin(), seqDescripts.end(), lDispatcher.getArray(), [this](const frame::DispatchDescriptor& rDescr) -> uno::Reference< frame::XDispatch > { return queryDispatch( rDescr.FeatureURL, rDescr.FrameName, rDescr.SearchFlags ); }); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 2f2189456f3e..f74d07f0398c 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -2210,7 +2210,7 @@ Sequence< PropertyState > SAL_CALL SwXTextDocument::getPropertyStates( const Seq const sal_Int32 nCount = rPropertyNames.getLength(); Sequence < PropertyState > aRet ( nCount ); - std::transform(rPropertyNames.begin(), rPropertyNames.end(), aRet.begin(), + std::transform(rPropertyNames.begin(), rPropertyNames.end(), aRet.getArray(), [this](const OUString& rName) -> PropertyState { return getPropertyState(rName); }); return aRet; @@ -4103,7 +4103,7 @@ Sequence< OUString > SwXLinkNameAccessWrapper::getElementNames() { const Sequence< OUString > aOrg = m_xRealAccess->getElementNames(); aRet.realloc(aOrg.getLength()); - std::transform(aOrg.begin(), aOrg.end(), aRet.begin(), + std::transform(aOrg.begin(), aOrg.end(), aRet.getArray(), [this](const OUString& rOrg) -> OUString { return rOrg + m_sLinkSuffix; }); } return aRet; |