[Libreoffice-commits] core.git: cui/source include/svx svx/source sw/inc sw/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 23 17:50:28 UTC 2020


 cui/source/tabpages/backgrnd.cxx            |    2 -
 include/svx/unobrushitemhelper.hxx          |    2 -
 svx/source/unodraw/unobrushitemhelper.cxx   |   16 +++++------
 sw/inc/doc.hxx                              |    4 +-
 sw/inc/fesh.hxx                             |    8 ++---
 sw/inc/format.hxx                           |    2 -
 sw/source/core/attr/format.cxx              |    4 +-
 sw/source/core/docnode/ndtbl1.cxx           |   14 +++++-----
 sw/source/core/frmedt/fetab.cxx             |   16 +++++------
 sw/source/core/layout/atrfrm.cxx            |    4 +-
 sw/source/core/layout/flylay.cxx            |    2 -
 sw/source/core/layout/paintfrm.cxx          |    2 -
 sw/source/core/layout/tabfrm.cxx            |    2 -
 sw/source/core/layout/wsfrm.cxx             |    6 ++--
 sw/source/core/unocore/unoframe.cxx         |    6 ++--
 sw/source/core/unocore/unoparagraph.cxx     |    2 -
 sw/source/core/unocore/unostyle.cxx         |   12 ++++----
 sw/source/core/unocore/unotbl.cxx           |   38 ++++++++++++++--------------
 sw/source/filter/html/htmlcss1.cxx          |    2 -
 sw/source/filter/html/htmlflywriter.cxx     |    2 -
 sw/source/filter/html/htmlgrin.cxx          |    2 -
 sw/source/filter/html/htmltabw.cxx          |    4 +-
 sw/source/filter/html/swcss1.hxx            |    2 -
 sw/source/filter/html/wrthtml.cxx           |    2 -
 sw/source/filter/writer/wrt_fn.cxx          |    2 -
 sw/source/filter/ww8/wrtw8esh.cxx           |    2 -
 sw/source/filter/ww8/ww8atr.cxx             |    4 +-
 sw/source/ui/dialog/uiregionsw.cxx          |   10 +++----
 sw/source/uibase/docvw/romenu.cxx           |   22 ++++++++--------
 sw/source/uibase/docvw/romenu.hxx           |    4 +-
 sw/source/uibase/shells/basesh.cxx          |    6 ++--
 sw/source/uibase/shells/tabsh.cxx           |    6 ++--
 sw/source/uibase/uiview/formatclipboard.cxx |    4 +-
 33 files changed, 108 insertions(+), 108 deletions(-)

