24#include <document.hxx>
56 aPositioner(rDoc, rRangeList) {}
61 size_t nCount = aRangeListRef->size();
66 const ScRange & rR = aRangeListRef->front();
78double getCellValue(
ScDocument& rDoc,
const ScAddress& rPos,
double fDefault,
bool bCalcAsShown )
80 double fRet = fDefault;
83 switch (aCell.getType())
87 fRet = aCell.getValue();
88 if (bCalcAsShown && fRet != 0.0)
127 aRangeListRef->front().GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
129 SCCOL nStrCol = nCol1;
130 SCROW nStrRow = nRow1;
140 nRow1 = nLastRow + 1;
143 if ( nCol1 <= nCol2 )
146 nCol1 = sal::static_int_cast<SCCOL>( nCol1 + nColAdd );
148 if ( nRow1 <= nRow2 )
151 nRow1 = sal::static_int_cast<SCROW>( nRow1 + nRowAdd );
154 SCSIZE nTotalCols = ( nCol1 <= nCol2 ? nCol2 - nCol1 + 1 : 0 );
156 aCols.reserve(nTotalCols);
159 SCCOL nThisCol = sal::static_int_cast<SCCOL>(nCol1+
i);
161 aCols.push_back(nThisCol);
163 SCSIZE nColCount = aCols.size();
165 SCSIZE nTotalRows = ( nRow1 <= nRow2 ? nRow2 - nRow1 + 1 : 0 );
167 aRows.reserve(nTotalRows);
171 SCROW nThisRow = nRow1;
172 while (nThisRow <= nRow2)
177 aRows.push_back(nThisRow);
181 SCSIZE nRowCount = aRows.size();
184 if (nColCount > SHRT_MAX || nRowCount > SHRT_MAX)
190 bool bValidData =
true;
195 aCols.push_back(nStrCol);
201 aRows.push_back(nStrRow);
205 std::unique_ptr<ScMemChart> pMemChart(
new ScMemChart( nColCount, nRowCount ));
210 for (nCol=0; nCol<nColCount; nCol++)
212 for (nRow=0; nRow<nRowCount; nRow++)
215 ScAddress aPos(aCols[nCol], aRows[nRow], nTab1);
216 double nVal = getCellValue(
rDocument, aPos, DBL_MIN, bCalcAsShown);
217 pMemChart->SetData(nCol, nRow, nVal);
224 for (nCol=0; nCol<nColCount; nCol++)
225 for (nRow=0; nRow<nRowCount; nRow++)
226 pMemChart->SetData( nCol, nRow, DBL_MIN );
231 for (nCol=0; nCol<nColCount; nCol++)
236 if (aString.isEmpty())
239 aString =
ScResId(STR_COLUMN) +
" " +
242 pMemChart->SetColText( nCol, aString);
247 for (nRow=0; nRow<nRowCount; nRow++)
254 if (aString.isEmpty())
256 aString =
ScResId(STR_ROW) +
" " +
257 OUString::number(
static_cast<sal_Int32
>(aRows[nRow]+1));
259 pMemChart->SetRowText( nRow, aString);
271 if (nColCount > SHRT_MAX || nRowCount > SHRT_MAX)
277 bool bValidData =
true;
290 std::unique_ptr<ScMemChart> pMemChart(
new ScMemChart( nColCount, nRowCount ));
298 for ( nCol = 0; nCol < nColCount; nCol++ )
300 for ( nRow = 0; nRow < nRowCount; nRow++,
nIndex++ )
302 double nVal = DBL_MIN;
306 nVal = getCellValue(
rDocument, *pPos, DBL_MIN, bCalcAsShown);
308 pMemChart->SetData(nCol, nRow, nVal);
314 for ( nRow = 0; nRow < nRowCount; nRow++,
nIndex++ )
316 double nVal = DBL_MIN;
320 nVal = getCellValue(
rDocument, *pPos, DBL_MIN, bCalcAsShown);
322 pMemChart->SetData(nCol, nRow, nVal);
331 for ( nCol = 0; nCol < nColCount; nCol++ )
338 if (aString.isEmpty())
341 nPosCol = pPos->
Col() + 1;
347 pMemChart->SetColText( nCol, aString);
353 for ( nRow = 0; nRow < nRowCount; nRow++ )
360 if (aString.isEmpty())
363 nPosRow = pPos->
Row() + 1;
366 aString =
ScResId(STR_ROW) +
" " + OUString::number(
static_cast<sal_Int32
>(nPosRow));
368 pMemChart->SetRowText( nRow, 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 ...
SC_DLLPUBLIC void Format(OStringBuffer &r, ScRefFlags nFlags, const ScDocument *pDocument=nullptr, const Details &rDetails=detailsOOOa1) const
const ScRangeListRef & GetRangeList() const
const ScChartPositionMap * GetPositionMap()
ScChartArray(ScDocument &rDoc, const ScRangeListRef &rRangeList)
bool HasRowHeaders() const
bool HasColHeaders() const
std::unique_ptr< ScMemChart > CreateMemChartMulti()
std::unique_ptr< ScMemChart > CreateMemChartSingle()
std::unique_ptr< ScMemChart > CreateMemChart()
const ScAddress * GetRowHeaderPosition(SCROW nChartRow) const
const ScAddress * GetColHeaderPosition(SCCOL nChartCol) const
const ScAddress * GetPosition(sal_uInt64 nIndex) const
SCROW GetRowCount() const
SCCOL GetColCount() const
deletes all ScAddress*
bool IsCalcAsShown() const
SC_DLLPUBLIC sal_uInt32 GetNumberFormat(SCCOL nCol, SCROW nRow, SCTAB nTab) const
SC_DLLPUBLIC double RoundValueAsShown(double fVal, sal_uInt32 nFormat, const ScInterpreterContext *pContext=nullptr) const
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
SC_DLLPUBLIC OUString GetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScInterpreterContext *pContext=nullptr) const
SC_DLLPUBLIC const ScDocOptions & GetDocOptions() const
std::unique_ptr< double[]> pData
ScMemChart(const ScMemChart &rMemChart)=delete
std::unique_ptr< OUString[]> pColText
std::unique_ptr< OUString[]> pRowText
OUString ScResId(TranslateId aId)
This is very similar to ScCellValue, except that it references the original value instead of copying ...