[Libreoffice-commits] core.git: basegfx/source desktop/source oox/inc oox/source
Noel Grandin
noel.grandin at collabora.co.uk
Fri Dec 2 06:37:17 UTC 2016
basegfx/source/inc/hommatrixtemplate.hxx | 8 +---
desktop/source/deployment/registry/configuration/dp_configuration.cxx | 6 +--
desktop/source/deployment/registry/dp_backend.cxx | 14 +++----
desktop/source/deployment/registry/inc/dp_backend.h | 6 +--
desktop/source/deployment/registry/sfwk/dp_sfwk.cxx | 6 +--
oox/inc/drawingml/textspacing.hxx | 20 +++++-----
oox/source/drawingml/textparagraphpropertiescontext.cxx | 12 +++---
oox/source/drawingml/textspacingcontext.cxx | 4 +-
8 files changed, 35 insertions(+), 41 deletions(-)
New commits:
commit 1517caa433b001968643ebcdca01c53bf76034d2
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Thu Dec 1 14:18:28 2016 +0200
convert some anonymous enums to scoped
Change-Id: Ia989376c983ff475359e4964abeb1f5a2300ff5b
Reviewed-on: https://gerrit.libreoffice.org/31486
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/basegfx/source/inc/hommatrixtemplate.hxx b/basegfx/source/inc/hommatrixtemplate.hxx
index f9b3e22..08c5b53 100644
--- a/basegfx/source/inc/hommatrixtemplate.hxx
+++ b/basegfx/source/inc/hommatrixtemplate.hxx
@@ -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;
diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
index 81ef958..b274786 100644
--- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx
+++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
@@ -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 );
diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx
index 4b81c5e..7393d9b 100644
--- a/desktop/source/deployment/registry/dp_backend.cxx
+++ b/desktop/source/deployment/registry/dp_backend.cxx
@@ -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;
}
diff --git a/desktop/source/deployment/registry/inc/dp_backend.h b/desktop/source/deployment/registry/inc/dp_backend.h
index d94d30f..b126f4b 100644
--- a/desktop/source/deployment/registry/inc/dp_backend.h
+++ b/desktop/source/deployment/registry/inc/dp_backend.h
@@ -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;
diff --git a/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx b/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx
index 1e578a3..e19df09 100644
--- a/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx
+++ b/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx
@@ -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");
}
diff --git a/oox/inc/drawingml/textspacing.hxx b/oox/inc/drawingml/textspacing.hxx
index efe0dab..d1ed9a9 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 3a0eb41..460bc2e 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 fc6dfd8..f33b1c1 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:
More information about the Libreoffice-commits
mailing list