11 #include <document.hxx>
17 #include <tokenarray.hxx>
19 #include <compiler.hxx>
36 bool mbLatinNumFmtOnly;
38 ColAttr() : mbLatinNumFmtOnly(false) {}
43 std::vector<ColAttr> maCols;
71 if (nTab >= maTabAttrs.size())
72 maTabAttrs.resize(nTab+1);
74 TabAttr& rTab = maTabAttrs[nTab];
75 if (nCol >= rTab.maCols.size())
76 rTab.maCols.resize(nCol+1);
78 return &rTab.maCols[nCol];
88 for (
SCTAB i = maBlockPosSet.size();
i <= nTab; ++
i)
89 maBlockPosSet.emplace_back(mrDoc,
i);
99 for (
size_t i = maBlockPosSet.size();
i < n; ++
i)
100 maBlockPosSet.emplace_back(mrDoc,
i);
102 if (maTabAttrs.size() < n)
103 maTabAttrs.resize(n);
134 mpImpl->mnDefaultScriptNumeric = nScript;
149 if (!
mpImpl->mrDoc.GetTable(rName, nTab))
157 return mpImpl->mrDoc.maTabs.size();
172 mpImpl->mrDoc.SetTabNameOnLoad(nTab, rName);
177 if (!
mpImpl->mrDoc.pDocOptions)
180 mpImpl->mrDoc.pDocOptions->SetDate(nDay, nMonth, nYear);
199 pTab->
aCol[rPos.
Col()].ParseString(
200 aCell, rPos.
Row(), rPos.
Tab(), rStr,
mpImpl->mrDoc.GetAddressConvention(), pStringParam);
274 pEditText->NormalizeString(
mpImpl->mrDoc.GetSharedStringPool());
281 const double* pResult )
292 std::unique_ptr<ScFormulaCell> pFC =
293 std::make_unique<ScFormulaCell>(
mpImpl->mrDoc, rPos, rFormula, eGrammar);
295 mpImpl->mrDoc.CheckLinkFormulaNeedingCheck( *pFC->GetCode());
300 pFC->SetResultDouble(*pResult);
305 rCells.set(pBlockPos->
miCellPos, rPos.
Row(), pFC.release());
310 const OUString& rResult )
321 std::unique_ptr<ScFormulaCell> pFC =
322 std::make_unique<ScFormulaCell>(
mpImpl->mrDoc, rPos, rFormula, eGrammar);
324 mpImpl->mrDoc.CheckLinkFormulaNeedingCheck( *pFC->GetCode());
327 pFC->SetHybridString(
mpImpl->mrDoc.GetSharedStringPool().intern(rResult));
331 rCells.set(pBlockPos->
miCellPos, rPos.
Row(), pFC.release());
345 std::unique_ptr<ScFormulaCell> pFC =
346 std::make_unique<ScFormulaCell>(
mpImpl->mrDoc, rPos, std::move(pArray));
348 mpImpl->mrDoc.CheckLinkFormulaNeedingCheck( *pFC->GetCode());
352 rCells.set(pBlockPos->
miCellPos, rPos.
Row(), pFC.release());
367 mpImpl->mrDoc.CheckLinkFormulaNeedingCheck( *pCell->
GetCode());
396 mpImpl->mrDoc.CheckLinkFormulaNeedingCheck( *pCell->
GetCode());
399 rCells.set(pBlockPos->
miCellPos, rBasePos.
Row(), pCell);
424 std::unique_ptr<ScTokenArray> pTokArr(aArr.
Clone());
432 pBlockPos =
mpImpl->getBlockPosition(rBasePos.
Tab(), nCol);
444 std::unique_ptr<ScTokenArray> pTokArr(aArr.
Clone());
466 OUStringBuffer aFormulaBuf;
467 aFormulaBuf.append(
'=');
476 aFormulaBuf.append(aSep);
478 aFormulaBuf.append(aSep);
479 aRef.
Set(nCol1, nRow1, nTab,
false,
true,
true);
489 aFormulaBuf.append(aSep);
491 aFormulaBuf.append(aSep);
492 aRef.
Set(nCol1, nRow1, nTab,
true,
false,
true);
501 aFormulaBuf.append(aSep);
503 aFormulaBuf.append(aSep);
504 aRef.
Set(nCol1, nRow1 + 1, nTab,
false,
true,
true);
506 aFormulaBuf.append(aSep);
508 aFormulaBuf.append(aSep);
509 aRef.
Set(nCol1 + 1, nRow1, nTab,
true,
false,
true);
518 rDoc,
ScAddress(nCol1, nRow1, nTab), aFormulaBuf.makeStringAndClear(),
521 for (
SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
531 for (
SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
536 rColCells.set(pBlockPos->
miCellPos, nRow, pCell);
559 std::vector<double> aCopied(nFillSize, aRefCell.
mfValue);
561 pBlockPos->
miCellPos, rPos.
Row()+1, aCopied.begin(), aCopied.end());
566 std::vector<svl::SharedString> aCopied(nFillSize, *aRefCell.
mpString);
568 pBlockPos->
miCellPos, rPos.
Row()+1, aCopied.begin(), aCopied.end());
586 ColAttr* pColAttr =
mpImpl->getColAttr(nTab, nCol);
588 pColAttr->mbLatinNumFmtOnly = rAttrs.mbLatinNumFmtOnly;
590 pCol->
pAttrArray->SetAttrEntries(std::move(rAttrs.mvData));
618 class CellStoreInitializer
634 sc::CellTextAttrStoreType::iterator miPos;
638 : maAttrs(rSheetLimits.GetMaxRowCount()), miPos(maAttrs.
begin()), mnScriptNumeric(nScriptNumeric)
651 mpImpl(
std::
make_shared<Impl>(rDocImpl.mrDoc.GetSheetLimits(), mrDocImpl.mnDefaultScriptNumeric))
654 std::shared_ptr<Impl> mpImpl;
656 void operator() (
const sc::CellStoreType::value_type& node)
668 const ColAttr*
p = mrDocImpl.
getColAttr(mnTab, mnCol);
669 if (p && p->mbLatinNumFmtOnly)
675 const ColAttr* p = mrDocImpl.
getColAttr(mnTab, mnCol);
676 if (p && p->mbLatinNumFmtOnly)
682 bool bNumResOnly =
true;
683 for (; pp != ppEnd; ++pp)
702 std::vector<sc::CellTextAttr> aDefaults(node.size, aDefault);
703 mpImpl->miPos = mpImpl->maAttrs.set(mpImpl->miPos, node.position, aDefaults.begin(), aDefaults.end());
711 for (; pp != ppEnd; ++pp)
727 mpImpl->maAttrs.swap(rAttrs);
737 for (
auto& rxTab : mpImpl->mrDoc.maTabs)
744 for (
SCCOL nColIdx = 0; nColIdx < nNumCols; ++nColIdx)
748 mpImpl->mrDoc.finalizeOutlineImport();
755 CellStoreInitializer aFunc(*mpImpl, rCol.
nTab, rCol.
nCol);
764 class CellStoreAfterImportBroadcaster
768 CellStoreAfterImportBroadcaster() {}
770 void operator() (
const sc::CellStoreType::value_type& node)
777 for (; pp != ppEnd; ++pp)
779 if ((*pp)->GetCode()->IsRecalcModeMustAfterImport())
791 ScBulkBroadcast aBulkBroadcast( mpImpl->mrDoc.GetBASM(), SfxHintId::ScDataChanged);
793 for (
auto& rxTab : mpImpl->mrDoc.maTabs)
800 for (
SCCOL nColIdx = 0; nColIdx < nNumCols; ++nColIdx)
807 CellStoreAfterImportBroadcaster aFunc;
void Set(const ScAddress &rAdr, bool bNewRelCol, bool bNewRelRow, bool bNewRelTab)
void SetMergedCells(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
void CellStorageModified()
Called whenever the state of cell array gets modified i.e.
void UpdatePageBreaks(SCTAB nTab, const ScRange *pUserArea=nullptr)
Temporarily switch on/off auto calculation mode.
void setDefaultNumericScript(SvtScriptType nScript)
void ApplyStyleArea(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScStyleSheet &rStyle)
SC_DLLPUBLIC void ShowRows(SCROW nRow1, SCROW nRow2, SCTAB nTab, bool bShow)
void initForSheets()
Initialize the storage for all sheets after all the sheet instances have been created in the document...
ColumnBlockPosition * getBlockPosition(SCCOL nCol)
Store parameters used in the ScDocument::SetString() method.
std::unique_ptr< ScAttrArray > pAttrArray
ScDocumentImportImpl(ScDocument &rDoc)
Single reference (one address) into the sheet.
formula::FormulaToken * AddMatrixSingleReference(const ScSingleRefData &rRef)
ScSingleRefOpToken with ocMatRef.
bool mbCheckLinkFormula
When true and the string results in a compiled formula, check the formula tokens for presence of func...
ScColumn * FetchColumn(SCCOL nCol)
SC_DLLPUBLIC void SetDrawPageSize(SCTAB nTab)
sc::ColumnBlockPosition * getBlockPosition(SCTAB nTab, SCCOL nCol)
Store position data for column array storage.
This is very similar to ScCellValue, except that it references the original value instead of copying ...
std::shared_ptr< T > make_shared(Args &&...args)
void SetRowRel(bool bVal)
mdds::multi_type_vector< CellFunc, CellStoreEvent > CellStoreType
void setMergedCells(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
void setEditCell(const ScAddress &rPos, std::unique_ptr< EditTextObject > pEditText)
void broadcastRecalcAfterImport()
Broadcast all formula cells that are marked with FormulaTokenArray::IsRecalcModeMustAfterImport() for...
Store arbitrary cell value of any kind.
void setAttrEntries(SCTAB nTab, SCCOL nCol, Attrs &&rAttrs)
Set an array of cell attributes to specified column.
const mdds::mtv::element_t element_type_formula
std::vector< sc::TableColumnBlockPositionSet > maBlockPosSet
SCTAB getSheetIndex(const OUString &rName) const
enumrange< T >::Iterator begin(enumrange< T >)
ScFormulaCell * mpFormula
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
SC_DLLPUBLIC SCTAB GetTableCount() const
sc::CellStoreType maCells
void SetTabRel(bool bVal)
void setCellStyleToSheet(SCTAB nTab, const ScStyleSheet &rStyle)
Apply specified cell style to an entire sheet.
void setMatrixCells(const ScRange &rRange, const ScTokenArray &rArray, formula::FormulaGrammar::Grammar eGrammar)
void swap(cow_wrapper< T, P > &a, cow_wrapper< T, P > &b)
SC_DLLPUBLIC SCCOL MaxCol() const
Parameter for data table aka multiple operations.
Set of column block positions only for one table.
bool appendSheet(const OUString &rName)
void fillDownCells(const ScAddress &rPos, SCROW nFillSize)
const svl::SharedString * mpString
SCTAB getSheetCount() const
void RegroupFormulaCells(std::vector< ScAddress > *pGroupPos=nullptr)
Regroup formula cells for the entire column.
SvtScriptType mnScriptType
svl::SharedString * mpString
sc::CellTextAttrStoreType maCellTextAttrs
ScRefAddress aRefFormulaCell
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
const mdds::mtv::element_t element_type_empty
const mdds::mtv::element_t element_type_numeric
Mapped standard element types (for convenience).
std::vector< TabAttr > maTabAttrs
void setSheetName(SCTAB nTab, const OUString &rName)
void setTableOpCells(const ScRange &rRange, const ScTabOpParam &rParam)
void setAutoInput(const ScAddress &rPos, const OUString &rStr, const ScSetStringParam *pStringParam=nullptr)
CellStoreType::iterator miCellPos
void setFormulaCell(const ScAddress &rPos, const OUString &rFormula, formula::FormulaGrammar::Grammar eGrammar, const double *pResult=nullptr)
const ScAddress & GetAddress() const
static void broadcastRecalcAfterImportColumn(ScColumn &rCol)
ScDocumentImport()=delete
ColAttr * getColAttr(size_t nTab, size_t nCol)
void setRowsVisible(SCTAB nTab, SCROW nRowStart, SCROW nRowEnd, bool bVisible)
sc::StartListeningContext maListenCxt
void setStringCell(const ScAddress &rPos, const OUString &rStr)
void InitFlags()
No default ctor, because used in ScRawToken union, set InitFlags!
void setOriginDate(sal_uInt16 nYear, sal_uInt16 nMonth, sal_uInt16 nDay)
bool isValid(size_t nTab, size_t nCol)
void SetAddress(const ScSheetLimits &rLimits, const ScAddress &rAddr, const ScAddress &rPos)
EditTextObject * mpEditText
OUString GetRefString(const ScDocument &rDocument, SCTAB nActTab, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1) const
ScRefAddress aRefFormulaEnd
void setNumericCell(const ScAddress &rPos, double fVal)
void SetColRel(bool bVal)
mdds::multi_type_vector< CTAttrFunc > CellTextAttrStoreType
void initColumn(ScColumn &rCol)
bool ValidTab(SCTAB nTab)
std::unique_ptr< ScDocumentImportImpl > mpImpl
std::unique_ptr< ScTokenArray > Clone() const
SvtScriptType mnDefaultScriptNumeric