More elimination of single-parameter methods from ScMatrix.

This commit is contained in:
Kohei Yoshida 2010-11-07 00:15:52 -04:00
parent 9c9e4c463f
commit 394aa60d67
5 changed files with 31 additions and 59 deletions

View file

@ -298,9 +298,7 @@ public:
void PutEmpty( SCSIZE nC, SCSIZE nR);
/// Jump FALSE without path
void PutEmptyPath( SCSIZE nC, SCSIZE nR);
void PutEmptyPath( SCSIZE nIndex);
void PutError( USHORT nErrorCode, SCSIZE nC, SCSIZE nR );
void PutError( USHORT nErrorCode, SCSIZE nIndex );
void PutBoolean( bool bVal, SCSIZE nC, SCSIZE nR);
void PutBoolean( bool bVal, SCSIZE nIndex);
@ -319,8 +317,6 @@ public:
@returns 0 if no error or string element, else one of err... constants */
USHORT GetErrorIfNotString( SCSIZE nC, SCSIZE nR) const
{ return IsValue( nC, nR) ? GetError( nC, nR) : 0; }
USHORT GetErrorIfNotString( SCSIZE nIndex) const
{ return IsValue( nIndex) ? GetError( nIndex) : 0; }
/// @return 0.0 if empty or empty path, else value or DoubleError.
double GetDouble( SCSIZE nC, SCSIZE nR) const;

View file

@ -660,7 +660,7 @@ bool ScValidationData::GetSelectionFromFormula( TypedScStrCollection* pStrings,
* rStrResult += ScGlobal::GetLongErrorString(nErrCode);
*/
xMatRef->PutError( nErrCode, 0);
xMatRef->PutError( nErrCode, 0, 0);
bOk = false;
}
else if (aValidationSrc.HasValueData())

View file