New commits:
commit d4248915d7db69aa7bf31d9d6189b7375aca70ed
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Apr 23 14:04:16 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Apr 23 19:49:43 2020 +0200

    pass SvxBrushItem around by unique_ptr
    
    we never create an object that is actually shared, so this is wasted
    
    Note1: in
      IMPL_LINK_NOARG(SwEditRegionDlg, OkHdl, weld::Button&, void)
    there was a comparison
      if( aBrush != pRepr->GetBackground() || ...
    which I removed
    
    Note2: In
        bool SwDoc::GetBoxAttr( const SwCursor& rCursor, std::shared_ptr<SfxPoolItem>& rToFill )
    which had a condition
        else if( rToFill != xBack )
    I changed to compare contents
    
    Change-Id: Idd769f44917c5ccc7e9f4bfbaddf12f9cd4151cf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92791
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx
index 123481198e17..38190271d778 100644
--- a/cui/source/tabpages/backgrnd.cxx
+++ b/cui/source/tabpages/backgrnd.cxx
@@ -181,7 +181,7 @@ bool SvxBkgTabPage::FillItemSet( SfxItemSet* rCoreSet )
         }
         case drawing::FillStyle_BITMAP:
         {
-            std::shared_ptr<SvxBrushItem> aBrushItem( getSvxBrushItemFromSourceSet( maSet, nWhich ) );
+            std::unique_ptr<SvxBrushItem> aBrushItem( getSvxBrushItemFromSourceSet( maSet, nWhich ) );
             if ( GraphicType::NONE != aBrushItem->GetGraphicObject()->GetType() )
                 rCoreSet->Put( *aBrushItem );
             break;
diff --git a/include/svx/unobrushitemhelper.hxx b/include/svx/unobrushitemhelper.hxx
index da0104747d74..1bb7d8f1422b 100644
--- a/include/svx/unobrushitemhelper.hxx
+++ b/include/svx/unobrushitemhelper.hxx
@@ -43,7 +43,7 @@ SVXCORE_DLLPUBLIC void setSvxBrushItemAsFillAttributesToTargetSet(
 // items in the range [XATTR_FILL_FIRST .. XATTR_FILL_LAST]. Since this is not 100%
 // representable this may lead to reduced data. With nBackgroundID a Which-ID for the
 // to-be-created SvxBrushItem has to be given (default should be 99 as in RES_BACKGROUND).
-SVXCORE_DLLPUBLIC std::shared_ptr<SvxBrushItem> getSvxBrushItemFromSourceSet(
+SVXCORE_DLLPUBLIC std::unique_ptr<SvxBrushItem> getSvxBrushItemFromSourceSet(
     const SfxItemSet& rSourceSet,
     sal_uInt16 nBackgroundID,
     bool bSearchInParents = true,
diff --git a/svx/source/unodraw/unobrushitemhelper.cxx b/svx/source/unodraw/unobrushitemhelper.cxx
index f62356026efa..e6c5758db9c1 100644
--- a/svx/source/unodraw/unobrushitemhelper.cxx
+++ b/svx/source/unodraw/unobrushitemhelper.cxx
@@ -167,7 +167,7 @@ static sal_uInt16 getTransparenceForSvxBrushItem(const SfxItemSet& rSourceSet, b
     return nFillTransparence;
 }
 
-static std::shared_ptr<SvxBrushItem> getSvxBrushItemForSolid(const SfxItemSet& rSourceSet, bool bSearchInParents, sal_uInt16 nBackgroundID)
+static std::unique_ptr<SvxBrushItem> getSvxBrushItemForSolid(const SfxItemSet& rSourceSet, bool bSearchInParents, sal_uInt16 nBackgroundID)
 {
     Color aFillColor(rSourceSet.Get(XATTR_FILLCOLOR, bSearchInParents).GetColorValue());
 
@@ -184,10 +184,10 @@ static std::shared_ptr<SvxBrushItem> getSvxBrushItemForSolid(const SfxItemSet& r
         aFillColor.SetTransparency(aTargetTrans);
     }
 
-    return std::make_shared<SvxBrushItem>(aFillColor, nBackgroundID);
+    return std::make_unique<SvxBrushItem>(aFillColor, nBackgroundID);
 }
 
-std::shared_ptr<SvxBrushItem> getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt16 nBackgroundID, bool bSearchInParents, bool bXMLImportHack)
+std::unique_ptr<SvxBrushItem> getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt16 nBackgroundID, bool bSearchInParents, bool bXMLImportHack)
 {
     const XFillStyleItem* pXFillStyleItem(rSourceSet.GetItem<XFillStyleItem>(XATTR_FILLSTYLE, bSearchInParents));
 
@@ -202,10 +202,10 @@ std::shared_ptr<SvxBrushItem> getSvxBrushItemFromSourceSet(const SfxItemSet& rSo
 
         aFillColor.SetTransparency(0xff);
 
-        return std::make_shared<SvxBrushItem>(aFillColor, nBackgroundID);
+        return std::make_unique<SvxBrushItem>(aFillColor, nBackgroundID);
     }
 
-    auto aRetval = std::make_shared<SvxBrushItem>(nBackgroundID);
+    auto aRetval = std::make_unique<SvxBrushItem>(nBackgroundID);
 
     switch(pXFillStyleItem->GetValue())
     {
@@ -244,7 +244,7 @@ std::shared_ptr<SvxBrushItem> getSvxBrushItemFromSourceSet(const SfxItemSet& rSo
                 aMixedColor.SetTransparency(aTargetTrans);
             }
 
-            aRetval = std::make_shared<SvxBrushItem>(aMixedColor, nBackgroundID);
+            aRetval = std::make_unique<SvxBrushItem>(aMixedColor, nBackgroundID);
             break;
         }
         case drawing::FillStyle_HATCH:
@@ -276,7 +276,7 @@ std::shared_ptr<SvxBrushItem> getSvxBrushItemFromSourceSet(const SfxItemSet& rSo
                 const sal_uInt8 aTargetTrans(std::min(sal_uInt8(0xfe), static_cast< sal_uInt8 >((nFillTransparence * 254) / 100)));
 
                 aHatchColor.SetTransparency(aTargetTrans);
-                aRetval = std::make_shared<SvxBrushItem>(aHatchColor, nBackgroundID);
+                aRetval = std::make_unique<SvxBrushItem>(aHatchColor, nBackgroundID);
             }
 
             break;
@@ -319,7 +319,7 @@ std::shared_ptr<SvxBrushItem> getSvxBrushItemFromSourceSet(const SfxItemSet& rSo
             }
 
             // create with given graphic and position
-            aRetval = std::make_shared<SvxBrushItem>(aGraphic, aSvxGraphicPosition, nBackgroundID);
+            aRetval = std::make_unique<SvxBrushItem>(aGraphic, aSvxGraphicPosition, nBackgroundID);
 
             // get evtl. mixed transparence
             const sal_uInt16 nFillTransparence(getTransparenceForSvxBrushItem(rSourceSet, bSearchInParents));
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index f4cd14a1911e..8e810bdb686a 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1484,7 +1484,7 @@ public:
     ///   Call again without bOptimize to ensure equal height in case some row's content didn't fit.
     bool BalanceRowHeight( const SwCursor& rCursor, bool bTstOnly, const bool bOptimize );
     void SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew );
-    static bool GetRowBackground( const SwCursor& rCursor, std::shared_ptr<SvxBrushItem>& rToFill );
+    static bool GetRowBackground( const SwCursor& rCursor, std::unique_ptr<SvxBrushItem>& rToFill );
     void SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet );
     void SetTabLineStyle( const SwCursor& rCursor,
                           const Color* pColor, bool bSetLine,
@@ -1501,7 +1501,7 @@ public:
     the values of the same property over any other boxes in the selection; if any value is different from
     that of the first box, the property is unset (and false is returned).
     */
-    static bool GetBoxAttr( const SwCursor& rCursor, std::shared_ptr<SfxPoolItem>& rToFill );
+    static bool GetBoxAttr( const SwCursor& rCursor, std::unique_ptr<SfxPoolItem>& rToFill );
     void SetBoxAlign( const SwCursor& rCursor, sal_uInt16 nAlign );
     static sal_uInt16 GetBoxAlign( const SwCursor& rCursor );
     /// Adjusts selected cell widths in such a way, that their content does not need to be wrapped (if possible).
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index 87319659505a..a28416dee426 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -675,16 +675,16 @@ public:
     void SetTabLineStyle(const Color* pColor, bool bSetLine = false, const editeng::SvxBorderLine* pBorderLine = nullptr);
 
     void SetTabBackground( const SvxBrushItem &rNew );
-    void GetTabBackground( std::shared_ptr<SvxBrushItem>& rToFill ) const;
+    void GetTabBackground( std::unique_ptr<SvxBrushItem>& rToFill ) const;
 
     void SetBoxBackground( const SvxBrushItem &rNew );
-    bool GetBoxBackground( std::shared_ptr<SvxBrushItem>& rToFill ) const; ///< FALSE ambiguous.
+    bool GetBoxBackground( std::unique_ptr<SvxBrushItem>& rToFill ) const; ///< FALSE ambiguous.
 
     void SetBoxDirection( const SvxFrameDirectionItem& rNew );
-    bool GetBoxDirection( std::shared_ptr<SvxFrameDirectionItem>& rToFill ) const; ///< FALSE ambiguous.
+    bool GetBoxDirection( std::unique_ptr<SvxFrameDirectionItem>& rToFill ) const; ///< FALSE ambiguous.
 
     void SetRowBackground( const SvxBrushItem &rNew );
-    bool GetRowBackground( std::shared_ptr<SvxBrushItem>& rToFill ) const; ///< FALSE ambiguous.
+    bool GetRowBackground( std::unique_ptr<SvxBrushItem>& rToFill ) const; ///< FALSE ambiguous.
 
     SwTab WhichMouseTabCol( const Point &rPt ) const;
     void GetTabCols( SwTabCols &rToFill ) const; ///< Info about columns and margins.
diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index 2c437e656e71..8a8c984ec58f 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -203,7 +203,7 @@ public:
     inline const SvxFormatKeepItem         &GetKeep( bool = true ) const;
 
     // Create SvxBrushItem for Background fill (partially for backwards compatibility)
-    std::shared_ptr<SvxBrushItem> makeBackgroundBrushItem( bool = true ) const;
+    std::unique_ptr<SvxBrushItem> makeBackgroundBrushItem( bool = true ) const;
 
     inline const SvxShadowItem            &GetShadow( bool = true ) const;
     inline const SwFormatPageDesc            &GetPageDesc( bool = true ) const;
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index ac03070f20d0..c856abb50b34 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -779,7 +779,7 @@ void SwFormat::SetGrabBagItem(const uno::Any& rVal)
     m_pGrabBagItem->PutValue(rVal, 0);
 }
 
-std::shared_ptr<SvxBrushItem> SwFormat::makeBackgroundBrushItem(bool bInP) const
+std::unique_ptr<SvxBrushItem> SwFormat::makeBackgroundBrushItem(bool bInP) const
 {
     if (supportsFullDrawingLayerFillAttributeSet())
     {
@@ -792,7 +792,7 @@ std::shared_ptr<SvxBrushItem> SwFormat::makeBackgroundBrushItem(bool bInP) const
         return getSvxBrushItemFromSourceSet(m_aSet, RES_BACKGROUND, bInP);
     }
 
-    return std::shared_ptr<SvxBrushItem>(m_aSet.GetBackground(bInP).Clone());
+    return std::unique_ptr<SvxBrushItem>(m_aSet.GetBackground(bInP).Clone());
 }
 
 drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwFormat::getSdrAllFillAttributesHelper() const
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx
index b23324a914aa..8d8fa399ac9a 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -504,7 +504,7 @@ void SwDoc::SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew
     }
 }
 
-bool SwDoc::GetRowBackground( const SwCursor& rCursor, std::shared_ptr<SvxBrushItem>& rToFill )
+bool SwDoc::GetRowBackground( const SwCursor& rCursor, std::unique_ptr<SvxBrushItem>& rToFill )
 {
     bool bRet = false;
     SwTableNode* pTableNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
@@ -520,9 +520,9 @@ bool SwDoc::GetRowBackground( const SwCursor& rCursor, std::shared_ptr<SvxBrushI
             bRet = true;
             for ( std::vector<SwTableLine*>::size_type i = 1; i < aRowArr.size(); ++i )
             {
-                std::shared_ptr<SvxBrushItem> aAlternative(aRowArr[i]->GetFrameFormat()->makeBackgroundBrushItem());
+                std::unique_ptr<SvxBrushItem> aAlternative(aRowArr[i]->GetFrameFormat()->makeBackgroundBrushItem());
 
-                if ( rToFill != aAlternative && rToFill && aAlternative && *rToFill != *aAlternative )
+                if ( rToFill && aAlternative && *rToFill != *aAlternative )
                 {
                     bRet = false;
                     break;
@@ -1190,7 +1190,7 @@ void SwDoc::SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew )
     }
 }
 
-bool SwDoc::GetBoxAttr( const SwCursor& rCursor, std::shared_ptr<SfxPoolItem>& rToFill )
+bool SwDoc::GetBoxAttr( const SwCursor& rCursor, std::unique_ptr<SfxPoolItem>& rToFill )
 {
     bool bRet = false;
     SwTableNode* pTableNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
@@ -1206,14 +1206,14 @@ bool SwDoc::GetBoxAttr( const SwCursor& rCursor, std::shared_ptr<SfxPoolItem>& r
             {
                 case RES_BACKGROUND:
                 {
-                    std::shared_ptr<SvxBrushItem> aBack =
+                    std::unique_ptr<SvxBrushItem> xBack =
                         aBoxes[i]->GetFrameFormat()->makeBackgroundBrushItem();
                     if( !bOneFound )
                     {
-                        rToFill.reset(aBack->Clone());
+                        rToFill = std::move(xBack);
                         bOneFound = true;
                     }
-                    else if( rToFill != aBack )
+                    else if( *rToFill != *xBack )
                         bRet = false;
                 }
                 break;
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index fcadbac2717a..242c148f89b0 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -745,7 +745,7 @@ void SwFEShell::SetRowBackground( const SvxBrushItem &rNew )
     EndAllActionAndCall();
 }
 
-bool SwFEShell::GetRowBackground( std::shared_ptr<SvxBrushItem>& rToFill ) const
+bool SwFEShell::GetRowBackground( std::unique_ptr<SvxBrushItem>& rToFill ) const
 {
     return SwDoc::GetRowBackground( *getShellCursor( false ), rToFill );
 }
@@ -781,11 +781,11 @@ void SwFEShell::SetBoxBackground( const SvxBrushItem &rNew )
     EndAllActionAndCall();
 }
 
-bool SwFEShell::GetBoxBackground( std::shared_ptr<SvxBrushItem>& rToFill ) const
+bool SwFEShell::GetBoxBackground( std::unique_ptr<SvxBrushItem>& rToFill ) const
 {
-    std::shared_ptr<SfxPoolItem> aTemp(rToFill);
+    std::unique_ptr<SfxPoolItem> aTemp = std::move(rToFill);
     bool bRetval(SwDoc::GetBoxAttr(*getShellCursor( false ), aTemp));
-    rToFill = std::static_pointer_cast<SvxBrushItem>(aTemp);
+    rToFill.reset(static_cast<SvxBrushItem*>(aTemp.release()));
     return bRetval;
 }
 
@@ -797,11 +797,11 @@ void SwFEShell::SetBoxDirection( const SvxFrameDirectionItem& rNew )
     EndAllActionAndCall();
 }
 
-bool SwFEShell::GetBoxDirection( std::shared_ptr<SvxFrameDirectionItem>& rToFill ) const
+bool SwFEShell::GetBoxDirection( std::unique_ptr<SvxFrameDirectionItem>& rToFill ) const
 {
-    std::shared_ptr<SfxPoolItem> aTemp(rToFill);
+    std::unique_ptr<SfxPoolItem> aTemp = std::move(rToFill);
     bool bRetval(SwDoc::GetBoxAttr(*getShellCursor( false ), aTemp));
-    rToFill = std::static_pointer_cast<SvxFrameDirectionItem>(aTemp);
+    rToFill.reset(static_cast<SvxFrameDirectionItem*>(aTemp.release()));
     return bRetval;
 }
 
@@ -831,7 +831,7 @@ void SwFEShell::SetTabBackground( const SvxBrushItem &rNew )
     GetDoc()->getIDocumentState().SetModified();
 }
 
-void SwFEShell::GetTabBackground( std::shared_ptr<SvxBrushItem>& rToFill ) const
+void SwFEShell::GetTabBackground( std::unique_ptr<SvxBrushItem>& rToFill ) const
 {
     SwFrame *pFrame = GetCurrFrame();
     if( pFrame && pFrame->IsInTab() )
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index d4e24094dd1f..f6475124cddf 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -3188,7 +3188,7 @@ bool SwFlyFrameFormat::IsBackgroundTransparent() const
     // NOTE: If background color is "no fill"/"auto fill" (COL_TRANSPARENT)
     //     and there is no background graphic, it "inherites" the background
     //     from its anchor.
-    std::shared_ptr<SvxBrushItem> aBackground(makeBackgroundBrushItem());
+    std::unique_ptr<SvxBrushItem> aBackground(makeBackgroundBrushItem());
     if ( aBackground &&
          (aBackground->GetColor().GetTransparency() != 0) &&
          (aBackground->GetColor() != COL_TRANSPARENT)
@@ -3228,7 +3228,7 @@ bool SwFlyFrameFormat::IsBackgroundBrushInherited() const
     }
     else
     {
-        std::shared_ptr<SvxBrushItem> aBackground(makeBackgroundBrushItem());
+        std::unique_ptr<SvxBrushItem> aBackground(makeBackgroundBrushItem());
         if ( aBackground &&
              (aBackground->GetColor() == COL_TRANSPARENT) &&
              !(aBackground->GetGraphicObject()) )
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index 15719ce4b9fc..4c41de8ed325 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -358,7 +358,7 @@ bool SwFlyFreeFrame::supportsAutoContour() const
     }
     else
     {
-        const std::shared_ptr<SvxBrushItem> aBack(GetFormat()->makeBackgroundBrushItem());
+        const std::unique_ptr<SvxBrushItem> aBack(GetFormat()->makeBackgroundBrushItem());
 
         if(aBack && aBack->isUsed())
         {
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index d5ec987896b1..8c9872b7743f 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3980,7 +3980,7 @@ void SwFlyFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect const&
             }
             else
             {
-                std::shared_ptr<SvxBrushItem> aBack = GetFormat()->makeBackgroundBrushItem();
+                std::unique_ptr<SvxBrushItem> aBack = GetFormat()->makeBackgroundBrushItem();
                 //     to determine, if background has to be painted, by checking, if
                 //     background color is not COL_TRANSPARENT ("no fill"/"auto fill")
                 //     or a background graphic exists.
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 9adfcbef6988..ef59cf08d82e 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -3200,7 +3200,7 @@ SwTwips SwTabFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
         InvalidatePage( pPage );
         SetComplete();
 
-        std::shared_ptr<SvxBrushItem> aBack = GetFormat()->makeBackgroundBrushItem();
+        std::unique_ptr<SvxBrushItem> aBack = GetFormat()->makeBackgroundBrushItem();
         const SvxGraphicPosition ePos = aBack ? aBack->GetGraphicPos() : GPOS_NONE;
         if ( GPOS_NONE != ePos && GPOS_TILED != ePos )
             SetCompletePaint();
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index d143ec52d868..57db1547a1c6 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -1686,7 +1686,7 @@ SwTwips SwFrame::AdjustNeighbourhood( SwTwips nDiff, bool bTst )
                 GetNext()->InvalidatePos_();
 
             //Trigger a repaint if necessary.
-            std::shared_ptr<SvxBrushItem> aBack(pUp->GetFormat()->makeBackgroundBrushItem());
+            std::unique_ptr<SvxBrushItem> aBack(pUp->GetFormat()->makeBackgroundBrushItem());
             const SvxGraphicPosition ePos = aBack ? aBack->GetGraphicPos() : GPOS_NONE;
             if ( ePos != GPOS_NONE && ePos != GPOS_TILED )
                 pViewShell->InvalidateWindows( pUp->getFrameArea() );
@@ -2723,7 +2723,7 @@ SwTwips SwLayoutFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
             if( IsCellFrame() )
                 InvaPercentLowers( nReal );
 
-            std::shared_ptr<SvxBrushItem> aBack(GetFormat()->makeBackgroundBrushItem());
+            std::unique_ptr<SvxBrushItem> aBack(GetFormat()->makeBackgroundBrushItem());
             const SvxGraphicPosition ePos = aBack ? aBack->GetGraphicPos() : GPOS_NONE;
             if ( GPOS_NONE != ePos && GPOS_TILED != ePos )
                 SetCompletePaint();
@@ -2909,7 +2909,7 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo )
             const SwFrameFormat* pFormat = GetFormat();
             if (pFormat)
             {
-                std::shared_ptr<SvxBrushItem> aBack(pFormat->makeBackgroundBrushItem());
+                std::unique_ptr<SvxBrushItem> aBack(pFormat->makeBackgroundBrushItem());
                 const SvxGraphicPosition ePos = aBack ? aBack->GetGraphicPos() : GPOS_NONE;
                 if ( GPOS_NONE == ePos || GPOS_TILED == ePos )
                     bCompletePaint = false;
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 5ffb98a44c61..760418f4be6a 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1746,8 +1746,8 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
             if(RES_BACKGROUND == pEntry->nWID)
             {
                 const SwAttrSet& rSet = pFormat->GetAttrSet();
-                const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND, true, pDoc->IsInXMLImport()));
-                std::shared_ptr<SvxBrushItem> aChangedBrushItem(aOriginalBrushItem->Clone());
+                const std::unique_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND, true, pDoc->IsInXMLImport()));
+                std::unique_ptr<SvxBrushItem> aChangedBrushItem(aOriginalBrushItem->Clone());
 
                 aChangedBrushItem->PutValue(aValue, nMemberId);
 
