core.git: sc/inc sc/source

2024-02-16 Thread Winfried Donkers (via logerrit)
 sc/inc/queryiter.hxx  |8 
 sc/source/core/data/queryiter.cxx |   27 +--
 sc/source/core/inc/interpre.hxx   |6 +++---
 sc/source/core/tool/interpr1.cxx  |   35 ++-
 4 files changed, 42 insertions(+), 34 deletions(-)

New commits:
commit 88ba9fab08514b96f458bb8c0ace175b2790638e
Author: Winfried Donkers 
AuthorDate: Sun Feb 11 16:18:44 2024 +0100
Commit: Balazs Varga 
CommitDate: Fri Feb 16 11:01:17 2024 +0100

Prepare search code for other functions than MATCH and XLOOKUP.

Purpose is to use one set of code for all similar lookup functions, as
they now each have their own code, which is largely identical.
Next steps will be to make the code used by XLOOKUP and MATCH work with
each similar lookup function.
This patch just changes the interface to accomodate other functions.

Change-Id: I6950aa69404f3eb8acbf2d55e247058f3e798814
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163230
Tested-by: Jenkins
Reviewed-by: Balazs Varga 

diff --git a/sc/inc/queryiter.hxx b/sc/inc/queryiter.hxx
index 32fd1cb83898..f494b83d74a5 100644
--- a/sc/inc/queryiter.hxx
+++ b/sc/inc/queryiter.hxx
@@ -183,7 +183,7 @@ protected:
 sal_uInt8nSortedBinarySearch;
 boolbAdvanceQuery;
 boolbIgnoreMismatchOnLeadingStrings;
-boolbXLookUp;
+sal_uInt16  nSearchOpCode;
 SCCOL   nBestFitCol;
 SCROW   nBestFitRow;
 
@@ -276,8 +276,8 @@ public:
 nSearchbAscd : (nSearchMode == -2 ? 
nSearchbDesc : nBinarySearchDisabled));
 }
 
-voidSetXlookupMode( bool bVal )
-{ bXLookUp = bVal; }
+voidSetLookupMode( sal_uInt16 nVal )
+{ nSearchOpCode = nVal; }
 };
 
 
@@ -325,7 +325,7 @@ class ScQueryCellIterator
 using Base::getThisResult;
 using Base::nBestFitCol;
 using Base::nBestFitRow;
-using Base::bXLookUp;
+using Base::nSearchOpCode;
 
 bool GetThis();
 
