summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-06-21 23:10:30 +0200
committerStephan Bergmann <sbergman@redhat.com>2022-06-22 07:58:56 +0200
commit28597ee6f713baa6833e6e7837faac46ba5c173a (patch)
tree2cb9675240f54f6913f14d144969dc82655593ff /sw
parent086055b0d7e44d1d07b3f23af55503e6a3924d87 (diff)
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 <sbergman@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/unocore/unosett.cxx30
1 files changed, 13 insertions, 17 deletions
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)
{