Kaydet (Commit) e5ee79b5 authored tarafından Armin Le Grand's avatar Armin Le Grand

tdf#118963 Hand over a SdrModel to createControlLabelPair

Change-Id: I34a35ff0700d14474fa9946851812c25c4eb4bc1
Reviewed-on: https://gerrit.libreoffice.org/58187
Tested-by: Jenkins
Reviewed-by: 's avatarArmin Le Grand <Armin.Le.Grand@cib.de>
üst 7dc30a14
......@@ -97,7 +97,11 @@ public:
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
);
......
......@@ -3136,11 +3136,26 @@ void OReportController::createControl(const Sequence< PropertyValue >& _aArgs,co
{
SdrUnoObj* pLabel( nullptr );
SdrUnoObj* pControl( nullptr );
FmFormView::createControlLabelPair( getDesignView()
,nLeftMargin,0
,nullptr,nullptr,_nObjectId,SdrInventor::ReportDesign,OBJ_DLG_FIXEDTEXT,
nullptr,pSectionWindow->getReportSection().getPage(),m_aReportModel.get(),
pLabel,pControl);
FmFormView::createControlLabelPair(
getDesignView(),
nLeftMargin,
0,
nullptr,
nullptr,
_nObjectId,
SdrInventor::ReportDesign,
OBJ_DLG_FIXEDTEXT,
nullptr,
pSectionWindow->getReportSection().getPage(),
// tdf#118963 Need a SdrModel for SdrObject creation. Dereferencing
// m_aReportModel seems pretty safe, it's done in other places, initialized
// in impl_initialize and throws a RuntimeException if not existing.
*m_aReportModel,
pLabel,
pControl);
// always use SdrObject::Free(...) for SdrObjects (!)
SdrObject* pTemp(pLabel);
......@@ -3433,12 +3448,28 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs)
OSectionView* pSectionViews[2];
pSectionViews[0] = &pSectionWindow[1]->getReportSection().getSectionView();
pSectionViews[1] = &pSectionWindow[0]->getReportSection().getSectionView();
// find this in svx
FmFormView::createControlLabelPair( getDesignView()
,nLeftMargin,0
,xField,xNumberFormats,nOBJID,SdrInventor::ReportDesign,OBJ_DLG_FIXEDTEXT,
pSectionWindow[1]->getReportSection().getPage(),pSectionWindow[0]->getReportSection().getPage(),m_aReportModel.get(),
pControl[0],pControl[1]);
FmFormView::createControlLabelPair(
getDesignView(),
nLeftMargin,
0,
xField,
xNumberFormats,
nOBJID,
SdrInventor::ReportDesign,
OBJ_DLG_FIXEDTEXT,
pSectionWindow[1]->getReportSection().getPage(),
pSectionWindow[0]->getReportSection().getPage(),
// tdf#118963 Need a SdrModel for SdrObject creation. Dereferencing
// m_aReportModel seems pretty safe, it's done in other places, initialized
// in impl_initialize and throws a RuntimeException if not existing.
*m_aReportModel,
pControl[0],
pControl[1]);
if ( pControl[0] && pControl[1] )
{
SdrPageView* pPgViews[2];
......
......@@ -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
);
}
......
......@@ -1515,11 +1515,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 )
......@@ -1540,7 +1558,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;
......@@ -1583,7 +1601,7 @@ bool FmXFormView::createControlLabelPair( OutputDevice const & _rOutDev, sal_Int
{
pLabel.reset( dynamic_cast< SdrUnoObj* >(
SdrObjFactory::MakeNewObject(
*_pModel,
_rModel,
_nInventor,
_nLabelObjectID)));
......@@ -1615,7 +1633,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)));
......
......@@ -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
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment