diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-12-01 14:18:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-12-02 06:36:48 +0000 |
commit | 1517caa433b001968643ebcdca01c53bf76034d2 (patch) | |
tree | 75adad41c99afe90eee48f866f99784e24acd2e3 /oox | |
parent | 06eb947c1651cb623cd60d81b08281de4cc6a86b (diff) |
convert some anonymous enums to scoped
Change-Id: Ia989376c983ff475359e4964abeb1f5a2300ff5b
Reviewed-on: https://gerrit.libreoffice.org/31486
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/inc/drawingml/textspacing.hxx | 20 | ||||
-rw-r--r-- | oox/source/drawingml/textparagraphpropertiescontext.cxx | 12 | ||||
-rw-r--r-- | oox/source/drawingml/textspacingcontext.cxx | 4 |
3 files changed, 18 insertions, 18 deletions
diff --git a/oox/inc/drawingml/textspacing.hxx b/oox/inc/drawingml/textspacing.hxx index efe0dab06674..d1ed9a988169 100644 --- a/oox/inc/drawingml/textspacing.hxx +++ b/oox/inc/drawingml/textspacing.hxx @@ -33,34 +33,34 @@ namespace oox { namespace drawingml { class TextSpacing { public: - enum { - POINTS = 0, - PERCENT + enum class Unit { + Points = 0, + Percent }; TextSpacing() - : nUnit( POINTS ), nValue( 0 ), bHasValue( false ) + : nUnit( Unit::Points ), nValue( 0 ), bHasValue( false ) { } - TextSpacing( sal_Int32 nPoints ) : nUnit( POINTS ), nValue( nPoints ), bHasValue( true ){}; + TextSpacing( sal_Int32 nPoints ) : nUnit( Unit::Points ), nValue( nPoints ), bHasValue( true ){}; css::style::LineSpacing toLineSpacing() const { css::style::LineSpacing aSpacing; - aSpacing.Mode = ( nUnit == PERCENT + aSpacing.Mode = ( nUnit == Unit::Percent ? css::style::LineSpacingMode::PROP : css::style::LineSpacingMode::MINIMUM ); - aSpacing.Height = static_cast< sal_Int16 >( nUnit == PERCENT ? nValue / 1000 : nValue ); + aSpacing.Height = static_cast< sal_Int16 >( nUnit == Unit::Percent ? nValue / 1000 : nValue ); return aSpacing; } sal_Int32 toMargin( float fFontSize ) const { - if ( nUnit == PERCENT ) + if ( nUnit == Unit::Percent ) return GetTextSpacingPoint(static_cast<sal_Int32>((fFontSize*nValue)/1000)); else return nValue; } - sal_Int32 nUnit; + Unit nUnit; sal_Int32 nValue; - bool bHasValue; + bool bHasValue; }; } } diff --git a/oox/source/drawingml/textparagraphpropertiescontext.cxx b/oox/source/drawingml/textparagraphpropertiescontext.cxx index 3a0eb4156849..460bc2e2d4d6 100644 --- a/oox/source/drawingml/textparagraphpropertiescontext.cxx +++ b/oox/source/drawingml/textparagraphpropertiescontext.cxx @@ -270,7 +270,7 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl if (oBefore.has()) { TextSpacing& rSpacing = mrTextParagraphProperties.getParaTopMargin(); - rSpacing.nUnit = TextSpacing::POINTS; + rSpacing.nUnit = TextSpacing::Unit::Points; rSpacing.nValue = TWIPS_TO_MM(oBefore.get()); rSpacing.bHasValue = true; } @@ -280,7 +280,7 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl if (oBeforeLines.has()) { TextSpacing& rSpacing = mrTextParagraphProperties.getParaTopMargin(); - rSpacing.nUnit = TextSpacing::PERCENT; + rSpacing.nUnit = TextSpacing::Unit::Percent; rSpacing.nValue = oBeforeLines.get() * MAX_PERCENT / 100; rSpacing.bHasValue = true; } @@ -294,7 +294,7 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl if (oAfter.has()) { TextSpacing& rSpacing = mrTextParagraphProperties.getParaBottomMargin(); - rSpacing.nUnit = TextSpacing::POINTS; + rSpacing.nUnit = TextSpacing::Unit::Points; rSpacing.nValue = TWIPS_TO_MM(oAfter.get()); rSpacing.bHasValue = true; } @@ -304,7 +304,7 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl if (oAfterLines.has()) { TextSpacing& rSpacing = mrTextParagraphProperties.getParaBottomMargin(); - rSpacing.nUnit = TextSpacing::PERCENT; + rSpacing.nUnit = TextSpacing::Unit::Percent; rSpacing.nValue = oAfterLines.get() * MAX_PERCENT / 100; rSpacing.bHasValue = true; } @@ -318,12 +318,12 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl { if( !oLineRule.has() || oLineRule.get() == "auto" ) { - maLineSpacing.nUnit = TextSpacing::PERCENT; + maLineSpacing.nUnit = TextSpacing::Unit::Percent; maLineSpacing.nValue = oLineSpacing.get() * MAX_PERCENT / 240; } else { - maLineSpacing.nUnit = TextSpacing::POINTS; + maLineSpacing.nUnit = TextSpacing::Unit::Points; maLineSpacing.nValue = TWIPS_TO_MM(oLineSpacing.get()); } maLineSpacing.bHasValue = true; diff --git a/oox/source/drawingml/textspacingcontext.cxx b/oox/source/drawingml/textspacingcontext.cxx index fc6dfd813139..f33b1c10a4e5 100644 --- a/oox/source/drawingml/textspacingcontext.cxx +++ b/oox/source/drawingml/textspacingcontext.cxx @@ -43,11 +43,11 @@ namespace oox { namespace drawingml { switch( aElement ) { case A_TOKEN( spcPct ): - maSpacing.nUnit = TextSpacing::PERCENT; + maSpacing.nUnit = TextSpacing::Unit::Percent; maSpacing.nValue = GetPercent( rAttribs.getString( XML_val ).get() ); break; case A_TOKEN( spcPts ): - maSpacing.nUnit = TextSpacing::POINTS; + maSpacing.nUnit = TextSpacing::Unit::Points; maSpacing.nValue = GetTextSpacingPoint( rAttribs.getString( XML_val ).get() ); break; default: |