23#include <document.hxx>
28#include <compiler.hxx>
33#include <tokenarray.hxx>
55#include <osl/diagnose.h>
61using ::editeng::SvxBorderLine;
69 return ( nScript != SvtScriptType::LATIN &&
70 nScript != SvtScriptType::ASIAN &&
71 nScript != SvtScriptType::COMPLEX &&
72 nScript != SvtScriptType::NONE );
78 pPattern(nullptr), bFormula(false), bSkipMerged(true), bGetFont(true), bTotalSize(false)
83 maCellTextAttrs(rSheetLimits.GetMaxRowCount()),
84 maCellNotes(rSheetLimits.GetMaxRowCount()),
85 maBroadcasters(rSheetLimits.GetMaxRowCount()),
86 maCells(
sc::CellStoreEvent(this)),
87 maSparklines(rSheetLimits.GetMaxRowCount()),
91 mbEmptyBroadcastersPending( false )
105 if ( bEmptyAttrArray )
112 bool bNoMatrixAtAll )
const
117 return MatrixEdge::Nothing;
123 std::pair<sc::CellStoreType::const_iterator,size_t> aPos =
maCells.position(nRow1);
125 return MatrixEdge::Nothing;
127 const ScFormulaCell* pCell = sc::formula_block::at(*aPos.first->data, aPos.second);
129 return MatrixEdge::Nothing;
137 std::pair<sc::CellStoreType::const_iterator,size_t> aPos =
maCells.position(nRow1);
138 sc::CellStoreType::const_iterator it = aPos.first;
139 size_t nOffset = aPos.second;
141 for (;it !=
maCells.end() && nRow <= nRow2; ++it, nOffset = 0)
146 nRow += it->size - nOffset;
150 size_t nRowsToRead = nRow2 - nRow + 1;
151 size_t nEnd = std::min(it->size, nOffset+nRowsToRead);
152 sc::formula_block::const_iterator itCell = sc::formula_block::begin(*it->data);
153 std::advance(itCell, nOffset);
154 for (
size_t i = nOffset;
i < nEnd; ++itCell, ++
i)
162 if (nEdges == MatrixEdge::Nothing)
168 return MatrixEdge::Inside;
170 if (nEdges & MatrixEdge::Top)
173 return nEdges | MatrixEdge::Open;
174 else if (nEdges & MatrixEdge::Inside)
180 if (nEdges & MatrixEdge::Bottom)
184 nRow += nEnd - nOffset;
187 nEdges |= MatrixEdge::Open;
204 for (
size_t i = 0,
n = aRanges.
size();
i <
n; ++
i)
215 std::pair<sc::CellStoreType::const_iterator,size_t> aPos =
maCells.position(nRow);
216 sc::CellStoreType::const_iterator it = aPos.first;
217 size_t nOffset = aPos.second;
219 for (;it !=
maCells.end() && nRow <= nBottom; ++it, nOffset = 0)
224 nRow += it->size - nOffset;
229 size_t nRowsToRead = nBottom - nRow + 1;
230 size_t nEnd = std::min(it->size, nRowsToRead);
231 sc::formula_block::const_iterator itCell = sc::formula_block::begin(*it->data);
232 std::advance(itCell, nOffset);
233 for (
size_t j = nOffset; j < nEnd; ++itCell, ++j)
242 if (nEdges == MatrixEdge::Nothing)
247 if (nEdges & MatrixEdge::Top)
251 else if (nEdges & MatrixEdge::Inside)
258 if (nEdges & MatrixEdge::Bottom)
269 if (aCurOrigin != aOrigin)
271 aCurOrigin = aOrigin;
310 while (aMultiIter.
Next( nTop, nBottom ) && !bFound)
312 if (
pAttrArray->HasAttrib( nTop, nBottom, nMask ))
331 while (aMultiIter.
Next( nTop, nBottom ))
332 pAttrArray->MergePatternArea( nTop, nBottom, rState, bDeep );
339 ::std::map< const ScPatternAttr*, size_t > aAttrMap;
341 size_t nMaxCount = 0;
345 SCROW nAttrRow1 = 0, nAttrRow2 = 0;
347 while( (pPattern = aAttrIter.
Next( nAttrRow1, nAttrRow2 )) !=
nullptr )
349 size_t& rnCount = aAttrMap[ pPattern ];
350 rnCount += (nAttrRow2 - nAttrRow1 + 1);
351 if( rnCount > nMaxCount )
353 pMaxPattern = pPattern;
363 SCROW nPatStartRow, nPatEndRow;
366 while (nEndRow > nPatEndRow)
368 nStartRow = nPatEndRow + 1;
369 pPattern =
pAttrArray->GetPatternRange(nPatStartRow, nPatEndRow, nStartRow);
371 if (nFormat != nTmpFormat)
378 bool*
const pIsChanged )
384 bool*
const pIsChanged,
SCCOL nCol )
393 while (aMultiIter.
Next( nTop, nBottom ))
395 pAttrArray->ApplyCacheArea( nTop, nBottom, pCache, pDataArray, pIsChanged );
402 else if (nTop==0 && nBottom==
GetDoc().MaxRow())
416 while (aMultiIter.
Next( nTop, nBottom ))
417 pAttrArray->ChangeIndent(nTop, nBottom, bIncrement);
436 while (aMultiIter.
Next( nTop, nBottom ))
437 pAttrArray->ClearItems(nTop, nBottom, pWhich);
462 while (aMultiIter.
Next( nTop, nBottom ))
463 DeleteArea(nTop, nBottom, nDelFlag, bBroadcast);
478 if (pNewPattern != pPattern)
487 pAttrArray->ApplyCacheArea( nStartRow, nEndRow, &aCache, pDataArray, pIsChanged );
501 nRow1, nRow2, nRow );
508 SCROW nNewRow1 = std::max( nRow1, nRow );
509 SCROW nNewRow2 = std::min( nRow2, nEndRow );
510 pAttrArray->ApplyCacheArea( nNewRow1, nNewRow2, &aCache );
519 std::unique_ptr<ScPatternAttr> pNewPattern(
new ScPatternAttr(*pPattern));
520 pNewPattern->SetStyleSheet(
const_cast<ScStyleSheet*
>(rStyle));
521 pAttrArray->SetPattern(nRow, std::move(pNewPattern),
true);
532 while (aMultiIter.
Next( nTop, nBottom ))
533 pAttrArray->ApplyStyleArea(nTop, nBottom, rStyle);
538 const SvxBorderLine* pLine,
bool bColorOnly )
540 if ( bColorOnly && !pLine )
549 while (aMultiIter.
Next( nTop, nBottom ))
550 pAttrArray->ApplyLineStyleArea(nTop, nBottom, pLine, bColorOnly );
559 OSL_FAIL(
"No selection in ScColumn::GetSelectionStyle");
572 while (bEqual && aMultiIter.
Next( nTop, nBottom ))
584 if ( !pNewStyle || ( pStyle && pNewStyle != pStyle ) )
590 return bEqual ? pStyle :
nullptr;
612 if ( !pNewStyle || ( pStyle && pNewStyle != pStyle ) )
617 return bEqual ? pStyle :
nullptr;
632 if ( pNewPattern != pOldPattern )
635 pDocPool->
Remove( *pNewPattern );
640 std::pair<sc::CellStoreType::const_iterator,size_t> aPos =
maCells.position(nRow);
641 if (aPos.first ==
maCells.end())
649 std::pair<sc::CellStoreType::iterator,size_t> aPos =
maCells.position(rBlockPos.
miCellPos, nRow);
650 if (aPos.first ==
maCells.end())
659 std::pair<sc::CellStoreType::const_iterator,size_t> aPos =
maCells.position(rBlockPos.
miCellPos, nRow);
660 if (aPos.first ==
maCells.end())
673 return ScRefCellValue(sc::numeric_block::at(*itPos->data, nOffset));
677 return ScRefCellValue(&sc::string_block::at(*itPos->data, nOffset));
681 return ScRefCellValue(sc::edittext_block::at(*itPos->data, nOffset));
685 return ScRefCellValue(sc::formula_block::at(*itPos->data, nOffset));
710 return &sc::celltextattr_block::at(*aPos.first->data, aPos.second);
719 std::pair<sc::CellStoreType::const_iterator,size_t> aPos =
maCells.position(nStartRow);
720 sc::CellStoreType::const_iterator it = aPos.first;
725 size_t nLen = it->size - aPos.second;
726 SCROW nNextNonEmptyRow = nStartRow + nLen;
727 if (nNextNonEmptyRow <= nEndRow)
739 std::pair<sc::CellStoreType::const_iterator,size_t> aPos =
maCells.position(nStartRow);
740 sc::CellStoreType::const_iterator it = aPos.first;
750 sc::CellStoreType::const_reverse_iterator it =
maCells.rbegin();
752 nLastNonEmptyRow -= it->size;
781 maCells.insert_empty(nStartRow, nSize);
792class CopyToClipHandler
800 void setDefaultAttrsToDest(
size_t nRow,
size_t nSize)
802 std::vector<sc::CellTextAttr> aAttrs(nSize);
809 mrSrcDoc(rSrcDoc), mrSrcCol(rSrcCol), mrDestCol(rDestCol), mpDestPos(pDestPos)
812 maDestPos = *mpDestPos;
820 *mpDestPos = maDestPos;
823 void operator() (
const sc::CellStoreType::value_type& aNode,
size_t nOffset,
size_t nDataSize)
825 size_t nTopRow = aNode.position + nOffset;
833 sc::numeric_block::const_iterator it = sc::numeric_block::begin(*aNode.data);
834 std::advance(it, nOffset);
835 sc::numeric_block::const_iterator itEnd = it;
836 std::advance(itEnd, nDataSize);
842 sc::string_block::const_iterator it = sc::string_block::begin(*aNode.data);
843 std::advance(it, nOffset);
844 sc::string_block::const_iterator itEnd = it;
845 std::advance(itEnd, nDataSize);
852 sc::edittext_block::const_iterator it = sc::edittext_block::begin(*aNode.data);
853 std::advance(it, nOffset);
854 sc::edittext_block::const_iterator itEnd = it;
855 std::advance(itEnd, nDataSize);
857 std::vector<EditTextObject*> aCloned;
858 aCloned.reserve(nDataSize);
859 for (; it != itEnd; ++it)
863 maDestPos.
miCellPos, nTopRow, aCloned.begin(), aCloned.end());
868 sc::formula_block::const_iterator it = sc::formula_block::begin(*aNode.data);
869 std::advance(it, nOffset);
870 sc::formula_block::const_iterator itEnd = it;
871 std::advance(itEnd, nDataSize);
873 std::vector<ScFormulaCell*> aCloned;
874 aCloned.reserve(nDataSize);
876 for (; it != itEnd; ++it, aDestPos.IncRow())
886 if (!aCloned.empty())
891 maDestPos.
miCellPos, nTopRow, aCloned.begin(), aCloned.end());
894 sc::CellStoreType::position_type aPos =
895 rDestCells.position(maDestPos.
miCellPos, nTopRow);
898 size_t nLastRow = nTopRow + nDataSize;
901 aPos = rDestCells.position(maDestPos.
miCellPos, nLastRow+1);
911 setDefaultAttrsToDest(nTopRow, nDataSize);
913 mrSrcCol.
DuplicateNotes(nTopRow, nDataSize, mrDestCol, maDestPos,
false);
918class CopyTextAttrToClipHandler
921 sc::CellTextAttrStoreType::iterator miPos;
925 mrDestAttrs(rAttrs), miPos(mrDestAttrs.
begin()) {}
927 void operator() (
const sc::CellTextAttrStoreType::value_type& aNode,
size_t nOffset,
size_t nDataSize )
932 sc::celltextattr_block::const_iterator it = sc::celltextattr_block::begin(*aNode.data);
933 std::advance(it, nOffset);
934 sc::celltextattr_block::const_iterator itEnd = it;
935 std::advance(itEnd, nDataSize);
937 size_t nPos = aNode.position + nOffset;
938 miPos = mrDestAttrs.set(miPos, nPos, it, itEnd);
975 rDestCol.
maCells.set_empty(nRow1, nRow2);
980 std::pair<sc::CellStoreType::const_iterator,size_t> aPos =
maCells.position(nRow1);
981 sc::CellStoreType::const_iterator it = aPos.first;
982 size_t nOffset = aPos.second;
983 size_t nDataSize = 0;
984 size_t nCurRow = nRow1;
988 bool bLastBlock =
false;
989 nDataSize = it->size - nOffset;
993 nDataSize = nRow2 - nCurRow + 1;
1001 sc::numeric_block::const_iterator itData = sc::numeric_block::begin(*it->data);
1002 std::advance(itData, nOffset);
1003 sc::numeric_block::const_iterator itDataEnd = itData;
1004 std::advance(itDataEnd, nDataSize);
1010 sc::string_block::const_iterator itData = sc::string_block::begin(*it->data);
1011 std::advance(itData, nOffset);
1012 sc::string_block::const_iterator itDataEnd = itData;
1013 std::advance(itDataEnd, nDataSize);
1019 sc::edittext_block::const_iterator itData = sc::edittext_block::begin(*it->data);
1020 std::advance(itData, nOffset);
1021 sc::edittext_block::const_iterator itDataEnd = itData;
1022 std::advance(itDataEnd, nDataSize);
1025 std::vector<svl::SharedString> aConverted;
1026 aConverted.reserve(nDataSize);
1027 for (; itData != itDataEnd; ++itData)
1031 aConverted.push_back(aSS);
1038 sc::formula_block::const_iterator itData = sc::formula_block::begin(*it->data);
1039 std::advance(itData, nOffset);
1040 sc::formula_block::const_iterator itDataEnd = itData;
1041 std::advance(itDataEnd, nDataSize);
1044 for (
SCROW i = 0; itData != itDataEnd; ++itData, ++
i)
1046 SCROW nRow = nCurRow +
i;
1076 for (
SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
1079 SvNumberFormatterMergeMap::const_iterator itNum = rMap.find(nNumFmt);
1080 if (itNum != rMap.end())
1081 nNumFmt = itNum->second;
1092 std::pair<sc::CellStoreType::const_iterator,size_t> aPos =
maCells.position(nSrcRow);
1093 sc::CellStoreType::const_iterator it = aPos.first;
1098 rDestCol.
maCells.set(nDestRow, sc::numeric_block::at(*it->data, aPos.second));
1101 rDestCol.
maCells.set(nDestRow, sc::string_block::at(*it->data, aPos.second));
1106 if (&rDocument == &rDestCol.
GetDoc())
1107 rDestCol.
maCells.set(nDestRow,
p->Clone().release());
1114 ScFormulaCell*
p = sc::formula_block::at(*it->data, aPos.second);
1119 aDestPos.
SetRow(nDestRow);
1127 rDestCol.
maCells.set_empty(nDestRow, nDestRow);
1145 rDestCol.
maCellNotes.set_empty(nDestRow, nDestRow);
1150 rDestCol.
maCellNotes.set_empty(nDestRow, nDestRow);
1162 if ((
nType == SvNumFormatType::DATE) || (
nType == SvNumFormatType::TIME) || (
nType == SvNumFormatType::DATETIME))
1168class CopyAsLinkHandler
1178 void setDefaultAttrToDest(
size_t nRow)
1184 void setDefaultAttrsToDest(
size_t nRow,
size_t nSize)
1186 std::vector<sc::CellTextAttr> aAttrs(nSize);
1198 aArr.AddSingleReference(aRef);
1202 void createRefBlock(
const sc::CellStoreType::value_type& aNode,
size_t nOffset,
size_t nDataSize)
1204 size_t nTopRow = aNode.position + nOffset;
1206 for (
size_t i = 0;
i < nDataSize; ++
i)
1208 SCROW nRow = nTopRow +
i;
1209 mrDestCol.
SetFormulaCell(maDestPos, nRow, createRefCell(nRow), meListenType);
1212 setDefaultAttrsToDest(nTopRow, nDataSize);
1218 mrDestCol(rDestCol),
1219 mpDestPos(pDestPos),
1220 mnCopyFlags(nCopyFlags),
1224 maDestPos = *mpDestPos;
1227 ~CopyAsLinkHandler()
1238 *mpDestPos = maDestPos;
1242 void setStartListening(
bool b )
1247 void operator() (
const sc::CellStoreType::value_type& aNode,
size_t nOffset,
size_t nDataSize)
1249 size_t nRow = aNode.position + nOffset;
1254 mrSrcCol.
DuplicateNotes(nRow, nDataSize, mrDestCol, maDestPos, bCloneCaption);
1264 sc::numeric_block::const_iterator it = sc::numeric_block::begin(*aNode.data);
1265 std::advance(it, nOffset);
1266 sc::numeric_block::const_iterator itEnd = it;
1267 std::advance(itEnd, nDataSize);
1270 for (; it != itEnd; ++it, aSrcPos.IncRow(), ++nRow)
1272 if (!canCopyValue(mrSrcCol.
GetDoc(), aSrcPos, mnCopyFlags))
1276 setDefaultAttrToDest(nRow);
1286 createRefBlock(aNode, nOffset, nDataSize);
1294 createRefBlock(aNode, nOffset, nDataSize);
1303class CopyByCloneHandler
1315 void setDefaultAttrToDest(
size_t nRow)
1321 void setDefaultAttrsToDest(
size_t nRow,
size_t nSize)
1323 std::vector<sc::CellTextAttr> aAttrs(nSize);
1338 bool bForceFormula =
false;
1340 if (bCloneSpecialBoolean)
1344 if (pCode && pCode->
GetLen() == 1)
1349 bForceFormula =
true;
1353 if (bForceFormula || bCloneFormula)
1359 setDefaultAttrToDest(nRow);
1369 if (nErr != FormulaError::NONE)
1374 mrDestCol.
SetFormulaCell(maDestPos, nRow, pErrCell, meListenType);
1375 setDefaultAttrToDest(nRow);
1380 if (bCloneValue || bCloneDateTime)
1388 setDefaultAttrToDest(nRow);
1417 setDefaultAttrToDest(nRow);
1424 mrDestCol(rDestCol),
1425 mpDestPos(pDestPos),
1426 mpSharedStringPool(pSharedStringPool),
1427 mnCopyFlags(nCopyFlags),
1432 maDestPos = *mpDestPos;
1435 ~CopyByCloneHandler()
1458 *mpDestPos = maDestPos;
1461 void setStartListening(
bool b )
1466 void operator() (
const sc::CellStoreType::value_type& aNode,
size_t nOffset,
size_t nDataSize)
1468 size_t nRow = aNode.position + nOffset;
1473 mrSrcCol.
DuplicateNotes(nRow, nDataSize, mrDestCol, maDestPos, bCloneCaption);
1483 sc::numeric_block::const_iterator it = sc::numeric_block::begin(*aNode.data);
1484 std::advance(it, nOffset);
1485 sc::numeric_block::const_iterator itEnd = it;
1486 std::advance(itEnd, nDataSize);
1489 for (; it != itEnd; ++it, aSrcPos.IncRow(), ++nRow)
1491 if (!canCopyValue(mrSrcCol.
GetDoc(), aSrcPos, mnCopyFlags))
1495 setDefaultAttrToDest(nRow);
1504 sc::string_block::const_iterator it = sc::string_block::begin(*aNode.data);
1505 std::advance(it, nOffset);
1506 sc::string_block::const_iterator itEnd = it;
1507 std::advance(itEnd, nDataSize);
1509 for (; it != itEnd; ++it, ++nRow)
1522 if (mpSharedStringPool)
1534 setDefaultAttrToDest(nRow);
1544 sc::edittext_block::const_iterator it = sc::edittext_block::begin(*aNode.data);
1545 std::advance(it, nOffset);
1546 sc::edittext_block::const_iterator itEnd = it;
1547 std::advance(itEnd, nDataSize);
1549 std::vector<EditTextObject*> aCloned;
1550 aCloned.reserve(nDataSize);
1551 for (; it != itEnd; ++it)
1555 maDestPos.
miCellPos, nRow, aCloned.begin(), aCloned.end());
1557 setDefaultAttrsToDest(nRow, nDataSize);
1562 sc::formula_block::const_iterator it = sc::formula_block::begin(*aNode.data);
1563 std::advance(it, nOffset);
1564 sc::formula_block::const_iterator itEnd = it;
1565 std::advance(itEnd, nDataSize);
1580 for (; it != itEnd; ++it, ++nRow)
1581 cloneFormulaCell(nRow, **it);
1595 const ScMarkData* pMarkData,
bool bAsLink,
bool bGlobalNamesToLocal)
const
1604 while ( aIter.
Next( nStart, nEnd ) && nStart <= nRow2 )
1606 if ( nEnd >= nRow1 )
1607 CopyToColumn(rCxt, std::max(nRow1,nStart), std::min(nRow2,nEnd),
1608 nFlags,
false, rColumn, pMarkData, bAsLink );
1613 OSL_FAIL(
"CopyToColumn: bMarked, but no mark");
1623 for (
SCROW nRow = nRow1; nRow <= nRow2; nRow++ )
1626 rColumn.
pAttrArray->GetPattern( nRow )->GetStyleSheet();
1628 std::unique_ptr<ScPatternAttr> pNewPattern(
new ScPatternAttr( *pPattern ));
1629 pNewPattern->SetStyleSheet(
const_cast<ScStyleSheet*
>(pStyle) );
1630 rColumn.
pAttrArray->SetPattern( nRow, std::move(pNewPattern),
true );
1654 pSharedStringPool, bGlobalNamesToLocal);
1669 CopyToColumn(rCxt, nRow1, nRow2, nFlags, bMarked, rColumn);
1671 if (nRow2 <
GetDoc().MaxRow())
1683 aRangeSet.
scan(*pPosCol);
1690 CopyToClipHandler aFunc(
GetDoc(), *
this, rDestCol,
nullptr);
1691 sc::CellStoreType::const_iterator itPos =
maCells.begin();
1692 for (
const auto& rRange : aRanges)
1703 SCROW nStart = -1, nEnd = -1;
1723 pPattern = aAttrIter.
Next( nStart, nEnd );
1732 SCROW nStart = -1, nEnd = -1;
1749 pPattern = aAttrIter.
Next( nStart, nEnd );
1757 SCROW nStart = 0, nEnd = 0;
1759 while (pPattern && bOk)
1765 pPattern = aAttrIter.
Next( nStart, nEnd );
1775 SCROW nStart = -1, nEnd = -1;
1786 pPattern = aAttrIter.
Next( nStart, nEnd );
1794 for (
auto& rCellItem : rCells)
1799 sc::formula_block::iterator itCell = sc::formula_block::begin(*rCellItem.data);
1800 sc::formula_block::iterator itCellEnd = sc::formula_block::end(*rCellItem.data);
1801 for (; itCell != itCellEnd; ++itCell)
1809class NoteCaptionUpdater
1814 NoteCaptionUpdater(
SCCOL nCol,
SCTAB nTab ) :
mnCol(nCol), mnTab(nTab) {}
1816 void operator() (
size_t nRow,
ScPostIt* p )
1826 NoteCaptionUpdater aFunc(
nCol,
nTab);
1832 assert(
static_cast<int>(pObjects.size()) >= nRowEnd - nRowStart + 1);
1835 for (
SCROW nCurrentRow = nRowStart; nCurrentRow <= nRowEnd; nCurrentRow++, nObj++)
1837 if (pObjects[nObj].empty())
1846 for (
auto &
pObject : pObjects)
1903 aNonEmpties.
scan(*
this, nStartRow, nEndRow);
1908 sc::CellStoreType::position_type aPos =
maCells.position(nStartRow);
1912 aPos =
maCells.position(aPos.first, nEndRow+1);
1917 aPos = rCol.
maCells.position(nStartRow);
1921 aPos = rCol.
maCells.position(aPos.first, nEndRow+1);
1935 aPos = rCol.
maCells.position(nStartRow);
1939 aPos = rCol.
maCells.position(aPos.first, nEndRow+1);
1949 for (
const auto& rRange : aRanges)
1951 for (
SCROW nRow = rRange.mnRow1; nRow <= rRange.mnRow2; ++nRow)
1961class SharedTopFormulaCellPicker
1964 SharedTopFormulaCellPicker() =
default;
1965 SharedTopFormulaCellPicker(SharedTopFormulaCellPicker
const &) =
default;
1966 SharedTopFormulaCellPicker(SharedTopFormulaCellPicker &&) =
default;
1967 SharedTopFormulaCellPicker & operator =(SharedTopFormulaCellPicker
const &) =
default;
1968 SharedTopFormulaCellPicker & operator =(SharedTopFormulaCellPicker &&) =
default;
1970 virtual ~SharedTopFormulaCellPicker() {}
1972 void operator() ( sc::CellStoreType::value_type& node )
1977 size_t nTopRow = node.position;
1979 sc::formula_block::iterator itBeg = sc::formula_block::begin(*node.data);
1980 sc::formula_block::iterator itEnd = sc::formula_block::end(*node.data);
1984 for (sc::formula_block::iterator it = itBeg; it != itEnd; ++it)
1987 size_t nRow = nTopRow + std::distance(itBeg, it);
1990 processNonShared(pCell, nRow);
2002 std::advance(it, nOffsetToLast);
2008 virtual void processSharedTop(
ScFormulaCell** ,
size_t ,
size_t ) {}
2011class UpdateRefOnCopy
2019 mrCxt(rCxt), mpUndoDoc(pUndoDoc), mbUpdated(false) {}
2021 bool isUpdated()
const {
return mbUpdated; }
2023 void operator() (sc::CellStoreType::value_type& node,
size_t nOffset,
size_t nDataSize)
2028 sc::formula_block::iterator it = sc::formula_block::begin(*node.data);
2029 std::advance(it, nOffset);
2030 sc::formula_block::iterator itEnd = it;
2031 std::advance(itEnd, nDataSize);
2033 for (; it != itEnd; ++it)
2041class UpdateRefOnNonCopy
2048 bool mbClipboardSource;
2057 aComp.CompileTokenArray();
2080 bool bGroupShifted =
false;
2085 for (++pp; pp != ppEnd; ++pp)
2089 aErrorPos, mpCxt->
mrDoc))
2091 assert(!
"can't move formula cell");
2105 bGroupShifted =
true;
2115 recompileTokenArray(*pTop);
2120 aEndCxt.setPositionDelta(
2123 for (pp = rGroup.
mpCells; pp != ppEnd; ++pp)
2126 p->EndListeningTo(aEndCxt);
2127 p->SetNeedsListening(
true);
2132 fillUndoDoc(aOldPos, rGroup.
mnLength, aOldCode);
2137 for (pp = rGroup.
mpCells; pp != ppEnd; ++pp)
2140 p->SetNeedsDirty(
true);
2186 bRecalcOnMove = aPos != aOldPos;
2196 recompileTokenArray(*pTop);
2203 auto pPosSet = std::make_shared<sc::ColumnBlockPositionSet>(mpCxt->
mrDoc);
2208 aEndCxt.setPositionDelta(
2211 for (; pp != ppEnd; ++pp)
2214 p->EndListeningTo(aEndCxt);
2215 p->StartListeningTo(aStartCxt);
2223 if (!mbClipboardSource || !bCellMoved)
2224 fillUndoDoc(aOldPos, rGroup.
mnLength, aOldCode);
2229 if (!mpUndoDoc || nLength <= 0)
2242 std::vector<ScFormulaCell*> aCells;
2243 aCells.reserve(nLength);
2245 aCells.push_back(pFC);
2250 aCells.push_back(pFC);
2255 std::for_each(aCells.begin(), aCells.end(), std::default_delete<ScFormulaCell>());
2262 mnCol(nCol), mnTab(nTab), mpCxt(pCxt),
2263 mpUndoDoc(pUndoDoc), mbUpdated(false),
2264 mbClipboardSource(pCxt->mrDoc.IsClipboardSource()){}
2271 updateRefOnShift(rGroup);
2274 updateRefOnMove(rGroup);
2285 for (; pp != ppEnd; ++pp, aUndoPos.
IncRow())
2288 mbUpdated |=
p->UpdateReference(*mpCxt, mpUndoDoc, &aUndoPos);
2298 bool isUpdated()
const {
return mbUpdated; }
2301class UpdateRefGroupBoundChecker :
public SharedTopFormulaCellPicker
2304 std::vector<SCROW>& mrBounds;
2308 mrCxt(rCxt), mrBounds(rBounds) {}
2310 virtual void processSharedTop(
ScFormulaCell** ppCells,
size_t ,
size_t )
override
2320class UpdateRefExpandGroupBoundChecker :
public SharedTopFormulaCellPicker
2323 std::vector<SCROW>& mrBounds;
2326 UpdateRefExpandGroupBoundChecker(
const sc::RefUpdateContext& rCxt, std::vector<SCROW>& rBounds) :
2327 mrCxt(rCxt), mrBounds(rBounds) {}
2329 virtual void processSharedTop(
ScFormulaCell** ppCells,
size_t ,
size_t )
override
2339class FormulaGroupPicker :
public SharedTopFormulaCellPicker
2341 std::vector<sc::FormulaGroupEntry>& mrGroups;
2344 explicit FormulaGroupPicker( std::vector<sc::FormulaGroupEntry>& rGroups ) : mrGroups(rGroups) {}
2346 virtual void processNonShared(
ScFormulaCell* pCell,
size_t nRow )
override
2348 mrGroups.emplace_back(pCell, nRow);
2351 virtual void processSharedTop(
ScFormulaCell** ppCells,
size_t nRow,
size_t nLength )
override
2353 mrGroups.emplace_back(ppCells, nRow, nLength);
2365 UpdateRefOnCopy aHandler(rCxt, pUndoDoc);
2367 sc::CellStoreType::position_type aPos = blockPos
2381 return aHandler.isUpdated();
2393 std::vector<SCROW> aBounds;
2397 if (bThisColShifted)
2408 aBounds.push_back(nSplitPos);
2413 aBounds.push_back(nSplitPos);
2416 aBounds.push_back(nSplitPos);
2422 UpdateRefGroupBoundChecker aBoundChecker(rCxt, aBounds);
2429 UpdateRefExpandGroupBoundChecker aExpandChecker(rCxt, aBounds);
2440 UpdateRefOnNonCopy aHandler(
nCol,
nTab, &rCxt, pUndoDoc);
2441 aHandler = std::for_each(aGroups.begin(), aGroups.end(), aHandler);
2442 if (bSplit || aHandler.isUpdated())
2445 return aHandler.isUpdated();
2450 std::vector<sc::FormulaGroupEntry> aGroups;
2451 std::for_each(
maCells.begin(),
maCells.end(), FormulaGroupPicker(aGroups));
2457class UpdateTransHandler
2460 sc::CellStoreType::iterator miPos;
2467 miPos(rColumn.GetCellStore().
begin()),
2468 maSource(rSource), maDest(rDest), mpUndoDoc(pUndoDoc) {}
2472 sc::CellStoreType::position_type aPos = mrColumn.
GetCellStore().position(miPos, nRow);
2480class UpdateGrowHandler
2483 sc::CellStoreType::iterator miPos;
2490 miPos(rColumn.GetCellStore().
begin()),
2491 maArea(rArea), mnGrowX(nGrowX), mnGrowY(nGrowY) {}
2495 sc::CellStoreType::position_type aPos = mrColumn.
GetCellStore().position(miPos, nRow);
2503class InsertTabUpdater
2507 sc::CellTextAttrStoreType::iterator miAttrPos;
2514 mrTextAttrs(rTextAttrs),
2515 miAttrPos(rTextAttrs.
begin()),
2533 bool isModified()
const {
return mbModified; }
2536class DeleteTabUpdater
2540 sc::CellTextAttrStoreType::iterator miAttrPos;
2546 mrTextAttrs(rTextAttrs),
2547 miAttrPos(rTextAttrs.
begin()),
2565 bool isModified()
const {
return mbModified; }
2568class InsertAbsTabUpdater
2571 sc::CellTextAttrStoreType::iterator miAttrPos;
2577 mrTextAttrs(rTextAttrs),
2578 miAttrPos(rTextAttrs.
begin()),
2597 bool isModified()
const {
return mbModified; }
2604 sc::CellTextAttrStoreType::iterator miAttrPos;
2610 mrTextAttrs(rTextAttrs),
2611 miAttrPos(rTextAttrs.
begin()),
2629 bool isModified()
const {
return mbModified; }
2632class UpdateCompileHandler
2634 bool mbForceIfNameInUse:1;
2636 explicit UpdateCompileHandler(
bool bForceIfNameInUse) :
2637 mbForceIfNameInUse(bForceIfNameInUse) {}
2649 explicit TabNoSetter(
SCTAB nTab) : mnTab(nTab) {}
2657class UsedRangeNameFinder
2669class CheckVectorizationHandler
2672 CheckVectorizationHandler()
2692struct SetDirtyVarHandler
2700class SetDirtyHandler
2706 mrDoc(rDoc), mrCxt(rCxt) {}
2712 if (!
p->IsShared() ||
p->IsSharedTop())
2726class SetDirtyOnRangeHandler
2731 explicit SetDirtyOnRangeHandler(
ScColumn& rColumn)
2732 : maValueRanges(rColumn.GetDoc().GetSheetLimits()),
2733 mrColumn(rColumn) {}
2740 void operator() (mdds::mtv::element_t type,
size_t nTopRow,
size_t nDataSize)
2747 SCROW nRow1 = nTopRow;
2748 SCROW nRow2 = nTopRow + nDataSize - 1;
2749 maValueRanges.
set(nRow1, nRow2,
true);
2754 std::vector<SCROW> aRows;
2766 for (
const auto& rSpan : aSpans)
2767 rBroadcastSpans.
set(mrColumn.
GetDoc(), nTab, nCol, rSpan.mnRow1, rSpan.mnRow2,
true);
2771class SetTableOpDirtyOnRangeHandler
2776 explicit SetTableOpDirtyOnRangeHandler(
ScColumn& rColumn)
2777 : maValueRanges(rColumn.GetDoc().GetSheetLimits()),
2778 mrColumn(rColumn) {}
2782 p->SetTableOpDirty();
2785 void operator() (mdds::mtv::element_t type,
size_t nTopRow,
size_t nDataSize)
2792 SCROW nRow1 = nTopRow;
2793 SCROW nRow2 = nTopRow + nDataSize - 1;
2794 maValueRanges.
set(nRow1, nRow2,
true);
2799 std::vector<SCROW> aRows;
2805struct SetDirtyAfterLoadHandler
2832struct SetDirtyIfPostponedHandler
2841struct CalcAllHandler
2843#define DEBUG_SC_CHECK_FORMULATREE_CALCULATION 0
2846#if DEBUG_SC_CHECK_FORMULATREE_CALCULATION
2848 double nOldVal, nNewVal;
2852#if DEBUG_SC_CHECK_FORMULATREE_CALCULATION
2858 assert(nOldVal == nNewVal);
2861#undef DEBUG_SC_CHECK_FORMULATREE_CALCULATION
2864class CompileAllHandler
2880class CompileXMLHandler
2888 mrProgress(rProgress),
2894 if( (nFormat % SV_COUNTRY_LANGUAGE_OFFSET) != 0)
2907class CompileErrorCellsHandler
2911 sc::CellStoreType::iterator miPos;
2918 miPos(mrColumn.GetCellStore().
begin()),
2919 mnErrCode(nErrCode),
2927 if (nCurError == FormulaError::NONE)
2931 if (mnErrCode != FormulaError::NONE && nCurError != mnErrCode)
2935 sc::CellStoreType::position_type aPos = mrColumn.
GetCellStore().position(miPos, nRow);
2939 OUString aFormula = pCell->
GetFormula(mrCxt);
2940 pCell->
Compile(mrCxt, aFormula);
2946 bool isCompiled()
const {
return mbCompiled; }
2949class CalcAfterLoadHandler
2952 bool mbStartListening;
2956 mrCxt(rCxt), mbStartListening(bStartListening) {}
2964struct ResetChangedHandler
2975class FindEditCellsHandler
2978 sc::CellTextAttrStoreType::iterator miAttrPos;
2979 sc::CellStoreType::iterator miCellPos;
2982 explicit FindEditCellsHandler(
ScColumn& rCol) :
2984 miAttrPos(rCol.GetCellAttrStore().
begin()),
2985 miCellPos(rCol.GetCellStore().
begin()) {}
2998 if (IsAmbiguousScriptNonZero(nScriptType))
3007 std::pair<size_t,bool> operator() (
const sc::CellStoreType::value_type& node,
size_t nOffset,
size_t nDataSize)
3009 typedef std::pair<size_t,bool> RetType;
3013 return RetType(0,
false);
3017 for (
size_t i = 0;
i < nDataSize; ++
i)
3019 SCROW nRow = node.position +
i + nOffset;
3021 if (IsAmbiguousScriptNonZero(nScriptType))
3023 return RetType(i+nOffset,
true);
3027 return RetType(0,
false);
3036 UpdateTransHandler aFunc(*
this, rSource, rDest, pUndoDoc);
3042 UpdateGrowHandler aFunc(*
this, rArea, nGrowX, nGrowY);
3061 if (aFunc.isModified())
3075 if (aFunc.isModified())
3083 if (aFunc.isModified())
3094 if (aFunc.isModified())
3100 UpdateCompileHandler aFunc(bForceIfNameInUse);
3109 TabNoSetter aFunc(
nTab);
3115 UsedRangeNameFinder aFunc(rIndexes);
3121 SetDirtyVarHandler aFunc;
3130 std::pair<sc::CellStoreType::const_iterator,size_t> aPos =
maCells.position(nRow);
3131 sc::CellStoreType::const_iterator it = aPos.first;
3136 const ScFormulaCell*
p = sc::formula_block::at(*it->data, aPos.second);
3137 return p->GetDirty();
3143 CheckVectorizationHandler aFunc;
3151 SetDirtyHandler aFunc(
GetDoc(), rCxt);
3161 SetDirtyOnRangeHandler aHdl(*
this);
3163 aHdl.fillBroadcastSpans(rBroadcastSpans);
3168class BroadcastBroadcastersHandler
3175 : maHint(nHint,
ScAddress(nCol, 0, nTab))
3176 , mbBroadcasted(false)
3184 mbBroadcasted =
true;
3187 bool wasBroadcasted() {
return mbBroadcasted; }
3194 BroadcastBroadcastersHandler aBroadcasterHdl(nHint,
nTab,
nCol);
3196 return aBroadcasterHdl.wasBroadcasted();
3209 SetDirtyOnRangeHandler aHdl(*
this);
3216 SetDirtyOnRangeHandler aHdl(*
this);
3224 SetDirtyOnRangeHandler aHdl(*
this);
3245 SetTableOpDirtyOnRangeHandler aHdl(*
this);
3253 SetDirtyAfterLoadHandler aFunc;
3259class RecalcOnRefMoveCollector
3261 std::vector<SCROW> maDirtyRows;
3266 maDirtyRows.push_back(nRow);
3269 const std::vector<SCROW>& getDirtyRows()
const
3280 SetDirtyIfPostponedHandler aFunc;
3288 RecalcOnRefMoveCollector aFunc;
3295 CalcAllHandler aFunc;
3301 CompileAllHandler aFunc(rCxt);
3307 CompileXMLHandler aFunc(rCxt, rProgress, *
this);
3314 CompileErrorCellsHandler aHdl(rCxt, *
this, nErrCode);
3316 return aHdl.isCompiled();
3321 CalcAfterLoadHandler aFunc(rCxt, bStartListening);
3327 ResetChangedHandler aFunc;
3335 FindEditCellsHandler aFunc(*
this);
3336 std::pair<sc::CellStoreType::const_iterator,size_t> aPos =
3339 if (aPos.first ==
maCells.end())
3342 rFirst = aPos.first->position + aPos.second;
3355 return pAttrArray->SearchStyle(nRow, pSearchStyle, bUp, &aArray);
3361 return pAttrArray->SearchStyle( nRow, pSearchStyle, bUp );
3366 bool bInSelection,
const ScMarkData& rMark)
const
3374 rRow, rEndRow, pSearchStyle, bUp, &aArray);
3380 return pAttrArray->SearchStyleRange( rRow, rEndRow, pSearchStyle, bUp );
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 ...
bool ValidRow(SCROW nRow, SCROW nMaxRow)
@ Scenario
field button for datapilot
@ All
dp button with popup arrow for multiple fields
std::unique_ptr< EditTextObject > CreateTextObject()
void SetText(const OUString &rStr)
virtual editeng::FieldUpdater GetFieldUpdater()=0
void Set(SCCOL nCol, SCROW nRow, SCTAB nTab)
SC_DLLPUBLIC bool Move(SCCOL nDeltaX, SCROW nDeltaY, SCTAB nDeltaZ, ScAddress &rErrorPos, const ScDocument &rDoc)
void IncRow(SCROW nDelta=1)
const ScPatternAttr * Next(SCROW &rTop, SCROW &rBottom)
std::unique_ptr< ScAttrArray > pAttrArray
SCROW ApplySelectionCache(SfxItemPoolCache *pCache, const ScMarkData &rMark, ScEditDataArray *pDataArray, bool *const pIsChanged, SCCOL nCol)
void ClearSelectionItems(const sal_uInt16 *pWhich, const ScMarkData &rMark, SCCOL nCol)
void InitAttrArray(ScAttrArray *attrArray)
void ApplyPatternArea(SCROW nStartRow, SCROW nEndRow, const ScPatternAttr &rPatAttr, ScEditDataArray *pDataArray=nullptr, bool *const pIsChanged=nullptr)
const ScPatternAttr * GetMostUsedPattern(SCROW nStartRow, SCROW nEndRow) const
void ChangeSelectionIndent(bool bIncrement, const ScMarkData &rMark, SCCOL nCol)
ScDocument & GetDoc() const
sal_uInt32 GetNumberFormat(const ScInterpreterContext &rContext, SCROW nRow) const
void UpdateNoteCaptions(SCROW nRow1, SCROW nRow2)
void CellStorageModified()
Called whenever the state of cell array gets modified i.e.
void CopyCellTextAttrsToDocument(SCROW nRow1, SCROW nRow2, ScColumn &rDestCol) const
~ScColumn() COVERITY_NOEXCEPT_FALSE
void ApplyPattern(SCROW nRow, const ScPatternAttr &rPatAttr)
sc::CellTextAttrStoreType maCellTextAttrs
bool TestInsertCol(SCROW nStartRow, SCROW nEndRow) const
bool TestInsertRow(SCROW nStartRow, SCSIZE nSize) const
void DuplicateNotes(SCROW nStartRow, size_t nDataSize, ScColumn &rDestCol, sc::ColumnBlockPosition &rDestBlockPos, bool bCloneCaption, SCROW nRowOffsetDest=0) const
void SetDirty(SCROW nRow1, SCROW nRow2, BroadcastMode)
void CheckVectorizationState()
void RegroupFormulaCells(std::vector< ScAddress > *pGroupPos=nullptr)
Regroup formula cells for the entire column.
ScFormulaCell * SetFormulaCell(SCROW nRow, ScFormulaCell *pCell, sc::StartListeningType eListenType=sc::SingleCellListening, bool bInheritNumFormatIfNeeded=true)
Takes ownership of pCell.
void UpdateDrawObjectsForRow(std::vector< SdrObject * > &pObjects, SCCOL nTargetCol, SCROW nTargetRow)
void UpdateInsertTabOnlyCells(sc::RefUpdateInsertTabContext &rCxt)
void DeleteSelection(InsertDeleteFlags nDelFlag, const ScMarkData &rMark, bool bBroadcast)
bool TestCopyScenarioTo(const ScColumn &rDestCol) const
void SetAllFormulasDirty(const sc::SetFormulaDirtyContext &rCxt)
void BroadcastCells(const std::vector< SCROW > &rRows, SfxHintId nHint)
void UpdateDrawObjects(std::vector< std::vector< SdrObject * > > &pObjects, SCROW nRowStart, SCROW nRowEnd)
void CopyToColumn(sc::CopyToDocContext &rCxt, SCROW nRow1, SCROW nRow2, InsertDeleteFlags nFlags, bool bMarked, ScColumn &rColumn, const ScMarkData *pMarkData=nullptr, bool bAsLink=false, bool bGlobalNamesToLocal=false) const
void BroadcastRecalcOnRefMove()
void InitBlockPosition(sc::ColumnBlockPosition &rBlockPos)
void UpdateDeleteTab(sc::RefUpdateDeleteTabContext &rCxt)
std::vector< sc::FormulaGroupEntry > GetFormulaGroupEntries()
Get all non-grouped formula cells and formula cell groups in the whole column.
void UpdateInsertTabAbs(SCTAB nNewPos)
SCROW ApplySelectionCache(SfxItemPoolCache *pCache, const ScMarkData &rMark, ScEditDataArray *pDataArray, bool *const pIsChanged)
void Init(SCCOL nNewCol, SCTAB nNewTab, ScDocument &rDoc, bool bEmptyAttrArray)
SvtScriptType GetRangeScriptType(sc::CellTextAttrStoreType::iterator &itPos, SCROW nRow1, SCROW nRow2, const sc::CellStoreType::iterator &itr)
Get combined script types of the specified range.
BroadcastMode
Broadcast mode for SetDirty(SCROW,SCROW,BroadcastMode).
@ BROADCAST_DATA_POSITIONS
broadcast existing cells with position => does AreaBroadcast
@ BROADCAST_BROADCASTERS
broadcast only existing cell broadcasters => no AreaBroadcast of range!
@ BROADCAST_NONE
no broadcasting
void DuplicateSparklines(SCROW nStartRow, size_t nDataSize, ScColumn &rDestCol, sc::ColumnBlockPosition &rDestBlockPos, SCROW nRowOffsetDest=0) const
sc::CellNoteStoreType maCellNotes
const ScStyleSheet * GetSelectionStyle(const ScMarkData &rMark, bool &rFound) const
void EndListeningFormulaCells(sc::EndListeningContext &rCxt, SCROW nRow1, SCROW nRow2, SCROW *pStartRow, SCROW *pEndRow)
bool UpdateReferenceOnCopy(sc::RefUpdateContext &rCxt, ScDocument *pUndoDoc=nullptr)
bool CompileErrorCells(sc::CompileFormulaContext &rCxt, FormulaError nErrCode)
void CompileXML(sc::CompileFormulaContext &rCxt, ScProgress &rProgress)
sc::MatrixEdge GetBlockMatrixEdges(SCROW nRow1, SCROW nRow2, sc::MatrixEdge nMask, bool bNoMatrixAtAll) const
void CalcAfterLoad(sc::CompileFormulaContext &rCxt, bool bStartListening)
void SetNumberFormat(SCROW nRow, sal_uInt32 nNumberFormat)
void SetTableOpDirty(const ScRange &)
void CopyScenarioTo(ScColumn &rDestCol) const
void ApplyAttr(SCROW nRow, const SfxPoolItem &rAttr)
void ResetChanged(SCROW nStartRow, SCROW nEndRow)
bool HasEditCells(SCROW nStartRow, SCROW nEndRow, SCROW &rFirst)
void MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn &rCol)
bool HasSelectionMatrixFragment(const ScMarkData &rMark, const ScRangeList &rRangeList) const
void ApplySelectionLineStyle(const ScMarkData &rMark, const ::editeng::SvxBorderLine *pLine, bool bColorOnly)
void CompileAll(sc::CompileFormulaContext &rCxt)
SCROW SearchStyle(SCROW nRow, const ScStyleSheet *pSearchStyle, bool bUp, bool bInSelection, const ScMarkData &rMark) const
May return -1 if not found.
void SetTabNo(SCTAB nNewTab)
void MergeSelectionPattern(ScMergePatternState &rState, const ScMarkData &rMark, bool bDeep) const
void UndoToColumn(sc::CopyToDocContext &rCxt, SCROW nRow1, SCROW nRow2, InsertDeleteFlags nFlags, bool bMarked, ScColumn &rColumn) const
void ApplyStyle(SCROW nRow, const ScStyleSheet *rStyle)
void UpdateCompile(bool bForceIfNameInUse=false)
bool HasAttribSelection(const ScMarkData &rMark, HasAttrFlags nMask) const
sc::CellStoreType maCells
ScRefCellValue GetCellValue(SCROW nRow) const
void CopyUpdated(const ScColumn *pPosCol, ScColumn &rDestCol) const
void MarkScenarioIn(ScMarkData &rDestMark) const
void InsertRow(SCROW nStartRow, SCSIZE nSize)
void CopyStaticToDocument(SCROW nRow1, SCROW nRow2, const SvNumberFormatterMergeMap &rMap, ScColumn &rDestCol)
void CopyScenarioFrom(const ScColumn &rSrcCol)
void CopyToClip(sc::CopyToClipContext &rCxt, SCROW nRow1, SCROW nRow2, ScColumn &rColumn) const
void CopyCellNotesToDocument(SCROW nRow1, SCROW nRow2, ScColumn &rDestCol, bool bCloneCaption=true, SCROW nRowOffsetDest=0) const
bool IsDrawObjectsEmptyBlock(SCROW nStartRow, SCROW nEndRow) const
void UpdateTranspose(const ScRange &rSource, const ScAddress &rDest, ScDocument *pUndoDoc)
sc::CellTextAttrStoreType & GetCellAttrStore()
void UpdateGrow(const ScRange &rArea, SCCOL nGrowX, SCROW nGrowY)
const ScStyleSheet * GetAreaStyle(bool &rFound, SCROW nRow1, SCROW nRow2) const
void UpdateInsertTab(sc::RefUpdateInsertTabContext &rCxt)
void ChangeSelectionIndent(bool bIncrement, const ScMarkData &rMark)
void SwapCol(ScColumn &rCol)
void ApplyPatternIfNumberformatIncompatible(const ScRange &rRange, const ScPatternAttr &rPattern, SvNumFormatType nNewType)
sc::CellStoreType & GetCellStore()
bool UpdateReference(sc::RefUpdateContext &rCxt, ScDocument *pUndoDoc)
Update reference addresses in formula cell in response to mass cell movement.
void DeleteArea(SCROW nStartRow, SCROW nEndRow, InsertDeleteFlags nDelFlag, bool bBroadcast=true, sc::ColumnSpanSet *pBroadcastSpans=nullptr)
void ApplySelectionStyle(const ScStyleSheet &rStyle, const ScMarkData &rMark)
bool IsFormulaDirty(SCROW nRow) const
void SetDirtyFromClip(SCROW nRow1, SCROW nRow2, sc::ColumnSpanSet &rBroadcastSpans)
void CopyCellToDocument(SCROW nSrcRow, SCROW nDestRow, ScColumn &rDestCol)
static void JoinNewFormulaCell(const sc::CellStoreType::position_type &aPos, ScFormulaCell &rCell)
void ClearSelectionItems(const sal_uInt16 *pWhich, const ScMarkData &rMark)
bool BroadcastBroadcasters(SCROW nRow1, SCROW nRow2, SfxHintId nHint)
Broadcast single broadcasters in range, without explicitly setting anything dirty,...
void SetDirtyIfPostponed()
sc::BroadcasterStoreType maBroadcasters
void UpdateMoveTab(sc::RefUpdateMoveTabContext &rCxt, SCTAB nTabNo)
const sc::CellTextAttr * GetCellTextAttr(SCROW nRow) const
void FindRangeNamesInUse(SCROW nRow1, SCROW nRow2, sc::UpdatedRangeNames &rIndexes) const
ScColumn(ScSheetLimits const &)
ScDocument & GetDoc() const
sal_uInt32 GetNumberFormat(const ScInterpreterContext &rContext, SCROW nRow) const
sc::SparklineStoreType maSparklines
bool SearchStyleRange(SCROW &rRow, SCROW &rEndRow, const ScStyleSheet *pSearchStyle, bool bUp, bool bInSelection, const ScMarkData &rMark) const
bool IsInFormulaTree(const ScFormulaCell *pCell) const
void TrackFormulas(SfxHintId nHintId=SfxHintId::ScDataChanged)
SC_DLLPUBLIC ScFormulaCell * SetFormulaCell(const ScAddress &rPos, ScFormulaCell *pCell)
Set formula cell, and transfer its ownership to the document.
SC_DLLPUBLIC ScPatternAttr * GetDefPattern() const
bool ValidRow(SCROW nRow) const
bool SetFormulaCells(const ScAddress &rPos, std::vector< ScFormulaCell * > &rCells)
SC_DLLPUBLIC ScDocumentPool * GetPool()
SC_DLLPUBLIC SCROW MaxRow() const
SC_DLLPUBLIC ScFieldEditEngine & GetEditEngine()
ScInterpreterContext & GetNonThreadedContext() const
SC_DLLPUBLIC bool GetAutoCalc() const
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const
SC_DLLPUBLIC svl::SharedStringPool & GetSharedStringPool()
bool IsExpandRefs() const
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
SC_DLLPUBLIC const ScFormulaCell * GetFormulaCell(const ScAddress &rPos) const
void PutInFormulaTree(ScFormulaCell *pCell)
SC_DLLPUBLIC const SfxPoolItem * GetAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich) const
void AreaBroadcast(const ScHint &rHint)
only area, no cell broadcast
bool HasObjectsAnchoredInRange(const ScRange &rRange)
void MoveObject(SdrObject *pObj, const ScAddress &rNewPosition)
static std::unique_ptr< EditTextObject > Clone(const EditTextObject &rSrc, ScDocument &rDestDoc)
static SC_DLLPUBLIC OUString GetString(const EditTextObject &rEditText, const ScDocument *pDoc)
Retrieves string with paragraphs delimited by new lines (' ').
void SetAddressRow(SCROW nRow)
This is a rather odd datastructure.
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
bool IsAllMarked(const ScRange &rRange) const
const ScRange & GetMarkArea() const
bool IsMultiMarked() const
void SetMultiMarkArea(const ScRange &rRange, bool bMark=true, bool bSetupMulti=false)
const ScMultiSel & GetMultiSelData() const
ScMarkArray GetMarkArray(SCCOL nCol) const
bool Next(SCROW &rTop, SCROW &rBottom)
bool HasMarks(SCCOL nCol) const
const ScStyleSheet * GetStyleSheet() const
sal_uInt32 GetNumberFormat(SvNumberFormatter *) const
SfxItemSet & GetItemSet()
const SfxPoolItem & GetItem(sal_uInt16 nWhichP) const
Additional class containing cell annotation data.
void UpdateCaptionPos(const ScAddress &rPos)
Updates caption position according to position of the passed cell.
std::unique_ptr< ScPostIt > Clone(const ScAddress &rOwnPos, ScDocument &rDestDoc, const ScAddress &rDestPos, bool bCloneCaption) const
Clones this note and its caption object, if specified.
bool Contains(const ScAddress &) const
is Address& fully in Range?
void CheckExpandReferenceBounds(const sc::RefUpdateContext &rCxt, const ScAddress &rPos, SCROW nGroupLen, std::vector< SCROW > &rBounds) const
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.
void CheckRelativeReferenceBounds(const sc::RefUpdateContext &rCxt, const ScAddress &rPos, SCROW nGroupLen, std::vector< SCROW > &rBounds) const
virtual void CheckToken(const formula::FormulaToken &r) override
std::unique_ptr< ScTokenArray > Clone() const
bool IsFormulaVectorDisabled() const
sc::RefUpdateResult AdjustReferenceOnMove(const sc::RefUpdateContext &rCxt, const ScAddress &rOldPos, const ScAddress &rNewPos)
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...
const SfxSetItem & ApplyTo(const SfxSetItem &rSetItem)
const T & Put(std::unique_ptr< T > xItem, sal_uInt16 nWhich=0)
void Remove(const SfxPoolItem &)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void Broadcast(const SfxHint &rHint)
void updateTableFields(int nTab)
Temporarily switch on/off auto calculation mode.
ColumnBlockPosition * getBlockPosition(SCTAB nTab, SCCOL nCol)
void set(SCTAB nTab, SCCOL nCol)
Structure that stores segments of boolean flags per column, and perform custom action on those segmen...
void set(const ScDocument &rDoc, SCTAB nTab, SCCOL nCol, SCROW nRow, bool bVal)
bool isKeepScenarioFlags() const
bool isStartListening() const
Keep track of spans in a single column only.
void scan(const ScColumn &rColumn)
Scan an entire column and tag all non-empty cell positions.
std::vector< RowSpan > SpansType
void getSpans(SpansType &rSpans) const
void getRows(std::vector< SCROW > &rRows) const
void set(SCROW nRow1, SCROW nRow2, bool bVal)
Keep track of all named expressions that have been updated during reference update.
SharedString intern(const OUString &rStr)
const OUString & getString() const
EmbeddedObjectRef * pObject
@ NOTE
Strings (and string results if InsertDeleteFlags::FORMULA is not set).
@ NOCAPTIONS
Sparklines in a cell.
@ SPECIAL_BOOLEAN
Internal use only (copy from clip): do not delete existing cell contents when pasting notes.
@ STRING
Dates, times, datetime values.
@ ADDNOTES
Internal use only (undo etc.): do not copy/delete caption objects of cell notes.
@ DATETIME
Numeric values (and numeric results if InsertDeleteFlags::FORMULA is not set).
@ ATTRIB
Internal use only (d&d undo): do not delete caption objects of cell notes.
@ STYLES
Hard cell attributes.
@ NamesToLocal
If set, global named expressions will be converted to sheet-local named expressions.
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
enumrange< T >::Iterator begin(enumrange< T >)
CAUTION! The following defines must be in the same namespace as the respective type.
StoreT::const_iterator ParseBlock(const typename StoreT::const_iterator &itPos, const StoreT &rStore, Func &rFunc, typename StoreT::size_type nStart, typename StoreT::size_type nEnd)
Generic algorithm to parse blocks of multi_type_vector either partially or fully.
const mdds::mtv::element_t element_type_celltextattr
const mdds::mtv::element_t element_type_edittext
CellStoreType::iterator ProcessFormula(const CellStoreType::iterator &it, CellStoreType &rStore, SCROW nRow1, SCROW nRow2, std::function< void(size_t, ScFormulaCell *)> aFuncElem)
Process formula cells found within specified row range.
const mdds::mtv::element_t element_type_formula
StoreT::iterator ProcessBlock(const typename StoreT::iterator &itPos, StoreT &rStore, Func &rFunc, typename StoreT::size_type nStart, typename StoreT::size_type nEnd)
Non-const variant of the above function.
BroadcasterStoreType::iterator ProcessBroadcaster(const BroadcasterStoreType::iterator &it, BroadcasterStoreType &rStore, SCROW nRow1, SCROW nRow2, FuncElem &rFuncElem)
void ParseFormula(const CellStoreType &rStore, Func &rFunc)
mdds::mtv::soa::multi_type_vector< CellStoreTraits > CellStoreType
Cell container.
const mdds::mtv::element_t element_type_numeric
Mapped standard element types (for convenience).
void ProcessFormulaEditText(CellStoreType &rStore, Func &rFunc)
std::pair< CellStoreType::const_iterator, size_t > FindFormulaEditText(const CellStoreType &rStore, SCROW nRow1, SCROW nRow2, Func &rFunc)
mdds::mtv::soa::multi_type_vector< CellTextAttrTraits > CellTextAttrStoreType
Cell text attribute container.
void ProcessNote(CellNoteStoreType &rStore, Func &rFunc)
const mdds::mtv::element_t element_type_string
const mdds::mtv::element_t element_type_empty
constexpr TypedWhichId< ScMergeFlagAttr > ATTR_MERGE_FLAG(145)
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
This is very similar to ScCellValue, except that it references the original value instead of copying ...
SCROW GetMaxRowCount() const
Single reference (one address) into the sheet.
void InitAddress(const ScAddress &rAdr)
InitAddress: InitFlags and set address.
void SetFlag3D(bool bVal)
CellTextAttrStoreType::const_iterator miCellTextAttrPos
CellStoreType::const_iterator miCellPos
Store position data for column array storage.
CellTextAttrStoreType::iterator miCellTextAttrPos
BroadcasterStoreType::iterator miBroadcasterPos
CellStoreType::iterator miCellPos
Context for reference update during shifting, moving or copying of cell ranges.
ColumnBlockPosition * getBlockPosition(SCTAB nTab, SCCOL nCol)
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.
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.
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.
bool mbClearTabDeletedFlag
When true, go through all reference tokens and clears "sheet deleted" flag if its corresponding index...
::boost::intrusive_ptr< ScFormulaCellGroup > ScFormulaCellGroupRef
std::unordered_map< sal_uInt32, sal_uInt32 > SvNumberFormatterMergeMap