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
(cherry picked from commit 9aab475e221e1abee2108b21545f2bdaa48552e6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136047
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 4b64958..1aa8d9f6 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(
diff --git a/include/formula/FormulaCompiler.hxx b/include/formula/FormulaCompiler.hxx
index c455ca4..5544ff8 100644
--- a/include/formula/FormulaCompiler.hxx
+++ b/include/formula/FormulaCompiler.hxx
@@ -166,7 +166,8 @@ public:
void putExternal( const OUString & rSymbol, const OUString & rAddIn );
/** Put entry of symbol String and AddIn international String pair,
failing silently if rAddIn name already exists. */
not warning just info as used for AddIn collection and setting up
alias names. */
void putExternalSoftly( const OUString & rSymbol, const OUString & rAddIn );
/// Core implementation of XFormulaOpCodeMapper::getMappings()