diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-10-08 10:08:59 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-10-08 15:48:11 -0400 |
commit | 165a61190f103d0227f57a3f19afa144604155a9 (patch) | |
tree | d6c114680baaa3b5ddfe1c0e4824f0e521b00ea4 /sc | |
parent | 83998b79f694fc513cb8e6d01f2e40afeb39d17b (diff) |
Handle edit text cells here as well as the string cells.
Change-Id: I46934341dbde93d963764152f663c4d2d310bea0
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/column2.cxx | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 392a8512bbe6..bb8cf5f7461f 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -2250,16 +2250,39 @@ bool appendStrings( return false; } -void copyFirstStringBlock( sc::FormulaGroupContext& rCxt, size_t nLen, const sc::CellStoreType::position_type& rPos ) +void copyFirstStringBlock( + ScDocument& rDoc, sc::FormulaGroupContext& rCxt, size_t nLen, const sc::CellStoreType::position_type& rPos ) { rCxt.maStrArrays.push_back(new sc::FormulaGroupContext::StrArrayType); sc::FormulaGroupContext::StrArrayType& rArray = rCxt.maStrArrays.back(); rArray.reserve(nLen); - svl::SharedString* p = &sc::string_block::at(*rPos.first->data, rPos.second); - svl::SharedString* pEnd = p + nLen; - for (; p != pEnd; ++p) - rArray.push_back(p->getDataIgnoreCase()); + switch (rPos.first->type) + { + case sc::element_type_string: + { + svl::SharedString* p = &sc::string_block::at(*rPos.first->data, rPos.second); + svl::SharedString* pEnd = p + nLen; + for (; p != pEnd; ++p) + rArray.push_back(p->getDataIgnoreCase()); + } + break; + case sc::element_type_edittext: + { + EditTextObject** p = &sc::edittext_block::at(*rPos.first->data, rPos.second); + EditTextObject** pEnd = p + nLen; + svl::SharedStringPool& rPool = rDoc.GetSharedStringPool(); + for (; p != pEnd; ++p) + { + EditTextObject* pText = *p; + OUString aStr = ScEditUtil::GetString(*pText, &rDoc); + rArray.push_back(rPool.intern(aStr).getDataIgnoreCase()); + } + } + break; + default: + ; + } } } @@ -2366,16 +2389,17 @@ formula::VectorRefArray ScColumn::FetchVectorRefArray( sc::FormulaGroupContext& } break; case sc::element_type_string: + case sc::element_type_edittext: { if (nLenRequested <= nLen) { // Requested length fits a single block. - copyFirstStringBlock(rCxt, nLenRequested, aPos); + copyFirstStringBlock(*pDocument, rCxt, nLenRequested, aPos); sc::FormulaGroupContext::StrArrayType& rArray = rCxt.maStrArrays.back(); return formula::VectorRefArray(&rArray[0]); } - copyFirstStringBlock(rCxt, nLen, aPos); + copyFirstStringBlock(*pDocument, rCxt, nLen, aPos); sc::FormulaGroupContext::StrArrayType& rArray = rCxt.maStrArrays.back(); // Fill the remaining array with values from the following blocks. |