diff --git a/sc/source/core/data/queryiter.cxx 
b/sc/source/core/data/queryiter.cxx
index 56d4081e7255..8abaa2b93fdd 100644
--- a/sc/source/core/data/queryiter.cxx
+++ b/sc/source/core/data/queryiter.cxx
@@ -67,7 +67,7 @@ ScQueryCellIteratorBase< accessType, queryType 
>::ScQueryCellIteratorBase(ScDocu
 , nSortedBinarySearch( nBinarySearchDisabled )
 , bAdvanceQuery( false )
 , bIgnoreMismatchOnLeadingStrings( false )
-, bXLookUp( false )
+, nSearchOpCode( SC_OPCODE_NONE )
 , nBestFitCol(SCCOL_MAX)
 , nBestFitRow(SCROW_MAX)
 {
@@ -207,7 +207,8 @@ void ScQueryCellIteratorBase< accessType, queryType 
>::PerformQuery()
 return;
 
 // XLookUp: Forward/asc/backward/desc search for best fit 
value, except if we have an exact match
-if (bXLookUp && (rEntry.eOp == SC_LESS_EQUAL || rEntry.eOp == 
SC_GREATER_EQUAL) &&
+if (nSearchOpCode == SC_OPCODE_X_LOOKUP &&
+(rEntry.eOp == SC_LESS_EQUAL || rEntry.eOp == 
SC_GREATER_EQUAL) &&
 (nBestFitCol != nCol || nBestFitRow != nRow))
 {
 bool bNumSearch = rItem.meType == ScQueryEntry::ByValue && 
aCell.hasNumeric();
@@ -315,7 +316,7 @@ void ScQueryCellIteratorBase< accessType, queryType 
>::InitPos()
 // is the one after it.
 lastRow = nRow;
 // BinarySearch() looks for the first match for XLOOKUP
-if (!bXLookUp)
+if (nSearchOpCode != SC_OPCODE_X_LOOKUP)
 {
 ScQueryOp saveOp = op;
 op = SC_LESS;
@@ -341,7 +342,7 @@ void ScQueryCellIteratorBase< accessType, queryType 
>::InitPos()
 if( BinarySearch( nCol ))
 lastRow = nRow;
 }
-AccessBase::InitPosFinish(beforeRow, lastRow, bXLookUp);
+AccessBase::InitPosFinish(beforeRow, lastRow, (nSearchOpCode == 
SC_OPCODE_X_LOOKUP));
 }
 }
 
@@ -545,7 +546,9 @@ bool ScQueryCellIteratorBase< accessType, queryType 
>::BinarySearch( SCCOL col,
 {
 if (fLastInRangeValue <= nCellVal)
 {
-if (bXLookUp && nSortedBinarySearch != nSearchbDesc && 
fLastInRangeValue == nCellVal && aIndexer.getLowIndex() != i)
+if (nSearchOpCode  == SC_OPCODE_X_LOOKUP &&
+nSortedBinarySearch != nSearchbDesc &&
+fLastInRangeValue == nCellVal && 
aIndexer.getLowIndex() != i)
 bDone = true;
 else
 {
@@ -593,7 +596,9 @@ bool ScQueryCellIteratorBa

core.git: formula/inc include/formula sc/inc sc/qa sc/README.md sc/source

2024-01-31 Thread Winfried Donkers (via logerrit)
 formula/inc/core_resource.hrc   |6 
 include/formula/compiler.hxx|2 
 include/formula/opcode.hxx  |2 
 sc/README.md|1 
 sc/inc/helpids.h|1 
 sc/inc/queryiter.hxx|   60 
 sc/inc/scfuncs.hrc  |   18 
 sc/qa/extras/scfunctionlistobj.cxx  |2 
 sc/qa/unit/data/functions/spreadsheet/fods/xlookup.fods | 4553 
 sc/qa/unit/ucalc.cxx|1 
 sc/qa/unit/ucalc_sort.cxx   |4 
 sc/source/core/data/funcdesc.cxx|1 
 sc/source/core/data/queryiter.cxx   |  184 
 sc/source/core/inc/interpre.hxx |   61 
 sc/source/core/tool/interpr1.cxx| 1232 +++-
 sc/source/core/tool/interpr4.cxx|1 
 sc/source/core/tool/parclass.cxx|1 
 sc/source/core/tool/token.cxx   |1 
 sc/source/filter/excel/xlformula.cxx|   13 
 sc/source/filter/oox/formulabase.cxx|   15 
 20 files changed, 5816 insertions(+), 343 deletions(-)

New commits:
commit f7039822c7ad3987326e1c20ea4a745c158f9682
Author: Winfried Donkers 
AuthorDate: Wed Jun 28 16:13:45 2023 +0200
Commit: Balazs Varga 
CommitDate: Wed Jan 31 09:14:19 2024 +0100

tdf#127293 Add Excel2021 function XLOOKUP to Calc

https://issues.oasis-open.org/browse/OFFICE-4154

What is working already: xlookup with normal forward,
backward search in columns/rows. Binary search in rows with
real binary search algorithm, in columns only works with linear search yet.
Linear forward backward wildcard/regex search in columns/rows.
Looking for the first smaller or greater value with linear and binary search
ALso all the combination of all these options. Except XLOOKUP
not supperted wildcard/regex search with binary search.

TODO in next patches:
- add the binary search option for searching in columns.
- Evaluate Formula calculation not working in general.

Co-authored-by: Balazs Varga 

Change-Id: I15fd4479b63ec13b093d269760d1bbb5957553e8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131905
Tested-by: Jenkins
Tested-by: Gabor Kelemen 
Reviewed-by: Balazs Varga 

diff --git a/formula/inc/core_resource.hrc b/formula/inc/core_resource.hrc
index baed318f586e..835d928ea4a8 100644
--- a/formula/inc/core_resource.hrc
+++ b/formula/inc/core_resource.hrc
@@ -275,6 +275,7 @@ const std::pair 
RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF[] =
 { "COUNTIFS" , SC_OPCODE_COUNT_IFS },
 { "LOOKUP" , SC_OPCODE_LOOKUP },
 { "VLOOKUP" , SC_OPCODE_V_LOOKUP },
+{ "COM.MICROSOFT.XLOOKUP" , SC_OPCODE_X_LOOKUP },
 { "HLOOKUP" , SC_OPCODE_H_LOOKUP },
 { "ORG.OPENOFFICE.MULTIRANGE" , SC_OPCODE_MULTI_AREA }, // legacy for 
range list (union)
 { "OFFSET" , SC_OPCODE_OFFSET },
@@ -722,6 +723,7 @@ const std::pair 
RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML[] =
 { "COUNTIFS" , SC_OPCODE_COUNT_IFS },
 { "LOOKUP" , SC_OPCODE_LOOKUP },
 { "VLOOKUP" , SC_OPCODE_V_LOOKUP },
+{ "_xlfn.XLOOKUP" , SC_OPCODE_X_LOOKUP },
 { "HLOOKUP" , SC_OPCODE_H_LOOKUP },
 { "_xlfn.ORG.OPENOFFICE.MULTIRANGE" , SC_OPCODE_MULTI_AREA }, // legacy 
for range list (union)
 { "OFFSET" , SC_OPCODE_OFFSET },
@@ -1172,6 +1174,7 @@ const std::pair 
RID_STRLIST_FUNCTION_NAMES_ENGLISH_PODF[] =
 { "COUNTIFS" , SC_OPCODE_COUNT_IFS },
 { "LOOKUP" , SC_OPCODE_LOOKUP },
 { "VLOOKUP" , SC_OPCODE_V_LOOKUP },
+{ "XLOOKUP" , SC_OPCODE_X_LOOKUP },
 { "HLOOKUP" , SC_OPCODE_H_LOOKUP },
 { "MULTIRANGE" , SC_OPCODE_MULTI_AREA },// legacy for range list 
(union)
 { "OFFSET" , SC_OPCODE_OFFSET },
@@ -1623,6 +1626,7 @@ const std::pair 
RID_STRLIST_FUNCTION_NAMES_ENGLISH_API[] =
 { "COUNTIFS" , SC_OPCODE_COUNT_IFS },
 { "LOOKUP" , SC_OPCODE_LOOKUP },
 { "VLOOKUP" , SC_OPCODE_V_LOOKUP },
+{ "XLOOKUP" , SC_OPCODE_X_LOOKUP },
 { "HLOOKUP" , SC_OPCODE_H_LOOKUP },
 { "MULTIRANGE" , SC_OPCODE_MULTI_AREA },// legacy for range list 
(union)
 { "OFFSET" , SC_OPCODE_OFFSET },
@@ -2072,6 +2076,7 @@ const std::pair 
RID_STRLIST_FUNCTION_NAMES_ENGLISH[] =
 { "COUNTIFS" , SC_OPCODE_COUNT_IFS },
 { "LOOKUP" , SC_OPCODE_LOOKUP },
 { "VLOOKUP" , SC_OPCODE_V_LOOKUP },
+{ "XLOOKUP" , SC_OPCODE_X_L

[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sc/qa sc/source

2023-01-16 Thread Winfried Donkers (via logerrit)
 sc/qa/unit/data/functions/spreadsheet/fods/hlookup.fods |   41 --
 sc/qa/unit/data/functions/spreadsheet/fods/match.fods   |   46 ---
 sc/qa/unit/data/functions/spreadsheet/fods/vlookup.fods |   65 +++-
 sc/source/core/tool/interpr1.cxx|   23 -
 4 files changed, 152 insertions(+), 23 deletions(-)

New commits:
commit a5103adc413fb2cc8811c8691de5bfbe2df51961
Author: Winfried Donkers 
AuthorDate: Sat Dec 31 15:54:57 2022 +0100
Commit: Xisco Fauli 
CommitDate: Mon Jan 16 08:40:21 2023 +

tdf#152774 Fix incorrect result with MATCH, HLOOKUP and VLOOKUP.

 This is a combination of 2 commits.

tdf#152774 Fix incorrect result with MATCH.

Use case now complies with ODF 6.9.14 (MATCH).
Added use case to unit test.

xChange-Id: I749a979135fbc01a3bb1583092fb6d6a100e2d2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144883
Tested-by: Jenkins
Reviewed-by: Eike Rathke 
(cherry picked from commit 0ce4c1e6898ba83d487f1b225dc9ee0bbc00d9fc)

tdf#152774 Fix incorrect result with HLOOKUP and VLOOKUP.

Use case now complies with ODF 6.9.5 (HLOOKUP) and 6.9.12 (VLOOKUP).
Added use case to unit test.

xChange-Id: I19df718b6446098f614136f462662c753a515036
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145514
Reviewed-by: Eike Rathke 
Tested-by: Jenkins
(cherry picked from commit bf432958c1d6d204511a6bb32e2c06161d811676)

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

diff --git a/sc/qa/unit/data/functions/spreadsheet/fods/hlookup.fods 
b/sc/qa/unit/data/functions/spreadsheet/fods/hlookup.fods
index e3b38cf6c85b..8e14a315ac2a 100644
--- a/sc/qa/unit/data/functions/spreadsheet/fods/hlookup.fods
+++ b/sc/qa/unit/data/functions/spreadsheet/fods/hlookup.fods
@@ -1304,10 +1304,41 @@
  
  
 
-
- 
- 
- 
+
+ 
+  #N/A
+ 
+ 
+  #N/A
+ 
+ 
+  TRUE
+ 
+ 
+  
=HLOOKUP(a,{1;3;b;d},1,1)
+ 
+ 
+  tdf152774
+ 
+ 
+
+
+ 
+  #N/A
+ 
+ 
+  #N/A
+ 
+ 
+  TRUE
+ 
+ 
+  
=HLOOKUP(a,{1;3;b;d},1,0)
+ 
+ 
+  tdf152774
+ 
+ 
 
 
  
@@ -1391,4 +1422,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/qa/unit/data/functions/spreadsheet/fods/match.fods 
b/sc/qa/unit/data/functions/spreadsheet/fods/match.fods
index a050773c07e3..d5debd0d6339 100644
--- a/sc/qa/unit/data/functions/spreadsheet/fods/match.fods
+++ b/sc/qa/unit/data/functions/spreadsheet/fods/match.fods
@@ -5716,11 +5716,23 @@
  
  
 
-
- 
- 
- 
- 
+
+ 
+  #N/A
+ 
+ 
+  #N/A
+ 
+ 
+  TRUE
+ 
+ 
+  
=MATCH(a,{1,3,b,d},1)
+ 
+ 
+  Tdf#152774
+ 
+ 
  
   4
  
@@ -5731,11 +5743,23 @@
  
  
 
-
- 
- 
- 
- 
+
+ 
+  #N/A
+ 
+ 
+  #N/A
+ 
+ 
+  TRUE
+ 
+ 
+  =MATCH(4,{d,b,3,1},-1)
+ 
+ 
+  Tdf#152774
+ 
+ 
  
   3
  
@@ -6255,4 +6279,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/qa/unit/data/functions/spreadsheet/fods/vlookup.fods 
b/sc/qa/unit/data/functions/spreadsheet/fods/vlookup.fods
index 354aff0d763d..e0a0530a65e7 100644
--- a/sc/qa/unit/data/functions/spreadsheet/fods/vlookup.fods
+++ b/sc/qa/unit/data/functions/spreadsheet/fods/vlookup.fods
@@ -2559,8 +2559,67 @@
  
  
 
-
- 
+
+ 
+  #N/A
+ 
+ 
+  #N/A
+ 
+ 
+  TRUE
+ 
+ 
+  
=VLOOKUP(a,{1;3;b;d},1,1)
+ 
+ 
+  tdf152774
+ 
+ 
+
+
+ 
+  #N/A
+ 
+ 
+  #N/A
+ 
+ 
+  TRUE
+ 
+ 
+  
=VLOOKUP(a,{1;3;b;d},1,0)
+ 
+ 
+  tdf152774
+ 
+ 
+
+
+ 
+  c
+ 
+ 
+  c
+ 
+ 
+  TRUE
+ 
+ 
+  =VLOOKUP(3, 
{1,a,d;2,b,e;3,c,f},
 2, 1)
+ 
+ 
+  tdf152774
+ 
+ 
+
+
+ 
+ 
+ 
+
+
+ 
 
 
  
@@ -2592,4 +2651,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 0785318da871..d82acb37494c 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -5052,7 +5052,11 @@ void ScInterpreter::ScMatch()
 
 if (nHitIndex > 0) // valid hit must be 2nd item or higher
 {
-PushDouble( nHitIndex); // non-exact match
+if ( ! ( rItem.meType == ScQueryEntry::ByString &&  
aMatAcc.IsValue( nHitIndex-1 ) ) &&
+ ! ( rItem.meType == ScQueryEntry::ByValue  && 
!a

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

2023-01-15 Thread Winfried Donkers (via logerrit)
 sc/qa/unit/data/functions/spreadsheet/fods/hlookup.fods |   41 --
 sc/qa/unit/data/functions/spreadsheet/fods/vlookup.fods |   65 +++-
 sc/source/core/tool/interpr1.cxx|   17 +++-
 3 files changed, 112 insertions(+), 11 deletions(-)

New commits:
commit bf432958c1d6d204511a6bb32e2c06161d811676
Author: Winfried Donkers 
AuthorDate: Sat Jan 14 18:01:12 2023 +0100
Commit: Eike Rathke 
CommitDate: Sun Jan 15 16:02:49 2023 +

tdf#152774 Fix incorrect result with HLOOKUP and VLOOKUP.

Use case now complies with ODF 6.9.5 (HLOOKUP) and 6.9.12 (VLOOKUP).
Added use case to unit test.

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

diff --git a/sc/qa/unit/data/functions/spreadsheet/fods/hlookup.fods 
b/sc/qa/unit/data/functions/spreadsheet/fods/hlookup.fods
index e3b38cf6c85b..8e14a315ac2a 100644
--- a/sc/qa/unit/data/functions/spreadsheet/fods/hlookup.fods
+++ b/sc/qa/unit/data/functions/spreadsheet/fods/hlookup.fods
@@ -1304,10 +1304,41 @@
  
  
 
-
- 
- 
- 
+
+ 
+  #N/A
+ 
+ 
+  #N/A
+ 
+ 
+  TRUE
+ 
+ 
+  
=HLOOKUP(a,{1;3;b;d},1,1)
+ 
+ 
+  tdf152774
+ 
+ 
+
+
+ 
+  #N/A
+ 
+ 
+  #N/A
+ 
+ 
+  TRUE
+ 
+ 
+  
=HLOOKUP(a,{1;3;b;d},1,0)
+ 
+ 
+  tdf152774
+ 
+ 
 
 
  
@@ -1391,4 +1422,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/qa/unit/data/functions/spreadsheet/fods/vlookup.fods 
b/sc/qa/unit/data/functions/spreadsheet/fods/vlookup.fods
index 354aff0d763d..e0a0530a65e7 100644
--- a/sc/qa/unit/data/functions/spreadsheet/fods/vlookup.fods
+++ b/sc/qa/unit/data/functions/spreadsheet/fods/vlookup.fods
@@ -2559,8 +2559,67 @@
  
  
 
-
- 
+
+ 
+  #N/A
+ 
+ 
+  #N/A
+ 
+ 
+  TRUE
+ 
+ 
+  
=VLOOKUP(a,{1;3;b;d},1,1)
+ 
+ 
+  tdf152774
+ 
+ 
+
+
+ 
+  #N/A
+ 
+ 
+  #N/A
+ 
+ 
+  TRUE
+ 
+ 
+  
=VLOOKUP(a,{1;3;b;d},1,0)
+ 
+ 
+  tdf152774
+ 
+ 
+
+
+ 
+  c
+ 
+ 
+  c
+ 
+ 
+  TRUE
+ 
+ 
+  =VLOOKUP(3, 
{1,a,d;2,b,e;3,c,f},
 2, 1)
+ 
+ 
+  tdf152774
+ 
+ 
+
+
+ 
+ 
+ 
+
+
+ 
 
 
  
@@ -2592,4 +2651,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index c47aec4b052c..d82acb37494c 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -5064,6 +5064,7 @@ void ScInterpreter::ScMatch()
 return;
 }
 
+// The source data is cell range.
 SCCOLROW nDelta = 0;
 if (nCol1 == nCol2)
 {   // search row in column
@@ -7508,16 +7509,26 @@ void ScInterpreter::CalculateLookup(bool bHLookup)
 {
 SCSIZE nX = static_cast(nSpIndex);
 SCSIZE nY = nDelta;
+SCSIZE nXs = 0;
+SCSIZE nYs = nY;
 if ( bHLookup )
 {
 nX = nDelta;
 nY = static_cast(nZIndex);
+nXs = nX;
+nYs = 0;
 }
 assert( nX < nC && nY < nR );
-if ( pMat->IsStringOrEmpty( nX, nY) )
-PushString(pMat->GetString( nX,nY).getString());
+if (!(rItem.meType == ScQueryEntry::ByString && pMat->IsValue( 
nXs, nYs)))
+{
+if (pMat->IsStringOrEmpty( nX, nY))
+PushString(pMat->GetString( nX, nY).getString());
+else
+PushDouble(pMat->GetDouble( nX, nY));
+}
 else
-PushDouble(pMat->GetDouble( nX,nY));
+PushNA();
+return;
 }
 else
 PushNA();


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

2023-01-12 Thread Winfried Donkers (via logerrit)
 sc/qa/unit/data/functions/spreadsheet/fods/match.fods |   46 +-
 sc/source/core/tool/interpr1.cxx  |6 +-
 2 files changed, 40 insertions(+), 12 deletions(-)

New commits:
commit 0ce4c1e6898ba83d487f1b225dc9ee0bbc00d9fc
Author: Winfried Donkers 
AuthorDate: Sat Dec 31 15:54:57 2022 +0100
Commit: Eike Rathke 
CommitDate: Thu Jan 12 14:55:30 2023 +

tdf#152774 Fix incorrect result with MATCH.

Use case now complies with ODF 6.9.14 (MATCH).
Added use case to unit test.

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

diff --git a/sc/qa/unit/data/functions/spreadsheet/fods/match.fods 
b/sc/qa/unit/data/functions/spreadsheet/fods/match.fods
index a050773c07e3..d5debd0d6339 100644
--- a/sc/qa/unit/data/functions/spreadsheet/fods/match.fods
+++ b/sc/qa/unit/data/functions/spreadsheet/fods/match.fods
@@ -5716,11 +5716,23 @@
  
  
 
-
- 
- 
- 
- 
+
+ 
+  #N/A
+ 
+ 
+  #N/A
+ 
+ 
+  TRUE
+ 
+ 
+  
=MATCH(a,{1,3,b,d},1)
+ 
+ 
+  Tdf#152774
+ 
+ 
  
   4
  
@@ -5731,11 +5743,23 @@
  
  
 
-
- 
- 
- 
- 
+
+ 
+  #N/A
+ 
+ 
+  #N/A
+ 
+ 
+  TRUE
+ 
+ 
+  =MATCH(4,{d,b,3,1},-1)
+ 
+ 
+  Tdf#152774
+ 
+ 
  
   3
  
@@ -6255,4 +6279,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 0785318da871..c47aec4b052c 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -5052,7 +5052,11 @@ void ScInterpreter::ScMatch()
 
 if (nHitIndex > 0) // valid hit must be 2nd item or higher
 {
-PushDouble( nHitIndex); // non-exact match
+if ( ! ( rItem.meType == ScQueryEntry::ByString &&  
aMatAcc.IsValue( nHitIndex-1 ) ) &&
+ ! ( rItem.meType == ScQueryEntry::ByValue  && 
!aMatAcc.IsValue( nHitIndex-1 ) ) )
+PushDouble( nHitIndex); // non-exact match
+else
+PushNA();
 return;
 }
 


Re: behaviour of Calc function MATCH

2022-12-21 Thread Winfried Donkers

Hi Eike,


the functions MATCH and VLOOKUP.
=MATCH("b";{1,2,"d","e"};1) returns 2, which is in accordance with 
https://docs.oasis-open.org/office/OpenDocument/v1.3/os/part4-formula/OpenDocument-v1.3-os-part4-formula.html#__RefHeading__1018430_715980110
But =MATCH("b",B1:B4;1) with B1:B4 containing the values 1,2,"d","e" returns
#N/A, which IMHO is not in accordance with the ODF standard.
I know that Excel returns #N/A in both occasions.


#N/A is in accordance with ODF, 6.14.9 MATCH says for "MatchType = 1 or
omitted" that "If Search is of type Text and the value found is of type
Number, the #N/A Error is returned."; similar for "MatchType = -1" that
"If Search is of type Number and the value found is of type Text, the
#N/A Error is returned.". Same for HLOOKUP and VLOOKUP.


Yes, I now see the lines you mention. But following that are the lines 
"If MatchType is 1, the SearchRegion may be assumed to be sorted in 
ascending order, with smaller Numbers before larger ones, smaller Text 
values before larger ones (e.g., "A" before "B", and "B" before "BA"), 
and FALSE before TRUE. If the types are mixed, Numbers are sorted before 
Text, and Text before Logicals; evaluators without a separate Logical 
type may include a Logical as a Number. If MatchType is -1, then 
SearchRegion may be assumed to be sorted in descending order (the 
opposite of the above). ", which seem confusing when comparing wit the 
lines you mentioned.
Nevertheless, I will make that MATCH/HLOOKUP and VLOOKUP return #N/A 
error - after verifying how XLOOKUP and other functions using

ScQueryCellIterator< accessType >::FindEqualOrSortedLastInRange(..) or
ScQueryCellIterator< accessType >::FindEqualOrSortedLastInRange() ought 
to respond when Search is of type text and the value found is of type 
number.





Why does Calc's MATCH conform partly with Excel behaviour and partly with
the ODF standard? Is this intended behaviour?


It looks more like implementation was omitted (or different in Excel
back at that time?) from the array/matrix case. It would need to be
implemented.

[...]

I suggest to implement the type mismatch #N/A for both, cell range and
array/matrix, if that is what Excel does.


Will do so, after creating a bug report about the inconsistency.


Merry solstice, happy holidays and a prosperous new year!


Thanks, and like for you all!

Winfried


behaviour of Calc function MATCH

2022-12-16 Thread Winfried Donkers

I am working on implementing XLOOKUP in Calc.
Therefore I need to change some existing code (to avoid lots of nearly 
identical code) and I came across a behaviour that I don't understand 
with the functions MATCH and VLOOKUP.
=MATCH("b";{1,2,"d","e"};1) returns 2, which is in accordance with 
https://docs.oasis-open.org/office/OpenDocument/v1.3/os/part4-formula/OpenDocument-v1.3-os-part4-formula.html#__RefHeading__1018430_715980110
But =MATCH("b",B1:B4;1) with B1:B4 containing the values 1,2,"d","e" 
returns #N/A, which IMHO is not in accordance with the ODF standard.

I know that Excel returns #N/A in both occasions.

Why does Calc's MATCH conform partly with Excel behaviour and partly 
with the ODF standard? Is this intended behaviour?
So far, it proves difficult for me to implement XLOOKUP because of un 
expected behaviour in use cases.


Winfried


ScQueryCellIteratorBase::BinarySearch

2022-11-01 Thread Winfried Donkers

Hi,

To implement the function XLOOKUP in Calc (tdf127293) I need to change 
ScQueryCellIteratorBase::BinarySearch().


In BinarySearch() at each iteration a check is performed to see whether 
the range really is sorted; if not orderBroken gets the value true.


The current check is not reliable. If orderBroken gets the value true, 
the order is broken. But if orderBroken is false, we don't know if the 
order is broken. BinarySearch only uses log(n)/log(2) of the elements 
(n) in the range in its search.




Is BinarySearch the proper place to check if the range is sorted correctly?

Shouldn't this happen either at the end of the sorting routine or be 
left to the user (i.e. if the user states that the range is sorted in 
the relevant XLOOKUP argument, why should we check that)?


With the information I have now, I would like to remove the orderBroken 
variable from BinarySearch(), but possibly I am overlooking something.




Winfried



Re: Need help with ScLookupCache

2022-06-29 Thread Winfried Donkers

Luboš, Eike,

Op 21-06-2022 om 15:12 schreef Winfried Donkers:
Am I correct when stating that ScLookupCache currently cannot cope 
with the

combinations
  eOp SC_GREATER_EQUAL and sorted in ascending order
and
  eOp SC_LESSER_EQUAL and sorted in descending order?


As Luboš already said, ScLookupCache just caches results of lookups, to
be able to reuse them for same lookups with further columns. Using the
same for example SC_GREATER_EQUAL operator with different ascending or
descending sort orders should however invalidate the cache for that
position, so you'll probably also need to take the sort order into
account in ScLookupCache::QueryCriteria and ScLookupCache::QueryKey.

That could be accomplished without adding an extra field if the
ScLookupCache::QueryOp simply would have different values for
SC_GREATER_EQUAL ascending or descending, similar for SC_LESS_EQUAL; so
just add them and map accordingly in the
ScLookupCache::QueryCriteria::QueryCriteria() ctor. You'll probably need
to add some flag to ScQueryEntry anyway.


It is the function BinarySearch in sc/source/core/data/queryiter.cxx 
that presents 'challenges'.
Currently its search direction (and probably whether the cells are 
ordered or not and in which direction) depends on rEntry.eOp.
For MATCH, LOOKUP, HLOOKUP and VLOOKUP this is OK, for XLOOKUP this is 
quite different.
XLOOKUP has 4 search modes (forwards and backwards (data not sorted) as 
well as ascending and descending (data sorted) and 4 match modes of 
which 3 are relevant here ( exact match (SC_EQUAL), exact or less 
(SC_LESS_EQUAL, exact or greater (SC_GREATER_EQUAL) and wildcard ( 
SC_EQUAL with wildcard/regexp enabled)). The search modes and match 
modes can be used in any combination.


Incorporating this in BinarySearch will be a lot of work and probably 
reduce performance for all other uses than XLOOKUP.
I tend to make an XBinarySearch function that will be called from 
BinarySearch when an XLOOKUPIndicator is true. I hope to be able to use 
BinarySearch as foundation and expand it for XLOOKUP.


I wonder if this is a wise way to go or whether there are better 
alternative solutions?


Winfried


Re: Need help with ScLookupCache

2022-06-21 Thread Winfried Donkers

Am I correct when stating that ScLookupCache currently cannot cope with the
combinations
  eOp SC_GREATER_EQUAL and sorted in ascending order
and
  eOp SC_LESSER_EQUAL and sorted in descending order?


As Luboš already said, ScLookupCache just caches results of lookups, to
be able to reuse them for same lookups with further columns. Using the
same for example SC_GREATER_EQUAL operator with different ascending or
descending sort orders should however invalidate the cache for that
position, so you'll probably also need to take the sort order into
account in ScLookupCache::QueryCriteria and ScLookupCache::QueryKey.

That could be accomplished without adding an extra field if the
ScLookupCache::QueryOp simply would have different values for
SC_GREATER_EQUAL ascending or descending, similar for SC_LESS_EQUAL; so
just add them and map accordingly in the
ScLookupCache::QueryCriteria::QueryCriteria() ctor. You'll probably need
to add some flag to ScQueryEntry anyway.



Ah, I see, I can get on with that, thank you,

Winfried


Re: Need help with ScLookupCache

2022-06-20 Thread Winfried Donkers

Hi Luboš,


Am I correct when stating that ScLookupCache currently cannot cope with
the combinations
   eOp SC_GREATER_EQUAL and sorted in ascending order
and
   eOp SC_LESSER_EQUAL and sorted in descending order?


  No, it's not correct, why would you think that would be the case? As the name
says, ScLookupCache is just a cache, so it stores the result of a lookup. It
cares only what the operation was and its result, it doesn't care what the
source data was (and it'll get discarded if the source data changes).


The reason is that XLOOKUP works fine with all combinations of eOp and 
order except those mentioned. Also, ScLookupCache mentions functions 
MATCH and LOOKUP, which do not have these combinations.
Now I know for sure my assumption is not correct I can debug in detail 
to find out what goes wrong.



  The code for looking up in sorted data is in queryiter.cpp .


Thank you,

Winfried


Need help with ScLookupCache

2022-06-16 Thread Winfried Donkers

Hi,

I am implementing Excel function XLOOKUP in Calc (at a slow pace), and 
need some help with ScLookupCache.


Am I correct when stating that ScLookupCache currently cannot cope with 
the combinations

 eOp SC_GREATER_EQUAL and sorted in ascending order
and
 eOp SC_LESSER_EQUAL and sorted in descending order?

And if so, can anyone help me in making this possible?

Winfried



gerrit: pull, change, commit --amend and submit after many changes in master since first submit to gerrit

2022-04-20 Thread Winfried Donkers

Hi,

I have submitted a patch to gerrit weeks ago and I now want to change 
some of it (the patch in gerrit is still active).


When pulling the patch from gerrit, I get a merge commit.
I can change my patch, but how do I update the patch (I normally use 
'git commit path_or_-a --amend' for this, but the patch is not the 
latest commit)?


Winfried


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

2022-02-10 Thread Winfried Donkers (via logerrit)
 sc/qa/unit/data/functions/text/fods/clean.fods | 1085 ++---
 sc/source/core/tool/interpr1.cxx   |   19 
 2 files changed, 833 insertions(+), 271 deletions(-)

New commits:
commit 61f4250ee9f43902107e4d2e6322cbf54f52dd8e
Author: Winfried Donkers 
AuthorDate: Mon Jan 31 14:04:17 2022 +0100
Commit: Mike Kaganski 
CommitDate: Thu Feb 10 18:39:32 2022 +0100

Make CLEAN fully compliant woth ODFF v1.3

Not only check for characters of category Cc, but also for characters of
category Cn.
Use generic functions to check is characters belong to one of the above
categories.

Follow up of commit e38ebf0737297fe94e3128459fc25ef9259faa6b.

Change-Id: I97618dbf33db70b01b2833cf653988610b499333
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129222
Reviewed-by: Mike Kaganski 
Tested-by: Jenkins

diff --git a/sc/qa/unit/data/functions/text/fods/clean.fods 
b/sc/qa/unit/data/functions/text/fods/clean.fods
index 0230953d00e5..c5531ad364d5 100644
--- a/sc/qa/unit/data/functions/text/fods/clean.fods
+++ b/sc/qa/unit/data/functions/text/fods/clean.fods
@@ -344,8 +344,8 @@
   

-
+   €
€
-   

   
   
@@ -2132,7 +2132,7 @@
   =CLEAN(J36)
  
  
-  Unicode Cn
+  Unicode Cc
  
  
  
@@ -2168,7 +2168,7 @@
   =CLEAN(J37)
  
  
-  Unicode Cn
+  Unicode Cc
  
  
  
@@ -2177,11 +2177,11 @@
  
   128
  
- 
-  €
+ 
+  €
  
- 
-  €Test text€
+ 
+  €Test text€
  
  
   Tdf#97706
@@ -2204,7 +2204,7 @@
   =CLEAN(J38)
  
  
-  Unicode Cn
+  Unicode Cc
  
  
  
@@ -2213,11 +2213,11 @@
  
   129
  
- 
-  
+ 
+  
  
- 
-  Test text
+ 
+  Test text
  
  
   Tdf#97706
@@ -2240,7 +2240,7 @@
   =CLEAN(J39)
  
  
-  Unicode Cn
+  Unicode Cc
  
  
  
@@ -2249,11 +2249,11 @@
  
   130
  
- 
-  ‚
+ 
+  ‚
  
- 
-  ‚Test text‚
+ 
+  ‚Test text‚
  
  
   Tdf#97706
@@ -2276,7 +2276,7 @@
   =CLEAN(J40)
  
  
-  Unicode Cn
+  Unicode Cc
  
  
  
@@ -2285,11 +2285,11 @@
  
   131
  
- 
-  ƒ
+ 
+  ƒ
  
- 
-  ƒTest textƒ
+ 
+  ƒTest textƒ
  
  
   Tdf#97706
@@ -2308,24 +2308,24 @@
  
   TRUE
  
- 
+ 
   =CLEAN(J41)
  
  
   Unicode Cn
  
  
- 
-  84
+ 
+  FFFE
  
- 
-  132
+ 
+  65534
  
- 
-  „
+ 
+  
  
- 
-  „Test text„
+ 
+  Test text
  
  
   Tdf#97706
@@ -2344,24 +2344,24 @@
  
   TRUE
  
- 
+ 
   =CLEAN(J42)
  
  
   Unicode Cn
  
  
- 
-  85
+ 
+  
  
- 
-  133
+ 
+  65535
  
- 
-  …
+ 
+  
  
- 
-  …Test text…
+ 
+  Test text
  
  
   Tdf#97706
@@ -2380,24 +2380,24 @@
  
   TRUE
  
- 
+ 
   =CLEAN(J43)
  
  
   Unicode Cn
  
  
- 
-  86
+ 
+  1FFFE
  
- 
-  134
+ 
+  131070
  
- 
-  †
+ 
+  🿾
  
- 
-  †Test text†
+ 
+  🿾Test text🿾
  
  
   Tdf#97706
@@ -2407,33 +2407,33 @@
  
 
 
- 
-  Test text
+ 
+  ïš“Test textïš“
  
- 
-  Test text
+ 
+  ïš“Test textïš“
  
  
   TRUE
  
- 
+ 
   =CLEAN(J44)
  
  
-  Unicode Cn
+  no clean
  
  
- 
-  87
+ 
+  F693
  
- 
-  135
+ 
+  63123
  
- 
-  ‡
+ 
+  ïš“
  
- 
-  ‡Test text‡
+ 
+  ïš“Test textïš“
  
  
   Tdf#97706
@@ -2443,33 +2443,33 @@
  
 
 
- 
-  Test text
+ 
+  Test text
  
- 
-  Test text
+ 
+  Test text
  
  
   TRUE
  
- 
+ 
   =CLEAN(J45)
  
  
-  Unicode Cn
+  no clean
  
  
- 
-  88
+ 
+  1F43C
  
- 
-  136
+ 
+  128060
  
- 
-  ˆ
+ 
+  
  
- 
-  ˆTest textˆ
+ 
+  Test text
  
  
   Tdf#97706
@@ -2479,33 +2479,33 @@
  
 
 
- 
-  Test text
+ 
+  �Test text�
  
- 
-  Test text
+ 
+  �Test text�
  
  
   TRUE
  
- 
+ 
   =CLEAN(J46)
  
  
-  Unicode Cn
+  no clean
  
  
- 
-  89
+ 
+  FFFD
  
- 
-  137
+ 
+  65533
  
- 
-  ‰
+ 
+  �
  
- 
-  ‰Test text‰
+ 
+  �Test text�
  
  
   Tdf#97706
@@ -2515,33

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

2022-01-24 Thread Winfried Donkers (via logerrit)
 sc/qa/unit/data/functions/text/fods/clean.fods | 3438 ++---
 sc/source/core/tool/interpr1.cxx   |3 
 2 files changed, 2532 insertions(+), 909 deletions(-)

New commits:
commit 34412339f863b35508842a3bf20fcc7341a006e7
Author: Winfried Donkers 
AuthorDate: Wed Jan 12 17:00:34 2022 +0100
Commit: Eike Rathke 
CommitDate: Mon Jan 24 23:42:05 2022 +0100

tdf#97706 CLEAN is neither ODFF nor OOXML conform.

Patch makes CLEAN 100% compliant with ODFF v1.3 and almost 100% compliant
with actual Excel results (just character 0x7F differs).

co-author: taylorlee...@gmail.com
Change-Id: Icc070ca2560b7ca7640128c5a538d1fbfa1193e9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128350
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/sc/qa/unit/data/functions/text/fods/clean.fods 
b/sc/qa/unit/data/functions/text/fods/clean.fods
index 58345a7f8ead..0230953d00e5 100644
--- a/sc/qa/unit/data/functions/text/fods/clean.fods
+++ b/sc/qa/unit/data/functions/text/fods/clean.fods
@@ -1,438 +1,440 @@
 
 
-http://www.w3.org/1999/xlink; 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:scr
 ipt="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:form
 x="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" 
xmlns:css3t="http://www.w3.org/TR/css3-text/; office:version="1.2" 
office:mimetype="application/vnd.oasis.opendocument.spreadsheet">
+http://www.w3.org/TR/css3-text/; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:config="urn:oasis:nam
 es:tc:opendocument:xmlns:config:1.0" 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:loext="urn

Re: submit a revised patch to an abandoned gerrit change

2022-01-12 Thread Winfried Donkers

I have the same menu, but just next to the menu button (the vertical ...),
on the left side, there is also a RESTORE button.


Might only work for own patches.


OK, thanks all, I'll simply submit a new patch and refer to the 
abandoned one (I have no need for elevated permissions).


Winfried


Re: submit a revised patch to an abandoned gerrit change

2022-01-11 Thread Winfried Donkers
Is it possible to reopen an abandoned gerrit change when you're not 
the original contributor?


I see a restore button for every abandoned patch. But why not simply try?


I can't see any restore button; in menu I see Cherry pick, Download 
patch and Ignore.


Winfried


submit a revised patch to an abandoned gerrit change

2022-01-11 Thread Winfried Donkers
In 2017 a contributor submitted several patches to gerrit, but in the 
end didn't succeed in fixing the bug and gave up.
The contributor gave up and gerrit (Pootle bot) changed the status of 
the gerrit change to abandoned.


Last month I received a question whether I could do something with the 
(still unresolved) bug report.
I made changes to the patch and would like to submit 'my' patch to the 
same gerrit change with me and the original contributor as co-authors.
However, gerrit won't accept the patch I submitted because the status of 
the change is 'abandoned'.


I can submit as a new patch of course and refer to the original patches, 
but reopening the original gerrit change seems (seemed?) a better idea.
Is it possible to reopen an abandoned gerrit change when you're not the 
original contributor? (In my case it isn't relevant whether the original 
contributor can reopen the change, I cannot get a response from him.)


If it a lot of bother to reopen, I will submit as a new patch and refer 
to the original change. But who knows, reopening might be simple...


Winfried

(I intentionally left out references to bug report and gerrit change to 
avoid over-publishing of someone's struggle to get a well written and 
properly functioning patch.)


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sc/qa sc/source

2021-12-10 Thread Winfried Donkers (via logerrit)
 sc/qa/unit/data/functions/database/fods/dcount.fods  |   21 +++
 sc/qa/unit/data/functions/database/fods/dcounta.fods |   21 +++
 sc/source/core/data/funcdesc.cxx |4 +--
 3 files changed, 36 insertions(+), 10 deletions(-)

New commits:
commit 1db4d3c869dbd4d68c0ab7b15c60bb2dad0a9f67
Author: Winfried Donkers 
AuthorDate: Thu Dec 9 17:39:58 2021 +0100
Commit: Xisco Fauli 
CommitDate: Fri Dec 10 13:52:37 2021 +0100

tdf#133353, Make 2nd argument optional for DCOUNT and DCOUNTA.

The functions accept empty second arguments, but the function
wizard and hints stated that it was required.

Change-Id: I74fcfcc31492ed776085d1bc6ee6a9ff22a87818
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126620
Tested-by: Eike Rathke 
Reviewed-by: Eike Rathke 
(cherry picked from commit 885465bc0ae6029d8adad57015fb0ff6c26a6ba6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126594
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/unit/data/functions/database/fods/dcount.fods 
b/sc/qa/unit/data/functions/database/fods/dcount.fods
index 392bc86d017d..4e2b792e08f2 100644
--- a/sc/qa/unit/data/functions/database/fods/dcount.fods
+++ b/sc/qa/unit/data/functions/database/fods/dcount.fods
@@ -2183,9 +2183,22 @@
  
 
 
- 
- 
- 
+ 
+  2
+ 
+ 
+  2
+ 
+ 
+  TRUE
+ 
+ 
+  =DCOUNT(J1:N11,,J41:N42)
+ 
+ 
+  Tdf#13353
+ 
+ 
  
   =I
  
@@ -2940,4 +2953,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/qa/unit/data/functions/database/fods/dcounta.fods 
b/sc/qa/unit/data/functions/database/fods/dcounta.fods
index 1080e2cf64a5..c95c1472d713 100644
--- a/sc/qa/unit/data/functions/database/fods/dcounta.fods
+++ b/sc/qa/unit/data/functions/database/fods/dcounta.fods
@@ -864,9 +864,22 @@
  
 
 
- 
- 
- 
+ 
+  2
+ 
+ 
+  2
+ 
+ 
+  TRUE
+ 
+ 
+  =DCOUNTA(J1:N10,,J41:N42)
+ 
+ 
+  Tdf#13353
+ 
+ 
  
   Greta
  
@@ -1491,4 +1504,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/data/funcdesc.cxx b/sc/source/core/data/funcdesc.cxx
index 51f03a4e4bf4..01d8143a16f8 100644
--- a/sc/source/core/data/funcdesc.cxx
+++ b/sc/source/core/data/funcdesc.cxx
@@ -576,8 +576,8 @@ ScFunctionList::ScFunctionList()
 { SC_OPCODE_NOMINAL, ENTRY(SC_OPCODE_NOMINAL_ARY), 0, 
ID_FUNCTION_GRP_FINANCIAL, HID_FUNC_NOMINAL, 2, { 0, 0 }, 0 },
 { SC_OPCODE_SUB_TOTAL, ENTRY(SC_OPCODE_SUB_TOTAL_ARY), 0, 
ID_FUNCTION_GRP_MATH, HID_FUNC_TEILERGEBNIS, 2, { 0, 0 }, 0 },
 { SC_OPCODE_DB_SUM, ENTRY(SC_OPCODE_DB_SUM_ARY), 0, 
ID_FUNCTION_GRP_DATABASE, HID_FUNC_DBSUMME, 3, { 0, 0, 0 }, 0 },
-{ SC_OPCODE_DB_COUNT, ENTRY(SC_OPCODE_DB_COUNT_ARY), 0, 
ID_FUNCTION_GRP_DATABASE, HID_FUNC_DBANZAHL, 3, { 0, 0, 0 }, 0 },
-{ SC_OPCODE_DB_COUNT_2, ENTRY(SC_OPCODE_DB_COUNT_2_ARY), 0, 
ID_FUNCTION_GRP_DATABASE, HID_FUNC_DBANZAHL2, 3, { 0, 0, 0 }, 0 },
+{ SC_OPCODE_DB_COUNT, ENTRY(SC_OPCODE_DB_COUNT_ARY), 0, 
ID_FUNCTION_GRP_DATABASE, HID_FUNC_DBANZAHL, 3, { 0, 1, 0 }, 0 },
+{ SC_OPCODE_DB_COUNT_2, ENTRY(SC_OPCODE_DB_COUNT_2_ARY), 0, 
ID_FUNCTION_GRP_DATABASE, HID_FUNC_DBANZAHL2, 3, { 0, 1, 0 }, 0 },
 { SC_OPCODE_DB_AVERAGE, ENTRY(SC_OPCODE_DB_AVERAGE_ARY), 0, 
ID_FUNCTION_GRP_DATABASE, HID_FUNC_DBMITTELWERT, 3, { 0, 0, 0 }, 0 },
 { SC_OPCODE_DB_GET, ENTRY(SC_OPCODE_DB_GET_ARY), 0, 
ID_FUNCTION_GRP_DATABASE, HID_FUNC_DBAUSZUG, 3, { 0, 0, 0 }, 0 },
 { SC_OPCODE_DB_MAX, ENTRY(SC_OPCODE_DB_MAX_ARY), 0, 
ID_FUNCTION_GRP_DATABASE, HID_FUNC_DBMAX, 3, { 0, 0, 0 }, 0 },


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

2021-12-09 Thread Winfried Donkers (via logerrit)
 sc/qa/unit/data/functions/database/fods/dcount.fods  |   21 +++
 sc/qa/unit/data/functions/database/fods/dcounta.fods |   21 +++
 sc/source/core/data/funcdesc.cxx |4 +--
 3 files changed, 36 insertions(+), 10 deletions(-)

New commits:
commit 885465bc0ae6029d8adad57015fb0ff6c26a6ba6
Author: Winfried Donkers 
AuthorDate: Thu Dec 9 17:39:58 2021 +0100
Commit: Eike Rathke 
CommitDate: Fri Dec 10 01:18:43 2021 +0100

tdf#133353, Make 2nd argument optional for DCOUNT and DCOUNTA.

The functions accept empty second arguments, but the function
wizard and hints stated that it was required.

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

diff --git a/sc/qa/unit/data/functions/database/fods/dcount.fods 
b/sc/qa/unit/data/functions/database/fods/dcount.fods
index 392bc86d017d..4e2b792e08f2 100644
--- a/sc/qa/unit/data/functions/database/fods/dcount.fods
+++ b/sc/qa/unit/data/functions/database/fods/dcount.fods
@@ -2183,9 +2183,22 @@
  
 
 
- 
- 
- 
+ 
+  2
+ 
+ 
+  2
+ 
+ 
+  TRUE
+ 
+ 
+  =DCOUNT(J1:N11,,J41:N42)
+ 
+ 
+  Tdf#13353
+ 
+ 
  
   =I
  
@@ -2940,4 +2953,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/qa/unit/data/functions/database/fods/dcounta.fods 
b/sc/qa/unit/data/functions/database/fods/dcounta.fods
index 1080e2cf64a5..c95c1472d713 100644
--- a/sc/qa/unit/data/functions/database/fods/dcounta.fods
+++ b/sc/qa/unit/data/functions/database/fods/dcounta.fods
@@ -864,9 +864,22 @@
  
 
 
- 
- 
- 
+ 
+  2
+ 
+ 
+  2
+ 
+ 
+  TRUE
+ 
+ 
+  =DCOUNTA(J1:N10,,J41:N42)
+ 
+ 
+  Tdf#13353
+ 
+ 
  
   Greta
  
@@ -1491,4 +1504,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/data/funcdesc.cxx b/sc/source/core/data/funcdesc.cxx
index 51f03a4e4bf4..01d8143a16f8 100644
--- a/sc/source/core/data/funcdesc.cxx
+++ b/sc/source/core/data/funcdesc.cxx
@@ -576,8 +576,8 @@ ScFunctionList::ScFunctionList()
 { SC_OPCODE_NOMINAL, ENTRY(SC_OPCODE_NOMINAL_ARY), 0, 
ID_FUNCTION_GRP_FINANCIAL, HID_FUNC_NOMINAL, 2, { 0, 0 }, 0 },
 { SC_OPCODE_SUB_TOTAL, ENTRY(SC_OPCODE_SUB_TOTAL_ARY), 0, 
ID_FUNCTION_GRP_MATH, HID_FUNC_TEILERGEBNIS, 2, { 0, 0 }, 0 },
 { SC_OPCODE_DB_SUM, ENTRY(SC_OPCODE_DB_SUM_ARY), 0, 
ID_FUNCTION_GRP_DATABASE, HID_FUNC_DBSUMME, 3, { 0, 0, 0 }, 0 },
-{ SC_OPCODE_DB_COUNT, ENTRY(SC_OPCODE_DB_COUNT_ARY), 0, 
ID_FUNCTION_GRP_DATABASE, HID_FUNC_DBANZAHL, 3, { 0, 0, 0 }, 0 },
-{ SC_OPCODE_DB_COUNT_2, ENTRY(SC_OPCODE_DB_COUNT_2_ARY), 0, 
ID_FUNCTION_GRP_DATABASE, HID_FUNC_DBANZAHL2, 3, { 0, 0, 0 }, 0 },
+{ SC_OPCODE_DB_COUNT, ENTRY(SC_OPCODE_DB_COUNT_ARY), 0, 
ID_FUNCTION_GRP_DATABASE, HID_FUNC_DBANZAHL, 3, { 0, 1, 0 }, 0 },
+{ SC_OPCODE_DB_COUNT_2, ENTRY(SC_OPCODE_DB_COUNT_2_ARY), 0, 
ID_FUNCTION_GRP_DATABASE, HID_FUNC_DBANZAHL2, 3, { 0, 1, 0 }, 0 },
 { SC_OPCODE_DB_AVERAGE, ENTRY(SC_OPCODE_DB_AVERAGE_ARY), 0, 
ID_FUNCTION_GRP_DATABASE, HID_FUNC_DBMITTELWERT, 3, { 0, 0, 0 }, 0 },
 { SC_OPCODE_DB_GET, ENTRY(SC_OPCODE_DB_GET_ARY), 0, 
ID_FUNCTION_GRP_DATABASE, HID_FUNC_DBAUSZUG, 3, { 0, 0, 0 }, 0 },
 { SC_OPCODE_DB_MAX, ENTRY(SC_OPCODE_DB_MAX_ARY), 0, 
ID_FUNCTION_GRP_DATABASE, HID_FUNC_DBMAX, 3, { 0, 0, 0 }, 0 },


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

2021-11-29 Thread Winfried Donkers (via logerrit)
 sc/qa/unit/data/functions/date_time/fods/weeks.fods |  652 +++-
 scaddins/source/datefunc/datefunc.cxx   |   71 --
 2 files changed, 659 insertions(+), 64 deletions(-)

New commits:
commit 105196aa00bc0d3e426796f6729a8e7e51271e56
Author: Winfried Donkers 
AuthorDate: Tue Nov 16 16:55:52 2021 +0100
Commit: Mike Kaganski 
CommitDate: Mon Nov 29 09:07:51 2021 +0100

tdf#145578, tdf#145587 revise calculations for WEEKS Add-In function

The calculations now follow the documentation for WEEKS in
https://wiki.documentfoundation.org/Documentation/Calc_Functions/WEEKS.

Change-Id: Ifede6e2ec2d9cfb7301fd5eb53bf7b6f187053bc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125319
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sc/qa/unit/data/functions/date_time/fods/weeks.fods 
b/sc/qa/unit/data/functions/date_time/fods/weeks.fods
index a0d596086220..f05803ea6684 100644
--- a/sc/qa/unit/data/functions/date_time/fods/weeks.fods
+++ b/sc/qa/unit/data/functions/date_time/fods/weeks.fods
@@ -1056,25 +1056,657 @@
  
 
 
- 
- 
- 
+ 
+  0
+ 
+ 
+  1
+ 
+ 
+  ONWAAR
+ 
+ 
+  =WEEKS(DATE(2022;1;2);DATE(2022;1;9);1)
+ 
+ 
+  tdf#145578
+ 
+ 
  
   17
  
  
 
 
- 
- 
- 
- 
+ 
+  1
+ 
+ 
+  1
+ 
+ 
+  WAAR
+ 
+ 
+  =WEEKS(DATE(2022;1;3);DATE(2022;1;10);1)
+ 
+ 
+  tdf#145578
+ 
+ 
  
  
-  12/01/2001
+  01-12-2001
  
  
 
+
+ 
+  0
+ 
+ 
+  -1
+ 
+ 
+  ONWAAR
+ 
+ 
+  =WEEKS(DATE(2022;1;9);DATE(2022;1;2);1)
+ 
+ 
+  tdf#145578
+ 
+ 
+
+
+ 
+  1
+ 
+ 
+  1
+ 
+ 
+  WAAR
+ 
+ 
+  =WEEKS(DATE(2021;11;14);DATE(2021;11;15);1)
+ 
+ 
+  tdf#145587
+ 
+ 
+
+
+ 
+  0
+ 
+ 
+  0
+ 
+ 
+  WAAR
+ 
+ 
+  =WEEKS(DATE(2021;11;14);DATE(2021;11;15);0)
+ 
+ 
+  tdf#145587
+ 
+ 
+ 
+ 
+
+
+ 
+  52
+ 
+ 
+  52
+ 
+ 
+  WAAR
+ 
+ 
+  =WEEKS(DATE(2010;01;01);DATE(2011;01;01);1)
+ 
+ 
+  tdf#145578
+ 
+ 
+
+
+ 
+  -52
+ 
+ 
+  -52
+ 
+ 
+  WAAR
+ 
+ 
+  =WEEKS(DATE(2011;01;01);DATE(2010;01;01);1)
+ 
+ 
+  tdf#145578
+ 
+ 
+
+
+ 
+  3
+ 
+ 
+  3
+ 
+ 
+  TRUE
+ 
+ 
+  =WEEKS($K$19,$K$20,0)
+ 
+ 
+  tdf#145578
+ 
+ 
+ 
+  Sat -0001-11-27
+ 
+ 
+
+
+ 
+  4
+ 
+ 
+  4
+ 
+ 
+  TRUE
+ 
+ 
+  =WEEKS($K$19,$K$20,1)
+ 
+ 
+  tdf#145578
+ 
+ 
+ 
+ 
+  Tue -0001-12-21
+ 
+ 
+
+
+ 
+  0
+ 
+ 
+  0
+ 
+ 
+  TRUE
+ 
+ 
+  =WEEKS(J21,K21,M21)
+ 
+ 
+  tdf#145587
+ 
+ 
+ 
+  01/03/1
+ 
+ 
+  12/31/-1
+ 
+ 
+ 
+  0
+ 
+ 
+
+
+ 
+  -1
+ 
+ 
+  -1
+ 
+ 
+  TRUE
+ 
+ 
+  =WEEKS(J22,K22,M22)
+ 
+ 
+  tdf#145587
+ 
+ 
+ 
+  01/03/1
+ 
+ 
+  12/31/-1
+ 
+ 
+ 
+  1
+ 
+ 
+
+
+ 
+  0
+ 
+ 
+  0
+ 
+ 
+  TRUE
+ 
+ 
+  =WEEKS(J23,K23,M23)
+ 
+ 
+  tdf#145587
+ 
+ 
+ 
+  12/31/-1
+ 
+ 
+  01/03/1
+ 
+ 
+ 
+  0
+ 
+ 
+
+
+ 
+  1
+ 
+ 
+  1
+ 
+ 
+  TRUE
+ 
+ 
+  =WEEKS(J24,K24,M24)
+ 
+ 
+  tdf#145587
+ 
+ 
+ 
+  12/31/-1
+ 
+ 
+  01/03/1
+ 
+ 
+ 
+  1
+ 
+ 
+
+
+ 
+  0
+ 
+ 
+  0
+ 
+ 
+  TRUE
+ 
+ 
+  =WEEKS(J25,K25,M25)
+ 
+ 
+  tdf#145587
+ 
+ 
+ 
+  01/07/1
+ 
+ 
+  01/10/1
+ 
+ 
+ 
+  0
+ 
+ 
+
+
+ 
+  1
+ 
+ 
+  1
+ 
+ 
+  TRUE
+ 
+ 
+  =WEEKS(J26,K26,M26)
+ 
+ 
+  tdf#145587
+ 
+ 
+ 
+  01/07/1
+ 
+ 
+  01/10/1
+ 
+ 
+ 
+  1
+ 
+ 
+
+
+ 
+  0
+ 
+ 
+  0
+ 
+ 
+  TRUE
+ 
+ 
+  =WEEKS(J27,K27,M27)
+ 
+ 
+  tdf#145587
+ 
+ 
+ 
+  12/24/-1
+ 
+ 
+  12/27/-1
+ 
+ 
+ 
+  0
+ 
+ 
+
+
+ 
+  1
+ 
+ 
+  1
+ 
+ 
+  TRUE
+ 
+ 
+  =WEEKS(J28,K28,M28)
+ 
+ 
+  tdf#145587

[no subject]

2020-10-14 Thread Winfried Donkers



___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Accessing code for Calc functions

2019-11-26 Thread Winfried Donkers


Hi Steve,

On 26.11.2019 17:15, Steve Fanning wrote:

I am currently working as a member of the Documentation Team, updating
Chapter 18 of the Calc Guide (Description of Functions). From time to
time during this task, I would benefit from viewing the code that
implements individual functions but have not been able to find that
code. Could somebody give me some hints please?


The code of most Calc functions is in sc/source/core/tool/interpr#.cxx, 
with # ranging from 1 to 8.


In sc/source/core/tool/interpr4.cxx is a function 
ScInterpreter::Interpret() with a large switch statement which handles 
the function calls. E.g. 'case ocSum :  ScSum(); break;' shows that the 
SUM function is ScSum, which git grep (or opengrok) tells you is in 
sc/source/core/tool/interpr6.cxx.


Some functions belong to a group 'Add-in functions' and are essentially 
functions that Excel had as a special package. These are handled quite 
differently and in scaddins/source/analysis and scaddins/source/financial.


HTH,

Winfried


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice

a developer's goodbye

2019-10-11 Thread Winfried Donkers

Hi all,

The past 8 years I have had the honour and pleasure to contribute as 
developer to LibreOffice (mainly Calc).


Alas, because of health reasons I must end my contributions.

It was great to be part of a large community focussed on making a great 
open source project a success.


Thank you all!


Winfried


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice

[Libreoffice-commits] core.git: chart2/Library_chartcore.mk chart2/source officecfg/registry

2019-05-20 Thread Winfried Donkers (via logerrit)
 chart2/Library_chartcore.mk   |3 
 chart2/source/view/charttypes/AreaChart.cxx   |   27 +-
 chart2/source/view/charttypes/ConfigAccess.cxx|   80 ++
 chart2/source/view/charttypes/VSeriesPlotter.cxx  |  161 ++
 chart2/source/view/inc/ConfigAccess.hxx   |   40 +++
 chart2/source/view/inc/VSeriesPlotter.hxx |   15 +
 officecfg/registry/schema/org/openoffice/Office/Chart.xcs |   13 +
 7 files changed, 333 insertions(+), 6 deletions(-)

New commits:
commit f6f27ae31a26bf6cecbf9205ef28a6bad3d06864
Author: Winfried Donkers 
AuthorDate: Sat Feb 2 13:05:03 2019 +0100
Commit: Eike Rathke 
CommitDate: Mon May 20 12:58:31 2019 +0200

tdf#90180 Add option to show errors as rectangles in diagrams with error 
bars.

The option is saved in registrymodifications.xcu, not yet in the document.

(cherry picked from commit 0fc471e8218b53b8b9e505d2af3e015abf3910f3)

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

diff --git a/chart2/Library_chartcore.mk b/chart2/Library_chartcore.mk
index 86eae1a11941..e671110a753f 100644
--- a/chart2/Library_chartcore.mk
+++ b/chart2/Library_chartcore.mk
@@ -91,6 +91,7 @@ $(eval $(call gb_Library_add_exception_objects,chartcore,\
 chart2/source/view/charttypes/BubbleChart \
 chart2/source/view/charttypes/CandleStickChart \
 chart2/source/view/charttypes/CategoryPositionHelper \
+chart2/source/view/charttypes/ConfigAccess \
 chart2/source/view/charttypes/NetChart \
 chart2/source/view/charttypes/PieChart \
 chart2/source/view/charttypes/Splines \
@@ -237,5 +238,5 @@ $(eval $(call gb_Library_add_exception_objects,chartcore,\
 chart2/source/tools/WrappedPropertySet \
 chart2/source/tools/XMLRangeHelper \
 ))
- 
+
 # vim: set noet sw=4 ts=4:
diff --git a/chart2/source/view/charttypes/AreaChart.cxx 
b/chart2/source/view/charttypes/AreaChart.cxx
index 2fa4f4e66dd0..2699121ed357 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -873,12 +874,28 @@ void AreaChart::createShapes()
 //@todo other symbol styles
 }
 }
-//create error bars
-if (bCreateXErrorBar)
-createErrorBar_X( aUnscaledLogicPosition, 
*pSeries, nIndex, m_xErrorBarTarget );
+//create error bars or rectangles, depending on 
configuration
+if ( ConfigAccess::getUseErrorRectangle() )
+{
+if ( bCreateXErrorBar || bCreateYErrorBar )
+{
+createErrorRectangle(
+  aUnscaledLogicPosition,
+  *pSeries,
+  nIndex,
+  m_xErrorBarTarget,
+  bCreateXErrorBar,
+  bCreateYErrorBar );
+}
+}
+else
+{
+if (bCreateXErrorBar)
+createErrorBar_X( aUnscaledLogicPosition, 
*pSeries, nIndex, m_xErrorBarTarget );
 
-if (bCreateYErrorBar)
-createErrorBar_Y( aUnscaledLogicPosition, 
*pSeries, nIndex, m_xErrorBarTarget, nullptr );
+if (bCreateYErrorBar)
+createErrorBar_Y( aUnscaledLogicPosition, 
*pSeries, nIndex, m_xErrorBarTarget, nullptr );
+}
 
 //create data point label
 if( pSeries->getDataPointLabelIfLabel(nIndex) )
diff --git a/chart2/source/view/charttypes/ConfigAccess.cxx 
b/chart2/source/view/charttypes/ConfigAccess.cxx
new file mode 100644
index ..bca2b6dd99ef
--- /dev/null
+++ b/chart2/source/view/charttypes/ConfigAccess.cxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additio

wanted: reviewer(s) for https://gerrit.libreoffice.org/67280

2019-05-16 Thread Winfried Donkers

Hi,

I am looking for at least one extra reviewer for 
https://gerrit.libreoffice.org/67280.


It would be great, if still possible, to have this extra feature added 
to Calc in version 6.3.


The feature (see tdf90180) allows the user to have either a cross bar 
(current, default) or rectangle to represent error values in charts. As 
the feature can only be activated by changing a setting in advanced 
options, it will be without consequences for the average user.


Having this feature in version 6.3 will make it possible to obtain 
feedback from key users before I start working on making the setting 
available in a setting dialog.


The gerrit patch dates from March, Eike has given it a +1, it just needs 
an extra reviewer giving it a +1.



Winfried


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice

tdf124710 convert Calc functions IFS and SWITCH to jump functions

2019-05-07 Thread Winfried Donkers

Hi Eike, all,

I have been concentrating on converting IFS functions to their 
equivalent with nested IF functions, e.g. IFS(b1;r1;b2;r2) to 
IF(b1;r1;IF(b2;r2;#NA)).


I now think I know where to insert ocIf tokens in the IFS-function 
string when looking at FormulaCompiler::Factor(), but I don't know how 
to insert a FormulaTokenRef in the code and not destroy the stack, jump 
array or other at the same time.


For some time thought that FormulaTokenArray::RewriteMissing(...) might 
be a better and easier place, but this function is only called after 
ScInterpreter::Interpret(), so that has no use.



Do you have any suggestions where and how I might try to insert these 
extra ocIf, ocSep and #NA tokens (and replace ocIfs with ocIf).


With ocSwitch I also must be able to copy (the result of) the first 
argument on top of the stack before the next ocIf is executed. The 
equivalent in those case would be SWITCH(x;b1;r1;b2;r2) converted to 
IF(x=b1;r1;IF(x=b2;r2;#NA)).


Winfried

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice

tdf124710 convert Calc function IFS (and SWITCH) to jump function

2019-04-30 Thread Winfried Donkers
Hi Eike,

Some time ago (when I submitted a draft patch) you suggested an alternative, 
possible easier way, to convert IFS and SWITCH to jump functions.
The idea was not to extend the jump functionality, but to internally convert 
IFS and SWITCH to IF:
IFS( b1, r1, b2, r2 ) should become IF( b1, r1, IF( b2, r2 ) )
and
SWITCH( x, v1, r1, v2, r2 ) should become IF( x = v1, r1, IF( x=v2, r2 ) ).
For the IFS example you gave the RPN code : 'b1 ocIf r1 , b2 ocIf , r2 )' .

I have two questions about this:
-Shouldn't the RPN code be 'b1 ocIf r1 , b2 ocif r2 ) )'?
-Am I right in thinking that this construction means that all conditions (b1, 
b2, etc.) are evaluated upon placing them on the stack, or is each condition 
only evaluated when taken from the stack?

Winfried

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice

confusing use of 'OpCode' in formula/source/core/api/FormulaCompiler.cxx

2019-04-30 Thread Winfried Donkers
Hi,

I stumbled over an inconsistency in the use of opcodes in 
formula/source/core/api/FormulaCompiler.cxx: in two locations SC_OPCODE_xxx is 
used for functions, whereas in all other code (apart from the definitions,  
formula/inc/core_resource.hrc, sc/inc/scfuncs.hrc and 
sc/source/core/data/funcdesc.cxx) ocXxx is used. (It took me hours with gdb to 
find out why ocIf was handled differenty than ocIfs_MS when the latter was 
changed to a fump function).

I want to replace the use of SC_OPCODE_XXX in 
formula/source/core/api/FormulaCompiler.cxx with ocXxx.
In sc/source/core/data/funcdesc.cxx the situation is the other way round, 
SC_OPCODE_XXX is consequently used for functions and ocXxx is use for oSep, 
ocOpen and similar. I want to change that too to get a consistent use of opcode 
names.

So far, no real problems.
But when looking into formula/source/core/api/FormulaCompiler.cxx I noticed 
that the term 'OpCode' seems to be used both for
type  e.g. line 58:SvNumFormatType lcl_GetRetFormat( OpCode eOpCode ),
members e.g. line 127 aEntry.Token.OpCode = nOpCode; and
variables e.g. line 184: xMap->putOpCode( aOpStr, OpCode(i), pCharClass); .

And as type for opcodes both OpCode (e.g. line 58) and sal_UInt16 (e.g. line 
173) are used. OpCode cannot be used in the case of SC_OPCODE_START_UN_OP and 
the like, but
changing
static const sal_UInt16 aOpCodes[] = {
SC_OPCODE_OPEN,
SC_OPCODE_CLOSE,
SC_OPCODE_SEP,
};
to
static const OpCode aOpCodes[] = {
SC_OPCODE_OPEN,
SC_OPCODE_CLOSE,
SC_OPCODE_SEP,
};
produces compiler errors ('invalid conversion from int to OpCode' and 'invalid 
conversion from const OpCode to sal_UInt16').

I am confused by this (non) use of 'OpCode'.
Anyone who knows the why and how of this?

Winfried

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice

RE: is gerrit #26348 still somewhere?

2019-04-29 Thread Winfried Donkers
Hi Christian, Mike, Eike,

(Combining mails into one reply)

> Not on gerrit anymore, but is available on jenkins mirror...
> Attached is the change v1 - if there was a second revision, then that is lost.
First of all, thank you, Christian, for retrieving the change v1. That'll help 
preventing making the same mistakes twice.

> ... but definitely, if a user deletes a draft patch, without publishing 
> it, it is deleted irreversibly (or at least irreversibly for the user).
It must have been a draft patch, then, Mike.

> I would had thought though that I was on reviewer Cc
> and I just tried and couldn't access it either.
You were reviewer and have commented (luckily I still have those comments).

I now have the patch and also the comments that Eike made. I can get on and 
concentrate on taking the next hurdle(s).

Thank you all!

Winfried

ciao
Christian
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice

RE: is gerrit #26348 still somewhere?

2019-04-26 Thread Winfried Donkers
Hi Xisco,

> This is the list of abandonded patch own by you -> 
> https://gerrit.libreoffice.org/#/q/status:abandoned+owner:%22Winfried+Donkers+%253Cwinfrieddonkers%2540libreoffice.org%253E%22
> is it in there? I can't find anything looking for 'tdf#124710'

No, it isn't in there. The gerrit change is from 2016 and the commit message 
did not have a bug report number in it, as there was no bug report at that 
time. I know the gerrit change number, 26348, and that one comment is dated 16 
June, 2016. The link in the mail of that comment (To view, visit 
https://gerrit.libreoffice.org/26348) does not work for me.
Now the current code has shown some unwanted behaviour and I want to try to fix 
that without making the errors I made in 2016...
If the gerrit 'commit' is lost, I just have a bit more to do ;-)

Winfried

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice

is gerrit #26348 still somewhere?

2019-04-26 Thread Winfried Donkers
Hi,

I am working on tdf#124710, which means that I need to convert functions IFS 
and SWITCH to 'jump functions'. I tried this before, but abandoned my work, 
which was in gerrit #26348.
Somehow I cannot retrieve that 'commit'.
Is there any way to retrieve it (so that I can read the comments and changes), 
or does it really no longer exist?

Winfried

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice

Re: tdf124710, unexpected result for function IFS when argument NA() is followed by an argument that needs interpreting

2019-04-17 Thread Winfried Donkers



The actual root cause here is that IFS() and SWITCH() are not compiled
into jumps so only the needed result would be calculated, but instead
all arguments are calculated beforehand as in usual function calls. We
had that discussion some while ago (and there exists some bug about it),
but I didn't get around to a different implementation. (right now I only
remember I had some idea for it to use existing means to compile an
IFS() call into some kind of nested or chained ocIf or ocChoose or some
such, would have to dig it out of my mail archive).

[...]
Not treating IFS() and SWITCH() as jumps of course code paths are
unnecessarily executed and has other unwanted side effects (like there
were cases where someone used STYLE() within but not the actual final
result), so the best fix would actually be to change that.


Yes, I remember. I tried but did not succeed. I may try again this time.

Winfried

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice

tdf124710, unexpected result for function IFS when argument NA() is followed by an argument that needs interpreting

2019-04-17 Thread Winfried Donkers
Hi Eike,

Upon debugging IFS( 0, NA(), 1+0, "output" ) I came to the following 
preliminary conclusions:
Before ScInterpreter::ScIfs_MS() is called, ScInterpreter::Interpret is called 
for argument '1+0' .
That leads to a call to scInterpreter::CalculateAddSub( false ) and there the 
problem starts.
0 and 1 are popped and added, but after PushDouble( ::rtl::math::approxAdd( 0, 
1 ) )
the raw stacktype is svError.
Unfortunately most of the time I have only a machine with 4GB available for 
debugging, giving 5 minutes max before freezing, so the simple question what 
the raw stacktype is before PushDouble (when NA() is on top of the stack) will 
take me up to an hour -which I don't have right now.

Do you happen to know if in the case of a token on top of the stack of type 
svError (like NA()), this stacktype is remained when pushing new values/tokens 
to the stack?
If that is the case, I wouldn't know a proper way to fix this, unless there are 
no use cases where this behaviour is desired.
Any thoughts?

Winfried

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice

RE: use of DBG_UNHANDLED_EXCEPTION

2019-04-05 Thread Winfried Donkers
Hi Stephan,

>> It won't compile.

> It would help to show (link to?) your exact changes and the exact failure.

Yes, that would have been be helpfull. Luckily Noel remembered and it seems 
that the 4 files in stoc/test/ that use '<< rExc' in the call to 
DBG_UNHANDLED_EXCEPTION are not examples of how the macro can be used.

Winfried
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice

RE: use of DBG_UNHANDLED_EXCEPTION

2019-04-05 Thread Winfried Donkers
Hi Noel,

>> just as you used it in stoc/test/testconv.cxx (and 3 other files in 
>> stoc/test).

> I don't think the code in those files stoc/test files are even compiled as 
> part of 
> our build, certainly that style of code doesn't work anymore.

> The way to use the DBG_UNHANDLED_EXCEPTION macro (on current master), is just 
> like this:
>   catch (const uno::Exception& )
>  {
> DBG_UNHANDLED_EXCEPTION("basctl.basicide");
>  }

> i.e. it only takes one parameter, which is the SAL log area for that code, 
> and it captures the current exception itself.

That helps, thank you.

Winfried

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice

use of DBG_UNHANDLED_EXCEPTION

2019-04-05 Thread Winfried Donkers
Hi Noel,

I hope you can help me solve a problem with DBG_UNHANDLED_EXCEPTION, as in your 
commit 48fbfe38f60de (5 April 2018).
I tried to use DBG_UNHANDLED_EXCEPTION("chart2", "Exception occurred : " << e);
in chart2/source/view/charttypes/VSeriesPlotter.cxx,
just as you used it in stoc/test/testconv.cxx (and 3 other files in stoc/test).
It won't compile.

Do you remember/know if my attempts are useless, or that I need something extra 
to make it work?


Winfried

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice

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

2019-03-28 Thread Winfried Donkers (via logerrit)
 sc/qa/unit/data/functions/mathematical/fods/rounddown.fods |   19 ++
 sc/qa/unit/data/functions/mathematical/fods/roundup.fods   |   19 ++
 sc/source/core/inc/interpre.hxx|1 
 sc/source/core/tool/interpr2.cxx   |   37 ++---
 4 files changed, 66 insertions(+), 10 deletions(-)

New commits:
commit edcbe8c4e02a67c74ec6f85f28899431dbfa0765
Author: Winfried Donkers 
AuthorDate: Tue Mar 26 16:27:09 2019 +0100
Commit: Eike Rathke 
CommitDate: Thu Mar 28 23:18:37 2019 +0100

tdf#124286 fix annoying rounding error.

In case of ROUNDDOWN and ROUNDUP, it is possible that seemingly clear 
decimal
values are rounded unexpectedly (from the user's POV). This is caused by 
the i
decimal to binary to decimal conversions.
By rounding to 12 significanr digits before calling the round-down of -up
function, most of these unexpected roundings are eliminated.

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

diff --git a/sc/qa/unit/data/functions/mathematical/fods/rounddown.fods 
b/sc/qa/unit/data/functions/mathematical/fods/rounddown.fods
index 5726eea4c9d5..0389f6348ef1 100644
--- a/sc/qa/unit/data/functions/mathematical/fods/rounddown.fods
+++ b/sc/qa/unit/data/functions/mathematical/fods/rounddown.fods
@@ -2123,6 +2123,23 @@
  
 
 
+ 
+  0.940
+ 
+ 
+  0.94
+ 
+ 
+  TRUE
+ 
+ 
+  =ROUNDDOWN(31415.92654, 3)
+ 
+ 
+ 
+ 
+
+
  
  
  
@@ -2408,4 +2425,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/qa/unit/data/functions/mathematical/fods/roundup.fods 
b/sc/qa/unit/data/functions/mathematical/fods/roundup.fods
index d1a56f7491cf..3fa289d4a2fc 100644
--- a/sc/qa/unit/data/functions/mathematical/fods/roundup.fods
+++ b/sc/qa/unit/data/functions/mathematical/fods/roundup.fods
@@ -2075,6 +2075,23 @@
  
 
 
+ 
+  0.060
+ 
+ 
+  0.06
+ 
+ 
+  TRUE
+ 
+ 
+  =ROUNDUP(8.06-8,2)
+ 
+ 
+ 
+ 
+
+
  
  
  
@@ -2360,4 +2377,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 3fd3dcf7668c..398fe707f86f 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -776,6 +776,7 @@ private:
 void ScConvertOOo();
 void ScEuroConvert();
 void ScRoundSignificant();
+static void RoundSignificant( double fX, double fDigits, double  );
 
 // financial functions
 void ScNPV();
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index b47acaddaf72..b8e4baef418f 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -983,10 +983,25 @@ void ScInterpreter::RoundNumber( rtl_math_RoundingMode 
eMode )
 else
 {
 sal_Int16 nDec = GetInt16();
+double fX = GetDouble();
 if ( nGlobalError != FormulaError::NONE || nDec < -20 || nDec > 20 
)
 PushIllegalArgument();
 else
-fVal = ::rtl::math::round( GetDouble(), nDec, eMode );
+{
+if ( ( eMode == rtl_math_RoundingMode_Down ||
+   eMode == rtl_math_RoundingMode_Up ) &&
+ nDec < 12 && fmod( fX, 1.0 ) != 0.0 )
+{
+// tdf124286 : round to 12 significant digits before 
rounding
+// down or up to avoid unexpected rounding 
errors
+// caused by decimal -> binary -> decimal 
conversion
+double fRes;
+RoundSignificant( fX, 12, fRes );
+fVal = ::rtl::math::round( fRes, nDec, eMode );
+}
+else
+fVal = ::rtl::math::round( fX, nDec, eMode );
+}
 }
 PushDouble(fVal);
 }
@@ -1007,6 +1022,17 @@ void ScInterpreter::ScRoundUp()
 RoundNumber( rtl_math_RoundingMode_Up );
 }
 
+void ScInterpreter::RoundSignificant( double fX, double fDigits, double  )
+{
+bool bNegVal = ( fX < 0 );
+if ( bNegVal )
+fX *= -1.0;
+double fTemp = ::rtl::math::approxFloor( log10( fX ) ) + 1.0 - fDigits;
+fRes = ::rtl::math::round( pow(10.0, -fTemp ) * fX ) * pow( 10.0, fTemp );
+if ( bNegVal )
+fRes *= -1.0;
+}
+
 // tdf#106931
 void ScInterpreter::ScRoundSignificant()
 {
@@ -1024,13 +1050,8 @@ void ScInterpreter::ScRoundSignificant()
 PushDouble( 0.0 );
 else
 {
-bool bNegVal = ( fX < 0 );
-if ( bNegVal )
-fX *= -1.0;
-double fTemp = ::rtl::math::approxFloor( log10( fX ) ) + 1.0

RE: Boolean configuration settings not editable in tools - advanced - expert configuration

2019-02-05 Thread Winfried Donkers
>> When using LO on a Linux machine, I need to double click a setting to edit 
>> it. In all cases, a dialog
>> appears. For string and int type settings, I can change/replace the value. 
>> For boolean seeting, a 
>> dialog appears, bu I cannot change true to false or vice versa.

> i just built a current master, and i'm not seeing this; double click 
> toggles the boolean.

>> When using LO on a Windows machine (where I am at his moment), there is a 
>> difference in tha case of
>> boolean type settings. No dialogs appears, but the value inverts by 
>> double-clicking.
>> I could not acchieve this (change the value of a boolean type setting by 
>> just double-clicking) on my
>> openSUSE leap 15.0 machines - which I cannot access right now.

> can you try different backends with SAL_USE_VCLPLUGIN=gen etc., maybe 
> it's specific to some particular one.

Will do. The annoying thing that I couldn't reproduce yesterday after a clean 
build, where I encountered the problem repeatedly in the weekend (on 1 machine).

Winfried
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: Boolean configuration settings not editable in tools - advanced - expert configuration

2019-02-04 Thread Winfried Donkers
Hi Mike,

>> I noticed a general unexpected behaviour when working with LibreOffice in 
>> Tools-Advanced-Expert Configuration.
>> When the setting is of type boolean, I cannot change the setting. I tried 
>> various existing settings, mainly in org.openoffice.Office.Calc and both 
>> with current Master and version as distributed with openSUSE Leap 15.0.
>> My conclusion was that for reasons unknown to me, boolean settings are not 
>> editable and int settings are.

> Could you please describe what exactly "not editable" means? I.e., "I 
> double-click the boolean setting, and expect a dialog to pop up like for 
> ints, but instead, the setting just changes from true to false and back 
> in place, without dialogs"?

Ah, now I'm beginning to understand what isn't clear.
When using LO on a Linux machine, I need to double click a setting to edit it. 
In all cases, a dialog appears. For string and int type settings, I can 
change/replace the value. For boolean seeting, a dialog appears, bu I cannot 
change true to false or vice versa.
When using LO on a Windows machine (where I am at his moment), there is a 
difference in tha case of boolean type settings. No dialogs appears, but the 
value inverts by double-clicking.
I could not acchieve this (change the value of a boolean type setting by just 
double-clicking) on my openSUSE leap 15.0 machines - which I cannot access 
right now.

HTH,

Winfried

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Boolean configuration settings not editable in tools - advanced - expert configuration

2019-02-04 Thread Winfried Donkers
(moving discussion from https://gerrit.libreoffice.org/#/c/67280/ to mailing 
list)

>> For reasons unknown to me, boolean configuration settings are read only on 
>> the 
>> expert configuration dialog, int/long values can be edited. This is not just 
>> in master,
>> but e.g. in version 6.0 as part of openSUSE too. I didn't investigate 
>> whether this
>> is as designed or a bug, as the focus of the current patch is the error 
>> rectangle code.

> I don't understand exactly what you claim is broken. Can you be more specific 
> please?
> (As you mention "version 6.0", it seems that you are talking about a generic 
> issue,
> not a specific issue with this patch? But there are certainly many properties 
> of boolean
> type in the registry, and I don't see a reason why this specific property 
> should be of 
> type int when it actually models a yes/no option.)

I noticed a general unexpected behaviour when working with LibreOffice in 
Tools-Advanced-Expert Configuration.
When the setting is of type boolean, I cannot change the setting. I tried 
various existing settings, mainly in org.openoffice.Office.Calc and both with 
current Master and version as distributed with openSUSE Leap 15.0.
My conclusion was that for reasons unknown to me, boolean settings are not 
editable and int settings are.
So I choose to use an int as type for a setting that is 'on' or 'off'.
I forgot to mention this behaviour in the mailing list when I made my discovery.

I'm trying to put that right now, and I would like to know whether the 
behaviour I described is intentional, a bug, or whether I did something in an 
incorrect way.

I hope this clarifies the situation.

WRT the specific issue, I want the setting to be of type boolean _and_ I need 
the setting to be editable. The latter is the most important at the moment, as 
the exact location (registry and/or document) and the accompanying UI are yet 
to be decided/inplemented.

Winfried

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: How do I add a new configuration item to registrymodifications.xcu

2019-02-01 Thread Winfried Donkers
Hi Heiko,


> I wrote a blog post some time ago about how to make a feature optional. It 
> comes from a
> non-developer/layman perspective to encourage people to look into the code. 
> Perhaps it’s 
> a bit helpful. 
> https://design.blog.documentfoundation.org/2018/04/14/easyhacking-how-to-make-a-feature-optional/
>  

Yes, that's helpful, especially for when I want to add the configuration option 
to the Options dialog.
FTB it's just under advanced -expert configuration.

In you blog you say it's surprisingly complex to implement a simple option. 
Well, in you case the framework was already present in module sw. 
In chart2, there is nothing yet and that presents a lot of challenges ;-)

Winfried

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: How do I add a new configuration item to registrymodifications.xcu

2019-02-01 Thread Winfried Donkers
Hi Michael,

>>> utl::ConfigItem is sort of deprecated and you should have a really good
>>> excuse to use it in new code.
>> 
>> I have no better excuse than that it existed in the same component.
>> Which method should I use instead (or where can I find good examples of code 
>> to use as guide)?
>
> just "git grep officecfg::" will find lots of examples, there are 
> headers generated that have a class for every config item and you can 
> get() and set() it.

I found sufficient examples to use; so far chart2 (where I'm currently working) 
does use officecfg:: yet.
Thanks!

Winfried
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: How do I add a new configuration item to registrymodifications.xcu

2019-01-31 Thread Winfried Donkers
Including the mailing list this time...

Winfried

-
Hi Michael, Stephan,

Thank you for your quick responses.

>> Therefore I need to add a configuration item to registrymodifications.xcu.
>> I have created a class to obtain the configuration item, using a derivative 
>> of ::com::sun::star::utl::ConfigItem and copying/adapting existing code to 
>> retrieve configuration items.

> utl::ConfigItem is sort of deprecated and you should have a really good 
> excuse to use it in new code.

I have no better excuse than that it existed in the same component. 
Which method should I use instead (or where can I find good examples of code to 
use as guide)?

> i see no mention of the word "officecfg" in your mail, which is worrisome :)

> so you first need to add your config item to the schema in 
> officecfg/registry/schema/ somewhere.

I should have mentioned that; I have added the item to 
officecfg/registry/schema/org/openoffice/Office/Calc/xcs.

> then "make officecfg postprocess" will get you the new configuration in 
> instdir; it should show up in Expert Configuration now, and if you 
> change it there it should automatically be written to 
> registrymodifications.xcu (which only contains non-default values).

That was what I didn't do, I ran make officecfg without the postprocess.
Now I no longer have the exceptions and can start testing thoroughly :)

Winfried

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


How do I add a new configuration item to registrymodifications.xcu

2019-01-31 Thread Winfried Donkers
Hi,

I am working on an enhancement for Calc, tdf90180.

Therefore I need to add a configuration item to registrymodifications.xcu.
I have created a class to obtain the configuration item, using a derivative of 
::com::sun::star::utl::ConfigItem and copying/adapting existing code to 
retrieve configuration items.

When the new configuration item is not yet in registrymodifications.xcu and 
upon opening a relevant Calc document I get an exception:
"warn::unotools::config:7006:7006:unotools/source/config/configitem.cxx:426: 
ignoring XHierarchicalNamesAccess to 
/org.openoffice.Office.Calc/Content/ErrorRectangle Exception: 
N3com3sun4star3uno9ExceptionE msg: ErrorRectangle"
When I manually add the configuration item to registrymodifications.xcu and 
open a relevant Calc document I get the same exception.
After running soffice (or scalc) my manual entry to registrymodifications.xcu 
is no longer there.

I have grepped similar -existing- configuration items in the code, and could 
not find anything that writes the item to registrymodifications.xcu.

Is there a simple way to fix this?
The only alternative I see now is to submit an incomplete patch to gerrit for 
review; I would like to avoid that.

Winfried

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: Gerrit, provider not supported (Yahoo)

2019-01-23 Thread Winfried Donkers

> Since yesterday, I can't log on gerrit with my Yahoo account, I got :
> "Provider is not supported, or was incorrectly entered."

I have the same problem and are equally interested in solutions.

Winfried
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Calc : (date)time parts, cell format and difference with other applications

2018-12-12 Thread Winfried Donkers
Hi all,

I added an attachment 
(https://bugs.documentfoundation.org/attachment.cgi?id=147433) to bug report 
tdf118800, with a comparison of the (date)time part functions (YEAR, MONTH, 
DAY, HOUR, MINUTE, SECOND) and some (date)time cell formats.

I made this comparison before submitting a patch for bug report tdf121978 
(https://bugs.documentfoundation.org/show_bug.cgi?id=121978) as I came across 
some unexpected differences between the time part functions and inconsistent 
(ambiguous?) differences between the definitions of date part functions in 
ODF1.2 part2.

In normal life, one could make a difference between (date)time and duration. 
Putting it simple, with (date)time a new minute only starts when 60 full 
seconds have passed since the last (i.e. the values are floored), but with 
duration a period can be rounded, e.g. an execution time of 1m 14.85s can be 
rounded to 1m 15s. This difference is not absolute (a quarter past twelve could 
be rounded and a contest to hold your breath at least 20 seconds probably will 
not accept 19.6s as adequate).
It seems ODF1.2 Part 2 uses both approaches. HOUR and MINUTE use floor and 
SECOND uses round (currently Calc uses floor, that's the subject of bug 
tdf121978).
But even with Calc's current SECOND function using floor, the cell format uses 
round for hour, minute and second presentation.
And weirdly a value of '2018-12-31 23:23:59.9' is shown as '2019-01-01 00' with 
cell format '-MM-DD HH', but as '2018-12-31' with cell format '-MM-DD'.

Excel seems quite consistent, by rounding all (date)time part functions and 
cell formats. It's just that with Excel new Year starts half a second sooner 
than in the real world. And the interoperability Calc-Excel is broken.

MariaDB and Transact SQL (used e.g. by Microsoft SQL server) are both 
consistent with their (date)time part functions: they all use floor. That  
makes (date)time data-exchange easy.

And now the questions:
-What should Calc do? IMHO the current behaviour is inconsistent and needs 
attention, both the Calc functions and the cell formatting.
-Should we propose a change of ODF1.2 part 2 with respect to (date)time 
functions? And which change(s)?

Any answers?
(Note that if there are lots of opinions, I may participate little in any 
discussion at most. The final outcome will be my reference for further action 
on (date)time part functions and possibly cell formatting.)

Winfried

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: tdf#69569 ODFFv1.2 part 2 incorrect

2018-12-03 Thread Winfried Donkers
Hi Eike,

> > c) The constraint date1 >= date2 is missing in §4.11.7.
> 
> It's date1 <= date2, isn't it? As stated for the other procedures as
> "If date1> date2, then swap the values of date1 and date2."
> I think that's missing for procedure E.

Yes, it should be
" c) The constraint date1 <= date2 is missing in §4.11.7."

> > I have made logical diagrams to cheack that all possible combinations of
> date1 and date2 are covered - on the presumption that date1 >= date2.
> 
> That date1 >= date2 confuses me, date1 <= date2?

Yes, it should be date1 <= date2. At last I was consistent in mie taping error.

> There's also a huge set of data available, yearfrac_data_basis_all.zip
> generated by Excel. It is said it was used to create the Python script.
> If the script already implements the correct algorithm there's probably
> nothing to do, but if not and needs modification, could you please
> verify the change with that data? Might be easiest to try with that
> before setting up Calc for it. Also two .ods files with some edge cases
> are there.

I will use this data for testing and enhancing the unittest document.

> > If you agree with my conclusions, would it be possible that you submit a
> proposal for changing ODFF to reflect the above?
> > I think that a proposal from you is more effective than one from me ;-)
> 
> Lol, I can do.

Great, I will start working on the code and testing, then.

Winfried
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: tdf#69569 ODFFv1.2 part 2 incorrect

2018-11-28 Thread Winfried Donkers
Hi Eike,

Have you been able to form an opinion yet re the conclusions/suggestions below?

Winfried

> woensdag 14 november 2018 11:38
> 
> Hi Eike,
> 
> I have been studying ODFFv1.2 part 2 §4.11.7.7 with
> https://bugs.documentfoundation.org/show_bug.cgi?id=69569#c17 , lines 1..5.
> in mind.
> 
> My conclusions are that
> a) Line 8 should be
> " 8.Otherwise, if _(not A)_ and is-leap-year(year(date1)) then return
> 366 ";
> b) Lines 9 and 10 can be combined by appending inclusive to both dates, the
> current line 9 is ambiguous and line 10 does not fully solve that;
> c) The constraint date1 >= date2 is missing in §4.11.7.
> 
> I have made logical diagrams to cheack that all possible combinations of
> date1 and date2 are covered - on the presumption that date1 >= date2.
> If you agree with my conclusions, would it be possible that you submit a
> proposal for changing ODFF to reflect the above?
> I think that a proposal from you is more effective than one from me ;-)
> 
> And if you agree with my conclusions I intend to work on bug tdf69569 to
> implement the proposed changes (c is already implemented in
> /core/scaddins/source.analysis/analysishelper.cxx, getYearFrac(.)).
> 
> 
> Winfried
> 
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


tdf#69569 ODFFv1.2 part 2 incorrect

2018-11-14 Thread Winfried Donkers
Hi Eike,

I have been studying ODFFv1.2 part 2 §4.11.7.7 with 
https://bugs.documentfoundation.org/show_bug.cgi?id=69569#c17 , lines 1..5. in 
mind.

My conclusions are that
a) Line 8 should be
" 8.Otherwise, if _(not A)_ and is-leap-year(year(date1)) then return 366 ";
b) Lines 9 and 10 can be combined by appending inclusive to both dates, the 
current line 9 is ambiguous and line 10 does not fully solve that;
c) The constraint date1 >= date2 is missing in §4.11.7. 

I have made logical diagrams to cheack that all possible combinations of date1 
and date2 are covered - on the presumption that date1 >= date2.
If you agree with my conclusions, would it be possible that you submit a 
proposal for changing ODFF to reflect the above? 
I think that a proposal from you is more effective than one from me ;-)

And if you agree with my conclusions I intend to work on bug tdf69569 to 
implement the proposed changes (c is already implemented in 
/core/scaddins/source.analysis/analysishelper.cxx, getYearFrac(.)).


Winfried

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Calc functions and Calc option 'convert text to number'

2018-07-13 Thread Winfried Donkers

Hi Eike,



I'm working on tdf64132, which is about SUM and text values that are not
converted to numbers.

That bug is wrong and not a bug, I'll explain there, so all further
speculations about changing behaviour and implied problems are moot ;-)


Well, then some additional help text will probably be needed to avoid 
confusion amongst users/bug-evaluators oh, and me ;-)

And I can start really looking into tdf118654.

Winfried
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Calc functions and Calc option 'convert text to number'

2018-07-12 Thread Winfried Donkers
Hi Eike,

I'm working on tdf64132, which is about SUM and text values that are not 
converted to numbers.
SUM uses ScInterpreter::IterateParameters(), which is used by various other 
Calc functions as well.
ScInterpreter::IterateParameters() does not handle the configuration settings 
for converting text to numbers properly.

For stack type svString I have a patch almost ready. The unit test is a problem 
for me, as the 'convert text to numbers' configuration is not in the test 
document and therefore unknown.

But the larger challenge lies with stack type svDoubleRef (probably the most 
used one). Here a sc::ColumnSpanSet is used with 
sc::ColumnSpanSet::ColumnAction (a.o. FuncSum), which in turn uses 
NumericCellAccumulator. And that class handles only sc::element_type_numeric 
and sc::element_type_formula, so text is discarded. I could add 
sc::element_type_string and the conversion to numbers depending on the 
configuration settings.
As that will have consequences beyond the Calc functions SUM and the like, I 
would like you opinion on this before I start implementing.
And all this leads to the question if all Calc functions expecting numeric 
arguments handle the 'convert tekst to numbers' configuration as advertised. It 
looks like I can keep myself occupied for quite some time with this ;-)

Winfried

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Calc functions and Calc option 'convert text to number'

2018-07-12 Thread Winfried Donkers

Hi Eike,

I'm working on tdf64132, which is about SUM and text values that are not 
converted to numbers.


SUM uses ScInterpreter::IterateParameters(), which is used by various 
other Calc functions as well.


ScInterpreter::IterateParameters() does not handle the configuration 
settings for converting text to numbers properly.


For stack type svString I have a patch ready (gerrit #57346). The unit 
test is a problem for me, as the 'convert text to numbers' configuration 
is not in the test document and therefore unknown. This is illustrated 
by a test passing on my computer and failing for Jenkins.


But the larger challenge lies with stack type svDoubleRef (probably the 
most used one). Here a sc::ColumnSpanSet is used with 
sc::ColumnSpanSet::ColumnAction (a.o. FuncSum), which in turn uses 
NumericCellAccumulator. And that class handles only 
sc::element_type_numeric and sc::element_type_formula, so text is 
discarded. I could add sc::element_type_string and the conversion to 
numbers depending on the configuration settings.


As that will have consequences beyond the Calc functions SUM and the 
like, I would like you opinion on this before I start implementing.


And all this leads to the question if all Calc functions expecting 
numeric arguments handle the 'convert text to numbers' configuration as 
advertised. It looks like I can keep myself occupied for quite some time 
with this ;-)


Winfried

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: sc/qa

2018-06-20 Thread Winfried Donkers
 sc/qa/unit/data/functions/spreadsheet/fods/column.fods |   79 +++---
 sc/qa/unit/data/functions/spreadsheet/fods/row.fods|  134 +++--
 2 files changed, 186 insertions(+), 27 deletions(-)

New commits:
commit 3613990eaae645e0489660be2dab8a61cab8a69c
Author: Winfried Donkers 
Date:   Mon Jun 18 19:32:22 2018 +0200

tdf#77517 Additions to unit tests.

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

diff --git a/sc/qa/unit/data/functions/spreadsheet/fods/column.fods 
b/sc/qa/unit/data/functions/spreadsheet/fods/column.fods
index 3a80f565b09e..09ab211bc32c 100644
--- a/sc/qa/unit/data/functions/spreadsheet/fods/column.fods
+++ b/sc/qa/unit/data/functions/spreadsheet/fods/column.fods
@@ -7224,34 +7224,75 @@
  
 
 
- 
- 
- 
- 
+ 
+  2
+ 
+ 
+  2
+ 
+ 
+  TRUE
+ 
+ 
+  
=COLUMN(file:///fake_path/filename#$Sheet3.B3)
+ 
  
  
  
 
 
- 
- 
- 
- 
+ 
+  2
+ 
+ 
+  2
+ 
+ 
+  TRUE
+ 
+ 
+  
{=COLUMN(file:///fake_path/filename#$Sheet3.B3:D8)}
+ 
  
 
 
- 
- 
- 
- 
- 
- 
+ 
+ 3
+ 
+ 
+  3
+ 
+ 
+  TRUE
+ 
+ 
+  
{=COLUMN(file:///fake_path/filename#$Sheet3.B3:D8)}
+ 
+ 
+ 
+  2
+ 
+ 
+  3
+ 
+ 
+  4
+ 
+ 
 
 
- 
- 
- 
- 
+ 
+  4
+ 
+ 
+  4
+ 
+ 
+  TRUE
+ 
+ 
+  
{=COLUMN(file:///fake_path/filename#$Sheet3.B3:D8)}
+ 
  
  
 
@@ -7374,4 +7415,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/qa/unit/data/functions/spreadsheet/fods/row.fods 
b/sc/qa/unit/data/functions/spreadsheet/fods/row.fods
index 37c0108c5405..cd69c66ed553 100644
--- a/sc/qa/unit/data/functions/spreadsheet/fods/row.fods
+++ b/sc/qa/unit/data/functions/spreadsheet/fods/row.fods
@@ -3293,9 +3293,18 @@
  
 
 
- 
- 
- 
+ 
+  3
+ 
+ 
+  3
+ 
+ 
+  TRUE
+ 
+ 
+  =ROW(file:///fake_path/filename#$Sheet1.B3)
+ 
  
  
  
@@ -3305,10 +3314,119 @@
  
  
 
-
- 
- 
- 
+
+ 
+  3
+ 
+ 
+  3
+ 
+ 
+  TRUE
+ 
+ 
+  
{=ROW(file:///fake_path/filename#$Sheet1.B3:D8)}
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+
+
+ 
+  4
+ 
+ 
+  4
+ 
+ 
+  TRUE
+ 
+ 
+  
{=ROW(file:///fake_path/filename#$Sheet1.B3:D8)}
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+
+
+ 
+  5
+ 
+ 
+  5
+ 
+ 
+  TRUE
+ 
+ 
+  
{=ROW(file:///fake_path/filename#$Sheet1.B3:D8)}
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+
+
+ 
+  6
+ 
+ 
+  6
+ 
+ 
+  TRUE
+ 
+ 
+  
{=ROW(file:///fake_path/filename#$Sheet1.B3:D8)}
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+
+
+ 
+  7
+ 
+ 
+  7
+ 
+ 
+  TRUE
+ 
+ 
+  
{=ROW(file:///fake_path/filename#$Sheet1.B3:D8)}
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+
+
+ 
+  8
+ 
+ 
+  8
+ 
+ 
+  TRUE
+ 
+ 
+  
{=ROW(file:///fake_path/filename#$Sheet1.B3:D8)}
+ 
  
  
  
@@ -4009,4 +4127,4 @@

   
  
-
\ No newline at end of file
+
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sc/source

2018-06-20 Thread Winfried Donkers
 sc/source/core/tool/interpr1.cxx |   39 ++-
 1 file changed, 30 insertions(+), 9 deletions(-)

New commits:
commit ad6bdc81f3b47cc46a7751e93e59fb92edd28baf
Author: Winfried Donkers 
Date:   Thu Jun 14 20:55:23 2018 +0200

tdf#77517 make Calc function ROW accept external references.

Change-Id: Ibd4f858abe825652c3df68ce7a21cbf16feea735
Reviewed-on: https://gerrit.libreoffice.org/55824
Tested-by: Jenkins
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 
(cherry picked from commit b1740fba0d1e6e3d69c3781734509317f42a0e4f)
Reviewed-on: https://gerrit.libreoffice.org/56129

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index e87e28d9c4db..9adedd0729ea 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -4361,7 +4361,7 @@ void ScInterpreter::ScRow()
 sal_uInt8 nParamCount = GetByte();
 if ( MustHaveParamCount( nParamCount, 0, 1 ) )
 {
-double nVal = 0;
+double nVal = 0.0;
 if (nParamCount == 0)
 {
 nVal = aPos.Row() + 1;
@@ -4400,15 +4400,39 @@ void ScInterpreter::ScRow()
 nVal = static_cast(nRow1 + 1);
 }
 break;
+case svExternalSingleRef :
+{
+sal_uInt16 nFileId;
+OUString aTabName;
+ScSingleRefData aRef;
+PopExternalSingleRef( nFileId, aTabName, aRef );
+ScAddress aAbsRef = aRef.toAbs( aPos );
+nVal = static_cast( aAbsRef.Row() + 1 );
+}
+break;
 case svDoubleRef :
+case svExternalDoubleRef :
 {
-SCCOL nCol1;
 SCROW nRow1;
-SCTAB nTab1;
-SCCOL nCol2;
 SCROW nRow2;
-SCTAB nTab2;
-PopDoubleRef( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
+if ( GetStackType() == svDoubleRef )
+{
+SCCOL nCol1;
+SCTAB nTab1;
+SCCOL nCol2;
+SCTAB nTab2;
+PopDoubleRef( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 
);
+}
+else
+{
+sal_uInt16 nFileId;
+OUString aTabName;
+ScComplexRefData aRef;
+PopExternalDoubleRef( nFileId, aTabName, aRef );
+ScRange aAbs = aRef.toAbs( aPos );
+nRow1 = aAbs.aStart.Row();
+nRow2 = aAbs.aEnd.Row();
+}
 if (nRow2 > nRow1)
 {
 ScMatrixRef pResMat = GetNewMat( 1,
@@ -4421,8 +4445,6 @@ void ScInterpreter::ScRow()
 PushMatrix(pResMat);
 return;
 }
-else
-nVal = 0.0;
 }
 else
 nVal = static_cast(nRow1 + 1);
@@ -4430,7 +4452,6 @@ void ScInterpreter::ScRow()
 break;
 default:
 SetError( FormulaError::IllegalParameter );
-nVal = 0.0;
 }
 }
 PushDouble( nVal );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sc/source

2018-06-19 Thread Winfried Donkers
 sc/source/core/tool/interpr1.cxx |   40 ++-
 1 file changed, 31 insertions(+), 9 deletions(-)

New commits:
commit d5c8199a94d0e2f722fff6637b930205a6641adf
Author: Winfried Donkers 
Date:   Mon Jun 18 19:31:47 2018 +0200

tdf#77517 make Calc function COLUMN accept external references.

Change-Id: Ife00755586be9a42ac5cf1f9b3debb396db1b45f
Reviewed-on: https://gerrit.libreoffice.org/56055
Tested-by: Jenkins
Reviewed-by: Eike Rathke 
(cherry picked from commit 28f3e44e99283ede636c28c68bffb2b9df0bbcf8)
Reviewed-on: https://gerrit.libreoffice.org/56128

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 712c0537e330..e87e28d9c4db 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -4258,7 +4258,7 @@ void ScInterpreter::ScColumn()
 sal_uInt8 nParamCount = GetByte();
 if ( MustHaveParamCount( nParamCount, 0, 1 ) )
 {
-double nVal = 0;
+double nVal = 0.0;
 if (nParamCount == 0)
 {
 nVal = aPos.Col() + 1;
@@ -4297,15 +4297,40 @@ void ScInterpreter::ScColumn()
 nVal = static_cast(nCol1 + 1);
 }
 break;
+case svExternalSingleRef :
+{
+sal_uInt16 nFileId;
+OUString aTabName;
+ScSingleRefData aRef;
+PopExternalSingleRef( nFileId, aTabName, aRef );
+ScAddress aAbsRef = aRef.toAbs( aPos );
+nVal = static_cast( aAbsRef.Col() + 1 );
+}
+break;
+
 case svDoubleRef :
+case svExternalDoubleRef :
 {
 SCCOL nCol1;
-SCROW nRow1;
-SCTAB nTab1;
 SCCOL nCol2;
-SCROW nRow2;
-SCTAB nTab2;
-PopDoubleRef( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
+if ( GetStackType() == svDoubleRef )
+{
+SCROW nRow1;
+SCTAB nTab1;
+SCROW nRow2;
+SCTAB nTab2;
+PopDoubleRef( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 
);
+}
+else
+{
+sal_uInt16 nFileId;
+OUString aTabName;
+ScComplexRefData aRef;
+PopExternalDoubleRef( nFileId, aTabName, aRef );
+ScRange aAbs = aRef.toAbs( aPos );
+nCol1 = aAbs.aStart.Col();
+nCol2 = aAbs.aEnd.Col();
+}
 if (nCol2 > nCol1)
 {
 ScMatrixRef pResMat = GetNewMat(
@@ -4318,8 +4343,6 @@ void ScInterpreter::ScColumn()
 PushMatrix(pResMat);
 return;
 }
-else
-nVal = 0.0;
 }
 else
 nVal = static_cast(nCol1 + 1);
@@ -4327,7 +4350,6 @@ void ScInterpreter::ScColumn()
 break;
 default:
 SetError( FormulaError::IllegalParameter );
-nVal = 0.0;
 }
 }
 PushDouble( nVal );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-06-19 Thread Winfried Donkers
 sc/source/core/tool/interpr1.cxx |   40 ++-
 1 file changed, 31 insertions(+), 9 deletions(-)

New commits:
commit 28f3e44e99283ede636c28c68bffb2b9df0bbcf8
Author: Winfried Donkers 
Date:   Mon Jun 18 19:31:47 2018 +0200

tdf#77517 make Calc function COLUMN accept external references.

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

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index a04aadcc9cea..9adedd0729ea 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -4258,7 +4258,7 @@ void ScInterpreter::ScColumn()
 sal_uInt8 nParamCount = GetByte();
 if ( MustHaveParamCount( nParamCount, 0, 1 ) )
 {
-double nVal = 0;
+double nVal = 0.0;
 if (nParamCount == 0)
 {
 nVal = aPos.Col() + 1;
@@ -4297,15 +4297,40 @@ void ScInterpreter::ScColumn()
 nVal = static_cast(nCol1 + 1);
 }
 break;
+case svExternalSingleRef :
+{
+sal_uInt16 nFileId;
+OUString aTabName;
+ScSingleRefData aRef;
+PopExternalSingleRef( nFileId, aTabName, aRef );
+ScAddress aAbsRef = aRef.toAbs( aPos );
+nVal = static_cast( aAbsRef.Col() + 1 );
+}
+break;
+
 case svDoubleRef :
+case svExternalDoubleRef :
 {
 SCCOL nCol1;
-SCROW nRow1;
-SCTAB nTab1;
 SCCOL nCol2;
-SCROW nRow2;
-SCTAB nTab2;
-PopDoubleRef( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
+if ( GetStackType() == svDoubleRef )
+{
+SCROW nRow1;
+SCTAB nTab1;
+SCROW nRow2;
+SCTAB nTab2;
+PopDoubleRef( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 
);
+}
+else
+{
+sal_uInt16 nFileId;
+OUString aTabName;
+ScComplexRefData aRef;
+PopExternalDoubleRef( nFileId, aTabName, aRef );
+ScRange aAbs = aRef.toAbs( aPos );
+nCol1 = aAbs.aStart.Col();
+nCol2 = aAbs.aEnd.Col();
+}
 if (nCol2 > nCol1)
 {
 ScMatrixRef pResMat = GetNewMat(
@@ -4318,8 +4343,6 @@ void ScInterpreter::ScColumn()
 PushMatrix(pResMat);
 return;
 }
-else
-nVal = 0.0;
 }
 else
 nVal = static_cast(nCol1 + 1);
@@ -4327,7 +4350,6 @@ void ScInterpreter::ScColumn()
 break;
 default:
 SetError( FormulaError::IllegalParameter );
-nVal = 0.0;
 }
 }
 PushDouble( nVal );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-06-15 Thread Winfried Donkers
 sc/source/core/tool/interpr1.cxx |   39 ++-
 1 file changed, 30 insertions(+), 9 deletions(-)

New commits:
commit b1740fba0d1e6e3d69c3781734509317f42a0e4f
Author: Winfried Donkers 
Date:   Thu Jun 14 20:55:23 2018 +0200

tdf#77517 make Calc function ROW accept external references.

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

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 712c0537e330..a04aadcc9cea 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -4339,7 +4339,7 @@ void ScInterpreter::ScRow()
 sal_uInt8 nParamCount = GetByte();
 if ( MustHaveParamCount( nParamCount, 0, 1 ) )
 {
-double nVal = 0;
+double nVal = 0.0;
 if (nParamCount == 0)
 {
 nVal = aPos.Row() + 1;
@@ -4378,15 +4378,39 @@ void ScInterpreter::ScRow()
 nVal = static_cast(nRow1 + 1);
 }
 break;
+case svExternalSingleRef :
+{
+sal_uInt16 nFileId;
+OUString aTabName;
+ScSingleRefData aRef;
+PopExternalSingleRef( nFileId, aTabName, aRef );
+ScAddress aAbsRef = aRef.toAbs( aPos );
+nVal = static_cast( aAbsRef.Row() + 1 );
+}
+break;
 case svDoubleRef :
+case svExternalDoubleRef :
 {
-SCCOL nCol1;
 SCROW nRow1;
-SCTAB nTab1;
-SCCOL nCol2;
 SCROW nRow2;
-SCTAB nTab2;
-PopDoubleRef( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
+if ( GetStackType() == svDoubleRef )
+{
+SCCOL nCol1;
+SCTAB nTab1;
+SCCOL nCol2;
+SCTAB nTab2;
+PopDoubleRef( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 
);
+}
+else
+{
+sal_uInt16 nFileId;
+OUString aTabName;
+ScComplexRefData aRef;
+PopExternalDoubleRef( nFileId, aTabName, aRef );
+ScRange aAbs = aRef.toAbs( aPos );
+nRow1 = aAbs.aStart.Row();
+nRow2 = aAbs.aEnd.Row();
+}
 if (nRow2 > nRow1)
 {
 ScMatrixRef pResMat = GetNewMat( 1,
@@ -4399,8 +4423,6 @@ void ScInterpreter::ScRow()
 PushMatrix(pResMat);
 return;
 }
-else
-nVal = 0.0;
 }
 else
 nVal = static_cast(nRow1 + 1);
@@ -4408,7 +4430,6 @@ void ScInterpreter::ScRow()
 break;
 default:
 SetError( FormulaError::IllegalParameter );
-nVal = 0.0;
 }
 }
 PushDouble( nVal );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


tdf97815 switching to English function names does not work with _ADD functions

2018-05-28 Thread Winfried Donkers
Hi Eike,

As I did some work in the past on this aspect, I try to fix this bug, even 
though I am not a big fan of the Add-In functions ;-).
I came across code that I don't understand enough:
1. /scaddins/source/analysis/deffuncname.hxx contains a lot of static const 
char*[2], with German and English function name. Why is there a German function 
name, can't this be removed (this German function name must at least be related 
to the cause of the bug)?
2. /scaddins/source/analysis/analysishelper.cxx contains a const FuncDataBase 
pFuncDatas[], that uses a macro FUNCDATA, which uses "get" to fill the 
structure. I can't easily find this "get"; do you know where it is defined?

Winfried

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/qa sc/source

2018-05-11 Thread Winfried Donkers
 sc/qa/unit/data/functions/statistical/fods/countif.fods |   22 
 sc/source/core/data/dociter.cxx |2 -
 2 files changed, 18 insertions(+), 6 deletions(-)

New commits:
commit 9b2ebcfe80900b2f6299851d3a271bdcaa85049a
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Wed May 9 10:40:03 2018 +0200

tdf#117433 count empty cells properly with COUNTIF.

All empty columns after the first column of the range were skipped.
When the query contains an 'cell is empty' expression, skipping is omitted.

Change-Id: I0d5b0d24c2d08bad88479cd5b356529a0a709156
Reviewed-on: https://gerrit.libreoffice.org/54021
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>
(cherry picked from commit 1a8febcaa4f932124d417877a3b08bd059c0362d)
Reviewed-on: https://gerrit.libreoffice.org/54037
Reviewed-by: Caolán McNamara <caol...@redhat.com>
Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sc/qa/unit/data/functions/statistical/fods/countif.fods 
b/sc/qa/unit/data/functions/statistical/fods/countif.fods
index 557e70b2044f..8625ebe7aeff 100644
--- a/sc/qa/unit/data/functions/statistical/fods/countif.fods
+++ b/sc/qa/unit/data/functions/statistical/fods/countif.fods
@@ -3865,10 +3865,22 @@
  
 
 
- 
- 
- 
- 
+ 
+  12
+ 
+ 
+  12
+ 
+ 
+  TRUE
+ 
+ 
+  =COUNTIF(P20:R23,)
+ 
+ 
+  tdf#117433
+ 
+ 
  
  
  
@@ -4469,4 +4481,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 96af2dbc3150..689abc31d07a 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -1144,7 +1144,7 @@ bool ScQueryCellIterator::GetThis()
 }
 pCol = &(pDoc->maTabs[nTab])->aCol[nCol];
 }
-while (pCol->IsEmptyData());
+while (!rItem.mbMatchEmpty && pCol->IsEmptyData());
 
 InitPos();
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-05-09 Thread Winfried Donkers
 sc/qa/unit/data/functions/statistical/fods/countif.fods |   22 
 sc/source/core/data/dociter.cxx |2 -
 2 files changed, 18 insertions(+), 6 deletions(-)

New commits:
commit 1a8febcaa4f932124d417877a3b08bd059c0362d
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Wed May 9 10:40:03 2018 +0200

tdf#117433 count empty cells properly with COUNTIF.

All empty columns after the first column of the range were skipped.
When the query contains an 'cell is empty' expression, skipping is omitted.

Change-Id: I0d5b0d24c2d08bad88479cd5b356529a0a709156
Reviewed-on: https://gerrit.libreoffice.org/54021
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/qa/unit/data/functions/statistical/fods/countif.fods 
b/sc/qa/unit/data/functions/statistical/fods/countif.fods
index 557e70b2044f..8625ebe7aeff 100644
--- a/sc/qa/unit/data/functions/statistical/fods/countif.fods
+++ b/sc/qa/unit/data/functions/statistical/fods/countif.fods
@@ -3865,10 +3865,22 @@
  
 
 
- 
- 
- 
- 
+ 
+  12
+ 
+ 
+  12
+ 
+ 
+  TRUE
+ 
+ 
+  =COUNTIF(P20:R23,)
+ 
+ 
+  tdf#117433
+ 
+ 
  
  
  
@@ -4469,4 +4481,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index b09c4413301b..0c74233f4c90 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -1144,7 +1144,7 @@ bool ScQueryCellIterator::GetThis()
 }
 pCol = &(pDoc->maTabs[nTab])->aCol[nCol];
 }
-while (pCol->IsEmptyData());
+while (!rItem.mbMatchEmpty && pCol->IsEmptyData());
 
 InitPos();
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


tdf117433 COUNIF doesn't count cells after first column in range for empty criteria

2018-05-08 Thread Winfried Donkers
Hi Eike,

I found what causes the problem of bug tdf117443, but I don't understand why 
the code is as it is now and therefore I am reluctant to change it.
In sc/source/core/data/dociter.cxx:ScQueryValueIterator::GetThis() there is a 
loop in lines 1132-1143 that is entered as soon as the first column of the 
range has been processed and a new column is started.
The loop skips empty columns, which is annoying when you want to count empty 
cells.

Do you know/remember if this code is only there to improve efficiency of the 
iterator?
Would it be a good idea to add a boolean mbDontSkipEmptyCols to 
ScQueryValueIterator which is only set to true for e.g. ScCountIf (ideally only 
when empty cell is part of the query, but I don't know if that can be achieved 
simply).?

Winfried

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: tdf117433 COUNIF doesn't count cells after first column in range for empty criteria

2018-05-08 Thread Winfried Donkers

Hi Eike,


On 05/08/2018 02:52 PM, Eike Rathke wrote:

In sc/source/core/data/dociter.cxx:ScQueryValueIterator::GetThis()
ScQueryCellIterator::GetThis() that is..

Sorry for that..

Would it be a good idea to add a boolean mbDontSkipEmptyCols to

ScQueryValueIterator which is only set to true for e.g. ScCountIf
(ideally only when empty cell is part of the query, but I don't know
if that can be achieved simply).?

It shouldn't need another parameter, just evaluating also
rItem.mbMatchEmpty there should be sufficient, so

 while (!rItem.mbMatchEmpty && pCol->IsEmptyData());

(untested)


Well, that's the way I will be going then. Thanks!

Winfried
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2018-05-03 Thread Winfried Donkers
 sc/qa/unit/data/functions/statistical/fods/hypgeomdist.fods |  145 
 sc/source/core/tool/interpr3.cxx|2 
 2 files changed, 146 insertions(+), 1 deletion(-)

New commits:
commit 5cee94308b8dbceb11de4ac02e1d7c9808ccdb02
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Wed May 2 15:51:48 2018 +0200

tdf#117041 use correct expression in if statement.

Follow up of commit e58b3f987681d0034f692db82345af06de217836.

Change-Id: Ia142ae401a8c86e3411830703794eedb351bca09
Reviewed-on: https://gerrit.libreoffice.org/53733
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/qa/unit/data/functions/statistical/fods/hypgeomdist.fods 
b/sc/qa/unit/data/functions/statistical/fods/hypgeomdist.fods
index 86e67be89a36..4b57e0150907 100644
--- a/sc/qa/unit/data/functions/statistical/fods/hypgeomdist.fods
+++ b/sc/qa/unit/data/functions/statistical/fods/hypgeomdist.fods
@@ -4469,6 +4469,151 @@
  
 
 
+
+  1
+ 
+ 
+  1
+ 
+ 
+  TRUE
+ 
+ 
+  =HYPGEOMDIST(2,4,1,10,1)
+ 
+ 
+  tdf117041
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+
+
+
+  0
+ 
+ 
+  0
+ 
+ 
+  TRUE
+ 
+ 
+  =HYPGEOMDIST(2,4,1,10,1)
+ 
+ 
+  tdf117041
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+
+
+
+  0.4
+ 
+ 
+  0.4
+ 
+ 
+  TRUE
+ 
+ 
+  =HYPGEOMDIST(1,4,1,10,0)
+ 
+ 
+  tdf117041
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+
+
+
+  0
+ 
+ 
+  0
+ 
+ 
+  TRUE
+ 
+ 
+  =HYPGEOMDIST(1,4,4,6,0)
+ 
+ 
+  tdf117041
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+
+
+
+  0.4
+ 
+ 
+  0.4
+ 
+ 
+  TRUE
+ 
+ 
+  =HYPGEOMDIST(2,4,4,6,0)
+ 
+ 
+  tdf117041
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+
+
  
  
  
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 2a9535e31c8d..b52a62fd3d20 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -1868,7 +1868,7 @@ void ScInterpreter::ScHypGeomDist( int nMinParamCount )
 
 for ( int i = ( bCumulative ? 0 : x ); i <= x && nGlobalError == 
FormulaError::NONE; i++ )
 {
-if ( (i >= n - N + M)  || (i >= M) )
+if ( (n - i <= N - M) && (i <= M) )
 fVal +=  GetHypGeomDist( i, n, M, N );
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-04-25 Thread Winfried Donkers
 sc/source/core/tool/interpr6.cxx |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit a985d4c2977ca23971f145b93a0155827bebfcdf
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Wed Apr 25 16:35:04 2018 +0200

Check if reference is to be ignored before counting.

tdf#116706 related.

Change-Id: If9f7326a411e537a5f797bcbe7d77af2c22ad352
Reviewed-on: https://gerrit.libreoffice.org/53454
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index 4d5febc210e1..a9b48d061b3c 100644
--- a/sc/source/core/tool/interpr6.cxx
+++ b/sc/source/core/tool/interpr6.cxx
@@ -670,6 +670,13 @@ void ScInterpreter::IterateParameters( ScIterFunc eFunc, 
bool bTextAsZero )
 return;
 }
 
+if ( ( ( mnSubTotalFlags & SubtotalFlags::IgnoreFiltered ) &&
+ pDok->RowFiltered( aAdr.Row(), aAdr.Tab() ) ) ||
+ ( ( mnSubTotalFlags & SubtotalFlags::IgnoreHidden ) &&
+   pDok->RowHidden( aAdr.Row(), aAdr.Tab() ) ) )
+{
+break;
+}
 if ( nGlobalError != FormulaError::NONE && ( eFunc == ifCOUNT2 
|| eFunc == ifCOUNT ||
  ( mnSubTotalFlags & SubtotalFlags::IgnoreErrVal ) ) )
 {
@@ -678,13 +685,6 @@ void ScInterpreter::IterateParameters( ScIterFunc eFunc, 
bool bTextAsZero )
 ++nCount;
 break;
 }
-if ( ( ( mnSubTotalFlags & SubtotalFlags::IgnoreFiltered ) &&
- pDok->RowFiltered( aAdr.Row(), aAdr.Tab() ) ) ||
- ( ( mnSubTotalFlags & SubtotalFlags::IgnoreHidden ) &&
-   pDok->RowHidden( aAdr.Row(), aAdr.Tab() ) ) )
-{
-break;
-}
 ScRefCellValue aCell(*pDok, aAdr);
 if (!aCell.isEmpty())
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-04-25 Thread Winfried Donkers
 sc/qa/unit/data/functions/statistical/fods/hypgeomdist.fods |   73 ++--
 sc/source/core/tool/interpr3.cxx|   20 +--
 2 files changed, 71 insertions(+), 22 deletions(-)

New commits:
commit e58b3f987681d0034f692db82345af06de217836
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Fri Apr 20 21:23:08 2018 +0200

tdf#117041 implement note at end of ODFF1.2 par. 6.18.37

And avoid double code by putting the non-cumulative calculation in
the loop as well.

Change-Id: I8538582e7d33370f5e44382924b9e3e89efa28dd
Reviewed-on: https://gerrit.libreoffice.org/53221
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/qa/unit/data/functions/statistical/fods/hypgeomdist.fods 
b/sc/qa/unit/data/functions/statistical/fods/hypgeomdist.fods
index 668562200ee5..86e67be89a36 100644
--- a/sc/qa/unit/data/functions/statistical/fods/hypgeomdist.fods
+++ b/sc/qa/unit/data/functions/statistical/fods/hypgeomdist.fods
@@ -4385,11 +4385,22 @@
  
 
 
- 
- 
- 
- 
- 
+ 
+  0.988500551352757
+ 
+ 
+  0.988500551352757
+ 
+ 
+  TRUE
+ 
+ 
+  =HYPGEOMDIST(53,55,269,300,1)
+ 
+ 
+  tdf117041
+ 
+ 
  
  
  
@@ -4399,12 +4410,52 @@
  
  
 
-
- 
+
+ 
+  0.95624768719555
+ 
+ 
+  0.95624768719555
+ 
+ 
+  TRUE
+ 
+ 
+  =HYPGEOMDIST(34,36,89,100,1)
+ 
+ 
+  tdf117041
+ 
+ 
+ 
+ 
+ 
+  
+ 
  
- 
- 
- 
+ 
+ 
+ 
+ 
+ 
+
+
+
+  0
+ 
+ 
+  0
+ 
+ 
+  TRUE
+ 
+ 
+  =HYPGEOMDIST(24,36,89,100)
+ 
+ 
+  tdf117041
+ 
+ 
  
  
  
@@ -5084,4 +5135,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 46328e5d8009..2a9535e31c8d 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -1844,7 +1844,7 @@ static void lcl_PutFactorialElements( ::std::vector< 
double >& cn, double fLower
 
 @see fdo#71722
 @see tdf#102948, make Calc function ODFF1.2-compliant
-
+@see tdf#117041, implement note at bottom of ODFF1.2 par.6.18.37
  */
 void ScInterpreter::ScHypGeomDist( int nMinParamCount )
 {
@@ -1858,23 +1858,21 @@ void ScInterpreter::ScHypGeomDist( int nMinParamCount )
 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) )
+if ( (x < 0.0) || (n < x) || (N < n) || (N < M) || (M < 0.0) )
 {
 PushIllegalArgument();
 return;
 }
 
-if ( bCumulative )
-{
-double fVal = 0.0;
-
-for ( int i = 0; i <= x && nGlobalError == FormulaError::NONE; i++ )
-fVal += GetHypGeomDist( i, n, M, N );
+double fVal = 0.0;
 
-PushDouble( fVal );
+for ( int i = ( bCumulative ? 0 : x ); i <= x && nGlobalError == 
FormulaError::NONE; i++ )
+{
+if ( (i >= n - N + M)  || (i >= M) )
+fVal +=  GetHypGeomDist( i, n, M, N );
 }
-else
-PushDouble( GetHypGeomDist( x, n, M, N ) );
+
+PushDouble( fVal );
 }
 
 /** Calculates a value of the hypergeometric distribution.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/qa sc/source

2018-04-09 Thread Winfried Donkers
 sc/qa/unit/data/functions/mathematical/fods/aggregate.fods |   40 -
 sc/source/core/tool/interpr6.cxx   |6 +
 2 files changed, 42 insertions(+), 4 deletions(-)

New commits:
commit 2c51260d91490a6fc512875d8befb38367bf3227
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Fri Apr 6 19:55:12 2018 +0200

tdf#116706 fix for AGGREGATE with hidden rows and single references.

Change-Id: I6ac88f26b46a17e1857b7b40d2034fb321973625
Reviewed-on: https://gerrit.libreoffice.org/52522
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Jenkins <c...@libreoffice.org>
(cherry picked from commit 0a4c1fb68c3619e61099a7c548f550b0d3fd7a53)
Reviewed-on: https://gerrit.libreoffice.org/52651

diff --git a/sc/qa/unit/data/functions/mathematical/fods/aggregate.fods 
b/sc/qa/unit/data/functions/mathematical/fods/aggregate.fods
index 66162e697742..62e72ca08da6 100644
--- a/sc/qa/unit/data/functions/mathematical/fods/aggregate.fods
+++ b/sc/qa/unit/data/functions/mathematical/fods/aggregate.fods
@@ -5881,7 +5881,43 @@
  
  
 
-
+
+ 
+  0
+ 
+ 
+  0
+ 
+ 
+  TRUE
+ 
+ 
+  =AGGREGATE(3,5,$C$6)
+ 
+ 
+  tdf116706
+ 
+ 
+
+
+ 
+  0
+ 
+ 
+  0
+ 
+ 
+  TRUE
+ 
+ 
+  =AGGREGATE(3,5,$C$6:$C$6)
+ 
+ 
+  tdf116706
+ 
+ 
+
+
  
 
 
@@ -5920,4 +5956,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index 62c96376c664..449375638cb5 100644
--- a/sc/source/core/tool/interpr6.cxx
+++ b/sc/source/core/tool/interpr6.cxx
@@ -678,8 +678,10 @@ void ScInterpreter::IterateParameters( ScIterFunc eFunc, 
bool bTextAsZero )
 ++nCount;
 break;
 }
-if ( ( mnSubTotalFlags & SubtotalFlags::IgnoreFiltered ) &&
- pDok->RowFiltered( aAdr.Row(), aAdr.Tab() ) )
+if ( ( ( mnSubTotalFlags & SubtotalFlags::IgnoreFiltered ) &&
+ pDok->RowFiltered( aAdr.Row(), aAdr.Tab() ) ) ||
+ ( ( mnSubTotalFlags & SubtotalFlags::IgnoreHidden ) &&
+   pDok->RowHidden( aAdr.Row(), aAdr.Tab() ) ) )
 {
 break;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-04-09 Thread Winfried Donkers
 sc/qa/unit/data/functions/mathematical/fods/aggregate.fods |   40 -
 sc/source/core/tool/interpr6.cxx   |6 +
 2 files changed, 42 insertions(+), 4 deletions(-)

New commits:
commit 0a4c1fb68c3619e61099a7c548f550b0d3fd7a53
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Fri Apr 6 19:55:12 2018 +0200

tdf#116706 fix for AGGREGATE with hidden rows and single references.

Change-Id: I6ac88f26b46a17e1857b7b40d2034fb321973625
Reviewed-on: https://gerrit.libreoffice.org/52522
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Jenkins <c...@libreoffice.org>

diff --git a/sc/qa/unit/data/functions/mathematical/fods/aggregate.fods 
b/sc/qa/unit/data/functions/mathematical/fods/aggregate.fods
index 66162e697742..62e72ca08da6 100644
--- a/sc/qa/unit/data/functions/mathematical/fods/aggregate.fods
+++ b/sc/qa/unit/data/functions/mathematical/fods/aggregate.fods
@@ -5881,7 +5881,43 @@
  
  
 
-
+
+ 
+  0
+ 
+ 
+  0
+ 
+ 
+  TRUE
+ 
+ 
+  =AGGREGATE(3,5,$C$6)
+ 
+ 
+  tdf116706
+ 
+ 
+
+
+ 
+  0
+ 
+ 
+  0
+ 
+ 
+  TRUE
+ 
+ 
+  =AGGREGATE(3,5,$C$6:$C$6)
+ 
+ 
+  tdf116706
+ 
+ 
+
+
  
 
 
@@ -5920,4 +5956,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index e1bc0d696b0b..4d5febc210e1 100644
--- a/sc/source/core/tool/interpr6.cxx
+++ b/sc/source/core/tool/interpr6.cxx
@@ -678,8 +678,10 @@ void ScInterpreter::IterateParameters( ScIterFunc eFunc, 
bool bTextAsZero )
 ++nCount;
 break;
 }
-if ( ( mnSubTotalFlags & SubtotalFlags::IgnoreFiltered ) &&
- pDok->RowFiltered( aAdr.Row(), aAdr.Tab() ) )
+if ( ( ( mnSubTotalFlags & SubtotalFlags::IgnoreFiltered ) &&
+ pDok->RowFiltered( aAdr.Row(), aAdr.Tab() ) ) ||
+ ( ( mnSubTotalFlags & SubtotalFlags::IgnoreHidden ) &&
+   pDok->RowHidden( aAdr.Row(), aAdr.Tab() ) ) )
 {
 break;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-03-29 Thread Winfried Donkers
 sc/qa/unit/data/functions/statistical/fods/mode.mult.fods |   28 ++--
 sc/source/core/inc/interpre.hxx   |3 
 sc/source/core/tool/interpr3.cxx  |   89 ++
 sc/source/core/tool/interpr4.cxx  |4 
 sc/source/core/tool/interpr5.cxx  |   63 -
 5 files changed, 81 insertions(+), 106 deletions(-)

New commits:
commit fc121c32ca0effb47d219066a6848435cba562cc
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Wed Mar 21 16:57:36 2018 +0100

tdf#97977 make MODE.MULT fully compatible with Excel.

Also, improve efficiency of function.

Change-Id: Id01542bdd997e0cacfdfd16683d1ac832d22fa35
Reviewed-on: https://gerrit.libreoffice.org/51708
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/qa/unit/data/functions/statistical/fods/mode.mult.fods 
b/sc/qa/unit/data/functions/statistical/fods/mode.mult.fods
index e26bd6673d3a..23a631162d52 100644
--- a/sc/qa/unit/data/functions/statistical/fods/mode.mult.fods
+++ b/sc/qa/unit/data/functions/statistical/fods/mode.mult.fods
@@ -3416,8 +3416,8 @@
   1
  
  
- 
-  1
+ 
+  2
  
  
 
@@ -3443,8 +3443,8 @@
  
  
  
- 
-  2
+ 
+  1
  
  
 
@@ -3669,11 +3669,11 @@
  
 
 
- 
-  1
+ 
+  2
  
- 
-  1
+ 
+  2
  
  
   TRUE
@@ -3688,11 +3688,11 @@
  
 
 
- 
-  2
+ 
+  1
  
- 
-  2
+ 
+  1
  
  
   TRUE
@@ -3780,7 +3780,7 @@
   {=MODE.MULT(J15:L17)}
  
  
-  Calc returns the result array as a sorted array and Excel does 
not. 
+   
  
  
  
@@ -4210,4 +4210,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 71bf46a80c50..e7d7f5e2aff8 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -932,8 +932,7 @@ private:
 void GetSortArray( sal_uInt8 nParamCount, ::std::vector& 
rSortArray, ::std::vector* pIndexOrder, bool bConvertTextInArray, bool 
bAllowEmptyArray );
 static void QuickSort(::std::vector& rSortArray, 
::std::vector* pIndexOrder);
 void ScModalValue();
-void ScModalValue_MS();
-void ScModalValue_Multi();
+void ScModalValue_MS( bool bSingle );
 void ScAveDev();
 void ScAggregate();
 void ScDevSq();
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index b66a27706a68..a33470ec9c30 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -3539,50 +3539,89 @@ void ScInterpreter::ScModalValue()
 }
 }
 
-void ScInterpreter::ScModalValue_MS()
+void ScInterpreter::ScModalValue_MS( bool bSingle )
 {
 sal_uInt8 nParamCount = GetByte();
 if ( !MustHaveParamCountMin( nParamCount, 1 ) )
 return;
 vector aArray;
 GetNumberSequenceArray( nParamCount, aArray, false );
-SCSIZE nSize = aArray.size();
+vector< double > aSortArray( aArray );
+QuickSort( aSortArray, nullptr );
+SCSIZE nSize = aSortArray.size();
 if ( nSize == 0 || nGlobalError != FormulaError::NONE )
 PushNoValue();
 else
 {
-SCSIZE nMaxIndex = 0, nMax = 1, nCount = 1, i, j;
-double nOldVal = aArray[ 0 ];
-
-for ( i = 1; i < nSize ; i++ )
+SCSIZE nMax = 1, nCount = 1;
+double nOldVal = aSortArray[ 0 ];
+vector< double > aResultArray( 1 );
+SCSIZE i;
+for ( i = 1; i < nSize; i++ )
 {
-for ( j = i; j < nSize; j++ )
-{
-if ( aArray[ j ] == nOldVal )
-nCount++;
-}
-if ( nCount > nMax )
-{
-nMax = nCount;
-nMaxIndex = i - 1;
-nCount = 1;
-}
-while ( (i < (nSize - 1)) && (nOldVal == aArray[ i ]) )
-i++;
-if ( ( nSize - i ) > nMax )
+if ( aSortArray[ i ] == nOldVal )
+nCount++;
+else
 {
-nOldVal = aArray[ i ];
+if ( nCount >= nMax && nCount > 1 )
+{
+if ( nCount > nMax )
+{
+nMax = nCount;
+if ( aResultArray.size() != 1 )
+vector< double >( 1 ).swap( aResultArray );
+aResultArray[ 0 ] = nOldVal;
+}
+else
+aResultArray.emplace_back( nOldVal );
+}
+nOldVal = aSortArray[ i ];
 nCount = 1;
 }
-   

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

2018-03-15 Thread Winfried Donkers
 sc/qa/unit/data/functions/statistical/fods/mode.sngl.fods |  114 --
 sc/source/core/inc/interpre.hxx   |1 
 sc/source/core/tool/interpr3.cxx  |   48 +
 sc/source/core/tool/interpr4.cxx  |2 
 4 files changed, 151 insertions(+), 14 deletions(-)

New commits:
commit c71e8df90b916f32a1d7d3a0849d0cdf14924475
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Thu Mar 1 17:34:23 2018 +0100

tdf#97977 related : make MODE.SNGL comply with Excel.

MODE.SNGL is to return the first occurrence of the number that has the
most occurences in the array of numbers in case of multiple
numbers having the same amount of (maximum) occurrences.

Change-Id: If76115ddc6b84367cbcb75de611f29076a538476
Reviewed-on: https://gerrit.libreoffice.org/50593
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/qa/unit/data/functions/statistical/fods/mode.sngl.fods 
b/sc/qa/unit/data/functions/statistical/fods/mode.sngl.fods
index e16f7d92d1a1..1dba7a7fcd3f 100644
--- a/sc/qa/unit/data/functions/statistical/fods/mode.sngl.fods
+++ b/sc/qa/unit/data/functions/statistical/fods/mode.sngl.fods
@@ -3925,10 +3925,18 @@
  
 
 
- 
- 
- 
- 
+ 
+  1
+ 
+ 
+  1
+ 
+ 
+  TRUE
+ 
+ 
+  =MODE.SNGL(H1:H12)
+ 
  
  
   10
@@ -3942,15 +3950,97 @@
  
  
 
-
- 
- 
- 
- 
+
+ 
+  4
+ 
+ 
+  4
+ 
+ 
+  TRUE
+ 
+ 
+  =MODE.SNGL(4,2,3,1,1,2,3,4,1,2,3,4)
+ 
  
 
-
- 
+
+ 
+  5
+ 
+ 
+  5
+ 
+ 
+  TRUE
+ 
+ 
+  =MODE.SNGL(5,1,3,4,5,5,1,H1:H4)
+ 
+ 
+
+
+ 
+  1
+ 
+ 
+  1
+ 
+ 
+  TRUE
+ 
+ 
+  =MODE.SNGL(1,2,3,4,1,2,3,4,1,2,3,4,H1:H12)
+ 
+ 
+
+
+ 
+  4
+ 
+ 
+  4
+ 
+ 
+  TRUE
+ 
+ 
+  =MODE.SNGL(4,2,3,1,1,2,3,4,1,2,3,4,H1:H12)
+ 
+ 
+
+
+ 
+  1.00E+000
+ 
+ 
+  1
+ 
+ 
+  TRUE
+ 
+ 
+  =MODE.SNGL(H1:H12,4,2,3,1,1,2,3,4,1,2,3,4)
+ 
+ 
+
+
+ 
+  2.00E+000
+ 
+ 
+  2
+ 
+ 
+  TRUE
+ 
+ 
+  =MODE.SNGL(H2,H1,H3:H12,4,2,3,1,1,2,3,4,1,2,3,4)
+ 
+ 
+
+
  
  
  
@@ -4204,4 +4294,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 3a3450654ff2..8f68245f99d7 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -932,6 +932,7 @@ private:
 void GetSortArray( sal_uInt8 nParamCount, ::std::vector& 
rSortArray, ::std::vector* pIndexOrder, bool bConvertTextInArray, bool 
bAllowEmptyArray );
 static void QuickSort(::std::vector& rSortArray, 
::std::vector* pIndexOrder);
 void ScModalValue();
+void ScModalValue_MS();
 void ScModalValue_Multi();
 void ScAveDev();
 void ScAggregate();
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index edbb01b4e0fa..db91105fcf10 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -3510,7 +3510,6 @@ void ScInterpreter::ScModalValue()
 SCSIZE nMaxIndex = 0, nMax = 1, nCount = 1;
 double nOldVal = aSortArray[0];
 SCSIZE i;
-
 for ( i = 1; i < nSize; i++)
 {
 if (aSortArray[i] == nOldVal)
@@ -3540,6 +3539,53 @@ void ScInterpreter::ScModalValue()
 }
 }
 
+void ScInterpreter::ScModalValue_MS()
+{
+sal_uInt8 nParamCount = GetByte();
+if ( !MustHaveParamCountMin( nParamCount, 1 ) )
+return;
+vector aArray;
+GetNumberSequenceArray( nParamCount, aArray, false );
+SCSIZE nSize = aArray.size();
+if ( nSize == 0 || nGlobalError != FormulaError::NONE )
+PushNoValue();
+else
+{
+SCSIZE nMaxIndex = 0, nMax = 1, nCount = 1, i, j;
+double nOldVal = aArray[ 0 ];
+
+for ( i = 1; i < nSize ; i++ )
+{
+for ( j = i; j < nSize; j++ )
+{
+if ( aArray[ j ] == nOldVal )
+nCount++;
+}
+if ( nCount > nMax )
+{
+nMax = nCount;
+nMaxIndex = i - 1;
+nCount = 1;
+}
+while ( nOldVal == aArray[ i ] && i < nSize - 1 )
+i++;
+if ( ( nSize - i ) > nMax )
+{
+nOldVal = aArray[ i ];
+nCount = 1;
+}
+else
+break;
+}
+if ( nMax == 1 && nCount == 1 )
+PushNoValue();
+  

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

2018-03-08 Thread Winfried Donkers
 sc/source/core/tool/interpr3.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 754d1053d37feb2bc91eaa74b3c3b111a0f8d859
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Wed Mar 7 17:54:58 2018 +0100

Load arguments in array in the order of the arguments.

Change-Id: I1a47018d626848e6d07c7e637ee6e04ff7750ac8
Reviewed-on: https://gerrit.libreoffice.org/50904
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index f73b7b65b818..f7ca635cc2f9 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -3709,6 +3709,7 @@ void ScInterpreter::GetNumberSequenceArray( sal_uInt8 
nParamCount, vector 0)
 {
 const StackVar eStackType = GetStackType();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-02-02 Thread Winfried Donkers
 i18nutil/source/utility/widthfolding.cxx |   45 ---
 i18nutil/source/utility/widthfolding_data.h  |   23 +++--
 sc/qa/unit/data/functions/text/fods/jis.fods |   24 +-
 3 files changed, 28 insertions(+), 64 deletions(-)

New commits:
commit 6c79c9053e3090df09fc2c0a24f1fec26ac8bf02
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Thu Feb 1 15:39:56 2018 +0100

Clean up of dirty hack.

Follow up of tdf#103550. The conversion from half to full width characters 
and vice versa happens per character according to a table. There is no need to 
have a separate table with exceptions to the general rule.

Change-Id: Id611d1d6074cb2489fb0254d8ba9a83d7c26065f
Reviewed-on: https://gerrit.libreoffice.org/49102
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/i18nutil/source/utility/widthfolding.cxx 
b/i18nutil/source/utility/widthfolding.cxx
index a7e8dd05c285..8db7524235e2 100644
--- a/i18nutil/source/utility/widthfolding.cxx
+++ b/i18nutil/source/utility/widthfolding.cxx
@@ -214,27 +214,6 @@ oneToOneMapping& widthfolding::getfull2halfTableForASC()
 static oneToOneMappingWithFlag table(full2half, sizeof(full2half), 
FULL2HALF_ASC_FUNCTION);
 table.makeIndex();
 
-// bluedwarf: dirty hack!
-// There is an exception. Additional conversion is required following:
-//  0xFFE5 (FULLWIDTH YEN SIGN)  --> 0x005C (REVERSE SOLIDUS)
-//
-//  See the following page for detail:
-// http://wiki.openoffice.org/wiki/Calc/Features/JIS_and_ASC_functions
-for( int i = 0; i < int(SAL_N_ELEMENTS(full2halfASCException)); i++ )
-{
-const int high = (full2halfASCException[i].first >> 8) & 0xFF;
-const int low  = (full2halfASCException[i].first)  & 0xFF;
-
-if( !table.mpIndex[high] )
-{
-table.mpIndex[high] = new UnicodePairWithFlag*[256];
-
-for( int j = 0; j < 256; j++ )
-table.mpIndex[high][j] = nullptr;
-}
-table.mpIndex[high][low] = [i];
-}
-
 return table;
 }
 
@@ -243,30 +222,6 @@ oneToOneMapping& widthfolding::gethalf2fullTableForJIS()
 static oneToOneMappingWithFlag table(half2full, sizeof(half2full), 
HALF2FULL_JIS_FUNCTION);
 table.makeIndex();
 
-// bluedwarf: dirty hack!
-//  There are some exceptions. Additional conversion are required 
following:
-//  0x0022 (QUOTATION MARK)  --> 0x201D (RIGHT DOUBLE QUOTATION MARK)
-//  0x0027 (APOSTROPHE)  --> 0x2019 (RIGHT SINGLE QUOTATION MARK)
-//  0x005C (REVERSE SOLIDUS) --> 0xFFE5 (FULLWIDTH YEN SIGN)
-//  0x0060 (GRAVE ACCENT)--> 0x2018 (LEFT SINGLE QUOTATION MARK)
-//
-//  See the following page for detail:
-// http://wiki.openoffice.org/wiki/Calc/Features/JIS_and_ASC_functions
-for( int i = 0; i < int(SAL_N_ELEMENTS(half2fullJISException)); i++ )
-{
-const int high = (half2fullJISException[i].first >> 8) & 0xFF;
-const int low  = (half2fullJISException[i].first)  & 0xFF;
-
-if( !table.mpIndex[high] )
-{
-table.mpIndex[high] = new UnicodePairWithFlag*[256];
-
-for( int j = 0; j < 256; j++ )
-table.mpIndex[high][j] = nullptr;
-}
-table.mpIndex[high][low] = [i];
-}
-
 return table;
 }
 
diff --git a/i18nutil/source/utility/widthfolding_data.h 
b/i18nutil/source/utility/widthfolding_data.h
index 999ca82734b1..b1c0e2c00c57 100644
--- a/i18nutil/source/utility/widthfolding_data.h
+++ b/i18nutil/source/utility/widthfolding_data.h
@@ -481,17 +481,11 @@ UnicodePairWithFlag full2half[] = {
 { 0xFFE3, 0x00AF, FULL2HALF_NORMAL },  // FULLWIDTH MACRON --> MACRON
 { 0xFFE4, 0x00A6, FULL2HALF_NORMAL },  // FULLWIDTH BROKEN BAR --> BROKEN 
BAR
 { 0xFFE5, 0x00A5, FULL2HALF_NORMAL },  // FULLWIDTH YEN SIGN --> YEN SIGN
+{ 0xFFE5, 0x005C, FULL2HALF_ASC_FUNCTION },  // FULLWIDTH YEN SIGN --> 
REVERSE SOLIDUS, exceptional conversion
 { 0xFFE6, 0x20A9, FULL2HALF_NORMAL },  // FULLWIDTH WON SIGN --> WON SIGN
 };
 
 /*
- Exceptional conversion table for ASC function
-*/
-UnicodePairWithFlag full2halfASCException[] = {
-{ 0xFFE5, 0x005C, FULL2HALF_ASC_FUNCTION }  // FULLWIDTH YEN SIGN --> 
REVERSE SOLIDUS
- };
-
-/*
   Unicode Normalization Forms
   http://www.unicode.org/unicode/reports/tr15/index.html
   http://www.w3.org/International/charlint/
@@ -708,11 +702,13 @@ UnicodePairWithFlag half2full[] = {
 { 0x0020, 0x3000, HALF2FULL_NORMAL },  // SPACE --> IDEOGRAPHIC SPACE
 { 0x0021, 0xFF01, HALF2FULL_NORMAL | HALF2FULL_JIS_FUNCTION },  // 
EXCLAMATION MARK --> FULLWIDTH EXCLAMATION MARK
 { 0x0022, 0xFF02, HALF2FULL_NORMAL },  // QUOTATION MARK --> FULLWIDTH 
QUOTATION MARK
+{ 0x0022, 0x201D, HALF2FULL_JIS_

[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - i18nutil/source sc/qa

2018-01-26 Thread Winfried Donkers
 i18nutil/source/utility/widthfolding_data.h  |1 +
 sc/qa/unit/data/functions/text/fods/jis.fods |   15 +--
 2 files changed, 10 insertions(+), 6 deletions(-)

New commits:
commit 8c01c25ac4f85266719dc04e9809da2f3eb5b10e
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Wed Jan 24 17:21:19 2018 +0100

tdf#103550 fix issue with HYPHEN-MINUS in Calc function JIS.

Change-Id: Ie1e25ea7a0d6f23dfe21f53ed47430be6b357984
Reviewed-on: https://gerrit.libreoffice.org/48523
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>
(cherry picked from commit 484d0ea842da586a4cf51b6d11683b04f234474c)
Reviewed-on: https://gerrit.libreoffice.org/48664

diff --git a/i18nutil/source/utility/widthfolding_data.h 
b/i18nutil/source/utility/widthfolding_data.h
index b2bdd369c6cf..999ca82734b1 100644
--- a/i18nutil/source/utility/widthfolding_data.h
+++ b/i18nutil/source/utility/widthfolding_data.h
@@ -718,6 +718,7 @@ UnicodePairWithFlag half2full[] = {
 { 0x002A, 0xFF0A, HALF2FULL_NORMAL | HALF2FULL_JIS_FUNCTION },  // 
ASTERISK --> FULLWIDTH ASTERISK
 { 0x002B, 0xFF0B, HALF2FULL_NORMAL | HALF2FULL_JIS_FUNCTION },  // PLUS 
SIGN --> FULLWIDTH PLUS SIGN
 { 0x002C, 0xFF0C, HALF2FULL_NORMAL | HALF2FULL_JIS_FUNCTION },  // COMMA 
--> FULLWIDTH COMMA
+{ 0x002D, 0xFF0D, HALF2FULL_NORMAL | HALF2FULL_JIS_FUNCTION },  // MINUS 
HYPHEN --> FULLWIDTH MINUS HYPHEN
 { 0x002E, 0xFF0E, HALF2FULL_NORMAL | HALF2FULL_JIS_FUNCTION },  // FULL 
STOP --> FULLWIDTH FULL STOP
 { 0x002F, 0xFF0F, HALF2FULL_NORMAL | HALF2FULL_JIS_FUNCTION },  // SOLIDUS 
--> FULLWIDTH SOLIDUS
 { 0x0030, 0xFF10, HALF2FULL_NORMAL | HALF2FULL_JIS_FUNCTION },  // DIGIT 
ZERO --> FULLWIDTH DIGIT ZERO
diff --git a/sc/qa/unit/data/functions/text/fods/jis.fods 
b/sc/qa/unit/data/functions/text/fods/jis.fods
index 50584f6b8820..2c55690735fb 100644
--- a/sc/qa/unit/data/functions/text/fods/jis.fods
+++ b/sc/qa/unit/data/functions/text/fods/jis.fods
@@ -1057,19 +1057,22 @@
  
 
 
- 
-  0123456789
+ 
+  !”#$%&’()*+,-./
  
  
-  0123456789
+  !”#$%&’()*+,-./
  
  
   TRUE
  
- 
+ 
   =JIS(I2)
  
- 
+ 
+  Tdf103550, AOO#78727
+ 
+ 
  
   !#$%()*+,-./
  
@@ -1802,4 +1805,4 @@

   
  
-
\ No newline at end of file
+
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-01-26 Thread Winfried Donkers
 i18nutil/source/utility/widthfolding_data.h  |1 +
 sc/qa/unit/data/functions/text/fods/jis.fods |   15 +--
 2 files changed, 10 insertions(+), 6 deletions(-)

New commits:
commit 484d0ea842da586a4cf51b6d11683b04f234474c
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Wed Jan 24 17:21:19 2018 +0100

tdf#103550 fix issue with HYPHEN-MINUS in Calc function JIS.

Change-Id: Ie1e25ea7a0d6f23dfe21f53ed47430be6b357984
Reviewed-on: https://gerrit.libreoffice.org/48523
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/i18nutil/source/utility/widthfolding_data.h 
b/i18nutil/source/utility/widthfolding_data.h
index b2bdd369c6cf..999ca82734b1 100644
--- a/i18nutil/source/utility/widthfolding_data.h
+++ b/i18nutil/source/utility/widthfolding_data.h
@@ -718,6 +718,7 @@ UnicodePairWithFlag half2full[] = {
 { 0x002A, 0xFF0A, HALF2FULL_NORMAL | HALF2FULL_JIS_FUNCTION },  // 
ASTERISK --> FULLWIDTH ASTERISK
 { 0x002B, 0xFF0B, HALF2FULL_NORMAL | HALF2FULL_JIS_FUNCTION },  // PLUS 
SIGN --> FULLWIDTH PLUS SIGN
 { 0x002C, 0xFF0C, HALF2FULL_NORMAL | HALF2FULL_JIS_FUNCTION },  // COMMA 
--> FULLWIDTH COMMA
+{ 0x002D, 0xFF0D, HALF2FULL_NORMAL | HALF2FULL_JIS_FUNCTION },  // MINUS 
HYPHEN --> FULLWIDTH MINUS HYPHEN
 { 0x002E, 0xFF0E, HALF2FULL_NORMAL | HALF2FULL_JIS_FUNCTION },  // FULL 
STOP --> FULLWIDTH FULL STOP
 { 0x002F, 0xFF0F, HALF2FULL_NORMAL | HALF2FULL_JIS_FUNCTION },  // SOLIDUS 
--> FULLWIDTH SOLIDUS
 { 0x0030, 0xFF10, HALF2FULL_NORMAL | HALF2FULL_JIS_FUNCTION },  // DIGIT 
ZERO --> FULLWIDTH DIGIT ZERO
diff --git a/sc/qa/unit/data/functions/text/fods/jis.fods 
b/sc/qa/unit/data/functions/text/fods/jis.fods
index 50584f6b8820..2c55690735fb 100644
--- a/sc/qa/unit/data/functions/text/fods/jis.fods
+++ b/sc/qa/unit/data/functions/text/fods/jis.fods
@@ -1057,19 +1057,22 @@
  
 
 
- 
-  0123456789
+ 
+  !”#$%&’()*+,-./
  
  
-  0123456789
+  !”#$%&’()*+,-./
  
  
   TRUE
  
- 
+ 
   =JIS(I2)
  
- 
+ 
+  Tdf103550, AOO#78727
+ 
+ 
  
   !#$%()*+,-./
  
@@ -1802,4 +1805,4 @@

   
  
-
\ No newline at end of file
+
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - i18npool/source

2018-01-26 Thread Winfried Donkers
 i18npool/source/localedata/data/la_VA.xml  |   20 ++--
 i18npool/source/localedata/data/lld_IT.xml |   20 ++--
 i18npool/source/localedata/data/vec_IT.xml |   20 ++--
 3 files changed, 30 insertions(+), 30 deletions(-)

New commits:
commit e18cb8bebf47f95bd036822490f12daba35d6cec
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Thu Jan 25 16:52:30 2018 +0100

Change TimeSeparator for locale la_VA, lld_IT and vec_IT.

Change-Id: I0afc3a08a31216efdbddc389dc23f0b04bc92b37
Reviewed-on: https://gerrit.libreoffice.org/48619
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>
(cherry picked from commit 80ac1dc53ba2aac97bce067495f7f60c6acabadd)
Reviewed-on: https://gerrit.libreoffice.org/48640

diff --git a/i18npool/source/localedata/data/la_VA.xml 
b/i18npool/source/localedata/data/la_VA.xml
index e951225f1933..ee71bf2666e3 100644
--- a/i18npool/source/localedata/data/la_VA.xml
+++ b/i18npool/source/localedata/data/la_VA.xml
@@ -33,7 +33,7 @@
   /
   .
   ,
-  .
+  :
   ,
   ;

@@ -169,31 +169,31 @@
   WW
 
 
-  HH.MM
+  HH:MM
 
 
-  HH.MM.SS
+  HH:MM:SS
 
 
-  HH.MM AM/PM
+  HH:MM AM/PM
 
 
-  HH.MM.SS AM/PM
+  HH:MM:SS AM/PM
 
 
-  [HH].MM.SS
+  [HH]:MM:SS
 
 
-  MM.SS,00
+  MM:SS,00
 
 
-  [HH].MM.SS,00
+  [HH]:MM:SS,00
 
 
-  DD/MM/YY HH.MM
+  DD/MM/YY HH:MM
 
 
-  DD/MM/ HH.MM.SS
+  DD/MM/ HH:MM:SS
 
   
   
diff --git a/i18npool/source/localedata/data/lld_IT.xml 
b/i18npool/source/localedata/data/lld_IT.xml
index 8f99a86ae1df..5fa8c1120ddd 100644
--- a/i18npool/source/localedata/data/lld_IT.xml
+++ b/i18npool/source/localedata/data/lld_IT.xml
@@ -33,7 +33,7 @@
   /
   .
   ,
-  .
+  :
   ,
   ;
   , 
@@ -170,31 +170,31 @@
   WW
 
 
-  HH.MM
+  HH:MM
 
 
-  HH.MM.SS
+  HH:MM:SS
 
 
-  HH.MM AM/PM
+  HH:MM AM/PM
 
 
-  HH.MM.SS AM/PM
+  HH:MM:SS AM/PM
 
 
-  [HH].MM.SS
+  [HH]:MM:SS
 
 
-  MM.SS,00
+  MM:SS,00
 
 
-  [HH].MM.SS,00
+  [HH]:MM:SS,00
 
 
-  DD/MM/YY HH.MM
+  DD/MM/YY HH:MM
 
 
-  DD/MM/ HH.MM.SS AM/PM
+  DD/MM/ HH:MM:SS AM/PM
 
   
   
diff --git a/i18npool/source/localedata/data/vec_IT.xml 
b/i18npool/source/localedata/data/vec_IT.xml
index aa79dd8b519e..086d59857db5 100644
--- a/i18npool/source/localedata/data/vec_IT.xml
+++ b/i18npool/source/localedata/data/vec_IT.xml
@@ -33,7 +33,7 @@
   /
   .
   ,
-  .
+  :
   ,
   ;

@@ -169,31 +169,31 @@
   WW
 
 
-  HH.MM
+  HH:MM
 
 
-  HH.MM.SS
+  HH:MM:SS
 
 
-  HH.MM AM/PM
+  HH:MM AM/PM
 
 
-  HH.MM.SS AM/PM
+  HH:MM:SS AM/PM
 
 
-  [HH].MM.SS
+  [HH]:MM:SS
 
 
-  MM.SS,00
+  MM:SS,00
 
 
-  [HH].MM.SS,00
+  [HH]:MM:SS,00
 
 
-  DD/MM/YY HH.MM
+  DD/MM/YY HH:MM
 
 
-  DD/MM/ HH.MM.SS
+  DD/MM/ HH:MM:SS
 
   
   
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - 2 commits - i18npool/source

2018-01-26 Thread Winfried Donkers
 i18npool/source/localedata/data/it_CH.xml  |4 ++--
 i18npool/source/localedata/data/it_IT.xml  |   20 ++--
 i18npool/source/localedata/data/vec_IT.xml |4 ++--
 3 files changed, 14 insertions(+), 14 deletions(-)

New commits:
commit c531008ab30620ec7e2264d708b8c11e977b7c9a
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Thu Jan 25 16:26:46 2018 +0100

Fix incorrect AM/PM symbols in locale it_CH and vec_IT.

Follow up of tdf#105226.

Change-Id: I31816a36e427338034a30492f2a7ac7f2d0fddd2
Reviewed-on: https://gerrit.libreoffice.org/48616
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>
(cherry picked from commit 8ff3d8821ef68069c1bdcf1a123b0c929d745566)
Reviewed-on: https://gerrit.libreoffice.org/48638

diff --git a/i18npool/source/localedata/data/it_CH.xml 
b/i18npool/source/localedata/data/it_CH.xml
index 1514c671a367..aa19b9e2339d 100644
--- a/i18npool/source/localedata/data/it_CH.xml
+++ b/i18npool/source/localedata/data/it_CH.xml
@@ -47,8 +47,8 @@
   “
   ”
 
-m.
-p.
+a.m.
+p.m.
 metric
   
   
diff --git a/i18npool/source/localedata/data/vec_IT.xml 
b/i18npool/source/localedata/data/vec_IT.xml
index 705e1aafca4e..aa79dd8b519e 100644
--- a/i18npool/source/localedata/data/vec_IT.xml
+++ b/i18npool/source/localedata/data/vec_IT.xml
@@ -47,8 +47,8 @@
   “
   ”
 
-m.
-p.
+a.m.
+p.m.
 metric
   
   
commit ac709f527bbe0e871bafef9b8f0993f4b865bbc4
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Thu Jan 25 16:22:24 2018 +0100

tdf#105226 follow up: change time separator for locale it_IT.

Change-Id: If994f615b4a9b976086546a80357b75e93952528
Reviewed-on: https://gerrit.libreoffice.org/48615
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Eike Rathke <er...@redhat.com>
(cherry picked from commit c97d67631724c29fa665c5f0aaad0a0fd9a061ee)
Reviewed-on: https://gerrit.libreoffice.org/48639
Tested-by: Jenkins <c...@libreoffice.org>

diff --git a/i18npool/source/localedata/data/it_IT.xml 
b/i18npool/source/localedata/data/it_IT.xml
index 94ebb32f8f61..8a047c4aa882 100644
--- a/i18npool/source/localedata/data/it_IT.xml
+++ b/i18npool/source/localedata/data/it_IT.xml
@@ -33,7 +33,7 @@
   /
   .
   ,
-  .
+  :
   ,
   ;

@@ -169,31 +169,31 @@
   WW
 
 
-  HH.MM
+  HH:MM
 
 
-  HH.MM.SS
+  HH:MM:SS
 
 
-  HH.MM AM/PM
+  HH:MM AM/PM
 
 
-  HH.MM.SS AM/PM
+  HH:MM:SS AM/PM
 
 
-  [HH].MM.SS
+  [HH]:MM:SS
 
 
-  MM.SS,00
+  MM:SS,00
 
 
-  [HH].MM.SS,00
+  [HH]:MM:SS,00
 
 
-  GG/MM/AA HH.MM
+  GG/MM/AA HH:MM
 
 
-  GG/MM/ HH.MM.SS
+  GG/MM/ HH:MM:SS
 
   
   
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: i18npool/source

2018-01-25 Thread Winfried Donkers
 i18npool/source/localedata/data/la_VA.xml  |   20 ++--
 i18npool/source/localedata/data/lld_IT.xml |   20 ++--
 i18npool/source/localedata/data/vec_IT.xml |   20 ++--
 3 files changed, 30 insertions(+), 30 deletions(-)

New commits:
commit 80ac1dc53ba2aac97bce067495f7f60c6acabadd
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Thu Jan 25 16:52:30 2018 +0100

Change TimeSeparator for locale la_VA, lld_IT and vec_IT.

Change-Id: I0afc3a08a31216efdbddc389dc23f0b04bc92b37
Reviewed-on: https://gerrit.libreoffice.org/48619
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/i18npool/source/localedata/data/la_VA.xml 
b/i18npool/source/localedata/data/la_VA.xml
index e951225f1933..ee71bf2666e3 100644
--- a/i18npool/source/localedata/data/la_VA.xml
+++ b/i18npool/source/localedata/data/la_VA.xml
@@ -33,7 +33,7 @@
   /
   .
   ,
-  .
+  :
   ,
   ;

@@ -169,31 +169,31 @@
   WW
 
 
-  HH.MM
+  HH:MM
 
 
-  HH.MM.SS
+  HH:MM:SS
 
 
-  HH.MM AM/PM
+  HH:MM AM/PM
 
 
-  HH.MM.SS AM/PM
+  HH:MM:SS AM/PM
 
 
-  [HH].MM.SS
+  [HH]:MM:SS
 
 
-  MM.SS,00
+  MM:SS,00
 
 
-  [HH].MM.SS,00
+  [HH]:MM:SS,00
 
 
-  DD/MM/YY HH.MM
+  DD/MM/YY HH:MM
 
 
-  DD/MM/ HH.MM.SS
+  DD/MM/ HH:MM:SS
 
   
   
diff --git a/i18npool/source/localedata/data/lld_IT.xml 
b/i18npool/source/localedata/data/lld_IT.xml
index 8f99a86ae1df..5fa8c1120ddd 100644
--- a/i18npool/source/localedata/data/lld_IT.xml
+++ b/i18npool/source/localedata/data/lld_IT.xml
@@ -33,7 +33,7 @@
   /
   .
   ,
-  .
+  :
   ,
   ;
   , 
@@ -170,31 +170,31 @@
   WW
 
 
-  HH.MM
+  HH:MM
 
 
-  HH.MM.SS
+  HH:MM:SS
 
 
-  HH.MM AM/PM
+  HH:MM AM/PM
 
 
-  HH.MM.SS AM/PM
+  HH:MM:SS AM/PM
 
 
-  [HH].MM.SS
+  [HH]:MM:SS
 
 
-  MM.SS,00
+  MM:SS,00
 
 
-  [HH].MM.SS,00
+  [HH]:MM:SS,00
 
 
-  DD/MM/YY HH.MM
+  DD/MM/YY HH:MM
 
 
-  DD/MM/ HH.MM.SS AM/PM
+  DD/MM/ HH:MM:SS AM/PM
 
   
   
diff --git a/i18npool/source/localedata/data/vec_IT.xml 
b/i18npool/source/localedata/data/vec_IT.xml
index aa79dd8b519e..086d59857db5 100644
--- a/i18npool/source/localedata/data/vec_IT.xml
+++ b/i18npool/source/localedata/data/vec_IT.xml
@@ -33,7 +33,7 @@
   /
   .
   ,
-  .
+  :
   ,
   ;

@@ -169,31 +169,31 @@
   WW
 
 
-  HH.MM
+  HH:MM
 
 
-  HH.MM.SS
+  HH:MM:SS
 
 
-  HH.MM AM/PM
+  HH:MM AM/PM
 
 
-  HH.MM.SS AM/PM
+  HH:MM:SS AM/PM
 
 
-  [HH].MM.SS
+  [HH]:MM:SS
 
 
-  MM.SS,00
+  MM:SS,00
 
 
-  [HH].MM.SS,00
+  [HH]:MM:SS,00
 
 
-  DD/MM/YY HH.MM
+  DD/MM/YY HH:MM
 
 
-  DD/MM/ HH.MM.SS
+  DD/MM/ HH:MM:SS
 
   
   
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: i18npool/source

2018-01-25 Thread Winfried Donkers
 i18npool/source/localedata/data/it_IT.xml |   20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

New commits:
commit c97d67631724c29fa665c5f0aaad0a0fd9a061ee
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Thu Jan 25 16:22:24 2018 +0100

tdf#105226 follow up: change time separator for locale it_IT.

Change-Id: If994f615b4a9b976086546a80357b75e93952528
Reviewed-on: https://gerrit.libreoffice.org/48615
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Eike Rathke <er...@redhat.com>

diff --git a/i18npool/source/localedata/data/it_IT.xml 
b/i18npool/source/localedata/data/it_IT.xml
index 94ebb32f8f61..8a047c4aa882 100644
--- a/i18npool/source/localedata/data/it_IT.xml
+++ b/i18npool/source/localedata/data/it_IT.xml
@@ -33,7 +33,7 @@
   /
   .
   ,
-  .
+  :
   ,
   ;

@@ -169,31 +169,31 @@
   WW
 
 
-  HH.MM
+  HH:MM
 
 
-  HH.MM.SS
+  HH:MM:SS
 
 
-  HH.MM AM/PM
+  HH:MM AM/PM
 
 
-  HH.MM.SS AM/PM
+  HH:MM:SS AM/PM
 
 
-  [HH].MM.SS
+  [HH]:MM:SS
 
 
-  MM.SS,00
+  MM:SS,00
 
 
-  [HH].MM.SS,00
+  [HH]:MM:SS,00
 
 
-  GG/MM/AA HH.MM
+  GG/MM/AA HH:MM
 
 
-  GG/MM/ HH.MM.SS
+  GG/MM/ HH:MM:SS
 
   
   
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: i18npool/source

2018-01-25 Thread Winfried Donkers
 i18npool/source/localedata/data/it_CH.xml  |4 ++--
 i18npool/source/localedata/data/vec_IT.xml |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 8ff3d8821ef68069c1bdcf1a123b0c929d745566
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Thu Jan 25 16:26:46 2018 +0100

Fix incorrect AM/PM symbols in locale it_CH and vec_IT.

Follow up of tdf#105226.

Change-Id: I31816a36e427338034a30492f2a7ac7f2d0fddd2
Reviewed-on: https://gerrit.libreoffice.org/48616
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/i18npool/source/localedata/data/it_CH.xml 
b/i18npool/source/localedata/data/it_CH.xml
index 1514c671a367..aa19b9e2339d 100644
--- a/i18npool/source/localedata/data/it_CH.xml
+++ b/i18npool/source/localedata/data/it_CH.xml
@@ -47,8 +47,8 @@
   “
   ”
 
-m.
-p.
+a.m.
+p.m.
 metric
   
   
diff --git a/i18npool/source/localedata/data/vec_IT.xml 
b/i18npool/source/localedata/data/vec_IT.xml
index 705e1aafca4e..aa79dd8b519e 100644
--- a/i18npool/source/localedata/data/vec_IT.xml
+++ b/i18npool/source/localedata/data/vec_IT.xml
@@ -47,8 +47,8 @@
   “
   ”
 
-m.
-p.
+a.m.
+p.m.
 metric
   
   
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - i18npool/source

2018-01-22 Thread Winfried Donkers
 i18npool/source/localedata/data/it_IT.xml |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 9a86daba30a60f478c4d2c430cd5607301e4f252
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Sat Jan 20 19:24:48 2018 +0100

tdf#105226 fix incorrect AM/PM symbol in locale it_IT.

Change-Id: I95ecc3163ea6081e51ce78653cebf292bee7b440
Reviewed-on: https://gerrit.libreoffice.org/48247
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>
(cherry picked from commit b6c0356ac9d59a4599d15f8d2f001d39010b3e48)
Reviewed-on: https://gerrit.libreoffice.org/48321
Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/i18npool/source/localedata/data/it_IT.xml 
b/i18npool/source/localedata/data/it_IT.xml
index c4d12ce9a44f..94ebb32f8f61 100644
--- a/i18npool/source/localedata/data/it_IT.xml
+++ b/i18npool/source/localedata/data/it_IT.xml
@@ -47,8 +47,8 @@
   “
   ”
 
-m.
-p.
+a.m.
+p.m.
 metric
   
   
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: i18npool/source

2018-01-22 Thread Winfried Donkers
 i18npool/source/localedata/data/it_IT.xml |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit b6c0356ac9d59a4599d15f8d2f001d39010b3e48
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Sat Jan 20 19:24:48 2018 +0100

tdf#105226 fix incorrect AM/PM symbol in locale it_IT.

Change-Id: I95ecc3163ea6081e51ce78653cebf292bee7b440
Reviewed-on: https://gerrit.libreoffice.org/48247
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/i18npool/source/localedata/data/it_IT.xml 
b/i18npool/source/localedata/data/it_IT.xml
index c4d12ce9a44f..94ebb32f8f61 100644
--- a/i18npool/source/localedata/data/it_IT.xml
+++ b/i18npool/source/localedata/data/it_IT.xml
@@ -47,8 +47,8 @@
   “
   ”
 
-m.
-p.
+a.m.
+p.m.
 metric
   
   
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sal/rtl sc/qa

2018-01-16 Thread Winfried Donkers
 sal/rtl/math.cxx   |3 
 sc/qa/unit/data/functions/mathematical/fods/round.fods |   45 +++-
 sc/qa/unit/data/functions/statistical/fods/chisq.test.fods |   50 ++---
 sc/qa/unit/data/functions/statistical/fods/chisqdist.fods  |   40 ++--
 sc/qa/unit/data/functions/statistical/fods/chisqinv.fods   |  118 ++---
 sc/qa/unit/data/functions/statistical/fods/chitest.fods|   50 ++---
 sc/qa/unit/data/functions/statistical/fods/stdevpa.fods|   28 +--
 sc/qa/unit/data/functions/statistical/fods/t.dist.rt.fods  |   66 +++
 sc/qa/unit/data/functions/statistical/fods/tinv.fods   |   60 +++---
 9 files changed, 243 insertions(+), 217 deletions(-)

New commits:
commit b97a0df0f3234b4c1140ba1418d4b96a592afa4a
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Sat Dec 30 18:25:02 2017 +0100

tdf#96821 fix corner cases for Calc function ROUND.

For very large integer numbers, e.g. 2^52+1, ROUND produced incorrect
results because rtl::math::round uses
floor( number + 0.5 + small_correction_value ), which reduces the maximum
possible mantissa resolution.a

Correction of several unit test documents (Calc functions) with rounding
errors that only became apparent with this fix.

Change-Id: I1769c9939a3d6118d3bfbfdf8e41dd4619997232
Reviewed-on: https://gerrit.libreoffice.org/47179
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 4b149b9f99dd..387ae3b2b4aa 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -1076,6 +1076,9 @@ double SAL_CALL rtl_math_round(double fValue, int 
nDecPlaces,
 if (fValue == 0.0)
 return fValue;
 
+if ( nDecPlaces == 0 && eMode == rtl_math_RoundingMode_Corrected )
+return std::round( fValue );
+
 // sign adjustment
 bool bSign = rtl::math::isSignBitSet( fValue );
 if (bSign)
diff --git a/sc/qa/unit/data/functions/mathematical/fods/round.fods 
b/sc/qa/unit/data/functions/mathematical/fods/round.fods
index 0f0a5b9026c3..d75968c17bbe 100644
--- a/sc/qa/unit/data/functions/mathematical/fods/round.fods
+++ b/sc/qa/unit/data/functions/mathematical/fods/round.fods
@@ -2117,20 +2117,43 @@
  
 
 
- 
- 
- 
- 
- 
+ 
+  4503599627370497
+ 
+ 
+  4503599627370497
+ 
+ 
+  TRUE
+ 
+ 
+  =ROUND(2^52+1,0)
+ 
+ 
+  limit of resolution
+ 
+ 
  
  
  
 
-
- 
- 
- 
- 
+
+ 
+  4503599627370497
+ 
+ 
+  4503599627370497
+ 
+ 
+  TRUE
+ 
+ 
+  =ROUND(2^52+1)
+ 
+ 
+  limit of resolution
+ 
+ 
  
  
 
@@ -2380,4 +2403,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/qa/unit/data/functions/statistical/fods/chisq.test.fods 
b/sc/qa/unit/data/functions/statistical/fods/chisq.test.fods
index 9eac30114eb7..648f8b864679 100644
--- a/sc/qa/unit/data/functions/statistical/fods/chisq.test.fods
+++ b/sc/qa/unit/data/functions/statistical/fods/chisq.test.fods
@@ -3803,7 +3803,7 @@
  
   1.16440189336067E-29
  
- 
+ 
   TRUE
  
  
@@ -3866,7 +3866,7 @@
  
   9.03490480352966E-10
  
- 
+ 
   TRUE
  
  
@@ -3934,7 +3934,7 @@
  
   1.34423459890025E-09
  
- 
+ 
   TRUE
  
  
@@ -4000,7 +4000,7 @@
  
   0
  
- 
+ 
   TRUE
  
  
@@ -4058,7 +4058,7 @@
  
   1.12896923737676E-11
  
- 
+ 
   TRUE
  
  
@@ -4121,7 +4121,7 @@
  
   0.997916658208002
  
- 
+ 
   TRUE
  
  
@@ -4184,7 +4184,7 @@
  
   0.001549713633046
  
- 
+ 
   TRUE
  
  
@@ -4246,7 +4246,7 @@
  
   0.020252473072358
  
- 
+ 
   TRUE
  
  
@@ -4306,7 +4306,7 @@
  
   1.66789802691649E-16
  
- 
+ 
   TRUE
  
  
@@ -4358,7 +4358,7 @@
  
   0
  
- 
+ 
   TRUE
  
  
@@ -4403,7 +4403,7 @@
  
   0.000308192017008
  
- 
+ 
   TRUE
  
  
@@ -4435,7 +4435,7 @@
  
   0.816527699624637
  
- 
+ 
   TRUE
  
  
@@ -4466,7 +4466,7 @@
  
   0.87928370831036
  
- 
+ 
   TRUE
  
  
@@ -4507,7 +4507,7 @@
  
   0.911826184650631
  
- 
+ 
   TRUE
  
  
@@ -4550,7 +4550,7 @@
  
   0.9314883584606
  
- 
+ 
   TRUE
  
  
@@ -4581,7 +4581,7 @@
  
   0.944539492146675
  
- 
+ 
   TRUE
  
  
@@ -4617,7 +4617,7 @@
  
   0.953774634535083
  
- 
+ 
   TRUE
  
  
@@ -4655,7 +4655,7 @@
  
   0.960619865110165
  
- 
+ 
   TRUE
  

Re: tests sc_array_functions_test fail due to floating point precision

2017-12-10 Thread Winfried Donkers

Hi Milton,



I've also opened the other test documents in
sc/qa/unit/data/functions/array/fods/ using LibreOffice. The documents which
fail are linest.fods and also logest.fods. The others succeed.

If your build completed ignoring these tests (i.e. produced a
usable office under ./instdir/), could you please open the
failing documents and tell us the cell addresses on the second
sheet where tests fail and the actual values they produced?

Below are the numbers. Some remarks: Many errors are in the
range of 1E-11 to 1E-12 but some are way larger >1E30. I assume
this is due some division of a very small error.

Has someone done a/some theoretical error analysis of the
algorithms involved? (e.g. numeric (forward/backward) stability
and error estimates similar to what is well-known for LU
factorization and other algorithms.)

Who/What provided the reference values -- or reformulated --
what error do these numbers have (wrt to the mathematical
solution).


Looking at the numbers it would be better to use ROUNDSIG instead of ROUND.
ROUND(1.2345E30,4) has no effect, ROUNDSIG(1.2345E30,4) rounds to 4 
significant digits, i.e. 1.234E30.
ROUNDSIG was only added to Calc last February, so most unit test 
documents don't use it (yet).


Winfried

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/source

2017-12-01 Thread Winfried Donkers
 sc/source/core/tool/interpr1.cxx |   18 +-
 1 file changed, 5 insertions(+), 13 deletions(-)

New commits:
commit 664d40fb24bf500a22efd1f1aff58a96b3c3cf2c
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Wed Nov 29 17:43:14 2017 +0100

tdf#97198 follow up: improve efficiency for Calc function RIGHT.

Change-Id: Ie2d5011f9ff73bd42a6f3ced1f709fab65d23c18
Reviewed-on: https://gerrit.libreoffice.org/45517
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Eike Rathke <er...@redhat.com>
(cherry picked from commit c5d0cffbf42f41349a8575ba52456d9cb07e91c7)
Reviewed-on: https://gerrit.libreoffice.org/45598

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 164c1185e1b8..d3b5829a5db8 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -8901,23 +8901,15 @@ void ScInterpreter::ScRight()
 n = 1;
 OUString aStr = GetString().getString();
 sal_Int32 nLen = aStr.getLength();
-sal_Int32 nIdx = 0;
-sal_Int32 nCnt = 0;
-while ( nIdx < nLen )
-{
-aStr.iterateCodePoints(  );
-++nCnt;
-}
-if ( nCnt <= n )
+if ( nLen <= n )
 PushString( aStr );
 else
 {
-sal_Int32 nCLen = nCnt;
-nIdx = 0;
-nCnt = 0;
-while ( nIdx < nLen && n < ( nCLen - nCnt ) )
+sal_Int32 nIdx = nLen;
+sal_Int32 nCnt = 0;
+while ( nIdx > 0 && n > nCnt )
 {
-aStr.iterateCodePoints(  );
+aStr.iterateCodePoints( , -1 );
 ++nCnt;
 }
 aStr = aStr.copy( nIdx, nLen - nIdx );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-30 Thread Winfried Donkers
 sc/source/core/tool/interpr1.cxx |   18 +-
 1 file changed, 5 insertions(+), 13 deletions(-)

New commits:
commit c5d0cffbf42f41349a8575ba52456d9cb07e91c7
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Wed Nov 29 17:43:14 2017 +0100

tdf#97198 follow up: improve efficiency for Calc function RIGHT.

Change-Id: Ie2d5011f9ff73bd42a6f3ced1f709fab65d23c18
Reviewed-on: https://gerrit.libreoffice.org/45517
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 164c1185e1b8..d3b5829a5db8 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -8901,23 +8901,15 @@ void ScInterpreter::ScRight()
 n = 1;
 OUString aStr = GetString().getString();
 sal_Int32 nLen = aStr.getLength();
-sal_Int32 nIdx = 0;
-sal_Int32 nCnt = 0;
-while ( nIdx < nLen )
-{
-aStr.iterateCodePoints(  );
-++nCnt;
-}
-if ( nCnt <= n )
+if ( nLen <= n )
 PushString( aStr );
 else
 {
-sal_Int32 nCLen = nCnt;
-nIdx = 0;
-nCnt = 0;
-while ( nIdx < nLen && n < ( nCLen - nCnt ) )
+sal_Int32 nIdx = nLen;
+sal_Int32 nCnt = 0;
+while ( nIdx > 0 && n > nCnt )
 {
-aStr.iterateCodePoints(  );
+aStr.iterateCodePoints( , -1 );
 ++nCnt;
 }
 aStr = aStr.copy( nIdx, nLen - nIdx );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/qa sc/source

2017-11-29 Thread Winfried Donkers
 sc/qa/unit/data/functions/text/fods/replace.fods |  230 +--
 sc/source/core/tool/interpr1.cxx |   17 +
 2 files changed, 227 insertions(+), 20 deletions(-)

New commits:
commit 44487fee8646c0ded5c2b2ffaaa70e75a7af7e04
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Tue Nov 28 15:55:56 2017 +0100

tdf#97198 Make Calc function REPLACE work with UniCode non-BMP-characters.

Change-Id: Ie9bd27ba2c28bdad0af9d91cb270ef37d5384791
Reviewed-on: https://gerrit.libreoffice.org/45421
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>
(cherry picked from commit aaba725b466950f47c4e93d790986d209e80ead3)
Reviewed-on: https://gerrit.libreoffice.org/45495

diff --git a/sc/qa/unit/data/functions/text/fods/replace.fods 
b/sc/qa/unit/data/functions/text/fods/replace.fods
index 140b735e7090..1ab069f6460a 100644
--- a/sc/qa/unit/data/functions/text/fods/replace.fods
+++ b/sc/qa/unit/data/functions/text/fods/replace.fods
@@ -1141,36 +1141,230 @@
  
 
 
- 
- 
- 
- 
+ 
+  Q
+ 
+ 
+  Q
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(;5;1;Q)
+ 
  
- 
+ 
+  B😂
+ 
  
 
-
- 
- 
- 
- 
+
+ 
+  ab😂B😂gh𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
+  ab😂B😂gh𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I11;4;3;I10)
+ 
  
- 
+ 
+  ab😂de𝔖gh𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
+
+
+ 
+  B😂xXx😂d
+ 
+ 
+  B😂xXx😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;3;1;xXx)
+ 
+ 
+ 
+  B😂c😂d
+ 
+ 
+
+
+ 
+  BxXxc😂d
+ 
+ 
+  BxXxc😂d
+  
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;2;1;xXx)
+  
+  
+ 
+ 
+ 
+  B😂𝖍𝖙😂d
+ 
+ 
+  B😂𝖍𝖙😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;3;1;𝖍𝖙)
+ 
+ 
+  
  
 
 
- 
+ 
+  Bx𝖍𝖙xc😂d
+ 
+ 
+  Bx𝖍𝖙xc😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;2;1;x𝖍𝖙x)
+ 
+  
+  
+  
+ 
+
+ 
+  BxXx😂c😂d
+ 
+ 
+  BxXx😂c😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;2;0;xXx)
+ 
+ 
+  
+ 
+
+
+ 
+  B😂xXxc😂d
+ 
+ 
+  B😂xXxc😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;3;0;xXx)
+ 
+  
+  
+  
+ 
+ 
+ 
+  xYxB😂c😂d
+ 
+ 
+  xYxB😂c😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;1;0;xYx)
+ 
+ 
+
+
+ 
+  xYx😂c😂d
+ 
+ 
+  xYx😂c😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;1;1;xYx)
+ 
+ 
+  
+ 
+
+
+ 
+  xYxc😂d
+ 
+ 
+  xYxc😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;1;2;xYx)
+ 
+  
+  
+  
+ 
+
+ 
+  xYx😂d
+ 
+ 
+  xYx😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;1;3;xYx)
+ 
+ 
  
- 
- 
+ 
+
+
+ 
+  xYxd
+ 
+ 
+  xYxd
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;1;4;xYx)
+ 
  
  
  
 
-
- 
+
  
- 
  
  
  
@@ -1210,4 +1404,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 2895c93f2a2e..164c1185e1b8 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -8451,9 +8451,22 @@ void ScInterpreter::ScReplace()
 nPos = nLen + 1;
 if (nCount > nLen - nPos + 1)
 nCount = nLen - nPos + 1;
-aOldStr = aOldStr.replaceAt( nPos-1, nCount, "" );
+sal_Int32 nIdx = 0;
+sal_Int32 nCnt = 0;
+while ( nIdx < nLen && nPos > nCnt + 1 )
+{
+aOldStr.iterateCodePoints(  );
+++nCnt;
+}
+sal_Int32 nStart = nIdx;
+while ( nIdx < nLen && nPos + nCount - 1 > nCnt )
+{
+aOldStr.iterateCodePoints(  );
+++nCnt;
+}
+aOldStr = aOldStr.replaceAt( nStart, nIdx - nStart, "" );
 if ( CheckStringResultLen( aOldStr, aNewStr ) )
-aOldStr = aOldStr.replaceAt( nPos-1, 0, aNewStr );
+aOldStr = aOldStr.replaceAt( nStart, 0, aNewStr );
 PushString( aOldStr );
 }
 }
___
Libreoffice-commits mailing list
libreoffic

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

2017-11-29 Thread Winfried Donkers
 sc/qa/unit/data/functions/text/fods/replace.fods |  230 +--
 sc/source/core/tool/interpr1.cxx |   17 +
 2 files changed, 227 insertions(+), 20 deletions(-)

New commits:
commit aaba725b466950f47c4e93d790986d209e80ead3
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Tue Nov 28 15:55:56 2017 +0100

tdf#97198 Make Calc function REPLACE work with UniCode non-BMP-characters.

Change-Id: Ie9bd27ba2c28bdad0af9d91cb270ef37d5384791
Reviewed-on: https://gerrit.libreoffice.org/45421
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/qa/unit/data/functions/text/fods/replace.fods 
b/sc/qa/unit/data/functions/text/fods/replace.fods
index 140b735e7090..1ab069f6460a 100644
--- a/sc/qa/unit/data/functions/text/fods/replace.fods
+++ b/sc/qa/unit/data/functions/text/fods/replace.fods
@@ -1141,36 +1141,230 @@
  
 
 
- 
- 
- 
- 
+ 
+  Q
+ 
+ 
+  Q
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(;5;1;Q)
+ 
  
- 
+ 
+  B😂
+ 
  
 
-
- 
- 
- 
- 
+
+ 
+  ab😂B😂gh𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
+  ab😂B😂gh𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I11;4;3;I10)
+ 
  
- 
+ 
+  ab😂de𝔖gh𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
+
+
+ 
+  B😂xXx😂d
+ 
+ 
+  B😂xXx😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;3;1;xXx)
+ 
+ 
+ 
+  B😂c😂d
+ 
+ 
+
+
+ 
+  BxXxc😂d
+ 
+ 
+  BxXxc😂d
+  
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;2;1;xXx)
+  
+  
+ 
+ 
+ 
+  B😂𝖍𝖙😂d
+ 
+ 
+  B😂𝖍𝖙😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;3;1;𝖍𝖙)
+ 
+ 
+  
  
 
 
- 
+ 
+  Bx𝖍𝖙xc😂d
+ 
+ 
+  Bx𝖍𝖙xc😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;2;1;x𝖍𝖙x)
+ 
+  
+  
+  
+ 
+
+ 
+  BxXx😂c😂d
+ 
+ 
+  BxXx😂c😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;2;0;xXx)
+ 
+ 
+  
+ 
+
+
+ 
+  B😂xXxc😂d
+ 
+ 
+  B😂xXxc😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;3;0;xXx)
+ 
+  
+  
+  
+ 
+ 
+ 
+  xYxB😂c😂d
+ 
+ 
+  xYxB😂c😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;1;0;xYx)
+ 
+ 
+
+
+ 
+  xYx😂c😂d
+ 
+ 
+  xYx😂c😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;1;1;xYx)
+ 
+ 
+  
+ 
+
+
+ 
+  xYxc😂d
+ 
+ 
+  xYxc😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;1;2;xYx)
+ 
+  
+  
+  
+ 
+
+ 
+  xYx😂d
+ 
+ 
+  xYx😂d
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;1;3;xYx)
+ 
+ 
  
- 
- 
+ 
+
+
+ 
+  xYxd
+ 
+ 
+  xYxd
+ 
+ 
+  TRUE
+ 
+ 
+  =REPLACE(I12;1;4;xYx)
+ 
  
  
  
 
-
- 
+
  
- 
  
  
  
@@ -1210,4 +1404,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 2895c93f2a2e..164c1185e1b8 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -8451,9 +8451,22 @@ void ScInterpreter::ScReplace()
 nPos = nLen + 1;
 if (nCount > nLen - nPos + 1)
 nCount = nLen - nPos + 1;
-aOldStr = aOldStr.replaceAt( nPos-1, nCount, "" );
+sal_Int32 nIdx = 0;
+sal_Int32 nCnt = 0;
+while ( nIdx < nLen && nPos > nCnt + 1 )
+{
+aOldStr.iterateCodePoints(  );
+++nCnt;
+}
+sal_Int32 nStart = nIdx;
+while ( nIdx < nLen && nPos + nCount - 1 > nCnt )
+{
+aOldStr.iterateCodePoints(  );
+++nCnt;
+}
+aOldStr = aOldStr.replaceAt( nStart, nIdx - nStart, "" );
 if ( CheckStringResultLen( aOldStr, aNewStr ) )
-aOldStr = aOldStr.replaceAt( nPos-1, 0, aNewStr );
+aOldStr = aOldStr.replaceAt( nStart, 0, aNewStr );
 PushString( aOldStr );
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-24 Thread Winfried Donkers
 sc/qa/unit/data/functions/text/fods/left.fods |   88 +-
 sc/source/core/tool/interpr1.cxx  |7 +-
 2 files changed, 92 insertions(+), 3 deletions(-)

New commits:
commit 4e3530b4f870e0470c23ae89cdb8b9a09af54d59
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Mon Nov 13 15:43:00 2017 +0100

tdf#97198 Make Calc function LEFT work with Unicode non-BMP characters

Change-Id: I66d24dd962f824079fd0aea2827bd5b975ffe698
Reviewed-on: https://gerrit.libreoffice.org/44684
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/qa/unit/data/functions/text/fods/left.fods 
b/sc/qa/unit/data/functions/text/fods/left.fods
index 535eff455432..45d659aab04e 100644
--- a/sc/qa/unit/data/functions/text/fods/left.fods
+++ b/sc/qa/unit/data/functions/text/fods/left.fods
@@ -1152,6 +1152,92 @@
  
  
 
+
+ 
+  ab😂d
+ 
+ 
+  ab😂d
+ 
+ 
+  WAAR
+ 
+ 
+  =LEFT(I11;4)
+ 
+ 
+  Excel 2016 returns the same result
+ 
+ 
+ ab😂de𝔖gh𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
+
+
+ 
+  𧌒
+ 
+ 
+  𧌒
+ 
+ 
+  WAAR
+ 
+ 
+  =LEFT(I12;2)
+ 
+ 
+  Excel 2016 returns the same result
+ 
+ 
+ 𧌒𧀬
+ 
+ 
+
+
+ 
+  u
+ 
+ 
+  u
+ 
+ 
+  WAAR
+ 
+ 
+  =LEFT(I13;2)
+ 
+ 
+  Excel 2016 returns the same result
+ 
+ 
+ 
+  üë
+ 
+ 
+
+
+ 
+  𝕬𝖈𝖍𝖙
+ 
+ 
+  𝕬𝖈𝖍𝖙
+ 
+ 
+  WAAR
+ 
+ 
+  =LEFT(I14;4)
+ 
+ 
+  Excel 2016 returns the same result
+ 
+ 
+ 
+  𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
+
 
  
  
@@ -1195,4 +1281,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 88b1fd43759d..2895c93f2a2e 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -8579,8 +8579,11 @@ void ScInterpreter::ScLeft()
 else
 n = 1;
 OUString aStr = GetString().getString();
-n = std::min(n, aStr.getLength());
-aStr = aStr.copy( 0, n );
+sal_Int32 nIdx = 0;
+sal_Int32 nCnt = 0;
+while ( nIdx < aStr.getLength() && n > nCnt++ )
+aStr.iterateCodePoints(  );
+aStr = aStr.copy( 0, nIdx );
 PushString( aStr );
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-24 Thread Winfried Donkers
 sc/qa/unit/data/functions/text/fods/search.fods |  160 +---
 sc/source/core/tool/interpr1.cxx|   11 +
 2 files changed, 156 insertions(+), 15 deletions(-)

New commits:
commit 78b7e5f76e72647e0cab662ad2c9342d4538704f
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Thu Nov 23 18:21:19 2017 +0100

tdf#97198 Make Calc function SEARCH work with UniCode non-BMP characters.

Change-Id: I99b44dc88fe9c8d4d5d7a319bd6bc84dd2bff4f3
Reviewed-on: https://gerrit.libreoffice.org/45170
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/qa/unit/data/functions/text/fods/search.fods 
b/sc/qa/unit/data/functions/text/fods/search.fods
index 12723d0e1154..c09827350d89 100644
--- a/sc/qa/unit/data/functions/text/fods/search.fods
+++ b/sc/qa/unit/data/functions/text/fods/search.fods
@@ -1416,21 +1416,153 @@
  
  
 
-
- 
- 
- 
- 
- 
+
+ 
+  2
+ 
+ 
+  2
+ 
+ 
+  TRUE
+ 
+ 
+  =SEARCH(I21;J21)
+ 
+ 
+  Excel 2016 has same result
+ 
+ 
+ 
+  B😂
+ 
+ 
+  ab😂de𝔖gh𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
 
-
- 
- 
- 
- 
- 
+
+ 
+  3
+ 
+ 
+  3
+ 
+ 
+  TRUE
+ 
+ 
+  =SEARCH(I22;J21)
+ 
+ 
+  Excel 2016 has same result
+ 
+ 
+ 
+  😂d
+ 
+ 
+  ab😂
+ 
+ 
+
+
+ 
+  3
+ 
+ 
+  3
+ 
+ 
+  TRUE
+ 
+ 
+  =SEARCH(I23;J23)
+ 
+ 
+  Excel 2016 returns 4
+ 
+ 
+ 
+  𧀬
+ 
+ 𧌒𧀬
+ 
+ 
+
+
+ 
+  8
+ 
+ 
+  8
+ 
+ 
+  TRUE
+ 
+ 
+  =SEARCH(I24;J21)
+ 
+ 
+  Excel 2016 returns 10
+ 
+ 
+ 
+  h
+ 
+ 
+
+
+ 
+  4
+ 
+ 
+  4
+ 
+ 
+  TRUE
+ 
+ 
+  =SEARCH(I25;J25)
+ 
+ 
+  Excel 2016 has same result
+ 
+ 
+ 
+  e
+ 
+ 
+  üë
+ 
+ 
+
+
+ 
+  3
+ 
+ 
+  3
+ 
+ 
+  TRUE
+ 
+ 
+  =SEARCH(I26;J26)
+ 
+ 
+  Excel 2016 returns 5
+ 
+ 
+ 
+  𝖍𝖙
+ 
+ 
+  𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
 
-
+
  
  
  
@@ -1483,4 +1615,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 96d8f764a418..88b1fd43759d 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -8942,7 +8942,16 @@ void ScInterpreter::ScSearch()
 if (!bBool)
 PushNoValue();
 else
-PushDouble((double)nPos + 1);
+{
+sal_Int32 nIdx = 0;
+sal_Int32 nCnt = 0;
+while ( nIdx <= nPos )
+{
+sStr.iterateCodePoints(  );
+++nCnt;
+}
+PushDouble( ( double )nCnt );
+}
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-24 Thread Winfried Donkers
 sc/qa/unit/data/functions/text/fods/len.fods |  100 +--
 sc/source/core/tool/interpr1.cxx |   10 ++
 2 files changed, 102 insertions(+), 8 deletions(-)

New commits:
commit 47155ce8fb4302d377b374d39b501d0a0f7577c5
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Mon Nov 13 15:18:52 2017 +0100

tdf#97198 Make Calc function LEN work with Unicode non-BMP characters.

Change-Id: Ibfdaaf1ed313257fc5f9036a7dd1ef51033fa8cd
Reviewed-on: https://gerrit.libreoffice.org/44681
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/qa/unit/data/functions/text/fods/len.fods 
b/sc/qa/unit/data/functions/text/fods/len.fods
index 2d643cef2fcd..adc36d87f379 100644
--- a/sc/qa/unit/data/functions/text/fods/len.fods
+++ b/sc/qa/unit/data/functions/text/fods/len.fods
@@ -1189,13 +1189,99 @@
  
  
 
-
- 
- 
- 
- 
+
+ 
+  16
+ 
+ 
+  16
+ 
+ 
+  TRUE
+ 
+ 
+  =LEN(I10)
+ 
+ 
+  Excel 2016 returns 25
+ 
+ 
+ ab😂de𝔖gh𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
  
- 
+
+
+ 
+  3
+ 
+ 
+  3
+ 
+ 
+  TRUE
+ 
+ 
+  =LEN(I11)
+ 
+ 
+  Excel 2016 returns 4
+ 
+ 
+ 
+  ab😂
+ 
+ 
+
+
+ 
+  4
+ 
+ 
+  4
+ 
+ 
+  TRUE
+ 
+ 
+  =LEN(I12)
+ 
+ 
+  Excel 2016 returns 6
+ 
+ 
+ 𧌒𧀬
+ 
+ 
+
+
+ 
+  6
+ 
+ 
+  6
+ 
+ 
+  TRUE
+ 
+ 
+  =LEN(I13)
+ 
+ 
+  Excel 2016 returns 6
+ 
+ 
+ 
+  üë
+ 
+ 
+
+
+  
+  
+ 
+  
+  
+  
  
 
 
@@ -1232,4 +1318,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index f83040c79e39..96d8f764a418 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -3064,7 +3064,15 @@ void ScInterpreter::ScLower()
 
 void ScInterpreter::ScLen()
 {
-PushDouble(GetString().getLength());
+OUString aStr = GetString().getString();
+sal_Int32 nIdx = 0;
+sal_Int32 nCnt = 0;
+while ( nIdx < aStr.getLength() )
+{
+aStr.iterateCodePoints(  );
+++nCnt;
+}
+PushDouble( nCnt );
 }
 
 void ScInterpreter::ScT()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-24 Thread Winfried Donkers
 sc/qa/unit/data/functions/text/fods/find.fods |  148 +-
 sc/source/core/tool/interpr1.cxx  |   11 +
 2 files changed, 156 insertions(+), 3 deletions(-)

New commits:
commit 5e2a3eed69060d63070d72df60cd84247ca0bc9e
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Thu Nov 23 18:44:34 2017 +0100

tdf#97198 Make Calc function FIND work with UniCode non-BMP characters.

Change-Id: I512199a5d29aa955b278f0666c7ce904e67d9767
Reviewed-on: https://gerrit.libreoffice.org/45171
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/qa/unit/data/functions/text/fods/find.fods 
b/sc/qa/unit/data/functions/text/fods/find.fods
index f5a1f2a2c06b..4f966cbe53a4 100644
--- a/sc/qa/unit/data/functions/text/fods/find.fods
+++ b/sc/qa/unit/data/functions/text/fods/find.fods
@@ -1254,7 +1254,151 @@
  
  
 
-
+
+ 
+  #VALUE!
+ 
+ 
+  #VALUE!
+ 
+ 
+  TRUE
+ 
+ 
+  =FIND(I16;J16)
+ 
+ 
+  Excel 2016 has same result
+ 
+ 
+ 
+  B😂
+ 
+ 
+  ab😂de𝔖gh𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
+
+
+ 
+  3
+ 
+ 
+  3
+ 
+ 
+  TRUE
+ 
+ 
+  =FIND(I17;J16)
+ 
+ 
+  Excel 2016 has same result
+ 
+ 
+ 
+  😂d
+ 
+ 
+ 
+
+
+ 
+  3
+ 
+ 
+  3
+ 
+ 
+  TRUE
+ 
+ 
+  =FIND(I18;J18)
+ 
+ 
+  Excel 2016 returns 4
+ 
+ 
+ 
+  𧀬
+ 
+ 𧌒𧀬
+ 
+ 
+
+
+ 
+  8
+ 
+ 
+  8
+ 
+ 
+  TRUE
+ 
+ 
+  =FIND(I19;J16)
+ 
+ 
+  Excel 2016 returns 10
+ 
+ 
+ 
+  h
+ 
+ 
+
+
+ 
+  4
+ 
+ 
+  4
+ 
+ 
+  TRUE
+ 
+ 
+  =FIND(I20;J20)
+ 
+ 
+  Excel 2016 has same result
+ 
+ 
+ 
+  e
+ 
+ 
+  üë
+ 
+ 
+
+
+ 
+  3
+ 
+ 
+  3
+ 
+ 
+  TRUE
+ 
+ 
+  =FIND(I21;J21)
+ 
+ 
+  Excel 2016 returns 5
+ 
+ 
+ 
+  𝖍𝖙
+ 
+ 
+  𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
+
+
  
  
  
@@ -1288,4 +1432,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 2f2955b52927..f83040c79e39 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -8526,7 +8526,16 @@ void ScInterpreter::ScFind()
 if (nPos == -1)
 PushNoValue();
 else
-PushDouble((double)(nPos + 1));
+{
+sal_Int32 nIdx = 0;
+nCnt = 0;
+while ( nIdx <= nPos )
+{
+sStr.iterateCodePoints(  );
+++nCnt;
+}
+PushDouble( ( double )nCnt );
+}
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-24 Thread Winfried Donkers
 sc/qa/unit/data/functions/text/fods/right.fods |  112 ++---
 sc/source/core/tool/interpr1.cxx   |   26 +
 2 files changed, 108 insertions(+), 30 deletions(-)

New commits:
commit 09455734727daa3774158795febd910b33b1d784
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Thu Nov 16 16:40:25 2017 +0100

tdf#97198 Make Calc function RIGHT work with Unicode non-BMP characters.

Change-Id: I775bc50d8e5948a2af9efb77dcea9d7cae7293d5
Reviewed-on: https://gerrit.libreoffice.org/44834
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/qa/unit/data/functions/text/fods/right.fods 
b/sc/qa/unit/data/functions/text/fods/right.fods
index 9f4b97f1f8b3..fff9ffc855cc 100644
--- a/sc/qa/unit/data/functions/text/fods/right.fods
+++ b/sc/qa/unit/data/functions/text/fods/right.fods
@@ -1251,9 +1251,12 @@
  
   un
  
+ 
+  TRUE
+ 
  
  
- 
+ 
  
   b
  
@@ -1282,55 +1285,110 @@
  
 
 
- 
- 
- 
- 
- 
+ 
+  𝔖gh𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
+  𝔖gh𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
+  TRUE
+ 
+ 
+  
=RIGHT(ab😂de𝔖gh𝕬𝖈𝖍𝖙𝖚𝖓𝖌!;11)
+ 
+ 
+  Excel 2016 returns same result
+ 
+ 
  
   c
  
  
 
 
- 
- 
- 
- 
- 
+ 
+  b😂
+ 
+ 
+  b😂
+ 
+ 
+  TRUE
+ 
+ 
+  =RIGHT(ab😂;2)
+ 
+ 
+  Excel 2016 returns same result
+ 
+ 
  
   d
  
  
 
 
- 
- 
- 
- 
- 
+ 
+  𧀬
+ 
+ 
+  𧀬
+ 
+ 
+  TRUE
+ 
+ 
+  =RIGHT(𧌒𧀬;2)
+ 
+ 
+  Excel 2016 returns same result
+ 
+ 
  
   E
  
  
 
 
- 
- 
- 
- 
- 
+ 
+  ̈
+ 
+ 
+  ̈
+ 
+ 
+  TRUE
+ 
+ 
+  =RIGHT(üë;2)
+ 
+ 
+  Excel 2016 returns same result
+ 
+ 
  
   f
  
  
 
 
- 
- 
- 
- 
- 
+ 
+  𝖚𝖓𝖌!
+ 
+ 
+  𝖚𝖓𝖌!
+ 
+ 
+  TRUE
+ 
+ 
+  =RIGHT(𝕬𝖈𝖍𝖙𝖚𝖓𝖌!;4)
+ 
+ 
+  Excel 2016 returns same result
+ 
+ 
  
   g
  
@@ -1488,4 +1546,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index d53c00f9fcd7..2f2955b52927 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -8867,9 +8867,29 @@ void ScInterpreter::ScRight()
 else
 n = 1;
 OUString aStr = GetString().getString();
-if( n < aStr.getLength() )
-aStr = aStr.copy( aStr.getLength() - n );
-PushString( aStr );
+sal_Int32 nLen = aStr.getLength();
+sal_Int32 nIdx = 0;
+sal_Int32 nCnt = 0;
+while ( nIdx < nLen )
+{
+aStr.iterateCodePoints(  );
+++nCnt;
+}
+if ( nCnt <= n )
+PushString( aStr );
+else
+{
+sal_Int32 nCLen = nCnt;
+nIdx = 0;
+nCnt = 0;
+while ( nIdx < nLen && n < ( nCLen - nCnt ) )
+{
+aStr.iterateCodePoints(  );
+++nCnt;
+}
+aStr = aStr.copy( nIdx, nLen - nIdx );
+PushString( aStr );
+}
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-24 Thread Winfried Donkers
 sc/qa/unit/data/functions/text/fods/mid.fods |  175 ++-
 sc/source/core/tool/interpr1.cxx |   28 +++-
 2 files changed, 166 insertions(+), 37 deletions(-)

New commits:
commit e78f508997f9384518c2dd1a005c5306ccd24783
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Tue Nov 21 16:08:32 2017 +0100

tdf#97198 Make calc function MID work with Unicode non-BMP characters.

Change-Id: Ic86344495490d6ca942f9fd2752874da22ef531f
Reviewed-on: https://gerrit.libreoffice.org/45040
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/qa/unit/data/functions/text/fods/mid.fods 
b/sc/qa/unit/data/functions/text/fods/mid.fods
index 56fcd55d3f27..68c7feb10299 100644
--- a/sc/qa/unit/data/functions/text/fods/mid.fods
+++ b/sc/qa/unit/data/functions/text/fods/mid.fods
@@ -1054,41 +1054,158 @@
  
  
 
-
- 
- 
- 
- 
- 
+
+ 
+  
+ 
+ 
+  
+ 
+ 
+  TRUE
+ 
+ 
+  =MID(I2;12;8)
+ 
+ 
 
 
- 
- 
- 
- 
+ 
+  Err:502
+ 
+ 
+  Err:502
+ 
+ 
+  TRUE
+ 
+ 
+  =MID(I2;0;3)
+ 
+ 
 
 
- 
- 
- 
- 
+ 
+  b😂
+ 
+ 
+  b😂
+ 
+ 
+  TRUE
+ 
+ 
+  =MID(I8;J8;K8)
+ 
+ 
+  result Excel 2016 is b😂
+ 
+ 
+ ab😂de𝔖gh𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
+  2
+ 
 
-
- 
- 
- 
- 
- 
+
+ 
+  b
+ 
+ 
+  b
+ 
+ 
+  TRUE
+ 
+ 
+  =MID(I9;J9;K9)
+ 
+ 
+  result Excel 2016 is b
+ 
+ 
+ 
+  ab😂
+ 
+ 
+  2
+ 
+ 
+  1
+ 
 
-
- 
- 
- 
- 
- 
- 
+
+ 
+  𧌒𧀬
+ 
+ 
+  𧌒𧀬
+ 
+ 
+  TRUE
+ 
+ 
+  =MID(I10;J10;K10)
+ 
+ 
+  result Excel 2016 is 𧌒
+ 
+ 
+ 𧌒𧀬
+ 
+ 
+  2
+ 
+
+
+ 
+  ü
+ 
+ 
+  ü
+ 
+ 
+  TRUE
+ 
+ 
+  =MID(I11;J11;K11)
+ 
+ 
+  result Excel 2016 is identical
+ 
+ 
+ 
+  üë
+ 
+ 
+  2
+ 
+
+
+ 
+  𝖍𝖙𝖚
+ 
+ 
+  𝖍𝖙𝖚
+ 
+ 
+  TRUE
+ 
+ 
+  =MID(I12;J12;K12)
+ 
+ 
+  result Excel 2016 is 𝖈
+ 
+ 
+ 
+  𝕬𝖈𝖍𝖙𝖚𝖓𝖌!
+ 
+ 
+  3
+ 
 
-
+
  
  
  
@@ -1130,4 +1247,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 5bb02e6e363d..d53c00f9fcd7 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -8914,18 +8914,30 @@ void ScInterpreter::ScMid()
 {
 if ( MustHaveParamCount( GetByte(), 3 ) )
 {
-double fCnt= GetStringPositionArgument();
-double fAnfang = GetStringPositionArgument();
+sal_Int32 nSubLen = ( sal_Int32 )GetStringPositionArgument();
+sal_Int32 nStart  = ( sal_Int32 )GetStringPositionArgument();
 OUString aStr = GetString().getString();
-if (fAnfang < 1.0 || fCnt < 0.0)
+if ( nStart < 1 || nSubLen < 0 )
 PushIllegalArgument();
 else
 {
-sal_Int32 nCharacters = 
std::min(static_cast(fCnt), aStr.getLength() - fAnfang + 
1);
-OUString sRes;
-if (nCharacters > 0)
-sRes = aStr.copy(static_cast(fAnfang-1), 
nCharacters);
-PushString(sRes);
+sal_Int32 nLen = aStr.getLength();
+sal_Int32 nIdx = 0;
+sal_Int32 nCnt = 0;
+while ( nIdx < nLen && nStart - 1 > nCnt )
+{
+aStr.iterateCodePoints(  );
+++nCnt;
+}
+sal_Int32 nIdx0 = nIdx;  //start position
+
+while ( nIdx < nLen && nStart + nSubLen - 1 > nCnt )
+{
+aStr.iterateCodePoints(  );
+++nCnt;
+}
+aStr = aStr.copy( nIdx0, nIdx - nIdx0 );
+PushString( aStr );
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-13 Thread Winfried Donkers
 sc/inc/scfuncs.hrc|4 -
 sc/qa/unit/data/functions/financial/fods/vdb.fods |   53 +-
 sc/source/core/opencl/opinlinefun_finacial.cxx|6 +-
 sc/source/core/tool/interpr2.cxx  |8 +--
 4 files changed, 61 insertions(+), 10 deletions(-)

New commits:
commit 76c2e3efe751d42f7b352bebdddfe33bd37d9e06
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Sun Nov 12 11:47:11 2017 +0100

tdf#113768 Fix opposite argument description for Calc function VDB.

Also, use self-explaining variable name for argument NoSwitch.
Added use of argument NoSwitch to unit test document.

Change-Id: I801d4dbd489898b28543e0eb46f74717671ea03a
Reviewed-on: https://gerrit.libreoffice.org/44647
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/inc/scfuncs.hrc b/sc/inc/scfuncs.hrc
index 30103bbf961c..0d3999899ee8 100644
--- a/sc/inc/scfuncs.hrc
+++ b/sc/inc/scfuncs.hrc
@@ -624,8 +624,8 @@ const char* SC_OPCODE_VBD_ARY[] =
 NC_("SC_OPCODE_VBD", "End. The last period of the depreciation using the 
same time unit as for the useful life."),
 NC_("SC_OPCODE_VBD", "Factor"),
 NC_("SC_OPCODE_VBD", "Factor. The factor for the reduction of the 
depreciation. Factor = 2 denotes double rate depreciation."),
-NC_("SC_OPCODE_VBD", "Type"),
-NC_("SC_OPCODE_VBD", "Do not alter. Type = 1 denotes switch to linear 
depreciation, type = 0 do not switch.")
+NC_("SC_OPCODE_VBD", "NoSwitch"),
+NC_("SC_OPCODE_VBD", "NoSwitch = 0 denotes switch to linear depreciation, 
NoSwitch = 1 do not switch.")
 };
 
 // -=*# Resource for function EFFECT #*=-
diff --git a/sc/qa/unit/data/functions/financial/fods/vdb.fods 
b/sc/qa/unit/data/functions/financial/fods/vdb.fods
index 734c0e4c7db2..aee00996327e 100644
--- a/sc/qa/unit/data/functions/financial/fods/vdb.fods
+++ b/sc/qa/unit/data/functions/financial/fods/vdb.fods
@@ -3665,6 +3665,57 @@
  
  
 
+
+ 
+  7557.14285714286
+ 
+ 
+  7557.14285714286
+ 
+ 
+  TRUE
+ 
+ 
+  =VDB(10;2;10;4;5;1;0)
+ 
+ 
+ 
+ 
+
+
+ 
+  6560.999
+ 
+ 
+  6560.999
+ 
+ 
+  TRUE
+ 
+ 
+  =VDB(10;2;10;4;5;1;1)
+ 
+ 
+ 
+ 
+
+
+ 
+  7557.14285714286
+ 
+ 
+  7557.14285714286
+ 
+ 
+  TRUE
+ 
+ 
+  =VDB(10;2;10;4;5;1)
+ 
+ 
+ 
+ 
+
 
  
  
@@ -3753,4 +3804,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/opencl/opinlinefun_finacial.cxx 
b/sc/source/core/opencl/opinlinefun_finacial.cxx
index 38eb41db02db..6093583dc87c 100644
--- a/sc/source/core/opencl/opinlinefun_finacial.cxx
+++ b/sc/source/core/opencl/opinlinefun_finacial.cxx
@@ -1532,18 +1532,18 @@ std::string ScInterVDB=
 
 std::string VDBImplementDecl=
 "double VDBImplement(double fCost, double fSalvage, double fLife, double 
fStart"
-", double fEnd, double fFactor, int nType);\n";
+", double fEnd, double fFactor, bool bNoSwitch);\n";
 
 std::string VDBImplement=
 "double VDBImplement(double fCost, double fSalvage, double fLife, double 
fStart"
-", double fEnd, double fFactor, int nType)\n"
+", double fEnd, double fFactor, bool bNoSwitch)\n"
 "{\n"
 "double result=0;\n"
 "double fIntStart = floor(fStart);\n"
 "double fIntEnd   = ceil(fEnd);\n"
 "int nLoopStart = (int) fIntStart;\n"
 "int nLoopEnd   = (int) fIntEnd;\n"
-"if (nType)\n"
+"if (bNoSwitch)\n"
 "{\n"
 "for (int i = nLoopStart + 1; i <= nLoopEnd; i++)\n"
 "{\n"
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index d4c27a4d0fd5..67573f5ab9c1 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -1795,11 +1795,11 @@ void ScInterpreter::ScVDB()
 if ( MustHaveParamCount( nParamCount, 5, 7 ) )
 {
 double fCost, fSalvage, fLife, fStart, fEnd, fFactor, fVdb = 0.0;
-bool bType;
+bool bNoSwitch;
 if (nParamCount == 7)
-bType = GetBool();
+bNoSwitch = GetBool();
 else
-bType = false;
+bNoSwitch = false;
 if (nParamCount >= 6)
 fFactor = GetDouble();
 else
@@ -1820,7 +1820,7 @@ void ScInterpreter::ScVDB()
 sal_uLong nLoopEnd   = (sal_uLong) fIntEnd;
 
 fVdb = 0.0;
-if (bType)
+if (bNoSwitch)
 {
 for (sal_uLong i = nLoopStart + 1; i <= nLoopEnd; i++)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Re: tdf106013 Add-In functions that are also Excel2013 OOXML functions

2017-10-24 Thread Winfried Donkers
Hi Eike,>> There is a group of Add-In functions that were newly defined 
in Excel 2013

(IMCOSH, IMCOT, IMCSC, IMCSCH, IMSEC, IMSECH, IMSINH and IMTAN, I'll call
them IMxx).

In Calc these functions are defined in scaddins and also mentioned in
sc/source/filter/oox/formulabase.cxx in saFuncTable2013[].


The problem is that the IMxx functions saved as xlsx by Calc won't open
correctly by Excel and vice versa.

Calc writes the IMxx functions in xlsx as =IMxx(...), just as on ods.

Excel writes the IMxx functions in xlsx as =_xlfn.IMxx(...), and in ods as
=IMxx(...).

The other Add-In functions are written by both Calc and Excel as
=FUNCTIONNAME(...).


This is due to that the functions defined in the Add-In were defined by
Excel long ago and are part of OOXML, and those Add-In functions are
treated accordingly during export. Unfortunately the exceptional IM*
cases don't seem to fit into the XclFunctionInfo tables of
sc/source/filter/excel/xlformula.cxx, only the case of writing an
internal function as Add-In is handled there (those with
EXC_FUNCFLAG_ADDINEQUIV set). But the lookup is done by OpCode in those
tables, so that doesn't work for ocExternal.


Any suggestions for a solution?


I could imagine to define some extra range of OpCode for XclFunctionInfo
starting at 0xFF00 or any other unused high value and for
ocExternal/svExternal do an extra lookup depending on the value of the
XclExpScToken's aTokData.mpScToken->GetExternal() programmatical name,
that for example is "com.sun.star.sheet.addin.Analysis.getImcsch", using
a simple std:map like
opcodevalue["com.sun.star.sheet.addin.Analysis.getImcsch"] = 0xFF00;

The corresponding XclFunctionInfo entry then could be

 { 0xFF00,   255,2,  2, V, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY, 
EXC_FUNCNAME( "IMCSCH" ) },

Note that these 255-export-only definitions due to the BIFF .xls macro
call storage use minparam+1 and maxparam+1, so for IMCSCH that expects
one parameter the definition is 2,2

In XclExpFmlaCompImpl::ProcessFunction() there's

 maFuncProv.GetFuncInfoFromOpCode( eOpCode )

which for (eOpCode == ocExternal && rTokData.GetType() == svExternal)
would needed to be called with the new eOpCode according to the mapping.

I hope that helps.



I have been working on and off ,too much off :-(, at tdf106013, but with 
little success. Currently, I don't see how to to proceed in 
XclExpFmlaCompImpl::ProcessFunction().
Can you give some more information about how you think these functions 
should be processed to have them properly saved in OOXML format?


Also, I wonder -ignorant of the consequences- if a solution the other 
way round would be better in the long term.
I mean, can't we make the Add-In functions regular functions (getting 
rid of a lot of almost identical code in the process) and just treat the 
saving as Add-In function in xls-documents and OOXML-documents. My guess 
is that there will be less Add-In functions in OOXML with every new 
Excel version when MS moves the Add-In function to a regular function, 
just like the IMxx-functions.
This is quite a big task, I realise that. But if the benefits I expect 
really are, I think I can move one function at a time once the framework 
is there.


Winfried
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: ODFF1.2 interpretation of function WEEKNUM

2017-09-26 Thread Winfried Donkers
Hi Eike,

> > Which bug# btw?
> 
> Never mind, found it,
> https://bugs.documentfoundation.org/show_bug.cgi?id=112320
> 
> > I'll bring this to the attention of the ODF-TC and, depending on the
> > outcome, we may have to change implementation, or introduce some
> > WEEKNUM_EXCEL function.
> 

I look forward to the outcome. The week number (we already had year fraction) 
is a weird subject when Excel is concerned.

Winfried
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: ODFF1.2 interpretation of function WEEKNUM

2017-09-25 Thread Winfried Donkers
Hi Wol,


> This reads to me exactly like the ODF spec, so it seems that Excel is not
> abiding by the Excel spec if it returns 29-dec as week 53 ...
> 
> To quote the Excel spec, "System 1The week containing January 1 is
> the first week of the year, and is numbered week 1." That says to me - as
> a native English speaker, that it is a complete week INCLUDING ANY DAYS
> BEFORE JAN 1.
> 
> So yes. It looks like Excel does not do what it says it does. Quelle
> Surprise.

I have studied quite some sources now and have come to the conclusion that 
there are 2 views:
-a generally shared view that is the same as ODFF1.2. This includes MariaDB SQL.
-a Microsoft view that partial weeks are used. This conflicts a.o. with the 
Islamitic week numbering system.

I have closed the bug report as NOTOURBUG.

Winfried
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


ODFF1.2 interpretation of function WEEKNUM

2017-09-18 Thread Winfried Donkers

Hi Eike,


I'm working on tdf112320 and I think that ODFF1.2 may be ambiguous with 
respect to WEEKNUM 
(http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part2.html#WEEKNUM)


My interpretation of the Semantics for Mode 1,2,11-17 was that

'every week starts on Sunday..Saturday, depending on the value of Mode. 
The week containing 1 January is week 1'.


So, WEEKNUM(DATE(2014,12,29),1) returns 1, as it is a Monday, the week 
starts on Sunday 28 December and 1 January is on the Thursday. All weeks 
have 7 days.



However, both Excel and Gnumeric use

'every week starts on Sunday..Saturday, depending on the value of Mode, 
_or_ on 1 January (with the week number 1)'.


So, WEEKNUM(DATE(2014,12,29),1) returns 53, as it is a Monday, following 
week 52 and WEEKNUM(DATE(2015,1,1),1) returns 1. Week 53 has 4 days and 
week 1 has 3 days.



When I read ODFF1.2 again (and again) I read the first interpretation 
(WEEKNUM(DATE(2014,12,29),1)=1). But is that correct??


As it is now, Calc produces different results when compared to Excel and 
Gnumeric.


What is your interpretation?


Winfried

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: ODFF1.2 GEOMEAN

2017-09-14 Thread Winfried Donkers
Hi Eike,

As we now have changed GEOMEAN, I think it would be wise to try to improve 
ODFF1.2 as well for GEOMEAN.

Winfried

Van: LibreOffice [mailto:libreoffice-boun...@lists.freedesktop.org] Namens 
Winfried Donkers
Verzonden: woensdag 26 juli 2017 12:06
Aan: libreoffice@lists.freedesktop.org; Eike Rathke (er...@redhat.com)
Onderwerp: ODFF1.2 GEOMEAN

Hi Eike,

I'm looking at bug 109096.
The problem here is that ODFF1.2 does not have constraints for the number 
values and neither specifies a complete result description.
See 
http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part2.html#__RefHeading__1018690_715980110

Geometric mean is defined as n-root( a1 * a2 * ... * an). This applies for n 
positive values a#.
This is awkward to compute as overflow is lurking in case of large values a and 
a large number n.
An alternative computation is given in ODFF, but the case of any value a# being 
0 is not mentioned (result is then 0).
Any a# with value is a geometrically valid situation, unlike negative values 
which do not have any geometric meaning AFAIK.

I would propose an amendment of ODFF1.2 for GEOMEAN:
Constraints: numbers >= 0
Semantics: addition of Returns zero when one or more numbers have value 0.

What's your opinion?

Winfried

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2017-09-13 Thread Winfried Donkers
 sc/qa/unit/data/functions/statistical/fods/geomean.fods |   83 ++--
 sc/source/core/tool/interpr3.cxx|   50 +
 2 files changed, 124 insertions(+), 9 deletions(-)

New commits:
commit 65ea925d173db0f319a8ca78855587d089e5270d
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Fri Sep 8 16:44:22 2017 +0200

tdf#109096 Allow 0 as argument value(s) to GEOMEAN()

Both ODFF1.2 and the mathematical definition allow 0 as value(s).
Excel does not allow 0 as argument value(s), but IMHO this is to be
regarded as an aberration of Excel.

Also added tests for no arguments or negative arguments, which is not 
allowed by ODFF1.2.

Change-Id: I330206b6e817e0ec092fe19f713b044578da41d1
Reviewed-on: https://gerrit.libreoffice.org/42107
Reviewed-by: Eike Rathke <er...@redhat.com>
Tested-by: Jenkins <c...@libreoffice.org>

diff --git a/sc/qa/unit/data/functions/statistical/fods/geomean.fods 
b/sc/qa/unit/data/functions/statistical/fods/geomean.fods
index 76b0257f9cd7..2a8fdf3fdf1e 100644
--- a/sc/qa/unit/data/functions/statistical/fods/geomean.fods
+++ b/sc/qa/unit/data/functions/statistical/fods/geomean.fods
@@ -3547,13 +3547,13 @@
  
 
 
- 
-  Err:502
- 
- 
-  Err:502
+ 
+  0
  
- 
+ 
+  0
+  
+ 
   TRUE
  
  
@@ -3699,7 +3699,10 @@
  
   0.5
  
- 
+ 
+  -9
+ 
+ 
  
  
  
@@ -4558,6 +4561,40 @@
  
   =GEOMEAN(J2:K5)
  
+
+
+ 
+  #NUM!
+ 
+ 
+  #NUM!
+ 
+ 
+  TRUE
+ 
+ 
+  =GEOMEAN(J21:J25)
+ 
+ 
+  at least 1 value must be given
+ 
+
+
+ 
+  #NUM!
+ 
+ 
+  #NUM!
+ 
+ 
+  TRUE
+ 
+ 
+  =GEOMEAN()
+ 
+ 
+  at least 1 value must be given
+ 
  
  
  
@@ -4568,9 +4605,37 @@
  
  
  
+ 
+
+
+ 
+  Err:502
+ 
+ 
+  Err:502
+ 
+ 
+  TRUE
+ 
+ 
+  =GEOMEAN(J2:J6)
+ 
+ 
+  negative values are not allowed
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
  
 
-
+
  
  
  
@@ -5186,4 +5251,4 @@

   
  
-
\ No newline at end of file
+
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 7b60e39dc6f4..e6ae4c2649d8 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -3042,6 +3042,14 @@ void ScInterpreter::ScGeoMean()
 nVal += log(x);
 nValCount++;
 }
+else if ( x == 0.0 )
+{
+// value of 0 means that function result will be 0
+while ( nParamCount-- > 0 )
+PopError();
+PushDouble( 0.0 );
+return;
+}
 else
 SetError( FormulaError::IllegalArgument);
 break;
@@ -3058,6 +3066,14 @@ void ScInterpreter::ScGeoMean()
 nVal += log(x);
 nValCount++;
 }
+else if ( x == 0.0 )
+{
+// value of 0 means that function result will be 0
+while ( nParamCount-- > 0 )
+PopError();
+PushDouble( 0.0 );
+return;
+}
 else
 SetError( FormulaError::IllegalArgument);
 }
@@ -3077,6 +3093,14 @@ void ScInterpreter::ScGeoMean()
 nVal += log(nCellVal);
 nValCount++;
 }
+else if ( nCellVal == 0.0 )
+{
+// value of 0 means that function result will be 0
+while ( nParamCount-- > 0 )
+PopError();
+PushDouble( 0.0 );
+return;
+}
 else
 SetError( FormulaError::IllegalArgument);
 SetError(nErr);
@@ -3087,6 +3111,14 @@ void ScInterpreter::ScGeoMean()
 nVal += log(nCellVal);
 nValCount++;
 }
+else if ( nCellVal == 0.0 )
+{
+// value of 0 means that function result will be 0
+while ( nParamCount-- > 0 )
+PopError();
+PushDouble( 0.0 );
+return;
+}
 else
 

  1   2   3   4   5   6   7   8   9   >