summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-05-08 08:29:46 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-05-09 08:47:50 +0200
commite0382c3ad7786910bc9aa81cf581798df0f2508c (patch)
tree6acb0196add99896ced2aa1a76ff5b432bc45401 /sw/source
parent38a684f72988f29e1c07bf9fa5a83e275e80e24c (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')
-rw-r--r--sw/source/core/doc/DocumentStylePoolManager.cxx20
-rw-r--r--sw/source/core/doc/doclay.cxx6
-rw-r--r--sw/source/core/doc/poolfmt.cxx10
-rw-r--r--sw/source/core/doc/tblafmt.cxx18
-rw-r--r--sw/source/core/docnode/ndtbl.cxx2
-rw-r--r--sw/source/core/tox/ToxTextGenerator.cxx6
-rw-r--r--sw/source/core/unocore/unoframe.cxx2
-rw-r--r--sw/source/core/unocore/unostyle.cxx4
-rw-r--r--sw/source/filter/basflt/fltini.cxx4
-rw-r--r--sw/source/filter/html/htmldrawreader.cxx6
-rw-r--r--sw/source/filter/html/htmldrawwriter.cxx4
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx5
-rw-r--r--sw/source/filter/ww8/ww8graf.cxx8
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx2
-rw-r--r--sw/source/filter/xml/xmlitemi.cxx2
-rw-r--r--sw/source/ui/chrdlg/numpara.cxx4
-rw-r--r--sw/source/uibase/app/appopt.cxx12
-rw-r--r--sw/source/uibase/shells/annotsh.cxx9
-rw-r--r--sw/source/uibase/shells/basesh.cxx3
-rw-r--r--sw/source/uibase/shells/drwtxtex.cxx9
-rw-r--r--sw/source/uibase/shells/tabsh.cxx7
-rw-r--r--sw/source/uibase/shells/textsh1.cxx3
-rw-r--r--sw/source/uibase/uiview/formatclipboard.cxx2
-rw-r--r--sw/source/uibase/uiview/viewstat.cxx17
-rw-r--r--sw/source/uibase/utlui/uitool.cxx2
25 files changed, 61 insertions, 106 deletions
diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx
index a7a0a68850f5..8b4c1ba85393 100644
--- a/sw/source/core/doc/DocumentStylePoolManager.cxx
+++ b/sw/source/core/doc/DocumentStylePoolManager.cxx
@@ -1317,9 +1317,9 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
aLR.SetLeft( GetMetricVal( CM_1 ));
aLR.SetRight( GetMetricVal( CM_1 ));
aSet.Put( aLR );
- std::shared_ptr<SvxULSpaceItem> aUL(static_cast<SvxULSpaceItem*>(pNewColl->GetULSpace().Clone()));
+ std::unique_ptr<SvxULSpaceItem> aUL(static_cast<SvxULSpaceItem*>(pNewColl->GetULSpace().Clone()));
aUL->SetLower( HTML_PARSPACE );
- aSet.Put(*aUL);
+ aSet.Put(std::move(aUL));
}
break;
@@ -1332,9 +1332,9 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
// The lower paragraph distance is set explicitly (makes
// assigning hard attributes easier)
- std::shared_ptr<SvxULSpaceItem> aULSpaceItem(static_cast<SvxULSpaceItem*>(pNewColl->GetULSpace().Clone()));
+ std::unique_ptr<SvxULSpaceItem> aULSpaceItem(static_cast<SvxULSpaceItem*>(pNewColl->GetULSpace().Clone()));
aULSpaceItem->SetLower( 0 );
- aSet.Put(*aULSpaceItem);
+ aSet.Put(std::move(aULSpaceItem));
}
break;
@@ -1349,13 +1349,13 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
aSet.Put( SwParaConnectBorderItem( false ) );
SetAllScriptItem( aSet, SvxFontHeightItem(120, 100, RES_CHRATR_FONTSIZE) );
- std::shared_ptr<SvxULSpaceItem> aUL;
+ std::unique_ptr<SvxULSpaceItem> aUL;
{
pNewColl->SetNextTextFormatColl( *GetTextCollFromPool( RES_POOLCOLL_TEXT ));
aUL.reset(static_cast<SvxULSpaceItem*>(pNewColl->GetULSpace().Clone()));
}
aUL->SetLower( HTML_PARSPACE );
- aSet.Put(*aUL);
+ aSet.Put(std::move(aUL));
SwFormatLineNumber aLN;
aLN.SetCountLines( false );
aSet.Put( aLN );
@@ -1364,22 +1364,22 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
case RES_POOLCOLL_HTML_DD:
{
- std::shared_ptr<SvxLRSpaceItem> aLR(static_cast<SvxLRSpaceItem*>(pNewColl->GetLRSpace().Clone()));
+ std::unique_ptr<SvxLRSpaceItem> aLR(static_cast<SvxLRSpaceItem*>(pNewColl->GetLRSpace().Clone()));
// We indent by 1 cm. The IDs are always 2 away from each other!
aLR->SetLeft( GetMetricVal( CM_1 ));
- aSet.Put(*aLR);
+ aSet.Put(std::move(aLR));
}
break;
case RES_POOLCOLL_HTML_DT:
{
- std::shared_ptr<SvxLRSpaceItem> aLR;
+ std::unique_ptr<SvxLRSpaceItem> aLR;
{
pNewColl->SetNextTextFormatColl( *GetTextCollFromPool( RES_POOLCOLL_HTML_DD ));
aLR.reset(static_cast<SvxLRSpaceItem*>(pNewColl->GetLRSpace().Clone()));
}
// We indent by 0 cm. The IDs are always 2 away from each other!
aLR->SetLeft( 0 );
- aSet.Put( *aLR );
+ aSet.Put( std::move(aLR) );
}
break;
}
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index cad5209f32a2..4d8775fa3514 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -785,9 +785,9 @@ lcl_InsertLabel(SwDoc & rDoc, SwTextFormatColls *const pTextFormatCollTable,
pNewSet->Put( pOldFormat->GetAnchor() );
// The new one should be changeable in its height.
- std::shared_ptr<SwFormatFrameSize> aFrameSize(static_cast<SwFormatFrameSize*>(pOldFormat->GetFrameSize().Clone()));
+ std::unique_ptr<SwFormatFrameSize> aFrameSize(static_cast<SwFormatFrameSize*>(pOldFormat->GetFrameSize().Clone()));
aFrameSize->SetHeightSizeType( ATT_MIN_SIZE );
- pNewSet->Put( *aFrameSize );
+ pNewSet->Put( std::move(aFrameSize) );
SwStartNode* pSttNd = rDoc.GetNodes().MakeTextSection(
SwNodeIndex( rDoc.GetNodes().GetEndOfAutotext() ),
@@ -849,7 +849,7 @@ lcl_InsertLabel(SwDoc & rDoc, SwTextFormatColls *const pTextFormatCollTable,
}
aFrameSize->SetWidthPercent(isMath ? 0 : 100);
aFrameSize->SetHeightPercent(SwFormatFrameSize::SYNCED);
- pNewSet->Put( *aFrameSize );
+ pNewSet->Put( std::move(aFrameSize) );
// Hard-set the attributes, because they could come from the Template
// and then size calculations could not be correct anymore.
diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx
index 0db28109528b..2f1f20d89175 100644
--- a/sw/source/core/doc/poolfmt.cxx
+++ b/sw/source/core/doc/poolfmt.cxx
@@ -103,15 +103,9 @@ void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem )
}
if( nWhCJK )
- {
- std::unique_ptr<SfxPoolItem> pNewItem(rItem.CloneSetWhich(nWhCJK));
- rSet.Put( *pNewItem );
- }
+ rSet.Put( rItem.CloneSetWhich(nWhCJK) );
if( nWhCTL )
- {
- std::unique_ptr<SfxPoolItem> pNewItem(rItem.CloneSetWhich(nWhCTL));
- rSet.Put( *pNewItem );
- }
+ rSet.Put( rItem.CloneSetWhich(nWhCTL) );
}
/// Return the AutoCollection by its Id. If it doesn't
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index 430b32422382..e9331971edc0 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -548,12 +548,9 @@ void SwTableAutoFormat::UpdateToSet(sal_uInt8 nPos, SfxItemSet& rSet,
}
else
{
- std::unique_ptr<SfxPoolItem> pNewItem(rChg.GetHeight().CloneSetWhich(RES_CHRATR_CJK_FONTSIZE));
- rSet.Put( *pNewItem);
- pNewItem = rChg.GetWeight().CloneSetWhich(RES_CHRATR_CJK_WEIGHT);
- rSet.Put( *pNewItem);
- pNewItem = rChg.GetPosture().CloneSetWhich(RES_CHRATR_CJK_POSTURE);
- rSet.Put( *pNewItem);
+ rSet.Put( rChg.GetHeight().CloneSetWhich(RES_CHRATR_CJK_FONTSIZE) );
+ rSet.Put( rChg.GetWeight().CloneSetWhich(RES_CHRATR_CJK_WEIGHT) );
+ rSet.Put( rChg.GetPosture().CloneSetWhich(RES_CHRATR_CJK_POSTURE) );
}
// do not insert empty CTL font
const SvxFontItem& rCTLFont = rChg.GetCTLFont();
@@ -566,12 +563,9 @@ void SwTableAutoFormat::UpdateToSet(sal_uInt8 nPos, SfxItemSet& rSet,
}
else
{
- std::unique_ptr<SfxPoolItem> pNewItem(rChg.GetHeight().CloneSetWhich(RES_CHRATR_CTL_FONTSIZE));
- rSet.Put( *pNewItem);
- pNewItem = rChg.GetWeight().CloneSetWhich(RES_CHRATR_CTL_WEIGHT);
- rSet.Put( *pNewItem);
- pNewItem = rChg.GetPosture().CloneSetWhich(RES_CHRATR_CTL_POSTURE);
- rSet.Put( *pNewItem);
+ rSet.Put( rChg.GetHeight().CloneSetWhich(RES_CHRATR_CTL_FONTSIZE) );
+ rSet.Put( rChg.GetWeight().CloneSetWhich(RES_CHRATR_CTL_WEIGHT) );
+ rSet.Put( rChg.GetPosture().CloneSetWhich(RES_CHRATR_CTL_POSTURE) );
}
rSet.Put( rChg.GetUnderline() );
rSet.Put( rChg.GetOverline() );
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 61749c7d77e9..b86b2f52d9f2 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -4187,7 +4187,7 @@ void SwDoc::ClearLineNumAttrs( SwPosition const & rPos )
pUndo->AddNode( *pTextNode );
std::unique_ptr<SfxStringItem> pNewItem(static_cast<SfxStringItem*>(pFormatItem->Clone()));
pNewItem->SetValue(OUString());
- rSet.Put( *pNewItem );
+ rSet.Put( std::move(pNewItem) );
pTextNode->SetAttr( rSet );
}
}
diff --git a/sw/source/core/tox/ToxTextGenerator.cxx b/sw/source/core/tox/ToxTextGenerator.cxx
index 7c29f0e7c979..ee51d5b9a219 100644
--- a/sw/source/core/tox/ToxTextGenerator.cxx
+++ b/sw/source/core/tox/ToxTextGenerator.cxx
@@ -291,9 +291,9 @@ ToxTextGenerator::CollectAttributesForTox(const SwTextAttr& hint, SwAttrPool& po
if (pItem->Which() == RES_CHRATR_ESCAPEMENT ||
pItem->Which() == RES_CHRATR_POSTURE ||
pItem->Which() == RES_CHRATR_CJK_POSTURE ||
- pItem->Which() == RES_CHRATR_CTL_POSTURE) {
- std::unique_ptr<SfxPoolItem> clonedItem(pItem->Clone());
- retval->Put(*clonedItem);
+ pItem->Which() == RES_CHRATR_CTL_POSTURE)
+ {
+ retval->Put(std::unique_ptr<SfxPoolItem>(pItem->Clone()));
}
if (aIter.IsAtEnd()) {
break;
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 99358c62f5ab..25e1edcf37d5 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1118,7 +1118,7 @@ bool SwGraphicProperties_Impl::AnyToItemSet(
{
std::unique_ptr<SfxPoolItem> pItem(::GetDfltAttr( nIDs[nIndex] )->Clone());
bRet &= pItem->PutValue(*pAny, nMId );
- rGrSet.Put(*pItem);
+ rGrSet.Put(std::move(pItem));
}
}
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 56f991b53364..f73337bbd2f4 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -3004,10 +3004,10 @@ void SwXPageStyle::SetPropertyValues_Impl(const uno::Sequence<OUString>& rProper
case FN_PARAM_FTN_INFO:
{
const SfxPoolItem& rItem = aBaseImpl.GetItemSet().Get(FN_PARAM_FTN_INFO);
- const std::unique_ptr<SfxPoolItem> pNewFootnoteItem(rItem.Clone());
+ std::unique_ptr<SfxPoolItem> pNewFootnoteItem(rItem.Clone());
if(!pNewFootnoteItem->PutValue(rValues[nProp], pEntry->nMemberId))
throw lang::IllegalArgumentException();
- aBaseImpl.GetItemSet().Put(*pNewFootnoteItem);
+ aBaseImpl.GetItemSet().Put(std::move(pNewFootnoteItem));
break;
}
default:
diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx
index 3b6ce6e54469..847930fc84a1 100644
--- a/sw/source/filter/basflt/fltini.cxx
+++ b/sw/source/filter/basflt/fltini.cxx
@@ -404,9 +404,9 @@ void CalculateFlySize(SfxItemSet& rFlySet, const SwNodeIndex& rAnchor,
}
else if( MINFLY > static_cast<const SwFormatFrameSize*>(pItem)->GetHeight() )
{
- std::shared_ptr<SwFormatFrameSize> aSz(static_cast<SwFormatFrameSize*>(pItem->Clone()));
+ std::unique_ptr<SwFormatFrameSize> aSz(static_cast<SwFormatFrameSize*>(pItem->Clone()));
aSz->SetHeight( MINFLY );
- rFlySet.Put( *aSz );
+ rFlySet.Put( std::move(aSz) );
}
}
diff --git a/sw/source/filter/html/htmldrawreader.cxx b/sw/source/filter/html/htmldrawreader.cxx
index cfaa9ece5011..7dbabfafd73e 100644
--- a/sw/source/filter/html/htmldrawreader.cxx
+++ b/sw/source/filter/html/htmldrawreader.cxx
@@ -238,11 +238,7 @@ static void PutEEPoolItem( SfxItemSet &rEEItemSet,
}
if( nEEWhich )
- {
- std::unique_ptr<SfxPoolItem> pEEItem(rSwItem.Clone());
- pEEItem->SetWhich( nEEWhich );
- rEEItemSet.Put( *pEEItem );
- }
+ rEEItemSet.Put( rSwItem.CloneSetWhich(nEEWhich) );
}
void SwHTMLParser::NewMarquee( HTMLTable *pCurTable )
diff --git a/sw/source/filter/html/htmldrawwriter.cxx b/sw/source/filter/html/htmldrawwriter.cxx
index 15615ad29698..7666f9f2ca17 100644
--- a/sw/source/filter/html/htmldrawwriter.cxx
+++ b/sw/source/filter/html/htmldrawwriter.cxx
@@ -114,9 +114,7 @@ void SwHTMLWriter::GetEEAttrsFromDrwObj( SfxItemSet& rItemSet,
pEEItem = &rObjItemSet.GetPool()->GetDefaultItem(nEEWhich);
// now we clone the item with the which id of the writer
- std::unique_ptr<SfxPoolItem> pSwItem(pEEItem->Clone());
- pSwItem->SetWhich( nSwWhich );
- rItemSet.Put( *pSwItem );
+ rItemSet.Put( pEEItem->CloneSetWhich(nSwWhich) );
}
nEEWhich = aIter.NextWhich();
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index d08796457530..5ea8e4a5a7db 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -468,8 +468,7 @@ void SwWW8AttrIter::OutAttr( sal_Int32 nSwPos, bool bWriteCombChars)
{
if (const SfxGrabBagItem *pCharFmtGrabBag = aExportSet.GetItem<SfxGrabBagItem>(RES_CHRATR_GRABBAG, false))
{
- std::unique_ptr<SfxPoolItem> pNewItem(pCharFmtGrabBag->Clone());
- SfxGrabBagItem* pNewCharFmtGrabBag = dynamic_cast<SfxGrabBagItem*>(pNewItem.get());
+ std::unique_ptr<SfxGrabBagItem> pNewCharFmtGrabBag(static_cast<SfxGrabBagItem*>(pCharFmtGrabBag->Clone()));
assert(pNewCharFmtGrabBag);
auto & rNewFmtMap = pNewCharFmtGrabBag->GetGrabBag();
for (auto const & item : pAutoFmtGrabBag->GetGrabBag())
@@ -477,7 +476,7 @@ void SwWW8AttrIter::OutAttr( sal_Int32 nSwPos, bool bWriteCombChars)
if (item.second.hasValue())
rNewFmtMap.erase(item.first);
}
- aExportSet.Put(*pNewCharFmtGrabBag);
+ aExportSet.Put(std::move(pNewCharFmtGrabBag));
}
}
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 551376439e05..f798db5f25cd 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -521,9 +521,7 @@ void SwWW8ImplReader::InsertTxbxStyAttrs( SfxItemSet& rS, sal_uInt16 nColl )
( SfxItemState::SET != rS.GetItemState(nWhich, false) )
)
{
- std::unique_ptr<SfxPoolItem> pCopy(pItem->Clone());
- pCopy->SetWhich( nWhich );
- rS.Put( *pCopy );
+ rS.Put( pItem->CloneSetWhich(nWhich) );
}
}
}
@@ -735,9 +733,7 @@ void SwWW8ImplReader::InsertAttrsAsDrawingAttrs(WW8_CP nStartCp, WW8_CP nEndCp,
nWhich != nSlotId
)
{
- std::unique_ptr<SfxPoolItem> pCopy(pItem->Clone());
- pCopy->SetWhich( nWhich );
- pS->Put( *pCopy );
+ pS->Put( pItem->CloneSetWhich(nWhich) );
}
}
}
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index bcb276246418..e98fc1b5b4b6 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -3617,7 +3617,7 @@ void SwWW8ImplReader::Read_UnderlineColor(sal_uInt16, const sal_uInt8* pData, sh
{
std::unique_ptr<SvxUnderlineItem> pUnderline(static_cast<SvxUnderlineItem*>(m_xCurrentItemSet->Get(RES_CHRATR_UNDERLINE, false).Clone()));
pUnderline->SetColor( msfilter::util::BGRToRGB(SVBT32ToUInt32(pData)) );
- m_xCurrentItemSet->Put( *pUnderline );
+ m_xCurrentItemSet->Put( std::move(pUnderline) );
}
}
}
diff --git a/sw/source/filter/xml/xmlitemi.cxx b/sw/source/filter/xml/xmlitemi.cxx
index 68e7ca2f47d7..b14f28bc7534 100644
--- a/sw/source/filter/xml/xmlitemi.cxx
+++ b/sw/source/filter/xml/xmlitemi.cxx
@@ -220,7 +220,7 @@ void SwXMLImportTableItemMapper_Impl::finished(
*pNewItem, m_FoMarginValue, Ids[i][1], rUnitConverter);
if (bPut)
{
- rSet.Put(*pNewItem);
+ rSet.Put(std::move(pNewItem));
}
}
else
diff --git a/sw/source/ui/chrdlg/numpara.cxx b/sw/source/ui/chrdlg/numpara.cxx
index 65209b1a1658..09a5e3c3f5a9 100644
--- a/sw/source/ui/chrdlg/numpara.cxx
+++ b/sw/source/ui/chrdlg/numpara.cxx
@@ -113,7 +113,7 @@ bool SwParagraphNumTabPage::FillItemSet( SfxItemSet* rSet )
{
std::unique_ptr<SfxUInt16Item> pOutlineLv(static_cast<SfxUInt16Item*>(pOldOutlineLv->Clone()));
pOutlineLv->SetValue( aOutlineLv );
- rSet->Put(*pOutlineLv);
+ rSet->Put(std::move(pOutlineLv));
bModified = true;
}
}
@@ -128,7 +128,7 @@ bool SwParagraphNumTabPage::FillItemSet( SfxItemSet* rSet )
{
std::unique_ptr<SfxStringItem> pRule(static_cast<SfxStringItem*>(pOldRule->Clone()));
pRule->SetValue(aStyle);
- rSet->Put(*pRule);
+ rSet->Put(std::move(pRule));
bModified = true;
}
}
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)