[Libreoffice-commits] core.git: formula/source sc/source

2023-02-16 Thread Eike Rathke (via logerrit)
 formula/source/core/api/token.cxx |   13 +
 sc/source/core/tool/interpr4.cxx  |   10 +-
 2 files changed, 14 insertions(+), 9 deletions(-)

New commits:
commit e7ce9bddadb2db222eaa5f594ef1de2e36d57e5c
Author: Eike Rathke 
AuthorDate: Thu Feb 16 20:20:31 2023 +0100
Commit: Eike Rathke 
CommitDate: Fri Feb 17 02:24:08 2023 +

Obtain actual 0-parameter count for OR(), AND() and 1-parameter functions

OR and AND for legacy infix notation are classified as binary
operators but in fact are functions with parameter count. In case
no argument is supplied, GetByte() returns 0 and for that case the
implicit binary operator 2 parameters were wrongly assumed.
Similar for functions expecting 1 parameter, without argument 1
was assumed. For "real" unary and binary operators the compiler
already checks parameters. Omit OR and AND and 1-parameter
functions from this implicit assumption and return the actual 0
count.

Change-Id: Ie05398c112a98021ac2875cf7b6de994aee9d882
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147173
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/formula/source/core/api/token.cxx 
b/formula/source/core/api/token.cxx
index ca7b7bab3d58..74a212937bb0 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -94,17 +94,14 @@ sal_uInt8 FormulaToken::GetParamCount() const
 return 0;   // parameters and specials
 // ocIf... jump commands not for FAP, have cByte then
 //2do: bool parameter whether FAP or not?
-else if ( GetByte() )
+else if (GetByte())
 return GetByte();   // all functions, also ocExternal and ocMacro
-else if (SC_OPCODE_START_BIN_OP <= eOp && eOp < SC_OPCODE_STOP_BIN_OP)
-return 2;   // binary
-else if ((SC_OPCODE_START_UN_OP <= eOp && eOp < SC_OPCODE_STOP_UN_OP)
-|| eOp == ocPercentSign)
-return 1;   // unary
+else if (SC_OPCODE_START_BIN_OP <= eOp && eOp < SC_OPCODE_STOP_BIN_OP && 
eOp != ocAnd && eOp != ocOr)
+return 2;   // binary operators, compiler checked; OR and AND 
legacy but are functions
+else if ((SC_OPCODE_START_UN_OP <= eOp && eOp < SC_OPCODE_STOP_UN_OP) || 
eOp == ocPercentSign)
+return 1;   // unary operators, compiler checked
 else if (SC_OPCODE_START_NO_PAR <= eOp && eOp < SC_OPCODE_STOP_NO_PAR)
 return 0;   // no parameter
-else if (SC_OPCODE_START_1_PAR <= eOp && eOp < SC_OPCODE_STOP_1_PAR)
-return 1;   // one parameter
 else if (FormulaCompiler::IsOpCodeJumpCommand( eOp ))
 return 1;   // only the condition counts as parameter
 else
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index b122a836d654..1f14981ebadc 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -4034,7 +4034,15 @@ StackVar ScInterpreter::Interpret()
 else if (sp >= pCur->GetParamCount())
 nStackBase = sp - pCur->GetParamCount();
 else
-nStackBase = sp;// underflow?!?
+{
+SAL_WARN("sc.core", "Stack anomaly at " << aPos.Format(
+ScRefFlags::VALID | ScRefFlags::FORCE_DOC | 
ScRefFlags::TAB_3D, )
+<< "  eOp: " << static_cast(eOp)
+<< "  params: " << 
static_cast(pCur->GetParamCount())
+<< "  nStackBase: " << nStackBase << "  sp: " << 
sp);
+nStackBase = sp;
+assert(!"underflow");
+}
 }
 
 switch( eOp )


[Libreoffice-commits] core.git: formula/source sc/source

2022-09-06 Thread Eike Rathke (via logerrit)
 formula/source/core/api/FormulaCompiler.cxx |2 +-
 sc/source/core/tool/compiler.cxx|4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 64f673238cf9b645a751e8f8137ca14e595a779a
Author: Eike Rathke 
AuthorDate: Tue Sep 6 13:48:29 2022 +0200
Commit: Eike Rathke 
CommitDate: Tue Sep 6 15:40:59 2022 +0200

A ColRowName (label) is a QuotedLabel is a SingleQuoted

Hence a ' is not escaped by \' but by '' doubling it.

See also ODFF 5.10 Quoted Label

https://docs.oasis-open.org/office/OpenDocument/v1.3/os/part4-formula/OpenDocument-v1.3-os-part4-formula.html#__RefHeading__1017950_715980110

Apparently this was always wrong and even stored in files and
never correctly read/compiled back.

Change-Id: I94bdb7d1fdffe9bbd77cf443883dd76637be981b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139491
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/formula/source/core/api/FormulaCompiler.cxx 
b/formula/source/core/api/FormulaCompiler.cxx
index 3f41b2196bcf..6684fd17da47 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -1203,7 +1203,7 @@ bool FormulaCompiler::DeQuote( OUString& rStr )
 if ( nLen > 1 && rStr[0] == '\'' && rStr[ nLen-1 ] == '\'' )
 {
 rStr = rStr.copy( 1, nLen-2 );
-rStr = rStr.replaceAll( "\\\'", "\'" );
+rStr = rStr.replaceAll( "''", "'" );
 return true;
 }
 return false;
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index de4cb870861e..550354d6b8f4 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -5357,13 +5357,13 @@ void ScCompiler::CreateStringFromSingleRef( 
OUStringBuffer& rBuffer, const Formu
 OUString aStr = rDoc.GetString(aAbs, mpInterpreterContext);
 
 // If string contains only numeric characters or if it contains 
non-alphanumeric characters
-// -> quote characters contained within are escaped by '\\'.
+// -> quote characters contained within are escaped by ''.
 // -> put quotes around string
 sal_Int32 nType = ScGlobal::getCharClass().getStringType( aStr, 0, 
aStr.getLength() );
 if ( CharClass::isNumericType( nType )
 || !CharClass::isAlphaNumericType( nType ) )
 {
-aStr = aStr.replaceAll(u"'", u"\\'");
+aStr = aStr.replaceAll(u"'", u"''");
 aStr = "'" + aStr + "'";
 }
 rBuffer.append(aStr);


[Libreoffice-commits] core.git: formula/source sc/source

2022-08-06 Thread Eike Rathke (via logerrit)
 formula/source/core/api/FormulaCompiler.cxx |   11 ++-
 sc/source/ui/docshell/docsh6.cxx|3 ++-
 2 files changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 0a78f11fdd13d914d5f063007b2df9796e6dce9d
Author: Eike Rathke 
AuthorDate: Fri Aug 5 19:28:50 2022 +0200
Commit: Eike Rathke 
CommitDate: Sat Aug 6 19:37:38 2022 +0200

Related: tdf#135993 Use ScCompiler to create English OpCodeMap with AddIns

... instead of formula::FormulaCompiler base class that doesn't
know anything about AddIns, and copy AddIns along to new resulting
native map.

Change-Id: I9e4ece2f7450a561ac502ca1dbddaa5a697fa2fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137882
Tested-by: Eike Rathke 
Reviewed-by: Eike Rathke 

diff --git a/formula/source/core/api/FormulaCompiler.cxx 
b/formula/source/core/api/FormulaCompiler.cxx
index 2b0db73d1a39..591b28744289 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -1296,7 +1296,16 @@ void FormulaCompiler::OpCodeMap::copyFrom( const 
OpCodeMap& r )
 }
 }
 
-// TODO: maybe copy the external maps too?
+// This was meant to copy to native map that does not have AddIn symbols
+// but needs them from the source map. It is unclear what should happen if
+// the destination already had externals, so do it only if it doesn't.
+if (!hasExternals())
+{
+maExternalHashMap = r.maExternalHashMap;
+maReverseExternalHashMap = r.maReverseExternalHashMap;
+mbCore = r.mbCore;
+mbEnglish = r.mbEnglish;
+}
 }
 
 
diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx
index 738c85110967..caefdfc0fed3 100644
--- a/sc/source/ui/docshell/docsh6.cxx
+++ b/sc/source/ui/docshell/docsh6.cxx
@@ -445,7 +445,8 @@ void ScDocShell::SetFormulaOptions( const ScFormulaOptions& 
rOpt, bool bForLoadi
 if (rOpt.GetUseEnglishFuncName())
 {
 // switch native symbols to English.
-formula::FormulaCompiler aComp;
+ScAddress aAddress;
+ScCompiler aComp( *m_pDocument, aAddress);
 ScCompiler::OpCodeMapPtr xMap = 
aComp.GetOpCodeMap(css::sheet::FormulaLanguage::ENGLISH);
 ScCompiler::SetNativeSymbols(xMap);
 }


[Libreoffice-commits] core.git: formula/source sc/source

2022-08-03 Thread Eike Rathke (via logerrit)
 formula/source/core/api/FormulaCompiler.cxx |3 +--
 sc/source/core/tool/compiler.cxx|   24 +---
 2 files changed, 22 insertions(+), 5 deletions(-)

New commits:
commit 86ed0105a4d70d481e3358ae1c6855766ef44d23
Author: Eike Rathke 
AuthorDate: Wed Aug 3 22:54:46 2022 +0200
Commit: Eike Rathke 
CommitDate: Thu Aug 4 02:50:59 2022 +0200

Resolves: tdf#150253 Add English names for GRAM_API AddIn functions

... so not only the com.sun.star.sheet.addin.* programmatic names
are recognized for XCell::setFormula() non-localized API calls.

Change-Id: I1f1f3f45001360445b25765312782f04ee079ee9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137769
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/formula/source/core/api/FormulaCompiler.cxx 
b/formula/source/core/api/FormulaCompiler.cxx
index 1aa8d9f65855..a13a7a1734e8 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -961,8 +961,7 @@ void FormulaCompiler::InitSymbolsAPI() const
 static OpCodeMapData aMap;
 osl::MutexGuard aGuard();
 if (!aMap.mxSymbolMap)
-// XFunctionAccess API always used PODF grammar, keep it.
-loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH_API, 
FormulaGrammar::GRAM_PODF, aMap.mxSymbolMap, SeparatorType::RESOURCE_BASE);
+loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH_API, 
FormulaGrammar::GRAM_API, aMap.mxSymbolMap, SeparatorType::RESOURCE_BASE);
 mxSymbolsAPI = aMap.mxSymbolMap;
 }
 
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 0de38ad001b2..2b1d70280926 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -110,6 +110,9 @@ void ScCompiler::fillFromAddInMap( const 
NonConstOpCodeMapPtr& xMap,FormulaGramm
 size_t nSymbolOffset;
 switch( _eGrammar )
 {
+// XFunctionAccess and XCell::setFormula()/getFormula() API always used
+// PODF grammar symbols, keep it.
+case FormulaGrammar::GRAM_API:
 case FormulaGrammar::GRAM_PODF:
 nSymbolOffset = offsetof( AddInMap, pUpper);
 break;
@@ -121,9 +124,8 @@ void ScCompiler::fillFromAddInMap( const 
NonConstOpCodeMapPtr& xMap,FormulaGramm
 nSymbolOffset = offsetof( AddInMap, pEnglish);
 break;
 }
-const AddInMap* pMap = g_aAddInMap;
-const AddInMap* const pStop = pMap + GetAddInMapCount();
-for ( ; pMap < pStop; ++pMap)
+const AddInMap* const pStop = g_aAddInMap + GetAddInMapCount();
+for (const AddInMap* pMap = g_aAddInMap; pMap < pStop; ++pMap)
 {
 char const * const * ppSymbol =
 reinterpret_cast< char const * const * >(
@@ -131,6 +133,22 @@ void ScCompiler::fillFromAddInMap( const 
NonConstOpCodeMapPtr& xMap,FormulaGramm
 xMap->putExternal( OUString::createFromAscii( *ppSymbol),
 OUString::createFromAscii( pMap->pOriginal));
 }
+if (_eGrammar == FormulaGrammar::GRAM_API)
+{
+// Add English names additionally to programmatic names, so they
+// can be used in XCell::setFormula() non-localized API calls.
+// Note the reverse map will still deliver programmatic names for
+// XCell::getFormula().
+nSymbolOffset = offsetof( AddInMap, pEnglish);
+for (const AddInMap* pMap = g_aAddInMap; pMap < pStop; ++pMap)
+{
+char const * const * ppSymbol =
+reinterpret_cast< char const * const * >(
+reinterpret_cast< char const * >(pMap) + 
nSymbolOffset);
+xMap->putExternal( OUString::createFromAscii( *ppSymbol),
+OUString::createFromAscii( pMap->pOriginal));
+}
+}
 }
 
 void ScCompiler::fillFromAddInCollectionUpperName( const NonConstOpCodeMapPtr& 
xMap ) const


[Libreoffice-commits] core.git: formula/source sc/source

2018-10-11 Thread Libreoffice Gerrit user
 formula/source/core/api/FormulaCompiler.cxx |   27 +++
 sc/source/core/tool/interpr4.cxx|4 +++-
 2 files changed, 26 insertions(+), 5 deletions(-)

New commits:
commit a6032ff5418ad66cc8fec10c636e32b124ee7864
Author: Eike Rathke 
AuthorDate: Thu Oct 11 00:57:00 2018 +0200
Commit: Eike Rathke 
CommitDate: Thu Oct 11 11:26:37 2018 +0200

Resolves: tdf#90698 catch list (1;2) of non-references as error

Change-Id: Icc6f93bbf85df245ba332ce89791a1c8d266b1c6
Reviewed-on: https://gerrit.libreoffice.org/61639
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/formula/source/core/api/FormulaCompiler.cxx 
b/formula/source/core/api/FormulaCompiler.cxx
index 6859e744ca15..db32c1de0ff1 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -1401,18 +1401,37 @@ void FormulaCompiler::Factor()
 NextToken();
 CheckSetForceArrayParameter( mpToken, 0);
 eOp = Expression();
-// Do not ignore error here, regardless of bIgnoreErrors, otherwise
-// errors like =(1;) would also result in display of =(1~)
+// Do not ignore error here, regardless of mbStopOnError, to not
+// change the formula expression in case of an unexpected state.
 if (pArr->GetCodeError() == FormulaError::NONE)
 {
-pFacToken->NewOpCode( ocUnion, FormulaToken::PrivateAccess());
-PutCode( pFacToken);
+// Left and right operands must be reference or function
+// returning reference to form a range list.
+const FormulaToken* p;
+if (pc >= 2
+&& ((p = pCode[-2]) != nullptr) && 
isPotentialRangeType( p, true, false)
+&& ((p = pCode[-1]) != nullptr) && 
isPotentialRangeType( p, true, true))
+{
+pFacToken->NewOpCode( ocUnion, 
FormulaToken::PrivateAccess());
+PutCode( pFacToken);
+}
 }
 }
 if (eOp != ocClose)
 SetError( FormulaError::PairExpected);
 else
 NextToken();
+
+/* TODO: if no conversion to ocUnion is involved this could collect
+ * such expression as a list or (matrix) vector to be passed as
+ * argument for one parameter (which in fact the ocUnion svRefList is a
+ * special case of), which would require a new StackVar type and needed
+ * to be handled by the interpreter for functions that could support it
+ * (i.e. already handle VAR_ARGS or svRefList parameters). This is also
+ * not defined by ODF.
+ * Does Excel handle =SUM((1;2))?
+ * As is, the interpreter catches extraneous uncalculated
+ * subexpressions like 1 of (1;2) as error. */
 }
 else
 {
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 4b5ff2281bfa..c47b33f8488c 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -4507,7 +4507,7 @@ StackVar ScInterpreter::Interpret()
 bForcedResultType = false;
 }
 
-if( sp )
+if (sp == 1)
 {
 pCur = pStack[ sp-1 ];
 if( pCur->GetOpCode() == ocPush )
@@ -4634,6 +4634,8 @@ StackVar ScInterpreter::Interpret()
 else
 SetError( FormulaError::UnknownStackVariable);
 }
+else if (sp > 1)
+SetError( FormulaError::OperatorExpected);
 else
 SetError( FormulaError::NoCode);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: formula/source sc/source

2018-07-18 Thread Libreoffice Gerrit user
 formula/source/core/api/FormulaCompiler.cxx |1 +
 sc/source/filter/xml/xmlcelli.cxx   |   12 +---
 2 files changed, 10 insertions(+), 3 deletions(-)

New commits:
commit a014a9bcf071229eef93c307c705a4c639635bd5
Author: Eike Rathke 
AuthorDate: Wed Jul 18 22:04:09 2018 +0200
Commit: Eike Rathke 
CommitDate: Wed Jul 18 23:21:26 2018 +0200

Do not force all string results to be recalculated if no style set

Results are forced to recalculate for cells with General format in
case they need to inherit a format that then can be set. However,
a General format will never lead to some other format being set
for any string results and almost all string result cells will
have General format because the string is already what is being
displayed. So for formula cells with a string result available do
not allow to use ScFormulaCell::SetNeedNumberFormat() forcing the
need to recalculate.

This popped up during intercepting for tdf#118735 when the formula
cell containing a WEBSERVICE() call is set dirty, through
CompileXMLHandler::operator()(...)

if (pCell->NeedsNumberFormat())
pCell->SetDirtyVar();

Which again, as WEBSERVICE() has to be recalculated to populate
the link manager, made it necessary to add that to
ScRecalcMode::ONLOAD_LENIENT (which it should already had been
before (when that was ONLOAD), but no harm in this case).

Change-Id: I0dc2cdfe35c56d9843f0edd24a6d14e3de79f7ef
Reviewed-on: https://gerrit.libreoffice.org/57700
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/formula/source/core/api/FormulaCompiler.cxx 
b/formula/source/core/api/FormulaCompiler.cxx
index 5d4c3e76ec5b..d11bd25a08d1 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -1436,6 +1436,7 @@ void FormulaCompiler::Factor()
 case ocDde:
 case ocMacro:
 case ocExternal:
+case ocWebservice:
 pArr->AddRecalcMode( ScRecalcMode::ONLOAD_LENIENT );
 break;
 // If the referred cell is moved the value changes.
diff --git a/sc/source/filter/xml/xmlcelli.cxx 
b/sc/source/filter/xml/xmlcelli.cxx
index 32a0cb1e6392..c9899457f23c 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1009,6 +1009,8 @@ void 
ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const
 {
 if(pFCell)
 {
+bool bMayForceNumberformat = true;
+
 if(mbErrorValue)
 {
 // don't do anything here
@@ -1021,6 +1023,9 @@ void 
ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const
 ScDocument* pDoc = rXMLImport.GetDocument();
 
pFCell->SetHybridString(pDoc->GetSharedStringPool().intern(*maStringValue));
 pFCell->ResetDirty();
+// A General format doesn't force any other format for a string
+// result, don't attempt to recalculate this later.
+bMayForceNumberformat = false;
 }
 }
 else if (rtl::math::isFinite(fValue))
@@ -1035,6 +1040,10 @@ void 
ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const
 else
 pFCell->ResetDirty();
 }
+
+if (bMayForceNumberformat)
+// Re-calculate to get number format only when style is not set.
+pFCell->SetNeedNumberFormat(!mbHasStyle);
 }
 }
 
@@ -1398,9 +1407,6 @@ void ScXMLTableRowCellContext::PutFormulaCell( const 
ScAddress& rCellPos )
 ScFormulaCell* pNewCell = new ScFormulaCell(pDoc, rCellPos, pCode, 
eGrammar, ScMatrixMode::NONE);
 SetFormulaCell(pNewCell);
 rDoc.setFormulaCell(rCellPos, pNewCell);
-
-// Re-calculate to get number format only when style is not set.
-pNewCell->SetNeedNumberFormat(!mbHasStyle);
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: formula/source sc/source

2018-02-12 Thread Eike Rathke
 formula/source/core/api/token.cxx |   10 +-
 sc/source/core/tool/interpr4.cxx  |4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit a6c659283ab02cb59feda39b67e1837ed8c32730
Author: Eike Rathke 
Date:   Mon Feb 12 22:52:05 2018 +0100

Use FormulaCompiler::IsOpCodeJumpCommand() where applicable

Change-Id: I295e842da0192c21d318357caa574062085acd9d

diff --git a/formula/source/core/api/token.cxx 
b/formula/source/core/api/token.cxx
index cfd759562d59..05ca4cf5e1e9 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -86,7 +86,7 @@ bool FormulaToken::IsFunction() const
 eOp != ocTableRef &&
(GetByte() != 0  // 
x parameters
 || (SC_OPCODE_START_NO_PAR <= eOp && eOp < SC_OPCODE_STOP_NO_PAR)   // 
no parameter
-|| (ocIf == eOp || ocIfError == eOp || ocIfNA == eOp || ocChoose == 
eOp ) // @ jump commands
+|| FormulaCompiler::IsOpCodeJumpCommand( eOp )  // 
@ jump commands
 || (SC_OPCODE_START_1_PAR <= eOp && eOp < SC_OPCODE_STOP_1_PAR) // 
one parameter
 || (SC_OPCODE_START_2_PAR <= eOp && eOp < SC_OPCODE_STOP_2_PAR) // 
x parameters (cByte==0 in
 // 
FuncAutoPilot)
@@ -101,10 +101,10 @@ bool FormulaToken::IsFunction() const
 sal_uInt8 FormulaToken::GetParamCount() const
 {
 if ( eOp < SC_OPCODE_STOP_DIV && eOp != ocExternal && eOp != ocMacro &&
- eOp != ocIf && eOp != ocIfError && eOp != ocIfNA && eOp != ocChoose &&
+ !FormulaCompiler::IsOpCodeJumpCommand( eOp ) &&
  eOp != ocPercentSign )
 return 0;   // parameters and specials
-// ocIf, ocIfError, ocIfNA and ocChoose not for FAP, 
have cByte then
+// ocIf... jump commands not for FAP, have cByte then
 //2do: bool parameter whether FAP or not?
 else if ( GetByte() )
 return GetByte();   // all functions, also ocExternal and ocMacro
@@ -117,7 +117,7 @@ sal_uInt8 FormulaToken::GetParamCount() const
 return 0;   // no parameter
 else if (SC_OPCODE_START_1_PAR <= eOp && eOp < SC_OPCODE_STOP_1_PAR)
 return 1;   // one parameter
-else if ( eOp == ocIf || eOp == ocIfError || eOp == ocIfNA || eOp == 
ocChoose )
+else if (FormulaCompiler::IsOpCodeJumpCommand( eOp ))
 return 1;   // only the condition counts as parameter
 else
 return 0;   // all the rest, no Parameter, or
@@ -893,7 +893,7 @@ bool FormulaTokenArray::HasMatrixDoubleRefOps()
 }
 if ( eOp == ocPush || lcl_IsReference( eOp, t->GetType() )  )
 pStack[sp++] = t;
-else if ( eOp == ocIf || eOp == ocIfError || eOp == ocIfNA || eOp 
== ocChoose )
+else if (FormulaCompiler::IsOpCodeJumpCommand( eOp ))
 {   // ignore Jumps, pop previous Result (Condition)
 if ( sp )
 --sp;
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 942911d29ff2..c1cd4f835398 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -3987,7 +3987,7 @@ StackVar ScInterpreter::Interpret()
 nCurFmtType = SvNumFormatType::UNDEFINED;
 }
 else if (pTokenMatrixMap &&
- !(eOp == ocIf || eOp == ocIfError || eOp == ocIfNA || eOp == 
ocChoose) &&
+ !FormulaCompiler::IsOpCodeJumpCommand( eOp ) &&
 ((aTokenMatrixMapIter = pTokenMatrixMap->find( pCur)) !=
  pTokenMatrixMap->end()) &&
 (*aTokenMatrixMapIter).second->GetType() != svJumpMatrix)
@@ -4008,7 +4008,7 @@ StackVar ScInterpreter::Interpret()
 nFuncFmtType = SvNumFormatType::NUMBER;
 nFuncFmtIndex = 0;
 
-if ( eOp == ocIf || eOp == ocChoose || eOp == ocIfError || eOp == 
ocIfNA )
+if (FormulaCompiler::IsOpCodeJumpCommand( eOp ))
 nStackBase = sp;// don't mess around with the jumps
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: formula/source sc/source

2017-04-01 Thread Jochen Nitschke
 formula/source/core/api/FormulaCompiler.cxx |4 ++--
 sc/source/core/tool/calcconfig.cxx  |2 +-
 sc/source/core/tool/compiler.cxx|8 
 sc/source/filter/excel/xeformula.cxx|2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 1ed1b639fc80909cb006d74ac25516bcdd409041
Author: Jochen Nitschke 
Date:   Sat Apr 1 00:27:17 2017 +0200

remove redundant OpCode casts

Change-Id: I75389b213ebf74aa35f935134e4f8122d28d2045
Reviewed-on: https://gerrit.libreoffice.org/35996
Tested-by: Jenkins 
Reviewed-by: Jochen Nitschke 

diff --git a/formula/source/core/api/FormulaCompiler.cxx 
b/formula/source/core/api/FormulaCompiler.cxx
index 8f86ce54af25..b70af7dc3152 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -964,7 +964,7 @@ OpCode FormulaCompiler::GetEnglishOpCode( const OUString& 
rName ) const
 
 formula::OpCodeHashMap::const_iterator iLook( xMap->getHashMap()->find( 
rName ) );
 bool bFound = (iLook != xMap->getHashMap()->end());
-return bFound ? (*iLook).second : OpCode(ocNone);
+return bFound ? (*iLook).second : ocNone;
 }
 
 bool FormulaCompiler::IsOpCodeVolatile( OpCode eOp )
