writerfilter/source/dmapper/DomainMapper.cxx | 2 - writerfilter/source/dmapper/DomainMapper_Impl.cxx | 25 +++++----------------- writerfilter/source/dmapper/StyleSheetTable.cxx | 2 - 3 files changed, 8 insertions(+), 21 deletions(-)
New commits: commit a7eb2f57d8e586577679ecd085b9aa90746ec36b Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Sun Jul 11 10:37:20 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sun Jul 11 11:55:35 2021 +0200 pProperties in StyleSheetEntry is never nullptr so we can elide some null checks Change-Id: I6fb07daf96b76dfa9223dad64bc9690585c00b2d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118736 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 39b118e108f0..0675d62ae22f 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -2732,7 +2732,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) if( !sStyleName.isEmpty() && GetStyleSheetTable() ) pStyle = GetStyleSheetTable()->FindStyleSheetByConvertedStyleName( sStyleName ); - if( pStyle && pStyle->pProperties + if( pStyle && pStyle->pProperties->isSet(PROP_BREAK_TYPE) && pStyle->pProperties->getProperty(PROP_BREAK_TYPE)->second == aBreakType ) { diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 1ab11e0b149f..f80f73ffdd7b 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -128,8 +128,6 @@ static void lcl_linenumberingHeaderFooter( const uno::Reference<container::XName if (!pEntry) return; const StyleSheetPropertyMap* pStyleSheetProperties = pEntry->pProperties.get(); - if ( !pStyleSheetProperties ) - return; sal_Int32 nListId = pStyleSheetProperties->GetListId(); if( xStyles.is() ) { @@ -912,17 +910,14 @@ uno::Any DomainMapper_Impl::GetPropertyFromStyleSheet(PropertyIds eId, StyleShee { while(pEntry) { - if(pEntry->pProperties) + std::optional<PropertyMap::Property> aProperty = + pEntry->pProperties->getProperty(eId); + if( aProperty ) { - std::optional<PropertyMap::Property> aProperty = - pEntry->pProperties->getProperty(eId); - if( aProperty ) - { - if (pIsDocDefault) - *pIsDocDefault = pEntry->pProperties->isDocDefault(eId); + if (pIsDocDefault) + *pIsDocDefault = pEntry->pProperties->isDocDefault(eId); - return aProperty->second; - } + return aProperty->second; } //search until the property is set or no parent is available StyleSheetEntryPtr pNewEntry; @@ -1205,8 +1200,6 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( ) if ( pParaStyle ) { const StyleSheetPropertyMap* pStyleProperties = pParaStyle->pProperties.get(); - if (!pStyleProperties) - return; sal_Int32 nWidth = rAppendContext.pLastParagraphProperties->Getw() > 0 ? rAppendContext.pLastParagraphProperties->Getw() : @@ -1425,8 +1418,6 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( ) static sal_Int32 lcl_getListId(const StyleSheetEntryPtr& rEntry, const StyleSheetTablePtr& rStyleTable, bool & rNumberingFromBaseStyle) { const StyleSheetPropertyMap* pEntryProperties = rEntry->pProperties.get(); - if (!pEntryProperties) - return -1; sal_Int32 nListId = pEntryProperties->GetListId(); // The style itself has a list id. @@ -1466,8 +1457,6 @@ sal_Int16 DomainMapper_Impl::GetListLevel(const StyleSheetEntryPtr& pEntry, return -1; const StyleSheetPropertyMap* pEntryProperties = pEntry->pProperties.get(); - if (!pEntryProperties) - return -1; nListLevel = pEntryProperties->GetListLevel(); // The style itself has a list level. @@ -7613,8 +7602,6 @@ uno::Reference<container::XIndexAccess> DomainMapper_Impl::GetCurrentNumberingRu if (!pEntry) return xRet; const StyleSheetPropertyMap* pStyleSheetProperties = pEntry->pProperties.get(); - if (!pStyleSheetProperties) - return xRet; sal_Int32 nListId = pStyleSheetProperties->GetListId(); if (nListId < 0) return xRet; diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index ae9440be8381..0636c87589b1 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -1004,7 +1004,7 @@ void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable ) xStyle.set(xStyles->getByName(sConvertedStyleName), uno::UNO_QUERY_THROW); StyleSheetPropertyMap* pPropertyMap = pEntry->pProperties.get(); - if (pPropertyMap && pPropertyMap->GetListId() == -1) + if (pPropertyMap->GetListId() == -1) { // No properties? Word default is 'none', Writer one is 'arabic', handle this. uno::Reference<beans::XPropertySet> xPropertySet(xStyle, uno::UNO_QUERY_THROW); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits