summaryrefslogtreecommitdiff
path: root/sc/source/filter/xml/xmlcelli.cxx
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-04-24 22:56:05 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-04-25 17:02:31 +0200
commit9fb60c6a7390f782f1878f0e943ba17fd419ebab (patch)
tree8fa7738b05855e07aa8358481722c764feecd953 /sc/source/filter/xml/xmlcelli.cxx
parentd691181f9ead97bba8970759255ba64f6c26aee6 (diff)
implement import for calcext:value-type
This saves us several string comparisons for every cell during import which should speed-up our cached value import quite a bit. I haven't profiled it yet. Additionally it lets us move away from a heuristic based approach. Change-Id: Id9ca92a1251b62e99ca54209fdd52031694784b1
Diffstat (limited to 'sc/source/filter/xml/xmlcelli.cxx')
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx29
1 files changed, 26 insertions, 3 deletions
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index b97a2458cc6c..556f27bf29eb 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -149,6 +149,8 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
bIsMatrix(false),
bIsCovered(bTempIsCovered),
bIsEmpty(true),
+ mbNewValueType(false),
+ mbErrorValue(false),
bIsFirstTextImport(false),
bSolarMutexLocked(false),
bFormulaTextResult(false),
@@ -207,6 +209,14 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
nCellType = GetScImport().GetCellType(sValue);
bIsEmpty = false;
break;
+ case XML_TOK_TABLE_ROW_CELL_ATTR_NEW_VALUE_TYPE:
+ if(sValue == "error")
+ mbErrorValue = true;
+ else
+ nCellType = GetScImport().GetCellType(sValue);
+ bIsEmpty = false;
+ mbNewValueType = true;
+ break;
case XML_TOK_TABLE_ROW_CELL_ATTR_VALUE:
{
if (!sValue.isEmpty())
@@ -968,7 +978,12 @@ void ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const
{
if(pFCell)
{
- if( bFormulaTextResult && maStringValue )
+ if(mbErrorValue)
+ {
+ // don't do anything here
+ // we need to recalc anyway
+ }
+ else if( bFormulaTextResult && maStringValue )
{
if( !IsPossibleErrorString() )
{
@@ -1010,6 +1025,9 @@ void ScXMLTableRowCellContext::PutTextCell( const ScAddress& rCurrentPos,
else
bDoIncrement = false;
+ if(mbErrorValue)
+ bDoIncrement = false;
+
if(!aCellString.isEmpty())
{
if (bDoIncrement && !IsPossibleErrorString())
@@ -1422,9 +1440,10 @@ void ScXMLTableRowCellContext::AddFormulaCell( const ScAddress& rCellPos )
// - is blank
// - has a constant error value beginning with "#" (such as "#VALUE!" or "#N/A")
// - has an "Err:[###]" (where "[###]" is an error number)
+// Libreoffice 4.1+ with ODF1.2 extended write however calcext:value-type="error" in that case
void ScXMLTableRowCellContext::HasSpecialCaseFormulaText()
{
- if (!mbEditEngineHasText)
+ if (!mbEditEngineHasText || mbNewValueType)
return;
OUString aStr = mpEditEngine->GetText(0);
@@ -1436,7 +1455,11 @@ void ScXMLTableRowCellContext::HasSpecialCaseFormulaText()
bool ScXMLTableRowCellContext::IsPossibleErrorString() const
{
- return mbPossibleErrorCell || ( mbCheckWithCompilerForError && GetScImport().IsFormulaErrorConstant(*maStringValue) );
+ if(mbNewValueType && !mbErrorValue)
+ return false;
+ else if(mbNewValueType && mbErrorValue)
+ return true;
+ return mbPossibleErrorCell || ( mbCheckWithCompilerForError && GetScImport().IsFormulaErrorConstant(*maStringValue) );
}