summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWinfried Donkers <winfrieddonkers@libreoffice.org>2013-08-16 09:45:41 +0200
committerEike Rathke <erack@redhat.com>2013-08-16 18:05:05 +0200
commit218728583950aed00be955b5ccdebec69986cff2 (patch)
treead6b7aabe5c2c6a810be2e311924550c5b78773f
parent5cc5a03d799434b51f67256a46d52b823870be94 (diff)
import .xlsx files saved by Calc before fdo#59727 was patched
Change-Id: Id1eedc86056f7de24913f8156a819f8a0695fd59 (cherry picked from commit 78c995a184115ef4ec1c348bd9b910a3791de550) Signed-off-by: Eike Rathke <erack@redhat.com> differentiated warning for symbol/AddIn pair insertion, fdo#59727 Change-Id: I371bca810c40d4cfab0b9fcd47a070b4e68ee768 (cherry picked from commit b24e3a6042ccfeee650664cc6fb244dfeea497cb) Signed-off-by: Eike Rathke <erack@redhat.com> (cherry picked from commit 27a5fa2c83c1acb119d5ae9000f040de3fb17c09) Signed-off-by: Eike Rathke <erack@redhat.com>
-rw-r--r--formula/source/core/api/FormulaCompiler.cxx11
-rw-r--r--sc/source/filter/oox/formulabase.cxx14
2 files changed, 22 insertions, 3 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 5d38e6e6ec14..11a2034e4cd4 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -253,10 +253,19 @@ const sal_Unicode* lcl_UnicodeStrChr( const sal_Unicode* pStr,sal_Unicode c )
void FormulaCompiler::OpCodeMap::putExternal( const String & rSymbol, const String & rAddIn )
{
+ // Different symbols may map to the same AddIn, but the same AddIn may not
+ // map to different symbols, the first pair wins. Same symbol of course may
+ // not map to different AddIns, again the first pair wins and also the
+ // AddIn->symbol mapping is not inserted in other cases.
bool bOk = mpExternalHashMap->insert( ExternalHashMap::value_type( rSymbol, rAddIn)).second;
+ SAL_WARN_IF( !bOk, "formula.core", "OpCodeMap::putExternal: symbol not inserted, " << rSymbol << " -> " << rAddIn);
if (bOk)
+ {
bOk = mpReverseExternalHashMap->insert( ExternalHashMap::value_type( rAddIn, rSymbol)).second;
- DBG_ASSERT( bOk, "OpCodeMap::putExternal: symbol not inserted");
+ // Failed insertion of the AddIn is ok for different symbols mapping to
+ // the same AddIn. Make this INFO only.
+ SAL_INFO_IF( !bOk, "formula.core", "OpCodeMap::putExternal: AddIn not inserted, " << rAddIn << " -> " << rSymbol);
+ }
}
void FormulaCompiler::OpCodeMap::putExternalSoftly( const String & rSymbol, const String & rAddIn )
diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx
index 9879c4629040..5fb279d89ea3 100644
--- a/sc/source/filter/oox/formulabase.cxx
+++ b/sc/source/filter/oox/formulabase.cxx
@@ -793,7 +793,7 @@ static const FunctionData saFuncTableOdf[] =
{ "XOR", 0, NOID, NOID, 1, MX, V, { RX }, FUNCFLAG_MACROCALLODF }
};
-/** Functions defined by calc, but not in OpenFormula nor supported by Excel. */
+/** Functions defined by Calc, but not in OpenFormula nor supported by Excel. */
static const FunctionData saFuncTableOOoLO[] =
{
{ "ORG.OPENOFFICE.WEEKS", "ORG.OPENOFFICE.WEEKS", NOID, NOID, 3, 3, V, { VR }, FUNCFLAG_MACROCALL_NEW | FUNCFLAG_EXTERNAL },
@@ -803,7 +803,17 @@ static const FunctionData saFuncTableOOoLO[] =
{ "ORG.OPENOFFICE.DAYSINMONTH", "ORG.OPENOFFICE.DAYSINMONTH", NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_MACROCALL_NEW | FUNCFLAG_EXTERNAL },
{ "ORG.OPENOFFICE.DAYSINYEAR", "ORG.OPENOFFICE.DAYSINYEAR", NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_MACROCALL_NEW | FUNCFLAG_EXTERNAL },
{ "ORG.OPENOFFICE.WEEKSINYEAR", "ORG.OPENOFFICE.WEEKSINYEAR", NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_MACROCALL_NEW | FUNCFLAG_EXTERNAL },
- { "ORG.OPENOFFICE.ROT13", "ORG.OPENOFFICE.ROT13", NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_MACROCALL_NEW | FUNCFLAG_EXTERNAL }
+ { "ORG.OPENOFFICE.ROT13", "ORG.OPENOFFICE.ROT13", NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_MACROCALL_NEW | FUNCFLAG_EXTERNAL },
+ /* Next 8 lines are for importing from .xlsx files saved by Calc before
+ * fdo#59727 was patched with the entries above. */
+ { "ORG.OPENOFFICE.WEEKS", "COM.SUN.STAR.SHEET.ADDIN.DATEFUNCTIONS.GETDIFFWEEKS", NOID, NOID, 3, 3, V, { VR }, FUNCFLAG_IMPORTONLY | FUNCFLAG_EXTERNAL },
+ { "ORG.OPENOFFICE.MONTHS", "COM.SUN.STAR.SHEET.ADDIN.DATEFUNCTIONS.GETDIFFMONTHS", NOID, NOID, 3, 3, V, { VR }, FUNCFLAG_IMPORTONLY | FUNCFLAG_EXTERNAL },
+ { "ORG.OPENOFFICE.YEARS", "COM.SUN.STAR.SHEET.ADDIN.DATEFUNCTIONS.GETDIFFYEARS", NOID, NOID, 3, 3, V, { VR }, FUNCFLAG_IMPORTONLY | FUNCFLAG_EXTERNAL },
+ { "ORG.OPENOFFICE.ISLEAPYEAR", "COM.SUN.STAR.SHEET.ADDIN.DATEFUNCTIONS.GETISLEAPYEAR", NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_IMPORTONLY | FUNCFLAG_EXTERNAL },
+ { "ORG.OPENOFFICE.DAYSINMONTH", "COM.SUN.STAR.SHEET.ADDIN.DATEFUNCTIONS.GETDAYSINMONTH", NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_IMPORTONLY | FUNCFLAG_EXTERNAL },
+ { "ORG.OPENOFFICE.DAYSINYEAR", "COM.SUN.STAR.SHEET.ADDIN.DATEFUNCTIONS.GETDAYSINYEAR", NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_IMPORTONLY | FUNCFLAG_EXTERNAL },
+ { "ORG.OPENOFFICE.WEEKSINYEAR", "COM.SUN.STAR.SHEET.ADDIN.DATEFUNCTIONS.GETWEEKSINYEAR", NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_IMPORTONLY | FUNCFLAG_EXTERNAL },
+ { "ORG.OPENOFFICE.ROT13", "COM.SUN.STAR.SHEET.ADDIN.DATEFUNCTIONS.GETROT13", NOID, NOID, 1, 1, V, { VR }, FUNCFLAG_IMPORTONLY | FUNCFLAG_EXTERNAL }
};
// ----------------------------------------------------------------------------