[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/kspread
From:       Tomas Mecir <mecirt () gmail ! com>
Date:       2005-08-09 14:01:51
Message-ID: 1123596111.413683.8585.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 444257 by mecir:

Functions now receive the range information. None of them uses it as of now - that'll come tomorrow :D




 M  +10 -2     formula.cc  
 M  +6 -1      functions.h  


--- trunk/koffice/kspread/formula.cc #444256:444257
@@ -1159,7 +1159,8 @@
   
 
   Function* function;
-  
+  FuncExtra fe;
+
   if( d->dirty )
   {
     Tokens tokens = scan( d->expression );
@@ -1382,6 +1383,9 @@
           return KSpreadValue::errorVALUE(); // not enough arguments
         
         args.clear();
+        fe.ranges.clear ();
+        fe.ranges.reserve (index);
+        fe.sheet = sheet;
         for( ; index; index-- )
         {
           stackEntry e = stack.pop();
@@ -1389,6 +1393,10 @@
           // TODO: create and fill a FunctionExtra object, if needed
           // problem: we don't know if we need it, as we don't have the
           // fuction name yet ...
+          fe.ranges[index - 1].col1 = e.col1;
+          fe.ranges[index - 1].row1 = e.row1;
+          fe.ranges[index - 1].col2 = e.col2;
+          fe.ranges[index - 1].row2 = e.row2;
         }
 
         // function name as string value
@@ -1399,7 +1407,7 @@
         if( !function )
           return KSpreadValue::errorVALUE(); // no such function
         
-        ret = function->exec (args, calc, 0);
+        ret = function->exec (args, calc, &fe);
         if (ret.isError ())
           return ret;    // error in the function
         entry.reset();
--- trunk/koffice/kspread/functions.h #444256:444257
@@ -28,15 +28,20 @@
 #include "kspread_value.h"
 
 class QDomElement;
+class KSpreadSheet;
 
-
 typedef QValueVector<KSpreadValue> valVector;
 
 namespace KSpread
 {
 
+struct rangeInfo {
+  int col1, col2, row1, row2;
+};
 struct FuncExtra {
   // here we'll add all the extras a function may need
+  QValueVector<rangeInfo> ranges;
+  KSpreadSheet *sheet;
 };
 
 class ValueCalc;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic