compilerplugins/clang/store/putpoolitem.cxx       |  103 ++++++++++++++++++++++
 compilerplugins/clang/test/putpoolitem.cxx        |   48 ++++++++++
 cui/source/tabpages/align.cxx                     |   12 +-
 cui/source/tabpages/backgrnd.cxx                  |    4 
 cui/source/tabpages/grfpage.cxx                   |    2 
 cui/source/tabpages/paragrph.cxx                  |    6 -
 cui/source/tabpages/swpossizetabpage.cxx          |    2 
 cui/source/tabpages/tabstpge.cxx                  |    2 
 cui/source/tabpages/tpline.cxx                    |   10 +-
 editeng/source/items/textitem.cxx                 |   10 --
 editeng/source/rtf/rtfitem.cxx                    |    6 -
 editeng/source/uno/unoipset.cxx                   |    2 
 sc/source/core/data/attarray.cxx                  |    6 -
 sc/source/core/data/patattr.cxx                   |   14 +-
 sc/source/filter/xml/xmlcelli.cxx                 |    5 -
 sc/source/ui/app/scmod.cxx                        |    4 
 sc/source/ui/view/tabvwsha.cxx                    |    8 -
 sd/source/ui/func/fuolbull.cxx                    |    3 
 sd/source/ui/func/fuscale.cxx                     |    2 
 sd/source/ui/view/drtxtob1.cxx                    |   11 --
 sd/source/ui/view/drviewsa.cxx                    |    2 
 sfx2/source/appl/appuno.cxx                       |    4 
 svx/source/sdr/properties/attributeproperties.cxx |    5 -
 svx/source/svdraw/svdmodel.cxx                    |    5 -
 svx/source/unodraw/UnoNameItemTable.cxx           |    4 
 sw/source/core/attr/swatrset.cxx                  |    4 
 sw/source/core/doc/docfly.cxx                     |    2 
 sw/source/core/frmedt/fefly1.cxx                  |    2 
 sw/source/core/layout/pagedesc.cxx                |    2 
 sw/source/core/unocore/unoframe.cxx               |    2 
 sw/source/core/unocore/unoobj.cxx                 |    6 -
 sw/source/core/unocore/unostyle.cxx               |   12 +-
 sw/source/core/unocore/unotbl.cxx                 |    2 
 sw/source/filter/basflt/fltini.cxx                |    2 
 sw/source/filter/ww8/ww8atr.cxx                   |    3 
 sw/source/filter/ww8/ww8graf.cxx                  |    2 
 sw/source/filter/xml/xmlfmt.cxx                   |    2 
 sw/source/filter/xml/xmlimpit.cxx                 |    2 
 sw/source/ui/frmdlg/frmpage.cxx                   |    2 
 sw/source/uibase/shells/basesh.cxx                |    2 
 sw/source/uibase/shells/frmsh.cxx                 |    2 
 sw/source/uibase/uiview/formatclipboard.cxx       |    2 
 sw/source/uibase/uiview/viewtab.cxx               |    2 
 43 files changed, 232 insertions(+), 101 deletions(-)

New commits:
commit e6de84d46c2a41fc4ae53e2744d432e50c4a4ac1
Author:     Noel Grandin <[email protected]>
AuthorDate: Thu Jun 2 09:13:02 2022 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu Jun 2 10:45:44 2022 +0200

    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 <[email protected]>

