diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-03-30 14:51:37 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-03-30 23:20:13 +0200 |
commit | 8f4b3fd788ff6d91b31d6950f2382c3d45a40702 (patch) | |
tree | 1439a425ee9af84dded1fc5a73926c7a78d024b1 | |
parent | f4b01361213ef62eff7fe718e4e4afc25becb54b (diff) |
make SwXTextTable::getRowDescriptions reuse SwXCellRange
Change-Id: Ia8194ed8945e7b3ef0eb187545047fa949c4434b
-rw-r--r-- | sw/source/core/unocore/unotbl.cxx | 42 |
1 files changed, 5 insertions, 37 deletions
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 895c0bd66bb4..e438ace785e0 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -2530,45 +2530,13 @@ void SwXTextTable::setData(const uno::Sequence< uno::Sequence< double > >& rData } } -uno::Sequence< OUString > SwXTextTable::getRowDescriptions(void) throw( uno::RuntimeException, std::exception ) +uno::Sequence<OUString> SwXTextTable::getRowDescriptions(void) + throw(uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - const sal_uInt16 nRowCount = getRowCount(); - if(!nRowCount) - { - uno::RuntimeException aRuntime; - aRuntime.Message = "Table too complex"; - throw aRuntime; - } - uno::Sequence< OUString > aRet(m_bFirstColumnAsLabel ? nRowCount - 1 : nRowCount); - - SwFrmFmt* pFmt = GetFrmFmt(); - if(pFmt) - { - OUString* pArray = aRet.getArray(); - if(m_bFirstColumnAsLabel) - { - const sal_uInt16 nStart = m_bFirstRowAsLabel ? 1 : 0; - for(sal_uInt16 i = nStart; i < nRowCount; i++) - { - uno::Reference< table::XCell > xCell = getCellByPosition(0, i); - if(!xCell.is()) - { - //exception ... - break; - } - 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; + uno::Reference<chart::XChartDataArray> xAllRange(getCellRangeByPosition(0, 0, getColumnCount()-1, getRowCount()-1), uno::UNO_QUERY); + static_cast<SwXCellRange*>(xAllRange.get())->SetLabels(m_bFirstRowAsLabel, m_bFirstColumnAsLabel); + return xAllRange->getRowDescriptions(); } void SwXTextTable::setRowDescriptions(const uno::Sequence< OUString >& rRowDesc) throw( uno::RuntimeException, std::exception ) |