[Libreoffice-commits] core.git: Branch 'private/kohei/calc-shared-string' - sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Tue Oct 8 07:07:52 PDT 2013
sc/source/core/data/column2.cxx | 38 +++++++++++++++++++++++++++++++-------
1 file changed, 31 insertions(+), 7 deletions(-)
New commits:
commit 1cd94a3c84f20458d57a0d8b97a714b943d33275
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Tue Oct 8 10:08:59 2013 -0400
Handle edit text cells here as well as the string cells.
Change-Id: I46934341dbde93d963764152f663c4d2d310bea0
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 392a851..bb8cf5f 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.
More information about the Libreoffice-commits
mailing list