summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-06-28 12:10:32 +0200
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-06-30 10:40:01 +0200
commit91dd43a4eaa6bd6434e538dee1a485842fbcbb4f (patch)
tree041b63acdcfee0b39d8a5071819bcdff65edafef
parentf828df4cad83760e2f722ec4b5e6e910c85f6598 (diff)
refactor getTextualData
Change-Id: I122a4fb8526af0c3c40e6a6cdacaa11fe531e15f
-rw-r--r--sw/source/core/unocore/unochart.cxx32
-rw-r--r--sw/source/core/unocore/unotbl.cxx10
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;
}
}