@@ -2306,7 +2306,7 @@ void FormulaCompiler::AppendDouble( OUStringBuffer& 
rBuffer, double fVal ) const
 
 void FormulaCompiler::AppendBoolean( OUStringBuffer& rBuffer, bool bVal ) const
 {
-rBuffer.append( mxSymbols->getSymbol( static_cast(bVal ? ocTrue : 
ocFalse)) );
+rBuffer.append( mxSymbols->getSymbol( bVal ? ocTrue : ocFalse ) );
 }
 
 void FormulaCompiler::AppendString( OUStringBuffer& rBuffer, const OUString & 
rStr )
diff --git a/sc/source/core/tool/calcconfig.cxx 
b/sc/source/core/tool/calcconfig.cxx
index 2a0b1f305276..97863bbacd23 100644
--- a/sc/source/core/tool/calcconfig.cxx
+++ b/sc/source/core/tool/calcconfig.cxx
@@ -192,7 +192,7 @@ ScCalcConfig::OpCodeSet ScStringToOpCodeSet(const OUString& 
rOpCodes)
 {
 auto opcode(pHashMap->find(element));
 if (opcode != pHashMap->end())
-result->insert(static_cast(opcode->second));
+result->insert(opcode->second);
 else
 SAL_WARN("sc.opencl", "Unrecognized OpCode " << element << 
" in OpCode set string");
 }
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index e5cef31ca269..3fc28488dc5b 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4708,8 +4708,8 @@ bool ScCompiler::HandleRange()
 // in short: if it isn't a self-contained expression.
 FormulaToken* p1 = pArr->PeekPrevNoSpaces();
 FormulaToken* p2 = pArr->PeekNextNoSpaces();
-OpCode eOp1 = (p1 ? p1->GetOpCode() : static_cast( ocSep ) 
);
-OpCode eOp2 = (p2 ? p2->GetOpCode() : static_cast( ocSep ) 
);
+OpCode eOp1 = (p1 ? p1->GetOpCode() : ocSep);
+OpCode eOp2 = (p2 ? p2->GetOpCode() : ocSep);
 bool bBorder1 = (eOp1 == ocSep || eOp1 == ocOpen);
 bool bBorder2 = (eOp2 == ocSep || eOp2 == ocClose);
 bool bAddPair = !(bBorder1 && bBorder2);
@@ -5353,8 +5353,8 @@ bool ScCompiler::HandleColRowName()
 FormulaToken* p1 = pArr->PeekPrevNoSpaces();
 FormulaToken* p2 = pArr->PeekNextNoSpaces();
 // begin/end of a formula => single
-OpCode eOp1 = p1 ? p1->GetOpCode() : static_cast( ocAdd );
-OpCode eOp2 = p2 ? p2->GetOpCode() : static_cast( ocAdd );
+OpCode eOp1 = p1 ? p1->GetOpCode() : ocAdd;
+OpCode eOp2 = p2 ? p2->GetOpCode() : ocAdd;
 if ( eOp1 != ocColRowName && eOp1 != ocIntersect
 && eOp2 != ocColRowName && eOp2 != ocIntersect )
 {
diff --git a/sc/source/filter/excel/xeformula.cxx 
b/sc/source/filter/excel/xeformula.cxx
index 79dce1e5bdc6..97e1907df15b 100644
--- a/sc/source/filter/excel/xeformula.cxx
+++ b/sc/source/filter/excel/xeformula.cxx
@@ -60,7 +60,7 @@ struct XclExpScToken
 explicit XclExpScToken() : mpScToken( nullptr ), mnSpaces( 0 ) {}
 bool Is() const { return mpScToken != nullptr; }
 StackVar GetType() const { return mpScToken ? mpScToken->GetType() : 
static_cast< StackVar >( svUnknown ); }
-OpCode   GetOpCode() const { return mpScToken ? mpScToken->GetOpCode() 
: static_cast< OpCode >( ocNone ); }
+OpCode   GetOpCode() const { return mpScToken ? mpScToken->GetOpCode() 
: ocNone; }
 };
 
 /** Effective token class conversion types. */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: formula/source sc/source

2016-10-24 Thread Winfried Donkers
 formula/source/core/api/token.cxx|4 
 sc/source/core/tool/interpr3.cxx |   13 +++--
 sc/source/filter/excel/xeformula.cxx |1 +
 sc/source/ui/src/scfuncs.src |2 +-
 4 files changed, 13 insertions(+), 7 deletions(-)

New commits:
commit 536258758a9192ce8985d5055edac600568120fc
Author: Winfried Donkers 
Date:   Fri Oct 14 17:34:47 2016 +0200

tdf#103186, make LOGINV ODFF1.2 compliant.

(Also retain Excel-interoperability and backward compatibility with Calc.)

Change-Id: Ibbe7224eabfb776cf6e7ecfeabae6d188178f4ed
Reviewed-on: https://gerrit.libreoffice.org/29885
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

diff --git a/formula/source/core/api/token.cxx 
b/formula/source/core/api/token.cxx
index 7c85b15..409c417 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -1069,6 +1069,7 @@ inline bool MissingConventionODF::isRewriteNeeded( OpCode 
eOp ) const
 case ocGammaDist:
 case ocPoissonDist:
 case ocAddress:
+case ocLogInv:
 case ocLogNormDist:
 case ocNormDist:
 return true;
@@ -1113,6 +1114,7 @@ inline bool MissingConventionOOXML::isRewriteNeeded( 
OpCode eOp )
 case ocFDist_LT:
 case ocPoissonDist:
 case ocNormDist:
+case ocLogInv:
 case ocLogNormDist:
 case ocHypGeomDist:
 
@@ -1171,6 +1173,7 @@ void FormulaMissingContext::AddMoreArgs( 
FormulaTokenArray *pNewArr, const Missi
 pNewArr->AddDouble( 1.0 );  // 4th, 
Cumulative=true()
 }
 break;
+case ocLogInv:
 case ocLogNormDist:
 if ( mnCurArg == 0 )
 {
@@ -1236,6 +1239,7 @@ void FormulaMissingContext::AddMoreArgs( 
FormulaTokenArray *pNewArr, const Missi
 }
 break;
 
+case ocLogInv:
 case ocLogNormDist:
 if ( mnCurArg == 0 )
 {
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 04b0343..66ca35c 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -2147,15 +2147,16 @@ void ScInterpreter::ScSNormInv()
 
 void ScInterpreter::ScLogNormInv()
 {
-if ( MustHaveParamCount( GetByte(), 3 ) )
+sal_uInt8 nParamCount = GetByte();
+if ( MustHaveParamCount( nParamCount, 1, 3 ) )
 {
-double sigma = GetDouble(); // Stdabw
-double mue = GetDouble();   // Mittelwert
-double y = GetDouble(); // y
-if (sigma <= 0.0 || y <= 0.0 || y >= 1.0)
+double fSigma = ( nParamCount == 3 ? GetDouble() : 1.0 );  // Stddev
+double fMue = ( nParamCount >= 2 ? GetDouble() : 0.0 );// Mean
+double fP = GetDouble();   // p
+if ( fSigma <= 0.0 || fP <= 0.0 || fP >= 1.0 )
 PushIllegalArgument();
 else
-PushDouble(exp(mue+sigma*gaussinv(y)));
+PushDouble( exp( fMue + fSigma * gaussinv( fP ) ) );
 }
 }
 
diff --git a/sc/source/filter/excel/xeformula.cxx 
b/sc/source/filter/excel/xeformula.cxx
index b810279..9326121 100644
--- a/sc/source/filter/excel/xeformula.cxx
+++ b/sc/source/filter/excel/xeformula.cxx
@@ -1736,6 +1736,7 @@ void XclExpFmlaCompImpl::AppendTrailingParam( 
XclExpFuncData& rFuncData )
 break;
 
 case ocLogNormDist:
+case ocLogInv:
 switch( nParamCount )
  {
 // LOGNORMDIST function needs 3 parameters in Excel
diff --git a/sc/source/ui/src/scfuncs.src b/sc/source/ui/src/scfuncs.src
index 84dcc9b..061e7a3 100644
--- a/sc/source/ui/src/scfuncs.src
+++ b/sc/source/ui/src/scfuncs.src
@@ -7600,7 +7600,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
 0;
 ID_FUNCTION_GRP_STATISTIC;
 HID_FUNC_LOGINV;
-3;  0;  0;  0;
+3;  0;  1;  1;
 0;
 };
 String 2 // Name of Parameter 1
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: formula/source sc/source

2016-10-14 Thread Winfried Donkers
 formula/source/core/api/token.cxx |   16 
 sc/source/core/inc/interpre.hxx   |3 +--
 sc/source/core/tool/interpr3.cxx  |   38 ++
 sc/source/core/tool/interpr4.cxx  |4 ++--
 sc/source/ui/src/scfuncs.src  |   10 +-
 5 files changed, 38 insertions(+), 33 deletions(-)

New commits:
commit cf43ff5262a111f9fbebe58d254b704ec057cbf6
Author: Winfried Donkers 
Date:   Thu Oct 13 13:49:18 2016 +0200

tdf#102948 Make HYPGEOMDIST ODFF1.2 compliant.

Also reduce duplicate code.
On Export to OOXML, HYPGEOMDIST is converted to HYPGEOM.DIST.

Change-Id: I70a70ee6b5c542e272ef574073ebcd1924f31083
Reviewed-on: https://gerrit.libreoffice.org/29767
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

diff --git a/formula/source/core/api/token.cxx 
b/formula/source/core/api/token.cxx
index 7d5528c..a9abdd0 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -,10 +,12 @@ inline bool MissingConventionOOXML::isRewriteNeeded( 
OpCode eOp )
 case ocPoissonDist:
 case ocNormDist:
 case ocLogNormDist:
+case ocHypGeomDist:
 
 case ocDBCount:
 case ocDBCount2:
 return true;
+
 default:
 return false;
 }
@@ -1244,6 +1246,14 @@ void FormulaMissingContext::AddMoreArgs( 
FormulaTokenArray *pNewArr, const Missi
 }
 break;
 
+case ocHypGeomDist:
+if ( mnCurArg == 3 )
+{
+pNewArr->AddOpCode( ocSep );
+pNewArr->AddDouble( 0.0 );  // 5th, Cumulative 
= false()
+}
+break;
+
 case ocRound:
 case ocRoundUp:
 case ocRoundDown:
@@ -1515,6 +1525,12 @@ FormulaTokenArray * FormulaTokenArray::RewriteMissing( 
const MissingConvention &
 ( pCur->GetOpCode() == ocCeil ? ocCeil_Math : 
ocFloor_Math ) );
 pNewArr->Add( pToken );
 }
