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

simplify

Change-Id: I2bd8e4e121c9919b52b69a6672aaa7f061d986bb
üst 2326a221
...@@ -4338,33 +4338,23 @@ uno::Sequence< OUString > SwXCellRange::getColumnDescriptions(void) ...@@ -4338,33 +4338,23 @@ uno::Sequence< OUString > SwXCellRange::getColumnDescriptions(void)
///@see SwXTextTable::setColumnDescriptions (TODO: seems to be copy and paste programming here) ///@see SwXTextTable::setColumnDescriptions (TODO: seems to be copy and paste programming here)
void SwXCellRange::setColumnDescriptions(const uno::Sequence< OUString >& ColumnDesc) void SwXCellRange::setColumnDescriptions(const uno::Sequence< OUString >& ColumnDesc)
throw( uno::RuntimeException, std::exception ) throw( uno::RuntimeException, std::exception )
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
const sal_uInt16 nColCount = getColumnCount(); const sal_uInt16 nColCount = getColumnCount();
SwFrmFmt* pFmt = GetFrmFmt(); 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(); uno::Reference<table::XCell> xCell = getCellByPosition(i, 0);
if(bFirstRowAsLabel && ColumnDesc.getLength() >= nColCount - (bFirstColumnAsLabel ? 1 : 0)) if(!xCell.is())
{ throw uno::RuntimeException();
const sal_uInt16 nStart = bFirstColumnAsLabel ? 1 : 0; uno::Reference<text::XText> xText(xCell, uno::UNO_QUERY);
for(sal_uInt16 i = nStart; i < nColCount; i++) xText->setString(pArray[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?");
}
} }
} }
......
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