@@ -2238,7 +2238,7 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
 
             if(RES_BACKGROUND == pEntry->nWID)
             {
-                const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
+                const std::unique_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
 
                 if(!aOriginalBrushItem->QueryValue(aAny, nMemberId))
                 {
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
index d10a19527b96..3fef41218cad 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -447,7 +447,7 @@ void SwXParagraph::Impl::GetSinglePropertyValue_Impl(
     {
         case RES_BACKGROUND:
         {
-            const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
+            const std::unique_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
 
             if(!aOriginalBrushItem->QueryValue(rAny, rEntry.nMemberId))
             {
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 446e07638ab8..16c089e78d0b 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1682,8 +1682,8 @@ template<>
 void SwXStyle::SetPropertyValue<sal_uInt16(RES_BACKGROUND)>(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
 {
     SfxItemSet& rStyleSet = o_rStyleBase.GetItemSet();
-    const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet, RES_BACKGROUND, true, m_pDoc->IsInXMLImport()));
-    std::shared_ptr<SvxBrushItem> aChangedBrushItem(aOriginalBrushItem->Clone());
+    const std::unique_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet, RES_BACKGROUND, true, m_pDoc->IsInXMLImport()));
+    std::unique_ptr<SvxBrushItem> aChangedBrushItem(aOriginalBrushItem->Clone());
 
     uno::Any aValue(rValue);
     const auto nMemberId(lcl_TranslateMetric(rEntry, m_pDoc, aValue));
@@ -2317,7 +2317,7 @@ uno::Any SwXStyle::GetStyleProperty<sal_uInt16(RES_BACKGROUND)>(const SfxItemPro
 {
     PrepareStyleBase(rBase);
     const SfxItemSet& rSet = rBase.GetItemSet();
-    const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
+    const std::unique_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
     uno::Any aResult;
     if(!aOriginalBrushItem->QueryValue(aResult, rEntry.nMemberId))
         SAL_WARN("sw.uno", "error getting attribute from RES_BACKGROUND.");
@@ -3675,8 +3675,8 @@ uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle(
                 }
                 case RES_BACKGROUND:
                 {
-                    const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, true, m_pDocShell->GetDoc()->IsInXMLImport()));
-                    std::shared_ptr<SvxBrushItem> aChangedBrushItem(aOriginalBrushItem->Clone());
+                    const std::unique_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, true, m_pDocShell->GetDoc()->IsInXMLImport()));
+                    std::unique_ptr<SvxBrushItem> aChangedBrushItem(aOriginalBrushItem->Clone());
 
                     aChangedBrushItem->PutValue(aValue, nMemberId);
 
@@ -4003,7 +4003,7 @@ uno::Sequence< uno::Any > SwXAutoStyle::GetPropertyValues_Impl(
             {
                 case RES_BACKGROUND:
                 {
-                    const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(*mpSet, RES_BACKGROUND));
+                    const std::unique_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(*mpSet, RES_BACKGROUND));
 
                     if(!aOriginalBrushItem->QueryValue(aTarget, pEntry->nMemberId))
                     {
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 7945d1cfc585..762dcf73dd1d 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -1666,7 +1666,7 @@ void SwXTextTableCursor::setPropertyValue(const OUString& rPropertyName, const u
     {
         case FN_UNO_TABLE_CELL_BACKGROUND:
         {
-            std::shared_ptr<SfxPoolItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
+            std::unique_ptr<SfxPoolItem> aBrush(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
             SwDoc::GetBoxAttr(rUnoCursor, aBrush);
             aBrush->PutValue(aValue, pEntry->nMemberId);
             pDoc->SetBoxAttr(rUnoCursor, *aBrush);
@@ -1719,7 +1719,7 @@ uno::Any SwXTextTableCursor::getPropertyValue(const OUString& rPropertyName)
     {
         case FN_UNO_TABLE_CELL_BACKGROUND:
         {
-            std::shared_ptr<SfxPoolItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
+            std::unique_ptr<SfxPoolItem> aBrush(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
             if (SwDoc::GetBoxAttr(rUnoCursor, aBrush))
                 aBrush->QueryValue(aResult, pEntry->nMemberId);
         }
@@ -1778,9 +1778,8 @@ public:
 
     void SetProperty(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any& aVal);
     bool GetProperty(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any*& rpAny);
-    template<typename Tpoolitem>
-    inline void AddItemToSet(SfxItemSet& rSet, std::function<Tpoolitem()> aItemFactory, sal_uInt16 nWhich, std::initializer_list<sal_uInt16> vMember, bool bAddTwips = false);
-
+    void AddItemToSet(SfxItemSet& rSet, std::function<std::unique_ptr<SfxPoolItem>()> aItemFactory,
+                        sal_uInt16 nWhich, std::initializer_list<sal_uInt16> vMember, bool bAddTwips = false);
     void ApplyTableAttr(const SwTable& rTable, SwDoc& rDoc);
 };
 
@@ -1795,8 +1794,9 @@ void SwTableProperties_Impl::SetProperty(sal_uInt16 nWhichId, sal_uInt16 nMember
 bool SwTableProperties_Impl::GetProperty(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any*& rpAny )
     { return aAnyMap.FillValue( nWhichId, nMemberId, rpAny ); }
 
-template<typename Tpoolitem>
-void SwTableProperties_Impl::AddItemToSet(SfxItemSet& rSet, std::function<Tpoolitem()> aItemFactory, sal_uInt16 nWhich, std::initializer_list<sal_uInt16> vMember, bool bAddTwips)
+void SwTableProperties_Impl::AddItemToSet(SfxItemSet& rSet,
+        std::function<std::unique_ptr<SfxPoolItem>()> aItemFactory,
+        sal_uInt16 nWhich, std::initializer_list<sal_uInt16> vMember, bool bAddTwips)
 {
     std::vector< std::pair<sal_uInt16, const uno::Any* > > vMemberAndAny;
     for(sal_uInt16 nMember : vMember)
@@ -1808,7 +1808,7 @@ void SwTableProperties_Impl::AddItemToSet(SfxItemSet& rSet, std::function<Tpooli
     }
     if(!vMemberAndAny.empty())
     {
-        Tpoolitem aItem = aItemFactory();
+        std::unique_ptr<SfxPoolItem> aItem(aItemFactory());
         for(const auto& aMemberAndAny : vMemberAndAny)
             aItem->PutValue(*aMemberAndAny.second, aMemberAndAny.first | (bAddTwips ? CONVERT_TWIPS : 0) );
         rSet.Put(*aItem);
@@ -1833,7 +1833,7 @@ void SwTableProperties_Impl::ApplyTableAttr(const SwTable& rTable, SwDoc& rDoc)
         const_cast<SwTable&>(rTable).SetRowsToRepeat( bVal ? 1 : 0 );  // TODO: MULTIHEADER
     }
 
-    AddItemToSet<std::shared_ptr<SvxBrushItem>>(aSet, [&rFrameFormat]() { return rFrameFormat.makeBackgroundBrushItem(); }, RES_BACKGROUND, {
+    AddItemToSet(aSet, [&rFrameFormat]() { return rFrameFormat.makeBackgroundBrushItem(); }, RES_BACKGROUND, {
         MID_BACK_COLOR,
         MID_GRAPHIC_TRANSPARENT,
         MID_GRAPHIC_POSITION,
@@ -1865,10 +1865,10 @@ void SwTableProperties_Impl::ApplyTableAttr(const SwTable& rTable, SwDoc& rDoc)
     }
 
     if(bPutBreak)
-        AddItemToSet<std::shared_ptr<SvxFormatBreakItem>>(aSet, [&rFrameFormat]() { return std::shared_ptr<SvxFormatBreakItem>(rFrameFormat.GetBreak().Clone()); }, RES_BREAK, {0});
-    AddItemToSet<std::shared_ptr<SvxShadowItem>>(aSet, [&rFrameFormat]() { return std::shared_ptr<SvxShadowItem>(rFrameFormat.GetShadow().Clone()); }, RES_SHADOW, {0}, true);
-    AddItemToSet<std::shared_ptr<SvxFormatKeepItem>>(aSet, [&rFrameFormat]() { return std::shared_ptr<SvxFormatKeepItem>(rFrameFormat.GetKeep().Clone()); }, RES_KEEP, {0});
-    AddItemToSet<std::shared_ptr<SwFormatHoriOrient>>(aSet, [&rFrameFormat]() { return std::shared_ptr<SwFormatHoriOrient>(rFrameFormat.GetHoriOrient().Clone()); }, RES_HORI_ORIENT, {MID_HORIORIENT_ORIENT}, true);
+        AddItemToSet(aSet, [&rFrameFormat]() { return std::unique_ptr<SfxPoolItem>(rFrameFormat.GetBreak().Clone()); }, RES_BREAK, {0});
+    AddItemToSet(aSet, [&rFrameFormat]() { return std::unique_ptr<SfxPoolItem>(rFrameFormat.GetShadow().Clone()); }, RES_SHADOW, {0}, true);
+    AddItemToSet(aSet, [&rFrameFormat]() { return std::unique_ptr<SfxPoolItem>(rFrameFormat.GetKeep().Clone()); }, RES_KEEP, {0});
+    AddItemToSet(aSet, [&rFrameFormat]() { return std::unique_ptr<SfxPoolItem>(rFrameFormat.GetHoriOrient().Clone()); }, RES_HORI_ORIENT, {MID_HORIORIENT_ORIENT}, true);
 
     const uno::Any* pSzRel(nullptr);
     GetProperty(FN_TABLE_IS_RELATIVE_WIDTH, 0xff, pSzRel);
@@ -1895,10 +1895,10 @@ void SwTableProperties_Impl::ApplyTableAttr(const SwTable& rTable, SwDoc& rDoc)
             aSz.SetWidth(MINLAY);
         aSet.Put(aSz);
     }
-    AddItemToSet<std::shared_ptr<SvxLRSpaceItem>>(aSet, [&rFrameFormat]() { return std::shared_ptr<SvxLRSpaceItem>(rFrameFormat.GetLRSpace().Clone()); }, RES_LR_SPACE, {
+    AddItemToSet(aSet, [&rFrameFormat]() { return std::unique_ptr<SfxPoolItem>(rFrameFormat.GetLRSpace().Clone()); }, RES_LR_SPACE, {
         MID_L_MARGIN|CONVERT_TWIPS,
         MID_R_MARGIN|CONVERT_TWIPS });
-    AddItemToSet<std::shared_ptr<SvxULSpaceItem>>(aSet, [&rFrameFormat]() { return std::shared_ptr<SvxULSpaceItem>(rFrameFormat.GetULSpace().Clone()); }, RES_UL_SPACE, {
+    AddItemToSet(aSet, [&rFrameFormat]() { return std::unique_ptr<SfxPoolItem>(rFrameFormat.GetULSpace().Clone()); }, RES_UL_SPACE, {
         MID_UP_MARGIN|CONVERT_TWIPS,
         MID_LO_MARGIN|CONVERT_TWIPS });
     const::uno::Any* pSplit(nullptr);
@@ -3393,7 +3393,7 @@ SwXCellRange::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV
         {
             case FN_UNO_TABLE_CELL_BACKGROUND:
             {
-                std::shared_ptr<SfxPoolItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
+                std::unique_ptr<SfxPoolItem> aBrush(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
                 SwDoc::GetBoxAttr(*m_pImpl->m_pTableCursor, aBrush);
                 aBrush->PutValue(aValue, pEntry->nMemberId);
                 pDoc->SetBoxAttr(*m_pImpl->m_pTableCursor, *aBrush);
@@ -3503,7 +3503,7 @@ uno::Any SAL_CALL SwXCellRange::getPropertyValue(const OUString& rPropertyName)
         {
             case FN_UNO_TABLE_CELL_BACKGROUND:
             {
-                std::shared_ptr<SfxPoolItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
+                std::unique_ptr<SfxPoolItem> aBrush(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
                 if (SwDoc::GetBoxAttr(*m_pImpl->m_pTableCursor, aBrush))
                     aBrush->QueryValue(aRet, pEntry->nMemberId);
 
@@ -3542,8 +3542,8 @@ uno::Any SAL_CALL SwXCellRange::getPropertyValue(const OUString& rPropertyName)
             break;
             case RES_VERT_ORIENT:
             {
-                std::shared_ptr<SfxPoolItem> aVertOrient(
-                    std::make_shared<SwFormatVertOrient>(RES_VERT_ORIENT));
+                std::unique_ptr<SfxPoolItem> aVertOrient(
+                    std::make_unique<SwFormatVertOrient>(RES_VERT_ORIENT));
                 if (SwDoc::GetBoxAttr(*m_pImpl->m_pTableCursor, aVertOrient))
                 {
                     aVertOrient->QueryValue( aRet, pEntry->nMemberId );
diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx
index c90c4e73307a..d314b2caa7dd 100644
--- a/sw/source/filter/html/htmlcss1.cxx
+++ b/sw/source/filter/html/htmlcss1.cxx
@@ -545,7 +545,7 @@ void SwCSS1Parser::SetPageDescAttrs( const SwPageDesc *pPageDesc,
         ChgPageDesc( pPageDesc, aNewPageDesc );
 }
 
-std::shared_ptr<SvxBrushItem> SwCSS1Parser::makePageDescBackground() const
+std::unique_ptr<SvxBrushItem> SwCSS1Parser::makePageDescBackground() const
 {
     return m_pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool( RES_POOLPAGE_HTML, false )
         ->GetMaster().makeBackgroundBrushItem();
diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx
index 580a07363439..2fb921c5ef2c 100644
--- a/sw/source/filter/html/htmlflywriter.cxx
+++ b/sw/source/filter/html/htmlflywriter.cxx
@@ -257,7 +257,7 @@ sal_uInt16 SwHTMLWriter::GuessFrameType( const SwFrameFormat& rFrameFormat,
                 }
                 if( bEmpty )
                 {
-                    std::shared_ptr<SvxBrushItem> aBrush = rFrameFormat.makeBackgroundBrushItem();
+                    std::unique_ptr<SvxBrushItem> aBrush = rFrameFormat.makeBackgroundBrushItem();
                     /// background is not empty, if it has a background graphic
                     /// or its background color is not "no fill"/"auto fill".
                     if( aBrush &&
diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx
index ef59eb27d254..628ef2704630 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -1004,7 +1004,7 @@ void SwHTMLParser::InsertBodyOptions()
 
     // Prepare the items for the page style (background, frame)
     // If BrushItem already set values must remain!
-    std::shared_ptr<SvxBrushItem> aBrushItem( m_pCSS1Parser->makePageDescBackground() );
+    std::unique_ptr<SvxBrushItem> aBrushItem( m_pCSS1Parser->makePageDescBackground() );
     bool bSetBrush = false;
 
     if( bBGColor && !m_pCSS1Parser->IsBodyBGColorSet() )
diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx
index 1bb526a2111b..f7d5951ae585 100644
--- a/sw/source/filter/html/htmltabw.cxx
+++ b/sw/source/filter/html/htmltabw.cxx
@@ -138,7 +138,7 @@ bool SwHTMLWrtTable::HasTabBackground( const SwTableBox& rBox,
     bool bRet = false;
     if( rBox.GetSttNd() )
     {
-        std::shared_ptr<SvxBrushItem> aBrushItem =
+        std::unique_ptr<SvxBrushItem> aBrushItem =
             rBox.GetFrameFormat()->makeBackgroundBrushItem();
 
         /// The table box has a background, if its background color is not "no fill"/
@@ -169,7 +169,7 @@ bool SwHTMLWrtTable::HasTabBackground( const SwTableLine& rLine,
     OSL_ENSURE( bTop || bBottom || bLeft || bRight,
             "HasTabBackground: cannot be called" );
 
-    std::shared_ptr<SvxBrushItem> aBrushItem = rLine.GetFrameFormat()->makeBackgroundBrushItem();
+    std::unique_ptr<SvxBrushItem> aBrushItem = rLine.GetFrameFormat()->makeBackgroundBrushItem();
     /// The table line has a background, if its background color is not "no fill"/
     /// "auto fill" or it has a background graphic.
     bool bRet = aBrushItem && (aBrushItem->GetColor() != COL_TRANSPARENT ||
diff --git a/sw/source/filter/html/swcss1.hxx b/sw/source/filter/html/swcss1.hxx
index 548a566a9f4d..b9f127c1ec04 100644
--- a/sw/source/filter/html/swcss1.hxx
+++ b/sw/source/filter/html/swcss1.hxx
@@ -151,7 +151,7 @@ public:
     void SetBodyLinkSet() { m_bBodyLinkSet = true; }
     void SetBodyVLinkSet() { m_bBodyVLinkSet = true; }
 
-    std::shared_ptr<SvxBrushItem> makePageDescBackground() const;
+    std::unique_ptr<SvxBrushItem> makePageDescBackground() const;
 
     inline void SetTHTagStyles();
     inline void SetTDTagStyles();
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index 744da9ec6257..f5c287644b39 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -1083,7 +1083,7 @@ const SwPageDesc *SwHTMLWriter::MakeHeader( sal_uInt16 &rHeaderAttrs )
         const SfxItemSet& rItemSet = pPageDesc->GetMaster().GetAttrSet();
 
         // fdo#86857 page styles now contain the XATTR_*, not RES_BACKGROUND
-        std::shared_ptr<SvxBrushItem> const aBrushItem(getSvxBrushItemFromSourceSet(rItemSet, RES_BACKGROUND));
+        std::unique_ptr<SvxBrushItem> const aBrushItem(getSvxBrushItemFromSourceSet(rItemSet, RES_BACKGROUND));
         OutBackground(aBrushItem.get(), true);
 
         m_nDirection = GetHTMLDirection( rItemSet );
diff --git a/sw/source/filter/writer/wrt_fn.cxx b/sw/source/filter/writer/wrt_fn.cxx
index 800be2431cf2..ded9420df294 100644
--- a/sw/source/filter/writer/wrt_fn.cxx
+++ b/sw/source/filter/writer/wrt_fn.cxx
@@ -112,7 +112,7 @@ Writer& Out_SfxItemSet( const SwAttrFnTab pTab, Writer& rWrt,
         // existing mechanisms.
         // This is the right place in the future if the adapted fill attributes
         // may be handled more directly in HTML export to handle them.
-        const std::shared_ptr<SvxBrushItem> aSvxBrushItem(getSvxBrushItemFromSourceSet(*pSet, RES_BACKGROUND, bDeep));
+        const std::unique_ptr<SvxBrushItem> aSvxBrushItem(getSvxBrushItemFromSourceSet(*pSet, RES_BACKGROUND, bDeep));
 
         if( nullptr != ( pOut = pTab[RES_BACKGROUND - RES_CHRATR_BEGIN] ))
         {
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index d291a9a63f15..9966e0899edb 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -2033,7 +2033,7 @@ sal_Int32 SwBasicEscherEx::WriteFlyFrameAttr(const SwFrameFormat& rFormat,
     // and neither should the commonly seen backgrounds anchored in headers.
     if (bIsInHeader || bIsThrough)
     {
-        std::shared_ptr<SvxBrushItem> aBrush(rFormat.makeBackgroundBrushItem());
+        std::unique_ptr<SvxBrushItem> aBrush(rFormat.makeBackgroundBrushItem());
 
         if(aBrush)
         {
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 9be12a69ef1e..51475ef1490a 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -345,7 +345,7 @@ void MSWordExportBase::OutputItemSet( const SfxItemSet& rSet, bool bPapFormat, b
             if (pXFillStyleItem && pXFillStyleItem->GetValue() == drawing::FillStyle_SOLID && !rSet.HasItem(RES_BACKGROUND))
             {
                 // Construct an SvxBrushItem, as expected by the exporters.
-                std::shared_ptr<SvxBrushItem> aBrush(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
+                std::unique_ptr<SvxBrushItem> aBrush(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
                 AttrOutput().OutputItem(*aBrush);
             }
         }
@@ -889,7 +889,7 @@ void MSWordExportBase::OutputFormat( const SwFormat& rFormat, bool bPapFormat, b
                     case drawing::FillStyle_SOLID:
                     {
                         // Construct an SvxBrushItem, as expected by the exporters.
-                        std::shared_ptr<SvxBrushItem> aBrush(getSvxBrushItemFromSourceSet(rFrameFormat.GetAttrSet(), RES_BACKGROUND));
+                        std::unique_ptr<SvxBrushItem> aBrush(getSvxBrushItemFromSourceSet(rFrameFormat.GetAttrSet(), RES_BACKGROUND));
                         aSet.Put(*aBrush);
                         break;
                     }
diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx
index 1e7d44c98360..0d86feff4bf3 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -142,7 +142,7 @@ class SectRepr
 private:
     SwSectionData           m_SectionData;
     SwFormatCol                m_Col;
-    std::shared_ptr<SvxBrushItem>            m_Brush;
+    std::unique_ptr<SvxBrushItem>            m_Brush;
     SwFormatFootnoteAtTextEnd        m_FootnoteNtAtEnd;
     SwFormatEndAtTextEnd        m_EndNtAtEnd;
     SwFormatNoBalancedColumns  m_Balance;
@@ -160,7 +160,7 @@ public:
 
     SwSectionData &     GetSectionData()        { return m_SectionData; }
     SwFormatCol&               GetCol()            { return m_Col; }
-    std::shared_ptr<SvxBrushItem>&           GetBackground()     { return m_Brush; }
+    std::unique_ptr<SvxBrushItem>&   GetBackground()     { return m_Brush; }
     SwFormatFootnoteAtTextEnd&       GetFootnoteNtAtEnd()     { return m_FootnoteNtAtEnd; }
     SwFormatEndAtTextEnd&       GetEndNtAtEnd()     { return m_EndNtAtEnd; }
     SwFormatNoBalancedColumns& GetBalance()        { return m_Balance; }
@@ -187,7 +187,7 @@ public:
 
 SectRepr::SectRepr( size_t nPos, SwSection& rSect )
     : m_SectionData( rSect )
-    , m_Brush(std::make_shared<SvxBrushItem>(RES_BACKGROUND))
+    , m_Brush(std::make_unique<SvxBrushItem>(RES_BACKGROUND))
     , m_FrameDirItem(std::make_shared<SvxFrameDirectionItem>(SvxFrameDirection::Environment, RES_FRAMEDIR))
     , m_LRSpaceItem(std::make_shared<SvxLRSpaceItem>(RES_LR_SPACE))
     , m_nArrPos(nPos)
@@ -775,8 +775,8 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OkHdl, weld::Button&, void)
                 if( pFormat->GetCol() != pRepr->GetCol() )
                     pSet->Put( pRepr->GetCol() );
 
-                std::shared_ptr<SvxBrushItem> aBrush(pFormat->makeBackgroundBrushItem(false));
-                if( aBrush != pRepr->GetBackground() || (aBrush && pRepr->GetBackground() && *aBrush != *pRepr->GetBackground()))
+                std::unique_ptr<SvxBrushItem> aBrush(pFormat->makeBackgroundBrushItem(false));
+                if( aBrush && pRepr->GetBackground() && *aBrush != *pRepr->GetBackground() )
                     pSet->Put( *pRepr->GetBackground() );
 
                 if( pFormat->GetFootnoteAtTextEnd(false) != pRepr->GetFootnoteNtAtEnd() )
diff --git a/sw/source/uibase/docvw/romenu.cxx b/sw/source/uibase/docvw/romenu.cxx
index 8d13400824c0..75aa8847d3d9 100644
--- a/sw/source/uibase/docvw/romenu.cxx
+++ b/sw/source/uibase/docvw/romenu.cxx
@@ -100,7 +100,7 @@ SwReadOnlyPopup::SwReadOnlyPopup(const Point &rDPos, SwView &rV)
     , m_nReadonlyFullscreen(m_xMenu->GetItemId("fullscreen"))
     , m_nReadonlyCopy(m_xMenu->GetItemId("copy"))
     , m_rView(rV)
-    , m_aBrushItem(std::make_shared<SvxBrushItem>(RES_BACKGROUND))
+    , m_xBrushItem(std::make_unique<SvxBrushItem>(RES_BACKGROUND))
 {
     m_bGrfToGalleryAsLnk = SW_MOD()->GetModuleConfig()->IsGrfToGalleryAsLnk();
     SwWrtShell &rSh = m_rView.GetWrtShell();
@@ -149,14 +149,14 @@ SwReadOnlyPopup::SwReadOnlyPopup(const Point &rDPos, SwView &rV)
     SfxViewFrame * pVFrame = rV.GetViewFrame();
     SfxDispatcher &rDis = *pVFrame->GetDispatcher();
     const SwPageDesc &rDesc = rSh.GetPageDesc( rSh.GetCurPageDesc() );
-    m_aBrushItem = rDesc.GetMaster().makeBackgroundBrushItem();
+    m_xBrushItem = rDesc.GetMaster().makeBackgroundBrushItem();
     bool bEnableBackGallery = false,
          bEnableBack = false;
 
-    if ( m_aBrushItem && GPOS_NONE != m_aBrushItem->GetGraphicPos() )
+    if ( m_xBrushItem && GPOS_NONE != m_xBrushItem->GetGraphicPos() )
     {
         bEnableBack = true;
-        if ( !m_aBrushItem->GetGraphicLink().isEmpty() )
+        if ( !m_xBrushItem->GetGraphicLink().isEmpty() )
         {
             if ( m_aThemeList.empty() )
                 GalleryExplorer::FillThemeList( m_aThemeList );
@@ -234,11 +234,11 @@ void SwReadOnlyPopup::Execute( vcl::Window* pWin, sal_uInt16 nId )
     {
         OUString sTmp;
         sal_uInt16 nSaveId;
-        if (m_aBrushItem && nId >= MN_READONLY_BACKGROUNDTOGALLERY)
+        if (m_xBrushItem && nId >= MN_READONLY_BACKGROUNDTOGALLERY)
         {
             nId -= MN_READONLY_BACKGROUNDTOGALLERY;
             nSaveId = m_nReadonlySaveBackground;
-            sTmp = m_aBrushItem->GetGraphicLink();
+            sTmp = m_xBrushItem->GetGraphicLink();
         }
         else
         {
@@ -325,14 +325,14 @@ OUString SwReadOnlyPopup::SaveGraphic(sal_uInt16 nId)
     // fish out the graphic's name
     if (nId == m_nReadonlySaveBackground)
     {
-        if ( m_aBrushItem && !m_aBrushItem->GetGraphicLink().isEmpty() )
-            m_sGrfName = m_aBrushItem->GetGraphicLink();
-        const Graphic *pGrf = m_aBrushItem ? m_aBrushItem->GetGraphic() : nullptr;
+        if ( m_xBrushItem && !m_xBrushItem->GetGraphicLink().isEmpty() )
+            m_sGrfName = m_xBrushItem->GetGraphicLink();
+        const Graphic *pGrf = m_xBrushItem ? m_xBrushItem->GetGraphic() : nullptr;
         if ( pGrf )
         {
             m_aGraphic = *pGrf;
-            if ( !m_aBrushItem->GetGraphicLink().isEmpty() )
-                m_sGrfName = m_aBrushItem->GetGraphicLink();
+            if ( !m_xBrushItem->GetGraphicLink().isEmpty() )
+                m_sGrfName = m_xBrushItem->GetGraphicLink();
         }
         else
             return OUString();
diff --git a/sw/source/uibase/docvw/romenu.hxx b/sw/source/uibase/docvw/romenu.hxx
index 7c6c2c0fe8b6..7d2e82994e63 100644
--- a/sw/source/uibase/docvw/romenu.hxx
+++ b/sw/source/uibase/docvw/romenu.hxx
@@ -56,8 +56,8 @@ class SwReadOnlyPopup
     sal_uInt16 m_nReadonlyFullscreen;
     sal_uInt16 m_nReadonlyCopy;
 
-    SwView &m_rView;
-    std::shared_ptr<SvxBrushItem> m_aBrushItem;
+    SwView &    m_rView;
+    std::unique_ptr<SvxBrushItem> m_xBrushItem;
                 Graphic m_aGraphic;
     OUString    m_sURL,
                 m_sTargetFrameName;
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index 2cdd1e3a44cd..fd1dfaf5fb0d 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -2259,7 +2259,7 @@ void SwBaseShell::GetBckColState(SfxItemSet &rSet)
     SfxWhichIter aIter(rSet);
     sal_uInt16 nWhich(aIter.FirstWhich());
     SelectionType nSelType(rSh.GetSelectionType());
-    std::shared_ptr<SvxBrushItem> aBrushItem(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
+    std::unique_ptr<SvxBrushItem> aBrushItem(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
 
     if( nWhich == SID_TABLE_CELL_BACKGROUND_COLOR )
     {
@@ -2323,7 +2323,7 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq)
         return;
     }
 
-    std::shared_ptr<SvxBrushItem> aBrushItem(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
+    std::unique_ptr<SvxBrushItem> aBrushItem(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
 
     if ( nSlot == SID_TABLE_CELL_BACKGROUND_COLOR )
     {
@@ -2614,7 +2614,7 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq)
             if ( rSh.IsTableMode() )
             {
                 // Get background attributes of the table and put it in the set
-                std::shared_ptr<SvxBrushItem> aBrush;
+                std::unique_ptr<SvxBrushItem> aBrush;
                 rSh.GetBoxBackground( aBrush );
                 pDlg.disposeAndReset(pFact->CreateSwBackgroundDialog(pMDI, aSet));
                 aSet.Put( *aBrush );
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx
index c6e1ae74877f..50ec6815ea0b 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -153,7 +153,7 @@ static std::shared_ptr<SwTableRep> lcl_TableParamToItemSet( SfxItemSet& rSet, Sw
 
     const sal_uInt16  nBackgroundDestination = rSh.GetViewOptions()->GetTableDest();
     rSet.Put(SfxUInt16Item(SID_BACKGRND_DESTINATION, nBackgroundDestination ));
-    std::shared_ptr<SvxBrushItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
+    std::unique_ptr<SvxBrushItem> aBrush(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
     if(rSh.GetRowBackground(aBrush))
     {
         aBrush->SetWhich(SID_ATTR_BRUSH_ROW);
@@ -166,7 +166,7 @@ static std::shared_ptr<SwTableRep> lcl_TableParamToItemSet( SfxItemSet& rSet, Sw
     rSet.Put( *aBrush );
 
     // text direction in boxes
-    std::shared_ptr<SvxFrameDirectionItem> aBoxDirection(std::make_shared<SvxFrameDirectionItem>(SvxFrameDirection::Environment, RES_FRAMEDIR));
+    std::unique_ptr<SvxFrameDirectionItem> aBoxDirection(std::make_unique<SvxFrameDirectionItem>(SvxFrameDirection::Environment, RES_FRAMEDIR));
     if(rSh.GetBoxDirection( aBoxDirection ))
     {
         aBoxDirection->SetWhich(FN_TABLE_BOX_TEXTORIENTATION);
@@ -579,7 +579,7 @@ void SwTableShell::Execute(SfxRequest &rReq)
             aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell())));
             rSh.GetTableAttr(aCoreSet);
             // GetTableAttr overwrites the background!
-            std::shared_ptr<SvxBrushItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
+            std::unique_ptr<SvxBrushItem> aBrush(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
             if(rSh.GetBoxBackground(aBrush))
                 aCoreSet.Put( *aBrush );
             else
diff --git a/sw/source/uibase/uiview/formatclipboard.cxx b/sw/source/uibase/uiview/formatclipboard.cxx
index 2e692698f2e0..d60fe21f3fb7 100644
--- a/sw/source/uibase/uiview/formatclipboard.cxx
+++ b/sw/source/uibase/uiview/formatclipboard.cxx
@@ -97,7 +97,7 @@ std::unique_ptr<SfxItemSet> lcl_CreateEmptyItemSet( SelectionType nSelectionType
 
 void lcl_getTableAttributes( SfxItemSet& rSet, SwWrtShell &rSh )
 {
-    std::shared_ptr<SvxBrushItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
+    std::unique_ptr<SvxBrushItem> aBrush(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
     rSh.GetBoxBackground(aBrush);
     rSet.Put( *aBrush );
     if(rSh.GetRowBackground(aBrush))
@@ -115,7 +115,7 @@ void lcl_getTableAttributes( SfxItemSet& rSet, SwWrtShell &rSh )
     rSet.Put(aBoxInfo);
     rSh.GetTabBorders( rSet );
 
-    std::shared_ptr<SvxFrameDirectionItem> aBoxDirection(std::make_shared<SvxFrameDirectionItem>(SvxFrameDirection::Environment, RES_FRAMEDIR));
+    std::unique_ptr<SvxFrameDirectionItem> aBoxDirection(std::make_unique<SvxFrameDirectionItem>(SvxFrameDirection::Environment, RES_FRAMEDIR));
     if(rSh.GetBoxDirection( aBoxDirection ))
     {
         aBoxDirection->SetWhich(FN_TABLE_BOX_TEXTORIENTATION);


More information about the Libreoffice-commits mailing list