summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2014-05-28 08:56:35 +0100
committerMichael Meeks <michael.meeks@collabora.com>2014-05-28 09:04:23 +0100
commitc3cea107354fecda6dedcd6b998343a2bd33d6f3 (patch)
treebc2a0f9ae1f56d4273c397fec3afa82d6f702609 /sc
parentec651eaead5aaa2a74f4c87d3bf17f7feddb958e (diff)
ODS load perf: avoid re-compiling an already free'd pCode with ScCompiler.
Change-Id: Ia6c3c587302869a42376cda1363ee9df0b7a74f5
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/formulacell.cxx51
1 files changed, 31 insertions, 20 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 0429a50142a8..7891500cdfb0 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1211,6 +1211,17 @@ void ScFormulaCell::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rPr
++xGroup->mnLength;
SetCellGroup( xGroup );
+ // Do setup here based on previous cell.
+
+ nFormatType = pPreviousCell->nFormatType;
+ bSubTotal = pPreviousCell->bSubTotal;
+ bChanged = true;
+ bCompile = false;
+ StartListeningTo( pDocument );
+
+ if (bSubTotal)
+ pDocument->AddSubTotalCell(this);
+
bSkipCompile = true;
pCode = pPreviousCell->pCode;
@@ -1226,31 +1237,31 @@ void ScFormulaCell::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rPr
ScTokenArray* pCodeOld = pCode;
pCode = aComp.CompileString( aFormula, aFormulaNmsp );
delete pCodeOld;
- }
- if( !pCode->GetCodeError() )
- {
- if ( !pCode->GetLen() )
- {
- if ( aFormula[0] == '=' )
- pCode->AddBad( aFormula.copy( 1 ) );
- else
- pCode->AddBad( aFormula );
- }
- bSubTotal = aComp.CompileTokenArray();
if( !pCode->GetCodeError() )
{
- nFormatType = aComp.GetNumFormatType();
- bChanged = true;
- bCompile = false;
- StartListeningTo( pDocument );
- }
+ if ( !pCode->GetLen() )
+ {
+ if ( aFormula[0] == '=' )
+ pCode->AddBad( aFormula.copy( 1 ) );
+ else
+ pCode->AddBad( aFormula );
+ }
+ bSubTotal = aComp.CompileTokenArray();
+ if( !pCode->GetCodeError() )
+ {
+ nFormatType = aComp.GetNumFormatType();
+ bChanged = true;
+ bCompile = false;
+ StartListeningTo( pDocument );
+ }
- if (bSubTotal)
- pDocument->AddSubTotalCell(this);
+ if (bSubTotal)
+ pDocument->AddSubTotalCell(this);
+ }
+ else
+ bChanged = true;
}
- else
- bChanged = true;
// Same as in Load: after loading, it must be known if ocMacro is in any formula
// (for macro warning, CompileXML is called at the end of loading XML file)