diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-03-30 15:47:26 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-03-31 06:59:31 +0000 |
commit | dcffc21805828ddff7de1282f3d40ffdf3fac38d (patch) | |
tree | 1b4e81850b3fcd42cee470a18413745732c36c4a /svx/source/unodraw | |
parent | 7fca8e61ce992e9dc6f900b77142a123c0c10b6d (diff) |
use actual UNO enums in svx
Change-Id: I00f53260667861ca2595892b5605479da3401adb
Reviewed-on: https://gerrit.libreoffice.org/35913
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/unodraw')
-rw-r--r-- | svx/source/unodraw/unoshap2.cxx | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx index da4453058d24..1b1ad743f5fa 100644 --- a/svx/source/unodraw/unoshap2.cxx +++ b/svx/source/unodraw/unoshap2.cxx @@ -662,8 +662,8 @@ namespace struct EnumConversionMap { - sal_Int16 nAPIValue; - sal_Int16 nFormValue; + style::ParagraphAdjust nAPIValue; + sal_Int16 nFormValue; }; EnumConversionMap aMapAdjustToAlign[] = @@ -676,51 +676,33 @@ namespace {style::ParagraphAdjust_RIGHT, (sal_Int16)awt::TextAlign::RIGHT}, {style::ParagraphAdjust_BLOCK, (sal_Int16)awt::TextAlign::RIGHT}, {style::ParagraphAdjust_STRETCH, (sal_Int16)awt::TextAlign::LEFT}, - {-1,-1} + {(style::ParagraphAdjust)-1,-1} }; - void lcl_mapFormToAPIValue( Any& _rValue, const EnumConversionMap* _pMap ) + void lcl_convertTextAlignmentToParaAdjustment( Any& _rValue ) { sal_Int16 nValue = sal_Int16(); OSL_VERIFY( _rValue >>= nValue ); - const EnumConversionMap* pEntry = _pMap; - while ( pEntry && ( pEntry->nFormValue != -1 ) ) - { - if ( nValue == pEntry->nFormValue ) + for ( auto const & rEntry : aMapAdjustToAlign ) + if ( nValue == rEntry.nFormValue ) { - _rValue <<= pEntry->nAPIValue; + _rValue <<= rEntry.nAPIValue; return; } - ++pEntry; - } } - void lcl_mapAPIToFormValue( Any& _rValue, const EnumConversionMap* _pMap ) + void lcl_convertParaAdjustmentToTextAlignment( Any& _rValue ) { sal_Int32 nValue = 0; OSL_VERIFY( _rValue >>= nValue ); - const EnumConversionMap* pEntry = _pMap; - while ( pEntry && ( pEntry->nAPIValue != -1 ) ) - { - if ( nValue == pEntry->nAPIValue ) + for ( auto const & rEntry : aMapAdjustToAlign ) + if ( (style::ParagraphAdjust)nValue == rEntry.nAPIValue ) { - _rValue <<= pEntry->nFormValue; + _rValue <<= rEntry.nFormValue; return; } - ++pEntry; - } - } - - void lcl_convertTextAlignmentToParaAdjustment( Any& rValue ) - { - lcl_mapFormToAPIValue( rValue, aMapAdjustToAlign ); - } - - void lcl_convertParaAdjustmentToTextAlignment( Any& rValue ) - { - lcl_mapAPIToFormValue( rValue, aMapAdjustToAlign ); } void convertVerticalAdjustToVerticalAlign( Any& _rValue ) |