diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-03-29 01:36:51 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-03-30 23:17:32 +0200 |
commit | cdd40eb7c0a65c313b1d5887517e128e46b23902 (patch) | |
tree | a9b8769208a1c089bfa550367b6fb7a3d42d283d /sw | |
parent | 2f241ed70c5065b526cac88a3400f9c47830f516 (diff) |
simplify
Change-Id: Ia3fad4e1272f72a09062cdb3d03cb391081e5dd5
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/unocore/unotbl.cxx | 40 |
1 files changed, 13 insertions, 27 deletions
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 40572a5e466b..eff935947916 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -4262,37 +4262,23 @@ uno::Sequence< OUString > SwXCellRange::getRowDescriptions(void) ///@see SwXTextTable::setRowDescriptions (TODO: seems to be copy and paste programming here) void SwXCellRange::setRowDescriptions(const uno::Sequence< OUString >& rRowDesc) - throw( uno::RuntimeException, std::exception ) + throw(uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - - SwFrmFmt* pFmt = GetFrmFmt(); - if(pFmt) + SwFrmFmt* pFmt(GetFrmFmt()); + if(!pFmt) + return; + const sal_uInt16 nRowCount = getRowCount(); + if(!nRowCount || bFirstRowAsLabel|| RowDesc.getLength() < nRowCount) + throw uno::RuntimeException("Illegal arguments", static_cast<cppu::OWeakObject*>(this)); + const OUString* pArray = rRowDesc.getConstArray(); + for(sal_uInt16 i = 0; i < nRowCount; i++) { - const sal_uInt16 nRowCount = getRowCount(); - if(!nRowCount || rRowDesc.getLength() < (bFirstRowAsLabel ? nRowCount - 1 : nRowCount)) - { + uno::Reference<table::XCell> xCell = getCellByPosition(0, i); + if(!xCell.is()) throw uno::RuntimeException(); - } - const OUString* pArray = rRowDesc.getConstArray(); - if(bFirstColumnAsLabel) - { - const sal_uInt16 nStart = bFirstRowAsLabel ? 1 : 0; - for(sal_uInt16 i = nStart; i < nRowCount; i++) - { - uno::Reference< table::XCell > xCell = getCellByPosition(0, i); - if(!xCell.is()) - { - throw uno::RuntimeException(); - } - uno::Reference< text::XText > xText(xCell, uno::UNO_QUERY); - xText->setString(pArray[i - nStart]); - } - } - else - { - OSL_FAIL("Where to put theses labels?"); - } + uno::Reference<text::XText> xText(xCell, uno::UNO_QUERY); + xText->setString(pArray[i]); } } |