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

refactor out getCells() in for chart seqs too

Change-Id: I1d18f1b7bdda8d95c2d2dd4256ca05aa0c60d5f4
üst 9ee481cc
......@@ -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
......
......@@ -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(),
......
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