summaryrefslogtreecommitdiff
path: root/reportdesign/source/core/sdr/RptObject.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-02 12:06:45 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-02 20:07:00 +0200
commitff7e960701ccacbd62bd2251f26561eeba8ebe8a (patch)
tree1adb4b20e453804203cb95721c7d5bc92795e1e6 /reportdesign/source/core/sdr/RptObject.cxx
parent4acb0e7f05fa7fe05f990786e0483e20962af1d9 (diff)
loplugin:flatten in reportdesign
Change-Id: I6d8b2730cede4453e7afd581cc24ed101ca6c81b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91557 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'reportdesign/source/core/sdr/RptObject.cxx')
-rw-r--r--reportdesign/source/core/sdr/RptObject.cxx222
1 files changed, 111 insertions, 111 deletions
diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx
index ab478828dd7d..157ed10b7ca6 100644
--- a/reportdesign/source/core/sdr/RptObject.cxx
+++ b/reportdesign/source/core/sdr/RptObject.cxx
@@ -779,113 +779,113 @@ OUString OUnoObject::GetDefaultName(const OUnoObject* _pObj)
void OUnoObject::_propertyChange( const beans::PropertyChangeEvent& evt )
{
OObjectBase::_propertyChange(evt);
- if (isListening())
+ if (!isListening())
+ return;
+
+ if ( evt.PropertyName == PROPERTY_CHARCOLOR )
{
- if ( evt.PropertyName == PROPERTY_CHARCOLOR )
+ Reference<XPropertySet> xControlModel(GetUnoControlModel(),uno::UNO_QUERY);
+ if ( xControlModel.is() )
{
- Reference<XPropertySet> xControlModel(GetUnoControlModel(),uno::UNO_QUERY);
- if ( xControlModel.is() )
+ OObjectBase::EndListening();
+ try
{
+ xControlModel->setPropertyValue(PROPERTY_TEXTCOLOR,evt.NewValue);
+ }
+ catch(uno::Exception&)
+ {
+ }
+ OObjectBase::StartListening();
+ }
+ }
+ else if ( evt.PropertyName == PROPERTY_NAME )
+ {
+ Reference<XPropertySet> xControlModel(GetUnoControlModel(),uno::UNO_QUERY);
+ if ( xControlModel.is() && xControlModel->getPropertySetInfo()->hasPropertyByName(PROPERTY_NAME) )
+ {
+ // get old name
+ OUString aOldName;
+ evt.OldValue >>= aOldName;
+
+ // get new name
+ OUString aNewName;
+ evt.NewValue >>= aNewName;
+
+ if ( aNewName != aOldName )
+ {
+ // set old name property
OObjectBase::EndListening();
+ if ( m_xMediator.is() )
+ m_xMediator->stopListening();
try
{
- xControlModel->setPropertyValue(PROPERTY_TEXTCOLOR,evt.NewValue);
+ xControlModel->setPropertyValue( PROPERTY_NAME, evt.NewValue );
}
catch(uno::Exception&)
{
}
+ if ( m_xMediator.is() )
+ m_xMediator->startListening();
OObjectBase::StartListening();
}
}
- else if ( evt.PropertyName == PROPERTY_NAME )
- {
- Reference<XPropertySet> xControlModel(GetUnoControlModel(),uno::UNO_QUERY);
- if ( xControlModel.is() && xControlModel->getPropertySetInfo()->hasPropertyByName(PROPERTY_NAME) )
- {
- // get old name
- OUString aOldName;
- evt.OldValue >>= aOldName;
-
- // get new name
- OUString aNewName;
- evt.NewValue >>= aNewName;
-
- if ( aNewName != aOldName )
- {
- // set old name property
- OObjectBase::EndListening();
- if ( m_xMediator.is() )
- m_xMediator->stopListening();
- try
- {
- xControlModel->setPropertyValue( PROPERTY_NAME, evt.NewValue );
- }
- catch(uno::Exception&)
- {
- }
- if ( m_xMediator.is() )
- m_xMediator->startListening();
- OObjectBase::StartListening();
- }
- }
- }
}
}
void OUnoObject::CreateMediator(bool _bReverse)
{
- if ( !m_xMediator.is() )
+ if ( m_xMediator.is() )
+ return;
+
+ // tdf#118730 Directly do things formerly done in
+ // OUnoObject::impl_setReportComponent_nothrow here
+ if(!m_xReportComponent.is())
{
- // tdf#118730 Directly do things 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);
+ OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject()));
+ OXUndoEnvironment::OUndoEnvLock aLock( rRptModel.GetUndoEnv() );
+ m_xReportComponent.set(getUnoShape(),uno::UNO_QUERY);
- impl_initializeModel_nothrow();
- }
+ impl_initializeModel_nothrow();
+ }
- if(m_xReportComponent.is() && m_bSetDefaultLabel)
- {
- // tdf#118730 Directly do things formerly done in
- // OUnoObject::EndCreate here
- // tdf#119067 ...but *only* if result of interactive
- // creation in Report DesignView
- m_bSetDefaultLabel = false;
+ if(m_xReportComponent.is() && m_bSetDefaultLabel)
+ {
+ // tdf#118730 Directly do things formerly done in
+ // OUnoObject::EndCreate here
+ // tdf#119067 ...but *only* if result of interactive
+ // creation in Report DesignView
+ m_bSetDefaultLabel = false;
- try
- {
- if ( supportsService( SERVICE_FIXEDTEXT ) )
- {
- m_xReportComponent->setPropertyValue(
- PROPERTY_LABEL,
- uno::makeAny(GetDefaultName(this)));
- }
- }
- catch(const uno::Exception&)
+ try
+ {
+ if ( supportsService( SERVICE_FIXEDTEXT ) )
{
- DBG_UNHANDLED_EXCEPTION("reportdesign");
+ m_xReportComponent->setPropertyValue(
+ PROPERTY_LABEL,
+ uno::makeAny(GetDefaultName(this)));
}
}
-
- if(!m_xMediator.is() && m_xReportComponent.is())
+ catch(const uno::Exception&)
{
- Reference<XPropertySet> xControlModel(GetUnoControlModel(),uno::UNO_QUERY);
-
- if(xControlModel.is())
- {
- m_xMediator = new OPropertyMediator(
- m_xReportComponent.get(),
- xControlModel,
- getPropertyNameMap(GetObjIdentifier()),
- _bReverse);
- }
+ DBG_UNHANDLED_EXCEPTION("reportdesign");
}
+ }
- OObjectBase::StartListening();
+ 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);
+ }
}
+
+ OObjectBase::StartListening();
}
uno::Reference< beans::XPropertySet> OUnoObject::getAwtComponent()
@@ -1160,21 +1160,21 @@ void OOle2Obj::impl_createDataProvider_nothrow(const uno::Reference< frame::XMod
void OOle2Obj::initializeOle()
{
- if ( m_bOnlyOnce )
- {
- m_bOnlyOnce = false;
- uno::Reference < embed::XEmbeddedObject > xObj = GetObjRef();
- OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject()));
- rRptModel.GetUndoEnv().AddElement(lcl_getDataProvider(xObj));
+ if ( !m_bOnlyOnce )
+ return;
- uno::Reference< embed::XComponentSupplier > xCompSupp( xObj, uno::UNO_QUERY );
- if( xCompSupp.is() )
- {
- uno::Reference< beans::XPropertySet > xChartProps( xCompSupp->getComponent(), uno::UNO_QUERY );
- if ( xChartProps.is() )
- xChartProps->setPropertyValue("NullDate",
- uno::makeAny(util::DateTime(0,0,0,0,30,12,1899,false)));
- }
+ m_bOnlyOnce = false;
+ uno::Reference < embed::XEmbeddedObject > xObj = GetObjRef();
+ OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject()));
+ rRptModel.GetUndoEnv().AddElement(lcl_getDataProvider(xObj));
+
+ uno::Reference< embed::XComponentSupplier > xCompSupp( xObj, uno::UNO_QUERY );
+ if( xCompSupp.is() )
+ {
+ uno::Reference< beans::XPropertySet > xChartProps( xCompSupp->getComponent(), uno::UNO_QUERY );
+ if ( xChartProps.is() )
+ xChartProps->setPropertyValue("NullDate",
+ uno::makeAny(util::DateTime(0,0,0,0,30,12,1899,false)));
}
}
@@ -1186,29 +1186,29 @@ void OOle2Obj::initializeChart( const uno::Reference< frame::XModel>& _xModel)
if( xCompSupp.is())
xReceiver.set( xCompSupp->getComponent(), uno::UNO_QUERY );
OSL_ASSERT( xReceiver.is());
- if( xReceiver.is() )
- {
- // lock the model to suppress any internal updates
- uno::Reference< frame::XModel > xChartModel( xReceiver, uno::UNO_QUERY );
- if( xChartModel.is() )
- xChartModel->lockControllers();
+ if( !xReceiver.is() )
+ return;
- if ( !lcl_getDataProvider(xObj).is() )
- impl_createDataProvider_nothrow(_xModel);
+ // lock the model to suppress any internal updates
+ uno::Reference< frame::XModel > xChartModel( xReceiver, uno::UNO_QUERY );
+ if( xChartModel.is() )
+ xChartModel->lockControllers();
- OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject()));
- rRptModel.GetUndoEnv().AddElement(lcl_getDataProvider(xObj));
+ if ( !lcl_getDataProvider(xObj).is() )
+ impl_createDataProvider_nothrow(_xModel);
+
+ OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject()));
+ rRptModel.GetUndoEnv().AddElement(lcl_getDataProvider(xObj));
- ::comphelper::NamedValueCollection aArgs;
- aArgs.put( "CellRangeRepresentation", uno::makeAny( OUString( "all" ) ) );
- aArgs.put( "HasCategories", uno::makeAny( true ) );
- aArgs.put( "FirstCellAsLabel", uno::makeAny( true ) );
- aArgs.put( "DataRowSource", uno::makeAny( chart::ChartDataRowSource_COLUMNS ) );
- xReceiver->setArguments( aArgs.getPropertyValues() );
+ ::comphelper::NamedValueCollection aArgs;
+ aArgs.put( "CellRangeRepresentation", uno::makeAny( OUString( "all" ) ) );
+ aArgs.put( "HasCategories", uno::makeAny( true ) );
+ aArgs.put( "FirstCellAsLabel", uno::makeAny( true ) );
+ aArgs.put( "DataRowSource", uno::makeAny( chart::ChartDataRowSource_COLUMNS ) );
+ xReceiver->setArguments( aArgs.getPropertyValues() );
- if( xChartModel.is() )
- xChartModel->unlockControllers();
- }
+ if( xChartModel.is() )
+ xChartModel->unlockControllers();
}
uno::Reference< style::XStyle> getUsedStyle(const uno::Reference< report::XReportDefinition>& _xReport)