fold CreateVirtObj()

- 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 <ci@libreoffice.org>
Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
This commit is contained in:
Bjoern Michaelsen 2017-02-28 00:29:12 +01:00 committed by Björn Michaelsen
parent 912b30b361
commit ca1aa69503
2 changed files with 3 additions and 14 deletions

View file

@ -364,8 +364,6 @@ class SwDrawContact final : public SwContact
bool operator() ( const std::unique_ptr<SwDrawVirtObj>& _pDrawVirtObj );
};
/// method for adding/removing 'virtual' drawing object.
SwDrawVirtObj* CreateVirtObj();
void RemoveAllVirtObjs();
void InvalidateObjs_( const bool _bUpdateSortedObjsList = false );

View file

@ -746,22 +746,13 @@ SwFrame* SwDrawContact::GetAnchorFrame(SdrObject *const pDrawObj)
return const_cast<SwFrame *>(const_cast<SwDrawContact const*>(this)->GetAnchorFrame(pDrawObj));
}
/// create a new 'virtual' drawing object.
SwDrawVirtObj* SwDrawContact::CreateVirtObj()
{
maDrawVirtObjs.push_back(std::unique_ptr<SwDrawVirtObj>(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<SwDrawVirtObj>(new SwDrawVirtObj(*GetMaster(), *this)));
maDrawVirtObjs.back()->AddToDrawingPage();
return maDrawVirtObjs.back().get();
}
/// remove 'virtual' drawing objects and destroy them.