26#include <sys/utsname.h>
34#include "valueconverter.h"
36#include "kspread_doc.h"
37#include "kspread_sheet.h"
49Value func_islogical (valVector args, ValueCalc *calc, FuncExtra *);
51Value func_isnottext (valVector args, ValueCalc *calc, FuncExtra *);
62void RegisterInformationFunctions()
64 FunctionRepository* repo = FunctionRepository::self();
67 f = new Function ( "FILENAME", func_filename);
70 f = new Function ( "INFO", func_info);
72 f = new Function ( "ISBLANK", func_isblank);
74 f = new Function ( "ISDATE", func_isdate);
76 f = new Function ( "ISERR", func_iserr);
78 f = new Function ( "ISERROR", func_iserror);
80 f = new Function ( "ISEVEN", func_iseven);
82 f = new Function ( "ISLOGICAL", func_islogical);
84 f = new Function ( "ISNA", func_isna);
86 f = new Function ( "ISNONTEXT", func_isnottext);
88 f = new Function ( "ISNOTTEXT", func_isnottext);
90 f = new Function ( "ISNUM", func_isnum);
92 f = new Function ( "ISNUMBER", func_isnum);
94 f = new Function ( "ISODD", func_isodd);
96 f = new Function ( "ISREF", func_isref);
97 f->setNeedsExtra ( true);
99 f = new Function ( "ISTEXT", func_istext);
101 f = new Function ( "ISTIME", func_istime);
103 f = new Function ( "N", func_n);
105 f = new Function ( "TYPE", func_type);
106 f->setAcceptArray ();
113 TQString type = calc->conv()->asString (args[0]). asString().lower();
115 if (type == "directory")
116 return Value (TQDir::currentDirPath());
118 if (type == "release")
119 return Value (TQString (VERSION));
121 if ( type == "numfile" )
124 if (type == "recalc")
128 if (calc->doc()->delayCalculation())
129 result = i18n ( "Manual");
131 result = i18n ( "Automatic");
133 return Value (result);
136 if (type == "memavail")
139 if (type == "memused")
142 if (type == "origin")
146 if (type == "system") {
148 if (uname (&name) >= 0)
149 return Value (TQString (name.sysname));
152 if (type == "totmem")
156 if (type == "osversion")
159 if (uname (&name) >= 0)
161 TQString os = TQString( "%1 %2 (%3)").arg( name.sysname ).
162 arg( name.release ).arg( name.machine );
173 return Value (args[0].isEmpty());
179 return Value (args[0].isBoolean());
185 return Value (args[0].isString());
192 if ((e == 0) || (e->ranges[0].col1 == -1) || (e->ranges[0].row1 == -1))
193 return Value ( false);
201 return Value (args[0].isString() ? false : true);
207 return Value (args[0].isNumber());
213 return Value ((args[0].format() == Value::fmt_Time)
214 || (args[0].format() == Value::fmt_DateTime));
220 return Value ((args[0].format() == Value::fmt_Date)
221 || (args[0].format() == Value::fmt_DateTime));
227 return Value (calc->isEven(args[0]) ? false : true);
233 return Value (calc->isEven(args[0]));
239 return (args[0].isError() &&
252 return (args[0].isError() &&
261 if (args[0].isArray())
263 if (args[0].isNumber())
265 if (args[0].isString())
267 if (args[0].isBoolean())
269 if (args[0].isError())
278 return Value (calc->doc()->url().prettyURL());
284 return calc->conv()->asFloat (args[0]);
static TQValueList< Doc * > documents() Returns list of all documents.
The ValueCalc class is used to perform all sorts of calculations.
Provides a wrapper for cell value.
TQString asString() const Returns the string value of this value.
static const Value & errorVALUE() Returns constant reference to #VALUE! error.
bool isError() const Returns true if this value holds error information.
static const Value & errorNA() Returns constant reference to #N/A error.
|