diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-06-28 12:49:34 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-06-30 10:40:02 +0200 |
commit | f7d603a7af180a47721c95db5631d08ab9738769 (patch) | |
tree | 9b0566cd87784e3acfaa39a2fc43a5651c446aa1 /sw | |
parent | a54845ee5d1f9258a422e378a39dac18cc975447 (diff) |
refactor out SwXCell:GetAny()
Change-Id: Ia79bb08fb77bda3de6714b160df7007218ab309a
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/unotbl.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/unocore/unotbl.cxx | 19 |
2 files changed, 14 insertions, 6 deletions
diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx index 23c2116d82e1..94fb3bdf7a89 100644 --- a/sw/inc/unotbl.hxx +++ b/sw/inc/unotbl.hxx @@ -155,6 +155,7 @@ public: SwTableBox* FindBox(SwTable* pTable, SwTableBox* pBox); SwFrameFormat* GetFrameFormat() const { return const_cast<SwFrameFormat*>(static_cast<const SwFrameFormat*>(GetRegisteredIn())); } double GetForcedNumericalValue() const; + css::uno::Any GetAny() const; }; class SwXTextTableRow SAL_FINAL : public cppu::WeakImplHelper diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index b3e404bc091d..1b5616d1c466 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -1220,6 +1220,17 @@ double SwXCell::GetForcedNumericalValue() const return fTmp; } +uno::Any SwXCell::GetAny() const +{ + SwTableBox* GetTableBox(); + if(!pBox) + throw uno::RuntimeException(); + // check if table box value item is set + auto pBoxFormat(pBox->GetFrameFormat()); + const bool bIsNum = pBoxFormat->GetItemState(RES_BOXATR_VALUE, false) == SfxItemState::SET; + return bIsNum ? uno::makeAny(getValue()) : uno::makeAny(const_cast<SwXCell*>(this)->getString()); +} + OUString SwXCell::getImplementationName() throw( uno::RuntimeException, std::exception ) { return OUString("SwXCell"); } @@ -3509,13 +3520,9 @@ uno::Sequence< uno::Sequence< uno::Any > > SAL_CALL SwXCellRange::getDataArray() for(auto& rCellAny : rRow) { auto pCell(static_cast<SwXCell*>(pCurrentCell->get())); - SwTableBox* pBox = pCell ? pCell->GetTableBox() : nullptr; - if(!pBox) + if(!pCell) throw uno::RuntimeException(); - // 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(pCell->getString()); + rCellAny = pCell->GetAny(); ++pCurrentCell; } } |