diff --git a/compilerplugins/clang/store/putpoolitem.cxx 
b/compilerplugins/clang/store/putpoolitem.cxx
new file mode 100644
index 000000000000..8080599973bd
--- /dev/null
+++ b/compilerplugins/clang/store/putpoolitem.cxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <cassert>
+#include <string>
+#include <iostream>
+#include <fstream>
+#include <set>
+#include <unordered_set>
+
+#include <clang/AST/CXXInheritance.h>
+
+#include "config_clang.h"
+
+#include "plugin.hxx"
+#include "check.hxx"
+
+/**
+
+*/
+
+namespace
+{
+class PutPoolItem : public loplugin::FilteringPlugin<PutPoolItem>
+{
+public:
+    explicit PutPoolItem(loplugin::InstantiationData const& data)
+        : FilteringPlugin(data)
+    {
+    }
+
+    virtual bool preRun() override
+    {
+        //        StringRef fn(handler.getMainFileName());
+        //        if (loplugin::isSamePathname(fn, WORKDIR 
"/YaccTarget/unoidl/source/sourceprovider-parser.cxx"))
+        //            return false;
+        return true;
+    }
+    virtual void run() override
+    {
+        if (preRun())
+            TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+    }
+
+    bool VisitCXXMemberCallExpr(const CXXMemberCallExpr*);
+    bool VisitFunctionDecl(const FunctionDecl*)
+    {
+        //        if (f->getIdentifier() && f->getName() == "foo")
+        //            f->dump();
+        return true;
+    }
+};
+
+bool PutPoolItem::VisitCXXMemberCallExpr(const CXXMemberCallExpr* cxxCallExpr)
+{
+    if (ignoreLocation(cxxCallExpr))
+        return true;
+    auto tc = loplugin::TypeCheck(cxxCallExpr->getObjectType());
+    if (!tc.Class("SfxItemSet"))
+        return true;
+    if (!cxxCallExpr->getMethodDecl()->getIdentifier()
+        || cxxCallExpr->getMethodDecl()->getName() != "Put")
+        return true;
+    auto argExpr = 
dyn_cast<CXXOperatorCallExpr>(cxxCallExpr->getArg(0)->IgnoreImplicit());
+    if (!argExpr)
+        return true;
+    if (argExpr->getOperator() != OO_Star)
+        return true;
+    auto ptrExpr = argExpr->getArg(0)->IgnoreImplicit();
+    auto tc2 = loplugin::TypeCheck(ptrExpr->getType());
+    if (!tc2.Class("unique_ptr"))
+        return true;
+    // ignore calls when we are passing a copy of a member field
+    if (isa<MemberExpr>(ptrExpr))
+        return true;
+
+    StringRef fn = getFilenameOfLocation(
+        
compiler.getSourceManager().getSpellingLoc(cxxCallExpr->getBeginLoc()));
+    if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/ui/app/inputwin.cxx")
+        || loplugin::isSamePathname(fn, SRCDIR 
"/sc/source/ui/dbgui/csvgrid.cxx")
+        || loplugin::isSamePathname(fn, SRCDIR 
"/sw/source/uibase/shells/basesh.cxx")
+        || loplugin::isSamePathname(fn, SRCDIR 
"/sw/source/uibase/shells/textsh.cxx")
+        || loplugin::isSamePathname(fn, SRCDIR 
"/sw/source/filter/xml/xmlimpit.cxx")
+        || loplugin::isSamePathname(fn, SRCDIR 
"/sw/source/uibase/shells/tabsh.cxx"))
+        return true;
+
+    //    argExpr->dump();
+
+    report(DiagnosticsEngine::Warning, "could use std::move?", 
cxxCallExpr->getBeginLoc())
+        << cxxCallExpr->getSourceRange();
+    return true;
+}
+
+loplugin::Plugin::Registration<PutPoolItem> putpoolitem("putpoolitem", true);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/compilerplugins/clang/test/putpoolitem.cxx 
b/compilerplugins/clang/test/putpoolitem.cxx
new file mode 100644
index 000000000000..fb44612a00f4
--- /dev/null
+++ b/compilerplugins/clang/test/putpoolitem.cxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <memory>
+
+class SfxPoolItem
+{
+public:
+    virtual ~SfxPoolItem();
+};
+class SfxPoolItemSubclass : public SfxPoolItem
+{
+};
+class SfxItemSet
+{
+public:
+    void Put(SfxPoolItem&);
+};
+
+void foo(SfxItemSet* pSet)
+{
+    std::unique_ptr<SfxPoolItemSubclass> foo;
+    SfxItemSet aSet;
+    // expected-error@+1 {{could use std::move? [loplugin:putpoolitem]}}
+    aSet.Put(*foo);
+
+    // expected-error@+1 {{could use std::move? [loplugin:putpoolitem]}}
+    pSet->Put(*foo);
+}
+
+class Foo2
+{
+    std::unique_ptr<SfxPoolItemSubclass> m_foo;
+    void foo()
+    {
+        SfxItemSet aSet;
+        // no warning expected
+        aSet.Put(*m_foo);
+    }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx
index 12e93ae65c43..8d2425e7ef68 100644
--- a/cui/source/tabpages/align.cxx
+++ b/cui/source/tabpages/align.cxx
@@ -223,7 +223,7 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet )
         assert(pIndentItem);
         std::unique_ptr<SfxUInt16Item> pNewIndentItem(pIndentItem->Clone());
         pNewIndentItem->SetValue(m_xEdIndent->get_value(FieldUnit::TWIP));
-        rSet->Put(*pNewIndentItem);
+        rSet->Put(std::move(pNewIndentItem));
         bChanged = true;
     }
     else if (SfxItemState::DEFAULT == rOldSet.GetItemState(nWhich, false))
@@ -266,7 +266,7 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet )
         assert(pAngleItem);
         std::unique_ptr<SdrAngleItem> pNewAngleItem(pAngleItem->Clone());
         pNewAngleItem->SetValue(m_xCtrlDial->GetRotation());
-        rSet->Put(*pNewAngleItem);
+        rSet->Put(std::move(pNewAngleItem));
         bChanged = true;
     }
     else if (SfxItemState::DEFAULT == rOldSet.GetItemState(nWhich, false))
@@ -303,7 +303,7 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet )
         assert(pStackItem);
         std::unique_ptr<SfxBoolItem> pNewStackItem(pStackItem->Clone());
         pNewStackItem->SetValue(m_xCbStacked->get_active());
-        rSet->Put(*pNewStackItem);
+        rSet->Put(std::move(pNewStackItem));
         bChanged = true;
     }
     else if (SfxItemState::DEFAULT == rOldSet.GetItemState(nWhich, false))
@@ -326,7 +326,7 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet )
         assert(pWrapItem);
         std::unique_ptr<SfxBoolItem> pNewWrapItem(pWrapItem->Clone());
         pNewWrapItem->SetValue(m_xBtnWrap->get_active());
-        rSet->Put(*pNewWrapItem);
+        rSet->Put(std::move(pNewWrapItem));
         bChanged = true;
     }
     else if (SfxItemState::DEFAULT == rOldSet.GetItemState(nWhich, false))
@@ -340,7 +340,7 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet )
         assert(pHyphItem);
         std::unique_ptr<SfxBoolItem> pNewHyphItem(pHyphItem->Clone());
         pNewHyphItem->SetValue(m_xBtnHyphen->get_active());
-        rSet->Put(*pNewHyphItem);
+        rSet->Put(std::move(pNewHyphItem));
         bChanged = true;
     }
     else if (SfxItemState::DEFAULT == rOldSet.GetItemState(nWhich, false))
