sw/source/filter/ww8/ww8atr.cxx | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)
New commits: commit eb760387efbc804c8a8b0c1cc630d6dba2699284 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Wed Jan 18 08:05:49 2023 +0000 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Wed Jan 18 13:15:45 2023 +0000 Use std::clamp Change-Id: I754ec67601b45542553e1070c0eb5489ed23a722 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145714 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index b8dedd686840..fbdedc3b64c9 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -3693,15 +3693,7 @@ void AttributeOutputBase::ParaNumRule( const SwNumRuleItem& rNumRule ) { if( pTextNd->IsCountedInList()) { - int nLevel = pTextNd->GetActualListLevel(); - - if (nLevel < 0) - nLevel = 0; - - if (nLevel >= MAXLEVEL) - nLevel = MAXLEVEL - 1; - - nLvl = static_cast< sal_uInt8 >(nLevel); + nLvl = std::clamp(pTextNd->GetActualListLevel(), 0, MAXLEVEL - 1); if (GetExport().GetExportFormat() == MSWordExportBase::DOCX) // FIXME { commit 81d333990474615ba1474e4e4229588b3869424f Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Wed Jan 18 06:30:56 2023 +0000 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Wed Jan 18 13:15:39 2023 +0000 Use dynamic_cast result instead of following static_cast And make the dynamic_cast more specific, matching the now-removed unconditional static_cast. Change-Id: I322312eb8675b28af79b7cca552d6347f74c5faa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145593 Tested-by: Mike Kaganski <mike.kagan...@collabora.com> Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index d0bed9c5c5bf..b8dedd686840 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -3689,10 +3689,8 @@ void AttributeOutputBase::ParaNumRule( const SwNumRuleItem& rNumRule ) return; } - if ( dynamic_cast< const SwContentNode *>( GetExport().m_pOutFormatNode ) != nullptr ) + if (pTextNd = dynamic_cast<const SwTextNode*>(GetExport().m_pOutFormatNode); pTextNd) { - pTextNd = static_cast<const SwTextNode*>(GetExport().m_pOutFormatNode); - if( pTextNd->IsCountedInList()) { int nLevel = pTextNd->GetActualListLevel(); @@ -3761,7 +3759,7 @@ void AttributeOutputBase::ParaNumRule( const SwNumRuleItem& rNumRule ) } else if ( auto pC = dynamic_cast< const SwTextFormatColl *>( GetExport().m_pOutFormatNode ) ) { - if ( pC && pC->IsAssignedToListLevelOfOutlineStyle() ) + if (pC->IsAssignedToListLevelOfOutlineStyle()) nLvl = static_cast< sal_uInt8 >( pC->GetAssignedOutlineStyleLevel() ); else {