sw/source/core/unocore/unosett.cxx | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-)
New commits: commit 28597ee6f713baa6833e6e7837faac46ba5c173a Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Tue Jun 21 23:10:30 2022 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Wed Jun 22 07:58:56 2022 +0200 Make code a bit more explicit ...and avoid the ugly unsigned short vs. SvxAdjust mismatch Change-Id: Ie820b5fda00942d258668535598027f9d878c013 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136264 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index a871d4f1c844..dcc6f1fb7abd 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -250,16 +250,6 @@ const o3tl::enumarray<SvxAdjust, sal_Int16> aSvxToUnoAdjust sal_Int16(-1) }; -const unsigned short aUnoToSvxAdjust[] = -{ - USHRT_MAX, - static_cast<unsigned short>(SvxAdjust::Right), // 1 - static_cast<unsigned short>(SvxAdjust::Center), // 3 - static_cast<unsigned short>(SvxAdjust::Left), // 0 - USHRT_MAX, - USHRT_MAX -}; - OUString SwXFootnoteProperties::getImplementationName() { return "SwXFootnoteProperties"; @@ -1537,14 +1527,20 @@ void SwXNumberingRules::SetPropertiesToNumFormat( { sal_Int16 nValue = text::HoriOrientation::NONE; rProp.Value >>= nValue; - if (nValue > text::HoriOrientation::NONE && - nValue <= text::HoriOrientation::LEFT && - USHRT_MAX != aUnoToSvxAdjust[nValue]) - { - aFormat.SetNumAdjust(static_cast<SvxAdjust>(aUnoToSvxAdjust[nValue])); - } - else + switch (nValue) { + case text::HoriOrientation::RIGHT: + aFormat.SetNumAdjust(SvxAdjust::Right); + break; + case text::HoriOrientation::CENTER: + aFormat.SetNumAdjust(SvxAdjust::Center); + break; + case text::HoriOrientation::LEFT: + aFormat.SetNumAdjust(SvxAdjust::Left); + break; + default: bWrongArg = true; + break; + } } else if (rProp.Name == UNO_NAME_PARENT_NUMBERING) {