diff options
-rw-r--r-- | sw/source/core/unocore/unochart.cxx | 32 | ||||
-rw-r--r-- | sw/source/core/unocore/unotbl.cxx | 10 |
2 files changed, 18 insertions, 24 deletions
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index 9f5472a5e109..a68bc988a61e 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -2175,23 +2175,23 @@ uno::Sequence< OUString > SAL_CALL SwChartDataSequence::getTextualData() SolarMutexGuard aGuard; if (bDisposed) throw lang::DisposedException(); - - uno::Sequence< OUString > 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( 0, &aRes, 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 vCells(SwXCellRange(pTableCrsr, *pTableFormat, aDesc).getCells()); + uno::Sequence< OUString > vTextData(vCells.size()); + std::transform(vCells.begin(), + vCells.end(), + vTextData.begin(), + [] (decltype(vCells)::value_type& xCell) + { return static_cast<SwXCell*>(xCell.get())->getString(); }); + return vTextData; } uno::Sequence< double > SAL_CALL SwChartDataSequence::getNumericalData() diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 32cfa1dcc61e..d1c69e1bc309 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -682,12 +682,6 @@ static void lcl_SetTableSeparators(const uno::Any& rVal, SwTable* pTable, SwTabl pDoc->SetTabCols(*pTable, aCols, aOldCols, pBox, bRow ); } -static inline OUString lcl_getString( SwXCell &rCell ) -{ - // getString is a member function of the base class... - return rCell.getString(); -} - /* non UNO function call to set string in SwXCell */ void sw_setString( SwXCell &rCell, const OUString &rText, bool bKeepNumberFormat = false ) @@ -3557,7 +3551,7 @@ void SwXCellRange::GetDataSequence( SwTableBox * pBox = pXCell ? pXCell->GetTableBox() : 0; if(!pBox) throw uno::RuntimeException(); - pTextData[nDtaCnt++] = lcl_getString(*pXCell); + pTextData[nDtaCnt++] = pXCell->getString(); } } assert(nDtaCnt == nSize); @@ -3589,7 +3583,7 @@ uno::Sequence< uno::Sequence< uno::Any > > SAL_CALL SwXCellRange::getDataArray() // check if table box value item is set SwFrameFormat* pBoxFormat(pBox->GetFrameFormat()); const bool bIsNum = pBoxFormat->GetItemState(RES_BOXATR_VALUE, false) == SfxItemState::SET; - rCellAny = bIsNum ? uno::makeAny(pCell->getValue()) : uno::makeAny(lcl_getString(*pCell)); + rCellAny = bIsNum ? uno::makeAny(pCell->getValue()) : uno::makeAny(pCell->getString()); ++pCurrentCell; } } |