From ca1aa6950314dd7332a02a31171920ec45f23187 Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Tue, 28 Feb 2017 00:29:12 +0100 Subject: [PATCH] fold CreateVirtObj() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - only one caller, and throwing around nacked pointers to owned objects should be avoided anyway Change-Id: I2ecc716a844c73e42a0838ac048caf0c20c045a1 Reviewed-on: https://gerrit.libreoffice.org/34705 Tested-by: Jenkins Reviewed-by: Björn Michaelsen --- sw/inc/dcontact.hxx | 2 -- sw/source/core/draw/dcontact.cxx | 15 +++------------ 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/sw/inc/dcontact.hxx b/sw/inc/dcontact.hxx index b440d4dbaf39..468a8667f451 100644 --- a/sw/inc/dcontact.hxx +++ b/sw/inc/dcontact.hxx @@ -364,8 +364,6 @@ class SwDrawContact final : public SwContact bool operator() ( const std::unique_ptr& _pDrawVirtObj ); }; - /// method for adding/removing 'virtual' drawing object. - SwDrawVirtObj* CreateVirtObj(); void RemoveAllVirtObjs(); void InvalidateObjs_( const bool _bUpdateSortedObjsList = false ); diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index e83bfe000122..fe9b058a55a2 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -746,22 +746,13 @@ SwFrame* SwDrawContact::GetAnchorFrame(SdrObject *const pDrawObj) return const_cast(const_cast(this)->GetAnchorFrame(pDrawObj)); } -/// create a new 'virtual' drawing object. -SwDrawVirtObj* SwDrawContact::CreateVirtObj() -{ - maDrawVirtObjs.push_back(std::unique_ptr(new SwDrawVirtObj(*GetMaster(), *this))); - return maDrawVirtObjs.back().get(); -} - /** add a 'virtual' drawing object to drawing page. - * - * Use an already created one, which isn't used, or create a new one. */ SwDrawVirtObj* SwDrawContact::AddVirtObj() { - auto pAddedDrawVirtObj(CreateVirtObj()); - pAddedDrawVirtObj->AddToDrawingPage(); - return pAddedDrawVirtObj; + maDrawVirtObjs.push_back(std::unique_ptr(new SwDrawVirtObj(*GetMaster(), *this))); + maDrawVirtObjs.back()->AddToDrawingPage(); + return maDrawVirtObjs.back().get(); } /// remove 'virtual' drawing objects and destroy them.