summaryrefslogtreecommitdiff
path: root/formula
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2022-06-18 01:46:23 +0200
committerEike Rathke <erack@redhat.com>2022-06-18 13:49:59 +0200
commit9aab475e221e1abee2108b21545f2bdaa48552e6 (patch)
treeec9faa8b1fb3b7aa38f1e2f6e03857ec01759271 /formula
parent85c564285036f92f76c1095487c5d5e12709b1e2 (diff)
Related: tdf#142293 tdf#141495 Allow additional symbols in externals map
... to repair broken saved as Excel documents with saved Add-In programmatic names, by adding them as upper-cased symbols. Previously, adding such name was rejected if the Add-In already existed in the reverse map. Now multiple one-way aliases are accepted. The upper-case programmatic name was already attempted to be added for all Add-Ins of the collection (for the non-UI case via fillFromAddInCollectionUpperName()) but the pre-known Add-Ins are mapped before so existed already and those names were rejected, as they shouldn't be necessary. Except for broken documents.. Change-Id: I3cb6848779362de3446581528d2f6e6f19af9ec8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136072 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'formula')
-rw-r--r--formula/source/core/api/FormulaCompiler.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 4b6495826d48..1aa8d9f65855 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -451,9 +451,14 @@ void FormulaCompiler::OpCodeMap::putExternal( const OUString & rSymbol, const OU
void FormulaCompiler::OpCodeMap::putExternalSoftly( const OUString & rSymbol, const OUString & rAddIn )
{
- bool bOk = maReverseExternalHashMap.emplace(rAddIn, rSymbol).second;
+ // Same as putExternal() but no warning, instead info whether inserted or not.
+ bool bOk = maExternalHashMap.emplace(rSymbol, rAddIn).second;
+ SAL_INFO( "formula.core", "OpCodeMap::putExternalSoftly: symbol " << (bOk ? "" : "not ") << "inserted, " << rSymbol << " -> " << rAddIn);
if (bOk)
- maExternalHashMap.emplace(rSymbol, rAddIn);
+ {
+ bOk = maReverseExternalHashMap.emplace(rAddIn, rSymbol).second;
+ SAL_INFO_IF( !bOk, "formula.core", "OpCodeMap::putExternalSoftly: AddIn not inserted, " << rAddIn << " -> " << rSymbol);
+ }
}
uno::Sequence< sheet::FormulaToken > FormulaCompiler::OpCodeMap::createSequenceOfFormulaTokens(