From 954f752cf10fc6a8777af2a6a93e496688464687 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 20 Sep 2016 16:41:39 +0200 Subject: convert MapUnit to scoped enum I left a prefix on the names "Map" so that I would not have to re-arrange each name too much, since I can't start identifiers with digits like "100thMM" And remove RSC_EXTRAMAPUNIT, which doesn't seem to be doing anything anymore. Change-Id: I5187824aa87e30caf5357b51b5384b5ab919d224 Reviewed-on: https://gerrit.libreoffice.org/29096 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- editeng/source/uno/unoipset.cxx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'editeng/source/uno') diff --git a/editeng/source/uno/unoipset.cxx b/editeng/source/uno/unoipset.cxx index 31f7e48ea8e1..60bac11af009 100644 --- a/editeng/source/uno/unoipset.cxx +++ b/editeng/source/uno/unoipset.cxx @@ -103,9 +103,9 @@ uno::Any SvxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry* if( nullptr == pItem && pPool ) pItem = &(pPool->GetDefaultItem( pMap->nWID )); - const MapUnit eMapUnit = pPool ? pPool->GetMetric((sal_uInt16)pMap->nWID) : MAP_100TH_MM; + const MapUnit eMapUnit = pPool ? pPool->GetMetric((sal_uInt16)pMap->nWID) : MapUnit::Map100thMM; sal_uInt8 nMemberId = pMap->nMemberId & (~SFX_METRIC_ITEM); - if( eMapUnit == MAP_100TH_MM ) + if( eMapUnit == MapUnit::Map100thMM ) nMemberId &= (~CONVERT_TWIPS); if(pItem) @@ -113,7 +113,7 @@ uno::Any SvxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry* pItem->QueryValue( aVal, nMemberId ); if( pMap->nMemberId & SFX_METRIC_ITEM ) { - if( eMapUnit != MAP_100TH_MM ) + if( eMapUnit != MapUnit::Map100thMM ) { if ( !bDontConvertNegativeValues || SvxUnoCheckForPositiveValue( aVal ) ) SvxUnoConvertToMM( eMapUnit, aVal ); @@ -164,10 +164,10 @@ void SvxItemPropertySet::setPropertyValue( const SfxItemPropertySimpleEntry* pMa { uno::Any aValue( rVal ); - const MapUnit eMapUnit = pPool ? pPool->GetMetric((sal_uInt16)pMap->nWID) : MAP_100TH_MM; + const MapUnit eMapUnit = pPool ? pPool->GetMetric((sal_uInt16)pMap->nWID) : MapUnit::Map100thMM; // check for needed metric translation - if( (pMap->nMemberId & SFX_METRIC_ITEM) && eMapUnit != MAP_100TH_MM ) + if( (pMap->nMemberId & SFX_METRIC_ITEM) && eMapUnit != MapUnit::Map100thMM ) { if ( !bDontConvertNegativeValues || SvxUnoCheckForPositiveValue( aValue ) ) SvxUnoConvertFromMM( eMapUnit, aValue ); @@ -176,7 +176,7 @@ void SvxItemPropertySet::setPropertyValue( const SfxItemPropertySimpleEntry* pMa SfxPoolItem *pNewItem = pItem->Clone(); sal_uInt8 nMemberId = pMap->nMemberId & (~SFX_METRIC_ITEM); - if( eMapUnit == MAP_100TH_MM ) + if( eMapUnit == MapUnit::Map100thMM ) nMemberId &= (~CONVERT_TWIPS); if( pNewItem->PutValue( aValue, nMemberId ) ) @@ -200,7 +200,7 @@ uno::Any SvxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry* // No UsrAny detected yet, generate Default entry and return this const MapUnit eMapUnit = mrItemPool.GetMetric((sal_uInt16)pMap->nWID); sal_uInt8 nMemberId = pMap->nMemberId & (~SFX_METRIC_ITEM); - if( eMapUnit == MAP_100TH_MM ) + if( eMapUnit == MapUnit::Map100thMM ) nMemberId &= (~CONVERT_TWIPS); uno::Any aVal; SfxItemSet aSet( mrItemPool, pMap->nWID, pMap->nWID); @@ -226,7 +226,7 @@ uno::Any SvxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry* if( pMap->nMemberId & SFX_METRIC_ITEM ) { // check for needed metric translation - if(pMap->nMemberId & SFX_METRIC_ITEM && eMapUnit != MAP_100TH_MM) + if(pMap->nMemberId & SFX_METRIC_ITEM && eMapUnit != MapUnit::Map100thMM) { SvxUnoConvertToMM( eMapUnit, aVal ); } @@ -282,7 +282,7 @@ void SvxUnoConvertToMM( const MapUnit eSourceMapUnit, uno::Any & rMetric ) throw // map the metric of the itempool to 100th mm switch(eSourceMapUnit) { - case MAP_TWIP : + case MapUnit::MapTwip : { switch( rMetric.getValueTypeClass() ) { @@ -319,7 +319,7 @@ void SvxUnoConvertFromMM( const MapUnit eDestinationMapUnit, uno::Any & rMetric { switch(eDestinationMapUnit) { - case MAP_TWIP : + case MapUnit::MapTwip : { switch( rMetric.getValueTypeClass() ) { -- cgit