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>
This commit is contained in:
Noel Grandin 2016-12-01 14:18:28 +02:00
parent 06eb947c16
commit 1517caa433
8 changed files with 35 additions and 41 deletions

View File

@ -37,10 +37,8 @@ namespace basegfx
return 0.0; return 0.0;
} }
template < unsigned int RowSize_ > class ImplMatLine template < sal_uInt16 RowSize > class ImplMatLine
{ {
enum { RowSize = RowSize_ };
double mfValue[RowSize]; double mfValue[RowSize];
public: public:
@ -74,10 +72,8 @@ namespace basegfx
} }
}; };
template < unsigned int RowSize_ > class ImplHomMatrixTemplate template < sal_uInt16 RowSize > class ImplHomMatrixTemplate
{ {
enum { RowSize = RowSize_ };
ImplMatLine< RowSize > maLine[RowSize - 1]; ImplMatLine< RowSize > maLine[RowSize - 1];
ImplMatLine< RowSize >* mpLine; ImplMatLine< RowSize >* mpLine;

View File

@ -710,20 +710,20 @@ void BackendImpl::PackageImpl::processPackage_(
} }
//No need for live-deployment for bundled extension, because OOo //No need for live-deployment for bundled extension, because OOo
//restarts after installation //restarts after installation
if (that->m_eContext != CONTEXT_BUNDLED if (that->m_eContext != Context::Bundled
&& !startup) && !startup)
{ {
if (m_isSchema) if (m_isSchema)
{ {
css::configuration::Update::get( css::configuration::Update::get(
that->m_xComponentContext)->insertExtensionXcsFile( that->m_xComponentContext)->insertExtensionXcsFile(
that->m_eContext == CONTEXT_SHARED, expandUnoRcUrl(url)); that->m_eContext == Context::Shared, expandUnoRcUrl(url));
} }
else else
{ {
css::configuration::Update::get( css::configuration::Update::get(
that->m_xComponentContext)->insertExtensionXcuFile( that->m_xComponentContext)->insertExtensionXcuFile(
that->m_eContext == CONTEXT_SHARED, expandUnoRcUrl(url)); that->m_eContext == Context::Shared, expandUnoRcUrl(url));
} }
} }
that->addToConfigmgrIni( m_isSchema, true, url, xCmdEnv ); that->addToConfigmgrIni( m_isSchema, true, url, xCmdEnv );

View File

@ -76,7 +76,7 @@ PackageRegistryBackend::PackageRegistryBackend(
Reference<XComponentContext> const & xContext ) Reference<XComponentContext> const & xContext )
: t_BackendBase( getMutex() ), : t_BackendBase( getMutex() ),
m_xComponentContext( xContext ), m_xComponentContext( xContext ),
m_eContext( CONTEXT_UNKNOWN ), m_eContext( Context::Unknown ),
m_readOnly( false ) m_readOnly( false )
{ {
assert(xContext.is()); assert(xContext.is());
@ -89,17 +89,17 @@ PackageRegistryBackend::PackageRegistryBackend(
m_readOnly = *readOnly; m_readOnly = *readOnly;
if ( m_context == "user" ) if ( m_context == "user" )
m_eContext = CONTEXT_USER; m_eContext = Context::User;
else if ( m_context == "shared" ) else if ( m_context == "shared" )
m_eContext = CONTEXT_SHARED; m_eContext = Context::Shared;
else if ( m_context == "bundled" ) else if ( m_context == "bundled" )
m_eContext = CONTEXT_BUNDLED; m_eContext = Context::Bundled;
else if ( m_context == "tmp" ) else if ( m_context == "tmp" )
m_eContext = CONTEXT_TMP; m_eContext = Context::Tmp;
else if (m_context.matchIgnoreAsciiCase("vnd.sun.star.tdoc:/")) else if (m_context.matchIgnoreAsciiCase("vnd.sun.star.tdoc:/"))
m_eContext = CONTEXT_DOCUMENT; m_eContext = Context::Document;
else else
m_eContext = CONTEXT_UNKNOWN; m_eContext = Context::Unknown;
} }

View File

@ -286,10 +286,8 @@ protected:
OUString m_context; OUString m_context;
// currently only for library containers: // currently only for library containers:
enum { enum class Context {
CONTEXT_UNKNOWN, Unknown, User, Shared, Bundled, Tmp, Document
CONTEXT_USER, CONTEXT_SHARED,CONTEXT_BUNDLED, CONTEXT_TMP,
CONTEXT_DOCUMENT
} m_eContext; } m_eContext;
bool m_readOnly; bool m_readOnly;

View File

@ -289,15 +289,15 @@ void BackendImpl::PackageImpl:: initPackageHandler()
BackendImpl * that = getMyBackend(); BackendImpl * that = getMyBackend();
Any aContext; Any aContext;
if ( that->m_eContext == CONTEXT_USER ) if ( that->m_eContext == Context::User )
{ {
aContext <<= OUString("user"); aContext <<= OUString("user");
} }
else if ( that->m_eContext == CONTEXT_SHARED ) else if ( that->m_eContext == Context::Shared )
{ {
aContext <<= OUString("share"); aContext <<= OUString("share");
} }
else if ( that->m_eContext == CONTEXT_BUNDLED ) else if ( that->m_eContext == Context::Bundled )
{ {
aContext <<= OUString("bundled"); aContext <<= OUString("bundled");
} }

View File

@ -33,34 +33,34 @@ namespace oox { namespace drawingml {
class TextSpacing class TextSpacing
{ {
public: public:
enum { enum class Unit {
POINTS = 0, Points = 0,
PERCENT Percent
}; };
TextSpacing() 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 toLineSpacing() const
{ {
css::style::LineSpacing aSpacing; css::style::LineSpacing aSpacing;
aSpacing.Mode = ( nUnit == PERCENT aSpacing.Mode = ( nUnit == Unit::Percent
? css::style::LineSpacingMode::PROP ? css::style::LineSpacingMode::PROP
: css::style::LineSpacingMode::MINIMUM ); : 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; return aSpacing;
} }
sal_Int32 toMargin( float fFontSize ) const sal_Int32 toMargin( float fFontSize ) const
{ {
if ( nUnit == PERCENT ) if ( nUnit == Unit::Percent )
return GetTextSpacingPoint(static_cast<sal_Int32>((fFontSize*nValue)/1000)); return GetTextSpacingPoint(static_cast<sal_Int32>((fFontSize*nValue)/1000));
else else
return nValue; return nValue;
} }
sal_Int32 nUnit; Unit nUnit;
sal_Int32 nValue; sal_Int32 nValue;
bool bHasValue; bool bHasValue;
}; };
} } } }

View File

@ -270,7 +270,7 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl
if (oBefore.has()) if (oBefore.has())
{ {
TextSpacing& rSpacing = mrTextParagraphProperties.getParaTopMargin(); TextSpacing& rSpacing = mrTextParagraphProperties.getParaTopMargin();
rSpacing.nUnit = TextSpacing::POINTS; rSpacing.nUnit = TextSpacing::Unit::Points;
rSpacing.nValue = TWIPS_TO_MM(oBefore.get()); rSpacing.nValue = TWIPS_TO_MM(oBefore.get());
rSpacing.bHasValue = true; rSpacing.bHasValue = true;
} }
@ -280,7 +280,7 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl
if (oBeforeLines.has()) if (oBeforeLines.has())
{ {
TextSpacing& rSpacing = mrTextParagraphProperties.getParaTopMargin(); TextSpacing& rSpacing = mrTextParagraphProperties.getParaTopMargin();
rSpacing.nUnit = TextSpacing::PERCENT; rSpacing.nUnit = TextSpacing::Unit::Percent;
rSpacing.nValue = oBeforeLines.get() * MAX_PERCENT / 100; rSpacing.nValue = oBeforeLines.get() * MAX_PERCENT / 100;
rSpacing.bHasValue = true; rSpacing.bHasValue = true;
} }
@ -294,7 +294,7 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl
if (oAfter.has()) if (oAfter.has())
{ {
TextSpacing& rSpacing = mrTextParagraphProperties.getParaBottomMargin(); TextSpacing& rSpacing = mrTextParagraphProperties.getParaBottomMargin();
rSpacing.nUnit = TextSpacing::POINTS; rSpacing.nUnit = TextSpacing::Unit::Points;
rSpacing.nValue = TWIPS_TO_MM(oAfter.get()); rSpacing.nValue = TWIPS_TO_MM(oAfter.get());
rSpacing.bHasValue = true; rSpacing.bHasValue = true;
} }
@ -304,7 +304,7 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl
if (oAfterLines.has()) if (oAfterLines.has())
{ {
TextSpacing& rSpacing = mrTextParagraphProperties.getParaBottomMargin(); TextSpacing& rSpacing = mrTextParagraphProperties.getParaBottomMargin();
rSpacing.nUnit = TextSpacing::PERCENT; rSpacing.nUnit = TextSpacing::Unit::Percent;
rSpacing.nValue = oAfterLines.get() * MAX_PERCENT / 100; rSpacing.nValue = oAfterLines.get() * MAX_PERCENT / 100;
rSpacing.bHasValue = true; rSpacing.bHasValue = true;
} }
@ -318,12 +318,12 @@ ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl
{ {
if( !oLineRule.has() || oLineRule.get() == "auto" ) if( !oLineRule.has() || oLineRule.get() == "auto" )
{ {
maLineSpacing.nUnit = TextSpacing::PERCENT; maLineSpacing.nUnit = TextSpacing::Unit::Percent;
maLineSpacing.nValue = oLineSpacing.get() * MAX_PERCENT / 240; maLineSpacing.nValue = oLineSpacing.get() * MAX_PERCENT / 240;
} }
else else
{ {
maLineSpacing.nUnit = TextSpacing::POINTS; maLineSpacing.nUnit = TextSpacing::Unit::Points;
maLineSpacing.nValue = TWIPS_TO_MM(oLineSpacing.get()); maLineSpacing.nValue = TWIPS_TO_MM(oLineSpacing.get());
} }
maLineSpacing.bHasValue = true; maLineSpacing.bHasValue = true;

View File

@ -43,11 +43,11 @@ namespace oox { namespace drawingml {
switch( aElement ) switch( aElement )
{ {
case A_TOKEN( spcPct ): case A_TOKEN( spcPct ):
maSpacing.nUnit = TextSpacing::PERCENT; maSpacing.nUnit = TextSpacing::Unit::Percent;
maSpacing.nValue = GetPercent( rAttribs.getString( XML_val ).get() ); maSpacing.nValue = GetPercent( rAttribs.getString( XML_val ).get() );
break; break;
case A_TOKEN( spcPts ): case A_TOKEN( spcPts ):
maSpacing.nUnit = TextSpacing::POINTS; maSpacing.nUnit = TextSpacing::Unit::Points;
maSpacing.nValue = GetTextSpacingPoint( rAttribs.getString( XML_val ).get() ); maSpacing.nValue = GetTextSpacingPoint( rAttribs.getString( XML_val ).get() );
break; break;
default: default: