diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-05-08 08:29:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-05-09 08:47:50 +0200 |
commit | e0382c3ad7786910bc9aa81cf581798df0f2508c (patch) | |
tree | 6acb0196add99896ced2aa1a76ff5b432bc45401 /sw/source/uibase | |
parent | 38a684f72988f29e1c07bf9fa5a83e275e80e24c (diff) |
avoid copying when placing items into SfxItemSet
Change-Id: I05c627f590e7794c1ba11b66021dc30aa3285eb0
Reviewed-on: https://gerrit.libreoffice.org/71941
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/uibase')
-rw-r--r-- | sw/source/uibase/app/appopt.cxx | 12 | ||||
-rw-r--r-- | sw/source/uibase/shells/annotsh.cxx | 9 | ||||
-rw-r--r-- | sw/source/uibase/shells/basesh.cxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/shells/drwtxtex.cxx | 9 | ||||
-rw-r--r-- | sw/source/uibase/shells/tabsh.cxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/shells/textsh1.cxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/uiview/formatclipboard.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewstat.cxx | 17 | ||||
-rw-r--r-- | sw/source/uibase/utlui/uitool.cxx | 2 |
9 files changed, 21 insertions, 43 deletions
diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx index 9a0b995679a7..3e9613639f44 100644 --- a/sw/source/uibase/app/appopt.cxx +++ b/sw/source/uibase/app/appopt.cxx @@ -133,15 +133,9 @@ std::unique_ptr<SfxItemSet> SwModule::CreateItemSet( sal_uInt16 nId ) pRet->Put(SwPtrItem(FN_PARAM_PRINTER, pPrt)); pRet->Put(SwPtrItem(FN_PARAM_WRTSHELL, &rWrtShell)); - std::unique_ptr<SfxPoolItem> pNewItem( - rWrtShell.GetDefault(RES_CHRATR_LANGUAGE).CloneSetWhich(SID_ATTR_LANGUAGE) ); - pRet->Put(*pNewItem); - - pNewItem = rWrtShell.GetDefault(RES_CHRATR_CJK_LANGUAGE).CloneSetWhich(SID_ATTR_CHAR_CJK_LANGUAGE); - pRet->Put(*pNewItem); - - pNewItem = rWrtShell.GetDefault(RES_CHRATR_CTL_LANGUAGE).CloneSetWhich(SID_ATTR_CHAR_CTL_LANGUAGE); - pRet->Put(*pNewItem); + pRet->Put(rWrtShell.GetDefault(RES_CHRATR_LANGUAGE).CloneSetWhich(SID_ATTR_LANGUAGE)); + pRet->Put(rWrtShell.GetDefault(RES_CHRATR_CJK_LANGUAGE).CloneSetWhich(SID_ATTR_CHAR_CJK_LANGUAGE)); + pRet->Put(rWrtShell.GetDefault(RES_CHRATR_CTL_LANGUAGE).CloneSetWhich(SID_ATTR_CHAR_CTL_LANGUAGE)); } else { diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index b1d0054dec3d..f8bf88323182 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -598,8 +598,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) if(nEEWhich && pNewAttrs) { - std::unique_ptr<SfxPoolItem> pNewItem(pNewAttrs->Get(nWhich).CloneSetWhich(nEEWhich)); - aNewAttr.Put(*pNewItem); + aNewAttr.Put(pNewAttrs->Get(nWhich).CloneSetWhich(nEEWhich)); } tools::Rectangle aOutRect = pOLV->GetOutputArea(); @@ -709,8 +708,7 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet) const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType ); if( pI ) { - std::unique_ptr<SfxPoolItem> pNewItem(pI->CloneSetWhich(nWhich)); - rSet.Put( *pNewItem ); + rSet.Put(pI->CloneSetWhich(nWhich)); } else rSet.InvalidateItem( nWhich ); @@ -860,8 +858,7 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet) if(nEEWhich) { - std::unique_ptr<SfxPoolItem> pNewItem(aEditAttr.Get(nEEWhich).CloneSetWhich(nWhich)); - rSet.Put(*pNewItem); + rSet.Put(aEditAttr.Get(nEEWhich).CloneSetWhich(nWhich)); if(nEEWhich == EE_CHAR_KERNING) { SfxItemState eState = aEditAttr.GetItemState( EE_CHAR_KERNING ); diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 0a3a735fdd02..96e4c0145703 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -2158,8 +2158,7 @@ void SwBaseShell::GetTextFontCtrlState( SfxItemSet& rSet ) const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType ); if( pI ) { - std::unique_ptr<SfxPoolItem> pNewItem(pI->CloneSetWhich(nWhich)); - rSet.Put( *pNewItem ); + rSet.Put( pI->CloneSetWhich(nWhich) ); } else rSet.InvalidateItem( nWhich ); diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index 6043349c54b9..82950e37743e 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -568,8 +568,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) } if(nEEWhich && pNewAttrs) { - std::unique_ptr<SfxPoolItem> pNewItem(pNewAttrs->Get(nWhich).CloneSetWhich(nEEWhich)); - aNewAttr.Put(*pNewItem); + aNewAttr.Put(pNewAttrs->Get(nWhich).CloneSetWhich(nEEWhich)); } SetAttrToMarked(aNewAttr); @@ -911,8 +910,7 @@ void SwDrawTextShell::GetDrawTextCtrlState(SfxItemSet& rSet) const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType ); if( pI ) { - std::unique_ptr<SfxPoolItem> pNewItem(pI->CloneSetWhich(nWhich)); - rSet.Put( *pNewItem ); + rSet.Put(pI->CloneSetWhich(nWhich)); } else rSet.InvalidateItem( nWhich ); @@ -964,8 +962,7 @@ void SwDrawTextShell::GetDrawTextCtrlState(SfxItemSet& rSet) } if(nEEWhich) { - std::unique_ptr<SfxPoolItem> pNewItem(aEditAttr.Get(nEEWhich).CloneSetWhich(nWhich)); - rSet.Put(*pNewItem); + rSet.Put(aEditAttr.Get(nEEWhich).CloneSetWhich(nWhich)); } nWhich = aIter.NextWhich(); diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index ef892924fc27..b9a424e0d2af 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -206,10 +206,7 @@ static SwTableRep* lcl_TableParamToItemSet( SfxItemSet& rSet, SwWrtShell &rSh ) //row split std::unique_ptr<SwFormatRowSplit> pSplit = rSh.GetRowSplit(); if(pSplit) - { - rSet.Put(*pSplit); - pSplit.reset(); - } + rSet.Put(std::move(pSplit)); if(!bTableSel) { @@ -1372,7 +1369,7 @@ void SwTableShell::GetState(SfxItemSet &rSet) { std::unique_ptr<SwFormatRowSplit> pSplit = rSh.GetRowSplit(); if(pSplit) - rSet.Put(*pSplit); + rSet.Put(std::move(pSplit)); else rSet.InvalidateItem( nSlot ); } diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 8cc0036bf338..657bf72df900 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -1589,8 +1589,7 @@ void SwTextShell::GetState( SfxItemSet &rSet ) SfxItemSet aSet( GetPool() ); rSh.GetCurAttr( aSet ); const SvxColorItem& aColorItem = aSet.Get(RES_CHRATR_COLOR); - std::unique_ptr<SfxPoolItem> pNewItem(aColorItem.CloneSetWhich(SID_ATTR_CHAR_COLOR2)); - rSet.Put( *pNewItem ); + rSet.Put( aColorItem.CloneSetWhich(SID_ATTR_CHAR_COLOR2) ); } break; case SID_ATTR_CHAR_COLOR_BACKGROUND: diff --git a/sw/source/uibase/uiview/formatclipboard.cxx b/sw/source/uibase/uiview/formatclipboard.cxx index f8f95205dbf6..9fab132e6c1d 100644 --- a/sw/source/uibase/uiview/formatclipboard.cxx +++ b/sw/source/uibase/uiview/formatclipboard.cxx @@ -140,7 +140,7 @@ void lcl_getTableAttributes( SfxItemSet& rSet, SwWrtShell &rSh ) std::unique_ptr<SwFormatRowSplit> pSplit = rSh.GetRowSplit(); if(pSplit) - rSet.Put(*pSplit); + rSet.Put(std::move(pSplit)); } void lcl_setTableAttributes( const SfxItemSet& rSet, SwWrtShell &rSh ) diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx index bc771162bea2..fe6c882e9db7 100644 --- a/sw/source/uibase/uiview/viewstat.cxx +++ b/sw/source/uibase/uiview/viewstat.cxx @@ -255,23 +255,19 @@ void SwView::GetState(SfxItemSet &rSet) break; case SID_ATTR_LANGUAGE: { - std::unique_ptr<SfxPoolItem> pNewItem( - m_pWrtShell->GetDefault(RES_CHRATR_LANGUAGE).CloneSetWhich(SID_ATTR_LANGUAGE)); - rSet.Put(*pNewItem); + rSet.Put(m_pWrtShell->GetDefault(RES_CHRATR_LANGUAGE).CloneSetWhich(SID_ATTR_LANGUAGE)); } break; case RES_CHRATR_CJK_LANGUAGE: { - std::unique_ptr<SfxPoolItem> pNewItem( - m_pWrtShell->GetDefault(RES_CHRATR_CJK_LANGUAGE).CloneSetWhich(RES_CHRATR_CJK_LANGUAGE)); - rSet.Put(*pNewItem); + rSet.Put(m_pWrtShell->GetDefault(RES_CHRATR_CJK_LANGUAGE) + .CloneSetWhich(RES_CHRATR_CJK_LANGUAGE)); } break; case RES_CHRATR_CTL_LANGUAGE: { - std::unique_ptr<SfxPoolItem> pNewItem( - m_pWrtShell->GetDefault(RES_CHRATR_CTL_LANGUAGE).CloneSetWhich(RES_CHRATR_CTL_LANGUAGE)); - rSet.Put(*pNewItem); + rSet.Put(m_pWrtShell->GetDefault(RES_CHRATR_CTL_LANGUAGE) + .CloneSetWhich(RES_CHRATR_CTL_LANGUAGE)); } break; case FN_REDLINE_ON: @@ -479,8 +475,7 @@ void SwView::GetState(SfxItemSet &rSet) { if (!(m_nSelectionType & SelectionType::DrawObject)) { - std::unique_ptr<SfxPoolItem> pNewItem(pState->CloneSetWhich(nWhich)); - rSet.Put(*pNewItem); + rSet.Put(pState->CloneSetWhich(nWhich)); } } else diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx index c44434b25961..17e1a92eac34 100644 --- a/sw/source/uibase/utlui/uitool.cxx +++ b/sw/source/uibase/utlui/uitool.cxx @@ -149,7 +149,7 @@ void ConvertAttrCharToGen(SfxItemSet& rSet) else pGrabBag.reset(new SfxGrabBagItem(RES_CHRATR_GRABBAG)); pGrabBag->GetGrabBag()["DialogUseCharAttr"] <<= true; - rSet.Put(*pGrabBag); + rSet.Put(std::move(pGrabBag)); } void ConvertAttrGenToChar(SfxItemSet& rSet, const SfxItemSet& rOrigSet) |