23#include <osl/diagnose.h>
27#include <tokenarray.hxx>
39#include <document.hxx>
51#include <com/sun/star/sheet/ComplexReference.hpp>
52#include <com/sun/star/sheet/ExternalReference.hpp>
53#include <com/sun/star/sheet/FormulaToken.hpp>
54#include <com/sun/star/sheet/ReferenceFlags.hpp>
55#include <com/sun/star/sheet/NameToken.hpp>
65 void lcl_SingleRefToCalc(
ScSingleRefData& rRef,
const sheet::SingleReference& rAPI )
69 rRef.
SetColRel( ( rAPI.Flags & sheet::ReferenceFlags::COLUMN_RELATIVE ) != 0 );
70 rRef.
SetRowRel( ( rAPI.Flags & sheet::ReferenceFlags::ROW_RELATIVE ) != 0 );
71 rRef.
SetTabRel( ( rAPI.Flags & sheet::ReferenceFlags::SHEET_RELATIVE ) != 0 );
72 rRef.
SetColDeleted( ( rAPI.Flags & sheet::ReferenceFlags::COLUMN_DELETED ) != 0 );
73 rRef.
SetRowDeleted( ( rAPI.Flags & sheet::ReferenceFlags::ROW_DELETED ) != 0 );
74 rRef.
SetTabDeleted( ( rAPI.Flags & sheet::ReferenceFlags::SHEET_DELETED ) != 0 );
75 rRef.
SetFlag3D( ( rAPI.Flags & sheet::ReferenceFlags::SHEET_3D ) != 0 );
76 rRef.
SetRelName( ( rAPI.Flags & sheet::ReferenceFlags::RELATIVE_NAME ) != 0 );
94 void lcl_ExternalRefToCalc(
ScSingleRefData& rRef,
const sheet::SingleReference& rAPI )
98 rRef.
SetColRel( ( rAPI.Flags & sheet::ReferenceFlags::COLUMN_RELATIVE ) != 0 );
99 rRef.
SetRowRel( ( rAPI.Flags & sheet::ReferenceFlags::ROW_RELATIVE ) != 0 );
100 rRef.
SetColDeleted( ( rAPI.Flags & sheet::ReferenceFlags::COLUMN_DELETED ) != 0 );
101 rRef.
SetRowDeleted( ( rAPI.Flags & sheet::ReferenceFlags::ROW_DELETED ) != 0 );
103 rRef.
SetFlag3D( ( rAPI.Flags & sheet::ReferenceFlags::SHEET_3D ) != 0 );
120 struct TokenPointerRange
125 TokenPointerRange() :
mpStart(nullptr), mpStop(nullptr) {}
127 mpStart(
p), mpStop(
p + static_cast<size_t>(
n)) {}
131 TokenPointerRange maPointerRange[2];
135 bool bSkipRelName =
true ) :
136 mbSkipRelName(bSkipRelName)
138 maPointerRange[0] = TokenPointerRange( pCode, nLen);
139 maPointerRange[1] = TokenPointerRange( pRPN, nRPN);
142 bool skipToken(
size_t i,
const FormulaToken*
const * pp )
152 if ((*pp)->GetRef() > 1)
159 switch ((*pp)->GetType())
162 return (*pp)->GetSingleRef()->IsRelName();
179 if (skipToken( i, pp))
183 if (
p->GetOpCode() == ocTableRef)
247 sbyte.eInForceArray = ParamClass::Unknown;
354#define IF_NOT_OPCODE_ERROR(o,c) SAL_WARN_IF((eOp!=o), "sc.core", #c "::ctor: OpCode " << static_cast<int>(eOp) << " lost, converted to " #o "; maybe inherit from FormulaToken instead!")
423 SAL_WARN(
"sc.core",
"unknown ScRawToken::CreateToken() type " <<
int(
GetType()));
427#undef IF_NOT_OPCODE_ERROR
436 (_rToken1.
GetType() == svSingleRef || _rToken1.
GetType() == svDoubleRef)
437 && _rToken1.FormulaToken::operator ==(_rToken2));
442 if ( _rToken1.
GetType() == svSingleRef )
451 if ( _rToken2.
GetType() == svSingleRef )
460 ScRange aRange1 = aTemp1.
toAbs(rLimits, aPos), aRange2 = aTemp2.
toAbs(rLimits, aPos);
469#if DEBUG_FORMULA_COMPILER
474 cout <<
"-- ScSingleRefToken" <<
endl;
478 cout <<
"-- ScDoubleRefToken" <<
endl;
482 cout <<
"-- FormulaToken" <<
endl;
483 cout <<
" opcode: " <<
int(rToken.
GetOpCode()) <<
" " <<
485 cout <<
" type: " <<
static_cast<int>(rToken.
GetType()) << endl;
505 const ScAddress & rPos,
bool bReuseDoubleRef )
550 aRef.
Extend(rLimits, rRef2, rPos);
562 xRes = (bReuseDoubleRef && rTok1.
GetRef() == 1 ? &rTok1 : rTok1.
Clone());
567 xRes = (bReuseDoubleRef && rTok2.
GetRef() == 1 ? &rTok2 : rTok2.
Clone());
576 if (pRefList->empty())
587 for (
size_t i=0;
i<2; ++
i)
592 rRef.
Extend(rLimits, *
pt[
i]->GetSingleRef(), rPos);
595 rRef.
Extend(rLimits, *
pt[
i]->GetDoubleRef(), rPos);
602 for (
const auto& rRefData : *
p)
604 rRef.
Extend(rLimits, rRefData, rPos);
612 rRef.
Extend(rLimits, *
pt[
i]->GetSingleRef(), rPos);
618 rRef.
Extend(rLimits, *
pt[
i]->GetDoubleRef(), rPos);
725 maTabName(
std::move(aTabName)),
756 if (!FormulaToken::operator==(r))
771 maTabName(
std::move(aTabName)),
822 if (!FormulaToken::operator==(r))
855 if ( !FormulaToken::operator==(r) )
873 mxAreaRefRPN( r.mxAreaRefRPN ? r.mxAreaRefRPN->
Clone() : nullptr),
895 SAL_WARN(
"sc.core",
"ScTableRefToken::GetSheet - maybe adapt caller to know about TableRef?");
922 if ( !FormulaToken::operator==(r) )
947 , mpJumpMatrix(
std::move(
p))
1067 OSL_ENSURE( r.
GetType() !=
svMatrix,
"ScMatrixFormulaCellToken::operator=: assigning ScMatrixToken to ScMatrixFormulaCellToken is not proper, use ScMatrixCellResultToken instead");
1101 OSL_FAIL(
"ScMatrixFormulaCellToken::SetUpperLeftDouble: not modifying unhandled token type");
1113 double f,
const svl::SharedString & rStr, OUString aFormula,
bool bEmptyDisplayedAsString ) :
1117 mbEmptyDisplayedAsString( bEmptyDisplayedAsString)
1120 assert( !bEmptyDisplayedAsString || (f == 0.0 && rStr.
getString().isEmpty()));
1140 bool bError = FormulaTokenArray::AddFormulaToken(rToken, rSPool, pExtRef);
1144 const OpCode eOpCode =
static_cast<OpCode>(rToken.OpCode);
1146 const uno::TypeClass eClass = rToken.Data.getValueTypeClass();
1149 case uno::TypeClass_STRUCT:
1151 uno::Type aType = rToken.Data.getValueType();
1155 sheet::SingleReference aApiRef;
1156 rToken.Data >>= aApiRef;
1157 lcl_SingleRefToCalc( aSingleRef, aApiRef );
1168 sheet::ComplexReference aApiRef;
1169 rToken.Data >>= aApiRef;
1170 lcl_SingleRefToCalc( aComplRef.
Ref1, aApiRef.Reference1 );
1171 lcl_SingleRefToCalc( aComplRef.
Ref2, aApiRef.Reference2 );
1180 sheet::NameToken aTokenData;
1181 rToken.Data >>= aTokenData;
1184 SAL_WARN_IF( aTokenData.Sheet < -1 || std::numeric_limits<sal_Int16>::max() < aTokenData.Sheet,
1186 "ScTokenArray::AddFormulaToken - NameToken.Sheet out of limits: " << aTokenData.Sheet);
1187 sal_Int16 nSheet =
static_cast<sal_Int16
>(aTokenData.Sheet);
1199 sheet::ExternalReference aApiExtRef;
1200 if( (eOpCode ==
ocPush) && (rToken.Data >>= aApiExtRef) && (0 <= aApiExtRef.Index) && (aApiExtRef.Index <=
SAL_MAX_UINT16) )
1202 sal_uInt16 nFileId =
static_cast< sal_uInt16
>( aApiExtRef.Index );
1203 sheet::SingleReference aApiSRef;
1204 sheet::ComplexReference aApiCRef;
1206 if( aApiExtRef.Reference >>= aApiSRef )
1209 size_t nCacheId =
static_cast< size_t >( aApiSRef.Sheet );
1211 if( !aTabName.isEmpty() )
1215 lcl_ExternalRefToCalc( aSingleRef, aApiSRef );
1221 else if( aApiExtRef.Reference >>= aApiCRef )
1224 size_t nCacheId =
static_cast< size_t >( aApiCRef.Reference1.Sheet );
1226 if( !aTabName.isEmpty() )
1230 lcl_ExternalRefToCalc( aComplRef.
Ref1, aApiCRef.Reference1 );
1231 lcl_ExternalRefToCalc( aComplRef.
Ref2, aApiCRef.Reference2 );
1234 aComplRef.
Ref1.
Tab() +
static_cast<SCTAB>(aApiCRef.Reference2.Sheet - aApiCRef.Reference1.Sheet));
1240 else if( aApiExtRef.Reference >>=
aName )
1242 if( !
aName.isEmpty() )
1257 case uno::TypeClass_SEQUENCE:
1262 uno::Sequence< uno::Sequence< uno::Any >>>::get()))
1283#if HAVE_CPP_CONSTINIT_SORTED_VECTOR
1319 static const bool bThreadingProhibited = std::getenv(
"SC_NO_THREADED_CALCULATION");
1321 if (bThreadingProhibited)
1329 if (aThreadedCalcDenyList.find(eOp) != aThreadedCalcDenyList.end())
1332 <<
"(" <<
int(eOp) <<
") disables threaded calculation of formula group");
1347 <<
" disables threaded calculation of formula group");
1371 <<
"(" <<
int(eOp) <<
") disables vectorisation for formula group");
1556 <<
"(" <<
int(eOp) <<
") disables vectorisation for formula group");
1610 <<
"(" <<
int(eOp) <<
") disables vectorisation for formula group");
1646 <<
"(" <<
int(eOp) <<
") disables vectorisation for formula group");
1722 nVal += (size_t(rRef.
IsRowRel()) << 1);
1723 nVal += (size_t(rRef.
IsTabRel()) << 2);
1732 static const OUStringHash aHasher;
1738 sal_uInt16
n = std::min<sal_uInt16>(
nLen, 20);
1739 for (sal_uInt16
i = 0;
i <
n; ++
i)
1742 eOp =
p->GetOpCode();
1753 nHash +=
static_cast<size_t>(nVal);
1759 double fVal =
p->GetDouble();
1760 nHash += std::hash<double>()(fVal);
1766 OUString
aStr =
p->GetString().getString();
1767 nHash += aHasher(
aStr);
1772 size_t nVal = HashSingleRef(*
p->GetSingleRef());
1779 size_t nVal1 = HashSingleRef(rRef.
Ref1);
1780 size_t nVal2 = HashSingleRef(rRef.
Ref2);
1787 nHash +=
static_cast<size_t>(eOp);
1792 nHash +=
static_cast<size_t>(eOp);
1794 nHash = (nHash << 4) - nHash;
1827 for (;
p != pEnd; ++
p)
1829 switch ((*p)->GetType())
1868 mxSheetLimits(&rDoc.GetSheetLimits()),
1875 mxSheetLimits(&rLimits),
1903 Move(std::move(rArr));
1915 for (sal_uInt16
i=0;
i<
nLen;
i++)
1917 if ( ppToken1[
i] != ppToken2[
i] &&
1918 !(*ppToken1[
i] == *ppToken2[
i]) )
1928 FormulaTokenArray::Clear();
1950 pp =
p->pCode.get();
1952 for( sal_uInt16
i = 0;
i <
nLen;
i++, pp++ )
1954 *pp = (*pp)->
Clone();
1962 for( sal_uInt16
i = 0;
i <
nRPN;
i++, pp++ )
1965 if(
t->GetRef() > 1 )
1968 sal_uInt16 nIdx = 0xFFFF;
1969 for( sal_uInt16 j = 0; j <
nLen; j++, p2++ )
1976 if( nIdx == 0xFFFF )
1979 *pp =
p->pCode[ nIdx ];
2008 pp = aNew.
pCode.get();
2010 for( sal_uInt16
i = 0;
i <
nLen;
i++, pp++ )
2012 *pp = (*pp)->
Clone();
2020 for( sal_uInt16
i = 0;
i <
nRPN;
i++, pp++ )
2023 if(
t->GetRef() > 1 )
2026 sal_uInt16 nIdx = 0xFFFF;
2027 for( sal_uInt16 j = 0; j <
nLen; j++, p2++ )
2034 if( nIdx == 0xFFFF )
2037 *pp = aNew.
pCode[ nIdx ];
2057 bool bResult = (bPrevWasSep == bNewVal);
2058 bPrevWasSep = bNewVal;
2064 int nCol = -1, nRow = 0;
2065 int i, nPrevRowSep = -1, nStart = 0;
2066 bool bPrevWasSep =
false;
2068 bool bNumeric =
false;
2072 for (
i =
nLen ;
i-- > nStart ; )
2075 switch (
t->GetOpCode() )
2137 if( nPrevRowSep < 0 ||
2138 ((nPrevRowSep -
i) % 2) == 1)
2145 nCol = (nPrevRowSep -
i) / 2;
2147 else if( (nPrevRowSep -
i)/2 != nCol)
2179 if( nCol <= 0 || nRow <= 0 )
2184 for (
i = nStart, nCol = 0, nRow = 0 ;
i <
nLen ;
i++ )
2188 switch (
t->GetOpCode() )
2193 pArray->
PutDouble(
t->GetDouble() * nSign, nCol, nRow );
2198 pArray->
PutString(
t->GetString(), nCol, nRow);
2233 nLen = sal_uInt16( nStart );
2241 sal_uInt16 nIdx =
nLen;
2326 sal_uInt16 nTokens = 1;
2330 if( !rFormulaNmsp.isEmpty() )
2334 Assign( nTokens, aTokens );
2347 nExtend = rPos.
Row();
2353 nExtend = rPos.
Col();
2354 nCol =
static_cast<SCCOL>(nExtend) + 1;
2357 if ( rPos.
Row() <= 0 )
2359 nExtend = rPos.
Row();
2363 if ( rPos.
Col() <= 0 )
2365 nExtend = rPos.
Col();
2366 nCol =
static_cast<SCCOL>(nExtend) - 1;
2369 OSL_FAIL(
"unknown Direction" );
2378 if ( nParamCount &&
nRPN > nParamCount )
2381 sal_uInt16 nParam =
nRPN - nParamCount - 1;
2382 for ( ; nParam <
nRPN-1; nParam++ )
2385 switch (
p->GetType() )
2394 if (aAbs.
Row() == nRow && aAbs.
Row() > nExtend)
2396 nExtend = aAbs.
Row();
2401 if (aAbs.
Col() == nCol &&
static_cast<SCCOLROW>(aAbs.
Col()) > nExtend)
2403 nExtend = aAbs.
Col();
2408 if (aAbs.
Row() == nRow && aAbs.
Row() < nExtend)
2410 nExtend = aAbs.
Row();
2415 if (aAbs.
Col() == nCol &&
static_cast<SCCOLROW>(aAbs.
Col()) < nExtend)
2417 nExtend = aAbs.
Col();
2476void GetExternalTableData(
const ScDocument* pOldDoc,
const ScDocument* pNewDoc,
const SCTAB nTab, OUString& rTabName, sal_uInt16& rFileId)
2478 const OUString& aFileName = pOldDoc->
GetFileURL();
2481 if (rTabName.isEmpty())
2482 pOldDoc->
GetName(nTab, rTabName);
2521 if (bCheckCopyArea && IsInCopyRange(aRange, &rOldDoc))
2547 for ( sal_uInt16 j=0; j<
nLen; ++j )
2549 switch (
pCode[j]->GetType() )
2553 if (SkipReference(
pCode[j], rPos, rOldDoc, bRangeName,
true))
2564 GetExternalTableData(&rOldDoc, &rNewDoc, rRef1.
Tab(), aTabName, nFileId);
2573 if (SkipReference(
pCode[j], rPos, rOldDoc, bRangeName,
true))
2582 GetExternalTableData(&rOldDoc, &rNewDoc, rRef.
Tab(), aTabName, nFileId);
2598 bool bCheckCopyRange)
2601 for (
size_t j=0; j<2; ++j)
2605 for (; pp != pEnd; ++pp)
2611 switch (
p->GetType() )
2615 if (!SkipReference(
p, rOldPos, rOldDoc,
false, bCheckCopyRange))
2622 AdjustSingleRefData( rRef1, rOldPos, rNewPos );
2623 AdjustSingleRefData( rRef2, rOldPos, rNewPos );
2628 if (!SkipReference(
p, rOldPos, rOldDoc,
false, bCheckCopyRange))
2633 AdjustSingleRefData( rRef, rOldPos, rNewPos );
2648 for (
size_t j=0; j<2; ++j)
2652 for (; pp != pEnd; ++pp)
2658 switch (
p->GetType() )
2696 for (
size_t j=0; j<2; ++j)
2698 FormulaToken*
const * pp = aPtrs.maPointerRange[j].mpStart;
2699 FormulaToken*
const *
const pEnd = aPtrs.maPointerRange[j].mpStop;
2700 for (; pp != pEnd; ++pp)
2706 switch (
p->GetType() )
2716 if (nTab1 <= nTab && nTab <= nTab2)
2725 if (rRef.
Tab() + nPosTab == nTab)
2730 if (rRef.
Tab() == nTab)
2783 return aSelectedRange;
2836 restoreDeletedRef(rRef.
Ref1, rCxt);
2837 restoreDeletedRef(rRef.
Ref2, rCxt);
3132 ScRange aSelectedRange = getSelectedRange(rCxt);
3142 assert(!
"can't move");
3147 for (
size_t j=0; j<2; ++j)
3151 for (; pp != pEnd; ++pp)
3157 switch (
p->GetType())
3167 setRefDeleted(rRef, rCxt);
3178 restoreDeletedRef(rRef, rCxt);
3205 setRefDeleted(rRef, rCxt);
3211 const ShrinkResult eSR = shrinkRange(rCxt, aAbs, aSelectedRange, rRef);
3220 else if (eSR == STICKY)
3245 if (aSelectedRange.
Contains(aCheckRange))
3248 restoreDeletedRef(rRef, rCxt);
3256 if (expandRange(rCxt, aAbs, aSelectedRange, rRef))
3265 if (expandRangeByEdge(rCxt, aAbs, aSelectedRange, rRef))
3329 if ((*pp)->GetType() ==
svIndex)
3331 switch ((*pp)->GetOpCode())
3335 SCTAB nOldTab = (*pp)->GetSheet();
3348 if (isDBDataModified(rCxt.
mrDoc, **pp))
3376 assert(!
"can't move");
3380 for (
size_t j=0; j<2; ++j)
3384 for (; pp != pEnd; ++pp)
3390 switch (
p->GetType())
3498 if ((*pp)->GetType() ==
svIndex)
3500 switch ((*pp)->GetOpCode())
3504 SCTAB nOldTab = (*pp)->GetSheet();
3511 if (isDBDataModified(rCxt.
mrDoc, **pp))
3528 for (
size_t j=0; j<2; ++j)
3532 for (; pp != pEnd; ++pp)
3538 switch (
p->GetType())
3545 if (aAbs.
Tab() == nTab && nRow1 <= aAbs.
Row() && aAbs.
Row() <= nRow2)
3549 if (it != rColMap.
end())
3552 SCCOL nNewCol = it->second;
3576 if (it != rColMap.
end())
3579 SCCOL nNewCol = it->second;
3597 for (
size_t j=0; j<2; ++j)
3601 for (; pp != pEnd; ++pp)
3607 switch (
p->GetType())
3614 if (aAbs.
Tab() == nTab && nCol1 <= aAbs.
Col() && aAbs.
Col() <= nCol2)
3618 if (it != rRowMap.
end())
3621 SCROW nNewRow = it->second;
3645 if (it != rRowMap.
end())
3648 SCROW nNewRow = it->second;
3665bool adjustSingleRefInName(
3680 bool bChanged =
false;
3728bool adjustDoubleRefInName(
3731 bool bRefChanged =
false;
3741 ScRange aSelectedRange = getSelectedRange(rCxt);
3758 ScRange aSelectedRange = getSelectedRange(rCxt);
3782 aCxt.mnRowDelta = 0;
3784 aCxt.mnColDelta = 0;
3785 if (!aCxt.mnColDelta && !aCxt.mnRowDelta && !aCxt.mnTabDelta)
3790 if (adjustSingleRefInName(rRef.
Ref2, aCxt, rPos, &rRef))
3793 if (adjustSingleRefInName(rRef.
Ref1, aCxt, rPos,
nullptr))
3799 if (adjustSingleRefInName(rRef.
Ref2, rCxt, rPos, &rRef))
3802 if (adjustSingleRefInName(rRef.
Ref1, rCxt, rPos,
nullptr))
3824 for (
size_t j=0; j<2; ++j)
3828 for (; pp != pEnd; ++pp)
3834 switch (
p->GetType())
3860 if (nDelStartRow <= aAbs.
Row() && aAbs.
Row() <= nDelEndRow)
3889 if (nDelStartCol <= aAbs.
Col() && aAbs.
Col() <= nDelEndCol)
3898 if (adjustSingleRefInName(rRef, rCxt, rPos,
nullptr))
3914 if (adjustDoubleRefInName(rRef, rCxt, rPos))
4033 if (adjustDoubleRefInName(rRef, rCxt, rPos))
4038 if (adjustDoubleRefInName(rRef, rCxt, rPos))
4090 assert(!
"can't move");
4099 for (
size_t j=0; j<2; ++j)
4103 for (; pp != pEnd; ++pp)
4109 switch (
p->GetType())
4174 if (nDelPos <= aAbs.
Tab() && aAbs.
Tab() < nDelPos + nSheets)
4180 if (nDelPos < aAbs.
Tab())
4187 else if (rOldPos.
Tab() != rNewPos.
Tab())
4200 if (nInsPos <= aAbs.
Tab())
4207 else if (rOldPos.
Tab() != rNewPos.
Tab())
4223 bool bMoreThanOneTab = aStartPos.
Tab() != aEndPos.
Tab();
4224 bool bModified =
false;
4225 if (bMoreThanOneTab && aStartPos.
Tab() == nDelPos && nDelPos + nSheets <= aEndPos.
Tab())
4235 bModified = adjustSingleRefOnDeletedTab(rLimits, rRef1, nDelPos, nSheets, rOldPos, rNewPos);
4238 if (bMoreThanOneTab && aEndPos.
Tab() == nDelPos && aStartPos.
Tab() <= nDelPos - nSheets)
4248 bModified |= adjustSingleRefOnDeletedTab(rLimits, rRef2, nDelPos, nSheets, rOldPos, rNewPos);
4262 for (
size_t j=0; j<2; ++j)
4266 for (; pp != pEnd; ++pp)
4272 switch (
p->GetType())
4293 if ((*pp)->GetType() ==
svIndex)
4295 switch ((*pp)->GetOpCode())
4299 SCTAB nOldTab = (*pp)->GetSheet();
4306 (*pp)->SetSheet( nOldTab - rCxt.
mnSheets);
4315 if (isDBDataModified(rCxt.
mrDoc, **pp))
4335 for (
size_t j=0; j<2; ++j)
4339 for (; pp != pEnd; ++pp)
4345 switch (
p->GetType())
4369 if ((*pp)->GetType() ==
svIndex)
4371 switch ((*pp)->GetOpCode())
4375 SCTAB nOldTab = (*pp)->GetSheet();
4381 (*pp)->SetSheet( nOldTab + rCxt.
mnSheets);
4387 if (isDBDataModified(rCxt.
mrDoc, **pp))
4404 if (nNewTab == rPos.
Tab())
4420 if (adjustTabOnMove(aNewPos, rCxt))
4424 for (
size_t j=0; j<2; ++j)
4428 for (; pp != pEnd; ++pp)
4434 switch (
p->GetType())
4440 if (adjustTabOnMove(aAbs, rCxt))
4449 if (adjustTabOnMove(aAbs.
aStart, rCxt))
4451 if (adjustTabOnMove(aAbs.
aEnd, rCxt))
4462 if ((*pp)->GetType() ==
svIndex)
4464 switch ((*pp)->GetOpCode())
4468 SCTAB nOldTab = (*pp)->GetSheet();
4472 if (nNewTab != nOldTab)
4475 (*pp)->SetSheet( nNewTab);
4481 if (isDBDataModified(rCxt.
mrDoc, **pp))
4497 for (
size_t j=0; j<2; ++j)
4501 for (; pp != pEnd; ++pp)
4507 switch (
p->GetType())
4535 for (
size_t j=0; j<2; ++j)
4539 for (; pp != pEnd; ++pp)
4545 bool bAdjust =
false;
4546 switch (
p->GetType())
4556 bAdjust = (aAbs.
Tab() != rOldPos.
Tab());
4584 for (
size_t j=0; j<2; ++j)
4588 for (; pp != pEnd; ++pp)
4594 switch (
p->GetType())
4617 if (nStartTab <= aAbs.
Tab() && aAbs.
Tab() <= nEndTab)
4625 if (nEndTab < nStartTab)
4630 for (;
p != pEnd; ++
p)
4632 switch ((*p)->GetType())
4638 clearTabDeletedFlag(*
mxSheetLimits, rRef, rPos, nStartTab, nEndTab);
4666 aAbs.aEnd.
IncRow(nGroupLen-1);
4671 if (aAbs.aEnd.
Row() < rCheckRange.
aStart.
Row() && (!pDeletedRange || aAbs.aEnd.
Row() < pDeletedRange->
aStart.
Row()))
4687 rBounds.push_back(rPos.
Row()+nOffset);
4690 if (pDeletedRange && aAbs.aStart.
Row() <= pDeletedRange->
aStart.
Row())
4696 rBounds.push_back(nRow);
4699 if (aAbs.aEnd.
Row() >= rCheckRange.
aEnd.
Row())
4712 rBounds.push_back(rPos.
Row()+nOffset);
4715 if (pDeletedRange && aAbs.aEnd.
Row() >= pDeletedRange->
aEnd.
Row())
4721 rBounds.push_back(nRow);
4733 const ScRange* pDeletedRange =
nullptr;
4742 assert(!
"can't move");
4746 pDeletedRange = &rCxt.
maRange;
4754 aDeletedRange = getSelectedRange( rCxt);
4755 pDeletedRange = &aDeletedRange;
4758 checkBounds(rCxt.
mrDoc.
GetSheetLimits(), rPos, nGroupLen, aCheckRange, rRef, rBounds, pDeletedRange);
4767 for (
size_t j=0; j<2; ++j)
4771 for (; pp != pEnd; ++pp)
4777 switch (
p->GetType())
4781 checkBounds(rCxt, rPos, nGroupLen, *
p->GetSingleRef(), rBounds);
4787 checkBounds(rCxt, rPos, nGroupLen, rRef.
Ref1, rBounds);
4788 checkBounds(rCxt, rPos, nGroupLen, rRef.
Ref2, rBounds);
4802 for (
size_t j=0; j<2; ++j)
4806 for (; pp != pEnd; ++pp)
4812 switch (
p->GetType())
4817 checkBounds(*
mxSheetLimits, rPos, nGroupLen, rRange, rRef, rBounds,
nullptr);
4823 checkBounds(*
mxSheetLimits, rPos, nGroupLen, rRange, rRef.
Ref1, rBounds,
nullptr);
4824 checkBounds(*
mxSheetLimits, rPos, nGroupLen, rRange, rRef.
Ref2, rBounds,
nullptr);
4839 for (
size_t j=0; j<2; ++j)
4841 FormulaToken*
const * pp = aPtrs.maPointerRange[j].mpStart;
4842 const FormulaToken*
const * pEnd = aPtrs.maPointerRange[j].mpStop;
4843 for (; pp != pEnd; ++pp)
4849 switch (
p->GetType())
4860 if (!bStartRowRelative && !bEndRowRelative)
4875 (aAbsStart.
aEnd.
Row() <= nInsRow && nInsRow <= aAbsEnd.
aEnd.
Row())))
4882 if (nEndRow + 1 < nInsRow)
4884 if (bEndRowRelative)
4886 nOffset = nInsRow - nEndRow - 1;
4888 if (bStartRowRelative)
4889 nStartRow += nOffset;
4893 nOffset = nInsRow - nStartRow;
4894 nStartRow += nOffset;
4896 bStartRowRelative =
false;
4897 bEndRowRelative =
true;
4900 for (
SCROW i = nOffset;
i < nGroupLen; ++
i)
4902 bool bSplit = (nStartRow == nInsRow || nEndRow + 1 == nInsRow);
4904 rBounds.push_back( rPos.
Row() +
i);
4906 if (bEndRowRelative)
4908 if (bStartRowRelative)
4911 if (!bEndRowRelative && nStartRow == nEndRow)
4914 bStartRowRelative =
false;
4915 bEndRowRelative =
true;
4918 if (nInsRow < nStartRow || (!bStartRowRelative && nInsRow <= nEndRow))
4920 if (bSplit && (++
i < nGroupLen))
4921 rBounds.push_back( rPos.
Row() +
i);
4940 rtl::math::doubleToUStringBuffer(
4941 rBuf, fVal, rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
'.',
true);
4946 rtl::math::doubleToUStringBuffer(
4948 rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
4953void appendString( OUStringBuffer& rBuf,
const OUString& rStr )
4956 rBuf.append(rStr.replaceAll(
"\"",
"\"\""));
4961 const ScAddress& rPos,
bool bFromRangeName )
4965 size_t nFileId = rToken.
GetIndex();
4980 rLimits, rBuf, rPos, nFileId, aFileName, aTabName, *rToken.
GetSingleRef());
4984 sc::TokenStringContext::IndexNamesMapType::const_iterator it =
4991 rLimits, rBuf, rPos, nFileId, aFileName, it->second, aTabName,
4998 OSL_FAIL(
"appendTokenByType: unknown type of ocExternalRef");
5007 appendDouble(rCxt, rBuf, rToken.
GetDouble());
5012 if (eOp == ocBad || eOp == ocStringXML)
5018 appendString(rBuf, aStr);
5054 size_t nC, nMaxC, nR, nMaxR;
5057 rBuf.append(rCxt.
mxOpCodeMap->getSymbol(ocArrayOpen));
5058 for (nR = 0 ; nR < nMaxR ; ++nR)
5062 rBuf.append(rCxt.
mxOpCodeMap->getSymbol(ocArrayRowSep));
5065 for (nC = 0 ; nC < nMaxC ; ++nC)
5069 rBuf.append(rCxt.
mxOpCodeMap->getSymbol(ocArrayColSep));
5076 bool bVal = pMat->
GetDouble(nC, nR) != 0.0;
5077 rBuf.append(rCxt.
mxOpCodeMap->getSymbol(bVal ? ocTrue : ocFalse));
5082 if (nErr != FormulaError::NONE)
5085 appendDouble(rCxt, rBuf, pMat->
GetDouble(nC, nR));
5088 else if (pMat->
IsEmpty(nC, nR))
5096 rBuf.append(rCxt.
mxOpCodeMap->getSymbol(ocArrayClose));
5119 rBuf.append(it->second);
5124 if (nTab != rPos.
Tab())
5130 if (!
aName.isEmpty())
5133 rBuf.append( aName);
5140 sc::TokenStringContext::TabIndexMapType::const_iterator itTab = rCxt.
maSheetRangeNames.find(nTab);
5147 const NameType& rNames = itTab->second;
5148 NameType::const_iterator it = rNames.find(nIndex);
5149 if (it == rNames.end())
5155 rBuf.append(it->second);
5162 NameType::const_iterator it = rCxt.
maNamedDBs.find(nIndex);
5164 rBuf.append(it->second);
5180 ExternalHashMap::const_iterator it = rExtMap.find(aAddIn);
5181 if (it != rExtMap.end())
5183 aAddIn = it->second;
5191 rBuf.append(aAddIn);
5201 case FormulaError::DivisionByZero:
5204 case FormulaError::NoValue:
5207 case FormulaError::NoRef:
5210 case FormulaError::NoName:
5213 case FormulaError::IllegalFPOperation:
5216 case FormulaError::NotAvailable:
5219 case FormulaError::NoCode:
5243 OUStringBuffer
aBuf;
5247 for (;
p != pEnd; ++
p)
5264 if (eOp < rCxt.mxOpCodeMap->getSymbolCount())
5270 return aBuf.makeStringAndClear();
5277 if (rPos.
Col() > nMaxCol)
5279 if (rPos.
Row() > nMaxRow)
5283template<
typename T>
void wrapRange( T& n1, T& n2, T nMax )
5300 wrapRange( nCol1, nCol2, nMaxCol);
5309 wrapRange( nRow1, nRow2, nMaxRow);
5320 for (;
p != pEnd; ++
p)
5322 switch ((*p)->GetType())
5329 wrapAddress(aAbs, nMaxCol, nMaxRow);
5341 wrapColRange( aAbs, nMaxCol);
5342 wrapRowRange( aAbs, nMaxRow);
5345 wrapColRange( aAbs, nMaxCol);
5347 wrapRowRange( aAbs, nMaxRow);
5361 sal_Int32 nResult = 0;
5362 for (
auto i = 0;
i <
nRPN; ++
i)
5364 switch ((*
pRPN[
i]).GetType())
5368 const auto pComplexRef = (*
pRPN[
i]).GetDoubleRef();
5371 const double nRows = 1 + (pComplexRef->Ref2.Row() - pComplexRef->Ref1.Row());
5372 const double nCols = 1 + (pComplexRef->Ref2.Col() - pComplexRef->Ref1.Col());
5373 const double nNumCellsTerm = nRows * nCols / 10.0;
5376 nResult += nNumCellsTerm;
5392#if DEBUG_FORMULA_COMPILER
5394void ScTokenArray::Dump()
const
5396 cout <<
"+++ Normal Tokens +++" <<
endl;
5397 for (sal_uInt16 i = 0;
i <
nLen; ++
i)
5399 DumpToken(*
pCode[i]);
5402 cout <<
"+++ RPN Tokens +++" <<
endl;
5403 for (sal_uInt16 i = 0;
i <
nRPN; ++
i)
5405 DumpToken(*
pRPN[i]);
const OUString & getNumDecimalSep() const
void IncTab(SCTAB nDelta=1)
SC_DLLPUBLIC bool Move(SCCOL nDeltaX, SCROW nDeltaY, SCTAB nDeltaZ, ScAddress &rErrorPos, const ScDocument &rDoc)
void IncCol(SCCOL nDelta=1)
void IncRow(SCROW nDelta=1)
static void CheckTabQuotes(OUString &aTabName, const formula::FormulaGrammar::AddressConvention eConv=formula::FormulaGrammar::CONV_OOO)
all
ScDBData * findByIndex(sal_uInt16 nIndex)
ScSheetLimits & GetSheetLimits() const
const OUString & GetFileURL() const
SC_DLLPUBLIC ScExternalRefManager * GetExternalRefManager() const
OUString GetCopyTabName(SCTAB nTab) const
SC_DLLPUBLIC ScDBCollection * GetDBCollection() const
SC_DLLPUBLIC svl::SharedStringPool & GetSharedStringPool()
bool IsExpandRefs() const
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
virtual const ScComplexRefData * GetDoubleRef() const override
virtual bool TextEqual(const formula::FormulaToken &rToken) const override
virtual const ScSingleRefData * GetSingleRef() const override
ScSheetLimits & mrSheetLimits
ScComplexRefData aDoubleRef
virtual bool operator==(const formula::FormulaToken &rToken) const override
virtual const ScSingleRefData * GetSingleRef2() const override
virtual bool operator==(const formula::FormulaToken &rToken) const override
virtual double GetDouble() const override
bool IsDisplayedAsString() const
virtual const svl::SharedString & GetString() const override
virtual const svl::SharedString & GetString() const override
virtual const ScSingleRefData * GetSingleRef2() const override
svl::SharedString maTabName
ScComplexRefData maDoubleRef
virtual sal_uInt16 GetIndex() const override
virtual const ScSingleRefData * GetSingleRef() const override
ScExternalDoubleRefToken()=delete
virtual ~ScExternalDoubleRefToken() override
virtual const ScComplexRefData * GetDoubleRef() const override
virtual bool operator==(const formula::FormulaToken &rToken) const override
virtual const svl::SharedString & GetString() const override
ScExternalNameToken()=delete
virtual ~ScExternalNameToken() override
virtual bool operator==(const formula::FormulaToken &rToken) const override
virtual sal_uInt16 GetIndex() const override
sal_uInt16 getExternalFileId(const OUString &rFile)
ScSingleRefData maSingleRef
virtual bool operator==(const formula::FormulaToken &rToken) const override
virtual const ScSingleRefData * GetSingleRef() const override
virtual const svl::SharedString & GetString() const override
svl::SharedString maTabName
virtual ~ScExternalSingleRefToken() override
ScExternalSingleRefToken()=delete
virtual sal_uInt16 GetIndex() const override
static SC_DLLPUBLIC ScUnoAddInCollection * GetAddInCollection()
static OUString GetErrorString(FormulaError nErrNumber)
const OUString & GetFormula() const
ScHybridCellToken(double f, const svl::SharedString &rStr, OUString aFormula, bool bEmptyDisplayedAsString)
virtual double GetDouble() const override
virtual const svl::SharedString & GetString() const override
svl::SharedString maString
virtual bool operator==(const formula::FormulaToken &rToken) const override
static const ScCalcConfig & GetGlobalConfig()
virtual bool operator==(const formula::FormulaToken &rToken) const override
virtual ~ScJumpMatrixToken() override
ScJumpMatrixToken(std::shared_ptr< ScJumpMatrix > p)
virtual ScJumpMatrix * GetJumpMatrix() const override
std::shared_ptr< ScJumpMatrix > mpJumpMatrix
Transports the result from the interpreter to the formula cell.
ScMatrixCellResultToken(ScConstMatrixRef pMat, const formula::FormulaToken *pUL)
virtual const svl::SharedString & GetString() const override
formula::StackVar GetUpperLeftType() const
virtual FormulaToken * Clone() const override
virtual ~ScMatrixCellResultToken() override
void Assign(const ScMatrixCellResultToken &r)
virtual bool operator==(const formula::FormulaToken &rToken) const override
virtual double GetDouble() const override
virtual ScMatrix * GetMatrix() override
formula::FormulaConstTokenRef xUpperLeft
Token storing matrix that represents values in sheet range.
virtual const ScMatrix * GetMatrix() const override
virtual bool operator==(const formula::FormulaToken &rToken) const override
ScMatrixRangeToken(const sc::RangeMatrix &rMat)
virtual sal_uInt8 GetByte() const override
virtual FormulaToken * Clone() const override
virtual const ScComplexRefData * GetDoubleRef() const override
virtual const ScMatrix * GetMatrix() const override
ScMatrixToken(ScMatrixRef p)
virtual bool operator==(const formula::FormulaToken &rToken) const override
Matrix data type that can store values of mixed types.
void PutBoolean(bool bVal, SCSIZE nC, SCSIZE nR)
svl::SharedString GetString(SCSIZE nC, SCSIZE nR) const
bool IsStringOrEmpty(SCSIZE nIndex) const
bool IsEmpty(SCSIZE nC, SCSIZE nR) const
void PutString(const svl::SharedString &rStr, SCSIZE nC, SCSIZE nR)
bool IsBoolean(SCSIZE nC, SCSIZE nR) const
double GetDouble(SCSIZE nC, SCSIZE nR) const
FormulaError GetError(SCSIZE nC, SCSIZE nR) const
May be used before obtaining the double value of an element to avoid passing its NAN around.
void PutEmpty(SCSIZE nC, SCSIZE nR)
void PutDouble(double fVal, SCSIZE nC, SCSIZE nR)
void GetDimensions(SCSIZE &rC, SCSIZE &rR) const
bool IsValue(SCSIZE nIndex) const
bool Contains(const ScRange &) const
bool IsEndRowSticky(const ScDocument &rDoc) const
If maximum end row should not be adapted during reference update.
bool IsEndColSticky(const ScDocument &rDoc) const
If maximum end column should not be adapted during reference update.
bool Move(SCCOL aDeltaX, SCROW aDeltaY, SCTAB aDeltaZ, ScRange &rErrorRange, const ScDocument &rDoc)
void IncEndRowSticky(const ScDocument &rDoc, SCROW nDelta)
Increment or decrement end row unless sticky or until it becomes sticky.
bool Intersects(const ScRange &rRange) const
void IncEndColSticky(const ScDocument &rDoc, SCCOL nDelta)
Increment or decrement end column unless sticky or until it becomes sticky.
bool Contains(const ScAddress &) const
is Address& fully in Range?
bool MoveSticky(const ScDocument &rDoc, SCCOL aDeltaX, SCROW aDeltaY, SCTAB aDeltaZ, ScRange &rErrorRange)
Same as Move() but with sticky end col/row anchors.
virtual bool operator==(const formula::FormulaToken &rToken) const override
bool IsArrayResult() const
virtual const ScRefList * GetRefList() const override
static ScMatrixRef CreateMixedMatrix(const css::uno::Any &rAny)
Convert a sequence of mixed elements to ScMatrix.
virtual bool operator==(const formula::FormulaToken &rToken) const override
ScSingleRefData aSingleRef
virtual const ScSingleRefData * GetSingleRef() const override
virtual bool TextEqual(const formula::FormulaToken &rToken) const override
ScSheetLimits & mrSheetLimits
Special token to remember details of ocTableRef "structured references".
sal_uInt16 mnIndex
index into table / database range collection
virtual sal_uInt16 GetIndex() const override
void SetAreaRefRPN(formula::FormulaToken *pToken)
formula::FormulaTokenRef mxAreaRefRPN
resulting RPN area
formula::FormulaToken * GetAreaRefRPN() const
virtual void SetIndex(sal_uInt16 n) override
virtual sal_Int16 GetSheet() const override
virtual ~ScTableRefToken() override
virtual bool operator==(const formula::FormulaToken &rToken) const override
void AddExternalSingleReference(sal_uInt16 nFileId, const svl::SharedString &rTabName, const ScSingleRefData &rRef)
sc::RefUpdateResult AdjustReferenceOnMovedTab(const sc::RefUpdateMoveTabContext &rCxt, const ScAddress &rOldPos)
void AdjustReferenceOnCopy(const ScAddress &rNewPos)
Adjust internal range references on base position change to justify / put in order the relative refer...
void CheckExpandReferenceBounds(const sc::RefUpdateContext &rCxt, const ScAddress &rPos, SCROW nGroupLen, std::vector< SCROW > &rBounds) const
virtual bool AddFormulaToken(const css::sheet::FormulaToken &rToken, svl::SharedStringPool &rSPool, formula::ExternalReferenceHelper *_pRef) override
ScTokenArray CloneValue() const
True copy!
sc::RefUpdateResult AdjustReferenceOnShift(const sc::RefUpdateContext &rCxt, const ScAddress &rOldPos)
Adjust all references in response to shifting of cells during cell insertion and deletion.
virtual formula::FormulaToken * AddOpCode(OpCode eCode) override
void CheckRelativeReferenceBounds(const sc::RefUpdateContext &rCxt, const ScAddress &rPos, SCROW nGroupLen, std::vector< SCROW > &rBounds) const
formula::FormulaToken * AddColRowName(const ScSingleRefData &rRef)
ScSingleRefOpToken with ocColRowName.
bool EqualTokens(const ScTokenArray *pArr2) const
void CheckForThreading(const formula::FormulaToken &r)
virtual void CheckToken(const formula::FormulaToken &r) override
virtual ~ScTokenArray() override
std::unique_ptr< ScTokenArray > Clone() const
formula::FormulaToken * AddMatrixSingleReference(const ScSingleRefData &rRef)
ScSingleRefOpToken with ocMatRef.
void AssignXMLString(const OUString &rText, const OUString &rFormulaNmsp)
Assign XML string placeholder to the array.
void MoveReferenceColReorder(const ScAddress &rPos, SCTAB nTab, SCROW nRow1, SCROW nRow2, const sc::ColRowReorderMapType &rColMap)
Move reference positions in response to column reordering.
ScTokenArray(const ScDocument &rDoc)
bool IsFormulaVectorDisabled() const
formula::FormulaToken * AddExternalDoubleReference(sal_uInt16 nFileId, const svl::SharedString &rTabName, const ScComplexRefData &rRef)
void AdjustReferenceOnMovedOriginIfOtherSheet(const ScAddress &rOldPos, const ScAddress &rNewPos)
Adjust all internal references on base position change if they point to a sheet other than the one of...
formula::FormulaToken * AddRawToken(const ScRawToken &)
sc::RefUpdateResult AdjustReferenceOnDeletedTab(const sc::RefUpdateDeleteTabContext &rCxt, const ScAddress &rOldPos)
Adjust all references on sheet deletion.
bool ReferencesSheet(SCTAB nTab, SCTAB nPosTab) const
Returns true if the sheet nTab is referenced in code.
void WrapReference(const ScAddress &rPos, SCCOL nMaxCol, SCROW nMaxRow)
formula::FormulaToken * AddDBRange(sal_uInt16 n)
bool ImplGetReference(ScRange &rRange, const ScAddress &rPos, bool bValidOnly) const
formula::FormulaToken * AddMatrix(const ScMatrixRef &p)
sc::RefUpdateResult AdjustReferenceOnInsertedTab(const sc::RefUpdateInsertTabContext &rCxt, const ScAddress &rOldPos)
rtl::Reference< ScSheetLimits > mxSheetLimits
sc::RefUpdateResult AdjustReferenceOnMove(const sc::RefUpdateContext &rCxt, const ScAddress &rOldPos, const ScAddress &rNewPos)
void AdjustSheetLocalNameReferences(SCTAB nOldTab, SCTAB nNewTab)
When copying a sheet-local named expression, move sheet references that point to the originating shee...
formula::FormulaToken * AddDoubleReference(const ScComplexRefData &rRef)
sc::RefUpdateResult AdjustReferenceInMovedName(const sc::RefUpdateContext &rCxt, const ScAddress &rPos)
void AdjustReferenceOnMovedOrigin(const ScAddress &rOldPos, const ScAddress &rNewPos)
Adjust all internal references on base position change.
OUString CreateString(sc::TokenStringContext &rCxt, const ScAddress &rPos) const
Create a string representation of formula token array without modifying the internal state of the tok...
sc::RefUpdateResult AdjustReferenceInName(const sc::RefUpdateContext &rCxt, const ScAddress &rPos)
Adjust all references in named expression.
formula::FormulaToken * AddSingleReference(const ScSingleRefData &rRef)
ScSingleRefToken with ocPush.
sal_Int32 GetWeight() const
ScTokenArray & operator=(const ScTokenArray &)
Assignment with incrementing references of FormulaToken entries (not copied!)
void AddRangeName(sal_uInt16 n, sal_Int16 nSheet)
bool IsValidReference(ScRange &rRange, const ScAddress &rPos) const
Exactly and only one valid range (no #REF!s)
bool IsInvariant() const
If the array contains at least one relative row reference or named expression, it's variant.
virtual formula::FormulaToken * MergeArray() override
void MoveReferenceRowReorder(const ScAddress &rPos, SCTAB nTab, SCCOL nCol1, SCCOL nCol2, const sc::ColRowReorderMapType &rRowMap)
void AdjustAbsoluteRefs(const ScDocument &rOldDoc, const ScAddress &rOldPos, const ScAddress &rNewPos, bool bCheckCopyArea)
Make all absolute references pointing to the copied range if the range is copied too.
void ReadjustAbsolute3DReferences(const ScDocument &rOldDoc, ScDocument &rNewDoc, const ScAddress &rPos, bool bRangeName=false)
Make all absolute references external references pointing to the old document.
ScFormulaVectorState meVectorState
void MergeRangeReference(const ScAddress &rPos)
Merge very last SingleRef+ocRange+SingleRef combination into DoubleRef and adjust pCode array,...
virtual void Clear() override
formula::FormulaToken * AddExternalName(sal_uInt16 nFileId, const svl::SharedString &rName)
bool IsReference(ScRange &rRange, const ScAddress &rPos) const
Exactly and only one range (valid or deleted)
bool GetAdjacentExtendOfOuterFuncRefs(SCCOLROW &nExtend, const ScAddress &rPos, ScDirection)
Determines the extent of direct adjacent references.
void ClearTabDeleted(const ScAddress &rPos, SCTAB nStartTab, SCTAB nEndTab)
Clear sheet deleted flag from internal reference tokens if the sheet index falls within specified ran...
void LocalizeString(OUString &rName)
modify rName - input: exact name
const LocaleDataWrapper & GetLocaleData() const
const_iterator end() const
DataType::const_iterator const_iterator
const_iterator find(DataType::key_type key) const
Keep track of all named expressions that have been updated during reference update.
bool isNameUpdated(SCTAB nTab, sal_uInt16 nIndex) const
SharedString intern(const OUString &rStr)
const OUString & getString() const
static const SharedString & getEmptyString()
#define SC_OPCODE_START_FUNCTION
#define SC_OPCODE_STOP_UN_OP
#define SC_OPCODE_STOP_FUNCTION
#define SC_OPCODE_START_BIN_OP
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
std::unique_ptr< sal_Int32[]> pData
bool getRangeFromToken(const ScDocument *pDoc, ScRange &rRange, const ScTokenRef &pToken, const ScAddress &rPos, bool bExternal=false)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
css::uno::Reference< css::animations::XAnimationNode > Clone(const css::uno::Reference< css::animations::XAnimationNode > &xSourceNode, const SdPage *pSource=nullptr, const SdPage *pTarget=nullptr)
const wchar_t *typedef int(__stdcall *DllNativeUnregProc)(int
TOOLS_DLLPUBLIC SvStream & endl(SvStream &rStr)
static bool isOpenCLEnabled()
OpCodeSet mpOpenCLSubsetOpCodes
static bool isThreadingEnabled()
This struct stores general clipboard parameters associated with a ScDocument instance created in clip...
@ SHEET_SEPARATOR
Character between sheet name and address.
const formula::FormulaGrammar::AddressConvention meConv
virtual sal_Unicode getSpecialSymbol(SpecialSymbolType eSymType) const =0
virtual OUString makeExternalNameStr(sal_uInt16 nFileId, const OUString &rFile, const OUString &rName) const =0
virtual void makeExternalRefStr(ScSheetLimits &rLimits, OUStringBuffer &rBuffer, const ScAddress &rPos, sal_uInt16 nFileId, const OUString &rFileName, const OUString &rTabName, const ScSingleRefData &rRef) const =0
virtual void makeRefStr(ScSheetLimits &rLimits, OUStringBuffer &rBuffer, formula::FormulaGrammar::Grammar eGram, const ScAddress &rPos, const OUString &rErrRef, const std::vector< OUString > &rTabNames, const ScComplexRefData &rRef, bool bSingleRef, bool bFromRangeName) const =0
Complex reference (a range) into the sheet.
SC_DLLPUBLIC ScRange toAbs(const ScSheetLimits &rLimits, const ScAddress &rPos) const
void InitRange(const ScRange &rRange)
bool Valid(const ScDocument &rDoc) const
bool IsEntireRow(const ScSheetLimits &rLimits) const
Whether this references entire rows, 1:1.
bool IncEndRowSticky(const ScDocument &rDoc, SCROW nDelta, const ScAddress &rPos)
Increment or decrement end row unless or until sticky.
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...
bool IncEndColSticky(const ScDocument &rDoc, SCCOL nDelta, const ScAddress &rPos)
Increment or decrement end column unless or until sticky.
bool IsEntireCol(const ScSheetLimits &rLimits) const
Whether this references entire columns, A:A.
ScComplexRefData & Extend(const ScSheetLimits &rLimits, const ScSingleRefData &rRef, const ScAddress &rPos)
Enlarge range if reference passed is not within existing range.
void PutInOrder(const ScAddress &rPos)
Adjust ordering (front-top-left/rear-bottom-right) to a new position.
static void UpdateDeleteTab(ScAddress &rAddr, const sc::RefUpdateDeleteTabContext &rCxt)
This is for the base-cell-address of a defined name or conditional format, not for references.
void SetExternalDoubleRef(sal_uInt16 nFileId, const OUString &rTabName, const ScComplexRefData &rRef)
void SetDouble(double fVal)
void SetString(rtl_uString *pData, rtl_uString *pDataIgnoreCase)
struct ScRawToken::@17::@24 table
void SetDoubleReference(const ScComplexRefData &rRef)
short nJump[FORMULA_MAXJUMPCOUNT+1]
void SetExternalSingleRef(sal_uInt16 nFileId, const OUString &rTabName, const ScSingleRefData &rRef)
void SetOpCode(OpCode eCode)
struct ScRawToken::@17::@19 whitespace
struct ScRawToken::@17::@20 sbyte
void SetName(sal_Int16 nSheet, sal_uInt16 nIndex)
bool IsValidReference(const ScDocument &rDoc) const
If the token is a non-external reference, determine if the reference is valid.
struct ScRawToken::@17::@25 sharedstring
void SetSingleReference(const ScSingleRefData &rRef)
void SetErrorConstant(FormulaError nErr)
formula::StackVar GetType() const
only delete via Delete()
struct ScRawToken::@17::@21 extref
void SetExternalName(sal_uInt16 nFileId, const OUString &rName)
struct ScRawToken::@17::@23 name
void SetExternal(const OUString &rStr)
struct ScRawToken::@17::@22 extname
formula::FormulaToken * CreateToken(ScSheetLimits &rLimits) const
SCROW GetMaxRowCount() const
bool ValidRow(SCROW nRow) const
Single reference (one address) into the sheet.
void SetAbsCol(SCCOL nVal)
void SetAbsTab(SCTAB nVal)
void SetAddress(const ScSheetLimits &rLimits, const ScAddress &rAddr, const ScAddress &rPos)
bool IsRowDeleted() const
void SetRowRel(bool bVal)
void SetTabRel(bool bVal)
void SetColDeleted(bool bVal)
void SetRelRow(SCROW nVal)
void SetRelTab(SCTAB nVal)
bool Valid(const ScDocument &rDoc) const
ScAddress toAbs(const ScSheetLimits &rLimits, const ScAddress &rPos) const
void SetAbsRow(SCROW nVal)
sal_uInt8 FlagValue() const
void SetRelCol(SCCOL nVal)
bool IsTabDeleted() const
void SetFlag3D(bool bVal)
void InitFlags()
No default ctor, because used in ScRawToken union, set InitFlags!
void SetRelName(bool bVal)
void SetRowDeleted(bool bVal)
bool IsColDeleted() const
void SetColRel(bool bVal)
void SetTabDeleted(bool bVal)
Context for reference update during shifting, moving or copying of cell ranges.
SCROW mnRowDelta
Amount and direction of movement in the row direction.
UpdateRefMode meMode
update mode - insert/delete, copy, or move.
SCCOL mnColDelta
Amount and direction of movement in the column direction.
bool mbTransposed
Are the data transposed?
SCTAB mnTabDelta
Amount and direction of movement in the sheet direction.
ScRange maRange
Range of cells that are about to be moved for insert/delete/move modes.
UpdatedRangeNames maUpdatedNames
UpdatedRangeNames maUpdatedNames
UpdatedRangeNames maUpdatedNames
UpdatedRangeNames maUpdatedNames
SCTAB getNewTab(SCTAB nOldTab) const
bool mbReferenceModified
This flag indicates whether any reference in the token array has been modified.
bool mbValueChanged
When this flag is true, the result of the formula needs to be re-calculated either because it contain...
bool mbNameModified
When this flag is true, it indicates that the token array contains a range name that's been updated.
Context for creating string from an array of formula tokens, used in ScTokenArray::CreateString().
formula::FormulaCompiler::OpCodeMapPtr mxOpCodeMap
std::vector< OUString > maExternalFileNames
IndexNamesMapType maExternalCachedTabNames
TabIndexMapType maSheetRangeNames
const ScCompiler::Convention * mpRefConv
formula::FormulaGrammar::Grammar meGram
std::vector< OUString > maTabNames
IndexNameMapType maGlobalRangeNames
IndexNameMapType maNamedDBs
std::unordered_map< sal_uInt16, OUString > IndexNameMapType
FormulaTokenRef extendRangeReference(ScSheetLimits &rLimits, FormulaToken &rTok1, FormulaToken &rTok2, const ScAddress &rPos, bool bReuseDoubleRef)
If rTok1 and rTok2 both are SingleRef or DoubleRef tokens, extend/merge ranges as needed for ocRange.
#define IF_NOT_OPCODE_ERROR(o, c)
static bool checkArraySep(bool &bPrevWasSep, bool bNewVal)
::std::vector< ScComplexRefData > ScRefList
#define MATRIX_TOKEN_HAS_RANGE
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
::boost::intrusive_ptr< const ScMatrix > ScConstMatrixRef
::boost::intrusive_ptr< ScMatrix > ScMatrixRef
@ FormulaVectorDisabledByOpCode
@ FormulaVectorDisabledByStackVariable
@ FormulaVectorDisabledNotInSubSet
@ FormulaVectorCheckReference
::boost::intrusive_ptr< formula::FormulaToken > ScTokenRef
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)