[GSOC] Using cached formula results during ODS import
Markus Mohrhard
markus.mohrhard at googlemail.com
Wed Jul 4 09:07:31 PDT 2012
Hello Daniel,
> I having trouble trying to think of a way to prevent ScFormulaCells from
> being set dirty without my hackish ScDocument libreoffice-generated-doc
> flag.
>
> During the import of the functions.ods unit test file, ScFormulaCells are
> set dirty at three different times in three different ways.
>
> 1) ScMyTables::SetMatrix() uses a call chain down to
> ScFormulaCell::SetMatColsRows() which sets the ScFormulaCell dirty.
This one might be legitimate. We need to check if we can also import
the cached values of matrix formulas.
> 2) ScDocument::CompileXML() uses a SetDirty call chain.
> 3) ScDocShell::AfterXMLLoading() eventually calls ScFormulaCell::Notify
> which sets the ScFormulaCell to dirty.
As discussed on IRC we can change these two to follow the design we
discussed. CompileXML and AfterXMLLoading are only called when we load
the document and can therefore follow the new concept with the hard
recalculation at the end. We may need to think a bit about the
SetDocumentModified behavior and think about good ways to call the
correct update methods without setting the formula cells dirty but I
hink this is possible and cleaner than manipulating directly
ScFormulaCell.
>
> I MAY be able to do something about 1; I'm not sure yet.
> I can probably stop 2 from setting dirty since it is only used in import.
> I don't see anyway to change 3 since ScFormulaCell::Notify() is so widely
> used.
>
> Backtraces for 1, 2, and 3 are attached.
>
> I know Markus said we are trying to get away from flags like ScDocument's
> IsImportingXML, but if I slightly modify the order of things in
> ScDocShell::AfterXMLLoading(), I think I can check if IsImportingXML is set
> to stop ScFormulaCell::SetDirty() from actually setting the cell dirty.
> That would solve 1, 2, and 3, and it would prevent me from adding my own
> ScDocument libreoffice-generated-doc flag.
>
We don't even like adding new callers to IsImportingXML if not really
necessary. We should first check if there is not really a cleaner and
simpler solution to prevent these calls during import before we add
such a check deep down in the formula part of calc.
Regards,
Markus
More information about the LibreOffice
mailing list