24 #include <document.hxx>
25 #include <globstr.hrc>
46 pRowText.reset(
new OUString[nRowCnt] );
56 aPositioner(rDoc, rRangeList) {}
64 else if ( nCount == 1 )
78 double getCellValue(
ScDocument& rDoc,
const ScAddress& rPos,
double fDefault,
bool bCalcAsShown )
80 double fRet = fDefault;
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);
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 aBuf.append(
ScResId(STR_COLUMN));
245 aString = aBuf.makeStringAndClear();
247 pMemChart->SetColText( nCol, aString);
252 for (nRow=0; nRow<nRowCount; nRow++)
259 if (aString.isEmpty())
264 aBuf.append(static_cast<sal_Int32>(aRows[nRow]+1));
265 aString = aBuf.makeStringAndClear();
267 pMemChart->SetRowText( nRow, aString);
279 if (nColCount > SHRT_MAX || nRowCount > SHRT_MAX)
285 bool bValidData =
true;
298 std::unique_ptr<ScMemChart> pMemChart(
new ScMemChart( nColCount, nRowCount ));
306 for ( nCol = 0; nCol < nColCount; nCol++ )
308 for ( nRow = 0; nRow < nRowCount; nRow++, nIndex++ )
310 double nVal = DBL_MIN;
314 nVal = getCellValue(
rDocument, *pPos, DBL_MIN, bCalcAsShown);
316 pMemChart->SetData(nCol, nRow, nVal);
322 for ( nRow = 0; nRow < nRowCount; nRow++, nIndex++ )
324 double nVal = DBL_MIN;
328 nVal = getCellValue(
rDocument, *pPos, DBL_MIN, bCalcAsShown);
330 pMemChart->SetData(nCol, nRow, nVal);
339 for ( nCol = 0; nCol < nColCount; nCol++ )
346 if (aString.isEmpty())
351 nPosCol = pPos->
Col() + 1;
356 aString = aBuf.makeStringAndClear();
358 pMemChart->SetColText( nCol, aString);
364 for ( nRow = 0; nRow < nRowCount; nRow++ )
371 if (aString.isEmpty())
374 nPosRow = pPos->
Row() + 1;
377 aString =
ScResId(STR_ROW) +
" " + OUString::number(static_cast<sal_Int32>(nPosRow));
379 pMemChart->SetRowText( nRow, aString);
const ScAddress * GetRowHeaderPosition(SCROW nChartRow) const
SC_DLLPUBLIC void Format(OStringBuffer &r, ScRefFlags nFlags, const ScDocument *pDocument=nullptr, const Details &rDetails=detailsOOOa1) const
const ScAddress * GetPosition(sal_uLong nIndex) const
SC_DLLPUBLIC void GetNumberFormat(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt32 &rFormat) const
SCCOL GetColCount() const
deletes all ScAddress*
This is very similar to ScCellValue, except that it references the original value instead of copying ...
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 ...
std::unique_ptr< ScMemChart > CreateMemChartSingle()
SC_DLLPUBLIC OUString GetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScInterpreterContext *pContext=nullptr) const
std::unique_ptr< double[]> pData
SC_DLLPUBLIC const ScDocOptions & GetDocOptions() const
bool HasRowHeaders() const
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
std::unique_ptr< OUString[]> pRowText
ScMemChart(const ScMemChart &rMemChart)=delete
const ScAddress * GetColHeaderPosition(SCCOL nChartCol) const
OUString ScResId(const char *pId)
ScChartArray(ScDocument &rDoc, const ScRangeListRef &rRangeList)
SCROW GetRowCount() const
void GetVars(SCCOL &nCol1, SCROW &nRow1, SCTAB &nTab1, SCCOL &nCol2, SCROW &nRow2, SCTAB &nTab2) const
SC_DLLPUBLIC double RoundValueAsShown(double fVal, sal_uInt32 nFormat, const ScInterpreterContext *pContext=nullptr) const
const ScChartPositionMap * GetPositionMap()
std::unique_ptr< ScMemChart > CreateMemChart()
bool IsCalcAsShown() const
std::unique_ptr< OUString[]> pColText
bool HasColHeaders() const
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
const ScRangeListRef & GetRangeList() const
std::unique_ptr< ScMemChart > CreateMemChartMulti()