diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-10-17 13:40:38 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-14 10:19:32 +0100 |
commit | 8f54136caa786523fd224f6c98fc8e7c45cd805d (patch) | |
tree | e77e4cba4e281a32e2bee5fd6a10d43ae6c7a360 /vcl/source/window | |
parent | b5344daa0cfc31cf187832261651e5490b19d922 (diff) |
use std::unique_ptr for SalLayout
to make the ownership passing around more obvious
Change-Id: I147ec6d9cfe7566cf3600685e0730ed741c2d90d
Reviewed-on: https://gerrit.libreoffice.org/43454
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/window')
-rw-r--r-- | vcl/source/window/status.cxx | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx index e24a153896cb..11a2480323ff 100644 --- a/vcl/source/window/status.cxx +++ b/vcl/source/window/status.cxx @@ -376,11 +376,9 @@ void StatusBar::ImplDrawItem(vcl::RenderContext& rRenderContext, bool bOffScreen if(!pLayoutCache) { - pLayoutCache = rRenderContext.ImplLayout(pItem->maText, 0, -1); - // update cache - if(pLayoutCache) - pItem->mxLayoutCache.reset(pLayoutCache); + pItem->mxLayoutCache = rRenderContext.ImplLayout(pItem->maText, 0, -1); + pLayoutCache = pItem->mxLayoutCache.get(); } Size aTextSize(rRenderContext.GetTextWidth(pItem->maText,0,-1,nullptr,pLayoutCache), rRenderContext.GetTextHeight()); @@ -1168,11 +1166,11 @@ void StatusBar::SetItemText( sal_uInt16 nItemId, const OUString& rText ) // adjust item width - see also DataChanged() long nFudge = GetTextHeight()/4; - SalLayout* pSalLayout = ImplLayout(pItem->maText,0,-1); - long nWidth = GetTextWidth( pItem->maText,0,-1,nullptr,pSalLayout ) + nFudge; + std::unique_ptr<SalLayout> pSalLayout = ImplLayout(pItem->maText,0,-1); + long nWidth = GetTextWidth( pItem->maText,0,-1,nullptr,pSalLayout.get() ) + nFudge; // update cache - pItem->mxLayoutCache.reset(pSalLayout); + pItem->mxLayoutCache = std::move(pSalLayout); if( (nWidth > pItem->mnWidth + STATUSBAR_OFFSET) || ((nWidth < pItem->mnWidth) && (mnDX - STATUSBAR_OFFSET) < mnItemsWidth )) |