Sorry, I meant to also CC Kohei and mailing list.
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.
In my first attempted implementation, I prevented the formula cells from
being set dirty in this case, and the cached values still worked. So I
think I just need to change the way ScMyTables::SetMatrix() works to
avoid setting cells dirty.
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.
Yes, CompileXML is no problem. Yes, I'll have to do more in-depth
thought about SetDocumentModified behavior.
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.
I guess I was too tempted by the quick fix. ;-) I'll think a lot
harder about this and see what I can come up with.
Context
- Fwd: Re: [GSOC] Using cached formula results during ODS import · Daniel Bankston
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.