@@ -354,7 +354,7 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet )
         assert(pShrinkItem);
         std::unique_ptr<SfxBoolItem> pNewShrinkItem(pShrinkItem->Clone());
         pNewShrinkItem->SetValue(m_xBtnShrink->get_active());
-        rSet->Put(*pNewShrinkItem);
+        rSet->Put(std::move(pNewShrinkItem));
         bChanged = true;
     }
     else if (SfxItemState::DEFAULT == rOldSet.GetItemState(nWhich, false))
diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx
index f1c0765fa70e..14269ad3c6c8 100644
--- a/cui/source/tabpages/backgrnd.cxx
+++ b/cui/source/tabpages/backgrnd.cxx
@@ -180,7 +180,7 @@ bool SvxBkgTabPage::FillItemSet( SfxItemSet* rCoreSet )
         {
             std::unique_ptr<SvxBrushItem> aBrushItem( 
getSvxBrushItemFromSourceSet( maSet, nWhich ) );
             if ( GraphicType::NONE != 
aBrushItem->GetGraphicObject()->GetType() )
-                rCoreSet->Put( *aBrushItem );
+                rCoreSet->Put( std::move(aBrushItem) );
             break;
         }
         default:
@@ -281,7 +281,7 @@ IMPL_LINK(SvxBkgTabPage, TblDestinationHdl_Impl, 
weld::ComboBox&, rBox, void)
         // fill local item set with XATTR_FILL settings gathered from tab page
         // and convert to SvxBrushItem and store in table destination slot 
Which
         SvxAreaTabPage::FillItemSet(&maSet);
-        maSet.Put(*getSvxBrushItemFromSourceSet(maSet, 
maSet.GetPool()->GetWhich(lcl_GetTableDestSlot(m_nActPos))));
+        maSet.Put(getSvxBrushItemFromSourceSet(maSet, 
maSet.GetPool()->GetWhich(lcl_GetTableDestSlot(m_nActPos))));
     }
 
     sal_Int32 nSelPos = rBox.get_active();
diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx
index d5c7fca425c0..1bbc73c3add3 100644
--- a/cui/source/tabpages/grfpage.cxx
+++ b/cui/source/tabpages/grfpage.cxx
@@ -270,7 +270,7 @@ bool SvxGrfCropPage::FillItemSet(SfxItemSet *rSet)
         pNew->SetRight( lcl_GetValue( *m_xRightMF, eUnit ) );
         pNew->SetTop( lcl_GetValue( *m_xTopMF, eUnit ) );
         pNew->SetBottom( lcl_GetValue( *m_xBottomMF, eUnit ) );
-        bModified |= nullptr != rSet->Put( *pNew );
+        bModified |= nullptr != rSet->Put( std::move(pNew) );
     }
 
     if( m_xZoomConstRB->get_state_changed_from_saved() )
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index 3fa77d9fb791..4b9aaff94f85 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -384,14 +384,14 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* 
rOutSet )
                             *rOutSet, SID_ATTR_PARA_REGISTER));
         if (!pBoolItem)
             return bModified;
-        std::unique_ptr<SfxBoolItem> pRegItem(pBoolItem->Clone());
         sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_REGISTER );
-        bool bSet = pRegItem->GetValue();
+        bool bSet = pBoolItem->GetValue();
 
         if (m_xRegisterCB->get_active() != bSet)
         {
+            std::unique_ptr<SfxBoolItem> pRegItem(pBoolItem->Clone());
             pRegItem->SetValue(!bSet);
-            rOutSet->Put(*pRegItem);
+            rOutSet->Put(std::move(pRegItem));
             bModified = true;
         }
         else if ( SfxItemState::DEFAULT == GetItemSet().GetItemState( _nWhich, 
false ) )
diff --git a/cui/source/tabpages/swpossizetabpage.cxx 
b/cui/source/tabpages/swpossizetabpage.cxx
index 5b0e20264282..e8a1e4eb9df4 100644
--- a/cui/source/tabpages/swpossizetabpage.cxx
+++ b/cui/source/tabpages/swpossizetabpage.cxx
@@ -861,7 +861,7 @@ bool SvxSwPosSizeTabPage::FillItemSet( SfxItemSet* rSet)
                 {
                     std::unique_ptr<SfxBoolItem> 
pFollow(static_cast<SfxBoolItem*>(pItem->Clone()));
                     pFollow->SetValue(m_xFollowCB->get_active());
-                    bModified |= nullptr != rSet->Put(*pFollow);
+                    bModified |= nullptr != rSet->Put(std::move(pFollow));
                 }
             }
         }
diff --git a/cui/source/tabpages/tabstpge.cxx b/cui/source/tabpages/tabstpge.cxx
index 96431ba20a5d..5a468f1dfffa 100644
--- a/cui/source/tabpages/tabstpge.cxx
+++ b/cui/source/tabpages/tabstpge.cxx
@@ -190,7 +190,7 @@ bool SvxTabulatorTabPage::FillItemSet(SfxItemSet* rSet)
 
         if (!pOld || *static_cast<const SvxTabStopItem*>(pOld) != *aTmp)
         {
-            rSet->Put(*aTmp);
+            rSet->Put(std::move(aTmp));
             bModified = true;
         }
     }
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx
index 60321ae9f3aa..04eaa41b92c9 100644
--- a/cui/source/tabpages/tpline.cxx
+++ b/cui/source/tabpages/tpline.cxx
@@ -413,7 +413,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs )
             pOld = GetOldItem( *rAttrs, XATTR_LINESTYLE );
             if ( !pOld || !( *static_cast<const XLineStyleItem*>(pOld) == 
*pStyleItem ) )
             {
-                rAttrs->Put( *pStyleItem );
+                rAttrs->Put( std::move(pStyleItem) );
                 bModified = true;
             }
         }
