convert ScaCategory to scoped enum

and drop unused AddIn constant

Change-Id: I4422f34db756649cb08aa9aa7f975cef73ccfa91
This commit is contained in:
Noel Grandin
2017-02-07 09:37:01 +02:00
parent de9c7e4d94
commit 75b7b685ce
2 changed files with 23 additions and 27 deletions

View File

@@ -52,14 +52,14 @@ ScaResId::ScaResId( sal_uInt16 nId, ResMgr& rResMgr ) :
const ScaFuncDataBase pFuncDataArr[] =
{
FUNCDATA( DiffWeeks, 3, ScaCat_DateTime, UNIQUE, INTPAR ),
FUNCDATA( DiffMonths, 3, ScaCat_DateTime, UNIQUE, INTPAR ),
FUNCDATA( DiffYears, 3, ScaCat_DateTime, UNIQUE, INTPAR ),
FUNCDATA( IsLeapYear, 1, ScaCat_DateTime, UNIQUE, INTPAR ),
FUNCDATA( DaysInMonth, 1, ScaCat_DateTime, UNIQUE, INTPAR ),
FUNCDATA( DaysInYear, 1, ScaCat_DateTime, UNIQUE, INTPAR ),
FUNCDATA( WeeksInYear, 1, ScaCat_DateTime, UNIQUE, INTPAR ),
FUNCDATA( Rot13, 1, ScaCat_Text, UNIQUE, STDPAR )
FUNCDATA( DiffWeeks, 3, ScaCategory::DateTime, UNIQUE, INTPAR ),
FUNCDATA( DiffMonths, 3, ScaCategory::DateTime, UNIQUE, INTPAR ),
FUNCDATA( DiffYears, 3, ScaCategory::DateTime, UNIQUE, INTPAR ),
FUNCDATA( IsLeapYear, 1, ScaCategory::DateTime, UNIQUE, INTPAR ),
FUNCDATA( DaysInMonth, 1, ScaCategory::DateTime, UNIQUE, INTPAR ),
FUNCDATA( DaysInYear, 1, ScaCategory::DateTime, UNIQUE, INTPAR ),
FUNCDATA( WeeksInYear, 1, ScaCategory::DateTime, UNIQUE, INTPAR ),
FUNCDATA( Rot13, 1, ScaCategory::Text, UNIQUE, STDPAR )
};
#undef FUNCDATA
@@ -353,15 +353,12 @@ OUString SAL_CALL ScaDateAddIn::getProgrammaticCategoryName(
{
switch( fDataIt->GetCategory() )
{
case ScaCat_DateTime: aRet = STR_FROM_ANSI( "Date&Time" ); break;
case ScaCat_Text: aRet = STR_FROM_ANSI( "Text" ); break;
case ScaCat_Finance: aRet = STR_FROM_ANSI( "Financial" ); break;
case ScaCat_Inf: aRet = STR_FROM_ANSI( "Information" ); break;
case ScaCat_Math: aRet = STR_FROM_ANSI( "Mathematical" ); break;
case ScaCat_Tech: aRet = STR_FROM_ANSI( "Technical" ); break;
// coverity[dead_error_begin] - following conditions exist to avoid compiler warning
default:
break;
case ScaCategory::DateTime: aRet = STR_FROM_ANSI( "Date&Time" ); break;
case ScaCategory::Text: aRet = STR_FROM_ANSI( "Text" ); break;
case ScaCategory::Finance: aRet = STR_FROM_ANSI( "Financial" ); break;
case ScaCategory::Inf: aRet = STR_FROM_ANSI( "Information" ); break;
case ScaCategory::Math: aRet = STR_FROM_ANSI( "Mathematical" ); break;
case ScaCategory::Tech: aRet = STR_FROM_ANSI( "Technical" ); break;
}
}

View File

@@ -102,15 +102,14 @@ public:
};
enum ScaCategory
enum class ScaCategory
{
ScaCat_AddIn,
ScaCat_DateTime,
ScaCat_Text,
ScaCat_Finance,
ScaCat_Inf,
ScaCat_Math,
ScaCat_Tech
DateTime,
Text,
Finance,
Inf,
Math,
Tech
};
struct ScaFuncDataBase
@@ -121,8 +120,8 @@ struct ScaFuncDataBase
sal_uInt16 nCompListID; // resource ID to list of valid names
sal_uInt16 nParamCount; // number of named / described parameters
ScaCategory eCat; // function category
bool bDouble; // name already exist in Calc
bool bWithOpt; // first parameter is internal
bool bDouble; // name already exist in Calc
bool bWithOpt; // first parameter is internal
};
class ScaFuncData final