summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-10-15 13:58:32 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-10-20 08:00:58 +0200
commit722cb06e71539e108f663ca1c2dd6baf7f4adc64 (patch)
tree47141f5957aa91d3d53de45e297a07fc84082f6c
parent587bd15487f78dc0e973ea811a4200612ceeda5d (diff)
return by unique_ptr from CreateFieldControl
Change-Id: Ic8bf9829c3320aca452fd1a40e9843fdbdbfa219 Reviewed-on: https://gerrit.libreoffice.org/61906 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--include/svx/fmview.hxx6
-rw-r--r--sc/source/ui/view/tabvwshb.cxx8
-rw-r--r--sc/source/ui/view/viewfun5.cxx8
-rw-r--r--sd/source/ui/view/drviewse.cxx4
-rw-r--r--sd/source/ui/view/sdview3.cxx4
-rw-r--r--svx/source/form/fmview.cxx6
-rw-r--r--svx/source/form/fmvwimp.cxx14
-rw-r--r--svx/source/inc/fmvwimp.hxx4
-rw-r--r--sw/source/uibase/dochdl/swdtflvr.cxx12
-rw-r--r--sw/source/uibase/uiview/viewdraw.cxx6
10 files changed, 36 insertions, 36 deletions
diff --git a/include/svx/fmview.hxx b/include/svx/fmview.hxx
index 106e83131733..853a6bccfe39 100644
--- a/include/svx/fmview.hxx
+++ b/include/svx/fmview.hxx
@@ -72,15 +72,15 @@ public:
@deprecated
This method is deprecated. Use the version with a ODataAccessDescriptor instead.
*/
- SdrObject* CreateFieldControl(const OUString& rFieldDesc) const;
+ SdrObjectUniquePtr CreateFieldControl(const OUString& rFieldDesc) const;
/** create a control pair (label/bound control) for the database field description given.
*/
- SdrObject* CreateFieldControl( const svx::ODataAccessDescriptor& _rColumnDescriptor );
+ SdrObjectUniquePtr CreateFieldControl( const svx::ODataAccessDescriptor& _rColumnDescriptor );
/** create a control pair (label/bound control) for the xforms description given.
*/
- SdrObject* CreateXFormsControl( const svx::OXFormsDescriptor &_rDesc );
+ SdrObjectUniquePtr CreateXFormsControl( const svx::OXFormsDescriptor &_rDesc );
virtual void MarkListHasChanged() override;
virtual void AddWindowToPaintView(OutputDevice* pNewWin, vcl::Window* pWindow) override;
diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx
index d4e88c791f21..3cd9c496d56e 100644
--- a/sc/source/ui/view/tabvwshb.cxx
+++ b/sc/source/ui/view/tabvwshb.cxx
@@ -448,7 +448,7 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq)
if(pPageView)
{
svx::ODataAccessDescriptor aDescriptor(pDescriptorItem->GetValue());
- SdrObject* pNewDBField = pDrView->CreateFieldControl(aDescriptor);
+ SdrObjectUniquePtr pNewDBField = pDrView->CreateFieldControl(aDescriptor);
if(pNewDBField)
{
@@ -462,11 +462,11 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq)
pNewDBField->SetLogicRect(aNewObjectRectangle);
// controls must be on control layer, groups on front layer
- if ( dynamic_cast<const SdrUnoObj*>( pNewDBField) != nullptr )
+ if ( dynamic_cast<const SdrUnoObj*>( pNewDBField.get() ) != nullptr )
pNewDBField->NbcSetLayer(SC_LAYER_CONTROLS);
else
pNewDBField->NbcSetLayer(SC_LAYER_FRONT);
- if (dynamic_cast<const SdrObjGroup*>( pNewDBField) != nullptr)
+ if (dynamic_cast<const SdrObjGroup*>( pNewDBField.get() ) != nullptr)
{
SdrObjListIter aIter( *pNewDBField, SdrIterMode::DeepWithGroups );
SdrObject* pSubObj = aIter.Next();
@@ -480,7 +480,7 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq)
}
}
- pView->InsertObjectAtView(pNewDBField, *pPageView);
+ pView->InsertObjectAtView(pNewDBField.release(), *pPageView);
}
}
}
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index bc44c67a900f..68751d4e148b 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -442,7 +442,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
{
MakeDrawLayer();
ScDrawView* pScDrawView = GetScDrawView();
- SdrObject* pObj = pScDrawView->CreateFieldControl( svx::OColumnTransferable::extractColumnDescriptor( aDataHelper ) );
+ SdrObjectUniquePtr pObj = pScDrawView->CreateFieldControl( svx::OColumnTransferable::extractColumnDescriptor( aDataHelper ) );
if (pObj)
{
Point aInsPos = aPos;
@@ -454,11 +454,11 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
aRect.SetPos(aInsPos);
pObj->SetLogicRect(aRect);
- if ( dynamic_cast<const SdrUnoObj*>( pObj) != nullptr )
+ if ( dynamic_cast<const SdrUnoObj*>( pObj.get() ) != nullptr )
pObj->NbcSetLayer(SC_LAYER_CONTROLS);
else
pObj->NbcSetLayer(SC_LAYER_FRONT);
- if (dynamic_cast<const SdrObjGroup*>( pObj) != nullptr)
+ if (dynamic_cast<const SdrObjGroup*>( pObj.get() ) != nullptr)
{
SdrObjListIter aIter( *pObj, SdrIterMode::DeepWithGroups );
SdrObject* pSubObj = aIter.Next();
@@ -472,7 +472,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
}
}
- pScDrawView->InsertObjectSafe(pObj, *pScDrawView->GetSdrPageView());
+ pScDrawView->InsertObjectSafe(pObj.release(), *pScDrawView->GetSdrPageView());
GetViewData().GetViewShell()->SetDrawShell( true );
bRet = true;
diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx
index 91a10f0aa275..05f8b041be60 100644
--- a/sd/source/ui/view/drviewse.cxx
+++ b/sd/source/ui/view/drviewse.cxx
@@ -272,7 +272,7 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq)
if(pPageView)
{
svx::ODataAccessDescriptor aDescriptor(pDescriptorItem->GetValue());
- SdrObject* pNewDBField = pFormView->CreateFieldControl(aDescriptor);
+ SdrObjectUniquePtr pNewDBField = pFormView->CreateFieldControl(aDescriptor);
if(pNewDBField)
{
@@ -285,7 +285,7 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq)
pNewDBField->SetLogicRect(aNewObjectRectangle);
- GetView()->InsertObjectAtView(pNewDBField, *pPageView);
+ GetView()->InsertObjectAtView(pNewDBField.release(), *pPageView);
}
}
}
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index 06d66260dd7a..e15e67a860de 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -842,7 +842,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
if( aDataHelper.GetString( SotClipboardFormatId::SBA_FIELDDATAEXCHANGE, aOUString ) )
{
- SdrObject* pObj = CreateFieldControl( aOUString );
+ SdrObjectUniquePtr pObj = CreateFieldControl( aOUString );
if( pObj )
{
@@ -854,7 +854,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
aRect.SetPos( maDropPos );
pObj->SetLogicRect( aRect );
- InsertObjectAtView( pObj, *GetSdrPageView(), SdrInsertFlags::SETDEFLAYER );
+ InsertObjectAtView( pObj.release(), *GetSdrPageView(), SdrInsertFlags::SETDEFLAYER );
bReturn = true;
}
}
diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx
index 5f93b1750b85..025ceff9d991 100644
--- a/svx/source/form/fmview.cxx
+++ b/svx/source/form/fmview.cxx
@@ -387,19 +387,19 @@ void FmFormView::DeactivateControls(SdrPageView const * pPageView)
}
-SdrObject* FmFormView::CreateFieldControl( const ODataAccessDescriptor& _rColumnDescriptor )
+SdrObjectUniquePtr FmFormView::CreateFieldControl( const ODataAccessDescriptor& _rColumnDescriptor )
{
return pImpl->implCreateFieldControl( _rColumnDescriptor );
}
-SdrObject* FmFormView::CreateXFormsControl( const OXFormsDescriptor &_rDesc )
+SdrObjectUniquePtr FmFormView::CreateXFormsControl( const OXFormsDescriptor &_rDesc )
{
return pImpl->implCreateXFormsControl(_rDesc);
}
-SdrObject* FmFormView::CreateFieldControl(const OUString& rFieldDesc) const
+SdrObjectUniquePtr FmFormView::CreateFieldControl(const OUString& rFieldDesc) const
{
OUString sDataSource = rFieldDesc.getToken(0,u'\x000B');
OUString sObjectName = rFieldDesc.getToken(1,u'\x000B');
diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx
index 7c2311948a8a..48f0b2220bec 100644
--- a/svx/source/form/fmvwimp.cxx
+++ b/svx/source/form/fmvwimp.cxx
@@ -1146,7 +1146,7 @@ namespace
}
-SdrObject* FmXFormView::implCreateFieldControl( const svx::ODataAccessDescriptor& _rColumnDescriptor )
+SdrObjectUniquePtr FmXFormView::implCreateFieldControl( const svx::ODataAccessDescriptor& _rColumnDescriptor )
{
// not if we're in design mode
if ( !m_pView->IsDesignMode() )
@@ -1347,7 +1347,7 @@ SdrObject* FmXFormView::implCreateFieldControl( const svx::ODataAccessDescriptor
bool bCheckbox = ( OBJ_FM_CHECKBOX == nOBJID );
OSL_ENSURE( !bCheckbox || !pLabel, "FmXFormView::implCreateFieldControl: why was there a label created for a check box?" );
if ( bCheckbox )
- return pControl.release();
+ return SdrObjectUniquePtr(pControl.release());
SdrObjGroup* pGroup = new SdrObjGroup(getView()->getSdrModelFromSdrView());
SdrObjList* pObjList = pGroup->GetSubList();
@@ -1366,7 +1366,7 @@ SdrObject* FmXFormView::implCreateFieldControl( const svx::ODataAccessDescriptor
}
}
- return pGroup; // and done
+ return SdrObjectUniquePtr(pGroup); // and done
}
catch (const Exception&)
{
@@ -1378,7 +1378,7 @@ SdrObject* FmXFormView::implCreateFieldControl( const svx::ODataAccessDescriptor
}
-SdrObject* FmXFormView::implCreateXFormsControl( const svx::OXFormsDescriptor &_rDesc )
+SdrObjectUniquePtr FmXFormView::implCreateXFormsControl( const svx::OXFormsDescriptor &_rDesc )
{
// not if we're in design mode
if ( !m_pView->IsDesignMode() )
@@ -1456,7 +1456,7 @@ SdrObject* FmXFormView::implCreateXFormsControl( const svx::OXFormsDescriptor &_
bool bCheckbox = ( OBJ_FM_CHECKBOX == nOBJID );
OSL_ENSURE( !bCheckbox || !pLabel, "FmXFormView::implCreateXFormsControl: why was there a label created for a check box?" );
if ( bCheckbox )
- return pControl.release();
+ return SdrObjectUniquePtr(pControl.release());
// group objects
@@ -1465,7 +1465,7 @@ SdrObject* FmXFormView::implCreateXFormsControl( const svx::OXFormsDescriptor &_
pObjList->InsertObject(pLabel.release());
pObjList->InsertObject(pControl.release());
- return pGroup;
+ return SdrObjectUniquePtr(pGroup);
}
else {
@@ -1495,7 +1495,7 @@ SdrObject* FmXFormView::implCreateXFormsControl( const svx::OXFormsDescriptor &_
Reference< css::form::submission::XSubmissionSupplier > xSubmissionSupplier(pControl->GetUnoControlModel(), UNO_QUERY);
xSubmissionSupplier->setSubmission(xSubmission);
- return pControl;
+ return SdrObjectUniquePtr(pControl);
}
}
catch (const Exception&)
diff --git a/svx/source/inc/fmvwimp.hxx b/svx/source/inc/fmvwimp.hxx
index 13749dedf391..f10068daee90 100644
--- a/svx/source/inc/fmvwimp.hxx
+++ b/svx/source/inc/fmvwimp.hxx
@@ -247,8 +247,8 @@ private:
void Activate(bool bSync = false);
void Deactivate(bool bDeactivateController = true);
- SdrObject* implCreateFieldControl( const svx::ODataAccessDescriptor& _rColumnDescriptor );
- SdrObject* implCreateXFormsControl( const svx::OXFormsDescriptor &_rDesc );
+ SdrObjectUniquePtr implCreateFieldControl( const svx::ODataAccessDescriptor& _rColumnDescriptor );
+ SdrObjectUniquePtr implCreateXFormsControl( const svx::OXFormsDescriptor &_rDesc );
static bool createControlLabelPair(
OutputDevice const & _rOutDev,
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<FmFormView*>( 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<SdrObjGroup*>(pObj)->GetCurrentBoundRect();
+ const tools::Rectangle& rBoundRect = static_cast<SdrObjGroup*>(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 );
}
}
}