From db123d181a48918dd85a90415d3557a78951c8bd Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Mon, 30 Mar 2015 18:07:01 +0200 Subject: lets get a XTest reference right away Change-Id: Ib805a20cd3f121ae1d021a28e3b9908afdad4ab4 --- sw/source/core/unocore/unotbl.cxx | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index d98d86b021b6..6a043798481e 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -4025,11 +4025,8 @@ uno::Sequence SwXCellRange::getRowDescriptions(void) const sal_uInt16 nStart = m_bFirstRowAsLabel ? 1 : 0; for(sal_uInt16 i = nStart; i < nRowCount; i++) { - auto xCell = getCellByPosition(0, i); - if(!xCell.is()) - throw uno::RuntimeException(); - uno::Reference xText(xCell, uno::UNO_QUERY); - pArray[i - nStart] = xText->getString(); + const uno::Reference xCell(getCellByPosition(0, i), uno::UNO_QUERY_THROW); + pArray[i - nStart] = xCell->getString(); } return aRet; } @@ -4048,16 +4045,12 @@ uno::Sequence SwXCellRange::getColumnDescriptions(void) const sal_uInt16 nStart = m_bFirstColumnAsLabel ? 1 : 0; for(sal_uInt16 i = nStart; i < nColumnCount; i++) { - auto xCell = getCellByPosition(i, 0); - if(!xCell.is()) - throw uno::RuntimeException(); - uno::Reference xText(xCell, uno::UNO_QUERY); - pArray[i - nStart] = xText->getString(); + const uno::Reference xCell(getCellByPosition(i, 0), uno::UNO_QUERY_THROW); + pArray[i - nStart] = xCell->getString(); } return aRet; } -///@see SwXTextTable::setRowDescriptions (TODO: seems to be copy and paste programming here) void SwXCellRange::setRowDescriptions(const uno::Sequence& rRowDesc) throw(uno::RuntimeException, std::exception) { @@ -4072,11 +4065,8 @@ void SwXCellRange::setRowDescriptions(const uno::Sequence& rRowDesc) throw uno::RuntimeException("Illegal arguments", static_cast(this)); for(sal_uInt16 i = nStart; i < nRowCount; i++) { - uno::Reference xCell = getCellByPosition(0, i); - if(!xCell.is()) - throw uno::RuntimeException(); - uno::Reference xText(xCell, uno::UNO_QUERY); - xText->setString(pArray[i-nStart]); + uno::Reference xCell(getCellByPosition(0, i), uno::UNO_QUERY_THROW); + xCell->setString(pArray[i-nStart]); } } void SwXCellRange::setColumnDescriptions(const uno::Sequence& rColumnDesc) @@ -4093,11 +4083,8 @@ void SwXCellRange::setColumnDescriptions(const uno::Sequence& rColumnD const OUString* pArray = rColumnDesc.getConstArray(); for(sal_uInt16 i = nStart; i < nColumnCount; i++) { - uno::Reference xCell = getCellByPosition(i, 0); - if(!xCell.is()) - throw uno::RuntimeException(); - uno::Reference xText(xCell, uno::UNO_QUERY); - xText->setString(pArray[i-nStart]); + uno::Reference xCell(getCellByPosition(i, 0), uno::UNO_QUERY_THROW); + xCell->setString(pArray[i-nStart]); } } -- cgit