Kaydet (Commit) d7b6b1dc authored tarafından Bjoern Michaelsen's avatar Bjoern Michaelsen

use getCells() here

Change-Id: Iff3997af302a6ddbfd21fb25cd7f0b94a9a107fe
üst e5796e02
...@@ -3639,28 +3639,25 @@ uno::Sequence< uno::Sequence< uno::Any > > SAL_CALL SwXCellRange::getDataArray() ...@@ -3639,28 +3639,25 @@ uno::Sequence< uno::Sequence< uno::Any > > SAL_CALL SwXCellRange::getDataArray()
const sal_uInt16 nColCount = getColumnCount(); const sal_uInt16 nColCount = getColumnCount();
if(!nRowCount || !nColCount) if(!nRowCount || !nColCount)
throw uno::RuntimeException("Table too complex", static_cast<cppu::OWeakObject*>(this)); throw uno::RuntimeException("Table too complex", static_cast<cppu::OWeakObject*>(this));
SwFrmFmt* pFmt(GetFrmFmt()); lcl_EnsureCoreConnected(GetFrmFmt(), static_cast<cppu::OWeakObject*>(this));
uno::Sequence< uno::Sequence< uno::Any > > aRowSeq(nRowCount); uno::Sequence< uno::Sequence< uno::Any > > aRowSeq(nRowCount);
if(!pFmt) auto vCells(getCells());
throw uno::RuntimeException(); auto pCurrentCell(vCells.begin());
sal_uInt16 nRow = 0;
for(auto& rRow : aRowSeq) for(auto& rRow : aRowSeq)
{ {
rRow = uno::Sequence< uno::Any >(nColCount); rRow = uno::Sequence< uno::Any >(nColCount);
sal_uInt16 nCol = 0;
for(auto& rCellAny : rRow) for(auto& rCellAny : rRow)
{ {
SwXCell* pXCell(lcl_CreateXCell(pFmt, nCol++, nRow)); auto pCell(static_cast<SwXCell*>(pCurrentCell->get()));
uno::Reference<table::XCell> xCell = pXCell; // to prevent distruction in UNO calls SwTableBox* pBox = pCell ? pCell->GetTblBox() : nullptr;
SwTableBox* pBox = pXCell ? pXCell->GetTblBox() : nullptr;
if(!pBox) if(!pBox)
throw uno::RuntimeException(); throw uno::RuntimeException();
// check if table box value item is set // check if table box value item is set
SwFrmFmt* pBoxFmt(pBox->GetFrmFmt()); SwFrmFmt* pBoxFmt(pBox->GetFrmFmt());
const bool bIsNum = pBoxFmt->GetItemState(RES_BOXATR_VALUE, false) == SfxItemState::SET; const bool bIsNum = pBoxFmt->GetItemState(RES_BOXATR_VALUE, false) == SfxItemState::SET;
rCellAny = bIsNum ? uno::makeAny(sw_getValue(*pXCell)) : uno::makeAny(lcl_getString(*pXCell)); rCellAny = bIsNum ? uno::makeAny(sw_getValue(*pCell)) : uno::makeAny(lcl_getString(*pCell));
++pCurrentCell;
} }
++nRow;
} }
return aRowSeq; return aRowSeq;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment