summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de>2018-07-27 13:38:46 +0200
committerCaolán McNamara <caolanm@redhat.com>2018-10-16 12:32:24 +0200
commit2cf13c31c6aa262e4bb4b075597f3543ecd3c4a6 (patch)
treea62439c3adf4e943788555209209bceffc54d863 /svx
parentd5d09bb733842252b3e2d6e7480b211e67136a75 (diff)
tdf#118963 Hand over a SdrModel to createControlLabelPair
Change-Id: I34a35ff0700d14474fa9946851812c25c4eb4bc1 Reviewed-on: https://gerrit.libreoffice.org/58187 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de> (cherry picked from commit e5ee79b5c089e72e6b24c04c7c820d706bd39993) Reviewed-on: https://gerrit.libreoffice.org/61316 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/form/fmview.cxx4
-rw-r--r--svx/source/form/fmvwimp.cxx32
-rw-r--r--svx/source/inc/fmvwimp.hxx6
3 files changed, 32 insertions, 10 deletions
diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx
index 1d9aadc0ab90..15df6aa0adfb 100644
--- a/svx/source/form/fmview.cxx
+++ b/svx/source/form/fmview.cxx
@@ -566,13 +566,13 @@ FmFormObj* FmFormView::getMarkedGrid() const
void FmFormView::createControlLabelPair( OutputDevice const * _pOutDev, sal_Int32 _nXOffsetMM, sal_Int32 _nYOffsetMM,
const Reference< XPropertySet >& _rxField, const Reference< XNumberFormats >& _rxNumberFormats,
sal_uInt16 _nControlObjectID, SdrInventor _nInventor, sal_uInt16 _nLabelObjectID,
- SdrPage* _pLabelPage, SdrPage* _pControlPage, SdrModel* _pModel, SdrUnoObj*& _rpLabel, SdrUnoObj*& _rpControl )
+ SdrPage* _pLabelPage, SdrPage* _pControlPage, SdrModel& _rModel, SdrUnoObj*& _rpLabel, SdrUnoObj*& _rpControl )
{
FmXFormView::createControlLabelPair(
*_pOutDev, _nXOffsetMM, _nYOffsetMM,
_rxField, _rxNumberFormats,
_nControlObjectID, "", _nInventor, _nLabelObjectID,
- _pLabelPage, _pControlPage, _pModel,
+ _pLabelPage, _pControlPage, _rModel,
_rpLabel, _rpControl
);
}
diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx
index f31659ea3a40..260892f1d9eb 100644
--- a/svx/source/form/fmvwimp.cxx
+++ b/svx/source/form/fmvwimp.cxx
@@ -1514,11 +1514,29 @@ bool FmXFormView::createControlLabelPair( OutputDevice const & _rOutDev, sal_Int
const Reference< XDataSource >& _rxDataSource, const OUString& _rDataSourceName,
const OUString& _rCommand, const sal_Int32 _nCommandType )
{
- if ( !createControlLabelPair( _rOutDev, _nXOffsetMM, _nYOffsetMM,
- _rxField, _rxNumberFormats, _nControlObjectID, _rFieldPostfix, SdrInventor::FmForm, OBJ_FM_FIXEDTEXT,
- nullptr, nullptr, nullptr, _rpLabel, _rpControl )
- )
+ if(!createControlLabelPair(
+ _rOutDev,
+ _nXOffsetMM,
+ _nYOffsetMM,
+ _rxField,
+ _rxNumberFormats,
+ _nControlObjectID,
+ _rFieldPostfix,
+ SdrInventor::FmForm,
+ OBJ_FM_FIXEDTEXT,
+ nullptr,
+ nullptr,
+
+ // tdf#118963 Hand over a SdrModel to SdrObject-creation. It uses the local m_pView
+ // and already returning false when nullptr == getView() could be done, but m_pView
+ // is already dereferenced here in many places (see below), so just use it for now.
+ getView()->getSdrModelFromSdrView(),
+
+ _rpLabel,
+ _rpControl))
+ {
return false;
+ }
// insert the control model(s) into the form component hierarchy
if ( _rpLabel )
@@ -1539,7 +1557,7 @@ bool FmXFormView::createControlLabelPair( OutputDevice const & _rOutDev, sal_Int
const Reference< XPropertySet >& _rxField,
const Reference< XNumberFormats >& _rxNumberFormats, sal_uInt16 _nControlObjectID,
const OUString& _rFieldPostfix, SdrInventor _nInventor, sal_uInt16 _nLabelObjectID,
- SdrPage* /*_pLabelPage*/, SdrPage* /*_pControlPage*/, SdrModel* _pModel, SdrUnoObj*& _rpLabel, SdrUnoObj*& _rpControl)
+ SdrPage* /*_pLabelPage*/, SdrPage* /*_pControlPage*/, SdrModel& _rModel, SdrUnoObj*& _rpLabel, SdrUnoObj*& _rpControl)
{
sal_Int32 nDataType = 0;
OUString sFieldName;
@@ -1582,7 +1600,7 @@ bool FmXFormView::createControlLabelPair( OutputDevice const & _rOutDev, sal_Int
{
pLabel.reset( dynamic_cast< SdrUnoObj* >(
SdrObjFactory::MakeNewObject(
- *_pModel,
+ _rModel,
_nInventor,
_nLabelObjectID)));
@@ -1614,7 +1632,7 @@ bool FmXFormView::createControlLabelPair( OutputDevice const & _rOutDev, sal_Int
// the control
::std::unique_ptr< SdrUnoObj, SdrObjectFreeOp > pControl( dynamic_cast< SdrUnoObj* >(
SdrObjFactory::MakeNewObject(
- *_pModel,
+ _rModel,
_nInventor,
_nControlObjectID)));
diff --git a/svx/source/inc/fmvwimp.hxx b/svx/source/inc/fmvwimp.hxx
index 8e77b3eeb641..5fb1403bec42 100644
--- a/svx/source/inc/fmvwimp.hxx
+++ b/svx/source/inc/fmvwimp.hxx
@@ -261,7 +261,11 @@ private:
sal_uInt16 _nLabelObjectID,
SdrPage* _pLabelPage,
SdrPage* _pControlPage,
- SdrModel* _pModel,
+
+ // tdf#118963 Need a SdrModel for SdrObject creation. To make the
+ // demand clear, hand over a SdrMldel&
+ SdrModel& _rModel,
+
SdrUnoObj*& _rpLabel,
SdrUnoObj*& _rpControl
);