24#include <document.hxx>
38#include <tokenarray.hxx>
53#include <com/sun/star/i18n/LocaleDataItem2.hpp>
54#include <com/sun/star/lang/IllegalArgumentException.hpp>
60#include <rtl/tencinfo.h>
66#include <osl/diagnose.h>
71using ::com::sun::star::i18n::LocaleDataItem2;
89 for (
const auto& rRow : rRows)
101 aSpanSet.
scan(*
this, nStartRow, nEndRow);
102 std::vector<SCROW> aRows;
109class CellInterpreterBase
115 if( !groupCells.empty() &&
p->GetCellGroup() == groupCells.back()->GetCellGroup()
116 &&
p->aPos.Row() == groupCells.back()->aPos.Row() + 1 )
118 assert(
p->aPos.Tab() == groupCells.back()->aPos.Tab()
119 &&
p->aPos.Col() == groupCells.back()->aPos.Col());
120 groupCells.push_back(p);
124 if( !
p->GetCellGroup())
129 groupCells.push_back(p);
132 ~CellInterpreterBase()
139 if(groupCells.empty())
141 SCROW firstRow = groupCells.front()->GetCellGroup()->mpTopCell->aPos.Row();
142 if(!groupCells.front()->Interpret(
143 groupCells.front()->aPos.Row() - firstRow, groupCells.back()->aPos.Row() - firstRow))
153 std::vector<ScFormulaCell*> groupCells;
156class DirtyCellInterpreter :
public CellInterpreterBase
166class NeedsInterpretCellInterpreter :
public CellInterpreterBase
171 if(
p->NeedsInterpret())
177 if(
p->NeedsInterpret())
178 allInterpreted =
false;
181 bool allInterpreted =
true;
191 DirtyCellInterpreter aFunc;
200 NeedsInterpretCellInterpreter aFunc;
202 return aFunc.allInterpreted;
207 sc::CellStoreType::position_type aPos =
maCells.position(nRow);
208 sc::CellStoreType::iterator it = aPos.first;
240 maCells.event_handler().stop();
263class ShiftFormulaPosHandler
279 SCROW nEndRow = nStartRow + nSize - 1;
289 sc::CellStoreType::position_type aPos =
maCells.position(nStartRow);
290 sc::CellStoreType::iterator itCell = aPos.first;
294 sc::CellStoreType::iterator itTest = itCell;
305 bool bShiftCells =
false;
306 if (nEndRow <
GetDoc().MaxRow())
308 aPos =
maCells.position(itCell, nEndRow+1);
313 sc::CellStoreType::iterator itTest = itCell;
329 aNonEmptySpans.
scan(aBlockPos, *
this, nEndRow+1,
GetDoc().MaxRow());
335 maCells.erase(nStartRow, nEndRow);
339 aPos =
maCells.position(nStartRow);
342 ShiftFormulaPosHandler aShiftFormulaFunc;
346 if (bJoined && pGroupPos)
357 bool bInsertFormula )
363 const sc::CellStoreType::position_type& aPos,
ScFormulaCell& rCell )
368 ScFormulaCell& rPrev = *sc::formula_block::at(*aPos.first->data, aPos.second-1);
369 sc::CellStoreType::position_type aPosPrev = aPos;
377 ScFormulaCell& rNext = *sc::formula_block::at(*aPos.first->data, aPos.second+1);
383 const sc::CellStoreType::position_type& aPos,
ScFormulaCell& rCell, std::vector<SCROW>& rNewSharedRows )
385 if (!
GetDoc().IsClipOrUndo())
387#if USE_FORMULA_GROUP_LISTENER
399 if (rCell.
aPos.
Row() == nSharedTopRow)
403 rNewSharedRows.push_back( nSharedTopRow + 1);
404 rNewSharedRows.push_back( nSharedTopRow + nSharedLength - 1);
406 else if (rCell.
aPos.
Row() == nSharedTopRow + nSharedLength - 1)
411 rNewSharedRows.push_back( nSharedTopRow);
412 rNewSharedRows.push_back( rCell.
aPos.
Row() - 1);
419 rNewSharedRows.push_back( nSharedTopRow);
420 rNewSharedRows.push_back( rCell.
aPos.
Row() - 1);
421 rNewSharedRows.push_back( rCell.
aPos.
Row() + 1);
422 rNewSharedRows.push_back( nSharedTopRow + nSharedLength - 1);
437 assert(rNewSharedRows.empty() || rNewSharedRows.size() == 2 || rNewSharedRows.size() == 4);
442 auto pPosSet = std::make_shared<sc::ColumnBlockPositionSet>(rDoc);
445 if (rNewSharedRows.size() >= 2)
450 if (rNewSharedRows.size() >= 4)
459class AttachFormulaCellsHandler
473class DetachFormulaCellsHandler
480 mrDoc(rDoc), mpCxt(pCxt) {}
494 const sc::CellStoreType::position_type& aPos,
size_t nLength, std::vector<SCROW>* pNewSharedRows )
496 const size_t nRow = aPos.first->position + aPos.second;
497 const size_t nNextTopRow = nRow +
nLength;
499 bool bLowerSplitOff =
false;
500 if (pNewSharedRows && !
GetDoc().IsClipOrUndo())
508 if (nTopRow <
static_cast<SCROW>(nRow))
511 pNewSharedRows->push_back(nTopRow);
512 pNewSharedRows->push_back(nRow - 1);
514 if (
static_cast<SCROW>(nNextTopRow) <= nBotRow)
517 pNewSharedRows->push_back(nNextTopRow);
518 pNewSharedRows->push_back(nBotRow);
519 bLowerSplitOff =
true;
529 if (pNewSharedRows && !bLowerSplitOff && !
GetDoc().IsClipOrUndo())
531 sc::CellStoreType::position_type aPos2 =
maCells.position(aPos.first, nNextTopRow-1);
538 if (
static_cast<SCROW>(nNextTopRow) <= nBotRow)
541 pNewSharedRows->push_back(nNextTopRow);
542 pNewSharedRows->push_back(nBotRow);
547 sc::CellStoreType::position_type aPos2 =
maCells.position(aPos.first, nNextTopRow);
551 if (
GetDoc().IsClipOrUndo())
554 DetachFormulaCellsHandler aFunc(
GetDoc(),
nullptr);
560 sc::CellStoreType::position_type aPos =
maCells.position(nRow1);
561 sc::CellStoreType::iterator it = aPos.first;
566 aPos =
maCells.position(it, nRow2+1);
570 if (
GetDoc().IsClipOrUndo())
575 bool bEnlargedDown =
false;
576 aPos =
maCells.position(nRow1);
580 ScFormulaCell& rCell = *sc::formula_block::at(*it->data, aPos.second);
587 bEnlargedDown =
true;
595 aPos =
maCells.position(it, nRow2);
599 ScFormulaCell& rCell = *sc::formula_block::at(*it->data, aPos.second);
607 AttachFormulaCellsHandler aFunc(rCxt);
613 sc::CellStoreType::position_type aPos =
maCells.position(nRow1);
614 sc::CellStoreType::iterator it = aPos.first;
620 aPos =
maCells.position(it, nRow2+1);
624 if (
GetDoc().IsClipOrUndo())
627 DetachFormulaCellsHandler aFunc(
GetDoc(), &rCxt);
632 std::vector<SCROW>& rNewSharedRows )
634 sc::CellStoreType::iterator itRet = rPos.first;
638 ScFormulaCell& rFC = *sc::formula_block::at(*itRet->data, rPos.second);
643 rNewSharedRows.push_back( nSharedTopRow);
644 rNewSharedRows.push_back( nSharedTopRow + nSharedLength - 1);
649 rNewSharedRows.push_back( nRow);
650 rNewSharedRows.push_back( nRow);
655 std::vector<SCROW>& rNewSharedRows,
bool bInsertFormula )
658 sc::CellStoreType::position_type aPos =
maCells.position(it, nRow);
659 sc::CellStoreType::iterator itRet = aPos.first;
663 ScFormulaCell& rCell = *sc::formula_block::at(*itRet->data, aPos.second);
666 else if (bInsertFormula && !
GetDoc().IsClipOrUndo())
670 sc::CellStoreType::position_type aPosBefore =
maCells.position(
maCells.begin(), nRow-1);
673 if (nRow <
GetDoc().MaxRow())
675 sc::CellStoreType::position_type aPosAfter =
maCells.position(
maCells.begin(), nRow+1);
685 const std::vector<SCROW>& rNewSharedRows,
692 const sc::CellStoreType::position_type& aPos,
ScFormulaCell& rCell,
693 const std::vector<SCROW>& rNewSharedRows,
713 auto pPosSet = std::make_shared<sc::ColumnBlockPositionSet>(rDocument);
716 SCROW nStartRow, nEndRow;
717 nStartRow = nEndRow = aPos.first->position + aPos.second;
718 for (
const SCROW nR : rNewSharedRows)
734 if (!rNewSharedRows.empty())
736 assert(rNewSharedRows.size() == 2 || rNewSharedRows.size() == 4);
743 if (rNewSharedRows.size() > 2)
759 std::vector<SCROW>& rNewSharedRows )
765 if (aPos.first->size < aPos.second +
nLength)
770 ScFormulaCell* pCell1 = sc::formula_block::at(*aPos.first->data, aPos.second);
773 sc::CellStoreType::position_type aPosLast = aPos;
774 aPosLast.second +=
nLength - 1;
775 ScFormulaCell* pCell2 = sc::formula_block::at(*aPosLast.first->data, aPosLast.second);
788 if (rNewSharedRows.empty())
790 rNewSharedRows.push_back( nTopRow);
791 rNewSharedRows.push_back( nBotRow);
793 else if (rNewSharedRows.size() == 2)
796 if (rNewSharedRows[0] > nTopRow)
797 rNewSharedRows[0] = nTopRow;
798 if (rNewSharedRows[1] < nBotRow)
799 rNewSharedRows[1] = nBotRow;
801 else if (rNewSharedRows.size() == 4)
805 std::vector<SCROW> aRows { std::min( rNewSharedRows[0], nTopRow), std::max( rNewSharedRows[3], nBotRow) };
806 rNewSharedRows.swap( aRows);
810 assert(!
"rNewSharedRows?");
816 ScFormulaCell** pp = &sc::formula_block::at(*aPos.first->data, aPos.second);
818 for (; pp != ppEnd; ++pp)
821 (*pp)->StartListeningTo(aCxt);
834 if (
GetDoc().IsClipOrUndo() ||
GetDoc().IsInsertingFromOtherDoc() ||
GetDoc().IsCalcingAfterLoad())
852 sc::CellStoreType::position_type
pos =
maCells.position(itr, nRow);
854 size_t nOffset =
pos.second;
866 pCondSet = rDocument.
GetCondResult(aCell, aPos, *pCFList, rData);
884class DeleteAreaHandler
887 std::vector<ScFormulaCell*> maFormulaCells;
899 maDeleteRanges(rDoc.GetSheetLimits()),
906 void operator() (
const sc::CellStoreType::value_type& node,
size_t nOffset,
size_t nDataSize)
912 if (!mbNumeric && !mbDateTime)
916 if (mbNumeric && mbDateTime)
919 deleteNumeric(node, nOffset, nDataSize);
931 sc::formula_block::iterator it = sc::formula_block::begin(*node.data) + nOffset;
932 sc::formula_block::iterator itEnd = it + nDataSize;
933 maFormulaCells.insert(maFormulaCells.end(), it, itEnd);
942 SCROW nRow1 = node.position + nOffset;
943 SCROW nRow2 = nRow1 + nDataSize - 1;
944 maDeleteRanges.
set(nRow1, nRow2,
true);
947 void deleteNumeric(
const sc::CellStoreType::value_type& node,
size_t nOffset,
size_t nDataSize)
949 size_t nStart = node.position + nOffset;
951 bool bLastTypeDateTime = isDateTime(nStart);
952 size_t nCount = nStart + nDataSize;
954 for (
size_t i = nStart + 1;
i <
nCount;
i++)
956 bool bIsDateTime = isDateTime(i);
959 if (bIsDateTime == bLastTypeDateTime)
966 deleteNumberOrDateTime(nStart, nStart + nElements - 1, bLastTypeDateTime);
971 bLastTypeDateTime = bIsDateTime;
975 deleteNumberOrDateTime(nStart, nStart + nElements - 1, bLastTypeDateTime);
978 void deleteNumberOrDateTime(
SCROW nRow1,
SCROW nRow2,
bool dateTime)
980 if (!dateTime && !mbNumeric)
982 if (dateTime && !mbDateTime)
984 maDeleteRanges.
set(nRow1, nRow2,
true);
987 bool isDateTime(
size_t position)
992 return (
nType == SvNumFormatType::DATE) || (
nType == SvNumFormatType::TIME) ||
993 (
nType == SvNumFormatType::DATETIME);
1000 std::vector<std::pair<SCROW, SCROW>> getFormulaRanges()
1002 std::vector<std::pair<SCROW, SCROW>> aRet;
1006 SCROW nTopRow = pFC->aPos.Row();
1007 SCROW nBottomRow = pFC->aPos.Row();
1009 auto xGroup = pFC->GetCellGroup();
1012 pFC = xGroup->mpTopCell;
1013 nTopRow = pFC->aPos.Row();
1014 nBottomRow = nTopRow + xGroup->mnLength - 1;
1017 aRet.emplace_back(nTopRow, nBottomRow);
1030 return maDeleteRanges;
1039 static void splitFormulaGrouping(
const sc::CellStoreType::position_type& rPos)
1043 ScFormulaCell& rCell = *sc::formula_block::at(*rPos.first->data, rPos.second);
1050 mrColumn(rColumn),
mrPos(rPos) {}
1058 sc::CellStoreType::position_type aPos = rCells.position(
mrPos.miCellPos, rSpan.
mnRow1);
1059 splitFormulaGrouping(aPos);
1060 aPos = rCells.position(aPos.first, rSpan.
mnRow2);
1061 splitFormulaGrouping(aPos);
1071 aDeletedRows( rDoc.GetSheetLimits() )
1078 std::unique_ptr<DeleteCellsResult> xResult = std::make_unique<DeleteCellsResult>(
GetDoc());
1081 DeleteAreaHandler aFunc(
GetDoc(), nDelFlag, *
this);
1082 sc::CellStoreType::iterator itPos =
maCells.position(rBlockPos.
miCellPos, nRow1).first;
1084 xResult->aFormulaRanges = aFunc.getFormulaRanges();
1085 aFunc.endFormulas();
1089 aFunc.getSpans().getSpans(aSpans);
1093 std::for_each(aSpans.rbegin(), aSpans.rend(), EmptyCells(rBlockPos, *
this));
1096 aFunc.getSpans().swap(xResult->aDeletedRows);
1113 std::unique_ptr<DeleteCellsResult> xResult;
1117 xResult =
DeleteCells(aBlockPos, nStartRow, nEndRow, nDelFlag);
1118 if (pBroadcastSpans)
1121 xResult->aDeletedRows.getSpans(aSpans);
1122 for (
const auto& rSpan : aSpans)
1130 DeleteCellNotes(aBlockPos, nStartRow, nEndRow, bForgetCaptionOwnership);
1145 pAttrArray->DeleteArea( nStartRow, nEndRow );
1147 pAttrArray->DeleteHardAttr( nStartRow, nEndRow );
1149 if (xResult && bBroadcast)
1153 std::vector<SCROW> aRows;
1154 xResult->aDeletedRows.getRows(aRows);
1177class CopyAttrArrayByRange
1184 mrDestAttrArray(rDestAttrArray), mrSrcAttrArray(rSrcAttrArray), mnRowOffset(nRowOffset) {}
1189 rSpan.
mnRow1+mnRowOffset, rSpan.
mnRow2+mnRowOffset, mnRowOffset, mrSrcAttrArray);
1193class CopyCellsFromClipHandler
1207 void insertRefCell(
SCROW nSrcRow,
SCROW nDestRow)
1209 ScAddress aSrcPos(mnSrcCol, nSrcRow, mnSrcTab);
1216 aArr.AddSingleReference(aRef);
1222 void duplicateNotes(
SCROW nStartRow,
size_t nDataSize,
bool bCloneCaption )
1224 mrSrcCol.
DuplicateNotes(nStartRow, nDataSize, mrDestCol, maDestBlockPos, bCloneCaption, mnRowOffset);
1227 void duplicateSparklines(
SCROW nStartRow,
size_t nDataSize)
1229 mrSrcCol.
DuplicateSparklines(nStartRow, nDataSize, mrDestCol, maDestBlockPos, mnRowOffset);
1236 mrDestCol(rDestCol),
1239 mnSrcTab(rSrcCol.
GetTab()),
1240 mnSrcCol(rSrcCol.
GetCol()),
1241 mnRowOffset(nRowOffset),
1242 mpDestBlockPos(mrCxt.getBlockPosition(nDestTab, nDestCol)),
1243 mpSharedStringPool(pSharedStringPool)
1254 maDestBlockPos = *mpDestBlockPos;
1260 ~CopyCellsFromClipHandler()
1264 *mpDestBlockPos = maDestBlockPos;
1267 void operator() (
const sc::CellStoreType::value_type& node,
size_t nOffset,
size_t nDataSize)
1269 SCROW nSrcRow1 = node.position + nOffset;
1280 duplicateNotes(nSrcRow1, nDataSize, bCloneCaption );
1282 if (bCopySparklines)
1284 duplicateSparklines(nSrcRow1, nDataSize);
1302 sc::numeric_block::const_iterator it = sc::numeric_block::begin(*node.data);
1303 std::advance(it, nOffset);
1304 sc::numeric_block::const_iterator itEnd = it;
1305 std::advance(itEnd, nDataSize);
1306 for (
SCROW nSrcRow = nSrcRow1; it != itEnd; ++it, ++nSrcRow)
1308 bool bCopy = mrCxt.
isDateCell(mrSrcCol, nSrcRow) ? bDateTime : bNumeric;
1313 insertRefCell(nSrcRow, nSrcRow + mnRowOffset);
1315 mrDestCol.
SetValue(maDestBlockPos, nSrcRow + mnRowOffset, *it);
1324 sc::string_block::const_iterator it = sc::string_block::begin(*node.data);
1325 std::advance(it, nOffset);
1326 sc::string_block::const_iterator itEnd = it;
1327 std::advance(itEnd, nDataSize);
1328 for (
SCROW nSrcRow = nSrcRow1; it != itEnd; ++it, ++nSrcRow)
1331 insertRefCell(nSrcRow, nSrcRow + mnRowOffset);
1332 else if (mpSharedStringPool)
1336 mrDestCol.
SetRawString(maDestBlockPos, nSrcRow + mnRowOffset, aInterned);
1339 mrDestCol.
SetRawString(maDestBlockPos, nSrcRow + mnRowOffset, *it);
1348 sc::edittext_block::const_iterator it = sc::edittext_block::begin(*node.data);
1349 std::advance(it, nOffset);
1350 sc::edittext_block::const_iterator itEnd = it;
1351 std::advance(itEnd, nDataSize);
1352 for (
SCROW nSrcRow = nSrcRow1; it != itEnd; ++it, ++nSrcRow)
1356 insertRefCell(nSrcRow, nSrcRow + mnRowOffset);
1358 mrDestCol.
SetEditText(maDestBlockPos, nSrcRow + mnRowOffset, **it);
1364 sc::formula_block::const_iterator it = sc::formula_block::begin(*node.data);
1365 std::advance(it, nOffset);
1366 sc::formula_block::const_iterator itEnd = it;
1367 std::advance(itEnd, nDataSize);
1368 for (
SCROW nSrcRow = nSrcRow1; it != itEnd; ++it, ++nSrcRow)
1371 bool bForceFormula =
false;
1376 if (pCode && pCode->
GetLen() == 1)
1379 if (
p->GetOpCode() == ocTrue ||
p->GetOpCode() == ocFalse)
1381 bForceFormula =
true;
1386 if (bFormula || bForceFormula)
1389 insertRefCell(nSrcRow, nSrcRow + mnRowOffset);
1393 maDestBlockPos, nSrcRow + mnRowOffset,
1399 else if (bNumeric || bDateTime || bString)
1405 if (nErr != FormulaError::NONE)
1411 insertRefCell(nSrcRow, nSrcRow + mnRowOffset);
1417 maDestBlockPos, nSrcRow + mnRowOffset, pErrCell);
1428 bool bCopy = mrCxt.
isDateCell(mrSrcCol, nSrcRow) ? bDateTime : bNumeric;
1433 insertRefCell(nSrcRow, nSrcRow + mnRowOffset);
1435 mrDestCol.
SetValue(maDestBlockPos, nSrcRow + mnRowOffset, rSrcCell.
GetValue());
1445 insertRefCell(nSrcRow, nSrcRow + mnRowOffset);
1453 else if (mpSharedStringPool)
1457 mrDestCol.
SetRawString(maDestBlockPos, nSrcRow + mnRowOffset, aInterned);
1461 mrDestCol.
SetRawString(maDestBlockPos, nSrcRow + mnRowOffset, aStr);
1474 duplicateNotes(nSrcRow1, nDataSize, bCloneCaption );
1476 if (bCopySparklines)
1478 duplicateSparklines(nSrcRow1, nDataSize);
1483class CopyTextAttrsFromClipHandler
1495 mpDestBlockPos(rCxt.getBlockPosition(nDestTab, nDestCol))
1503 ~CopyTextAttrsFromClipHandler()
1510 void operator() (
const sc::CellTextAttrStoreType::value_type& aNode,
size_t nOffset,
size_t nDataSize )
1515 sc::celltextattr_block::const_iterator it = sc::celltextattr_block::begin(*aNode.data);
1516 std::advance(it, nOffset);
1517 sc::celltextattr_block::const_iterator itEnd = it;
1518 std::advance(itEnd, nDataSize);
1520 size_t nPos = aNode.position + nOffset + mnDelta;
1543 aSpanSet.
scan(rColumn, nRow1-nDy, nRow2-nDy);
1571 for (
SCROW nDestRow = nRow1; nDestRow <= nRow2; nDestRow++)
1574 aDestPos.
SetRow( nDestRow );
1577 aArr.AddSingleReference( aRef );
1596 CopyCellsFromClipHandler aFunc(rCxt, rColumn, *
this,
nTab,
nCol, nDy, pSharedStringPool);
1609 bool bSkipEmpty,
const ScColumn& rSrcCol )
1616 while (aIter.
Next( nRow1, nRow2 ))
1617 MixData(rCxt, nRow1, nRow2, nFunction, bSkipEmpty, rSrcCol);
1624bool lcl_DoFunction(
double& rVal1,
double nVal2,
ScPasteFunc nFunction )
1659 pToken = aIter.Next();
1672 sc::CellStoreType::iterator miNewCellsPos;
1679 void doFunction(
size_t nDestRow,
double fVal1,
double fVal2 )
1681 bool bOk = lcl_DoFunction(fVal1, fVal2, mnFunction);
1684 miNewCellsPos = maNewCells.set(miNewCellsPos, nDestRow-mnRowOffset, fVal1);
1692 miNewCellsPos = maNewCells.set(miNewCellsPos, nDestRow-mnRowOffset, pFC);
1702 mrDestColumn(rDestColumn),
1703 mrBlockPos(rBlockPos),
1704 maNewCells(nRow2 - nRow1 + 1),
1705 miNewCellsPos(maNewCells.
begin()),
1707 mnFunction(nFunction),
1708 mbSkipEmpty(bSkipEmpty)
1712 void operator() (
size_t nRow,
double f)
1714 sc::CellStoreType::position_type aPos = mrDestColumn.
GetCellStore().position(mrBlockPos.
miCellPos, nRow);
1716 switch (aPos.first->type)
1721 double fSrcVal = 0.0;
1723 fSrcVal = sc::numeric_block::at(*aPos.first->data, aPos.second);
1726 doFunction(nRow, f, fSrcVal);
1747 aArr.AddOpCode(eOp);
1750 ScFormulaCell* pDest = sc::formula_block::at(*aPos.first->data, aPos.second);
1751 lcl_AddCode(aArr, pDest);
1753 miNewCellsPos = maNewCells.set(
1754 miNewCellsPos, nRow-mnRowOffset,
1763 miNewCellsPos = maNewCells.set(miNewCellsPos, nRow-mnRowOffset, f);
1773 miNewCellsPos = maNewCells.set(miNewCellsPos, nRow-mnRowOffset, rStr);
1778 miNewCellsPos = maNewCells.set(miNewCellsPos, nRow-mnRowOffset,
p->Clone().release());
1783 sc::CellStoreType::position_type aPos = mrDestColumn.
GetCellStore().position(mrBlockPos.
miCellPos, nRow);
1785 switch (aPos.first->type)
1793 lcl_AddCode(aArr, p);
1805 aArr.AddOpCode(eOp);
1808 aArr.AddDouble(sc::numeric_block::at(*aPos.first->data, aPos.second));
1810 miNewCellsPos = maNewCells.set(
1811 miNewCellsPos, nRow-mnRowOffset,
1822 lcl_AddCode(aArr, p);
1834 aArr.AddOpCode(eOp);
1837 ScFormulaCell* pDest = sc::formula_block::at(*aPos.first->data, aPos.second);
1838 lcl_AddCode(aArr, pDest);
1840 miNewCellsPos = maNewCells.set(
1841 miNewCellsPos, nRow-mnRowOffset,
1852 miNewCellsPos = maNewCells.set(
1864 void operator() (mdds::mtv::element_t,
size_t nTopRow,
size_t nDataSize)
1870 for (
size_t i = 0;
i < nDataSize; ++
i)
1872 size_t nDestRow = nTopRow +
i;
1873 sc::CellStoreType::position_type aPos = mrDestColumn.
GetCellStore().position(mrBlockPos.
miCellPos, nDestRow);
1875 switch (aPos.first->type)
1879 double fVal2 = sc::numeric_block::at(*aPos.first->data, aPos.second);
1880 doFunction(nDestRow, 0.0, fVal2);
1885 const svl::SharedString& aVal = sc::string_block::at(*aPos.first->data, aPos.second);
1886 miNewCellsPos = maNewCells.set(
1887 miNewCellsPos, nDestRow-mnRowOffset, aVal);
1892 EditTextObject* pObj = sc::edittext_block::at(*aPos.first->data, aPos.second);
1893 miNewCellsPos = maNewCells.set(
1894 miNewCellsPos, nDestRow-mnRowOffset, pObj->
Clone().release());
1902 ScFormulaCell* pSrc = sc::formula_block::at(*aPos.first->data, aPos.second);
1903 lcl_AddCode( aArr, pSrc);
1916 aArr.AddOpCode(eOp);
1917 aArr.AddDouble(0.0);
1919 miNewCellsPos = maNewCells.set(
1920 miNewCellsPos, nDestRow-mnRowOffset,
1939 sc::CellStoreType::position_type aPos = rDestCells.position(mrBlockPos.
miCellPos, mnRowOffset);
1943 sc::CellStoreType::iterator& itDestPos = mrBlockPos.
miCellPos;
1944 sc::CellTextAttrStoreType::iterator& itDestAttrPos = mrBlockPos.
miCellTextAttrPos;
1946 for (
const auto& rNewCell : maNewCells)
1948 bool bHasContent =
true;
1949 size_t nDestRow = mnRowOffset + rNewCell.position;
1951 switch (rNewCell.type)
1955 sc::numeric_block::iterator itData = sc::numeric_block::begin(*rNewCell.data);
1956 sc::numeric_block::iterator itDataEnd = sc::numeric_block::end(*rNewCell.data);
1957 itDestPos = mrDestColumn.
GetCellStore().set(itDestPos, nDestRow, itData, itDataEnd);
1962 sc::string_block::iterator itData = sc::string_block::begin(*rNewCell.data);
1963 sc::string_block::iterator itDataEnd = sc::string_block::end(*rNewCell.data);
1964 itDestPos = rDestCells.set(itDestPos, nDestRow, itData, itDataEnd);
1969 sc::edittext_block::iterator itData = sc::edittext_block::begin(*rNewCell.data);
1970 sc::edittext_block::iterator itDataEnd = sc::edittext_block::end(*rNewCell.data);
1971 itDestPos = rDestCells.set(itDestPos, nDestRow, itData, itDataEnd);
1976 sc::formula_block::iterator itData = sc::formula_block::begin(*rNewCell.data);
1977 sc::formula_block::iterator itDataEnd = sc::formula_block::end(*rNewCell.data);
1983 itDestPos = rDestCells.set(itDestPos, nDestRow, itData, itDataEnd);
1986 aPos = rDestCells.position(itDestPos, nDestRow);
1990 size_t nNextRow = nDestRow + rNewCell.size;
1993 aPos = rDestCells.position(aPos.first, nNextRow);
1998 std::vector<SCROW> aNewSharedRows;
1999 aPos = rDestCells.position(itDestPos, nDestRow);
2000 size_t nFormulaCells = std::distance(itData, itDataEnd);
2006 itDestPos = rDestCells.set_empty(itDestPos, nDestRow, nDestRow+rNewCell.size-1);
2007 bHasContent =
false;
2018 itDestAttrPos = rDestAttrs.set(itDestAttrPos, nDestRow, aAttrs.begin(), aAttrs.end());
2021 itDestAttrPos = rDestAttrs.set_empty(itDestAttrPos, nDestRow, nDestRow+rNewCell.size-1);
2024 maNewCells.release();
2032 bool bSkipEmpty,
const ScColumn& rSrcCol )
2040 MixDataHandler aFunc(*
p, *
this, nRow1, nRow2, nFunction, bSkipEmpty);
2049 return std::make_unique<ScAttrIterator>(
pAttrArray.get(), nStartRow, nEndRow,
GetDoc().GetDefPattern() );
2054class StartListenersHandler
2057 bool mbAllListeners;
2061 mpCxt(&rCxt), mbAllListeners(bAllListeners) {}
2063 void operator() ( sc::CellStoreType::value_type& aBlk )
2071 for (; pp != ppEnd; ++pp)
2092 std::for_each(
maCells.begin(),
maCells.end(), StartListenersHandler(rCxt, bAll));
2113 if (rString.isEmpty())
2116 bool bNumFmtSet =
false;
2124 sal_uInt32 nOldIndex = 0;
2131 if ( rString.getLength() > 1 )
2134 if ( eNumFormatType != SvNumFormatType::TEXT )
2135 cFirstChar = rString[0];
2140 if ( cFirstChar ==
'=' )
2142 if ( rString.getLength() == 1 )
2160 rCell.
set( pFormulaCell);
2163 else if ( cFirstChar ==
'\'')
2172 rCell.
set(rPool.
intern(rString.copy(1)));
2195 if (eNumFormatType == SvNumFormatType::ALL)
2197 bool bForceFormatDate = (eNumFormatType == SvNumFormatType::DATE
2198 || eNumFormatType == SvNumFormatType::DATETIME);
2201 if (bForceFormatDate)
2212 bForceFormatDate =
false;
2216 aCell.
getValue(), nOldIndex, eNumFormatType, pOldFormat);
2223 bForceFormatDate =
false;
2229 if (bForceFormatDate)
2232 if (!bIsNumberFormat)
2254 if (
nIndex != nOldIndex)
2260 bool bOverwrite =
false;
2264 if ( nOldType == SvNumFormatType::NUMBER || nOldType == SvNumFormatType::DATE ||
2265 nOldType == SvNumFormatType::TIME || nOldType == SvNumFormatType::LOGICAL )
2295 const LocaleDataItem2& aLocaleItem =
pLocale->getLocaleItem();
2296 const OUString& rDecSep = aLocaleItem.decimalSeparator;
2297 const OUString& rGroupSep = aLocaleItem.thousandSeparator;
2298 const OUString& rDecSepAlt = aLocaleItem.decimalSeparatorAlternative;
2299 if (rDecSep.getLength() != 1 || rGroupSep.getLength() != 1 || rDecSepAlt.getLength() > 1)
2347 bool bNumFmtSet =
ParseString(aNewCell, nRow, nTabP, rString, eConv, pParam);
2351 aNewCell.
release(*
this, nRow);
2361 pEditText->NormalizeString(
GetDoc().GetSharedStringPool());
2362 std::vector<SCROW> aNewSharedRows;
2364 maCells.set(it, nRow, pEditText.release());
2375 pEditText->NormalizeString(
GetDoc().GetSharedStringPool());
2376 std::vector<SCROW> aNewSharedRows;
2407 if (pEditPool &&
GetDoc().GetEditPool() == pEditPool)
2425 std::vector<SCROW> aNewSharedRows;
2431 it =
maCells.set(it, nRow, pCell);
2443 std::vector<SCROW> aNewSharedRows;
2449 it =
maCells.set(it, nRow, pCell);
2459 bool bInheritNumFormatIfNeeded )
2461 std::vector<SCROW> aNewSharedRows;
2466 it =
maCells.set(it, nRow, pCell);
2479 bool bInheritNumFormatIfNeeded )
2481 std::vector<SCROW> aNewSharedRows;
2500 SCROW nEndRow = nRow + rCells.size() - 1;
2504 sc::CellStoreType::position_type aPos =
maCells.position(nRow);
2507 std::vector<SCROW> aNewSharedRows;
2510 if (!
GetDoc().IsClipOrUndo())
2512 for (
size_t i = 0,
n = rCells.size();
i <
n; ++
i)
2514 SCROW nThisRow = nRow +
i;
2517 rCells[
i]->SetNeedNumberFormat(
true);
2521 std::vector<sc::CellTextAttr> aDefaults(rCells.size(),
sc::CellTextAttr());
2524 maCells.set(aPos.first, nRow, rCells.begin(), rCells.end());
2530 aPos =
maCells.position(nRow);
2538 sc::CellStoreType::const_position_type aPos =
maCells.position(nRow);
2539 switch (aPos.first->type)
2542 return sc::string_block::at(*aPos.first->data, aPos.second);
2545 const EditTextObject* pObj = sc::edittext_block::at(*aPos.first->data, aPos.second);
2547 if (aSSs.size() != 1)
2562class FilterEntriesHandler
2579 mrFilterEntries.
addTextColor(pTable->GetCellTextColor(aPos));
2611 if (nErr != FormulaError::NONE)
2615 if (!aErr.isEmpty())
2631 if ((
nType & SvNumFormatType::DATE) && !(
nType & SvNumFormatType::TIME))
2635 fVal = rtl::math::approxFloor(fVal);
2643 else if (
nType == SvNumFormatType::DATETIME)
2652 if ((nFormat % SV_COUNTRY_LANGUAGE_OFFSET) != 0 && !bDate)
2659 FilterEntriesHandler(
ScColumn& rColumn,
ScFilterEntries& rFilterEntries,
bool bFiltering,
bool bFilteredRow) :
2660 mrColumn(rColumn), mrFilterEntries(rFilterEntries), mbFiltering(bFiltering), mbFilteredRow(bFilteredRow) {}
2662 void operator() (
size_t nRow,
double fVal)
2665 processCell(mrColumn, nRow, aCell);
2671 processCell(mrColumn, nRow, aCell);
2677 processCell(mrColumn, nRow, aCell);
2683 processCell(mrColumn, nRow, aCell);
2686 void operator() (
const int nElemType,
size_t nRow,
size_t )
2699 FilterEntriesHandler aFunc(*
this, rFilterEntries, bFiltering, bFilteredRow);
2709class StrCellIterator
2711 typedef std::pair<sc::CellStoreType::const_iterator,size_t> PosType;
2713 sc::CellStoreType::const_iterator miBeg;
2714 sc::CellStoreType::const_iterator miEnd;
2718 miBeg(rCells.
begin()), miEnd(rCells.
end()), mpDoc(pDoc)
2721 maPos = rCells.position(nStart);
2724 maPos.first = miEnd;
2727 bool valid()
const {
return (maPos.first != miEnd); }
2741 if (maPos.first == miBeg)
2745 maPos.second = maPos.first->size - 1;
2751 if (maPos.second > 0)
2761 if (maPos.first == miBeg)
2766 maPos.second = maPos.first->size - 1;
2782 if (maPos.first == miEnd)
2792 if (maPos.second >= maPos.first->size)
2798 if (maPos.first == miEnd)
2809 OUString
get()
const
2811 switch (maPos.first->type)
2814 return sc::string_block::at(*maPos.first->data, maPos.second).getString();
2817 const EditTextObject*
p = sc::edittext_block::at(*maPos.first->data, maPos.second);
2831 SCROW nStartRow, std::set<ScTypedStrData>& rStrings)
const
2840 bool bMoveUp = aItrUp.valid();
2846 bMoveUp = aItrUp.prev();
2848 bool bMoveDown = aItrDown.valid();
2849 if (bMoveDown && !aItrDown.has())
2850 bMoveDown = aItrDown.next();
2852 bool bFound =
false;
2856 OUString
aStr = aItrUp.get();
2857 if (!
aStr.isEmpty())
2863 bMoveUp = aItrUp.prev();
2869 OUString
aStr = aItrDown.get();
2870 if (!
aStr.isEmpty())
2876 bMoveDown = aItrDown.next();
2884class FormulaToValueHandler
2895 typedef std::vector<Entry> EntriesType;
2896 EntriesType maEntries;
2904 maEntries.emplace_back(nRow, p2->
GetValue());
2906 maEntries.emplace_back(nRow, p2->
GetString());
2909 void commitCells(
ScColumn& rColumn)
2914 for (
const Entry& r : maEntries)
2916 switch (r.maValue.getType())
2919 rColumn.
SetValue(aBlockPos, r.mnRow, r.maValue.getDouble(),
false);
2922 rColumn.
SetRawString(aBlockPos, r.mnRow, *r.maValue.getSharedString(),
false);
2935 FormulaToValueHandler aFunc;
2936 sc::CellStoreType::const_iterator itPos =
maCells.begin();
2953 pPattern = aAttrIter.
Next( nTop, nBottom );
2956 aFunc.commitCells(*
this);
2967 std::vector<SCROW> aNewSharedRows;
2969 it =
maCells.set(it, nRow, pCell);
2994 std::vector<SCROW> aNewSharedRows;
3012 std::vector<SCROW> aNewSharedRows;
3031 std::vector<SCROW> aNewSharedRows;
3049 std::vector<SCROW> aNewSharedRows;
3069 sal_uInt32 nFormat =
GetNumberFormat( pContext ? *pContext :
GetDoc().GetNonThreadedContext(), nRow);
3070 const Color* pColor =
nullptr;
3077 std::pair<sc::CellStoreType::iterator,size_t> aPos =
maCells.position(nRow);
3078 sc::CellStoreType::iterator it = aPos.first;
3085 return &sc::numeric_block::at(*it->data, aPos.second);
3096 std::pair<sc::CellStoreType::const_iterator,size_t> aPos =
maCells.position(nRow);
3097 sc::CellStoreType::const_iterator it = aPos.first;
3101 return sc::numeric_block::at(*it->data, aPos.second);
3104 const ScFormulaCell*
p = sc::formula_block::at(*it->data, aPos.second);
3117 std::pair<sc::CellStoreType::const_iterator,size_t> aPos =
maCells.position(nRow);
3118 sc::CellStoreType::const_iterator it = aPos.first;
3125 return sc::edittext_block::at(*it->data, aPos.second);
3130 std::pair<sc::CellStoreType::iterator,size_t> aPos =
maCells.position(nRow);
3131 sc::CellStoreType::iterator it = aPos.first;
3146 return p->GetFormula();
3162 switch (
maCells.get_type(nRow))
3189 void operator() (
const sc::CellStoreType::value_type& node)
3197 size_t getCount()
const {
return mnCount; }
3206 return aFunc.getCount();
3211 std::pair<sc::CellStoreType::const_iterator,size_t> aPos =
maCells.position(nRow);
3212 sc::CellStoreType::const_iterator it = aPos.first;
3214 return FormulaError::NONE;
3217 return FormulaError::NONE;
3219 const ScFormulaCell*
p = sc::formula_block::at(*it->data, aPos.second);
3225 std::pair<sc::CellStoreType::const_iterator,size_t> aPos =
maCells.position(nRow);
3226 switch (aPos.first->type)
3233 const ScFormulaCell*
p = sc::formula_block::at(*aPos.first->data, aPos.second);
3245 std::pair<sc::CellStoreType::const_iterator,size_t> aPos =
maCells.position(nRow);
3246 switch (aPos.first->type)
3252 const ScFormulaCell*
p = sc::formula_block::at(*aPos.first->data, aPos.second);
3267 std::pair<sc::CellStoreType::const_iterator,size_t> aPos =
maCells.position(nStartRow);
3268 sc::CellStoreType::const_iterator it = aPos.first;
3269 size_t nOffset = aPos.second;
3270 SCROW nRow = nStartRow;
3271 for (; it !=
maCells.end() && nRow <= nEndRow; ++it)
3276 nRow += it->size - nOffset;
3285class MaxStringLenHandler
3290 rtl_TextEncoding meCharSet;
3291 bool mbOctetEncoding;
3295 const Color* pColor;
3299 if (mbOctetEncoding)
3302 if (!aString.convertToString(&aOString, meCharSet,
3303 RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
3304 RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR))
3311 nLen = aOString.getLength();
3316 if (mnMaxLen < nLen)
3321 MaxStringLenHandler(
const ScColumn& rColumn, rtl_TextEncoding eCharSet) :
3324 mpFormatter(rColumn.
GetDoc().GetFormatTable()),
3325 meCharSet(eCharSet),
3326 mbOctetEncoding(rtl_isOctetTextEncoding(eCharSet))
3330 void operator() (
size_t nRow,
double fVal)
3333 processCell(nRow, aCell);
3339 processCell(nRow, aCell);
3345 processCell(nRow, aCell);
3351 processCell(nRow, aCell);
3354 sal_Int32 getMaxLen()
const {
return mnMaxLen; }
3361 MaxStringLenHandler aFunc(*
this, eCharSet);
3363 return aFunc.getMaxLen();
3368class MaxNumStringLenHandler
3373 sal_uInt16 mnPrecision;
3374 sal_uInt16 mnMaxGeneralPrecision;
3379 sal_uInt16 nCellPrecision = mnMaxGeneralPrecision;
3390 nCellPrecision = mnPrecision;
3392 nCellPrecision = (mnMaxGeneralPrecision >= 15) ? 4 : mnMaxGeneralPrecision;
3396 if (!mbHaveSigned && fVal < 0.0)
3397 mbHaveSigned =
true;
3402 sal_uInt32 nFormat =
3404 if (nFormat % SV_COUNTRY_LANGUAGE_OFFSET)
3411 bool bThousand, bNegRed;
3412 sal_uInt16 nLeading;
3420 if (mnPrecision >= mnMaxGeneralPrecision)
3434 aString = rtl::math::doubleToUString( fVal, rtl_math_StringFormat_F, nCellPrecision,
'.',
true);
3438 sal_Int32 nLen = aString.getLength();
3445 if (nFormat % SV_COUNTRY_LANGUAGE_OFFSET)
3450 aString = rtl::math::doubleToUString( fVal, rtl_math_StringFormat_F, nCellPrecision,
'.',
true);
3451 nLen = aString.getLength();
3453 sal_Int32 nSep = aString.indexOf( aSep);
3455 nPrec = aString.getLength() - nSep - 1;
3460 mnPrecision = nPrec;
3465 sal_Int32 nTmp = aString.indexOf(aSep);
3467 nLen += mnPrecision + aSep.getLength();
3470 nTmp = aString.getLength() - (nTmp + aSep.getLength());
3471 if (nTmp != mnPrecision)
3472 nLen += mnPrecision - nTmp;
3482 if (mbHaveSigned && fVal >= 0.0)
3485 if (mnMaxLen < nLen)
3490 MaxNumStringLenHandler(
const ScColumn& rColumn, sal_uInt16 nMaxGeneralPrecision) :
3491 mrColumn(rColumn), mpFormatter(rColumn.
GetDoc().GetFormatTable()),
3492 mnMaxLen(0), mnPrecision(0), mnMaxGeneralPrecision(nMaxGeneralPrecision),
3497 if (mnMaxGeneralPrecision > 15)
3498 mnMaxGeneralPrecision = 15;
3501 void operator() (
size_t nRow,
double fVal)
3504 processCell(nRow, aCell);
3510 processCell(nRow, aCell);
3513 sal_Int32 getMaxLen()
const {
return mnMaxLen; }
3515 sal_uInt16 getPrecision()
const {
return mnPrecision; }
3521 sal_uInt16& nPrecision,
SCROW nRowStart,
SCROW nRowEnd )
const
3524 MaxNumStringLenHandler aFunc(*
this, nMaxGeneralPrecision);
3526 nPrecision = aFunc.getPrecision();
3527 return aFunc.getMaxLen();
3532class GroupFormulaCells
3534 std::vector<ScAddress>* mpGroupPos;
3537 explicit GroupFormulaCells(std::vector<ScAddress>* pGroupPos)
3538 : mpGroupPos(pGroupPos) {}
3540 void operator() (sc::CellStoreType::value_type& node)
3546 size_t nRow = node.position;
3548 sc::formula_block::iterator it = sc::formula_block::begin(*node.data);
3549 sc::formula_block::iterator itEnd = sc::formula_block::end(*node.data);
3558 std::advance(it, xPrevGrp->mnLength);
3559 nRow += xPrevGrp->mnLength;
3569 for (; it != itEnd; pPrev = pCur, xPrevGrp = xCurGrp)
3581 if (xCurGrp->mnLength > std::distance(it, itEnd))
3582 throw css::lang::IllegalArgumentException();
3583 std::advance(it, xCurGrp->mnLength);
3584 nRow += xCurGrp->mnLength;
3602 xPrevGrp->mnLength += xCurGrp->mnLength;
3604 sc::formula_block::iterator itGrpEnd = it;
3605 if (xCurGrp->mnLength > std::distance(itGrpEnd, itEnd))
3606 throw css::lang::IllegalArgumentException();
3607 std::advance(itGrpEnd, xCurGrp->mnLength);
3608 for (++it; it != itGrpEnd; ++it)
3613 nRow += xCurGrp->mnLength;
3619 ++xPrevGrp->mnLength;
3628 nRow += xCurGrp->mnLength;
3629 if (xCurGrp->mnLength > std::distance(it, itEnd))
3630 throw css::lang::IllegalArgumentException();
3631 std::advance(it, xCurGrp->mnLength);
3633 xCurGrp->mpTopCell = pPrev;
3634 ++xCurGrp->mnLength;
3640 assert(pPrev->
aPos.
Row() ==
static_cast<SCROW>(nRow - 1));
3648 mpGroupPos->push_back(pCur->
aPos);
3661 std::for_each(
maCells.begin(),
maCells.end(), GroupFormulaCells(pGroupPos));
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)
std::unique_ptr< EditTextObject > CreateTextObject()
void SetText(const OUString &rStr)
virtual std::vector< svl::SharedString > GetSharedStrings() const=0
virtual const SfxItemPool * GetPool() const=0
virtual std::unique_ptr< EditTextObject > Clone() const=0
void CopyAreaSafe(SCROW nStartRow, SCROW nEndRow, tools::Long nDy, ScAttrArray &rAttrArray)
Leave flags summarized with CopyArea.
const ScPatternAttr * Next(SCROW &rTop, SCROW &rBottom)
std::unique_ptr< ScAttrArray > pAttrArray
std::unique_ptr< ScAttrIterator > CreateAttrIterator(SCROW nStartRow, SCROW nEndRow) const
void DeleteCellNotes(sc::ColumnBlockPosition &rBlockPos, SCROW nRow1, SCROW nRow2, bool bForgetCaptionOwnership)
svl::SharedString GetSharedString(SCROW nRow) const
void CellStorageModified()
Called whenever the state of cell array gets modified i.e.
bool HasStringData(SCROW nRow) const
void ApplyPattern(SCROW nRow, const ScPatternAttr &rPatAttr)
FormulaError GetErrCode(SCROW nRow) const
void SetValue(SCROW nRow, double fVal)
sc::CellTextAttrStoreType maCellTextAttrs
void SetFormula(SCROW nRow, const ScTokenArray &rArray, formula::FormulaGrammar::Grammar eGram)
bool HasValueData(SCROW nRow) const
const ScPatternAttr * GetPattern(SCROW nRow) const
void DuplicateNotes(SCROW nStartRow, size_t nDataSize, ScColumn &rDestCol, sc::ColumnBlockPosition &rDestBlockPos, bool bCloneCaption, SCROW nRowOffsetDest=0) const
const SfxPoolItem & GetAttr(SCROW nRow, sal_uInt16 nWhich) const
void RegroupFormulaCells(std::vector< ScAddress > *pGroupPos=nullptr)
Regroup formula cells for the entire column.
void SetError(SCROW nRow, const FormulaError nError)
ScFormulaCell * SetFormulaCell(SCROW nRow, ScFormulaCell *pCell, sc::StartListeningType eListenType=sc::SingleCellListening, bool bInheritNumFormatIfNeeded=true)
Takes ownership of pCell.
void BroadcastCells(const std::vector< SCROW > &rRows, SfxHintId nHint)
bool SetFormulaCells(SCROW nRow, std::vector< ScFormulaCell * > &rCells)
void InterpretDirtyCells(SCROW nRow1, SCROW nRow2)
void InitBlockPosition(sc::ColumnBlockPosition &rBlockPos)
void StartListeners(sc::StartListeningContext &rCxt, bool bAll)
sal_Int32 GetMaxNumberStringLen(sal_uInt16 &nPrecision, SCROW nRowStart, SCROW nRowEnd) const
void DetachFormulaCell(const sc::CellStoreType::position_type &aPos, ScFormulaCell &rCell, std::vector< SCROW > &rNewSharedRows)
Detach a formula cell that's about to be deleted, or removed from document storage (if that ever happ...
OUString GetFormula(SCROW nRow) const
void RemoveProtected(SCROW nStartRow, SCROW nEndRow)
bool ParseString(ScCellValue &rCell, SCROW nRow, SCTAB nTab, const OUString &rString, formula::FormulaGrammar::AddressConvention eConv, const ScSetStringParam *pParam)
void DuplicateSparklines(SCROW nStartRow, size_t nDataSize, ScColumn &rDestCol, sc::ColumnBlockPosition &rDestBlockPos, SCROW nRowOffsetDest=0) const
std::unique_ptr< DeleteCellsResult > DeleteCells(sc::ColumnBlockPosition &rBlockPos, SCROW nRow1, SCROW nRow2, InsertDeleteFlags nDelFlag)
void GetFilterEntries(sc::ColumnBlockConstPosition &rBlockPos, SCROW nStartRow, SCROW nEndRow, ScFilterEntries &rFilterEntries, bool bFiltering, bool bFilteredRow)
void RemoveEditAttribs(sc::ColumnBlockPosition &rBlockPos, SCROW nStartRow, SCROW nEndRow)
bool HasStringCells(SCROW nStartRow, SCROW nEndRow) const
Return true if there is a string or editcell in the range.
sc::CellNoteStoreType maCellNotes
void AttachNewFormulaCell(const sc::CellStoreType::iterator &itPos, SCROW nRow, ScFormulaCell &rCell, const std::vector< SCROW > &rNewSharedRows, bool bJoin=true, sc::StartListeningType eListenType=sc::SingleCellListening)
const ScFormulaCell * GetFormulaCell(SCROW nRow) const
void DeleteRow(SCROW nStartRow, SCSIZE nSize, std::vector< ScAddress > *pGroupPos)
const EditTextObject * GetEditText(SCROW nRow) const
void MixMarked(sc::MixDocContext &rCxt, const ScMarkData &rMark, ScPasteFunc nFunction, bool bSkipEmpty, const ScColumn &rSrcCol)
void CellNotesDeleting(SCROW nRow1, SCROW nRow2, bool bForgetCaptionOwnership)
bool InterpretCellsIfNeeded(SCROW nRow1, SCROW nRow2)
void CopyFromClip(sc::CopyFromClipContext &rCxt, SCROW nRow1, SCROW nRow2, tools::Long nDy, ScColumn &rColumn)
sal_Int32 GetMaxStringLen(SCROW nRowStart, SCROW nRowEnd, rtl_TextEncoding eCharSet) const
void ApplyAttr(SCROW nRow, const SfxPoolItem &rAttr)
void MixData(sc::MixDocContext &rCxt, SCROW nRow1, SCROW nRow2, ScPasteFunc nFunction, bool bSkipEmpty, const ScColumn &rSrcCol)
void BroadcastNewCell(SCROW nRow)
void SetNeedsListeningGroup(SCROW nRow)
OUString GetInputString(SCROW nRow, bool bForceSystemLocale=false) const
bool GetDataEntries(SCROW nRow, std::set< ScTypedStrData > &rStrings) const
sc::CellStoreType maCells
ScRefCellValue GetCellValue(SCROW nRow) const
void DetachFormulaCells(const sc::CellStoreType::position_type &aPos, size_t nLength, std::vector< SCROW > *pNewSharedRows)
bool UpdateScriptType(sc::CellTextAttr &rAttr, SCROW nRow, sc::CellStoreType::iterator &itr)
SCSIZE GetCellCount() const
void StartListeningUnshared(const std::vector< SCROW > &rNewSharedRows)
Re-establish listeners on unshared formula groups.
void StartListeningFormulaCells(sc::StartListeningContext &rStartCxt, sc::EndListeningContext &rEndCxt, SCROW nRow1, SCROW nRow2)
void BroadcastRows(SCROW nStartRow, SCROW nEndRow, SfxHintId nHint)
void Broadcast(SCROW nRow)
sc::CellTextAttrStoreType & GetCellAttrStore()
double * GetValueCell(SCROW nRow)
void DeleteSparklineCells(sc::ColumnBlockPosition &rBlockPos, SCROW nRow1, SCROW nRow2)
void SetEditText(SCROW nRow, std::unique_ptr< EditTextObject > pEditText)
void DeleteContent(SCROW nRow, bool bBroadcast=true)
sc::CellStoreType & GetCellStore()
bool SetString(SCROW nRow, SCTAB nTab, const OUString &rString, formula::FormulaGrammar::AddressConvention eConv, const ScSetStringParam *pParam=nullptr)
Returns true if the cell format was set as well.
void DeleteArea(SCROW nStartRow, SCROW nEndRow, InsertDeleteFlags nDelFlag, bool bBroadcast=true, sc::ColumnSpanSet *pBroadcastSpans=nullptr)
double GetValue(SCROW nRow) const
static void JoinNewFormulaCell(const sc::CellStoreType::position_type &aPos, ScFormulaCell &rCell)
sc::BroadcasterStoreType maBroadcasters
OUString GetString(SCROW nRow, const ScInterpreterContext *pContext=nullptr) const
void SetRawString(SCROW nRow, const OUString &rStr)
void RemoveEditTextCharAttribs(SCROW nRow, const ScPatternAttr &rAttr)
SCROW GetLastDataPos() const
CellType GetCellType(SCROW nRow) const
const ScFormulaCell * FetchFormulaCell(SCROW nRow) const
ScDocument & GetDoc() const
sal_uInt32 GetNumberFormat(const ScInterpreterContext &rContext, SCROW nRow) const
sc::SparklineStoreType maSparklines
void AttachFormulaCells(sc::StartListeningContext &rCxt, SCROW nRow1, SCROW nRow2)
sc::CellStoreType::iterator GetPositionToInsert(SCROW nRow, std::vector< SCROW > &rNewSharedRows, bool bInsertFormula)
void AttachNewFormulaCells(const sc::CellStoreType::position_type &aPos, size_t nLength, std::vector< SCROW > &rNewSharedRows)
sal_uInt16 GetStdPrecision() const
bool IsCalcingAfterLoad() const
bool ValidRow(SCROW nRow) const
SC_DLLPUBLIC ScTable * FetchTable(SCTAB nTab)
SC_DLLPUBLIC SCROW GetMaxRowCount() const
SC_DLLPUBLIC ScDocumentPool * GetPool()
SC_DLLPUBLIC void CheckLinkFormulaNeedingCheck(const ScTokenArray &rCode)
Check token array and set link check if ocDde/ocWebservice is contained.
SC_DLLPUBLIC ScFieldEditEngine & GetEditEngine()
SC_DLLPUBLIC double RoundValueAsShown(double fVal, sal_uInt32 nFormat, const ScInterpreterContext *pContext=nullptr) const
ScInterpreterContext & GetNonThreadedContext() const
SC_DLLPUBLIC SvtScriptType GetStringScriptType(const OUString &rString)
bool IsDelayedFormulaGrouping() const
void Broadcast(const ScHint &rHint)
Broadcast wrapper, calls rHint.GetCell()->Broadcast() and AreaBroadcast() and TrackFormulas() Preferr...
void EndListeningFormulaCells(std::vector< ScFormulaCell * > &rCells)
bool IsClipOrUndo() const
bool IsInsertingFromOtherDoc() const
SC_DLLPUBLIC svl::SharedStringPool & GetSharedStringPool()
SC_DLLPUBLIC ScConditionalFormatList * GetCondFormList(SCTAB nTab) const
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
bool CanDelayStartListeningFormulaCells(ScColumn *column, SCROW row1, SCROW row2)
If true is returned, ScColumn::StartListeningFormulaCells() for the given cells will be performed lat...
SC_DLLPUBLIC const SfxItemSet * GetCondResult(SCCOL nCol, SCROW nRow, SCTAB nTab, ScRefCellValue *pCell=nullptr) const
SC_DLLPUBLIC const ScDocOptions & GetDocOptions() const
void SetTextCurrentDefaults(const EditTextObject &rTextObject)
SetText and apply defaults already set.
static void RemoveCharAttribs(EditTextObject &rEditText, const ScPatternAttr &rAttr)
static SC_DLLPUBLIC OUString GetString(const EditTextObject &rEditText, const ScDocument *pDoc)
Retrieves string with paragraphs delimited by new lines (' ').
static OUString GetErrorString(FormulaError nErrNumber)
void SetAddressRow(SCROW nRow)
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
bool IsMultiMarked() const
const ScMultiSel & GetMultiSelData() const
bool Next(SCROW &rTop, SCROW &rBottom)
sal_uInt32 GetNumberFormat(SvNumberFormatter *) const
const SfxPoolItem & GetItem(sal_uInt16 nWhichP) const
bool GetHideFormula() const
static bool parseSimpleNumber(const OUString &rStr, sal_Unicode dsep, sal_Unicode gsep, sal_Unicode dsepa, double &rVal, bool bDetectScientificNumber=true)
Check if a given string is a simple decimal number (e.g.
virtual formula::FormulaToken * AddOpCode(OpCode eCode) override
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
static bool SafePlus(double &fVal1, double fVal2)
static bool SafeMult(double &fVal1, double fVal2)
static bool SafeDiv(double &fVal1, double fVal2)
Temporarily switch on/off auto calculation mode.
ColumnBlockPosition * getBlockPosition(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 isCloneSparklines() const
bool isCloneNotes() const
bool isSkipEmptyCells() const
Get the flag that indicates whether the "skip empty cells" paste option is selected.
InsertDeleteFlags getInsertFlag() const
bool isDateCell(const ScColumn &rCol, SCROW nRow) const
ScDocument * getDestDoc()
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)
SharedString intern(const OUString &rStr)
static void lcl_AddFormulaGroupBoundaries(const sc::CellStoreType::position_type &rPos, std::vector< SCROW > &rNewSharedRows)
#define suppress_fun_call_w_exception(expr)
@ SPARKLINES
Sheet / outlining (grouping) information.
@ 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.
@ EDITATTR
Drawing objects.
@ STRING
Dates, times, datetime values.
@ 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.
enumrange< T >::Iterator begin(enumrange< T >)
CellStoreType::const_iterator ParseAllNonEmpty(const typename CellStoreType::const_iterator &itPos, const CellStoreType &rCells, SCROW nRow1, SCROW nRow2, Func &rFunc)
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.
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).
CellStoreType::const_iterator ParseFormulaNumeric(const CellStoreType::const_iterator &itPos, const CellStoreType &rCells, SCROW nRow1, SCROW nRow2, Func &rFunc)
CellStoreType::const_iterator ParseAll(const typename CellStoreType::const_iterator &itPos, const CellStoreType &rCells, SCROW nRow1, SCROW nRow2, FuncElem &rFuncElem, FuncElse &rFuncElse)
@ ConvertToGroupListening
mdds::mtv::soa::multi_type_vector< CellTextAttrTraits > CellTextAttrStoreType
Cell text attribute container.
const mdds::mtv::element_t element_type_string
const mdds::mtv::element_t element_type_empty
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
constexpr TypedWhichId< ScProtectionAttr > ATTR_PROTECTION(149)
constexpr TypedWhichId< ScCondFormatItem > ATTR_CONDITIONAL(154)
Store arbitrary cell value of any kind.
void release(ScDocument &rDoc, const ScAddress &rPos)
Set cell value at specified position in specified document.
DeleteCellsResult(const ScDocument &rDoc)
void addBackgroundColor(const Color &aBackgroundColor)
void addTextColor(const Color &aTextColor)
void push_back(const ScTypedStrData &r)
SvNumberFormatter * GetFormatTable() const
This is very similar to ScCellValue, except that it references the original value instead of copying ...
ScFormulaCell * getFormula() const
Store parameters used in the ScDocument::SetString() method.
bool mbHandleApostrophe
When true, treat input with a leading apostrophe as an escape character for all content,...
bool mbCheckLinkFormula
When true and the string results in a compiled formula, check the formula tokens for presence of func...
bool mbDetectScientificNumberFormat
bool mbDetectNumberFormat
Specify which number formats are detected: mbDetectNumberFormat=true && mbDetectScientificNumberForma...
SvNumberFormatter * mpNumFormatter
Stores the pointer to the number formatter instance to be used during number format detection.
@ Always
Set Text number format if the input string can be parsed as a number or formula text.
@ Never
Never set Text number format.
@ SpecialNumberOnly
Set Text number format only when the input string is considered a special number but we only want to ...
TextFormatPolicy meSetTextNumFormat
Determine when to set the 'Text' number format to the cell where the input string is being set.
sc::StartListeningType meStartListening
Single reference (one address) into the sheet.
void SetAbsCol(SCCOL nVal)
void SetAbsTab(SCTAB nVal)
void InitAddress(const ScAddress &rAdr)
InitAddress: InitFlags and set address.
void SetAbsRow(SCROW nVal)
void SetFlag3D(bool bVal)
void InitFlags()
No default ctor, because used in ScRawToken union, set InitFlags!
SvtScriptType mnScriptType
CellNoteStoreType::const_iterator miCellNotePos
CellTextAttrStoreType::const_iterator miCellTextAttrPos
CellStoreType::const_iterator miCellPos
Store position data for column array storage.
SparklineStoreType::iterator miSparklinePos
CellTextAttrStoreType::iterator miCellTextAttrPos
BroadcasterStoreType::iterator miBroadcasterPos
CellStoreType::iterator miCellPos
CellNoteStoreType::iterator miCellNotePos
::boost::intrusive_ptr< ScFormulaCellGroup > ScFormulaCellGroupRef
NF_EVALDATEFORMAT_INTL_FORMAT
NF_EVALDATEFORMAT_FORMAT_INTL
#define SV_COUNTRY_LANGUAGE_OFFSET