diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kspread/kspread_functions_datetime.cc | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kspread/kspread_functions_datetime.cc')
-rw-r--r-- | kspread/kspread_functions_datetime.cc | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/kspread/kspread_functions_datetime.cc b/kspread/kspread_functions_datetime.cc index 35b13d6c..b139057d 100644 --- a/kspread/kspread_functions_datetime.cc +++ b/kspread/kspread_functions_datetime.cc @@ -32,8 +32,8 @@ using namespace KSpread; // prototypes, sorted -Value func_currentDate (valVector args, ValueCalc *calc, FuncExtra *); -Value func_currentDateTime (valVector args, ValueCalc *calc, FuncExtra *); +Value func_tqcurrentDate (valVector args, ValueCalc *calc, FuncExtra *); +Value func_tqcurrentDateTime (valVector args, ValueCalc *calc, FuncExtra *); Value func_currentTime (valVector args, ValueCalc *calc, FuncExtra *); Value func_date (valVector args, ValueCalc *calc, FuncExtra *); Value func_datevalue (valVector args, ValueCalc *calc, FuncExtra *); @@ -77,10 +77,10 @@ void RegisterDateTimeFunctions() FunctionRepository* repo = FunctionRepository::self(); Function *f; - f = new Function ("CURRENTDATE", func_currentDate); + f = new Function ("CURRENTDATE", func_tqcurrentDate); f->setParamCount (0); repo->add (f); - f = new Function ("CURRENTDATETIME", func_currentDateTime); + f = new Function ("CURRENTDATETIME", func_tqcurrentDateTime); f->setParamCount (0); repo->add (f); f = new Function ("CURRENTTIME", func_currentTime); @@ -140,7 +140,7 @@ void RegisterDateTimeFunctions() f = new Function ("MONTHS", func_months); f->setParamCount (3); repo->add (f); - f = new Function ("NOW", func_currentDateTime); + f = new Function ("NOW", func_tqcurrentDateTime); f->setParamCount (0); repo->add (f); f = new Function ("SECOND", func_second); @@ -154,7 +154,7 @@ void RegisterDateTimeFunctions() repo->add (f); f = new Function ("TIMEVALUE", func_timevalue); repo->add (f); - f = new Function ("TODAY", func_currentDate); + f = new Function ("TODAY", func_tqcurrentDate); f->setParamCount (0); repo->add (f); f = new Function ("WEEKDAY", func_weekday); @@ -175,7 +175,7 @@ void RegisterDateTimeFunctions() // Function: EDATE Value func_edate (valVector args, ValueCalc *calc, FuncExtra *) { - QDate date = calc->conv()->asDate (args[0]).asDate(); + TQDate date = calc->conv()->asDate (args[0]).asDate(); int months = calc->conv()->asInteger (args[1]).asInteger(); date = calc->conv()->locale()->calendar()->addMonths (date, months); @@ -194,7 +194,7 @@ Value func_eomonth (valVector args, ValueCalc *calc, FuncExtra *) if (modDate.isError()) return modDate; // modDate is currently in Date format - QDate date = modDate.asDate(); + TQDate date = modDate.asDate(); date.setYMD (date.year(), date.month(), date.daysInMonth()); return Value (date); @@ -204,8 +204,8 @@ Value func_eomonth (valVector args, ValueCalc *calc, FuncExtra *) // algorithm adapted from gnumeric Value func_days360 (valVector args, ValueCalc *calc, FuncExtra *) { - QDate date1 = calc->conv()->asDate (args[0]).asDate(); - QDate date2 = calc->conv()->asDate (args[1]).asDate(); + TQDate date1 = calc->conv()->asDate (args[0]).asDate(); + TQDate date2 = calc->conv()->asDate (args[1]).asDate(); bool european = false; if (args.count() == 3) european = calc->conv()->asBoolean (args[2]).asBoolean(); @@ -217,7 +217,7 @@ Value func_days360 (valVector args, ValueCalc *calc, FuncExtra *) if (date1.daysTo( date2 ) < 0) { - QDate tmp( date1 ); + TQDate tmp( date1 ); date1 = date2; date2 = tmp; negative = true; @@ -266,7 +266,7 @@ Value func_year (valVector args, ValueCalc *calc, FuncExtra *) { Value v = calc->conv()->asDate (args[0]); if (v.isError()) return v; - QDate date = v.asDate(); + TQDate date = v.asDate(); return Value (date.year ()); } @@ -275,7 +275,7 @@ Value func_month (valVector args, ValueCalc *calc, FuncExtra *) { Value v = calc->conv()->asDate (args[0]); if (v.isError()) return v; - QDate date = v.asDate(); + TQDate date = v.asDate(); return Value (date.month ()); } @@ -284,14 +284,14 @@ Value func_day (valVector args, ValueCalc *calc, FuncExtra *) { Value v = calc->conv()->asDate (args[0]); if (v.isError()) return v; - QDate date = v.asDate(); + TQDate date = v.asDate(); return Value (date.day ()); } // Function: HOUR Value func_hour (valVector args, ValueCalc *calc, FuncExtra *) { - QTime time; + TQTime time; if (args.count() == 1) { Value v = calc->conv()->asTime (args[0]); @@ -299,14 +299,14 @@ Value func_hour (valVector args, ValueCalc *calc, FuncExtra *) time = v.asTime(); } else - time = QTime::currentTime (); + time = TQTime::currentTime (); return Value (time.hour ()); } // Function: MINUTE Value func_minute (valVector args, ValueCalc *calc, FuncExtra *) { - QTime time; + TQTime time; if (args.count() == 1) { Value v = calc->conv()->asTime (args[0]); @@ -314,14 +314,14 @@ Value func_minute (valVector args, ValueCalc *calc, FuncExtra *) time = v.asTime(); } else - time = QTime::currentTime (); + time = TQTime::currentTime (); return Value (time.minute ()); } // Function: SECOND Value func_second (valVector args, ValueCalc *calc, FuncExtra *) { - QTime time; + TQTime time; if (args.count() == 1) { Value v = calc->conv()->asTime (args[0]); @@ -329,7 +329,7 @@ Value func_second (valVector args, ValueCalc *calc, FuncExtra *) time = v.asTime(); } else - time = QTime::currentTime (); + time = TQTime::currentTime (); return Value (time.second ()); } @@ -338,7 +338,7 @@ Value func_weekday (valVector args, ValueCalc *calc, FuncExtra *) { Value v = calc->conv()->asDate (args[0]).asDate(); if (v.isError()) return v; - QDate date = v.asDate(); + TQDate date = v.asDate(); int method = 1; if (args.count() == 2) method = calc->conv()->asInteger (args[1]).asInteger(); @@ -386,8 +386,8 @@ Value func_timevalue (valVector args, ValueCalc *calc, FuncExtra *) // Function: years Value func_years (valVector args, ValueCalc *calc, FuncExtra *) { - QDate date1 = calc->conv()->asDate (args[0]).asDate(); - QDate date2 = calc->conv()->asDate (args[1]).asDate(); + TQDate date1 = calc->conv()->asDate (args[0]).asDate(); + TQDate date2 = calc->conv()->asDate (args[1]).asDate(); if (!date1.isValid() || !date2.isValid()) return Value::errorVALUE(); @@ -420,8 +420,8 @@ Value func_years (valVector args, ValueCalc *calc, FuncExtra *) // Function: months Value func_months (valVector args, ValueCalc *calc, FuncExtra *) { - QDate date1 = calc->conv()->asDate (args[0]).asDate(); - QDate date2 = calc->conv()->asDate (args[1]).asDate(); + TQDate date1 = calc->conv()->asDate (args[0]).asDate(); + TQDate date2 = calc->conv()->asDate (args[1]).asDate(); if (!date1.isValid() || !date2.isValid()) return Value::errorVALUE(); @@ -455,8 +455,8 @@ Value func_months (valVector args, ValueCalc *calc, FuncExtra *) // Function: weeks Value func_weeks (valVector args, ValueCalc *calc, FuncExtra *) { - QDate date1 = calc->conv()->asDate (args[0]).asDate(); - QDate date2 = calc->conv()->asDate (args[1]).asDate(); + TQDate date1 = calc->conv()->asDate (args[0]).asDate(); + TQDate date2 = calc->conv()->asDate (args[1]).asDate(); if (!date1.isValid() || !date2.isValid()) return Value::errorVALUE(); @@ -481,8 +481,8 @@ Value func_weeks (valVector args, ValueCalc *calc, FuncExtra *) // Function: days Value func_days (valVector args, ValueCalc *calc, FuncExtra *) { - QDate date1 = calc->conv()->asDate (args[0]).asDate(); - QDate date2 = calc->conv()->asDate (args[1]).asDate(); + TQDate date1 = calc->conv()->asDate (args[0]).asDate(); + TQDate date2 = calc->conv()->asDate (args[1]).asDate(); if (!date1.isValid() || !date2.isValid()) return Value::errorVALUE(); @@ -496,7 +496,7 @@ Value func_date (valVector args, ValueCalc *calc, FuncExtra *) int m = calc->conv()->asInteger (args[1]).asInteger(); int d = calc->conv()->asInteger (args[2]).asInteger(); - QDate _date; + TQDate _date; if( _date.setYMD (y, m, d)) return Value (_date); return Value::errorVALUE(); @@ -507,7 +507,7 @@ Value func_dayname (valVector args, ValueCalc *calc, FuncExtra *) { int number = calc->conv()->asInteger (args[0]).asInteger(); - QString weekName = calc->conv()->locale()->calendar()->weekDayName (number); + TQString weekName = calc->conv()->locale()->calendar()->weekDayName (number); if (weekName.isNull()) return Value::errorVALUE(); return Value (weekName); @@ -518,8 +518,8 @@ Value func_monthname (valVector args, ValueCalc *calc, FuncExtra *) { int number = calc->conv()->asInteger (args[0]).asInteger(); - QString monthName = calc->conv()->locale()->calendar()->monthName (number, - QDate::currentDate().year()); + TQString monthName = calc->conv()->locale()->calendar()->monthName (number, + TQDate::tqcurrentDate().year()); if (monthName.isNull()) return Value::errorVALUE(); return Value (monthName); @@ -552,25 +552,25 @@ Value func_time (valVector args, ValueCalc *calc, FuncExtra *) if (h < 0) h += 24; - return Value (QTime (h, m, s)); + return Value (TQTime (h, m, s)); } -// Function: currentDate -Value func_currentDate (valVector, ValueCalc *, FuncExtra *) +// Function: tqcurrentDate +Value func_tqcurrentDate (valVector, ValueCalc *, FuncExtra *) { - return Value (QDate::currentDate ()); + return Value (TQDate::tqcurrentDate ()); } // Function: currentTime Value func_currentTime (valVector, ValueCalc *, FuncExtra *) { - return Value (QTime::currentTime ()); + return Value (TQTime::currentTime ()); } -// Function: currentDateTime -Value func_currentDateTime (valVector, ValueCalc *, FuncExtra *) +// Function: tqcurrentDateTime +Value func_tqcurrentDateTime (valVector, ValueCalc *, FuncExtra *) { - return Value (QDateTime::currentDateTime ()); + return Value (TQDateTime::tqcurrentDateTime ()); } // Function: dayOfYear @@ -586,7 +586,7 @@ Value func_daysInMonth (valVector args, ValueCalc *calc, FuncExtra *) { int y = calc->conv()->asInteger (args[0]).asInteger(); int m = calc->conv()->asInteger (args[1]).asInteger(); - QDate date (y, m, 1); + TQDate date (y, m, 1); return Value (date.daysInMonth()); } @@ -594,21 +594,21 @@ Value func_daysInMonth (valVector args, ValueCalc *calc, FuncExtra *) Value func_isLeapYear (valVector args, ValueCalc *calc, FuncExtra *) { int y = calc->conv()->asInteger (args[0]).asInteger(); - return Value (QDate::leapYear (y)); + return Value (TQDate::leapYear (y)); } // Function: daysInYear Value func_daysInYear (valVector args, ValueCalc *calc, FuncExtra *) { int y = calc->conv()->asInteger (args[0]).asInteger(); - return Value (QDate::leapYear (y) ? 366 : 365); + return Value (TQDate::leapYear (y) ? 366 : 365); } // Function: weeksInYear Value func_weeksInYear (valVector args, ValueCalc *calc, FuncExtra *) { int y = calc->conv()->asInteger (args[0]).asInteger(); - QDate date (y, 12, 31); // last day of the year + TQDate date (y, 12, 31); // last day of the year return Value (date.weekNumber ()); } @@ -636,13 +636,13 @@ Value func_easterSunday (valVector args, ValueCalc *calc, FuncExtra *) nDay = O % 31 + 1; nMonth = int(O / 31); - return Value (QDate (nYear, nMonth, nDay)); + return Value (TQDate (nYear, nMonth, nDay)); } // Function: isoWeekNum Value func_isoWeekNum (valVector args, ValueCalc *calc, FuncExtra *) { - QDate date = calc->conv()->asDate (args[0]).asDate(); + TQDate date = calc->conv()->asDate (args[0]).asDate(); if (!date.isValid()) return Value::errorVALUE(); |