diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-06-02 09:13:02 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-06-02 10:45:44 +0200 |
commit | e6de84d46c2a41fc4ae53e2744d432e50c4a4ac1 (patch) | |
tree | 6be38c21e699cf240ff4b5eb3dd38e251dda96b5 /sc | |
parent | 1577c0dc30ed3c9db361fb989e41a3e9d6c45dfa (diff) |
std::move SfxPoolItem into SfxItemSet where possible
found with the help of a temporary loplugin (which i have put into the
store/ folder)
Change-Id: Ide40d09bef6993ace50039a8fd0439b7e29c09a6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135288
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/attarray.cxx | 6 | ||||
-rw-r--r-- | sc/source/core/data/patattr.cxx | 14 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlcelli.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/app/scmod.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwsha.cxx | 8 |
5 files changed, 16 insertions, 21 deletions
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index 356786667032..d5eaa1906d01 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -798,9 +798,9 @@ void ScAttrArray::ApplyLineStyleArea( SCROW nStartRow, SCROW nEndRow, SetLine( pNewBLTRItem->GetLine(), pLine ); } } - if( pNewBoxItem ) rNewSet.Put( *pNewBoxItem ); - if( pNewTLBRItem ) rNewSet.Put( *pNewTLBRItem ); - if( pNewBLTRItem ) rNewSet.Put( *pNewBLTRItem ); + if( pNewBoxItem ) rNewSet.Put( std::move(pNewBoxItem) ); + if( pNewTLBRItem ) rNewSet.Put( std::move(pNewTLBRItem) ); + if( pNewBLTRItem ) rNewSet.Put( std::move(pNewBLTRItem) ); nStart = mvData[nPos].nEndRow + 1; diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index a0077be5696a..8a88e9449850 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -781,13 +781,13 @@ void ScPatternAttr::FillToEditItemSet( SfxItemSet& rEditSet, const SfxItemSet& r else { // tdf#125054 adapt WhichID - rEditSet.Put( *aColorItem, EE_CHAR_COLOR ); + rEditSet.Put( std::move(aColorItem), EE_CHAR_COLOR ); } // tdf#125054 adapt WhichID - rEditSet.Put( *aFontItem, EE_CHAR_FONTINFO ); - rEditSet.Put( *aCjkFontItem, EE_CHAR_FONTINFO_CJK ); - rEditSet.Put( *aCtlFontItem, EE_CHAR_FONTINFO_CTL ); + rEditSet.Put( std::move(aFontItem), EE_CHAR_FONTINFO ); + rEditSet.Put( std::move(aCjkFontItem), EE_CHAR_FONTINFO_CJK ); + rEditSet.Put( std::move(aCtlFontItem), EE_CHAR_FONTINFO_CTL ); rEditSet.Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) ); rEditSet.Put( SvxFontHeightItem( nCjkHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) ); @@ -797,8 +797,8 @@ void ScPatternAttr::FillToEditItemSet( SfxItemSet& rEditSet, const SfxItemSet& r rEditSet.Put( SvxWeightItem ( eCtlWeight, EE_CHAR_WEIGHT_CTL ) ); // tdf#125054 adapt WhichID - rEditSet.Put( *aUnderlineItem, EE_CHAR_UNDERLINE ); - rEditSet.Put( *aOverlineItem, EE_CHAR_OVERLINE ); + rEditSet.Put( std::move(aUnderlineItem), EE_CHAR_UNDERLINE ); + rEditSet.Put( std::move(aOverlineItem), EE_CHAR_OVERLINE ); rEditSet.Put( SvxWordLineModeItem( bWordLine, EE_CHAR_WLM ) ); rEditSet.Put( SvxCrossedOutItem( eStrike, EE_CHAR_STRIKEOUT ) ); @@ -1142,7 +1142,7 @@ ScPatternAttr* ScPatternAttr::PutInPool( ScDocument* pDestDoc, ScDocument* pSrcD if ( pNewItem ) { - pDestSet->Put(*pNewItem); + pDestSet->Put(std::move(pNewItem)); } else pDestSet->Put(*pSrcItem); diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index 0f47ae25c96b..0d0a81ebade6 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -393,8 +393,7 @@ void ScXMLTableRowCellContext::PushFormat(sal_Int32 nBegin, sal_Int32 nEnd, cons if (nLastItemID != pEntry->mnItemID && pPoolItem) { // Flush the last item when the item ID changes. - rFmt.maItemSet.Put(*pPoolItem); - pPoolItem.reset(); + rFmt.maItemSet.Put(std::move(pPoolItem)); } switch (pEntry->mnItemID) @@ -562,7 +561,7 @@ void ScXMLTableRowCellContext::PushFormat(sal_Int32 nBegin, sal_Int32 nEnd, cons } if (pPoolItem) - rFmt.maItemSet.Put(*pPoolItem); + rFmt.maItemSet.Put(std::move(pPoolItem)); } OUString ScXMLTableRowCellContext::GetFirstParagraph() const diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index 97a5461956ca..1529f9920549 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -2031,9 +2031,7 @@ std::optional<SfxItemSet> ScModule::CreateItemSet( sal_uInt16 nId ) pRet->Put( ScTpPrintItem( GetPrintOptions() ) ); // TP_GRID - std::unique_ptr<SvxGridItem> pSvxGridItem = aViewOpt.CreateGridItem(); - pRet->Put( *pSvxGridItem ); - pSvxGridItem.reset(); + pRet->Put( aViewOpt.CreateGridItem() ); // TP_USERLISTS if ( pUL ) diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 7d57d26534fe..99877fdaf589 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -527,7 +527,6 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName const ScPatternAttr* pOldAttrs = GetSelectionPattern(); auto pOldSet = std::make_shared<SfxItemSet>(pOldAttrs->GetItemSet()); - std::unique_ptr<SvxNumberInfoItem> pNumberInfoItem; pOldSet->MergeRange(XATTR_FILLSTYLE, XATTR_FILLCOLOR); @@ -566,7 +565,7 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName aLineInner->SetValid( SvxBoxInfoItemValidFlags::LEFT, aTempInfo->IsValid(SvxBoxInfoItemValidFlags::RIGHT)); aLineInner->SetValid( SvxBoxInfoItemValidFlags::RIGHT, aTempInfo->IsValid(SvxBoxInfoItemValidFlags::LEFT)); - pOldSet->Put( *aNewFrame ); + pOldSet->Put( std::move(aNewFrame) ); } else { @@ -579,10 +578,9 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName pOldSet->Put( SfxUInt32Item( ATTR_VALUE_FORMAT, pOldAttrs->GetNumberFormat( rDoc.GetFormatTable() ) ) ); - pNumberInfoItem = MakeNumberInfoItem(rDoc, GetViewData()); - + std::unique_ptr<SvxNumberInfoItem> pNumberInfoItem = MakeNumberInfoItem(rDoc, GetViewData()); pOldSet->MergeRange( SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_INFO ); - pOldSet->Put(*pNumberInfoItem ); + pOldSet->Put( std::move(pNumberInfoItem) ); bInFormatDialog = true; ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); |