+else if ( pCur->GetOpCode() == ocHypGeomDist &&
+  rConv.getConvention() == 
MissingConvention::FORMULA_MISSING_CONVENTION_OOXML )
+{
+FormulaToken *pToken = new FormulaToken( svByte, 
ocHypGeomDist_MS );
+pNewArr->Add( pToken );
+}
 else
 pNewArr->AddToken( *pCur );
 }
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index fadd474..47d5afd 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -866,8 +866,7 @@ void ScCombinA();
 void ScPermut();
 void ScPermutationA();
 void ScB();
-void ScHypGeomDist();
-void ScHypGeomDist_MS();
+void ScHypGeomDist( int nMinParamCount );
 void ScLogNormDist( int nMinParamCount );
 void ScLogNormInv();
 void ScTDist();
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 18f8e33..04b0343 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -1844,39 +1844,21 @@ static void lcl_PutFactorialElements( ::std::vector< 
double >& cn, double fLower
 
 @see #i47296#
 
- */
-void ScInterpreter::ScHypGeomDist()
-{
-if ( !MustHaveParamCount( GetByte(), 4 ) )
-return;
-
-double N = ::rtl::math::approxFloor(GetDouble());
-double M = ::rtl::math::approxFloor(GetDouble());
-double n = ::rtl::math::approxFloor(GetDouble());
-double x = ::rtl::math::approxFloor(GetDouble());
-
-if( (x < 0.0) || (n < x) || (M < x) || (N < n) || (N < M) || (x < n - N + 
M) )
-{
-PushIllegalArgument();
-return;
-}
-
-PushDouble( GetHypGeomDist( x, n, M, N ) );
-}
-
-/** Calculates a value of the hypergeometric distribution (Excel 2010 
function).
-
-This function has an extra argument bCumulative as compared to 
ScHypGeomDist(),
-which only calculates the non-cumulative distribution.
+This function has an extra argument bCumulative,
+which only calculates the non-cumulative distribution and
+which is optional in Calc and mandatory with Excel's HYPGEOM.DIST()
 
 @see fdo#71722
-*/
-void ScInterpreter::ScHypGeomDist_MS()
+@see tdf#102948, make Calc function ODFF1.2-compliant
+
+ */
+void ScInterpreter::ScHypGeomDist( int nMinParamCount )
 {
-if ( !MustHaveParamCount( GetByte(), 5 ) )
+sal_uInt8 nParamCount = GetByte();
+if ( !MustHaveParamCount( nParamCount, nMinParamCount, 5 ) )
 return;
 
-bool bCumulative = GetBool();
+bool bCumulative = ( nParamCount == 5 && GetBool() );
 double N = ::rtl::math::approxFloor(GetDouble());
 double M = ::rtl::math::approxFloor(GetDouble());
 double 

[Libreoffice-commits] core.git: formula/source sc/source

2016-08-26 Thread Eike Rathke
 formula/source/core/api/FormulaCompiler.cxx |   91 +---
 sc/source/core/tool/compiler.cxx|   18 +
 2 files changed, 102 insertions(+), 7 deletions(-)

New commits:
commit f551477ab32ad2671d85a3070a0a436715ea7505
Author: Eike Rathke 
Date:   Fri Aug 26 16:31:33 2016 +0200

handle overwriting of symbols/opcodes in symbol map for known cases

This silences the SAL_WARN_IF like
warn:formula.core:6944:1:formula/source/core/api/FormulaCompiler.cxx:625:
OpCodeMap::putOpCode: reusing OpCode 161,
replacing '_xlfn.ORG.OPENOFFICE.ERRORTYPE' with 'ERRORTYPE'
in English map 0x1018000

that occurred during the first load of OOXML .xlsx documents since the
old bad entries were added with commit
89c4a69103b6e15e7f52401c51110b926c3ccf36

In fact the direction opcode -> string was replaced, which it should had
not. That specific mapping is only used though when loading msoxl
namespace formulas from ODF.

Also, the replacement of parameter separator and array column and row
separator worked merely by chance, depending on in which order the
entries where inserted to the hash map. Fixed along as it popped up with
the new handling.

Change-Id: I88017a8b38ccc30874c3dca7d78f0fa47a77a36f

diff --git a/formula/source/core/api/FormulaCompiler.cxx 
b/formula/source/core/api/FormulaCompiler.cxx
index 7354cfc..be19fcf 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -617,14 +617,91 @@ void FormulaCompiler::OpCodeMap::putOpCode( const 
OUString & rStr, const OpCode
 {
 if (0 < eOp && sal_uInt16(eOp) < mnSymbols)
 {
-SAL_WARN_IF( !(mpTable[eOp].isEmpty() || (mpTable[eOp] == rStr) ||
-(eOp == ocCurrency) || (eOp == ocSep) || (eOp == 
ocArrayColSep) ||
-(eOp == ocArrayRowSep)), "formula.core",
-"OpCodeMap::putOpCode: reusing OpCode " << 
static_cast(eOp)
-<< ", replacing '" << mpTable[eOp] << "' with '" << rStr << "' 
in "
-<< (mbEnglish ? "" : "non-") << "English map 0x" << ::std::hex 
<< meGrammar);
+bool bPutOp = mpTable[eOp].isEmpty();
+bool bRemoveFromMap = false;
+if (!bPutOp)
+{
+switch (eOp)
+{
+// These OpCodes are meant to overwrite and also remove an
+// existing mapping.
+case ocCurrency:
+bPutOp = true;
+bRemoveFromMap = true;
+break;
+// These separator OpCodes are meant to overwrite and also
+// remove an existing mapping if it is not used for one of the
+// other separators.
+case ocArrayColSep:
+bPutOp = true;
+bRemoveFromMap = (mpTable[ocArrayRowSep] != mpTable[eOp] 
&& mpTable[ocSep] != mpTable[eOp]);
+break;
+case ocArrayRowSep:
+bPutOp = true;
+bRemoveFromMap = (mpTable[ocArrayColSep] != mpTable[eOp] 
&& mpTable[ocSep] != mpTable[eOp]);
+break;
+// For ocSep keep the ";" in map but remove any other if it is
+// not used for ocArrayColSep or ocArrayRowSep.
+case ocSep:
+bPutOp = true;
+bRemoveFromMap = (mpTable[eOp] != ";" &&
+mpTable[ocArrayColSep] != mpTable[eOp] &&
+mpTable[ocArrayColSep] != mpTable[eOp]);
+break;
+// These OpCodes are known to be duplicates in the Excel
+// external API mapping because of different parameter counts
+// in different BIFF versions. Names are identical and entries
+// are ignored.
+case ocLinest:
+case ocTrend:
+case ocLogest:
+case ocGrowth:
+case ocTrunc:
+case ocFixed:
+case ocGetDayOfWeek:
+case ocHLookup:
+case ocVLookup:
+case ocGetDiffDate360:
+if (rStr == mpTable[eOp])
+return;
+SAL_FALLTHROUGH;
+// These OpCodes are known to be added to an existing mapping,
+// but only for the OOXML external API mapping. This is *not*
+// FormulaLanguage::OOXML. Keep the first
+// (correct) definition for the OpCode, all following are
+// additional alias entries in the map.
+case ocErrorType:
+case ocMultiArea:
+case ocBackSolver:
+case ocEasterSunday:
+case ocCurrent:
+case ocStyle:
+if (mbEnglish &&
+  

[Libreoffice-commits] core.git: formula/source sc/source

2016-07-14 Thread Eike Rathke
 formula/source/core/resource/core_resource.src |   10 +-
 sc/source/core/tool/compiler.cxx   |9 +++--
 2 files changed, 12 insertions(+), 7 deletions(-)

New commits:
commit 69a3f884a511fdd9ed6703cbbd1955f3fbf4472d
Author: Eike Rathke 
Date:   Thu Jul 14 19:41:03 2016 +0200

yet more functions to save with prefix and namespace to OOXML

MULTIRANGE, GOALSEEK, EASTERSUNDAY, CURRENT and STYLE are LibreOffice /
OpenOffice.org only and need a _xlfn.ORG.OPENOFFICE. prefix and namespace 
when
saved to OOXML.

Change-Id: Ie5d4eb14b1ec958f9ebec5f149d0d1d7b4dd644e

diff --git a/formula/source/core/resource/core_resource.src 
b/formula/source/core/resource/core_resource.src
index 0a1699d..d32a578 100644
--- a/formula/source/core/resource/core_resource.src
+++ b/formula/source/core/resource/core_resource.src
@@ -505,7 +505,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML
 String SC_OPCODE_GET_ACT_DATE { Text = "TODAY" ; };
 String SC_OPCODE_GET_ACT_TIME { Text = "NOW" ; };
 String SC_OPCODE_NO_VALUE { Text = "NA" ; };
-String SC_OPCODE_CURRENT { Text = "CURRENT" ; };
+String SC_OPCODE_CURRENT { Text = "_xlfn.ORG.OPENOFFICE.CURRENT" ; };
 String SC_OPCODE_DEG { Text = "DEGREES" ; };
 String SC_OPCODE_RAD { Text = "RADIANS" ; };
 String SC_OPCODE_SIN { Text = "SIN" ; };
@@ -706,7 +706,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML
 String SC_OPCODE_LOOKUP { Text = "LOOKUP" ; };
 String SC_OPCODE_V_LOOKUP { Text = "VLOOKUP" ; };
 String SC_OPCODE_H_LOOKUP { Text = "HLOOKUP" ; };
-String SC_OPCODE_MULTI_AREA { Text = "MULTIRANGE" ; };  // legacy for 
range list (union)
+String SC_OPCODE_MULTI_AREA { Text = "_xlfn.ORG.OPENOFFICE.MULTIRANGE" ; 
};  // legacy for range list (union)
 String SC_OPCODE_OFFSET { Text = "OFFSET" ; };
 String SC_OPCODE_INDEX { Text = "INDEX" ; };
 String SC_OPCODE_AREAS { Text = "AREAS" ; };
@@ -739,7 +739,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML
 String SC_OPCODE_MAT_MULT { Text = "MMULT" ; };
 String SC_OPCODE_MAT_TRANS { Text = "TRANSPOSE" ; };
 String SC_OPCODE_MATRIX_UNIT { Text = "_xlfn.MUNIT" ; };
-String SC_OPCODE_BACK_SOLVER { Text = "GOALSEEK" ; };
+String SC_OPCODE_BACK_SOLVER { Text = "_xlfn.ORG.OPENOFFICE.GOALSEEK" ; };
 String SC_OPCODE_HYP_GEOM_DIST { Text = "HYPGEOMDIST" ; };
 String SC_OPCODE_HYP_GEOM_DIST_MS { Text = "_xlfn.HYPGEOM.DIST" ; };
 String SC_OPCODE_LOG_NORM_DIST { Text = "LOGNORMDIST" ; };
@@ -846,13 +846,13 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML
 String SC_OPCODE_WEEK { Text = "WEEKNUM" ; };
 String SC_OPCODE_ISOWEEKNUM { Text = "_xlfn.ISOWEEKNUM" ; };
 String SC_OPCODE_WEEKNUM_OOO { Text = "_xlfn.ORG.LIBREOFFICE.WEEKNUM_OOO" 
; };
-String SC_OPCODE_EASTERSUNDAY { Text = "EASTERSUNDAY" ; };
+String SC_OPCODE_EASTERSUNDAY { Text = "_xlfn.ORG.OPENOFFICE.EASTERSUNDAY" 
; };
 String SC_OPCODE_GET_DAY_OF_WEEK { Text = "WEEKDAY" ; };
 String SC_OPCODE_NETWORKDAYS { Text = "NETWORKDAYS" ; };
 String SC_OPCODE_NETWORKDAYS_MS { Text = "NETWORKDAYS.INTL" ; };
 String SC_OPCODE_WORKDAY_MS { Text = "WORKDAY.INTL" ; };
 String SC_OPCODE_NO_NAME { Text = "#NAME!" ; };
-String SC_OPCODE_STYLE { Text = "STYLE" ; };
+String SC_OPCODE_STYLE { Text = "_xlfn.ORG.OPENOFFICE.STYLE" ; };
 String SC_OPCODE_DDE { Text = "DDE" ; };
 String SC_OPCODE_BASE { Text = "_xlfn.BASE" ; };
 String SC_OPCODE_DECIMAL { Text = "_xlfn.DECIMAL" ; };
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 44ab14b..be8810a 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2750,8 +2750,13 @@ bool ScCompiler::IsOpCode( const OUString& rName, bool 
bInArray )
 OpCode  eOp;
 };
 static const FunctionName aOoxmlAliases[] = {
-{ "EFFECTIVE",  ocEffect }, // EFFECTIVE -> EFFECT
-{ "ERRORTYPE",  ocErrorType }   // ERRORTYPE -> 
_xlfn.ORG.OPENOFFICE.ERRORTYPE
+{ "EFFECTIVE",  ocEffect }, // EFFECTIVE -> EFFECT
+{ "ERRORTYPE",  ocErrorType },  // ERRORTYPE -> 
_xlfn.ORG.OPENOFFICE.ERRORTYPE
+{ "MULTIRANGE", ocMultiArea },  // MULTIRANGE -> 
_xlfn.ORG.OPENOFFICE.MULTIRANGE
+{ "GOALSEEK",   ocBackSolver }, // GOALSEEK -> 
_xlfn.ORG.OPENOFFICE.GOALSEEK
+{ "EASTERSUNDAY",   ocEasterSunday },   // EASTERSUNDAY -> 
_xlfn.ORG.OPENOFFICE.EASTERSUNDAY
+{ "CURRENT",ocCurrent },// CURRENT -> 
_xlfn.ORG.OPENOFFICE.CURRENT
+{ "STYLE",  ocStyle }   // STYLE -> 
_xlfn.ORG.OPENOFFICE.STYLE
 };
 for (const FunctionName& rOoxmlAlias : aOoxmlAliases)
 {
___
Libreoffice-commits mailing list

[Libreoffice-commits] core.git: formula/source sc/source

2016-07-14 Thread Eike Rathke
 formula/source/core/resource/core_resource.src |2 +-
 sc/source/core/tool/compiler.cxx   |3 ++-
 sc/source/filter/excel/xlformula.cxx   |9 -
 3 files changed, 11 insertions(+), 3 deletions(-)

New commits:
commit feef105196021c03191d22dd952d8c82276a7bd0
Author: Eike Rathke 
Date:   Thu Jul 14 18:15:14 2016 +0200

save ERRORTYPE as _xlfn.ORG.OPENOFFICE.ERRORTYPE to OOXML

Was wrongly saved as ERRORTYPE without _xlfn. prefix and namespace.
Be able to still read ERRORTYPE.

Change-Id: Ia028fe06d930f60b4260adf589ee3190b90ea099

diff --git a/formula/source/core/resource/core_resource.src 
b/formula/source/core/resource/core_resource.src
index 6a2d7d2..0a1699d 100644
--- a/formula/source/core/resource/core_resource.src
+++ b/formula/source/core/resource/core_resource.src
@@ -585,7 +585,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML
 String SC_OPCODE_S_NORM_INV_MS { Text = "_xlfn.NORM.S.INV" ; };
 String SC_OPCODE_GAMMA_LN { Text = "GAMMALN" ; };
 String SC_OPCODE_GAMMA_LN_MS { Text = "_xlfn.GAMMALN.PRECISE" ; };
-String SC_OPCODE_ERROR_TYPE { Text = "ERRORTYPE" ; };
+String SC_OPCODE_ERROR_TYPE { Text = "_xlfn.ORG.OPENOFFICE.ERRORTYPE" ; };
 String SC_OPCODE_ERROR_TYPE_ODF { Text = "ERROR.TYPE" ; };
 String SC_OPCODE_FORMULA { Text = "_xlfn.FORMULATEXT"; };
 String SC_OPCODE_ARC_TAN_2 { Text = "ATAN2" ; };
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 8cb9534..44ab14b 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2750,7 +2750,8 @@ bool ScCompiler::IsOpCode( const OUString& rName, bool 
bInArray )
 OpCode  eOp;
 };
 static const FunctionName aOoxmlAliases[] = {
-{ "EFFECTIVE",  ocEffect }  // EFFECTIVE -> EFFECT
+{ "EFFECTIVE",  ocEffect }, // EFFECTIVE -> EFFECT
+{ "ERRORTYPE",  ocErrorType }   // ERRORTYPE -> 
_xlfn.ORG.OPENOFFICE.ERRORTYPE
 };
 for (const FunctionName& rOoxmlAlias : aOoxmlAliases)
 {
diff --git a/sc/source/filter/excel/xlformula.cxx 
b/sc/source/filter/excel/xlformula.cxx
index 0e9257f..809fb5b 100644
--- a/sc/source/filter/excel/xlformula.cxx
+++ b/sc/source/filter/excel/xlformula.cxx
@@ -259,7 +259,7 @@ static const XclFunctionInfo saFuncTable_4[] =
 { ocRank,   216,2,  3,  V, { VR, RO, VR }, 0, nullptr },
 { ocDB, 247,4,  5,  V, { VR }, 0, nullptr },
 { ocFrequency,  252,2,  2,  A, { RA }, 0, nullptr },
-{ ocErrorType,  261,1,  1,  V, { VR }, 0, nullptr },
+{ ocErrorType_ODF,  261,1,  1,  V, { VR }, 0, nullptr },
 { ocAveDev, 269,1,  MX, V, { RX }, 0, nullptr },
 { ocBetaDist,   270,3,  5,  V, { VR }, 0, nullptr },
 { ocGammaLn,271,1,  1,  V, { VR }, 0, nullptr },
@@ -605,9 +605,15 @@ static const XclFunctionInfo saFuncTable_Odf[] =
 { opcode, NOID, minparam, maxparam, V, { VR },   
EXC_FUNCFLAG_IMPORTONLY|(flags), EXC_FUNCNAME( asciiname ) }, \
 { opcode,  255, (minparam)+1, (maxparam)+1, V, { RO_E, RO }, 
EXC_FUNCFLAG_EXPORTONLY|(flags), EXC_FUNCNAME( asciiname ) }
 
+// Import Broken Raw ... even without leading _xlfn.
+#define EXC_FUNCENTRY_OOO_IBR( opcode, minparam, maxparam, flags, asciiname ) \
+{ opcode, NOID, minparam, maxparam, V, { VR },   
EXC_FUNCFLAG_IMPORTONLY|(flags), asciiname }
+
 /** Functions defined by Calc, but not in OpenFormula nor supported by Excel. 
*/
 static const XclFunctionInfo saFuncTable_OOoLO[] =
 {
+EXC_FUNCENTRY_OOO( ocErrorType, 1,  1,  0,  "ORG.OPENOFFICE.ERRORTYPE" 
),
+EXC_FUNCENTRY_OOO_IBR( ocErrorType, 1,  1,  0,  "ERRORTYPE" ),  // was 
written wrongly, read it
 EXC_FUNCENTRY_OOO( ocConvert,   3,  3,  0,  "ORG.OPENOFFICE.CONVERT" ),
 EXC_FUNCENTRY_OOO( ocColor, 3,  4,  0,  "ORG.LIBREOFFICE.COLOR" ),
 EXC_FUNCENTRY_OOO( ocRawSubtract,   2, MX,  0,  
"ORG.LIBREOFFICE.RAWSUBTRACT" ),
@@ -617,6 +623,7 @@ static const XclFunctionInfo saFuncTable_OOoLO[] =
 EXC_FUNCENTRY_OOO( ocForecast_ETS_STM, 3,  6,  0,  
"ORG.LIBREOFFICE.FORECAST.ETS.STAT.MULT" )
 };
 
+#undef EXC_FUNCENTRY_OOO_IBR
 #undef EXC_FUNCENTRY_OOO
 
 XclFunctionProvider::XclFunctionProvider( const XclRoot& rRoot )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: formula/source sc/source

2016-06-27 Thread Eike Rathke
 formula/source/core/resource/core_resource.src |3 ++
 sc/source/core/tool/compiler.cxx   |   26 +
 2 files changed, 29 insertions(+)

New commits:
commit 2795cb694b6563772e1326b74cfd678ed251681f
Author: Eike Rathke 
Date:   Mon Jun 27 16:37:56 2016 +0200

add an isPODF() block to ScCompiler::IsOpCode(), tdf#100641 related

... as we can't rename RID_STRLIST_FUNCTION_NAMES_ENGLISH names.

Should we need yet another resource block to differentiate between
PODF/API names and actual always available English names? Ugly but
maybe. A much better approach would be if Text[en-US] would be always
available, additionally to the current localized resource.

Change-Id: If8eaf18643f4e24c811149c52efff1097a3c1596

diff --git a/formula/source/core/resource/core_resource.src 
b/formula/source/core/resource/core_resource.src
index 2124218a..6a2d7d2 100644
--- a/formula/source/core/resource/core_resource.src
+++ b/formula/source/core/resource/core_resource.src
@@ -896,6 +896,9 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML
 // DO NOT CHANGE NAMES! Only add functions.
 // These English names are used internally to store/load ODF v1.0/v1.1 and for
 // API XFunctionAccess.
+// If there is a reason for another name for some function then add an
+// *additional* name to be recognized to sc/source/core/tool/compiler.cxx
+// ScCompiler::IsOpCode() in the else if (mxSymbols->isPODF()) block.
 Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH
 {
 String SC_OPCODE_IF { Text = "IF" ; };
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index e5a91be..2ed3d59 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2762,6 +2762,32 @@ bool ScCompiler::IsOpCode( const OUString& rName, bool 
bInArray )
 }
 }
 }
+else if (mxSymbols->isPODF())
+{
+// PODF names are ODF 1.0/1.1 and also used in API XFunctionAccess.
+// We can't rename them in
+// formula/source/core/resource/core_resource.src but can add
+// additional names to be recognized here so they match the UI names if
+// those are renamed.
+struct FunctionName
+{
+const sal_Char* pName;
+OpCode  eOp;
+};
+static const FunctionName aPodfAliases[] = {
+{ "EFFECT",  ocEffect }  // EFFECTIVE -> EFFECT
+};
+for (const FunctionName& rPodfAlias : aPodfAliases)
+{
+if (rName.equalsIgnoreAsciiCaseAscii( rPodfAlias.pName))
+{
+maRawToken.SetOpCode( rPodfAlias.eOp);
+bFound = true;
+break;  // for
+}
+}
+}
+
 if (!bFound)
 {
 OUString aIntName;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: formula/source sc/source

2016-03-14 Thread Eike Rathke
 formula/source/core/resource/core_resource.src |   16 
 sc/source/filter/oox/formulabase.cxx   |   10 +-
 2 files changed, 13 insertions(+), 13 deletions(-)

New commits:
commit 0aa29f32f9c39f598f43cdf3664b89d6cb151b17
Author: Eike Rathke 
Date:   Mon Mar 14 15:43:50 2016 +0100

prefix domain namespace to FORECAST.* functions for ODFF, tdf#94635 
follow-up

Change-Id: If875b538f2143eb572371dfcc086145c2f6e80f5

diff --git a/formula/source/core/resource/core_resource.src 
b/formula/source/core/resource/core_resource.src
index 1d6c15d..0fb5a63 100644
--- a/formula/source/core/resource/core_resource.src
+++ b/formula/source/core/resource/core_resource.src
@@ -368,14 +368,14 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF
 String SC_OPCODE_LINEST { Text = "LINEST" ; };
 String SC_OPCODE_LOGEST { Text = "LOGEST" ; };
 String SC_OPCODE_FORECAST { Text = "FORECAST" ; };
-String SC_OPCODE_FORECAST_ETS_ADD { Text = "FORECAST.ETS" ; };
-String SC_OPCODE_FORECAST_ETS_SEA { Text = "FORECAST.ETS.SEASONALITY" ; };
-String SC_OPCODE_FORECAST_ETS_MUL { Text = "FORECAST.ETS.MULT" ; };
-String SC_OPCODE_FORECAST_ETS_PIA { Text = "FORECAST.ETS.CONFINT" ; };
-String SC_OPCODE_FORECAST_ETS_PIM { Text = "FORECAST.ETS.PI.MULT" ; };
-String SC_OPCODE_FORECAST_ETS_STA { Text = "FORECAST.ETS.STAT" ; };
-String SC_OPCODE_FORECAST_ETS_STM { Text = "FORECAST.ETS.STAT.MULT" ; };
-String SC_OPCODE_FORECAST_LIN { Text = "FORECAST.LINEAR" ; };
+String SC_OPCODE_FORECAST_ETS_ADD { Text = "COM.MICROSOFT.FORECAST.ETS" ; 
};
+String SC_OPCODE_FORECAST_ETS_SEA { Text = 
"COM.MICROSOFT.FORECAST.ETS.SEASONALITY" ; };
+String SC_OPCODE_FORECAST_ETS_MUL { Text = 
"ORG.LIBREOFFICE.FORECAST.ETS.MULT" ; };
+String SC_OPCODE_FORECAST_ETS_PIA { Text = 
"COM.MICROSOFT.FORECAST.ETS.CONFINT" ; };
+String SC_OPCODE_FORECAST_ETS_PIM { Text = 
"ORG.LIBREOFFICE.FORECAST.ETS.PI.MULT" ; };
+String SC_OPCODE_FORECAST_ETS_STA { Text = 
"COM.MICROSOFT.FORECAST.ETS.STAT" ; };
+String SC_OPCODE_FORECAST_ETS_STM { Text = 
"ORG.LIBREOFFICE.FORECAST.ETS.STAT.MULT" ; };
+String SC_OPCODE_FORECAST_LIN { Text = "COM.MICROSOFT.FORECAST.LINEAR" ; };
 String SC_OPCODE_CHI_INV { Text = "LEGACY.CHIINV" ; };
 String SC_OPCODE_CHI_INV_MS { Text = "COM.MICROSOFT.CHISQ.INV.RT" ; };
 String SC_OPCODE_GAMMA_DIST { Text = "GAMMADIST" ; };
diff --git a/sc/source/filter/oox/formulabase.cxx 
b/sc/source/filter/oox/formulabase.cxx
index 41190f0..2e1a4a9 100644
--- a/sc/source/filter/oox/formulabase.cxx
+++ b/sc/source/filter/oox/formulabase.cxx
@@ -904,11 +904,11 @@ static const FunctionData saFuncTable2013[] =
 /* FIXME: BIFF12 function identifiers available? Where to obtain? */
 static const FunctionData saFuncTable2016[] =
 {
-{ "FORECAST.ETS", "FORECAST.ETS", NOID,   NOID,   
3,  6,  V, { VR, VA, VR }, FUNCFLAG_MACROCALL_NEW },
-{ "FORECAST.ETS.CONFINT", "FORECAST.ETS.CONFINT", NOID,   NOID,   
4,  7,  V, { VR, VA, VR }, FUNCFLAG_MACROCALL_NEW },
-{ "FORECAST.ETS.SEASONALITY", "FORECAST.ETS.SEASONALITY", NOID,   NOID,   
2,  4,  V, { VR, VA, VR }, FUNCFLAG_MACROCALL_NEW },
-{ "FORECAST.ETS.STAT","FORECAST.ETS.STAT",NOID,   NOID,   
3,  6,  V, { VR, VA, VR }, FUNCFLAG_MACROCALL_NEW },
-{ "FORECAST.LINEAR",  "FORECAST.LINEAR",  NOID,   NOID,   
3,  3,  V, { VR, VA }, FUNCFLAG_MACROCALL_NEW }
+{ "COM.MICROSOFT.FORECAST.ETS", "FORECAST.ETS", 
NOID,   NOID,   3,  6,  V, { VR, VA, VR }, FUNCFLAG_MACROCALL_NEW },
+{ "COM.MICROSOFT.FORECAST.ETS.CONFINT", "FORECAST.ETS.CONFINT", 
NOID,   NOID,   4,  7,  V, { VR, VA, VR }, FUNCFLAG_MACROCALL_NEW },
+{ "COM.MICROSOFT.FORECAST.ETS.SEASONALITY", "FORECAST.ETS.SEASONALITY", 
NOID,   NOID,   2,  4,  V, { VR, VA, VR }, FUNCFLAG_MACROCALL_NEW },
+{ "COM.MICROSOFT.FORECAST.ETS.STAT","FORECAST.ETS.STAT",
NOID,   NOID,   3,  6,  V, { VR, VA, VR }, FUNCFLAG_MACROCALL_NEW },
+{ "COM.MICROSOFT.FORECAST.LINEAR",  "FORECAST.LINEAR",  
NOID,   NOID,   3,  3,  V, { VR, VA }, FUNCFLAG_MACROCALL_NEW }
 };
 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: formula/source sc/source

2015-09-28 Thread Winfried Donkers
 formula/source/core/resource/core_resource.src |2 +-
 sc/source/core/tool/compiler.cxx   |1 +
 sc/source/filter/oox/formulabase.cxx   |2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 5ba0f79e246ea970d16f366640c2ccd87e1d8786
Author: Winfried Donkers 
Date:   Wed Sep 23 10:17:21 2015 +0200

tdf#94214 ODFF function FINV incorrectly saved as COM.MICROSOFT.F.INV

Change-Id: Ic053342fde436a7053c15e32683e09b9e91f5308
Reviewed-on: https://gerrit.libreoffice.org/18792
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

diff --git a/formula/source/core/resource/core_resource.src 
b/formula/source/core/resource/core_resource.src
index 534dafc..ed0aeca 100644
--- a/formula/source/core/resource/core_resource.src
+++ b/formula/source/core/resource/core_resource.src
@@ -378,7 +378,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF
 String SC_OPCODE_T_INV_2T { Text = "COM.MICROSOFT.T.INV.2T" ; };
 String SC_OPCODE_T_INV_MS { Text = "COM.MICROSOFT.T.INV" ; };
 String SC_OPCODE_F_INV { Text = "LEGACY.FINV" ; };
-String SC_OPCODE_F_INV_LT { Text = "COM.MICROSOFT.F.INV" ; };
+String SC_OPCODE_F_INV_LT { Text = "FINV" ; };
 String SC_OPCODE_F_INV_RT { Text = "COM.MICROSOFT.F.INV.RT" ; };
 String SC_OPCODE_CHI_TEST { Text = "LEGACY.CHITEST" ; };
 String SC_OPCODE_CHI_TEST_MS { Text = "COM.MICROSOFT.CHISQ.TEST" ; };
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index d954c2d..50db4f4 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2634,6 +2634,7 @@ bool ScCompiler::IsOpCode( const OUString& rName, bool 
bInArray )
 { "COLOR",  ocColor },  // COLOR -> 
ORG.LIBREOFFICE.COLOR
 { "GOALSEEK",   ocBackSolver }, // GOALSEEK -> 
ORG.OPENOFFICE.GOALSEEK
 { "COM.MICROSOFT.F.DIST", ocFDist_LT }, // fdo#40835, -> FDIST -> 
COM.MICROSOFT.F.DIST
+{ "COM.MICROSOFT.F.INV",  ocFInv_LT }   // tdf#94214, 
COM.MICROSOFT.F.INV -> FINV (ODF)
 // Renamed new names, prepare to read future names:
 //{ "ORG.OPENOFFICE.XXX", ocXXX } // XXX -> 
ORG.OPENOFFICE.XXX
 };
diff --git a/sc/source/filter/oox/formulabase.cxx 
b/sc/source/filter/oox/formulabase.cxx
index e9914c5..b4bcb25 100644
--- a/sc/source/filter/oox/formulabase.cxx
+++ b/sc/source/filter/oox/formulabase.cxx
@@ -775,7 +775,7 @@ static const FunctionData saFuncTable2010[] =
 { "COM.MICROSOFT.CONFIDENCE.T",   "CONFIDENCE.T",NOID,
NOID,   3,  3,  V, { VR }, FUNCFLAG_MACROCALL_NEW },
 { "FDIST","F.DIST",  NOID,   
NOID,4,  4,  V, { VR }, FUNCFLAG_MACROCALL_NEW },
 { "COM.MICROSOFT.F.DIST.RT",  "F.DIST.RT",   NOID,   
NOID,3,  3,  V, { VR }, FUNCFLAG_MACROCALL_NEW },
-{ "COM.MICROSOFT.F.INV",  "F.INV",   NOID,   
NOID,3,  3,  V, { VR }, FUNCFLAG_MACROCALL_NEW },
+{ "FINV", "F.INV",   NOID,   
NOID,3,  3,  V, { VR }, FUNCFLAG_MACROCALL_NEW },
 { "COM.MICROSOFT.F.INV.RT",   "F.INV.RT",NOID,   
NOID,3,  3,  V, { VR }, FUNCFLAG_MACROCALL_NEW },
 { "COM.MICROSOFT.F.TEST", "F.TEST",  NOID,   
NOID,2,  2,  V, { VA }, FUNCFLAG_MACROCALL_NEW },
 { "COM.MICROSOFT.EXPON.DIST", "EXPON.DIST",  NOID,   
NOID,3,  3,  V, { VR }, FUNCFLAG_MACROCALL_NEW },
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: formula/source sc/source

2015-03-24 Thread Winfried Donkers
 formula/source/core/api/token.cxx  |2 ++
 formula/source/core/resource/core_resource.src |2 +-
 sc/source/core/tool/compiler.cxx   |3 ++-
 sc/source/core/tool/interpr3.cxx   |   14 --
 sc/source/filter/oox/formulabase.cxx   |2 +-
 sc/source/ui/src/scfuncs.src   |2 +-
 6 files changed, 19 insertions(+), 6 deletions(-)

New commits:
commit f1f4167bac271f4b7f4ed766db4b077f94fd4daa
Author: Winfried Donkers winfrieddonk...@libreoffice.org
Date:   Thu Feb 26 17:09:10 2015 +0100

tdf#40835 add ODFF function FDIST

and clean up F-Distribution function names.

Change-Id: I859269121b3ea32e8179b42e3497aa86754f
Reviewed-on: https://gerrit.libreoffice.org/14657
Tested-by: Jenkins c...@libreoffice.org
Reviewed-by: Eike Rathke er...@redhat.com
Tested-by: Eike Rathke er...@redhat.com

diff --git a/formula/source/core/api/token.cxx 
b/formula/source/core/api/token.cxx
index 117f276..39067e2 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -1055,6 +1055,7 @@ inline bool MissingConventionOOXML::isRewriteNeeded( 
OpCode eOp ) const
 case ocIndex:
 
 case ocGammaDist:
+case ocFDist_LT:
 case ocPoissonDist:
 case ocNormDist:
 case ocLogNormDist:
@@ -1166,6 +1167,7 @@ void FormulaMissingContext::AddMoreArgs( 
FormulaTokenArray *pNewArr, const Missi
 break;
 
 case ocGammaDist:
+case ocFDist_LT:
 case ocNormDist:
 if (mnCurArg == 2)
 {
diff --git a/formula/source/core/resource/core_resource.src 
b/formula/source/core/resource/core_resource.src
index b6e6f7e..31d5d94 100644
--- a/formula/source/core/resource/core_resource.src
+++ b/formula/source/core/resource/core_resource.src
@@ -299,7 +299,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF
 String SC_OPCODE_T_DIST_MS { Text = COM.MICROSOFT.T.DIST ; };
 String SC_OPCODE_T_DIST_RT { Text = COM.MICROSOFT.T.DIST.RT ; };
 String SC_OPCODE_F_DIST { Text = LEGACY.FDIST ; };
-String SC_OPCODE_F_DIST_LT { Text = COM.MICROSOFT.F.DIST ; };
+String SC_OPCODE_F_DIST_LT { Text = FDIST ; };
 String SC_OPCODE_F_DIST_RT { Text = COM.MICROSOFT.F.DIST.RT ; };
 String SC_OPCODE_CHI_DIST { Text = LEGACY.CHIDIST ; };
 String SC_OPCODE_CHI_DIST_MS { Text = COM.MICROSOFT.CHISQ.DIST.RT ; };
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index ca67769..551f690 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2499,7 +2499,8 @@ bool ScCompiler::IsOpCode( const OUString rName, bool 
bInArray )
 { EASTERSUNDAY,   ocEasterSunday },   // EASTERSUNDAY - 
ORG.OPENOFFICE.EASTERSUNDAY
 { ZGZ,ocRRI },// ZGZ - RRI
 { COLOR,  ocColor },  // COLOR - 
ORG.LIBREOFFICE.COLOR
-{ GOALSEEK,   ocBackSolver }  // GOALSEEK - 
ORG.OPENOFFICE.GOALSEEK
+{ GOALSEEK,   ocBackSolver }, // GOALSEEK - 
ORG.OPENOFFICE.GOALSEEK
+{ COM.MICROSOFT.F.DIST, ocFDist_LT }, // fdo#40835, - FDIST - 
COM.MICROSOFT.F.DIST
 // Renamed new names, prepare to read future names:
 //{ ORG.OPENOFFICE.XXX, ocXXX } // XXX - 
ORG.OPENOFFICE.XXX
 };
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 051bb66..2def402 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -1702,9 +1702,19 @@ void ScInterpreter::ScFDist()
 
 void ScInterpreter::ScFDist_LT()
 {
-if ( !MustHaveParamCount( GetByte(), 4 ) )
+int nParamCount = GetByte();
+if ( !MustHaveParamCount( nParamCount, 3, 4 ) )
 return;
-bool   bCum = GetBool();
+bool bCum;
+if ( nParamCount == 3 )
+bCum = true;
+else if ( IsMissing() )
+{
+bCum = true;
+Pop();
+}
+else
+bCum = GetBool();
 double fF2 = ::rtl::math::approxFloor( GetDouble() );
 double fF1 = ::rtl::math::approxFloor( GetDouble() );
 double fF  = GetDouble();
diff --git a/sc/source/filter/oox/formulabase.cxx 
b/sc/source/filter/oox/formulabase.cxx
index 40d282f..e1237b7 100644
--- a/sc/source/filter/oox/formulabase.cxx
+++ b/sc/source/filter/oox/formulabase.cxx
@@ -773,7 +773,7 @@ static const FunctionData saFuncTable2010[] =
 { COM.MICROSOFT.CHISQ.TEST, CHISQ.TEST,  NOID,
NOID,   2,  2,  V, { VA }, FUNCFLAG_MACROCALL_NEW },
 { COM.MICROSOFT.CONFIDENCE.NORM,CONFIDENCE.NORM, NOID,
NOID,   3,  3,  V, { VR }, FUNCFLAG_MACROCALL_NEW },
 { COM.MICROSOFT.CONFIDENCE.T,   CONFIDENCE.T,NOID,
NOID,   3,  3,  V, { VR }, FUNCFLAG_MACROCALL_NEW },
-{ COM.MICROSOFT.F.DIST, F.DIST,  

[Libreoffice-commits] core.git: formula/source sc/source

2014-08-21 Thread Eike Rathke
 formula/source/core/resource/core_resource.src |3 ++-
 sc/source/core/tool/compiler.cxx   |1 +
 sc/source/filter/excel/xlformula.cxx   |3 ++-
 sc/source/filter/oox/formulabase.cxx   |3 ++-
 4 files changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 7c6a82d66ebe55fa5ce106bf60f841dd7758d2bc
Author: Eike Rathke er...@redhat.com
Date:   Thu Aug 21 15:06:46 2014 +0200

write COLOR function with extension namespace

and add to Excel import/export maps so it survives saving in that format

Change-Id: I3a8e07fdd1bded77d4bad60eefffeb0b1dbdd734

diff --git a/formula/source/core/resource/core_resource.src 
b/formula/source/core/resource/core_resource.src
index 259eda0..6f7f8d5 100644
--- a/formula/source/core/resource/core_resource.src
+++ b/formula/source/core/resource/core_resource.src
@@ -423,7 +423,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF
 /* END defined ERROR.TYPE() values. */
 String SC_OPCODE_FILTERXML { Text = COM.MICROSOFT.FILTERXML;};
 String SC_OPCODE_WEBSERVICE{ Text = COM.MICROSOFT.WEBSERVICE; };
-String SC_OPCODE_COLOR { Text = COLOR; };
+String SC_OPCODE_COLOR { Text = ORG.LIBREOFFICE.COLOR; };
 String SC_OPCODE_ERF_MS { Text = COM.MICROSOFT.ERF.PRECISE ; };
 String SC_OPCODE_ERFC_MS { Text = COM.MICROSOFT.ERFC.PRECISE ; };
 };
@@ -830,6 +830,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML
 /* END defined ERROR.TYPE() values. */
 String SC_OPCODE_FILTERXML { Text = _xlfn.FILTERXML;};
 String SC_OPCODE_WEBSERVICE{ Text = _xlfn.WEBSERVICE; };
+String SC_OPCODE_COLOR { Text = _xlfn.ORG.LIBREOFFICE.COLOR; };
 String SC_OPCODE_ERF_MS { Text = _xlfn.ERF.PRECISE ; };
 String SC_OPCODE_ERFC_MS { Text = _xlfn.ERFC.PRECISE ; };
 };
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 2d7694d..788dd0e 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2424,6 +2424,7 @@ bool ScCompiler::IsOpCode( const OUString rName, bool 
bInArray )
 { TDIST,  ocTDist },  // TDIST - LEGACY.TDIST
 { EASTERSUNDAY,   ocEasterSunday },   // EASTERSUNDAY - 
ORG.OPENOFFICE.EASTERSUNDAY
 { ZGZ,ocZGZ },// ZGZ - RRI
+{ COLOR,  ocColor },  // COLOR - 
ORG.LIBREOFFICE.COLOR
 // Renamed new names, prepare to read future names:
 { ORG.OPENOFFICE.GOALSEEK, ocBackSolver } // GOALSEEK - 
ORG.OPENOFFICE.GOALSEEK
 };
diff --git a/sc/source/filter/excel/xlformula.cxx 
b/sc/source/filter/excel/xlformula.cxx
index 3944c57..abb9c2d 100644
--- a/sc/source/filter/excel/xlformula.cxx
+++ b/sc/source/filter/excel/xlformula.cxx
@@ -589,7 +589,8 @@ static const XclFunctionInfo saFuncTable_Odf[] =
 /** Functions defined by Calc, but not in OpenFormula nor supported by Excel. 
*/
 static const XclFunctionInfo saFuncTable_OOoLO[] =
 {
-EXC_FUNCENTRY_OOO( ocConvert,   3,  3,  0,  ORG.OPENOFFICE.CONVERT )
+EXC_FUNCENTRY_OOO( ocConvert,   3,  3,  0,  ORG.OPENOFFICE.CONVERT ),
+EXC_FUNCENTRY_OOO( ocColor, 3,  4,  0,  ORG.LIBREOFFICE.COLOR )
 };
 
 #undef EXC_FUNCENTRY_OOO
diff --git a/sc/source/filter/oox/formulabase.cxx 
b/sc/source/filter/oox/formulabase.cxx
index b866a77..2459791 100644
--- a/sc/source/filter/oox/formulabase.cxx
+++ b/sc/source/filter/oox/formulabase.cxx
@@ -917,7 +917,8 @@ static const FunctionData saFuncTableOOoLO[] =
 { 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 },
 // Other functions.
-{ ORG.OPENOFFICE.CONVERT, ORG.OPENOFFICE.CONVERT,   NOID,   NOID,  
 3,  3,  V, { VR }, FUNCFLAG_MACROCALL_NEW }
+{ ORG.OPENOFFICE.CONVERT, ORG.OPENOFFICE.CONVERT,   NOID,   NOID,  
 3,  3,  V, { VR }, FUNCFLAG_MACROCALL_NEW },
+{ ORG.LIBREOFFICE.COLOR,  ORG.LIBREOFFICE.COLOR,NOID,   NOID,  
 3,  4,  V, { VR }, FUNCFLAG_MACROCALL_NEW }
 };
 
 const sal_Unicode API_TOKEN_OPEN= '(';
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: formula/source sc/source

2014-08-21 Thread Eike Rathke
 formula/source/core/resource/core_resource.src |2 +-
 sc/source/core/tool/compiler.cxx   |3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

New commits:
commit fe4d72b56319fe7820d973794fc937d79aeec64a
Author: Eike Rathke er...@redhat.com
Date:   Thu Aug 21 15:41:03 2014 +0200

it's about time to write GOALSEEK as ODFF ORG.OPENOFFICE.GOALSEEK

Change-Id: Ie5a0464b49baae62e217e87f4d0040151f3aa8a5

diff --git a/formula/source/core/resource/core_resource.src 
b/formula/source/core/resource/core_resource.src
index 6f7f8d5..b6816c7 100644
--- a/formula/source/core/resource/core_resource.src
+++ b/formula/source/core/resource/core_resource.src
@@ -287,7 +287,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF
 String SC_OPCODE_MAT_MULT { Text = MMULT ; };
 String SC_OPCODE_MAT_TRANS { Text = TRANSPOSE ; };
 String SC_OPCODE_MATRIX_UNIT { Text = MUNIT ; };
-String SC_OPCODE_BACK_SOLVER { Text = GOALSEEK ; };
+String SC_OPCODE_BACK_SOLVER { Text = ORG.OPENOFFICE.GOALSEEK ; };
 String SC_OPCODE_HYP_GEOM_DIST { Text = HYPGEOMDIST ; };
 String SC_OPCODE_HYP_GEOM_DIST_MS { Text = COM.MICROSOFT.HYPGEOM.DIST ; 
};
 String SC_OPCODE_LOG_NORM_DIST { Text = LOGNORMDIST ; };
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 788dd0e..93d8f19 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2425,8 +2425,9 @@ bool ScCompiler::IsOpCode( const OUString rName, bool 
bInArray )
 { EASTERSUNDAY,   ocEasterSunday },   // EASTERSUNDAY - 
ORG.OPENOFFICE.EASTERSUNDAY
 { ZGZ,ocZGZ },// ZGZ - RRI
 { COLOR,  ocColor },  // COLOR - 
ORG.LIBREOFFICE.COLOR
+{ GOALSEEK,   ocBackSolver }  // GOALSEEK - 
ORG.OPENOFFICE.GOALSEEK
 // Renamed new names, prepare to read future names:
-{ ORG.OPENOFFICE.GOALSEEK, ocBackSolver } // GOALSEEK - 
ORG.OPENOFFICE.GOALSEEK
+//{ ORG.OPENOFFICE.XXX, ocXXX } // XXX - 
ORG.OPENOFFICE.XXX
 };
 static const size_t nOdffAliases = sizeof(aOdffAliases) / 
sizeof(aOdffAliases[0]);
 for (size_t i=0; inOdffAliases; ++i)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: formula/source sc/source

2014-08-21 Thread Eike Rathke
 formula/source/ui/dlg/formula.cxx   |2 -
 sc/source/filter/oox/workbookhelper.cxx |2 +
 sc/source/ui/app/scmod.cxx  |6 ++-
 sc/source/ui/docshell/docsh.cxx |2 +
 sc/source/ui/docshell/docsh3.cxx|2 -
 sc/source/ui/docshell/docsh6.cxx|   54 
 sc/source/ui/inc/docsh.hxx  |2 -
 7 files changed, 46 insertions(+), 24 deletions(-)

New commits:
commit c0aba5007b6e468336b41138f099914c32f4b0cf
Author: Eike Rathke er...@redhat.com
Date:   Thu Aug 21 23:14:52 2014 +0200

fdo#82183 do not reset globals while loading a document

Destroying the function list while an instance of the Formula Wizard is
still open is a bad idea. Workaround not doing this when loading a
document due to a DDE function or external reference being entered in
the wizard.

Change-Id: I6fa00fb4f442bf7c9410679e446ff460289e4b16

diff --git a/formula/source/ui/dlg/formula.cxx 
b/formula/source/ui/dlg/formula.cxx
index 3377565..5a2710c 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -1831,7 +1831,7 @@ void FormulaDlg::StoreFormEditData(FormEditData* pData)
 
 const IFunctionDescription* FormulaDlg::getCurrentFunctionDescription() const
 {
-OSL_VERIFY(!m_pImpl-pFuncDesc || 
m_pImpl-pFuncDesc-getSuppressedArgumentCount() == m_pImpl-nArgs);
+//OSL_VERIFY(!m_pImpl-pFuncDesc || 
m_pImpl-pFuncDesc-getSuppressedArgumentCount() == m_pImpl-nArgs);
 return m_pImpl-pFuncDesc;
 }
 
diff --git a/sc/source/filter/oox/workbookhelper.cxx 
b/sc/source/filter/oox/workbookhelper.cxx
index 048f754..bfe360e 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -675,6 +675,8 @@ void WorkbookGlobals::recalcFormulaCells()
 
officecfg::Office::Calc::Formula::Load::OOXMLRecalcMode::set(sal_Int32(0), 
batch);
 ScFormulaOptions aOpt = SC_MOD()-GetFormulaOptions();
 aOpt.SetOOXMLRecalcOptions(bHardRecalc ? RECALC_ALWAYS : 
RECALC_NEVER);
+/** XXX is this really supposed to set the ScModule options?
+Not the ScDocShell options? */
 SC_MOD()-SetFormulaOptions(aOpt);
 
 batch-commit();
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 84eddf0..040e16e 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1034,13 +1034,15 @@ void ScModule::ModifyOptions( const SfxItemSet rOptSet 
)
 if (pFormulaCfg  pFormulaCfg-GetCalcConfig() != 
rOpt.GetCalcConfig())
 bCalcAll = true;
 
-SetFormulaOptions( rOpt );
-
 if ( pDocSh )
 {
 pDocSh-SetFormulaOptions( rOpt );
 pDocSh-SetDocumentModified();
 }
+
+// ScDocShell::SetFormulaOptions() may check for changed settings, so
+// set the new options here after that has been called.
+SetFormulaOptions( rOpt );
 }
 
 // ViewOptions
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 92cc36c..bc1d284 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -484,6 +484,8 @@ bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const 
::com::sun::star::uno::R
 
officecfg::Office::Calc::Formula::Load::ODFRecalcMode::set(sal_Int32(0), batch);
 ScFormulaOptions aOpt = SC_MOD()-GetFormulaOptions();
 aOpt.SetODFRecalcOptions(bHardRecalc ? RECALC_ALWAYS : 
RECALC_NEVER);
+/** XXX is this really supposed to set the ScModule options?
+Not the ScDocShell options? */
 SC_MOD()-SetFormulaOptions(aOpt);
 
 batch-commit();
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 8544435..8424ef5 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -417,7 +417,7 @@ void ScDocShell::InitOptions(bool bForLoading)  // 
called from InitNew and L
 
 aDocument.SetDocOptions( aDocOpt );
 aDocument.SetViewOptions( aViewOpt );
-SetFormulaOptions( aFormulaOpt );
+SetFormulaOptions( aFormulaOpt, bForLoading );
 
 //  Druck-Optionen werden jetzt direkt vor dem Drucken gesetzt
 
diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx
index c6b3dc6..78228eb 100644
--- a/sc/source/ui/docshell/docsh6.cxx
+++ b/sc/source/ui/docshell/docsh6.cxx
@@ -445,32 +445,48 @@ bool ScDocShell::ReloadTabLinks()
 return true;//! Fehler erkennen
 }
 
-void ScDocShell::SetFormulaOptions(const ScFormulaOptions rOpt )
+void ScDocShell::SetFormulaOptions( const ScFormulaOptions rOpt, bool 
bForLoading )
 {
 aDocument.SetGrammar( rOpt.GetFormulaSyntax() );
 
-// This needs to be called first since it may re-initialize the entire
-// opcode map.
-if (rOpt.GetUseEnglishFuncName())
+  

[Libreoffice-commits] core.git: formula/source sc/source

2013-12-02 Thread Eike Rathke
 formula/source/core/resource/core_resource.src |2 +-
 sc/source/filter/excel/xlformula.cxx   |   14 ++
 sc/source/filter/oox/formulabase.cxx   |6 --
 3 files changed, 19 insertions(+), 3 deletions(-)

New commits:
commit 8302495a219e869f194f4b585c6f2b996eee0a5c
Author: Eike Rathke er...@redhat.com
Date:   Mon Dec 2 18:53:32 2013 +0100

store internal CONVERT to .xlsx/.xls and distinguish from CONVERT_ADD

Change-Id: Ie9b5f6ade1c25618aa990ce17bd7b2a2b46a250a

diff --git a/formula/source/core/resource/core_resource.src 
b/formula/source/core/resource/core_resource.src
index 81e1557..5b2220a 100644
--- a/formula/source/core/resource/core_resource.src
+++ b/formula/source/core/resource/core_resource.src
@@ -739,7 +739,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML
 String SC_OPCODE_DDE { Text = DDE ; };
 String SC_OPCODE_BASE { Text = _xlfn.BASE ; };
 String SC_OPCODE_DECIMAL { Text = _xlfn.DECIMAL ; };
-String SC_OPCODE_CONVERT { Text = CONVERT ; };
+String SC_OPCODE_CONVERT { Text = _xlfn.ORG.OPENOFFICE.CONVERT ; };
 String SC_OPCODE_ROMAN { Text = ROMAN ; };
 String SC_OPCODE_ARABIC { Text = _xlfn.ARABIC ; };
 String SC_OPCODE_HYPERLINK { Text = HYPERLINK ; };
diff --git a/sc/source/filter/excel/xlformula.cxx 
b/sc/source/filter/excel/xlformula.cxx
index 45db3ca..fb6c39d 100644
--- a/sc/source/filter/excel/xlformula.cxx
+++ b/sc/source/filter/excel/xlformula.cxx
@@ -549,6 +549,19 @@ static const XclFunctionInfo saFuncTable_Odf[] =
 
 #undef EXC_FUNCENTRY_ODF
 
+
+#define EXC_FUNCENTRY_OOO( opcode, minparam, maxparam, flags, asciiname ) \
+{ opcode, NOID, minparam, maxparam, V, { VR },   
EXC_FUNCFLAG_IMPORTONLY|(flags), EXC_FUNCNAME( asciiname ) }, \
+{ opcode,  255, (minparam)+1, (maxparam)+1, V, { RO_E, RO }, 
EXC_FUNCFLAG_EXPORTONLY|(flags), EXC_FUNCNAME( asciiname ) }
+
+/** Functions defined by Calc, but not in OpenFormula nor supported by Excel. 
*/
+static const XclFunctionInfo saFuncTable_OOoLO[] =
+{
+EXC_FUNCENTRY_OOO( ocConvert,   3,  3,  0,  ORG.OPENOFFICE.CONVERT )
+};
+
+#undef EXC_FUNCENTRY_OOO
+
 // 
 
 XclFunctionProvider::XclFunctionProvider( const XclRoot rRoot )
@@ -574,6 +587,7 @@ XclFunctionProvider::XclFunctionProvider( const XclRoot 
rRoot )
 (this-*pFillFunc)( saFuncTable_2010, STATIC_ARRAY_END( saFuncTable_2010 ) 
);
 (this-*pFillFunc)( saFuncTable_2013, STATIC_ARRAY_END( saFuncTable_2013 ) 
);
 (this-*pFillFunc)( saFuncTable_Odf, STATIC_ARRAY_END( saFuncTable_Odf ) );
+(this-*pFillFunc)( saFuncTable_OOoLO, STATIC_ARRAY_END( saFuncTable_OOoLO 
) );
 }
 
 const XclFunctionInfo* XclFunctionProvider::GetFuncInfoFromXclFunc( sal_uInt16 
nXclFunc ) const
diff --git a/sc/source/filter/oox/formulabase.cxx 
b/sc/source/filter/oox/formulabase.cxx
index 3fb9461..6589ed8 100644
--- a/sc/source/filter/oox/formulabase.cxx
+++ b/sc/source/filter/oox/formulabase.cxx
@@ -198,7 +198,7 @@ const sal_uInt16 FUNCFLAG_VOLATILE  = 0x0001;   /// 
Result is volatile (
 const sal_uInt16 FUNCFLAG_IMPORTONLY= 0x0002;   /// Only used in 
import filter.
 const sal_uInt16 FUNCFLAG_EXPORTONLY= 0x0004;   /// Only used in 
export filter.
 const sal_uInt16 FUNCFLAG_MACROCALL = 0x0008;   /// Function is stored 
as macro call in Excel (_xlfn. prefix). OOXML name MUST exist.
-const sal_uInt16 FUNCFLAG_MACROCALLODF  = 0x0010;   /// ODF-only function 
stored as macro call in Excel (_xlfnodf. prefix). ODF name MUST exist.
+const sal_uInt16 FUNCFLAG_MACROCALLODF  = 0x0010;   /// ODF-only function 
stored as macro call in BIFF Excel (_xlfnodf. prefix). ODF name MUST exist.
 const sal_uInt16 FUNCFLAG_EXTERNAL  = 0x0020;   /// Function is 
external in Calc.
 const sal_uInt16 FUNCFLAG_MACROFUNC = 0x0040;   /// Function is a 
macro-sheet function.
 const sal_uInt16 FUNCFLAG_MACROCMD  = 0x0080;   /// Function is a 
macro-sheet command.
@@ -888,7 +888,9 @@ static const FunctionData saFuncTableOOoLO[] =
 { 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 }
+{ ORG.OPENOFFICE.ROT13,   
COM.SUN.STAR.SHEET.ADDIN.DATEFUNCTIONS.GETROT13,   NOID,   NOID,   1,  1, 
 V, { VR }, FUNCFLAG_IMPORTONLY | FUNCFLAG_EXTERNAL },
+// Other 

[Libreoffice-commits] core.git: formula/source sc/source

2013-11-29 Thread Eike Rathke
 formula/source/core/resource/core_resource.src |2 +-
 sc/source/filter/oox/formulabase.cxx   |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 62e1a27dc757637223f5f18b1a340ba138e0cb82
Author: Eike Rathke er...@redhat.com
Date:   Fri Nov 29 21:45:50 2013 +0100

our UI DURATION is ODF and Excel PDURATION

Change-Id: Iaf0e5f8096554b8b5d80265b6dc5296b3294f134

diff --git a/formula/source/core/resource/core_resource.src 
b/formula/source/core/resource/core_resource.src
index 868a31a..81e1557 100644
--- a/formula/source/core/resource/core_resource.src
+++ b/formula/source/core/resource/core_resource.src
@@ -585,7 +585,7 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML
 String SC_OPCODE_GDA { Text = DDB ; };
 String SC_OPCODE_GDA_2 { Text = DB ; };
 String SC_OPCODE_VBD { Text = VDB ; };
-String SC_OPCODE_LAUFZ { Text = _xlfn.DURATION ; };
+String SC_OPCODE_LAUFZ { Text = _xlfn.PDURATION ; };
 String SC_OPCODE_LIA { Text = SLN ; };
 String SC_OPCODE_RMZ { Text = PMT ; };
 String SC_OPCODE_COLUMNS { Text = COLUMNS ; };
diff --git a/sc/source/filter/oox/formulabase.cxx 
b/sc/source/filter/oox/formulabase.cxx
index 30abf67..3fb9461 100644
--- a/sc/source/filter/oox/formulabase.cxx
+++ b/sc/source/filter/oox/formulabase.cxx
@@ -623,7 +623,7 @@ static const FunctionData saFuncTableBiff4[] =
 { COUPNCD,COUPNCD,  455,NOID,   3,  4, 
 V, { RR }, FUNCFLAG_EXTERNAL },
 { COUPNUM,COUPNUM,  456,NOID,   3,  4, 
 V, { RR }, FUNCFLAG_EXTERNAL },
 { COUPPCD,COUPPCD,  457,NOID,   3,  4, 
 V, { RR }, FUNCFLAG_EXTERNAL },
-{ DURATION,   DURATION, 458,NOID,   5,  6, 
 V, { RR }, FUNCFLAG_EXTERNAL | FUNCFLAG_INTERNAL }, // Calc: builtin and add-in
+{ DURATION,   DURATION, 458,NOID,   5,  6, 
 V, { RR }, FUNCFLAG_EXTERNAL }, // Calc: builtin and add-in (but different!)
 { MDURATION,  MDURATION,459,NOID,   5,  6, 
 V, { RR }, FUNCFLAG_EXTERNAL },
 { ODDLPRICE,  ODDLPRICE,460,NOID,   7,  8, 
 V, { RR }, FUNCFLAG_EXTERNAL },
 { ODDLYIELD,  ODDLYIELD,461,NOID,   8,  9, 
 V, { RR }, FUNCFLAG_EXTERNAL },
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits