21#include <document.hxx>
26#include <tokenarray.hxx>
27#include <osl/diagnose.h>
33#define SC_CONS_NOTFOUND -1
50static void lcl_AddString( ::std::vector<OUString>& rData, T& nCount,
const OUString& rInsert )
52 rData.push_back( rInsert);
80 ::std::vector<OUString>().swap(
maTitles);
166 SCCOL nStartCol = nCol1;
167 SCROW nStartRow = nRow1;
173 for (
SCCOL nCol=nStartCol; nCol<=nCol2; nCol++)
175 aTitle = pSrcDoc->
GetString(nCol, nRow1, nTab);
176 if (!aTitle.isEmpty())
191 for (
SCROW nRow=nStartRow; nRow<=nRow2; nRow++)
193 aTitle = pSrcDoc->
GetString(nCol1, nRow, nTab);
194 if (!aTitle.isEmpty())
215 size_t nTitleCount =
maTitles.size();
223 nMax = std::max( nMax,
ppRefs[nArrX][nArrY].
size() );
227 ppUsed[nArrX][nArrY] =
true;
246 OSL_FAIL(
"range too big");
247 nCol2 = sal::static_int_cast<SCCOL>( nCol1 +
nColCount - 1 );
251 OSL_FAIL(
"range too big");
252 nRow2 = sal::static_int_cast<SCROW>( nRow1 +
nRowCount - 1 );
262 OUString aThisCorner = pSrcDoc->
GetString(nCol1, nRow1, nTab);
277 SCCOL nStartCol = nCol1;
278 SCROW nStartRow = nRow1;
282 std::unique_ptr<SCCOL[]> pDestCols;
283 std::unique_ptr<SCROW[]> pDestRows;
286 pDestCols.reset(
new SCCOL[nCol2-nStartCol+1]);
287 for (nCol=nStartCol; nCol<=nCol2; nCol++)
289 aTitle = pSrcDoc->
GetString(nCol, nRow1, nTab);
291 if (!aTitle.isEmpty())
300 OSL_ENSURE(bFound,
"column not found");
302 pDestCols[nCol-nStartCol] =
nPos;
307 pDestRows.reset(
new SCROW[nRow2-nStartRow+1]);
308 for (nRow=nStartRow; nRow<=nRow2; nRow++)
310 aTitle = pSrcDoc->
GetString(nCol1, nRow, nTab);
312 if (!aTitle.isEmpty())
321 OSL_ENSURE(bFound,
"row not found");
323 pDestRows[nRow-nStartRow] =
nPos;
332 for (nCol=nCol1; nCol<=nCol2; nCol++)
334 SCCOL nArrX = nCol-nCol1;
338 for (nRow=nRow1; nRow<=nRow2; nRow++)
340 SCROW nArrY = nRow-nRow1;
343 bAnyCell ? pSrcDoc->
HasData( nCol, nRow, nTab )
348 ppUsed[nArrX][nArrY] =
true;
349 ppRefs[nArrX][nArrY].push_back( { nCol, nRow, nTab } );
353 double nVal = pSrcDoc->
GetValue( nCol, nRow, nTab );
354 if (!
ppUsed[nArrX][nArrY])
356 ppUsed[nArrX][nArrY] =
true;
380 nNeeded = std::max( nNeeded,
ppRefs[nArrX][nArrY].
size() );
405 SCCOL nStartCol = nCol;
406 SCROW nStartRow = nRow;
430 rDestDoc.
SetError( sal::static_int_cast<SCCOL>(nCol+nArrX),
431 sal::static_int_cast<SCROW>(nRow+nArrY), nTab, FormulaError::NoValue );
433 rDestDoc.
SetValue( sal::static_int_cast<SCCOL>(nCol+nArrX),
434 sal::static_int_cast<SCROW>(nRow+nArrY), nTab, fVal );
457 nNeeded = std::max( nNeeded,
ppRefs[nArrX][nArrY].
size() );
461 rDestDoc.
InsertRow( 0,nTab, rDestDoc.
MaxCol(),nTab, nRow+nArrY, nNeeded );
481 ScAddress aDest( sal::static_int_cast<SCCOL>(nCol+nArrX),
482 sal::static_int_cast<SCROW>(nRow+nArrY+
nPos), nTab );
490 ScAddress aDest( sal::static_int_cast<SCCOL>(nCol+nArrX),
491 sal::static_int_cast<SCROW>(nRow+nArrY+nNeeded), nTab );
493 ScRange aRange(sal::static_int_cast<SCCOL>(nCol+nArrX), nRow+nArrY, nTab);
498 aArr.AddOpCode(eOpCode);
500 aArr.AddDoubleReference(aCRef);
511 SCROW nOutStart = nRow+nArrY;
512 SCROW nOutEnd = nRow+nArrY+nNeeded-1;
514 rOutArr.
Insert( nOutStart, nOutEnd, bSize );
515 for (
SCROW nOutRow=nOutStart; nOutRow<=nOutEnd; nOutRow++)
516 rDestDoc.
ShowRow( nOutRow, nTab,
false );
531 if ( bDo && nTPos < nNeeded )
534 rDestDoc.
SetString( nCol-1, nRow+nArrY+nTPos, nTab, aString );
size_t SCSIZE
size_t typedef to be able to find places where code was changed from USHORT to size_t and is used to ...
void PutInOrder(T &nStart, T &nEnd)
std::unique_ptr< std::unique_ptr< ScReferenceList[]>[]> ppRefs
std::unique_ptr< std::unique_ptr< ScFunctionData[]>[]> ppFunctionData
SCROW GetInsertCount() const
void SetFlags(ScSubTotalFunc eFunc, bool bColName, bool bRowName, bool bRef)
std::unique_ptr< std::unique_ptr< SCSIZE[]>[]> ppTitlePos
std::unique_ptr< std::unique_ptr< bool[]>[]> ppUsed
void OutputToDocument(ScDocument &rDestDoc, SCCOL nCol, SCROW nRow, SCTAB nTab)
void AddName(const OUString &rName)
void GetSize(SCCOL &rCols, SCROW &rRows) const
void AddFields(const ScDocument *pSrcDoc, SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
::std::vector< OUString > maColHeaders
void SetSize(SCCOL nCols, SCROW nRows)
void AddData(ScDocument *pSrcDoc, SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
std::vector< ScReferenceEntry > ScReferenceList
::std::vector< OUString > maRowHeaders
::std::vector< OUString > maTitles
ScSheetLimits & GetSheetLimits() const
SC_DLLPUBLIC ScFormulaCell * SetFormulaCell(const ScAddress &rPos, ScFormulaCell *pCell)
Set formula cell, and transfer its ownership to the document.
SC_DLLPUBLIC SCCOL MaxCol() const
SC_DLLPUBLIC void ShowRow(SCROW nRow, SCTAB nTab, bool bShow)
SC_DLLPUBLIC double GetValue(const ScAddress &rPos) const
SC_DLLPUBLIC bool SetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString &rString, const ScSetStringParam *pParam=nullptr)
SC_DLLPUBLIC bool HasData(SCCOL nCol, SCROW nRow, SCTAB nTab)
bool UpdateOutlineRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bShow)
SC_DLLPUBLIC void SetDrawPageSize(SCTAB nTab)
void SetError(SCCOL nCol, SCROW nRow, SCTAB nTab, const FormulaError nError)
SC_DLLPUBLIC void SetValue(SCCOL nCol, SCROW nRow, SCTAB nTab, const double &rVal)
SC_DLLPUBLIC ScOutlineTable * GetOutlineTable(SCTAB nTab, bool bCreate=false)
SC_DLLPUBLIC bool HasValueData(SCCOL nCol, SCROW nRow, SCTAB nTab) const
SC_DLLPUBLIC OUString GetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScInterpreterContext *pContext=nullptr) const
bool InsertRow(SCCOL nStartCol, SCTAB nStartTab, SCCOL nEndCol, SCTAB nEndTab, SCROW nStartRow, SCSIZE nSize, ScDocument *pRefUndoDoc=nullptr, const ScMarkData *pTabMark=nullptr)
To calculate a single subtotal function.
bool Insert(SCCOLROW nStartPos, SCCOLROW nEndPos, bool &rSizeChanged, bool bHidden=false)
const ScOutlineArray & GetRowArray() const
virtual formula::FormulaToken * AddOpCode(OpCode eCode) override
formula::FormulaToken * AddSingleReference(const ScSingleRefData &rRef)
ScSingleRefToken with ocPush.
const OpCode eOpCodeTable[]
static void lcl_AddString(::std::vector< OUString > &rData, T &nCount, const OUString &rInsert)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
Complex reference (a range) into the sheet.
void SetRange(const ScSheetLimits &rLimits, const ScRange &rRange, const ScAddress &rPos)
Set a new range, assuming that the ordering of the range matches the ordering of the reference data f...
Single reference (one address) into the sheet.
void SetAddress(const ScSheetLimits &rLimits, const ScAddress &rAddr, const ScAddress &rPos)
void SetRowRel(bool bVal)
void SetTabRel(bool bVal)
void SetFlag3D(bool bVal)
void InitFlags()
No default ctor, because used in ScRawToken union, set InitFlags!
void SetColRel(bool bVal)