summaryrefslogtreecommitdiff
path: root/reportdesign/source/core/sdr
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de>2018-07-25 14:10:08 +0200
committerArmin Le Grand <Armin.Le.Grand@cib.de>2018-07-25 19:22:09 +0200
commit96b338e62c422ccd23cd33b3f87a463730221514 (patch)
tree69e2dfb923a6560a7375294c7531c2977cc02322 /reportdesign/source/core/sdr
parentad9821c92fdf6dbd39826fb71742f10c41f2155b (diff)
tdf#118730 Correct ReportDesigner Object creation
This is a follow up problem to removing the old stuff that first a SdrPage* at the SdrObjects was set *without* the SdrObject being inserted to any SdrObjList. It works no longer - the SdrPage which you can get now is the one the SdrObject *is* inserted at. Solution is to move that stuff - plus other initializations which were done in OUnoObject::EndCreate before - to where it belongs. This gets rid of OUnoObject::EndCreate completely. It makes OUnoObject::impl_setReportComponent_nothrow no longer needed due to being used only in one place. All initializations move to OUnoObject::CreateMediator which anyways needs to be done when a OUnoObject got created. Change-Id: I86f968dc6e867c5752d3c8cee1b3b2af57e467c8 Reviewed-on: https://gerrit.libreoffice.org/57976 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Diffstat (limited to 'reportdesign/source/core/sdr')
-rw-r--r--reportdesign/source/core/sdr/RptObject.cxx97
1 files changed, 50 insertions, 47 deletions
diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx
index f69427efa035..4ea04086ff33 100644
--- a/reportdesign/source/core/sdr/RptObject.cxx
+++ b/reportdesign/source/core/sdr/RptObject.cxx
@@ -639,18 +639,6 @@ void OUnoObject::impl_initializeModel_nothrow()
}
}
-void OUnoObject::impl_setReportComponent_nothrow()
-{
- if ( m_xReportComponent.is() )
- return;
-
- OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject()));
- OXUndoEnvironment::OUndoEnvLock aLock( rRptModel.GetUndoEnv() );
- m_xReportComponent.set(getUnoShape(),uno::UNO_QUERY);
-
- impl_initializeModel_nothrow();
-}
-
sal_uInt16 OUnoObject::GetObjIdentifier() const
{
return m_nObjectType;
@@ -742,37 +730,6 @@ void OUnoObject::NbcSetLogicRect(const tools::Rectangle& rRect)
OObjectBase::StartListening();
}
-
-bool OUnoObject::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
-{
- bool bResult = SdrUnoObj::EndCreate(rStat, eCmd);
- if ( bResult )
- {
- impl_setReportComponent_nothrow();
- // set labels
- if ( m_xReportComponent.is() )
- {
- try
- {
- if ( supportsService( SERVICE_FIXEDTEXT ) )
- {
- m_xReportComponent->setPropertyValue( PROPERTY_LABEL, uno::makeAny(GetDefaultName(this)) );
- }
- }
- catch(const uno::Exception&)
- {
- DBG_UNHANDLED_EXCEPTION("reportdesign");
- }
-
- impl_initializeModel_nothrow();
- }
- // set geometry properties
- SetPropsFromRect(GetLogicRect());
- }
-
- return bResult;
-}
-
OUString OUnoObject::GetDefaultName(const OUnoObject* _pObj)
{
OUString aDefaultName = "HERE WE HAVE TO INSERT OUR NAME!";
@@ -856,11 +813,57 @@ void OUnoObject::CreateMediator(bool _bReverse)
{
if ( !m_xMediator.is() )
{
- impl_setReportComponent_nothrow();
+ // tdf#118730 Directly do thinigs formerly done in
+ // OUnoObject::impl_setReportComponent_nothrow here
+ if(!m_xReportComponent.is())
+ {
+ OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject()));
+ OXUndoEnvironment::OUndoEnvLock aLock( rRptModel.GetUndoEnv() );
+ m_xReportComponent.set(getUnoShape(),uno::UNO_QUERY);
+
+ impl_initializeModel_nothrow();
+ }
+
+ // tdf#118730 Directly do thinigs formerly done in
+ // OUnoObject::EndCreate here
+ if(m_xReportComponent.is())
+ {
+ // set labels
+ if ( m_xReportComponent.is() )
+ {
+ try
+ {
+ if ( supportsService( SERVICE_FIXEDTEXT ) )
+ {
+ m_xReportComponent->setPropertyValue( PROPERTY_LABEL, uno::makeAny(GetDefaultName(this)) );
+ }
+ }
+ catch(const uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("reportdesign");
+ }
+
+ impl_initializeModel_nothrow();
+ }
+ }
+
+ // tdf#118730 set geometry properties
+ SetPropsFromRect(GetLogicRect());
+
+ if(!m_xMediator.is() && m_xReportComponent.is())
+ {
+ Reference<XPropertySet> xControlModel(GetUnoControlModel(),uno::UNO_QUERY);
+
+ if(xControlModel.is())
+ {
+ m_xMediator = new OPropertyMediator(
+ m_xReportComponent.get(),
+ xControlModel,
+ getPropertyNameMap(GetObjIdentifier()),
+ _bReverse);
+ }
+ }
- Reference<XPropertySet> xControlModel(GetUnoControlModel(),uno::UNO_QUERY);
- if ( !m_xMediator.is() && m_xReportComponent.is() && xControlModel.is() )
- m_xMediator = new OPropertyMediator(m_xReportComponent.get(),xControlModel,getPropertyNameMap(GetObjIdentifier()),_bReverse);
OObjectBase::StartListening();
}
}