From 722cb06e71539e108f663ca1c2dd6baf7f4adc64 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 15 Oct 2018 13:58:32 +0200 Subject: return by unique_ptr from CreateFieldControl Change-Id: Ic8bf9829c3320aca452fd1a40e9843fdbdbfa219 Reviewed-on: https://gerrit.libreoffice.org/61906 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sw/source/uibase/dochdl/swdtflvr.cxx | 12 ++++++------ sw/source/uibase/uiview/viewdraw.cxx | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'sw') diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 61abefb4ffaa..a67f021e72d4 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -2688,10 +2688,10 @@ bool SwTransferable::PasteDBData( TransferableDataHelper& rData, if (pFmView && pDragPt) { const OXFormsDescriptor &rDesc = OXFormsTransferable::extractDescriptor(rData); - SdrObject* pObj = pFmView->CreateXFormsControl(rDesc); - if(nullptr != pObj) + SdrObjectUniquePtr pObj = pFmView->CreateXFormsControl(rDesc); + if(pObj) { - rSh.SwFEShell::InsertDrawObj( *pObj, *pDragPt ); + rSh.SwFEShell::InsertDrawObj( *(pObj.release()), *pDragPt ); } } } @@ -2745,9 +2745,9 @@ bool SwTransferable::PasteDBData( TransferableDataHelper& rData, FmFormView* pFmView = dynamic_cast( rSh.GetDrawView() ); if (pFmView && bHaveColumnDescriptor && pDragPt) { - SdrObject* pObj = pFmView->CreateFieldControl( OColumnTransferable::extractColumnDescriptor(rData) ); - if ( nullptr != pObj) - rSh.SwFEShell::InsertDrawObj( *pObj, *pDragPt ); + SdrObjectUniquePtr pObj = pFmView->CreateFieldControl( OColumnTransferable::extractColumnDescriptor(rData) ); + if (pObj) + rSh.SwFEShell::InsertDrawObj( *(pObj.release()), *pDragPt ); } } bRet = true; diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx index 8a94bb84f346..974add36a258 100644 --- a/sw/source/uibase/uiview/viewdraw.cxx +++ b/sw/source/uibase/uiview/viewdraw.cxx @@ -115,7 +115,7 @@ void SwView::ExecDraw(SfxRequest& rReq) if( pDescriptorItem ) { svx::ODataAccessDescriptor aDescriptor( pDescriptorItem->GetValue() ); - SdrObject* pObj = pFormView->CreateFieldControl( aDescriptor ); + SdrObjectUniquePtr pObj = pFormView->CreateFieldControl( aDescriptor ); if ( pObj ) { @@ -130,14 +130,14 @@ void SwView::ExecDraw(SfxRequest& rReq) //determine the size of the object if(pObj->IsGroupObject()) { - const tools::Rectangle& rBoundRect = static_cast(pObj)->GetCurrentBoundRect(); + const tools::Rectangle& rBoundRect = static_cast(pObj.get())->GetCurrentBoundRect(); aStartPos.AdjustX( -(rBoundRect.GetWidth()/2) ); aStartPos.AdjustY( -(rBoundRect.GetHeight()/2) ); } // TODO: unmark all other m_pWrtShell->EnterStdMode(); - m_pWrtShell->SwFEShell::InsertDrawObj( *pObj, aStartPos ); + m_pWrtShell->SwFEShell::InsertDrawObj( *(pObj.release()), aStartPos ); } } } -- cgit