Kaydet (Commit) e27fbbcd authored tarafından Noel Grandin's avatar Noel Grandin

convert ExpressionFunct to scoped enum

and drop the trivial subset of it EnumFunc

Change-Id: I9ee7de829121f04e97c167b133cdc78c5ffd0822
üst 2c86c131
......@@ -194,23 +194,7 @@ class SVX_DLLPUBLIC EnhancedCustomShape2d : public SfxItemSet
EnhancedCustomShape2d( SdrObject* pSdrObjCustomShape );
virtual ~EnhancedCustomShape2d();
enum SAL_DLLPRIVATE EnumFunc
{
ENUM_FUNC_PI,
ENUM_FUNC_LEFT,
ENUM_FUNC_TOP,
ENUM_FUNC_RIGHT,
ENUM_FUNC_BOTTOM,
ENUM_FUNC_XSTRETCH,
ENUM_FUNC_YSTRETCH,
ENUM_FUNC_HASSTROKE,
ENUM_FUNC_HASFILL,
ENUM_FUNC_WIDTH,
ENUM_FUNC_HEIGHT,
ENUM_FUNC_LOGWIDTH,
ENUM_FUNC_LOGHEIGHT
};
SAL_DLLPRIVATE double GetEnumFunc( const EnumFunc eVal ) const;
SAL_DLLPRIVATE double GetEnumFunc( const EnhancedCustomShape::ExpressionFunct eVal ) const;
SAL_DLLPRIVATE double GetAdjustValueAsDouble( const sal_Int32 nIndex ) const;
SAL_DLLPRIVATE double GetEquationValueAsDouble( const sal_Int32 nIndex ) const;
......
......@@ -44,43 +44,43 @@ class EnhancedCustomShape2d;
namespace EnhancedCustomShape {
enum ExpressionFunct
enum class ExpressionFunct
{
FUNC_CONST,
ENUM_FUNC_PI,
ENUM_FUNC_LEFT,
ENUM_FUNC_TOP,
ENUM_FUNC_RIGHT,
ENUM_FUNC_BOTTOM,
ENUM_FUNC_XSTRETCH,
ENUM_FUNC_YSTRETCH,
ENUM_FUNC_HASSTROKE,
ENUM_FUNC_HASFILL,
ENUM_FUNC_WIDTH,
ENUM_FUNC_HEIGHT,
ENUM_FUNC_LOGWIDTH,
ENUM_FUNC_LOGHEIGHT,
ENUM_FUNC_ADJUSTMENT,
ENUM_FUNC_EQUATION,
UNARY_FUNC_ABS,
UNARY_FUNC_SQRT,
UNARY_FUNC_SIN,
UNARY_FUNC_COS,
UNARY_FUNC_TAN,
UNARY_FUNC_ATAN,
UNARY_FUNC_NEG,
BINARY_FUNC_PLUS,
BINARY_FUNC_MINUS,
BINARY_FUNC_MUL,
BINARY_FUNC_DIV,
BINARY_FUNC_MIN,
BINARY_FUNC_MAX,
BINARY_FUNC_ATAN2,
TERNARY_FUNC_IF
Const,
EnumPi,
EnumLeft,
EnumTop,
EnumRight,
EnumBottom,
EnumXStretch,
EnumYStretch,
EnumHasStroke,
EnumHasFill,
EnumWidth,
EnumHeight,
EnumLogWidth,
EnumLogHeight,
EnumAdjustment,
EnumEquation,
UnaryAbs,
UnarySqrt,
UnarySin,
UnaryCos,
UnaryTan,
UnaryAtan,
UnaryNeg,
BinaryPlus,
BinaryMinus,
BinaryMul,
BinaryDiv,
BinaryMin,
BinaryMax,
BinaryAtan2,
TernaryIf
};
#define EXPRESSION_FLAG_SUMANGLE_MODE 1
......
......@@ -810,24 +810,28 @@ EnhancedCustomShape2d::EnhancedCustomShape2d( SdrObject* pAObj ) :
}
}
}
double EnhancedCustomShape2d::GetEnumFunc( const EnumFunc eFunc ) const
using EnhancedCustomShape::ExpressionFunct;
double EnhancedCustomShape2d::GetEnumFunc( const ExpressionFunct eFunc ) const
{
double fRet = 0.0;
switch( eFunc )
{
case ENUM_FUNC_PI : fRet = F_PI; break;
case ENUM_FUNC_LEFT : fRet = 0.0; break;
case ENUM_FUNC_TOP : fRet = 0.0; break;
case ENUM_FUNC_RIGHT : fRet = (double)nCoordWidth * fXRatio; break;
case ENUM_FUNC_BOTTOM : fRet = (double)nCoordHeight * fYRatio; break;
case ENUM_FUNC_XSTRETCH : fRet = nXRef; break;
case ENUM_FUNC_YSTRETCH : fRet = nYRef; break;
case ENUM_FUNC_HASSTROKE : fRet = bStroked ? 1.0 : 0.0; break;
case ENUM_FUNC_HASFILL : fRet = bFilled ? 1.0 : 0.0; break;
case ENUM_FUNC_WIDTH : fRet = nCoordWidth; break;
case ENUM_FUNC_HEIGHT : fRet = nCoordHeight; break;
case ENUM_FUNC_LOGWIDTH : fRet = aLogicRect.GetWidth(); break;
case ENUM_FUNC_LOGHEIGHT : fRet = aLogicRect.GetHeight(); break;
case ExpressionFunct::EnumPi : fRet = F_PI; break;
case ExpressionFunct::EnumLeft : fRet = 0.0; break;
case ExpressionFunct::EnumTop : fRet = 0.0; break;
case ExpressionFunct::EnumRight : fRet = (double)nCoordWidth * fXRatio; break;
case ExpressionFunct::EnumBottom : fRet = (double)nCoordHeight * fYRatio; break;
case ExpressionFunct::EnumXStretch : fRet = nXRef; break;
case ExpressionFunct::EnumYStretch : fRet = nYRef; break;
case ExpressionFunct::EnumHasStroke : fRet = bStroked ? 1.0 : 0.0; break;
case ExpressionFunct::EnumHasFill : fRet = bFilled ? 1.0 : 0.0; break;
case ExpressionFunct::EnumWidth : fRet = nCoordWidth; break;
case ExpressionFunct::EnumHeight : fRet = nCoordHeight; break;
case ExpressionFunct::EnumLogWidth : fRet = aLogicRect.GetWidth(); break;
case ExpressionFunct::EnumLogHeight : fRet = aLogicRect.GetHeight(); break;
default: break;
}
return fRet;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment