summaryrefslogtreecommitdiff
path: root/svtools/source/uno/treecontrolpeer.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'svtools/source/uno/treecontrolpeer.cxx')
-rw-r--r--svtools/source/uno/treecontrolpeer.cxx22
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());
}