@@ -480,7 +480,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs )
             pOld = GetOldItem( *rAttrs, XATTR_LINESTART );
             if( pItem && ( !pOld || *pOld != *pItem ) )
             {
-                rAttrs->Put( *pItem );
+                rAttrs->Put( std::move(pItem) );
                 bModified = true;
             }
         }
@@ -497,7 +497,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs )
             if( pItem &&
                 ( !pOld || !( *static_cast<const XLineEndItem*>(pOld) == 
*pItem ) ) )
             {
-                rAttrs->Put( *pItem );
+                rAttrs->Put( std::move(pItem) );
                 bModified = true;
             }
         }
@@ -575,7 +575,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs )
 
             if(!pOld || !(*static_cast<const XLineJointItem*>(pOld) == *pNew))
             {
-                rAttrs->Put( *pNew );
+                rAttrs->Put( std::move(pNew) );
                 bModified = true;
             }
         }
@@ -612,7 +612,7 @@ bool SvxLineTabPage::FillItemSet( SfxItemSet* rAttrs )
 
             if(!pOld || !(*static_cast<const XLineCapItem*>(pOld) == *pNew))
             {
-                rAttrs->Put( *pNew );
+                rAttrs->Put( std::move(pNew) );
                 bModified = true;
             }
         }
diff --git a/editeng/source/items/textitem.cxx 
b/editeng/source/items/textitem.cxx
index 72b982b73ff9..df06cfd03ad8 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -2620,21 +2620,17 @@ void SvxScriptSetItem::PutItemForScriptType( 
SvtScriptType nScriptType,
     sal_uInt16 nLatin, nAsian, nComplex;
     GetWhichIds( nLatin, nAsian, nComplex );
 
-    std::unique_ptr<SfxPoolItem> pCpy(rItem.Clone());
     if( SvtScriptType::LATIN & nScriptType )
     {
-        pCpy->SetWhich( nLatin );
-        GetItemSet().Put( *pCpy );
+        GetItemSet().Put( rItem.CloneSetWhich(nLatin) );
     }
     if( SvtScriptType::ASIAN & nScriptType )
     {
-        pCpy->SetWhich( nAsian );
-        GetItemSet().Put( *pCpy );
+        GetItemSet().Put( rItem.CloneSetWhich(nAsian) );
     }
     if( SvtScriptType::COMPLEX & nScriptType )
     {
-        pCpy->SetWhich( nComplex );
-        GetItemSet().Put( *pCpy );
+        GetItemSet().Put( rItem.CloneSetWhich(nComplex) );
     }
 }
 
diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx
index 1434657f7fdc..b74b118791d1 100644
--- a/editeng/source/rtf/rtfitem.cxx
+++ b/editeng/source/rtf/rtfitem.cxx
@@ -775,7 +775,7 @@ ATTR_SETUNDERLINE:
 
                     aUL->SetColor(GetColor(sal_uInt16(nTokenValue)));
 
-                    pSet->Put(*aUL);
+                    pSet->Put(std::move(aUL));
                 }
                 break;
 
@@ -876,7 +876,7 @@ ATTR_SETOVERLINE:
 
                     aOL->SetColor(GetColor(sal_uInt16(nTokenValue)));
 
-                    pSet->Put(*aOL);
+                    pSet->Put(std::move(aOL));
                 }
                 break;
 
@@ -1529,7 +1529,7 @@ void SvxRTFParser::ReadBorderAttr( int nToken, 
SfxItemSet& rSet,
 
     SetBorderLine( nBorderTyp, *aAttr, aBrd );
 
-    rSet.Put( *aAttr );
+    rSet.Put( std::move(aAttr) );
     SkipToken();
 }
 
diff --git a/editeng/source/uno/unoipset.cxx b/editeng/source/uno/unoipset.cxx
index da068755ce8d..2aa7e5746cbc 100644
--- a/editeng/source/uno/unoipset.cxx
+++ b/editeng/source/uno/unoipset.cxx
@@ -142,7 +142,7 @@ void SvxItemPropertySet::setPropertyValue( const 
SfxItemPropertyMapEntry* pMap,
     {
         // Set new item in item set
         pNewItem->SetWhich(pMap->nWID);
-        rSet.Put(*pNewItem);
+        rSet.Put(std::move(pNewItem));
     }
 }
 
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();
diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx
index 1f91fe3e719c..beb57db5b31e 100644
--- a/sd/source/ui/func/fuolbull.cxx
+++ b/sd/source/ui/func/fuolbull.cxx
@@ -317,8 +317,7 @@ const SvxNumBulletItem* 
FuBulletAndPosition::GetNumBulletItem(SfxItemSet& aNewAt
 
     //DBG_ASSERT( pItem, "No EE_PARA_NUMBULLET in the Pool!" );
 
-    std::unique_ptr<SfxPoolItem> 
pNewItem(pItem->CloneSetWhich(EE_PARA_NUMBULLET));
-    aNewAttr.Put(*pNewItem);
+    aNewAttr.Put(pItem->CloneSetWhich(EE_PARA_NUMBULLET));
 
     if(bTitle && aNewAttr.GetItemState(EE_PARA_NUMBULLET) == SfxItemState::SET 
)
     {
diff --git a/sd/source/ui/func/fuscale.cxx b/sd/source/ui/func/fuscale.cxx
index 5d5c4c29d26a..d4730b243209 100644
--- a/sd/source/ui/func/fuscale.cxx
+++ b/sd/source/ui/func/fuscale.cxx
@@ -103,7 +103,7 @@ void FuScale::DoExecute( SfxRequest& rReq )
         }
 
         pZoomItem->SetValueSet( nZoomValues );
-        aNewAttr.Put( *pZoomItem );
+        aNewAttr.Put( std::move(pZoomItem) );
 
         SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
         ScopedVclPtr<AbstractSvxZoomDialog> 
pDlg(pFact->CreateSvxZoomDialog(rReq.GetFrameWeld(), aNewAttr));
diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx
index eda20834083d..86b7a698aa95 100644
--- a/sd/source/ui/view/drtxtob1.cxx
+++ b/sd/source/ui/view/drtxtob1.cxx
@@ -197,8 +197,7 @@ void TextObjectBar::Execute( SfxRequest &rReq )
                         pNewItem->SetLeftValue( static_cast<sal_uInt16>(nLeft) 
);
 
                         SfxItemSet aNewAttrs( aAttr );
-                        aNewAttrs.Put( *pNewItem );
-                        pNewItem.reset();
+                        aNewAttrs.Put( std::move(pNewItem) );
                         pOLV->GetOutliner()->SetParaAttribs( nPara, aNewAttrs 
);
                     }
                 }
