diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2017-05-22 21:08:56 -0400 |
---|---|---|
committer | Kohei Yoshida <libreoffice@kohei.us> | 2017-05-24 05:19:40 +0200 |
commit | d4cd8677889ec3807c194ef5b462f8e031807e5b (patch) | |
tree | 4b53429527d6358d145feef9912d0460924cbde0 /sc/source/core/data/cellvalue.cxx | |
parent | 7948e84091f37fbda75f524f20138d1171918e64 (diff) |
tdf#107945: properly iterate over mtv during pivot cache loading.
This reduces the total time required for populating the pivot cache
by ~60%.
Change-Id: I6a8511959c20231a8a5dbd0b0a9a3d0930a1fa0c
Reviewed-on: https://gerrit.libreoffice.org/37971
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
Diffstat (limited to 'sc/source/core/data/cellvalue.cxx')
-rw-r--r-- | sc/source/core/data/cellvalue.cxx | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/sc/source/core/data/cellvalue.cxx b/sc/source/core/data/cellvalue.cxx index efe66f789596..75b7c5bbb12f 100644 --- a/sc/source/core/data/cellvalue.cxx +++ b/sc/source/core/data/cellvalue.cxx @@ -17,6 +17,7 @@ #include "editutil.hxx" #include "tokenarray.hxx" #include <formula/token.hxx> +#include <formula/errorcodes.hxx> #include <svl/sharedstring.hxx> namespace { @@ -178,6 +179,27 @@ OUString getStringImpl( const CellT& rCell, const ScDocument* pDoc ) return EMPTY_OUSTRING; } +template<typename CellT> +OUString getRawStringImpl( const CellT& rCell, const ScDocument* pDoc ) +{ + switch (rCell.meType) + { + case CELLTYPE_VALUE: + return OUString::number(rCell.mfValue); + case CELLTYPE_STRING: + return rCell.mpString->getString(); + case CELLTYPE_EDIT: + if (rCell.mpEditText) + return ScEditUtil::GetString(*rCell.mpEditText, pDoc); + break; + case CELLTYPE_FORMULA: + return rCell.mpFormula->GetRawString().getString(); + default: + ; + } + return EMPTY_OUSTRING; +} + } ScCellValue::ScCellValue() : meType(CELLTYPE_NONE), mfValue(0.0) {} @@ -544,6 +566,11 @@ bool ScRefCellValue::hasNumeric() const return hasNumericImpl(meType, mpFormula); } +bool ScRefCellValue::hasError() const +{ + return meType == CELLTYPE_FORMULA && mpFormula->GetErrCode() != FormulaError::NONE; +} + double ScRefCellValue::getValue() { switch (meType) @@ -558,11 +585,30 @@ double ScRefCellValue::getValue() return 0.0; } +double ScRefCellValue::getRawValue() const +{ + switch (meType) + { + case CELLTYPE_VALUE: + return mfValue; + case CELLTYPE_FORMULA: + return mpFormula->GetRawValue(); + default: + ; + } + return 0.0; +} + OUString ScRefCellValue::getString( const ScDocument* pDoc ) { return getStringImpl(*this, pDoc); } +OUString ScRefCellValue::getRawString( const ScDocument* pDoc ) const +{ + return getRawStringImpl(*this, pDoc); +} + bool ScRefCellValue::isEmpty() const { return meType == CELLTYPE_NONE; |