ooo-build r11224 - in trunk: . patches/src680



Author: kyoshida
Date: Tue Jan  8 17:29:58 2008
New Revision: 11224
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11224&view=rev

Log:
2008-01-08  Lv Yue  <lvyue redflag2000 cn>

	* patches/src680/sc-openformula-minmax.diff: added to have 
	MIN/MAX/MINA/MAXA return 0 when referenced cell ranges are empty (part
	of OpenFormula work).

	* patches/src680/sc-minmax.diff: obsoleted by the above patch.

	* patches/src680/apply:	make the above change.


Added:
   trunk/patches/src680/sc-openformula-minmax.diff
Removed:
   trunk/patches/src680/sc-minmax.diff
Modified:
   trunk/ChangeLog
   trunk/patches/src680/apply

Modified: trunk/patches/src680/apply
==============================================================================
--- trunk/patches/src680/apply	(original)
+++ trunk/patches/src680/apply	Tue Jan  8 17:29:58 2008
@@ -624,9 +624,6 @@
 # Allow objects to stay within cells as expected when rows are resized.
 sc-object-row-position.diff, i#47088, jonp
 
-# Return 0 by MIN/MAX/MINA/MAXA when referenced cells are all empty.
-sc-minmax.diff, i#38759, muthusub
-
 # Unit conversion fixes in ScDrawLayer.
 sc-drwlayer-units.diff, i#83735, jonp
 
@@ -646,6 +643,10 @@
 # to Excel's (ODFF).
 sc-openformula-sumif.diff, i#85000, kohei
 
+# Return 0 by MIN/MAX/MINA/MAXA when referenced cells are all empty (patch
+# contributed from Lv Yue) (ODFF).
+sc-openformula-minmax.diff, i#38759, kohei
+
 # Support print & page preview for files containing only lines
 sc-print-lines.diff, n#351468, i#85076, jonp
 

Added: trunk/patches/src680/sc-openformula-minmax.diff
==============================================================================
--- (empty file)
+++ trunk/patches/src680/sc-openformula-minmax.diff	Tue Jan  8 17:29:58 2008
@@ -0,0 +1,84 @@
+Index: sc/source/core/tool/interpr1.cxx
+===================================================================
+RCS file: /cvs/sc/sc/source/core/tool/interpr1.cxx,v
+retrieving revision 1.53
+diff -u -r1.53 interpr1.cxx
+--- sc/source/core/tool/interpr1.cxx	1 Nov 2007 16:23:17 -0000	1.53
++++ sc/source/core/tool/interpr1.cxx	8 Jan 2008 17:17:34 -0000
+@@ -2768,7 +2768,9 @@
+ void ScInterpreter::ScMin( BOOL bTextAsZero )
+ {
+ 	BYTE nParamCount = GetByte();
+-	double nMin = SC_DOUBLE_MAXVALUE;
++    if (!MustHaveParamCountMin( nParamCount, 1))
++        return;
++    double nMin = ::std::numeric_limits<double>::max();
+ 	double nVal = 0.0;
+ 	ScAddress aAdr;
+ 	ScRange aRange;
+@@ -2805,18 +2807,18 @@
+ 				USHORT nErr = 0;
+ 				PopDoubleRef( aRange );
+ 				ScValueIterator aValIter( pDok, aRange, glSubTotal, bTextAsZero );
+-				if (aValIter.GetFirst(nVal, nErr))
+-				{
+-					if (nMin > nVal)
+-						nMin = nVal;
+-					aValIter.GetCurNumFmtInfo( nFuncFmtType, nFuncFmtIndex );
+-					while ((nErr == 0) && aValIter.GetNext(nVal, nErr))
+-					{
+-						if (nMin > nVal)
+-							nMin = nVal;
+-					}
+-					SetError(nErr);
+-				}
++                if (aValIter.GetFirst(nVal, nErr))
++                {
++                    if (nMin > nVal)
++                        nMin = nVal;
++                    aValIter.GetCurNumFmtInfo( nFuncFmtType, nFuncFmtIndex );
++                    while ((nErr == 0) && aValIter.GetNext(nVal, nErr))
++                    {
++                        if (nMin > nVal)
++                            nMin = nVal;
++                    }
++                    SetError(nErr);
++                }
+ 			}
+ 			break;
+ 			case svMatrix :
+@@ -2875,9 +2877,9 @@
+ 				SetError(errIllegalParameter);
+ 		}
+ 	}
+-	if (nMin == SC_DOUBLE_MAXVALUE)
+-		SetIllegalArgument();
+-	else
++	if ( nVal < nMin  )
++		PushDouble(0.0);
++	else		
+ 		PushDouble(nMin);
+ }
+ 
+@@ -2888,7 +2890,9 @@
+ void ScInterpreter::ScMax( BOOL bTextAsZero )
+ {
+ 	BYTE nParamCount = GetByte();
+-	double nMax = -SC_DOUBLE_MAXVALUE;
++    if (!MustHaveParamCountMin( nParamCount, 1))
++        return;
++    double nMax = -(::std::numeric_limits<double>::max());
+ 	double nVal = 0.0;
+ 	ScAddress aAdr;
+ 	ScRange aRange;
+@@ -2995,8 +2999,8 @@
+ 				SetError(errIllegalParameter);
+ 		}
+ 	}
+-	if (nMax == -SC_DOUBLE_MAXVALUE)
+-		SetIllegalArgument();
++    if ( nVal > nMax  )
++        PushDouble(0.0);
+ 	else
+ 		PushDouble(nMax);
+ }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]