@ -2144,8 +2144,8 @@ void ScInterpreter::ScIsValue()
; // nothing
else if ( !pJumpMatrix )
{
if (pMat->GetErrorIfNotString( 0 ) == 0)
nRes = pMat->IsValue( 0 );
if (pMat->GetErrorIfNotString( 0, 0) == 0)
nRes = pMat->IsValue( 0, 0);
}
else
{
@ -2250,7 +2250,7 @@ void ScInterpreter::ScIsNV()
if ( !pMat )
; // nothing
else if ( !pJumpMatrix )
nRes = (pMat->GetErrorIfNotString( 0 ) == NOTAVAILABLE);
nRes = (pMat->GetErrorIfNotString( 0, 0) == NOTAVAILABLE);
else
{
SCSIZE nCols, nRows, nC, nR;
@ -2300,7 +2300,7 @@ void ScInterpreter::ScIsErr()
nRes = ((nGlobalError && nGlobalError != NOTAVAILABLE) || !pMat);
else if ( !pJumpMatrix )
{
USHORT nErr = pMat->GetErrorIfNotString( 0 );
USHORT nErr = pMat->GetErrorIfNotString( 0, 0);
nRes = (nErr && nErr != NOTAVAILABLE);
}
else
@ -2357,7 +2357,7 @@ void ScInterpreter::ScIsError()
if ( nGlobalError || !pMat )
nRes = 1;
else if ( !pJumpMatrix )
nRes = (pMat->GetErrorIfNotString( 0 ) != 0);
nRes = (pMat->GetErrorIfNotString( 0, 0) != 0);
else
{
SCSIZE nCols, nRows, nC, nR;

View file

@ -1339,41 +1339,43 @@ void ScInterpreter::ScAmpersand()
ScMatrixRef pResMat = GetNewMat(nC, nR);
if (pResMat)
{
SCSIZE nCount = nC * nR;
if (nGlobalError)
{
for ( SCSIZE i = 0; i < nCount; i++ )
pResMat->PutError( nGlobalError, i);
for (SCSIZE i = 0; i < nC; ++i)
for (SCSIZE j = 0; j < nR; ++j)
pResMat->PutError( nGlobalError, i, j);
}
else if (bFlag)
{
for ( SCSIZE i = 0; i < nCount; i++ )
{
USHORT nErr = pMat->GetErrorIfNotString( i);
if (nErr)
pResMat->PutError( nErr, i);
else
for (SCSIZE i = 0; i < nC; ++i)
for (SCSIZE j = 0; j < nR; ++j)
{
String aTmp( sStr);
aTmp += pMat->GetString( *pFormatter, i);
pResMat->PutString( aTmp, i);
USHORT nErr = pMat->GetErrorIfNotString( i, j);
if (nErr)
pResMat->PutError( nErr, i, j);
else
{
String aTmp( sStr);
aTmp += pMat->GetString( *pFormatter, i, j);
pResMat->PutString( aTmp, i, j);
}
}
}
}
else
{
for ( SCSIZE i = 0; i < nCount; i++ )
{
USHORT nErr = pMat->GetErrorIfNotString( i);
if (nErr)
pResMat->PutError( nErr, i);
else
for (SCSIZE i = 0; i < nC; ++i)
for (SCSIZE j = 0; j < nR; ++j)
{
String aTmp( pMat->GetString( *pFormatter, i));
aTmp += sStr;
pResMat->PutString( aTmp, i);
USHORT nErr = pMat->GetErrorIfNotString( i, j);
if (nErr)
pResMat->PutError( nErr, i, j);
else
{
String aTmp( pMat->GetString( *pFormatter, i, j));
aTmp += sStr;
pResMat->PutString( aTmp, i, j);
}
}
}
}
PushMatrix(pResMat);
}

View file

@ -181,9 +181,7 @@ public:
void PutEmpty(SCSIZE nC, SCSIZE nR);
void PutEmptyPath(SCSIZE nC, SCSIZE nR);
void PutEmptyPath(SCSIZE nIndex);
void PutError( USHORT nErrorCode, SCSIZE nC, SCSIZE nR );
void PutError( USHORT nErrorCode, SCSIZE nIndex );
void PutBoolean(bool bVal, SCSIZE nC, SCSIZE nR);
void PutBoolean( bool bVal, SCSIZE nIndex);
USHORT GetError( SCSIZE nC, SCSIZE nR) const;
@ -385,25 +383,11 @@ void ScMatrixImpl::PutEmptyPath(SCSIZE nC, SCSIZE nR)
}
}
void ScMatrixImpl::PutEmptyPath(SCSIZE nIndex)
{
SCSIZE nC, nR;
CalcPosition(nIndex, nC, nR);
PutEmptyPath(nC, nR);
}
void ScMatrixImpl::PutError( USHORT nErrorCode, SCSIZE nC, SCSIZE nR )
{
maMat.set_numeric(nR, nC, CreateDoubleError(nErrorCode));
}
void ScMatrixImpl::PutError( USHORT nErrorCode, SCSIZE nIndex )
{
SCSIZE nC, nR;
CalcPosition(nIndex, nC, nR);
PutError(nErrorCode, nC, nR);
}
void ScMatrixImpl::PutBoolean(bool bVal, SCSIZE nC, SCSIZE nR)
{
if (ValidColRow( nC, nR))
@ -912,21 +896,11 @@ void ScMatrix::PutEmptyPath(SCSIZE nC, SCSIZE nR)
pImpl->PutEmptyPath(nC, nR);
}
void ScMatrix::PutEmptyPath(SCSIZE nIndex)
{
pImpl->PutEmptyPath(nIndex);
}
void ScMatrix::PutError( USHORT nErrorCode, SCSIZE nC, SCSIZE nR )
{
pImpl->PutError(nErrorCode, nC, nR);
}
void ScMatrix::PutError( USHORT nErrorCode, SCSIZE nIndex )
{
pImpl->PutError(nErrorCode, nIndex);
}
void ScMatrix::PutBoolean(bool bVal, SCSIZE nC, SCSIZE nR)
{
pImpl->PutBoolean(bVal, nC, nR);