summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-06-28 09:32:05 +0200
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-06-30 10:40:00 +0200
commit0685f902927a263fb724e47731654169dc87a3a6 (patch)
tree0221d8085a418e851610e749086aaf466f1bf478
parent9437369a4b08bdb8fd2aed514606ccc3a73c7dae (diff)
remove one client of getDataSequence
Change-Id: Iec8c3653497e213c085242085737dcc5985d70b3
-rw-r--r--sw/source/core/unocore/unochart.cxx35
-rw-r--r--sw/source/core/unocore/unotbl.cxx15
2 files changed, 22 insertions, 28 deletions
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index afa0dda62d4f..92456895ab72 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -23,6 +23,7 @@
#include <com/sun/star/chart2/data/LabelOrigin.hpp>
#include <cppuhelper/interfacecontainer.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <comphelper/sequence.hxx>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <svl/zforlist.hxx>
@@ -2015,22 +2016,26 @@ uno::Sequence< uno::Any > SAL_CALL SwChartDataSequence::getData()
if (bDisposed)
throw lang::DisposedException();
- uno::Sequence< uno::Any > aRes;
SwFrameFormat* pTableFormat = GetFrameFormat();
- if(pTableFormat)
- {
- SwTable* pTable = SwTable::FindTable( pTableFormat );
- if(!pTable->IsTableComplex())
- {
- SwRangeDescriptor aDesc;
- if (FillRangeDescriptor( aDesc, GetCellRangeName( *pTableFormat, *pTableCrsr ) ))
- {
- SwXCellRange aRange(pTableCrsr, *pTableFormat, aDesc );
- aRange.GetDataSequence( &aRes, 0, 0 );
- }
- }
- }
- return aRes;
+ if(!pTableFormat)
+ return {};
+ SwTable* pTable = SwTable::FindTable(pTableFormat);
+ if(pTable->IsTableComplex())
+ return {};
+ SwRangeDescriptor aDesc;
+ if(!FillRangeDescriptor(aDesc, GetCellRangeName(*pTableFormat,*pTableCrsr)))
+ return {};
+ auto vData(SwXCellRange(pTableCrsr, *pTableFormat, aDesc).getDataArray());
+ if(!vData.getLength())
+ return {};
+ std::vector< uno::Any > vResult;
+ vResult.reserve(vData.getLength()*vData[0].getLength());
+ for(auto& rRow : vData)
+ std::copy(
+ rRow.begin(),
+ rRow.end(),
+ std::back_inserter(vResult));
+ return comphelper::containerToSequence(vResult);
}
OUString SAL_CALL SwChartDataSequence::getSourceRangeRepresentation( )
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 4c5436ec5fd5..f178a59a41c3 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -3484,13 +3484,11 @@ void SwXCellRange::GetDataSequence(
}
const size_t nSize = static_cast<size_t>(nRowCount) * static_cast<size_t>(nColCount);
- uno::Any* pAnyData(nullptr);
OUString* pTextData(nullptr);
double* pDblData(nullptr);
if (pAnySeq)
{
- pAnySeq->realloc(nSize);
- pAnyData = pAnySeq->getArray();
+ assert(false);
}
else if (pTextSeq)
{
@@ -3529,16 +3527,7 @@ void SwXCellRange::GetDataSequence(
SwTableBox * pBox = pXCell ? pXCell->GetTableBox() : 0;
if(!pBox)
throw uno::RuntimeException();
- if (pAnyData)
- {
- // check if table box value item is set
- bool bIsNum = pBox->GetFrameFormat()->GetItemState( RES_BOXATR_VALUE, false ) == SfxItemState::SET;
- if (!bIsNum)
- pAnyData[nDtaCnt++] <<= lcl_getString(*pXCell);
- else
- pAnyData[nDtaCnt++] <<= sw_getValue(*pXCell);
- }
- else if (pTextData)
+ if (pTextData)
pTextData[nDtaCnt++] = lcl_getString(*pXCell);
else
{