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

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: 's avatarArmin Le Grand <Armin.Le.Grand@cib.de>
üst ad9821c9
......@@ -246,7 +246,6 @@ protected:
virtual void NbcMove( const Size& rSize ) override;
virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
virtual SdrPage* GetImplPage() const override;
......@@ -272,7 +271,6 @@ public:
private:
virtual void impl_setUnoShape( const css::uno::Reference< css::uno::XInterface >& rxUnoShape ) override;
void impl_setReportComponent_nothrow();
void impl_initializeModel_nothrow();
};
......
......@@ -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 ( !m_xMediator.is() && m_xReportComponent.is() && xControlModel.is() )
m_xMediator = new OPropertyMediator(m_xReportComponent.get(),xControlModel,getPropertyNameMap(GetObjIdentifier()),_bReverse);
if(xControlModel.is())
{
m_xMediator = new OPropertyMediator(
m_xReportComponent.get(),
xControlModel,
getPropertyNameMap(GetObjIdentifier()),
_bReverse);
}
}
OObjectBase::StartListening();
}
}
......
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