diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-23 14:04:16 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-23 19:49:43 +0200 |
commit | d4248915d7db69aa7bf31d9d6189b7375aca70ed (patch) | |
tree | 03e53496dd63b2a9725ede707c78cc02079d1018 /sw/source/ui/dialog | |
parent | 3cbcaa8d36ef889a28d790e18d68b838cfc46bb2 (diff) |
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@collabora.co.uk>
Diffstat (limited to 'sw/source/ui/dialog')
-rw-r--r-- | sw/source/ui/dialog/uiregionsw.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
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() ) |