@@ -264,8 +263,7 @@ void TextObjectBar::Execute( SfxRequest &rReq )
                         pNewItem->SetLower( static_cast<sal_uInt16>(nLower) );
 
                         SfxItemSet aNewAttrs( aAttr );
-                        aNewAttrs.Put( *pNewItem );
-                        pNewItem.reset();
+                        aNewAttrs.Put( std::move(pNewItem) );
                         pOLV->GetOutliner()->SetParaAttribs( nPara, aNewAttrs 
);
                     }
                 }
@@ -306,8 +304,7 @@ void TextObjectBar::Execute( SfxRequest &rReq )
                     }
                     pNewItem->SetLower( static_cast<sal_uInt16>(nLower) );
 
-                    aNewAttrs.Put( *pNewItem );
-                    pNewItem.reset();
+                    aNewAttrs.Put( std::move(pNewItem) );
 
                     mpView->SetAttributes( aNewAttrs );
                 }
@@ -836,7 +833,7 @@ void TextObjectBar::Execute( SfxRequest &rReq )
             }
             if (pColorItem)
             {
-                pNewArgs->Put(*pColorItem);
+                pNewArgs->Put(std::move(pColorItem));
             }
 
             mpView->SetAttributes(*pNewArgs);
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index 8cd3dd04f7e1..a61d64599781 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -555,7 +555,7 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet)
             }
 
             pZoomItem->SetValueSet( nZoomValues );
-            rSet.Put( *pZoomItem );
+            rSet.Put( std::move(pZoomItem) );
         }
     }
     if( SfxItemState::DEFAULT == rSet.GetItemState( SID_ATTR_ZOOMSLIDER ) )
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index 6c75faa21977..26f0e336a9f2 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -264,7 +264,7 @@ void TransformParameters( sal_uInt16 nSlotId, const 
uno::Sequence<beans::Propert
 
             // at least one part of the complex item must be present; other 
parts can have default values
             if ( nFound > 0 )
-                rSet.Put( *pItem );
+                rSet.Put( std::move(pItem) );
         }
 
         return;
@@ -370,7 +370,7 @@ void TransformParameters( sal_uInt16 nSlotId, const 
uno::Sequence<beans::Propert
 
                 if ( bRet )
                     // only use successfully converted items
-                    rSet.Put( *pItem );
+                    rSet.Put( std::move(pItem) );
 
             }
         }
diff --git a/svx/source/sdr/properties/attributeproperties.cxx 
b/svx/source/sdr/properties/attributeproperties.cxx
index a6bcaf40da65..7f141b8f65b7 100644
--- a/svx/source/sdr/properties/attributeproperties.cxx
+++ b/svx/source/sdr/properties/attributeproperties.cxx
@@ -339,10 +339,7 @@ namespace sdr::properties
                 if(pResultItem)
                 {
                     // force ItemSet
-                    mxItemSet->Put(*pResultItem);
-
-                    // delete item if it was a generated one
-                    pResultItem.reset();
+                    mxItemSet->Put(std::move(pResultItem));
                 }
                 else
                 {
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index f5218c997ca6..acf05bd94d21 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -1668,10 +1668,7 @@ void SdrModel::MigrateItemSet( const SfxItemSet* 
pSourceSet, SfxItemSet* pDestSe
 
             // set item
             if( pResultItem )
-            {
-                pDestSet->Put(*pResultItem);
-                pResultItem.reset();
-            }
+                pDestSet->Put(std::move(pResultItem));
             else
                 pDestSet->Put(*pPoolItem);
         }
diff --git a/svx/source/unodraw/UnoNameItemTable.cxx 
b/svx/source/unodraw/UnoNameItemTable.cxx
index 71569ae7ab51..67b1dcc7d59c 100644
--- a/svx/source/unodraw/UnoNameItemTable.cxx
+++ b/svx/source/unodraw/UnoNameItemTable.cxx
@@ -107,7 +107,7 @@ void SvxUnoNameItemTable::ImplInsertByName( const OUString& 
aName, const uno::An
     xNewItem->SetName(aName);
     xNewItem->PutValue(aElement, mnMemberId);
     xNewItem->SetWhich(mnWhich);
-    maItemSetVector.back()->Put(*xNewItem);
+    maItemSetVector.back()->Put(std::move(xNewItem));
 }
 
 // XNameContainer
@@ -172,7 +172,7 @@ void SAL_CALL SvxUnoNameItemTable::replaceByName( const 
OUString& aApiName, cons
         xNewItem->SetName(aName);
         if (!xNewItem->PutValue(aElement, mnMemberId) || 
!isValid(xNewItem.get()))
             throw lang::IllegalArgumentException();
-        (*aIter)->Put(*xNewItem);
+        (*aIter)->Put(std::move(xNewItem));
         return;
     }
 
diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx
index a825cb9941a2..e50116d58459 100644
--- a/sw/source/core/attr/swatrset.cxx
+++ b/sw/source/core/attr/swatrset.cxx
@@ -395,7 +395,7 @@ void SwAttrSet::CopyToModify( sw::BroadcastingModify& rMod 
) const
                     // #i92811#
                     if ( pNewListIdItem != nullptr )
                     {
-                        tmpSet->Put( *pNewListIdItem );
+                        tmpSet->Put( std::move(pNewListIdItem) );
                     }
                     pCNd->SetAttr( *tmpSet );
                 }
