Kaydet (Commit) 0c57f31a authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Noel Grandin

convert ParamType enum in SC to enum class

mostly to get the NONE constant out of the global namespace, so I can
convert other enums which also want to use the NONE constant

Change-Id: I988d5d7e5316dd5e4ca0be0cc8f043f69bbb900c
Reviewed-on: https://gerrit.libreoffice.org/11848Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
Tested-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst 8d174943
......@@ -37,7 +37,7 @@ extern "C" {
typedef void (CALLTYPE* AdvData)( double& nHandle, void* pData );
}
enum ParamType
enum class ParamType
{
PTR_DOUBLE,
PTR_STRING,
......
......@@ -483,19 +483,19 @@ ScFunctionList::ScFunctionList() :
{
switch (pAddInFuncData->GetParamType(j+1))
{
case PTR_DOUBLE:
case ParamType::PTR_DOUBLE:
pDesc->maDefArgNames[j] = aDefArgNameValue;
break;
case PTR_STRING:
case ParamType::PTR_STRING:
pDesc->maDefArgNames[j] = aDefArgNameString;
break;
case PTR_DOUBLE_ARR:
case ParamType::PTR_DOUBLE_ARR:
pDesc->maDefArgNames[j] = aDefArgNameValues;
break;
case PTR_STRING_ARR:
case ParamType::PTR_STRING_ARR:
pDesc->maDefArgNames[j] = aDefArgNameStrings;
break;
case PTR_CELL_ARR:
case ParamType::PTR_CELL_ARR:
pDesc->maDefArgNames[j] = aDefArgNameCells;
break;
default:
......@@ -509,19 +509,19 @@ ScFunctionList::ScFunctionList() :
{
switch (pAddInFuncData->GetParamType(j+1))
{
case PTR_DOUBLE:
case ParamType::PTR_DOUBLE:
pDesc->maDefArgDescs[j] = aDefArgDescValue;
break;
case PTR_STRING:
case ParamType::PTR_STRING:
pDesc->maDefArgDescs[j] = aDefArgDescString;
break;
case PTR_DOUBLE_ARR:
case ParamType::PTR_DOUBLE_ARR:
pDesc->maDefArgDescs[j] = aDefArgDescValues;
break;
case PTR_STRING_ARR:
case ParamType::PTR_STRING_ARR:
pDesc->maDefArgDescs[j] = aDefArgDescStrings;
break;
case PTR_CELL_ARR:
case ParamType::PTR_CELL_ARR:
pDesc->maDefArgDescs[j] = aDefArgDescCells;
break;
default:
......
......@@ -41,7 +41,7 @@ ScAddInAsync::ScAddInAsync() :
pDocs( NULL ),
mpFuncData( NULL ),
nHandle( 0 ),
meType( NONE ),
meType( ParamType::NONE ),
bValid( false )
{ // nur fuer aSeekObj !
}
......@@ -66,7 +66,7 @@ ScAddInAsync::~ScAddInAsync()
{
// in dTor because of theAddInAsyncTbl.DeleteAndDestroy in ScGlobal::Clear
mpFuncData->Unadvice( (double)nHandle );
if ( meType == PTR_STRING && pStr ) // include type comparison because of union
if ( meType == ParamType::PTR_STRING && pStr ) // include type comparison because of union
delete pStr;
delete pDocs;
}
......@@ -98,10 +98,10 @@ void ScAddInAsync::CallBack( sal_uLong nHandleP, void* pData )
}
switch ( p->meType )
{
case PTR_DOUBLE :
case ParamType::PTR_DOUBLE :
p->nVal = *(double*)pData;
break;
case PTR_STRING :
case ParamType::PTR_STRING :
{
sal_Char* pChar = (sal_Char*)pData;
if ( p->pStr )
......
......@@ -206,21 +206,21 @@ bool InitExternalFunc(const OUString& rModuleName)
sal_Char cInternalName[256];
sal_uInt16 nParamCount;
ParamType eParamType[MAXFUNCPARAM];
ParamType eAsyncType = NONE;
ParamType eAsyncType = ParamType::NONE;
// initialize all, in case the AddIn behaves bad
cFuncName[0] = 0;
cInternalName[0] = 0;
nParamCount = 0;
for ( sal_uInt16 j=0; j<MAXFUNCPARAM; j++ )
{
eParamType[j] = NONE;
eParamType[j] = ParamType::NONE;
}
(*((GetFuncDataPtr)fpGetData))(i, cFuncName, nParamCount,
eParamType, cInternalName);
if( fpIsAsync )
{
(*((IsAsync)fpIsAsync))(i, &eAsyncType);
if ( fpAdvice && eAsyncType != NONE )
if ( fpAdvice && eAsyncType != ParamType::NONE )
(*((Advice)fpAdvice))( i, pfCallBack );
}
OUString aInternalName( cInternalName, strlen(cInternalName), osl_getThreadTextEncoding() );
......
......@@ -2492,13 +2492,13 @@ void ScInterpreter::ScExternal()
{
switch (eParamType[i])
{
case PTR_DOUBLE :
case ParamType::PTR_DOUBLE :
{
nVal[i-1] = GetDouble();
ppParam[i] = &nVal[i-1];
}
break;
case PTR_STRING :
case ParamType::PTR_STRING :
{
OString aStr(OUStringToOString(GetString().getString(),
osl_getThreadTextEncoding()));
......@@ -2513,7 +2513,7 @@ void ScInterpreter::ScExternal()
}
}
break;
case PTR_DOUBLE_ARR :
case ParamType::PTR_DOUBLE_ARR :
{
SCCOL nCol1;
SCROW nRow1;
......@@ -2529,7 +2529,7 @@ void ScInterpreter::ScExternal()
ppParam[i] = pCellArr[i-1];
}
break;
case PTR_STRING_ARR :
case ParamType::PTR_STRING_ARR :
{
SCCOL nCol1;
SCROW nRow1;
......@@ -2545,7 +2545,7 @@ void ScInterpreter::ScExternal()
ppParam[i] = pCellArr[i-1];
}
break;
case PTR_CELL_ARR :
case ParamType::PTR_CELL_ARR :
{
SCCOL nCol1;
SCROW nRow1;
......@@ -2571,11 +2571,11 @@ void ScInterpreter::ScExternal()
if (nGlobalError == 0)
{
if ( pFuncData->GetAsyncType() == NONE )
if ( pFuncData->GetAsyncType() == ParamType::NONE )
{
switch ( eParamType[0] )
{
case PTR_DOUBLE :
case ParamType::PTR_DOUBLE :
{
double nErg = 0.0;
ppParam[0] = &nErg;
......@@ -2583,7 +2583,7 @@ void ScInterpreter::ScExternal()
PushDouble(nErg);
}
break;
case PTR_STRING :
case ParamType::PTR_STRING :
{
boost::scoped_array<sal_Char> pcErg(new sal_Char[ADDIN_MAXSTRLEN]);
ppParam[0] = pcErg.get();
......@@ -2627,10 +2627,10 @@ void ScInterpreter::ScExternal()
{
switch ( pAs->GetType() )
{
case PTR_DOUBLE :
case ParamType::PTR_DOUBLE :
PushDouble( pAs->GetValue() );
break;
case PTR_STRING :
case ParamType::PTR_STRING :
PushString( pAs->GetString() );
break;
default:
......
......@@ -361,8 +361,8 @@ ScParameterClassification::GetExternalParameterType( const formula::FormulaToken
{
switch ( pFuncData->GetParamType( nParameter) )
{
case PTR_DOUBLE:
case PTR_STRING:
case ParamType::PTR_DOUBLE:
case ParamType::PTR_STRING:
eRet = Value;
break;
default:
......
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