summaryrefslogtreecommitdiff
path: root/sw/source/core/layout
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-23 14:04:16 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-23 19:49:43 +0200
commitd4248915d7db69aa7bf31d9d6189b7375aca70ed (patch)
tree03e53496dd63b2a9725ede707c78cc02079d1018 /sw/source/core/layout
parent3cbcaa8d36ef889a28d790e18d68b838cfc46bb2 (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/core/layout')
-rw-r--r--sw/source/core/layout/atrfrm.cxx4
-rw-r--r--sw/source/core/layout/flylay.cxx2
-rw-r--r--sw/source/core/layout/paintfrm.cxx2
-rw-r--r--sw/source/core/layout/tabfrm.cxx2
-rw-r--r--sw/source/core/layout/wsfrm.cxx6
5 files changed, 8 insertions, 8 deletions
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;