@@ -410,7 +410,7 @@ void SwAttrSet::CopyToModify( sw::BroadcastingModify& rMod 
) const
                 if ( pNewListIdItem != nullptr )
                 {
                     SfxItemSet aTmpSet( *this );
-                    aTmpSet.Put( *pNewListIdItem );
+                    aTmpSet.Put( std::move(pNewListIdItem) );
                     pCNd->SetAttr( aTmpSet );
                 }
                 else
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
index 3ab1e80b4e0a..985cf6bbd9fd 100644
--- a/sw/source/core/doc/docfly.cxx
+++ b/sw/source/core/doc/docfly.cxx
@@ -546,7 +546,7 @@ void 
SwDoc::CheckForUniqueItemForLineFillNameOrIndex(SfxItemSet& rSet)
 
         if(pResult)
         {
-            rSet.Put(*pResult);
+            rSet.Put(std::move(pResult));
         }
     }
 }
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index b6d7016dd8bc..323816ef2d84 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -799,7 +799,7 @@ const SwFrameFormat *SwFEShell::NewFlyFrame( const 
SfxItemSet& rSet, bool bAnchV
                     }
                 }
 
-                const_cast<SfxItemSet&>(rSet).Put( *pOldAnchor );
+                const_cast<SfxItemSet&>(rSet).Put( std::move(pOldAnchor) );
 
                 if( bHOriChgd )
                     const_cast<SfxItemSet&>(rSet).Put( *aOldH );
diff --git a/sw/source/core/layout/pagedesc.cxx 
b/sw/source/core/layout/pagedesc.cxx
index 418bf6b2358f..d93b47517e5b 100644
--- a/sw/source/core/layout/pagedesc.cxx
+++ b/sw/source/core/layout/pagedesc.cxx
@@ -179,7 +179,7 @@ void SwPageDesc::Mirror()
     aSet.Put( m_Master.GetPaperBin() );
     aSet.Put( m_Master.GetULSpace() );
     aSet.Put( m_Master.GetBox() );
-    aSet.Put( *m_Master.makeBackgroundBrushItem() );
+    aSet.Put( m_Master.makeBackgroundBrushItem() );
     aSet.Put( m_Master.GetShadow() );
     aSet.Put( m_Master.GetCol() );
     aSet.Put( m_Master.GetFrameDir() );
diff --git a/sw/source/core/unocore/unoframe.cxx 
b/sw/source/core/unocore/unoframe.cxx
index d4140a8edf64..9df8a8a180f1 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2836,7 +2836,7 @@ void 
SwXFrame::attachToRange(uno::Reference<text::XTextRange> const& xTextRange,
                 pFormat->DelFrames();
                 pAnchorItem->SetAnchor( pCopySource->Start() );
                 SfxItemSetFixed<RES_ANCHOR, RES_ANCHOR> aAnchorSet( 
pDoc->GetAttrPool() );
-                aAnchorSet.Put( *pAnchorItem );
+                aAnchorSet.Put( std::move(pAnchorItem) );
                 pDoc->SetFlyFrameAttr( *pFormat, aAnchorSet );
             }
         }
diff --git a/sw/source/core/unocore/unoobj.cxx 
b/sw/source/core/unocore/unoobj.cxx
index 067daf3d25f4..3d4cf5dfe16a 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -299,7 +299,7 @@ SwUnoCursorHelper::SetPageDesc(
         }
         else
         {
-            rSet.Put(*pNewDesc);
+            rSet.Put(std::move(pNewDesc));
         }
     }
     return true;
@@ -393,7 +393,7 @@ lcl_setDropcapCharStyle(SwPaM const & rPam, SfxItemSet & 
rItemSet,
     }
     const rtl::Reference<SwDocStyleSheet> xStyle(new SwDocStyleSheet(*pStyle));
     pDrop->SetCharFormat(xStyle->GetCharFormat());
-    rItemSet.Put(*pDrop);
+    rItemSet.Put(std::move(pDrop));
 }
 
 static void
@@ -425,7 +425,7 @@ lcl_setRubyCharstyle(SfxItemSet & rItemSet, uno::Any const& 
rValue)
                 sStyle, SwGetPoolIdFromName::ChrFmt);
         pRuby->SetCharFormatId(nId);
     }
-    rItemSet.Put(*pRuby);
+    rItemSet.Put(std::move(pRuby));
 }
 
 bool
