From 7f48fa8152bd3320af7276d811b752c5a762dcce Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 1 Nov 2018 13:14:09 +0200 Subject: loplugin:collapseif in tools..xmloff Change-Id: Iea1227a9f13a0a618d9bb6b0bbedaa5ce8d1a4f5 Reviewed-on: https://gerrit.libreoffice.org/62732 Tested-by: Jenkins Reviewed-by: Noel Grandin --- xmloff/source/core/xmlimp.cxx | 17 +++++++---------- xmloff/source/draw/animationexport.cxx | 9 +++------ xmloff/source/draw/ximpshap.cxx | 17 +++++++---------- xmloff/source/text/XMLIndexMarkExport.cxx | 14 ++++---------- xmloff/source/text/XMLTextFrameContext.cxx | 7 ++----- 5 files changed, 23 insertions(+), 41 deletions(-) (limited to 'xmloff/source') diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index a2303e170b0f..d68a9debcfc2 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -1288,20 +1288,17 @@ const Reference< container::XNameContainer > & SvXMLImport::GetMarkerHelper() const Reference< container::XNameContainer > & SvXMLImport::GetDashHelper() { - if( !mxDashHelper.is() ) + if( !mxDashHelper.is() && mxModel.is() ) { - if( mxModel.is() ) + Reference< lang::XMultiServiceFactory > xServiceFact( mxModel, UNO_QUERY); + if( xServiceFact.is() ) { - Reference< lang::XMultiServiceFactory > xServiceFact( mxModel, UNO_QUERY); - if( xServiceFact.is() ) + try { - try - { - mxDashHelper.set( xServiceFact->createInstance( "com.sun.star.drawing.DashTable" ), UNO_QUERY); - } - catch( lang::ServiceNotRegisteredException& ) - {} + mxDashHelper.set( xServiceFact->createInstance( "com.sun.star.drawing.DashTable" ), UNO_QUERY); } + catch( lang::ServiceNotRegisteredException& ) + {} } } diff --git a/xmloff/source/draw/animationexport.cxx b/xmloff/source/draw/animationexport.cxx index 72938424411a..de66a89dcd8d 100644 --- a/xmloff/source/draw/animationexport.cxx +++ b/xmloff/source/draw/animationexport.cxx @@ -881,13 +881,10 @@ void AnimationsExporterImpl::exportNode( const Reference< XAnimationNode >& xNod } aTemp = xNode->getEndSync(); - if( aTemp.hasValue() ) + if( aTemp.hasValue() && (aTemp >>= nTemp) ) { - if( aTemp >>= nTemp ) - { - SvXMLUnitConverter::convertEnum( sTmp, nTemp, aAnimations_EnumMap_Endsync ); - mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_ENDSYNC, sTmp.makeStringAndClear() ); - } + SvXMLUnitConverter::convertEnum( sTmp, nTemp, aAnimations_EnumMap_Endsync ); + mrExport.AddAttribute( XML_NAMESPACE_SMIL, XML_ENDSYNC, sTmp.makeStringAndClear() ); } sal_Int16 nContainerNodeType = EffectNodeType::DEFAULT; diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index a8f9a7a1dbff..8988e52dd9f1 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -3894,19 +3894,16 @@ void SdXMLTableShapeContext::StartElement( const css::uno::Reference< css::xml:: uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY); - if(bIsPresShape) + if(bIsPresShape && xProps.is()) { - if(xProps.is()) + uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() ); + if( xPropsInfo.is() ) { - uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() ); - if( xPropsInfo.is() ) - { - if( !mbIsPlaceholder && xPropsInfo->hasPropertyByName("IsEmptyPresentationObject")) - xProps->setPropertyValue("IsEmptyPresentationObject", css::uno::Any(false) ); + if( !mbIsPlaceholder && xPropsInfo->hasPropertyByName("IsEmptyPresentationObject")) + xProps->setPropertyValue("IsEmptyPresentationObject", css::uno::Any(false) ); - if( mbIsUserTransformed && xPropsInfo->hasPropertyByName("IsPlaceholderDependent")) - xProps->setPropertyValue("IsPlaceholderDependent", css::uno::Any(false) ); - } + if( mbIsUserTransformed && xPropsInfo->hasPropertyByName("IsPlaceholderDependent")) + xProps->setPropertyValue("IsPlaceholderDependent", css::uno::Any(false) ); } } diff --git a/xmloff/source/text/XMLIndexMarkExport.cxx b/xmloff/source/text/XMLIndexMarkExport.cxx index bfeb4a845d9f..a236b7e4dfcb 100644 --- a/xmloff/source/text/XMLIndexMarkExport.cxx +++ b/xmloff/source/text/XMLIndexMarkExport.cxx @@ -191,12 +191,9 @@ static void lcl_ExportPropertyString( SvXMLExport& rExport, rAny = rPropSet->getPropertyValue( sProperty ); OUString sValue; - if( rAny >>= sValue ) + if( (rAny >>= sValue) && !sValue.isEmpty() ) { - if( !sValue.isEmpty() ) - { - rExport.AddAttribute( XML_NAMESPACE_TEXT, eToken, sValue ); - } + rExport.AddAttribute( XML_NAMESPACE_TEXT, eToken, sValue ); } } @@ -209,12 +206,9 @@ static void lcl_ExportPropertyBool( SvXMLExport& rExport, rAny = rPropSet->getPropertyValue( sProperty ); bool bValue; - if( rAny >>= bValue ) + if( (rAny >>= bValue) && bValue ) { - if( bValue ) - { - rExport.AddAttribute( XML_NAMESPACE_TEXT, eToken, XML_TRUE ); - } + rExport.AddAttribute( XML_NAMESPACE_TEXT, eToken, XML_TRUE ); } } diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx index a23caf149fde..134f81f9daeb 100644 --- a/xmloff/source/text/XMLTextFrameContext.cxx +++ b/xmloff/source/text/XMLTextFrameContext.cxx @@ -1332,11 +1332,8 @@ bool XMLTextFrameContext::CreateIfNotThere( css::uno::Reference < css::beans::XP { SvXMLImportContext *pContext = m_xImplContext.get(); XMLTextFrameContext_Impl *pImpl = dynamic_cast< XMLTextFrameContext_Impl*>( pContext ); - if( pImpl ) - { - if( pImpl->CreateIfNotThere() ) - rPropSet = pImpl->GetPropSet(); - } + if( pImpl && pImpl->CreateIfNotThere() ) + rPropSet = pImpl->GetPropSet(); return rPropSet.is(); } -- cgit