sc/source/filter/oox/formulabuffer.cxx | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
New commits: commit e745bf67b7bd2701ae1334de42ffdf78c67e7177 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/56697 Reviewed-by: Aron Budea <aron.bu...@collabora.com> Tested-by: Aron Budea <aron.bu...@collabora.com> diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx index bfa229292775..c54ae121543d 100644 --- a/sc/source/filter/oox/formulabuffer.cxx +++ b/sc/source/filter/oox/formulabuffer.cxx @@ -114,7 +114,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; { @@ -139,6 +140,7 @@ void applySharedFormulas( } { + svl::SharedStringPool& rStrPool = rDoc.getDoc().GetSharedStringPool(); // Process formulas that use shared formulas. std::vector<FormulaBuffer::SharedFormulaDesc>::const_iterator it = rCells.begin(), itEnd = rCells.end(); for (; it != itEnd; ++it) @@ -157,7 +159,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 (it->mnValueType) { @@ -165,6 +167,19 @@ void applySharedFormulas( // numeric value. pCell->SetResultDouble(it->maCellValue.toDouble()); break; + case XML_str: + if (bGeneratorKnownGood) + { + // See applyCellFormulaValues + svl::SharedString aSS = rStrPool.intern(it->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(); @@ -306,7 +321,8 @@ void processSheetFormulaCells( const uno::Sequence<sheet::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