diff --git a/sw/source/core/unocore/unostyle.cxx 
b/sw/source/core/unocore/unostyle.cxx
index c154272188df..66832979b3df 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1837,7 +1837,7 @@ void 
SwXStyle::SetPropertyValue<sal_uInt16(RES_PAGEDESC)>(const SfxItemPropertyM
         if(!pPageDesc)
             throw lang::IllegalArgumentException();
         pNewDesc->RegisterToPageDesc(*pPageDesc);
-        rStyleSet.Put(*pNewDesc);
+        rStyleSet.Put(std::move(pNewDesc));
     }
 }
 template<>
@@ -1954,7 +1954,7 @@ void 
SwXStyle::SetPropertyValue<sal_uInt16(RES_TXTATR_CJK_RUBY)>(const SfxItemPr
         const sal_uInt16 nId(SwStyleNameMapper::GetPoolIdFromUIName(sValue, 
SwGetPoolIdFromName::ChrFmt));
         pRuby->SetCharFormatId(nId);
     }
-    rStyleSet.Put(*pRuby);
+    rStyleSet.Put(std::move(pRuby));
     SetPropertyValue<HINT_BEGIN>(rEntry, rPropSet, rValue, o_rStyleBase);
 }
 template<>
@@ -1983,7 +1983,7 @@ void 
SwXStyle::SetPropertyValue<sal_uInt16(RES_PARATR_DROP)>(const SfxItemProper
         throw lang::IllegalArgumentException();
     }
     pDrop->SetCharFormat(pStyle->GetCharFormat());
-    rStyleSet.Put(*pDrop);
+    rStyleSet.Put(std::move(pDrop));
 }
 template<>
 void SwXStyle::SetPropertyValue<sal_uInt16(RES_PARATR_NUMRULE)>(const 
SfxItemPropertyMapEntry& rEntry, const SfxItemPropertySet& rPropSet, const 
uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
@@ -2840,7 +2840,7 @@ SwXPageStyle::SwXPageStyle(SwDocShell* pDocSh)
 void SwXStyle::PutItemToSet(const SvxSetItem* pSetItem, const 
SfxItemPropertySet& rPropSet, const SfxItemPropertyMapEntry& rEntry, const 
uno::Any& rVal, SwStyleBase_Impl& rBaseImpl)
 {
     // create a new SvxSetItem and get it's ItemSet as new target
-    const std::unique_ptr<SvxSetItem> pNewSetItem(pSetItem->Clone());
+    std::unique_ptr<SvxSetItem> pNewSetItem(pSetItem->Clone());
     SfxItemSet& rSetSet = pNewSetItem->GetItemSet();
 
     // set parent to ItemSet to ensure XFILL_NONE as XFillStyleItem
@@ -2857,7 +2857,7 @@ void SwXStyle::PutItemToSet(const SvxSetItem* pSetItem, 
const SfxItemPropertySet
     rSetSet.SetParent(nullptr);
 
     // set the new SvxSetItem at the real target and delete it
-    rBaseImpl.GetItemSet().Put(*pNewSetItem);
+    rBaseImpl.GetItemSet().Put(std::move(pNewSetItem));
 }
 
 void SwXPageStyle::SetPropertyValues_Impl(const uno::Sequence<OUString>& 
rPropertyNames, const uno::Sequence<uno::Any>& rValues)
@@ -3010,7 +3010,7 @@ void SwXPageStyle::SetPropertyValues_Impl(const 
uno::Sequence<OUString>& rProper
                         rSetSet.SetParent(nullptr);
 
                         // set the new SvxSetItem at the real target and 
delete it
-                        aBaseImpl.GetItemSet().Put(*pNewSetItem);
+                        aBaseImpl.GetItemSet().Put(std::move(pNewSetItem));
                     }
                 }
                 continue;
diff --git a/sw/source/core/unocore/unotbl.cxx 
b/sw/source/core/unocore/unotbl.cxx
index 829ea727e5d6..90df0f543428 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -1788,7 +1788,7 @@ void SwTableProperties_Impl::AddItemToSet(SfxItemSet& 
rSet,
         std::unique_ptr<SfxPoolItem> aItem(aItemFactory());
         for(const auto& aMemberAndAny : vMemberAndAny)
             aItem->PutValue(*aMemberAndAny.second, aMemberAndAny.first | 
(bAddTwips ? CONVERT_TWIPS : 0) );
-        rSet.Put(*aItem);
+        rSet.Put(std::move(aItem));
     }
 }
 void SwTableProperties_Impl::ApplyTableAttr(const SwTable& rTable, SwDoc& rDoc)
