summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-06-28 12:30:15 +0200
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-06-30 10:40:01 +0200
commita54845ee5d1f9258a422e378a39dac18cc975447 (patch)
tree50aa37b672f7215805af4b355771725c77542891
parent9ee481cce4f26cbde09efa46bc0b2c52e53eb2bf (diff)
refactor out getCells() in for chart seqs too
Change-Id: I1d18f1b7bdda8d95c2d2dd4256ca05aa0c60d5f4
-rw-r--r--sw/inc/unochart.hxx2
-rw-r--r--sw/source/core/unocore/unochart.cxx30
2 files changed, 14 insertions, 18 deletions
diff --git a/sw/inc/unochart.hxx b/sw/inc/unochart.hxx
index 4bfd2e04db81..580368a7a867 100644
--- a/sw/inc/unochart.hxx
+++ b/sw/inc/unochart.hxx
@@ -40,6 +40,7 @@
#include <com/sun/star/util/XModifyBroadcaster.hpp>
#include <com/sun/star/util/XModifyListener.hpp>
#include <com/sun/star/chart/ChartDataRowSource.hpp>
+#include <com/sun/star/table/XCell.hpp>
#include <cppuhelper/interfacecontainer.h>
#include <cppuhelper/implbase.hxx>
@@ -349,6 +350,7 @@ public:
void FillRangeDesc( SwRangeDescriptor &rRangeDesc ) const;
bool ExtendTo( bool bExtendCol, sal_Int32 nFirstNew, sal_Int32 nCount );
+ std::vector< css::uno::Reference< css::table::XCell > > getCells();
};
typedef cppu::WeakImplHelper
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index a68bc988a61e..11c32ac41026 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -2169,22 +2169,27 @@ uno::Sequence< OUString > SAL_CALL SwChartDataSequence::generateLabel(
return 0;
}
-uno::Sequence< OUString > SAL_CALL SwChartDataSequence::getTextualData()
- throw (uno::RuntimeException, std::exception)
+std::vector< css::uno::Reference< css::table::XCell > > SwChartDataSequence::getCells()
{
- SolarMutexGuard aGuard;
if (bDisposed)
throw lang::DisposedException();
- SwFrameFormat* pTableFormat = GetFrameFormat();
+ auto pTableFormat(GetFrameFormat());
if(!pTableFormat)
return {};
- SwTable* pTable = SwTable::FindTable(pTableFormat);
+ auto pTable(SwTable::FindTable(pTableFormat));
if(pTable->IsTableComplex())
return {};
SwRangeDescriptor aDesc;
if(!FillRangeDescriptor(aDesc, GetCellRangeName(*pTableFormat, *pTableCrsr)))
return {};
- auto vCells(SwXCellRange(pTableCrsr, *pTableFormat, aDesc).getCells());
+ return SwXCellRange(pTableCrsr, *pTableFormat, aDesc).getCells();
+}
+
+uno::Sequence< OUString > SAL_CALL SwChartDataSequence::getTextualData()
+ throw (uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+ auto vCells(getCells());
uno::Sequence< OUString > vTextData(vCells.size());
std::transform(vCells.begin(),
vCells.end(),
@@ -2198,18 +2203,7 @@ uno::Sequence< double > SAL_CALL SwChartDataSequence::getNumericalData()
throw (uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- if (bDisposed)
- throw lang::DisposedException();
- SwFrameFormat* pTableFormat = GetFrameFormat();
- if(!pTableFormat)
- return {};
- SwTable* pTable = SwTable::FindTable(pTableFormat);
- if(pTable->IsTableComplex())
- return {};
- SwRangeDescriptor aDesc;
- if(!FillRangeDescriptor(aDesc, GetCellRangeName(*pTableFormat,*pTableCrsr)))
- return {};
- auto vCells(SwXCellRange(pTableCrsr, *pTableFormat, aDesc).getCells());
+ auto vCells(getCells());
uno::Sequence< double > vNumData(vCells.size());
std::transform(vCells.begin(),
vCells.end(),