summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-03-29 01:14:51 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-03-30 23:17:31 +0200
commit99ecd8abe7e9a65e1d4af04ee160d3941aadebad (patch)
tree924864f27acd0bc08d3cb73ad3b2adfa822282c5 /sw
parent2326a22140f46c2b4cb2fbde72ac5444f478ee44 (diff)
simplify
Change-Id: I2bd8e4e121c9919b52b69a6672aaa7f061d986bb
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/unocore/unotbl.cxx34
1 files changed, 12 insertions, 22 deletions
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index d8a216a03572..6a431a3517b2 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -4338,33 +4338,23 @@ uno::Sequence< OUString > SwXCellRange::getColumnDescriptions(void)
///@see SwXTextTable::setColumnDescriptions (TODO: seems to be copy and paste programming here)
void SwXCellRange::setColumnDescriptions(const uno::Sequence< OUString >& ColumnDesc)
- throw( uno::RuntimeException, std::exception )
+ throw( uno::RuntimeException, std::exception )
{
SolarMutexGuard aGuard;
const sal_uInt16 nColCount = getColumnCount();
SwFrmFmt* pFmt = GetFrmFmt();
- if(pFmt)
+ if(!pFmt)
+ return;
+ const OUString* pArray = ColumnDesc.getConstArray();
+ if(bFirstColumnAsLabel || ColumnDesc.getLength() < nColCount)
+ throw uno::RuntimeException("Illegal arguments", static_cast<cppu::OWeakObject*>(this));
+ for(sal_uInt16 i = 0; i < nColCount; i++)
{
- const OUString* pArray = ColumnDesc.getConstArray();
- if(bFirstRowAsLabel && ColumnDesc.getLength() >= nColCount - (bFirstColumnAsLabel ? 1 : 0))
- {
- const sal_uInt16 nStart = bFirstColumnAsLabel ? 1 : 0;
- for(sal_uInt16 i = nStart; i < nColCount; i++)
- {
- uno::Reference< table::XCell > xCell = getCellByPosition(i, 0);
- 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<table::XCell> xCell = getCellByPosition(i, 0);
+ if(!xCell.is())
+ throw uno::RuntimeException();
+ uno::Reference<text::XText> xText(xCell, uno::UNO_QUERY);
+ xText->setString(pArray[i]);
}
}