20#include <config_features.h>
26#include <rtl/math.hxx>
35#include <osl/thread.h>
43#include <com/sun/star/table/XCellRange.hpp>
44#include <com/sun/star/script/XInvocation.hpp>
45#include <com/sun/star/sheet/XSheetCellRange.hpp>
52#include <document.hxx>
68#include <tokenarray.hxx>
69#include <compiler.hxx>
79using ::std::unique_ptr;
81#define ADDIN_MAXSTRLEN 256
91 for (
size_t i = 0;
i < ListSize; ++
i )
94 if ( rPos == pTOp->
aOld1 )
99 else if ( rPos == pTOp->
aOld2 )
114 for (
size_t i = 0;
i < ListSize; ++
i )
132 nErr = FormulaError::NONE;
139 nErr = FormulaError::NONE;
168 if (nError != FormulaError::NONE)
199 if( nErr == FormulaError::NONE )
286 "Add check for columns > SAL_MAX_UINT16!");
291 sal_uInt16*
p =
reinterpret_cast<sal_uInt16*
>(pCellArr);
292 *
p++ =
static_cast<sal_uInt16
>(nCol1);
293 *
p++ =
static_cast<sal_uInt16
>(nRow1);
294 *
p++ =
static_cast<sal_uInt16
>(nTab1);
295 *
p++ =
static_cast<sal_uInt16
>(nCol2);
296 *
p++ =
static_cast<sal_uInt16
>(nRow2);
297 *
p++ =
static_cast<sal_uInt16
>(nTab2);
298 sal_uInt16* pCount =
p;
300 sal_uInt16
nPos = 14;
303 while (nTab <= nTab2)
307 while (nRow <= nRow2)
311 while (nCol <= nCol2)
341 if ((
nPos + (4 *
sizeof(sal_uInt16)) +
sizeof(
double)) >
MAXARRSIZE)
343 *
p++ =
static_cast<sal_uInt16
>(nCol);
344 *
p++ =
static_cast<sal_uInt16
>(nRow);
345 *
p++ =
static_cast<sal_uInt16
>(nTab);
346 *
p++ =
static_cast<sal_uInt16
>(nErr);
347 memcpy(
p, &nVal,
sizeof(
double));
348 nPos += 8 +
sizeof(double);
349 p =
reinterpret_cast<sal_uInt16*
>( pCellArr +
nPos );
370 "Add check for columns > SAL_MAX_UINT16!");
375 sal_uInt16*
p =
reinterpret_cast<sal_uInt16*
>(pCellArr);
376 *
p++ =
static_cast<sal_uInt16
>(nCol1);
377 *
p++ =
static_cast<sal_uInt16
>(nRow1);
378 *
p++ =
static_cast<sal_uInt16
>(nTab1);
379 *
p++ =
static_cast<sal_uInt16
>(nCol2);
380 *
p++ =
static_cast<sal_uInt16
>(nRow2);
381 *
p++ =
static_cast<sal_uInt16
>(nTab2);
382 sal_uInt16* pCount =
p;
384 sal_uInt16
nPos = 14;
386 while (nTab <= nTab2)
389 while (nRow <= nRow2)
392 while (nCol <= nCol2)
422 osl_getThreadTextEncoding()));
429 sal_uInt16 nStrLen =
static_cast<sal_uInt16
>(aTmp.getLength());
430 sal_uInt16 nLen = ( nStrLen + 2 ) & ~1;
434 *
p++ =
static_cast<sal_uInt16
>(nCol);
435 *
p++ =
static_cast<sal_uInt16
>(nRow);
436 *
p++ =
static_cast<sal_uInt16
>(nTab);
437 *
p++ =
static_cast<sal_uInt16
>(nErr);
439 memcpy(
p, aTmp.getStr(), nStrLen + 1);
440 nPos += 10 + nStrLen + 1;
442 if( (nStrLen & 1) == 0 )
447 p =
reinterpret_cast<sal_uInt16*
>( pCellArr +
nPos );
468 "Add check for columns > SAL_MAX_UINT16!");
473 sal_uInt16*
p =
reinterpret_cast<sal_uInt16*
>(pCellArr);
474 *
p++ =
static_cast<sal_uInt16
>(nCol1);
475 *
p++ =
static_cast<sal_uInt16
>(nRow1);
476 *
p++ =
static_cast<sal_uInt16
>(nTab1);
477 *
p++ =
static_cast<sal_uInt16
>(nCol2);
478 *
p++ =
static_cast<sal_uInt16
>(nRow2);
479 *
p++ =
static_cast<sal_uInt16
>(nTab2);
480 sal_uInt16* pCount =
p;
482 sal_uInt16
nPos = 14;
485 while (nTab <= nTab2)
489 while (nRow <= nRow2)
493 while (nCol <= nCol2)
500 sal_uInt16
nType = 0;
529 *
p++ =
static_cast<sal_uInt16
>(nCol);
530 *
p++ =
static_cast<sal_uInt16
>(nRow);
531 *
p++ =
static_cast<sal_uInt16
>(nTab);
532 *
p++ =
static_cast<sal_uInt16
>(nErr);
539 memcpy(
p, &nVal,
sizeof(
double));
540 nPos +=
sizeof(double);
545 osl_getThreadTextEncoding()));
552 sal_uInt16 nStrLen =
static_cast<sal_uInt16
>(aTmp.getLength());
553 sal_uInt16 nLen = ( nStrLen + 2 ) & ~1;
557 memcpy(
p, aTmp.getStr(), nStrLen + 1);
558 nPos += 2 + nStrLen + 1;
560 if( (nStrLen & 1) == 0 )
567 p =
reinterpret_cast<sal_uInt16*
>( pCellArr +
nPos );
587 SetError( FormulaError::StackOverflow );
603 SetError( FormulaError::StackOverflow );
622 SetError( FormulaError::StackOverflow );
624 p->DeleteIfZeroRef();
638 p->DeleteIfZeroRef();
652 SetError( FormulaError::StackOverflow );
671 SetError( FormulaError::StackOverflow );
694 if (pRetTypeExpr && pRetIndexExpr)
704 if (nErr != FormulaError::NONE)
708 *pRetTypeExpr = SvNumFormatType::UNDEFINED;
718 *pRetTypeExpr = SvNumFormatType::TEXT;
749 SetError(FormulaError::UnknownStackVariable);
763 SetError(FormulaError::UnknownStackVariable);
777 SetError(FormulaError::UnknownStackVariable);
789 switch (
p->GetType())
797 if (
nType != SvNumFormatType::ALL &&
nType != SvNumFormatType::UNDEFINED)
799 return p->GetDouble();
805 SetError( FormulaError::IllegalArgument);
809 SetError( FormulaError::UnknownStackVariable);
821 switch (
p->GetType())
827 return p->GetString();
832 SetError( FormulaError::IllegalArgument);
836 SetError( FormulaError::UnknownStackVariable);
857 for (
const auto& rRef : rRefList)
913 switch (
p->GetType())
931 rAdr.
Set( nCol, nRow, nTab );
937 SetError( FormulaError::IllegalParameter);
941 SetError( FormulaError::UnknownStackVariable);
956 ScRange aRange( rCol1, rRow1, rTab1, rCol2, rRow2, rTab2 );
958 SetError( FormulaError::IllegalParameter );
968 SetError(FormulaError::UnknownStackVariable);
982 ScRange(nCol1, nRow1, nTab1, nCol2, nRow2, nTab2));
997 SetError( FormulaError::IllegalParameter);
1010 switch (
p->GetType())
1019 SetError( FormulaError::IllegalParameter);
1023 SetError( FormulaError::UnknownStackVariable);
1027 ScRange & rRange,
bool bDontCheckForTableOp )
1035 rRange.
aEnd.
Set( nCol, nRow, nTab );
1040 SetError( FormulaError::IllegalParameter );
1069 if (rRefInList < pList->
size())
1072 if (++rRefInList < pList->
size())
1084 SetError( FormulaError::IllegalParameter);
1089 SetError( FormulaError::IllegalParameter);
1093 SetError( FormulaError::UnknownStackVariable);
1102 switch (
p->GetType())
1111 SetError( FormulaError::IllegalParameter);
1115 SetError( FormulaError::UnknownStackVariable);
1123 switch (
p->GetType())
1126 return p->GetDoubleRef();
1130 if (rRefInList < pList->
size())
1131 return &(*pList)[rRefInList];
1145 SetError(FormulaError::UnknownStackVariable);
1161 SetError( FormulaError::IllegalParameter);
1165 rFileId =
p->GetIndex();
1166 rTabName =
p->GetString().getString();
1167 rRef = *
p->GetSingleRef();
1196 OSL_FAIL(
"ScCompiler::GetToken: external single reference must have an absolute table reference!");
1204 rFileId, rTabName, aAddr, &
aPos,
nullptr, &aFmt);
1212 if (xNew->GetType() ==
svError)
1224 SetError(FormulaError::UnknownStackVariable);
1240 SetError( FormulaError::IllegalParameter);
1244 rFileId =
p->GetIndex();
1245 rTabName =
p->GetString().getString();
1246 rRef = *
p->GetDoubleRef();
1275 SetError( FormulaError::IllegalParameter);
1278 rMat =
p->GetMatrix();
1280 SetError( FormulaError::UnknownVariable);
1296 OSL_FAIL(
"ScCompiler::GetToken: external double reference must have an absolute table reference!");
1310 nFileId, rTabName, aRange, &
aPos);
1314 SetError(FormulaError::IllegalArgument);
1328 SetError(FormulaError::IllegalArgument);
1335 SetError( FormulaError::IllegalArgument);
1383 const std::vector<ScComplexRefData>* pv = xTok->
GetRefList();
1386 const size_t nEntries = pv->size();
1397 for (
const auto & rRef : *pv)
1399 if (rRef.Ref1 != rRef.Ref2)
1405 for (
size_t i=0;
i < nEntries; ++
i)
1416 xMat->PutEmpty( 0,
i);
1420 xMat->PutDouble( aCell.
getValue(), 0,
i);
1460 SAL_WARN_IF( nParams >
sp,
"sc.core",
"ConvertMatrixParameters: stack/param count mismatch: eOp: "
1461 <<
static_cast<int>(
pCur->
GetOpCode()) <<
" sp: " <<
sp <<
" nParams: " << nParams);
1462 assert(nParams <=
sp);
1463 SCSIZE nJumpCols = 0, nJumpRows = 0;
1464 for ( sal_uInt16
i=1;
i <= nParams &&
i <=
sp; ++
i )
1469 assert(!
"ConvertMatrixParameters: not a push");
1473 switch (
p->GetType() )
1487 == formula::ParamClass::Value )
1491 SetError( FormulaError::UnknownVariable);
1495 pMat->GetDimensions( nCols, nRows);
1496 if ( nJumpCols < nCols )
1498 if ( nJumpRows < nRows )
1507 if (
eType != formula::ParamClass::Reference &&
1508 eType != formula::ParamClass::ReferenceOrRefArray &&
1509 eType != formula::ParamClass::ReferenceOrForceArray &&
1524 nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
1527 if (
eType == formula::ParamClass::Value )
1530 nJumpCols =
static_cast<SCSIZE>(nCol2 - nCol1 + 1);
1532 nJumpRows =
static_cast<SCSIZE>(nRow2 - nRow1 + 1);
1545 if (
eType == formula::ParamClass::Value ||
eType == formula::ParamClass::Array)
1547 sal_uInt16 nFileId =
p->GetIndex();
1548 OUString aTabName =
p->GetString().getString();
1561 if (
eType == formula::ParamClass::Value)
1581 if (
eType != formula::ParamClass::Reference &&
1582 eType != formula::ParamClass::ReferenceOrRefArray &&
1583 eType != formula::ParamClass::ReferenceOrForceArray &&
1584 eType != formula::ParamClass::ForceArray)
1594 assert(!
"ConvertMatrixParameters: unknown parameter type");
1598 if( nJumpCols && nJumpRows )
1601 short nStart = nPC - 1;
1603 short nStop = nPC + 1;
1605 ScTokenMatrixMap::const_iterator aMapIter;
1607 xNew = (*aMapIter).second;
1610 std::shared_ptr<ScJumpMatrix> pJumpMat;
1613 pJumpMat = std::make_shared<ScJumpMatrix>(
pCur->
GetOpCode(), nJumpCols, nJumpRows);
1615 catch (
const std::bad_alloc&)
1617 SAL_WARN(
"sc.core",
"std::bad_alloc in ScJumpMatrix ctor with " << nJumpCols <<
" columns and " << nJumpRows <<
" rows");
1620 pJumpMat->SetAllJumps( 1.0, nStart, nNext, nStop);
1623 for ( sal_uInt16
i=1; i <= nParams && sp > 0; ++
i )
1628 aParams[ nParams -
i ] =
p;
1630 pJumpMat->SetJumpParameters( std::move(aParams) );
1648 switch (
p->GetType())
1662 SetError( FormulaError::UnknownVariable);
1666 SetError( FormulaError::IllegalParameter);
1670 SetError( FormulaError::UnknownStackVariable);
1688 aRet.
mpMat->SetErrorInterpreter(
this);
1704 SetError( FormulaError::UnknownVariable);
1719 xMat->GetDimensions(nCols, nRows);
1724 if ( xMat->IsEmptyPath( 0, 0))
1728 rRetTypeExpr = SvNumFormatType::LOGICAL;
1730 else if ( xMat->IsEmptyResult( 0, 0))
1735 else if ( xMat->IsEmpty( 0, 0))
1744 rRetTypeExpr = SvNumFormatType::TEXT;
1751 if (nErr != FormulaError::NONE)
1756 if ( rRetTypeExpr != SvNumFormatType::LOGICAL )
1757 rRetTypeExpr = SvNumFormatType::NUMBER;
1760 xMat->SetErrorInterpreter(
nullptr);
1763 SetError( FormulaError::UnknownStackVariable);
1773 if (
p &&
p->GetRef() == 1)
1775 p->GetDoubleAsReference() = fVal;
1776 p->SetDoubleType(
static_cast<sal_Int16
>(nFmt) );
1858 sal_uInt16 nFileId,
const OUString& rTabName,
SCCOL nCol,
SCROW nRow,
SCTAB nTab)
1870 sal_uInt16 nFileId,
const OUString& rTabName,
1911 rMat.
mpMat->SetErrorInterpreter(
nullptr);
1918 pMat->SetErrorInterpreter(
nullptr);
1935 PushError( FormulaError::ParameterExpected);
1940 PushError( FormulaError::IllegalParameter);
1945 PushError( FormulaError::IllegalArgument);
1972 SetError(FormulaError::UnknownStackVariable);
1989 SetError(FormulaError::UnknownStackVariable);
2012 assert(
sp >= nParamCount &&
" less stack elements than parameters");
2013 sal_uInt16 nStackParams = std::min<sal_uInt16>(
sp, nParamCount);
2032 SetError( FormulaError::IllegalArgument);
2037 rAdr.
SetCol( sal::static_int_cast<SCCOL>( rRange.
aStart.
Col() + nC ) );
2038 rAdr.
SetRow( sal::static_int_cast<SCROW>( rRange.
aStart.
Row() + nR ) );
2063 double fVal = pMat->GetDoubleWithStringConversion( 0, 0);
2065 if (nErr != FormulaError::NONE)
2075 SCSIZE nCols, nRows, nC, nR;
2076 pMat->GetDimensions( nCols, nRows);
2079 if ( (nC < nCols || nCols == 1) && (nR < nRows || nRows == 1) )
2081 double fVal = pMat->GetDoubleWithStringConversion( nC, nR);
2083 if (nErr != FormulaError::NONE)
2137 nVal = pToken->GetDouble();
2170 SetError( FormulaError::IllegalParameter);
2183 nResultVal = nDefault;
2189 if (!std::isfinite(fVal))
2196 fVal = rtl::math::approxFloor( fVal);
2199 SetError( FormulaError::IllegalArgument);
2203 else if (fVal < 0.0)
2205 fVal = rtl::math::approxCeil( fVal);
2208 SetError( FormulaError::IllegalArgument);
2212 return static_cast<sal_Int32
>(fVal);
2232 if (!std::isfinite(fVal))
2239 fVal = rtl::math::approxFloor( fVal);
2242 SetError( FormulaError::IllegalArgument);
2246 else if (fVal < 0.0)
2248 fVal = rtl::math::approxCeil( fVal);
2251 SetError( FormulaError::IllegalArgument);
2255 return static_cast<sal_Int16
>(fVal);
2260 double fVal = rtl::math::approxFloor(
GetDouble());
2261 if (!std::isfinite(fVal))
2268 SetError( FormulaError::IllegalArgument);
2271 return static_cast<sal_uInt32
>(fVal);
2276 bool bDouble =
true;
2326 SetError( FormulaError::IllegalParameter);
2392 return pToken->GetString();
2408 SetError( FormulaError::IllegalArgument);
2423 SCSIZE nCols, nRows, nC, nR;
2424 pMat->GetDimensions( nCols, nRows);
2427 if ( (nC < nCols || nCols == 1) && (nR < nRows || nRows == 1) )
2428 return pMat->GetString( *
pFormatter, nC, nR);
2452 SetError( FormulaError::IllegalParameter);
2463 nMatVal = pMat->Get(0, 0);
2464 nMatValType = nMatVal.
nType;
2468 SCSIZE nCols, nRows, nC, nR;
2469 pMat->GetDimensions( nCols, nRows);
2472 if ( (nC < nCols || nCols == 1) && (nR < nRows || nRows == 1) )
2474 nMatVal = pMat->Get( nC, nR);
2475 nMatValType = nMatVal.
nType;
2483 rDouble = nMatVal.
fVal;
2485 if (nError != FormulaError::NONE)
2499 SvNumFormatType::NUMBER,
2508 bool bMissingField =
false;
2509 unique_ptr<ScDBQueryParamBase> pQueryParam(
GetDBParams(bMissingField) );
2517 pQueryParam->mbSkipString =
false;
2520 if (!aValIter.
GetFirst(aValue) || aValue.
mnError != FormulaError::NONE)
2528 if (aValIter.
GetNext(aValNext) && aValNext.
mnError == FormulaError::NONE)
2547 if (pLegacyFuncData)
2552 if (nParamCount < MAXFUNCPARAM && nParamCount == pLegacyFuncData->GetParamCount() - 1)
2564 ppParam[
i] =
nullptr;
2567 pCellArr[
i] =
nullptr;
2570 for (
i = nParamCount; (
i > 0) && (
nGlobalError == FormulaError::NONE);
i--)
2577 SetError( FormulaError::ParameterExpected);
2580 switch (eParamType[
i])
2585 ppParam[
i] = &nVal[
i-1];
2591 osl_getThreadTextEncoding()));
2593 SetError( FormulaError::StringOverflow );
2599 ppParam[
i] = pStr[
i-1];
2611 PopDoubleRef(nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
2613 if (!
CreateDoubleArr(nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, pCellArr[
i-1]))
2614 SetError(FormulaError::CodeOverflow);
2616 ppParam[
i] = pCellArr[
i-1];
2627 PopDoubleRef(nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
2629 if (!
CreateStringArr(nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, pCellArr[
i-1]))
2630 SetError(FormulaError::CodeOverflow);
2632 ppParam[
i] = pCellArr[
i-1];
2643 PopDoubleRef(nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
2645 if (!
CreateCellArr(nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, pCellArr[
i-1]))
2646 SetError(FormulaError::CodeOverflow);
2648 ppParam[
i] = pCellArr[
i-1];
2652 SetError(FormulaError::IllegalParameter);
2663 switch ( eParamType[0] )
2669 pLegacyFuncData->
Call(ppParam);
2676 ppParam[0] = pcErg.get();
2677 pLegacyFuncData->
Call(ppParam);
2678 OUString aUni( pcErg.get(), strlen(pcErg.get()), osl_getThreadTextEncoding() );
2683 PushError( FormulaError::UnknownState );
2693 pLegacyFuncData->
Call(ppParam);
2720 PushError( FormulaError::UnknownState );
2734 delete[] pCellArr[
i];
2739 while( nParamCount-- > 0)
2752 SetError( FormulaError::IllegalParameter );
2762 aCall.
SetCaller(
static_cast<beans::XPropertySet*
>(
2767 short nPar = nParamCount;
2768 while ( nPar > 0 &&
GetError() == FormulaError::NONE )
2804 switch( nStackType )
2813 uno::Sequence<sal_Int32> aInner( &nVal, 1 );
2814 uno::Sequence< uno::Sequence<sal_Int32> > aOuter( &aInner, 1 );
2824 SetError(FormulaError::IllegalParameter);
2829 SetError(FormulaError::IllegalParameter);
2833 SetError(FormulaError::IllegalParameter);
2838 switch( nStackType )
2845 uno::Sequence<double> aInner( &fVal, 1 );
2846 uno::Sequence< uno::Sequence<double> > aOuter( &aInner, 1 );
2855 SetError(FormulaError::IllegalParameter);
2860 SetError(FormulaError::IllegalParameter);
2864 SetError(FormulaError::IllegalParameter);
2869 switch( nStackType )
2876 uno::Sequence<OUString> aInner( &aString, 1 );
2877 uno::Sequence< uno::Sequence<OUString> > aOuter( &aInner, 1 );
2886 SetError(FormulaError::IllegalParameter);
2891 SetError(FormulaError::IllegalParameter);
2895 SetError(FormulaError::IllegalParameter);
2900 switch( nStackType )
2921 aElem <<=
aStr.getString();
2927 uno::Sequence<uno::Any> aInner( &aElem, 1 );
2928 uno::Sequence< uno::Sequence<uno::Any> > aOuter( &aInner, 1 );
2937 SetError(FormulaError::IllegalParameter);
2942 SetError(FormulaError::IllegalParameter);
2946 SetError(FormulaError::IllegalParameter);
2951 switch( nStackType )
2969 aParam <<=
aStr.getString();
2981 SetError(FormulaError::IllegalParameter);
2986 SetError(FormulaError::IllegalParameter);
2990 SetError(FormulaError::IllegalParameter);
2995 switch( nStackType )
3002 uno::Reference<table::XCellRange> xObj =
3007 SetError(FormulaError::IllegalParameter);
3014 uno::Reference<table::XCellRange> xObj =
3022 SetError(FormulaError::IllegalParameter);
3028 SetError(FormulaError::IllegalParameter);
3034 SetError(FormulaError::IllegalParameter);
3043 if (
GetError() == FormulaError::NONE )
3050 uno::Reference<sheet::XVolatileResult> xRes = aCall.
GetVarRes();
3057 bool bTemporaryListener =
false;
3064 bTemporaryListener =
true;
3077 if (bTemporaryListener)
3083 css::lang::EventObject
aEvent;
3086 catch (
const uno::Exception&)
3092 if ( aCall.
GetErrCode() != FormulaError::NONE )
3114 while( nParamCount-- > 0)
3130#if HAVE_FEATURE_SCRIPTING
3132static uno::Any lcl_getSheetModule(
const uno::Reference<table::XCellRange>& xCellRange,
const ScDocument* pDok )
3134 uno::Reference< sheet::XSheetCellRange > xSheetRange( xCellRange, uno::UNO_QUERY_THROW );
3135 uno::Reference< beans::XPropertySet > xProps( xSheetRange->getSpreadsheet(), uno::UNO_QUERY_THROW );
3137 xProps->getPropertyValue(
"CodeName") >>= sCodeName;
3145 uno::Reference< uno::XInterface > xIf;
3146 if ( pBasMgr && !pBasMgr->
GetName().isEmpty() )
3148 OUString sProj(
"Standard" );
3171 uno::Reference< uno::XInterface > xVBARange;
3173 uno::Sequence< uno::Any > aArgs{ lcl_getSheetModule( xCellRange, &rDok ),
3176 if ( xVBARange.is() )
3183 catch( uno::Exception& )
3189static bool lcl_isNumericResult(
double& fVal,
const SbxVariable* pVar )
3209 fVal = (pVar->
GetBool() ? 1.0 : 0.0);
3222#if !HAVE_FEATURE_SCRIPTING
3258 SbxVariable* pVar = pRoot ? pRoot->
Find(aMacro, SbxClassType::Method) :
nullptr;
3271 bool bVolatileMacro =
false;
3276 OSL_ENSURE(
dynamic_cast<const StarBASIC *
>(
pObject) !=
nullptr,
"No Basic found!");
3279 if (pRoot && bUseVBAObjects)
3286 aBasicStr =
pObject->GetParent()->GetName();
3296 for( sal_uInt32
i = nParamCount;
i && bOk ;
i-- )
3315 if ( pToken->GetType() ==
svString )
3316 pPar->
PutString( pToken->GetString().getString() );
3317 else if ( pToken->GetType() ==
svDouble )
3321 SetError( FormulaError::IllegalArgument );
3331 if ( bUseVBAObjects )
3334 bOk = lcl_setVBARange( aRange,
mrDoc, pPar );
3350 PopDoubleRef( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
3351 if( nTab1 != nTab2 )
3353 SetError( FormulaError::IllegalParameter );
3358 if ( bUseVBAObjects )
3360 ScRange aRange( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
3361 bOk = lcl_setVBARange( aRange,
mrDoc, pPar );
3366 refArray->AddDim(1, nRow2 - nRow1 + 1);
3367 refArray->AddDim(1, nCol2 - nCol1 + 1);
3369 for(
SCROW nRow = nRow1; bOk && nRow <= nRow2; nRow++ )
3372 sal_Int32 nIdx[ 2 ];
3373 nIdx[ 0 ] = nRow-nRow1+1;
3374 for(
SCCOL nCol = nCol1; bOk && nCol <= nCol2; nCol++ )
3377 nIdx[ 1 ] = nCol-nCol1+1;
3394 pMat->GetDimensions(nC, nR);
3396 refArray->AddDim(1,
static_cast<sal_Int32
>(nR));
3397 refArray->AddDim(1,
static_cast<sal_Int32
>(nC));
3398 for(
SCSIZE nMatRow = 0; nMatRow < nR; nMatRow++ )
3400 sal_Int32 nIdx[ 2 ];
3401 nIdx[ 0 ] =
static_cast<sal_Int32
>(nMatRow+1);
3402 for(
SCSIZE nMatCol = 0; nMatCol < nC; nMatCol++ )
3404 nIdx[ 1 ] =
static_cast<sal_Int32
>(nMatCol+1);
3406 if (pMat->IsStringOrEmpty(nMatCol, nMatRow))
3408 p->PutString( pMat->GetString(nMatCol, nMatRow).getString() );
3412 p->PutDouble( pMat->GetDouble(nMatCol, nMatRow));
3420 SetError( FormulaError::IllegalParameter );
3425 SetError( FormulaError::IllegalParameter );
3455 else if (lcl_isNumericResult( fVal, refRes.
get()))
3473 SbxBase* pElemObj = refRes->GetObject();
3475 sal_Int32 nDim = pDimArray ? pDimArray->
GetDims() : 0;
3476 if ( 1 <= nDim && nDim <= 2 )
3478 sal_Int32 nCs, nCe, nRs;
3484 pDimArray->
GetDim(1, nCs, nCe);
3485 nC =
static_cast<SCSIZE>(nCe - nCs + 1);
3494 pDimArray->
GetDim(1, nRs, nRe);
3495 nR =
static_cast<SCSIZE>(nRe - nRs + 1);
3496 pDimArray->
GetDim(2, nCs, nCe);
3497 nC =
static_cast<SCSIZE>(nCe - nCs + 1);
3505 for (
SCSIZE j=0; j < nR; j++ )
3507 sal_Int32 nIdx[ 2 ];
3510 nIdx[ nRowIdx ] = nRs +
static_cast<sal_Int32
>(j);
3513 nIdx[ nColIdx ] = nCs +
static_cast<sal_Int32
>(
i);
3514 pV = pDimArray->
Get(nIdx);
3515 if ( lcl_isNumericResult( fVal, pV) )
3548#if HAVE_FEATURE_SCRIPTING
3554 if (!aCell.isEmpty())
3558 switch (aCell.getType())
3569 nErr = aCell.getFormula()->GetErrCode();
3570 if( nErr == FormulaError::NONE )
3572 if (aCell.getFormula()->IsValue())
3574 nVal = aCell.getFormula()->GetValue();
3578 pVar->
PutString(aCell.getFormula()->GetString().getString());
3601 if (nParamCount != 3 && nParamCount != 5)
3607 if (nParamCount == 5)
3621 if ( bReuseLastParams )
3635 if ( nParamCount == 5 )
3664 pCell->SetTableOpDirty();
3668 if ( !bReuseLastParams )
3682 pCell->ResetTableOpDirtyVar();
3742 if (
aPos.
Col() == nStartCol )
3745 if ( nStartRow <= nMyRow && nMyRow <= aAbs.
aEnd.
Row())
3747 if ( nMyRow == nStartRow )
3767 if (
aPos.
Row() == nStartRow )
3770 if (nStartCol <= nMyCol && nMyCol <= aAbs.
aEnd.
Col())
3772 if ( nMyCol == nStartCol )
3798 while ( nParamCount-- > 0)
3810 , mpLinkManager(rDoc.GetLinkManager())
3811 , mrStrPool(rDoc.GetSharedStringPool())
3812 , pJumpMatrix(nullptr)
3813 , pMyFormulaCell(pCell)
3814 , pFormatter(rContext.GetFormatTable())
3828 , bCalcAsShown(rDoc.GetDocOptions().IsCalcAsShown())
3829 , meVolatileType(r.IsRecalcModeAlways() ? VOLATILE : NOT_VOLATILE)
3926 return rMat.
mpMat->GetDouble(0, nOffset);
3932 return rMat.
mpMat->GetDouble(nOffset, 0);
3935 return std::numeric_limits<double>::quiet_NaN();
3975 sal_uInt32 nRetIndexExpr = 0;
3976 sal_uInt16 nErrorFunction = 0;
3977 sal_uInt16 nErrorFunctionCount = 0;
3978 std::vector<sal_uInt16> aErrorFunctionStack;
3979 sal_uInt16 nStackBase;
3989 ScTokenMatrixMap::const_iterator aTokenMatrixMapIter;
4003 if (!
pCur || (
nGlobalError != FormulaError::NONE && nErrorFunction > nErrorFunctionCount) )
4013 else if (!FormulaCompiler::IsOpCodeJumpCommand( eOp ) &&
4016 (*aTokenMatrixMapIter).second->GetType() !=
svJumpMatrix)
4023 SAL_WARN(
"sc.core",
"Stack anomaly with calculated path at "
4027 <<
" eOp: " <<
static_cast<int>(eOp)
4029 <<
" nStackBase: " << nStackBase <<
" sp: " <<
sp);
4031 assert(!
"underflow");
4045 if (FormulaCompiler::IsOpCodeJumpCommand( eOp ))
4064 <<
" eOp: " <<
static_cast<int>(eOp)
4066 <<
" nStackBase: " << nStackBase <<
" sp: " <<
sp);
4068 assert(!
"underflow");
4504 default :
PushError( FormulaError::UnknownOpCode);
break;
4514 if (FormulaCompiler::IsOpCodeVolatile(eOp))
4528 case SvNumFormatType::CURRENCY:
4529 case SvNumFormatType::DATE:
4530 case SvNumFormatType::TIME:
4531 case SvNumFormatType::DATETIME:
4532 case SvNumFormatType::DURATION:
4548 while (
sp > nStackBase)
4567 aErrorFunctionStack.push_back( nErrorFunction);
4569 if (aErrorFunctionStack.empty())
4570 assert(!
"ScInterpreter::Interpret - aErrorFunctionStack empty in JumpMatrix context");
4573 nErrorFunction = aErrorFunctionStack.back();
4575 aErrorFunctionStack.pop_back();
4580 }
while ( bGotResult );
4582 if( IsErrFunc(eOp) )
4587 if ( !nErrorFunctionCount )
4592 if ( IsErrFunc(
t->GetOpCode()) )
4593 ++nErrorFunctionCount;
4596 if ( nErrorFunction >= nErrorFunctionCount )
4615 bool bForcedResultType;
4624 bForcedResultType =
true;
4627 bForcedResultType =
false;
4660 if (!bForcedResultType)
4666 if (nRetTypeExpr == SvNumFormatType::DURATION)
4675 fVal = rtl::math::round( fVal, 6);
4683 nRetTypeExpr = SvNumFormatType::NUMBER;
4689 nRetTypeExpr = SvNumFormatType::TEXT;
4735 double fVal = applyImplicitIntersection(aMat,
aPos);
4736 if (std::isnan(fVal))
4764 SetError( FormulaError::UnknownStackVariable);
4768 SetError( FormulaError::UnknownStackVariable);
4771 SetError( FormulaError::OperatorExpected);
4775 if (bForcedResultType || nRetTypeExpr != SvNumFormatType::UNDEFINED)
4805 xResult->GetMatrix()->SetImmutable();
@ SC_ADDINARG_VALUE_OR_ARRAY
any
@ SC_ADDINARG_INTEGER
long
@ SC_ADDINARG_STRING
string
@ SC_ADDINARG_STRING_ARRAY
sequence<sequence<string>>
@ SC_ADDINARG_INTEGER_ARRAY
sequence<sequence<long>>
@ SC_ADDINARG_DOUBLE
double
@ SC_ADDINARG_DOUBLE_ARRAY
sequence<sequence<double>>
@ SC_ADDINARG_CELLRANGE
XCellRange.
@ SC_ADDINARG_MIXED_ARRAY
sequence<sequence<any>>
bool ValidTab(SCTAB nTab)
const SCCOL MAXCOLCOUNT_JUMBO
size_t SCSIZE
size_t typedef to be able to find places where code was changed from USHORT to size_t and is used to ...
void PutInOrder(T &nStart, T &nEnd)
const NodeContext & mrContext
SfxApplication * SfxGetpApp()
StarBASIC * GetLib(sal_uInt16 nLib) const
const OUString & GetName() const
const LegacyFuncData * findByName(const OUString &rName) const
ParamType GetParamType(sal_uInt16 nIndex) const
ParamType GetAsyncType() const
void Call(void **ppParam) const
css::uno::Reference< css::script::XInvocation > const & GetUnoModule()
bool IsVBASupport() const
static ErrCode const & GetError()
bool GetDim(sal_Int32, sal_Int32 &, sal_Int32 &) const
SbxVariable * Get(SbxArray *)
sal_Int32 GetDims() const
bool PutString(const OUString &)
bool PutObject(SbxBase *)
const SbxObject * GetParent() const
virtual SbxDataType GetType() const override
const OUString & GetName(SbxNameType=SbxNameType::NONE) const
static ScAddInAsync * Get(sal_uLong nHandle)
ParamType GetType() const
void AddDocument(ScDocument *pDoc)
const OUString & GetString() const
bool HasDocument(ScDocument *pDoc) const
static ScAddInListener * CreateListener(const css::uno::Reference< css::sheet::XVolatileResult > &xVR, ScDocument *pDoc)
const css::uno::Any & GetResult() const
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
static ScAddInListener * Get(const css::uno::Reference< css::sheet::XVolatileResult > &xVR)
void AddDocument(ScDocument *pDoc)
bool HasDocument(ScDocument *pDoc) const
void Set(SCCOL nCol, SCROW nRow, SCTAB nTab)
SC_DLLPUBLIC void Format(OStringBuffer &r, ScRefFlags nFlags, const ScDocument *pDocument=nullptr, const Details &rDetails=detailsOOOa1) const
static css::uno::Reference< css::table::XCellRange > CreateRangeFromDoc(const ScDocument &rDoc, const ScRange &rR)
static bool DoubleRefToPosSingleRefScalarCase(const ScRange &rRange, ScAddress &rAdr, const ScAddress &rFormulaPos)
TODO : Move this to somewhere appropriate.
ScDBData * findByIndex(sal_uInt16 nIndex)
void GetArea(SCTAB &rTab, SCCOL &rCol1, SCROW &rRow1, SCCOL &rCol2, SCROW &rRow2) const
bool GetNext(Value &rValue)
Does NOT reset rValue if no value found!
bool GetFirst(Value &rValue)
Does NOT reset rValue if no value found!
Base class for abstracting range data backends for database functions.
ScSheetLimits & GetSheetLimits() const
SC_DLLPUBLIC sal_uInt32 GetNumberFormat(SCCOL nCol, SCROW nRow, SCTAB nTab) const
void IncInterpreterTableOpLevel()
void IncMacroInterpretLevel()
bool ValidRow(SCROW nRow) const
const ScCalcConfig & GetCalcConfig() const
void DecInterpreterTableOpLevel()
SC_DLLPUBLIC SCCOL MaxCol() const
ScInterpreterTableOpParams aLastTableOpParams
SC_DLLPUBLIC ScMacroManager * GetMacroManager()
SC_DLLPUBLIC SCROW MaxRow() const
void SetTableOpDirty(const ScRange &)
std::vector< ScInterpreterTableOpParams * > m_TableOpList
list of ScInterpreterTableOpParams currently in use
SC_DLLPUBLIC double RoundValueAsShown(double fVal, sal_uInt32 nFormat, const ScInterpreterContext *pContext=nullptr) const
SC_DLLPUBLIC ScExternalRefManager * GetExternalRefManager() const
void GetNumberFormatInfo(const ScInterpreterContext &rContext, SvNumFormatType &nType, sal_uInt32 &nIndex, const ScAddress &rPos) const
SC_DLLPUBLIC ScDBCollection * GetDBCollection() const
SfxObjectShell * GetDocumentShell() const
bool ValidCol(SCCOL nCol) const
SC_DLLPUBLIC svl::SharedStringPool & GetSharedStringPool()
void LockTable(SCTAB nTab)
void DecMacroInterpretLevel()
SC_DLLPUBLIC void GetDataArea(SCTAB nTab, SCCOL &rStartCol, SCROW &rStartRow, SCCOL &rEndCol, SCROW &rEndRow, bool bIncludeOld, bool bOnlyDown) const
Return the smallest area containing at least all contiguous cells having data.
void UnlockTable(SCTAB nTab)
bool ValidRange(const ScRange &rRange) const
SC_DLLPUBLIC const ScDocOptions & GetDocOptions() const
SC_DLLPUBLIC SCTAB GetTableCount() const
bool ValidColRow(SCCOL nCol, SCROW nRow) const
::formula::FormulaTokenRef TokenRef
std::shared_ptr< ScTokenArray > TokenArrayRef
const OUString * getExternalFileName(sal_uInt16 nFileId, bool bForceOriginal=false)
It returns a pointer to the name of the URI associated with a given external file ID.
ScExternalRefCache::TokenArrayRef getDoubleRefTokens(sal_uInt16 nFileId, const OUString &rTabName, const ScRange &rRange, const ScAddress *pCurPos)
Get an array of tokens that consist of the specified external cell range.
ScExternalRefCache::TokenRef getSingleRefToken(sal_uInt16 nFileId, const OUString &rTabName, const ScAddress &rCell, const ScAddress *pCurPos, SCTAB *pTab, ScExternalRefCache::CellFormat *pFmt=nullptr)
static LegacyFuncCollection * GetLegacyFuncCollection()
static double ConvertStringToValue(const OUString &rStr, const ScCalcConfig &rConfig, FormulaError &rError, FormulaError nStringNoValueError, SvNumberFormatter *pFormatter, SvNumFormatType &rCurFmtType)
Convert string content to numeric value.
static SC_DLLPUBLIC LanguageType eLnge
static SC_DLLPUBLIC ScUnoAddInCollection * GetAddInCollection()
formula::FormulaConstTokenRef PopToken()
static void SetGlobalConfig(const ScCalcConfig &rConfig)
void ScNormDist(int nMinParamCount)
void ScStDev(bool bTextAsZero=false)
void SetError(FormulaError nError)
double ConvertStringToValue(const OUString &)
ScCalcConfig maCalcConfig
formula::FormulaToken * CreateDoubleOrTypedToken(double fVal)
svl::SharedString GetString()
void ScGetIsoWeekOfYear()
bool IsInArrayContext() const
bool ConvertMatrixParameters()
static ScCalcConfig * mpGlobalConfig
formula::FormulaTokenIterator aCode
formula::FormulaToken * CreateFormulaDoubleToken(double fVal, SvNumFormatType nFmt=SvNumFormatType::NUMBER)
void DoubleRefToVars(const formula::FormulaToken *p, SCCOL &rCol1, SCROW &rRow1, SCTAB &rTab1, SCCOL &rCol2, SCROW &rRow2, SCTAB &rTab2)
void PopExternalSingleRef(sal_uInt16 &rFileId, OUString &rTabName, ScSingleRefData &rRef)
static FormulaError GetCellErrCode(const ScRefCellValue &rCell)
void PushExternalDoubleRef(sal_uInt16 nFileId, const OUString &rTabName, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2)
SubtotalFlags mnSubTotalFlags
void AssertFormulaMatrix()
ScDBRangeBase * PopDBDoubleRef()
void PushIllegalParameter()
bool JumpMatrix(short nStackLevel)
bool GetDoubleOrString(double &rValue, svl::SharedString &rString)
returns TRUE if double (or error, check nGlobalError), else FALSE
static ScCalcConfig & GetOrCreateGlobalConfig()
FormulaError nGlobalError
void PushIllegalArgument()
sal_Int16 GetInt16()
if GetDouble() not within int16 limits sets nGlobalError and returns SAL_MAX_INT16
bool CreateDoubleArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt8 *pCellArr)
static thread_local bool bGlobalStackInUse
void ScLogNormDist(int nMinParamCount)
formula::StackVar Interpret()
void ScTDist_T(int nTails)
void DoubleRefToRange(const ScComplexRefData &, ScRange &, bool bDontCheckForTableOp=false)
void ScMax(bool bTextAsZero=false)
void PushDoubleRef(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2)
void Push(const formula::FormulaToken &r)
Does substitute with formula::FormulaErrorToken in case nGlobalError is set and the token passed is n...
void PushExternalSingleRef(sal_uInt16 nFileId, const OUString &rTabName, SCCOL nCol, SCROW nRow, SCTAB nTab)
void ReplaceCell(ScAddress &)
const svl::SharedString & GetStringResult() const
void ScRank(bool bAverage)
formula::StackVar GetRawStackType()
Raw stack type without default replacements.
svl::SharedString GetStringFromDouble(const double fVal)
const formula::FormulaToken * pCur
ScInterpreterContext & mrContext
void ScEncodeURL()
Returns a string in which all non-alphanumeric characters except stroke and underscore (-_) have been...
SvNumFormatType nFuncFmtType
bool DoubleRefToPosSingleRef(const ScRange &rRange, ScAddress &rAdr)
sal_uInt32 GetUInt32()
if GetDouble() not within uint32 limits sets nGlobalError and returns SAL_MAX_UINT32
std::unique_ptr< ScDBQueryParamBase > GetDBParams(bool &rMissingField)
double GetValueCellValue(const ScAddress &, double fOrig)
Only ValueCell, formula cells already store the result rounded.
bool IsTableOpInRange(const ScRange &)
const svl::SharedString & PopString()
const ScComplexRefData * GetStackDoubleRef(size_t rRefInList=0)
void GetCellString(svl::SharedString &rStr, ScRefCellValue &rCell)
void ScBetaDist_MS()
Microsoft version has parameters in different order Also, upper and lowerbound are optional and have ...
bool PopDoubleRefOrSingleRef(ScAddress &rAdr)
bool CreateStringArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt8 *pCellArr)
void ValidateRef(const ScSingleRefData &rRef)
VolatileType meVolatileType
void GetExternalDoubleRef(sal_uInt16 nFileId, const OUString &rTabName, const ScComplexRefData &aData, ScExternalRefCache::TokenArrayRef &rArray)
double GetCellValueOrZero(const ScAddress &, ScRefCellValue &rCell)
void PushError(FormulaError nError)
void PopRefListPushMatrixOrRef()
sal_uInt8 GetByte() const
double GetDoubleFromMatrix(const ScMatrixRef &pMat)
static const ScCalcConfig & GetGlobalConfig()
sal_Int32 GetInt32WithDefault(sal_Int32 nDefault)
if GetDoubleWithDefault() not within int32 limits sets nGlobalError and returns SAL_MAX_INT32
void PushWithoutError(const formula::FormulaToken &r)
Does not substitute with formula::FormulaErrorToken in case nGlobalError is set.
void ScForecast_Ets(ScETSType eETSType)
void Init(ScFormulaCell *pCell, const ScAddress &rPos, ScTokenArray &rTokArray)
void ScModalValue_MS(bool bSingle)
ScMatrixRef GetNewMat(SCSIZE nC, SCSIZE nR, bool bEmpty=false)
void PopDoubleRefPushMatrix()
ScMatValType GetDoubleOrStringFromMatrix(double &rDouble, svl::SharedString &rString)
void PushCellResultToken(bool bDisplayEmptyAsString, const ScAddress &rAddress, SvNumFormatType *pRetTypeExpr, sal_uInt32 *pRetIndexExpr, bool bFinalResult=false)
Obtain cell result / content from address and push as temp token.
void ScAverage(bool bTextAsZero=false)
void ScChiDist(bool bODFF)
ScTokenMatrixMap & GetTokenMatrixMap()
void ConvertMatrixJumpConditionToMatrix()
void PushDouble(double nVal)
void ScQuartile(bool bInclusive)
sc::RangeMatrix PopRangeMatrix()
const formula::FormulaToken ** pStack
void QueryMatrixType(const ScMatrixRef &xMat, SvNumFormatType &rRetTypeExpr, sal_uInt32 &rRetIndexExpr)
void PopSingleRef(ScAddress &)
void ReverseStack(sal_uInt8 nParamCount)
ScTokenMatrixMap maTokenMatrixMap
void MergeCalcConfig()
Merge global and document specific settings.
void ScRawSubtract()
The purpose of RAWSUBTRACT() is exactly to not apply any error correction, approximation etc.
bool SetSbxVariable(SbxVariable *pVar, const ScAddress &)
SvNumberFormatter * pFormatter
FormulaError mnStringNoValueError
static thread_local std::unique_ptr< ScTokenStack > pGlobalStack
void ScVar(bool bTextAsZero=false)
void PushTempTokenWithoutError(const formula::FormulaToken *)
Does not substitute with formula::FormulaErrorToken in case nGlobalError is set.
void PushParameterExpected()
void TreatDoubleError(double &rVal)
ScJumpMatrix * pJumpMatrix
bool CreateCellArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt8 *pCellArr)
sal_Int32 double_to_int32(double fVal)
FormulaError GetError() const
sal_uInt32 GetCellNumberFormat(const ScAddress &rPos, ScRefCellValue &rCell)
void PopDoubleRef(ScRange &rRange, short &rParam, size_t &rRefInList)
If formula::StackVar formula::svDoubleRef pop ScDoubleRefToken and return values of ScComplexRefData.
void PushTokenRef(const formula::FormulaConstTokenRef &)
Pushes the token or substitutes with formula::FormulaErrorToken in case nGlobalError is set and the t...
void ScPercentile(bool bInclusive)
void PushMatrix(const sc::RangeMatrix &rMat)
void ScGammaDist(bool bODFF)
void ScVarP(bool bTextAsZero=false)
void ScCeil(bool bODFF)
tdf69552 ODFF1.2 function CEILING and Excel function CEILING.MATH In essence, the difference between ...
ScFormulaCell * pMyFormulaCell
void PopExternalDoubleRef(sal_uInt16 &rFileId, OUString &rTabName, ScComplexRefData &rRef)
double GetCellValue(const ScAddress &, ScRefCellValue &rCell)
bool MatrixParameterConversion()
void PushTempToken(formula::FormulaToken *)
Does substitute with formula::FormulaErrorToken in case nGlobalError is set and the token passed is n...
void ScStDevP(bool bTextAsZero=false)
void PushSingleRef(SCCOL nCol, SCROW nRow, SCTAB nTab)
void ScMin(bool bTextAsZero=false)
void ScHypGeomDist(int nMinParamCount)
Calculates a value of the hypergeometric distribution.
void ScNetWorkdays(bool bOOXML_Version)
void SingleRefToVars(const ScSingleRefData &rRef, SCCOL &rCol, SCROW &rRow, SCTAB &rTab)
bool IfErrorPushError()
If nGlobalError is set push formula::FormulaErrorToken.
double GetDoubleWithDefault(double nDefault)
void ScFloor(bool bODFF)
tdf69552 ODFF1.2 function FLOOR and Excel function FLOOR.MATH In essence, the difference between the ...
void ScIfError(bool bNAonly)
void ScRoundSignificant()
sal_Int32 GetInt32()
if GetDouble() not within int32 limits sets nGlobalError and returns SAL_MAX_INT32
formula::StackVar GetStackType()
Stack type with replacement of defaults, e.g. svMissing and formula::svEmptyCell will result in formu...
formula::FormulaConstTokenRef xResult
svl::SharedStringPool & mrStrPool
svl::SharedString GetStringFromMatrix(const ScMatrixRef &pMat)
SvNumFormatType nCurFmtType
SvNumFormatType nRetFmtType
void PushString(const OUString &rStr)
void PushStringBuffer(const sal_Unicode *pString)
ScMatrixRef CreateMatrixFromDoubleRef(const formula::FormulaToken *pToken, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2)
void ScPercentrank(bool bInclusive)
ScInterpreter(ScFormulaCell *pCell, ScDocument &rDoc, ScInterpreterContext &rContext, const ScAddress &, ScTokenArray &, bool bForGroupThreading=false)
void ScPoissonDist(bool bODFF)
void GetPos(SCSIZE &rCol, SCSIZE &rRow) const
SC_DLLPUBLIC bool GetUserFuncVolatile(const OUString &sName)
void AddDependentCell(const OUString &aModuleName, ScFormulaCell *pCell)
Token storing matrix that represents values in sheet range.
Matrix data type that can store values of mixed types.
void SetErrorInterpreter(ScInterpreter *p)
static bool IsValueType(ScMatValType nType)
Value or boolean.
static bool IsNonValueType(ScMatValType nType)
String, empty or empty path, but not value nor boolean.
void GetDimensions(SCSIZE &rC, SCSIZE &rR) const
static formula::ParamClass GetParameterType(const formula::FormulaToken *pToken, sal_uInt16 nParameter)
Get one parameter type for function eOp.
static bool FillMixedArray(css::uno::Any &rAny, ScDocument &rDoc, const ScRange &rRange, bool bAllowNV=false)
static bool FillDoubleArray(css::uno::Any &rAny, ScDocument &rDoc, const ScRange &rRange)
static bool FillLongArray(css::uno::Any &rAny, ScDocument &rDoc, const ScRange &rRange)
static bool FillStringArray(css::uno::Any &rAny, ScDocument &rDoc, const ScRange &rRange)
bool Contains(const ScAddress &) const
is Address& fully in Range?
const formula::FormulaToken * pPointer[MAXSTACK]
const ScMatrixRef & GetMatrix() const
FormulaError GetErrCode() const
void SetResult(const css::uno::Any &rNewRes)
ScAddInArgumentType GetArgType(tools::Long nPos)
const css::uno::Reference< css::sheet::XVolatileResult > & GetVarRes() const
void SetCaller(const css::uno::Reference< css::uno::XInterface > &rInterface)
const OUString & GetString() const
void SetParam(tools::Long nPos, const css::uno::Any &rValue)
void SetCallerFromObjectShell(const SfxObjectShell *pSh)
BasicManager * GetBasicManager() const
StarBASIC * GetBasic() const
ErrCode CallBasic(std::u16string_view rMacro, std::u16string_view rBasicName, SbxArray *pArgs, SbxValue *pRet=nullptr)
const OUString & GetName() const
virtual SbxVariable * Find(const OUString &, SbxClassType) override
SbModule * FindModule(std::u16string_view)
SbxObject * getVBAGlobals()
bool StartListening(SvtBroadcaster &rBroadcaster)
SharedString intern(const OUString &rStr)
const OUString & getString() const
static const SharedString & getEmptyString()
EmbeddedObjectRef * pObject
FormulaError GetDoubleErrorValue(double fVal)
constexpr size_t MAXSTACK
::std::vector< const formula::FormulaToken * > ScTokenVec
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SAL_MATH_FPEXCEPTIONS_OFF()
constexpr OUStringLiteral aData
OUString getString(const Any &_rAny)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs(SfxObjectShell const *pShell, const char *_pAsciiName, const css::uno::Sequence< css::uno::Any > &aArgs)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
void SetSbUnoObjectDfltPropName(SbxObject *pObj)
SbxObjectRef GetSbUnoObject(const OUString &aName, const Any &aUnoObj_)
Configuration options for formula interpreter.
void MergeDocumentSpecific(const ScCalcConfig &r)
Complex reference (a range) into the sheet.
SC_DLLPUBLIC ScRange toAbs(const ScSheetLimits &rLimits, const ScAddress &rPos) const
void InitRange(const ScRange &rRange)
void SetRange(const ScSheetLimits &rLimits, const ScRange &rRange, const ScAddress &rPos)
Set a new range, assuming that the ordering of the range matches the ordering of the reference data f...
void InitFromRefAddresses(const ScDocument &rDoc, const ScRefAddress &rRef1, const ScRefAddress &rRef2, const ScAddress &rPos)
InitFlags and set range, relative to rPos if rRef1 and rRef2 say so.
std::vector< formula::FormulaToken * > maTokens
SvNumFormatType GetNumberFormatType(sal_uInt32 nFIndex) const
bool bCollectNotifications
::std::vector< ScAddress > aNotifiedFormulaPos
::std::vector< ScFormulaCell * > aNotifiedFormulaCells
Try NOT to use this struct.
FormulaError GetError() const
Only valid if ScMatrix methods indicate that this is no string!
const svl::SharedString & GetString() const
Only valid if ScMatrix methods indicate so!
This is very similar to ScCellValue, except that it references the original value instead of copying ...
ScFormulaCell * getFormula() const
OUString getString(const ScDocument *pDoc) const
Retrieve string value.
Single reference (one address) into the sheet.
void InitAddress(const ScAddress &rAdr)
InitAddress: InitFlags and set address.
bool IsRowDeleted() const
ScAddress toAbs(const ScSheetLimits &rLimits, const ScAddress &rPos) const
bool IsTabDeleted() const
void InitFromRefAddress(const ScDocument &rDoc, const ScRefAddress &rRef, const ScAddress &rPos)
InitFlags and set address, relative to rPos if rRef says so.
bool IsColDeleted() const
bool isRangeValid() const
::std::vector< ScComplexRefData > ScRefList
#define MATRIX_TOKEN_HAS_RANGE
::boost::intrusive_ptr< const ScMatrix > ScConstMatrixRef
::boost::intrusive_ptr< ScMatrix > ScMatrixRef