summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-03-30 17:52:39 +0200
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-03-30 23:20:23 +0200
commit84e71f3bad28f2003a0f654f0938d5bc7e309666 (patch)
tree63285e6c6c1e0147a0d83e0e2576301d441c22b2 /sw
parent7cb7ced25e656b1edcc4f8be5ee80bf45a2b3264 (diff)
use even more SwXCellRange impls from SwXTextTable
Change-Id: If1eede3bc1dc4effdb6a46ad2c0aeed2d6cd57a2
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/unocore/unotbl.cxx74
1 files changed, 10 insertions, 64 deletions
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index e98982ef8072..d98d86b021b6 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -2539,39 +2539,13 @@ uno::Sequence<OUString> SwXTextTable::getRowDescriptions(void)
return xAllRange->getRowDescriptions();
}
-void SwXTextTable::setRowDescriptions(const uno::Sequence< OUString >& rRowDesc) throw( uno::RuntimeException, std::exception )
+void SwXTextTable::setRowDescriptions(const uno::Sequence<OUString>& rRowDesc)
+ throw(uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- SwFrmFmt* pFmt = GetFrmFmt();
- if(pFmt)
- {
- const sal_uInt16 nRowCount = getRowCount();
- if(!nRowCount || rRowDesc.getLength() < (m_bFirstRowAsLabel ? nRowCount - 1 : nRowCount))
- {
- throw uno::RuntimeException();
- }
- const OUString* pArray = rRowDesc.getConstArray();
- 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())
- {
- 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?");
- }
- }
- else
- throw uno::RuntimeException();
+ 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);
+ xAllRange->setRowDescriptions(rRowDesc);
}
uno::Sequence<OUString> SwXTextTable::getColumnDescriptions(void)
@@ -2583,41 +2557,13 @@ uno::Sequence<OUString> SwXTextTable::getColumnDescriptions(void)
return xAllRange->getColumnDescriptions();
}
-void SwXTextTable::setColumnDescriptions(const uno::Sequence< OUString >& rColumnDesc) throw( uno::RuntimeException, std::exception )
+void SwXTextTable::setColumnDescriptions(const uno::Sequence<OUString>& rColumnDesc)
+ throw(uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- const sal_uInt16 nColCount = getColumnCount();
- if(!nColCount)
- {
- uno::RuntimeException aRuntime;
- aRuntime.Message = "Table too complex";
- throw aRuntime;
- }
- SwFrmFmt* pFmt = GetFrmFmt();
- if(pFmt)
- {
- const OUString* pArray = rColumnDesc.getConstArray();
- if(m_bFirstRowAsLabel && rColumnDesc.getLength() >= nColCount - (m_bFirstColumnAsLabel ? 1 : 0))
- {
- const sal_uInt16 nStart = m_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 do these labels come from?");
- }
- }
- else
- throw uno::RuntimeException();
+ 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->setColumnDescriptions(rColumnDesc);
}
void SAL_CALL SwXTextTable::addChartDataChangeEventListener(