summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/filter/oox/formulabuffer.cxx22
1 files changed, 19 insertions, 3 deletions
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)
{