diff --git a/sw/source/filter/basflt/fltini.cxx 
b/sw/source/filter/basflt/fltini.cxx
index acf72c41cda2..f8c6c320fa0f 100644
--- a/sw/source/filter/basflt/fltini.cxx
+++ b/sw/source/filter/basflt/fltini.cxx
@@ -366,7 +366,7 @@ void CalculateFlySize(SfxItemSet& rFlySet, const 
SwNodeIndex& rAnchor,
         aSz->SetWidth( nWidth );
         if( MINFLY > aSz->GetHeight() )
             aSz->SetHeight( MINFLY );
-        rFlySet.Put( *aSz );
+        rFlySet.Put( std::move(aSz) );
     }
     else if( MINFLY > pFrameSizeItem->GetHeight() )
     {
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index c8f147e05763..7e3ba779aab6 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -917,8 +917,7 @@ void MSWordExportBase::OutputFormat( const SwFormat& 
rFormat, bool bPapFormat, b
                     case drawing::FillStyle_SOLID:
                     {
                         // Construct an SvxBrushItem, as expected by the 
exporters.
-                        std::unique_ptr<SvxBrushItem> 
aBrush(getSvxBrushItemFromSourceSet(rFrameFormat.GetAttrSet(), RES_BACKGROUND));
-                        aSet.Put(*aBrush);
+                        
aSet.Put(getSvxBrushItemFromSourceSet(rFrameFormat.GetAttrSet(), 
RES_BACKGROUND));
                         break;
                     }
                     default:
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index e942f437c50c..c10c302cf6c4 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -2731,7 +2731,7 @@ SwFrameFormat* SwWW8ImplReader::Read_GrafLayer( 
tools::Long nGrafAnchorCp )
         if (!aTarFrame.isEmpty())
             pFormatURL->SetTargetFrameName(aTarFrame);
         pFormatURL->SetMap(nullptr);
-        aFlySet.Put(*pFormatURL);
+        aFlySet.Put(std::move(pFormatURL));
     }
 
     // If we are to be "below text" then we are not to be opaque
diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx
index 9f5ee3cf0dc1..b317b04473e3 100644
--- a/sw/source/filter/xml/xmlfmt.cxx
+++ b/sw/source/filter/xml/xmlfmt.cxx
@@ -655,7 +655,7 @@ void SwXMLItemSetStyleContext_Impl::ConnectPageDesc()
     if( pFormatPageDesc )
     {
         pFormatPageDesc->RegisterToPageDesc( *pPageDesc );
-        m_oItemSet->Put( *pFormatPageDesc );
+        m_oItemSet->Put( std::move(pFormatPageDesc) );
     }
 }
 
diff --git a/sw/source/filter/xml/xmlimpit.cxx 
b/sw/source/filter/xml/xmlimpit.cxx
index d09221ba2eb6..f60d78f83810 100644
--- a/sw/source/filter/xml/xmlimpit.cxx
+++ b/sw/source/filter/xml/xmlimpit.cxx
@@ -134,7 +134,7 @@ void SvXMLImportItemMapper::importXML( SfxItemSet& rSet,
                     }
 
                     if( bPut )
-                        rSet.Put( *pNewItem );
+                        rSet.Put( std::move(pNewItem) );
                 }
                 else
                 {
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index a0f8ab67cea7..35db7c25135a 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -2752,7 +2752,7 @@ bool SwFrameURLPage::FillItemSet(SfxItemSet *rSet)
         pFormatURL->SetTargetFrameName(m_xFrameCB->get_active_text());
         bModified = true;
     }
-    rSet->Put(*pFormatURL);
+    rSet->Put(std::move(pFormatURL));
     return bModified;
 }
 
diff --git a/sw/source/uibase/shells/basesh.cxx 
b/sw/source/uibase/shells/basesh.cxx
index 4792e0af9f09..7f422172efce 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -2755,7 +2755,7 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq)
                 std::unique_ptr<SvxBrushItem> 
aBrush(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
                 rSh.GetBoxBackground( aBrush );
                 pDlg.disposeAndReset(pFact->CreateSwBackgroundDialog(pMDI, 
aSet));
-                aSet.Put( *aBrush );
+                aSet.Put( std::move(aBrush) );
                 if ( pDlg->Execute() == RET_OK )
                 {
 
diff --git a/sw/source/uibase/shells/frmsh.cxx 
b/sw/source/uibase/shells/frmsh.cxx
index 2cea80a45f68..9652af505186 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -1241,7 +1241,7 @@ void SwFrameShell::ExecFrameStyle(SfxRequest const & rReq)
     {
         aBoxItem->SetAllDistances(MIN_BORDER_DIST);
     }
-    aFrameSet.Put( *aBoxItem );
+    aFrameSet.Put( std::move(aBoxItem) );
     // Template AutoUpdate
     SwFrameFormat* pFormat = rSh.GetSelectedFrameFormat();
     if(pFormat && pFormat->IsAutoUpdateFormat())
diff --git a/sw/source/uibase/uiview/formatclipboard.cxx 
b/sw/source/uibase/uiview/formatclipboard.cxx
index 5e7e8f768108..16e72e40bdfc 100644
--- a/sw/source/uibase/uiview/formatclipboard.cxx
+++ b/sw/source/uibase/uiview/formatclipboard.cxx
@@ -115,7 +115,7 @@ void lcl_getTableAttributes( SfxItemSet& rSet, SwWrtShell 
&rSh )
     if(rSh.GetBoxDirection( aBoxDirection ))
     {
         aBoxDirection->SetWhich(FN_TABLE_BOX_TEXTORIENTATION);
-        rSet.Put(*aBoxDirection);
+        rSet.Put(std::move(aBoxDirection));
     }
 
     rSet.Put(SfxUInt16Item(FN_TABLE_SET_VERT_ALIGN, rSh.GetBoxAlign()));
diff --git a/sw/source/uibase/uiview/viewtab.cxx 
b/sw/source/uibase/uiview/viewtab.cxx
index 563d29fab1f5..3f33b3f404fa 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -808,7 +808,7 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
                     if( pColl && pColl->IsAutoUpdateFormat())
                     {
                         SfxItemSetFixed<RES_PARATR_TABSTOP, 
RES_PARATR_TABSTOP> aSetTmp(GetPool());
-                        aSetTmp.Put(*aTabStops);
+                        aSetTmp.Put(std::move(aTabStops));
                         rSh.AutoUpdatePara( pColl, aSetTmp );
                     }
                     else

Reply via email to