diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-30 15:11:33 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-05-02 08:26:04 +0200 |
commit | ecf6e884d50c9d6220a95ef1a785e9643fb1f01e (patch) | |
tree | 68b25edee694af0a0ed78695c60b3c7f66fc07f5 | |
parent | 6702a4c56abc2bcd46df65b6eb5ba61e6f1c8dcb (diff) |
loplugin:useuniqueptr in ThumbnailView
Change-Id: I1851af82e7f1e56a5b309be55da6dc08b6d34ace
Reviewed-on: https://gerrit.libreoffice.org/53704
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/sfx2/thumbnailview.hxx | 5 | ||||
-rw-r--r-- | sfx2/source/control/thumbnailview.cxx | 6 |
2 files changed, 6 insertions, 5 deletions
diff --git a/include/sfx2/thumbnailview.hxx b/include/sfx2/thumbnailview.hxx index 50ea94440b4b..c628d38a2eb1 100644 --- a/include/sfx2/thumbnailview.hxx +++ b/include/sfx2/thumbnailview.hxx @@ -12,8 +12,9 @@ #include <sfx2/dllapi.h> -#include <vector> #include <functional> +#include <memory> +#include <vector> #include <sfx2/thumbnailviewitem.hxx> #include <vcl/ctrl.hxx> @@ -317,7 +318,7 @@ protected: double mfHighlightTransparence; ///< Transparence of the highlight. Link<const ThumbnailViewItem*, void> maItemStateHdl; - ThumbnailItemAttributes* mpItemAttrs; + std::unique_ptr<ThumbnailItemAttributes> mpItemAttrs; std::function<bool (const ThumbnailViewItem*)> maFilterFunc; }; diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx index 6e45a4f7dc93..5cd33e453a58 100644 --- a/sfx2/source/control/thumbnailview.cxx +++ b/sfx2/source/control/thumbnailview.cxx @@ -69,7 +69,7 @@ void ThumbnailView::dispose() xComponent->dispose (); mpScrBar.disposeAndClear(); - delete mpItemAttrs; + mpItemAttrs.reset(); ImplDeleteItems(); Control::dispose(); @@ -354,7 +354,7 @@ void ThumbnailView::CalculateItemPositions (bool bScrollBarUsed) } pItem->setDrawArea(::tools::Rectangle( Point(x,y), Size(mnItemWidth, mnItemHeight) )); - pItem->calculateItemsPosition(mnThumbnailHeight,mnDisplayHeight,mnItemPadding,mpItemAttrs->nMaxTextLength,mpItemAttrs); + pItem->calculateItemsPosition(mnThumbnailHeight,mnDisplayHeight,mnItemPadding,mpItemAttrs->nMaxTextLength,mpItemAttrs.get()); if ( !((nCurCount+1) % mnCols) ) { @@ -851,7 +851,7 @@ void ThumbnailView::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rec if (pItem->isVisible()) { - pItem->Paint(pProcessor.get(), mpItemAttrs); + pItem->Paint(pProcessor.get(), mpItemAttrs.get()); } } |