Kaydet (Commit) 56b5f7ff authored tarafından Bjoern Michaelsen's avatar Bjoern Michaelsen

simplify

Change-Id: I550ed187381fd92bf8a11775f8f2eda65b25d288
üst 26ae223d
...@@ -4220,43 +4220,27 @@ void SwXCellRange::setData(const uno::Sequence< uno::Sequence< double > >& rData ...@@ -4220,43 +4220,27 @@ void SwXCellRange::setData(const uno::Sequence< uno::Sequence< double > >& rData
} }
///@see SwXTextTable::getRowDescriptions (TODO: seems to be copy and paste programming here) ///@see SwXTextTable::getRowDescriptions (TODO: seems to be copy and paste programming here)
uno::Sequence< OUString > SwXCellRange::getRowDescriptions(void) uno::Sequence<OUString> SwXCellRange::getRowDescriptions(void)
throw( uno::RuntimeException, std::exception ) throw( uno::RuntimeException, std::exception )
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
const sal_uInt16 nRowCount = getRowCount(); const sal_uInt16 nRowCount = getRowCount();
if(!nRowCount) if(!nRowCount)
throw uno::RuntimeException("Table too complex", static_cast<cppu::OWeakObject*>(this));
uno::Sequence<OUString> aRet(bFirstColumnAsLabel ? nRowCount - 1 : nRowCount);
SwFrmFmt* pFmt(GetFrmFmt());
if(!pFmt || !bFirstColumnAsLabel)
throw uno::RuntimeException("Illegal arguments", static_cast<cppu::OWeakObject*>(this));
OUString* pArray = aRet.getArray();
const sal_uInt16 nStart = bFirstRowAsLabel ? 1 : 0;
for(sal_uInt16 i = nStart; i < nRowCount; i++)
{ {
uno::RuntimeException aRuntime; auto xCell = getCellByPosition(0, i);
aRuntime.Message = "Table too complex"; if(!xCell.is())
throw aRuntime; throw uno::RuntimeException();
} uno::Reference<text::XText> xText(xCell, uno::UNO_QUERY);
uno::Sequence< OUString > aRet(bFirstColumnAsLabel ? nRowCount - 1 : nRowCount); pArray[i - nStart] = xText->getString();
SwFrmFmt* pFmt = GetFrmFmt();
if(pFmt)
{
OUString* pArray = aRet.getArray();
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);
pArray[i - nStart] = xText->getString();
}
}
else
{
OSL_FAIL("Where do these labels come from?");
}
} }
else
throw uno::RuntimeException();
return aRet; return aRet;
} }
......
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