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/core/frmedt/fetab.cxx | |
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/core/frmedt/fetab.cxx')
-rw-r--r-- | sw/source/core/frmedt/fetab.cxx | 16 |
1 files changed, 8 insertions, 8 deletions
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() ) |