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;
}
template < unsigned int RowSize_ > class ImplMatLine
template < sal_uInt16 RowSize > class ImplMatLine
{
enum { RowSize = RowSize_ };
double mfValue[RowSize];
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 >* mpLine;

View File

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

View File

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

View File

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

View File

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

View File

@ -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;
};
} }

View File

@ -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;

View File

@ -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: