diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-11 12:58:07 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-12 12:42:22 +0200 |
commit | e722564d40143fa029fe10d22a625539c795ee04 (patch) | |
tree | 5b4aab88bfa6d35917707d4d8ebe92e78a30c0e5 /svtools/source/uno/treecontrolpeer.cxx | |
parent | 5dd762ddc1829a86e7b4e23076143bc01d6073ad (diff) |
make SvLBoxItem::Clone return a std::unique_ptr
and combine the Create/Clone methods into one
Change-Id: Ia982be6b50135b8d368d84070327689be6b3d890
Reviewed-on: https://gerrit.libreoffice.org/52745
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svtools/source/uno/treecontrolpeer.cxx')
-rw-r--r-- | svtools/source/uno/treecontrolpeer.cxx | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx index 4c068748fab5..b481ebfb7025 100644 --- a/svtools/source/uno/treecontrolpeer.cxx +++ b/svtools/source/uno/treecontrolpeer.cxx @@ -115,8 +115,7 @@ public: void SetGraphicURL( const OUString& rGraphicURL ); virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext, const SvViewDataEntry* pView, const SvTreeListEntry& rEntry) override; - SvLBoxItem* Create() const override; - void Clone( SvLBoxItem* pSource ) override; + std::unique_ptr<SvLBoxItem> Clone( SvLBoxItem const * pSource ) const override; private: OUString maGraphicURL; @@ -1510,20 +1509,13 @@ void UnoTreeListItem::Paint( } -SvLBoxItem* UnoTreeListItem::Create() const +std::unique_ptr<SvLBoxItem> UnoTreeListItem::Clone(SvLBoxItem const * pSource) const { - return new UnoTreeListItem; -} - - -void UnoTreeListItem::Clone( SvLBoxItem* pSource ) -{ - UnoTreeListItem* pSourceItem = dynamic_cast< UnoTreeListItem* >( pSource ); - if( pSourceItem ) - { - maText = pSourceItem->maText; - maImage = pSourceItem->maImage; - } + std::unique_ptr<UnoTreeListItem> pNew(new UnoTreeListItem); + UnoTreeListItem const * pSourceItem = static_cast< UnoTreeListItem const * >( pSource ); + pNew->maText = pSourceItem->maText; + pNew->maImage = pSourceItem->maImage; + return std::unique_ptr<SvLBoxItem>(pNew.release()); } |