diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/unocore/unotbl.cxx | 66 |
1 files changed, 3 insertions, 63 deletions
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 6a043798481e..a1ef18e17a87 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -2401,72 +2401,12 @@ uno::Sequence< uno::Sequence< uno::Any > > SAL_CALL SwXTextTable::getDataArray() return xAllRange->getDataArray(); } -void SAL_CALL SwXTextTable::setDataArray( - const uno::Sequence< uno::Sequence< uno::Any > >& rArray ) +void SAL_CALL SwXTextTable::setDataArray(const uno::Sequence< uno::Sequence< uno::Any > >& rArray) throw (uno::RuntimeException, std::exception) { - // see SwXTextTable::setData(...) also - SolarMutexGuard aGuard; - const sal_uInt16 nRowCount = getRowCount(); - const sal_uInt16 nColCount = getColumnCount(); - - SwFrmFmt* pFmt = GetFrmFmt(); - if(pFmt) - { - SwTable* pTable = SwTable::FindTable( pFmt ); - if(pTable->IsTblComplex()) - { - uno::RuntimeException aRuntime; - aRuntime.Message = "Table too complex"; - throw aRuntime; - } - - if(rArray.getLength() != nRowCount) - { - throw uno::RuntimeException(); - } - const uno::Sequence< uno::Any >* pRowArray = rArray.getConstArray(); - for(sal_uInt16 nRow = 0; nRow < nRowCount; nRow++) - { - const uno::Sequence< uno::Any >& rColSeq = pRowArray[nRow]; - if(rColSeq.getLength() != nColCount) - { - throw uno::RuntimeException(); - } - const uno::Any * pColArray = rColSeq.getConstArray(); - uno::Reference< table::XCell > xCellRef; - for(sal_uInt16 nCol = 0; nCol < nColCount; nCol++) - { - SwXCell* pXCell = lcl_CreateXCell(pFmt, nCol, nRow); - //! keep (additional) reference to object to prevent implicit destruction - //! in following UNO calls (when object will get referenced) - xCellRef = pXCell; - SwTableBox * pBox = pXCell ? pXCell->GetTblBox() : 0; - if(!pBox) - { - throw uno::RuntimeException(); - } - else - { - const uno::Any &rAny = pColArray[nCol]; - if (uno::TypeClass_STRING == rAny.getValueTypeClass()) - sw_setString( *pXCell, *static_cast<OUString const *>(rAny.getValue()) ); - else - { - double d = 0; - // #i20067# don't throw exception just do nothing if - // there is no value set - if( (rAny >>= d) ) - sw_setValue( *pXCell, d ); - else - sw_setString( *pXCell, OUString(), true ); - - } - } - } - } - } + uno::Reference<sheet::XCellRangeData> xAllRange(getCellRangeByPosition(0, 0, getColumnCount()-1, getRowCount()-1), uno::UNO_QUERY); + return xAllRange->setDataArray(rArray); } uno::Sequence< uno::Sequence< double > > SwXTextTable::getData(void) |