sc/source/filter/oox/formulabuffer.cxx | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
New commits: commit ee0d0b0d21889441dec04c3b17fc99087cf8ef96 Author: Mike Kaganski <mike.kagan...@collabora.com> Date: Fri Jun 29 20:08:50 2018 +1000 tdf#118441: also keep string-formula results for shared formulas ... like it is done for normal cells. So, the cells that have markup like <row r="2" ...> <c r="A2" t="str"> <f t="shared" ref="A2:A65" si="0">Test(B2:Z2)</f> <v>0</v> </c> </row> <row r="3" ...> <c r="A3" t="str"> <f t="shared" si="0"/> <v>0</v> </c> </row> now are handled (wrt restoring the stored result value) just like cells with this markup without sharing have long been handled: <row r="1" ...> <c r="A1" t="str"> <f>Test(B1:Z1)</f> <v>0</v> </c> </row> Change-Id: Ifcf62cf6d073faff310aa8553c6f57f42ae588cc Reviewed-on: https://gerrit.libreoffice.org/56675 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit e6c43ed9e6bb41b64bcc8105ad006c999deebcd7) Reviewed-on: https://gerrit.libreoffice.org/56756 Reviewed-by: Eike Rathke <er...@redhat.com> diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx index 0e5a5f796be8..f09a11244de9 100644 --- a/sc/source/filter/oox/formulabuffer.cxx +++ b/sc/source/filter/oox/formulabuffer.cxx @@ -109,7 +109,8 @@ void applySharedFormulas( ScDocumentImport& rDoc, SvNumberFormatter& rFormatter, std::vector<FormulaBuffer::SharedFormulaEntry>& rSharedFormulas, - std::vector<FormulaBuffer::SharedFormulaDesc>& rCells ) + std::vector<FormulaBuffer::SharedFormulaDesc>& rCells, + bool bGeneratorKnownGood) { sc::SharedFormulaGroups aGroups; { @@ -132,6 +133,7 @@ void applySharedFormulas( } { + svl::SharedStringPool& rStrPool = rDoc.getDoc().GetSharedStringPool(); // Process formulas that use shared formulas. for (const FormulaBuffer::SharedFormulaDesc& rDesc : rCells) { @@ -149,7 +151,7 @@ void applySharedFormulas( continue; } - // Set cached formula results. For now, we only use numeric + // Set cached formula results. For now, we only use numeric and string-formula // results. Find out how to utilize cached results of other types. switch (rDesc.mnValueType) { @@ -157,6 +159,19 @@ void applySharedFormulas( // numeric value. pCell->SetResultDouble(rDesc.maCellValue.toDouble()); break; + case XML_str: + if (bGeneratorKnownGood) + { + // See applyCellFormulaValues + svl::SharedString aSS = rStrPool.intern(rDesc.maCellValue); + pCell->SetResultToken(new formula::FormulaStringToken(aSS)); + // If we don't reset dirty, then e.g. disabling macros makes all cells + // that use macro functions to show #VALUE! + pCell->ResetDirty(); + pCell->SetChanged(false); + break; + } + SAL_FALLTHROUGH; default: // Mark it for re-calculation. pCell->SetDirty(); @@ -291,7 +306,8 @@ void processSheetFormulaCells( const Sequence<ExternalLinkInfo>& rExternalLinks, bool bGeneratorKnownGood ) { if (rItem.mpSharedFormulaEntries && rItem.mpSharedFormulaIDs) - applySharedFormulas(rDoc, rFormatter, *rItem.mpSharedFormulaEntries, *rItem.mpSharedFormulaIDs); + applySharedFormulas(rDoc, rFormatter, *rItem.mpSharedFormulaEntries, + *rItem.mpSharedFormulaIDs, bGeneratorKnownGood); if (rItem.mpCellFormulas) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits