summaryrefslogtreecommitdiffstats
path: root/kspread/kspread_functions_text.cc
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
commitf008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch)
tree8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kspread/kspread_functions_text.cc
parent1210f27b660efb7b37ff43ec68763e85a403471f (diff)
downloadkoffice-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_text.cc')
-rw-r--r--kspread/kspread_functions_text.cc134
1 files changed, 67 insertions, 67 deletions
diff --git a/kspread/kspread_functions_text.cc b/kspread/kspread_functions_text.cc
index 9bb7095e..966ac56c 100644
--- a/kspread/kspread_functions_text.cc
+++ b/kspread/kspread_functions_text.cc
@@ -23,7 +23,7 @@
// built-in text functions
// please keep it in alphabetical order
-#include <qregexp.h>
+#include <tqregexp.h>
#include <kdebug.h>
#include <klocale.h>
#include <math.h>
@@ -45,7 +45,7 @@ Value func_compare (valVector args, ValueCalc *calc, FuncExtra *);
Value func_concatenate (valVector args, ValueCalc *calc, FuncExtra *);
Value func_dollar (valVector args, ValueCalc *calc, FuncExtra *);
Value func_exact (valVector args, ValueCalc *calc, FuncExtra *);
-Value func_find (valVector args, ValueCalc *calc, FuncExtra *);
+Value func_tqfind (valVector args, ValueCalc *calc, FuncExtra *);
Value func_fixed (valVector args, ValueCalc *calc, FuncExtra *);
Value func_left (valVector args, ValueCalc *calc, FuncExtra *);
Value func_len (valVector args, ValueCalc *calc, FuncExtra *);
@@ -54,7 +54,7 @@ Value func_mid (valVector args, ValueCalc *calc, FuncExtra *);
Value func_proper (valVector args, ValueCalc *calc, FuncExtra *);
Value func_regexp (valVector args, ValueCalc *calc, FuncExtra *);
Value func_regexpre (valVector args, ValueCalc *calc, FuncExtra *);
-Value func_replace (valVector args, ValueCalc *calc, FuncExtra *);
+Value func_tqreplace (valVector args, ValueCalc *calc, FuncExtra *);
Value func_rept (valVector args, ValueCalc *calc, FuncExtra *);
Value func_rot (valVector args, ValueCalc *calc, FuncExtra *);
Value func_right (valVector args, ValueCalc *calc, FuncExtra *);
@@ -116,7 +116,7 @@ void RegisterTextFunctions()
f = new Function ("EXACT", func_exact);
f->setParamCount (2);
repo->add (f);
- f = new Function ("FIND", func_find);
+ f = new Function ("FIND", func_tqfind);
f->setParamCount (2, 3);
repo->add (f);
f = new Function ("FIXED", func_fixed);
@@ -134,7 +134,7 @@ void RegisterTextFunctions()
f = new Function ("REGEXPRE", func_regexpre);
f->setParamCount (3);
repo->add (f);
- f = new Function ("REPLACE", func_replace);
+ f = new Function ("REPLACE", func_tqreplace);
f->setParamCount (4);
repo->add (f);
f = new Function ("REPT", func_rept);
@@ -159,15 +159,15 @@ void RegisterTextFunctions()
Value func_char (valVector args, ValueCalc *calc, FuncExtra *)
{
int val = calc->conv()->asInteger (args[0]).asInteger ();
- return Value (QString (QChar (val)));
+ return Value (TQString (TQChar (val)));
}
// Function: CLEAN
Value func_clean (valVector args, ValueCalc *calc, FuncExtra *)
{
- QString str (calc->conv()->asString (args[0]).asString());
- QString result;
- QChar c;
+ TQString str (calc->conv()->asString (args[0]).asString());
+ TQString result;
+ TQChar c;
int i;
int l = str.length();
@@ -184,11 +184,11 @@ Value func_clean (valVector args, ValueCalc *calc, FuncExtra *)
// Function: CODE
Value func_code (valVector args, ValueCalc *calc, FuncExtra *)
{
- QString str (calc->conv()->asString (args[0]).asString());
+ TQString str (calc->conv()->asString (args[0]).asString());
if (str.length() <= 0)
return Value::errorVALUE();
- return Value (str[0].unicode());
+ return Value (str[0].tqunicode());
}
// Function: COMPARE
@@ -197,8 +197,8 @@ Value func_compare (valVector args, ValueCalc *calc, FuncExtra *)
int result = 0;
bool exact = calc->conv()->asBoolean (args[2]).asBoolean();
- QString s1 = calc->conv()->asString (args[0]).asString();
- QString s2 = calc->conv()->asString (args[1]).asString();
+ TQString s1 = calc->conv()->asString (args[0]).asString();
+ TQString s2 = calc->conv()->asString (args[1]).asString();
if (!exact)
result = s1.lower().localeAwareCompare(s2.lower());
@@ -214,7 +214,7 @@ Value func_compare (valVector args, ValueCalc *calc, FuncExtra *)
}
void func_concatenate_helper (Value val, ValueCalc *calc,
- QString& tmp)
+ TQString& tmp)
{
if (val.isArray()) {
for (unsigned int row = 0; row < val.rows(); ++row)
@@ -227,7 +227,7 @@ void func_concatenate_helper (Value val, ValueCalc *calc,
// Function: CONCATENATE
Value func_concatenate (valVector args, ValueCalc *calc, FuncExtra *)
{
- QString tmp;
+ TQString tmp;
for (unsigned int i = 0; i < args.count(); ++i)
func_concatenate_helper (args[i], calc, tmp);
@@ -253,7 +253,7 @@ Value func_dollar (valVector args, ValueCalc *calc, FuncExtra *)
value = floor (value * pow (10.0, precision) + 0.5) / pow (10.0, precision);
KLocale *locale = calc->conv()->locale();
- QString s = locale->formatMoney (value, locale->currencySymbol(), precision);
+ TQString s = locale->formatMoney (value, locale->currencySymbol(), precision);
return Value (s);
}
@@ -261,16 +261,16 @@ Value func_dollar (valVector args, ValueCalc *calc, FuncExtra *)
// Function: EXACT
Value func_exact (valVector args, ValueCalc *calc, FuncExtra *)
{
- QString s1 = calc->conv()->asString (args[0]).asString();
- QString s2 = calc->conv()->asString (args[1]).asString();
+ TQString s1 = calc->conv()->asString (args[0]).asString();
+ TQString s2 = calc->conv()->asString (args[1]).asString();
bool exact = (s1 == s2);
return Value (exact);
}
// Function: FIND
-Value func_find (valVector args, ValueCalc *calc, FuncExtra *)
+Value func_tqfind (valVector args, ValueCalc *calc, FuncExtra *)
{
- QString find_text, within_text;
+ TQString find_text, within_text;
int start_num = 1;
find_text = calc->conv()->asString (args[0]).asString();
@@ -282,7 +282,7 @@ Value func_find (valVector args, ValueCalc *calc, FuncExtra *)
if (start_num <= 0) return Value::errorVALUE();
if (start_num > (int)within_text.length()) return Value::errorVALUE();
- int pos = within_text.find (find_text, start_num - 1);
+ int pos = within_text.tqfind (find_text, start_num - 1);
if( pos < 0 ) return Value::errorNA();
return Value (pos + 1);
@@ -302,7 +302,7 @@ Value func_fixed (valVector args, ValueCalc *calc, FuncExtra *)
if (args.count() == 3)
no_commas = calc->conv()->asBoolean (args[2]).asBoolean();
- QString result;
+ TQString result;
KLocale *locale = calc->conv()->locale();
// unfortunately, we can't just use KLocale::formatNumber because
@@ -317,11 +317,11 @@ Value func_fixed (valVector args, ValueCalc *calc, FuncExtra *)
}
bool neg = number < 0;
- result = QString::number( neg ? -number:number, 'f', decimals );
+ result = TQString::number( neg ? -number:number, 'f', decimals );
- int pos = result.find('.');
+ int pos = result.tqfind('.');
if (pos == -1) pos = result.length();
- else result.replace(pos, 1, locale->decimalSymbol());
+ else result.tqreplace(pos, 1, locale->decimalSymbol());
if( !no_commas )
while (0 < (pos -= 3))
result.insert(pos, locale->thousandsSeparator());
@@ -335,7 +335,7 @@ Value func_fixed (valVector args, ValueCalc *calc, FuncExtra *)
// Function: LEFT
Value func_left (valVector args, ValueCalc *calc, FuncExtra *)
{
- QString str = calc->conv()->asString (args[0]).asString();
+ TQString str = calc->conv()->asString (args[0]).asString();
int nb = 1;
if (args.count() == 2)
nb = calc->conv()->asInteger (args[1]).asInteger();
@@ -359,7 +359,7 @@ Value func_lower (valVector args, ValueCalc *calc, FuncExtra *)
// Function: MID
Value func_mid (valVector args, ValueCalc *calc, FuncExtra *)
{
- QString str = calc->conv()->asString (args[0]).asString();
+ TQString str = calc->conv()->asString (args[0]).asString();
int pos = calc->conv()->asInteger (args[1]).asInteger();
uint len = 0xffffffff;
if (args.count() == 3)
@@ -374,9 +374,9 @@ Value func_mid (valVector args, ValueCalc *calc, FuncExtra *)
// Function: PROPER
Value func_proper (valVector args, ValueCalc *calc, FuncExtra *)
{
- QString str = calc->conv()->asString (args[0]).asString().lower();
+ TQString str = calc->conv()->asString (args[0]).asString().lower();
- QChar f;
+ TQChar f;
bool first = true;
for (unsigned int i = 0; i < str.length(); ++i)
@@ -406,12 +406,12 @@ Value func_proper (valVector args, ValueCalc *calc, FuncExtra *)
Value func_regexp (valVector args, ValueCalc *calc, FuncExtra *)
{
// ensure that we got a valid regular expression
- QRegExp exp (calc->conv()->asString (args[1]).asString());
+ TQRegExp exp (calc->conv()->asString (args[1]).asString());
if (!exp.isValid ())
return Value::errorVALUE();
- QString s = calc->conv()->asString (args[0]).asString();
- QString defText;
+ TQString s = calc->conv()->asString (args[0]).asString();
+ TQString defText;
if (args.count() > 2)
defText = calc->conv()->asString (args[2]).asString();
int bkref = 0;
@@ -420,7 +420,7 @@ Value func_regexp (valVector args, ValueCalc *calc, FuncExtra *)
if (bkref < 0) // strange back-reference
return Value::errorVALUE();
- QString returnValue;
+ TQString returnValue;
int pos = exp.search (s);
if (pos == -1)
@@ -435,18 +435,18 @@ Value func_regexp (valVector args, ValueCalc *calc, FuncExtra *)
Value func_regexpre (valVector args, ValueCalc *calc, FuncExtra *)
{
// ensure that we got a valid regular expression
- QRegExp exp (calc->conv()->asString (args[1]).asString());
+ TQRegExp exp (calc->conv()->asString (args[1]).asString());
if (!exp.isValid ())
return Value::errorVALUE();
- QString s = calc->conv()->asString (args[0]).asString();
- QString str = calc->conv()->asString (args[2]).asString();
+ TQString s = calc->conv()->asString (args[0]).asString();
+ TQString str = calc->conv()->asString (args[2]).asString();
int pos = 0;
while ((pos = exp.search (s, pos)) != -1)
{
int i = exp.matchedLength();
- s = s.replace (pos, i, str);
+ s = s.tqreplace (pos, i, str);
pos += str.length();
}
@@ -454,26 +454,26 @@ Value func_regexpre (valVector args, ValueCalc *calc, FuncExtra *)
}
// Function: REPLACE
-Value func_replace (valVector args, ValueCalc *calc, FuncExtra *)
+Value func_tqreplace (valVector args, ValueCalc *calc, FuncExtra *)
{
- QString text = calc->conv()->asString (args[0]).asString();
+ TQString text = calc->conv()->asString (args[0]).asString();
int pos = calc->conv()->asInteger (args[1]).asInteger();
int len = calc->conv()->asInteger (args[2]).asInteger();
- QString new_text = calc->conv()->asString (args[3]).asString();
+ TQString new_text = calc->conv()->asString (args[3]).asString();
if (pos < 0) pos = 0;
- QString result = text.replace (pos-1, len, new_text);
+ TQString result = text.tqreplace (pos-1, len, new_text);
return Value (result);
}
// Function: REPT
Value func_rept (valVector args, ValueCalc *calc, FuncExtra *)
{
- QString s = calc->conv()->asString (args[0]).asString();
+ TQString s = calc->conv()->asString (args[0]).asString();
int nb = calc->conv()->asInteger (args[1]).asInteger();
- QString result;
+ TQString result;
for (int i = 0; i < nb; i++) result += s;
return Value (result);
}
@@ -481,7 +481,7 @@ Value func_rept (valVector args, ValueCalc *calc, FuncExtra *)
// Function: RIGHT
Value func_right (valVector args, ValueCalc *calc, FuncExtra *)
{
- QString str = calc->conv()->asString (args[0]).asString();
+ TQString str = calc->conv()->asString (args[0]).asString();
int nb = 1;
if (args.count() == 2)
nb = calc->conv()->asInteger (args[1]).asInteger();
@@ -492,15 +492,15 @@ Value func_right (valVector args, ValueCalc *calc, FuncExtra *)
// Function: ROT
Value func_rot (valVector args, ValueCalc *calc, FuncExtra *)
{
- QString text = calc->conv()->asString (args[0]).asString();
+ TQString text = calc->conv()->asString (args[0]).asString();
for( unsigned i=0; i<text.length(); i++ )
{
- unsigned c = text[i].upper().unicode();
+ unsigned c = text[i].upper().tqunicode();
if( ( c >= 'A' ) && ( c <= 'M' ) )
- text[i] = QChar( text[i].unicode() + 13);
+ text[i] = TQChar( text[i].tqunicode() + 13);
if( ( c >= 'N' ) && ( c <= 'Z' ) )
- text[i] = QChar( text[i].unicode() - 13);
+ text[i] = TQChar( text[i].tqunicode() - 13);
}
return Value (text);
@@ -509,8 +509,8 @@ Value func_rot (valVector args, ValueCalc *calc, FuncExtra *)
// Function: SEARCH
Value func_search (valVector args, ValueCalc *calc, FuncExtra *)
{
- QString find_text = calc->conv()->asString (args[0]).asString();
- QString within_text = calc->conv()->asString (args[1]).asString();
+ TQString find_text = calc->conv()->asString (args[0]).asString();
+ TQString within_text = calc->conv()->asString (args[1]).asString();
int start_num = 1;
if (args.count() == 3)
start_num = calc->conv()->asInteger (args[2]).asInteger();
@@ -519,9 +519,9 @@ Value func_search (valVector args, ValueCalc *calc, FuncExtra *)
if (start_num <= 0) return Value::errorVALUE();
if (start_num > (int)within_text.length()) return Value::errorVALUE();
- // use globbing feature of QRegExp
- QRegExp regex( find_text, false, true );
- int pos = within_text.find( regex, start_num-1 );
+ // use globbing feature of TQRegExp
+ TQRegExp regex( find_text, false, true );
+ int pos = within_text.tqfind( regex, start_num-1 );
if( pos < 0 ) return Value::errorNA();
return Value (pos + 1);
@@ -530,9 +530,9 @@ Value func_search (valVector args, ValueCalc *calc, FuncExtra *)
// Function: SLEEK
Value func_sleek (valVector args, ValueCalc *calc, FuncExtra *)
{
- QString str = calc->conv()->asString (args[0]).asString();
- QString result;
- QChar c;
+ TQString str = calc->conv()->asString (args[0]).asString();
+ TQString result;
+ TQChar c;
int i;
int l = str.length();
@@ -558,21 +558,21 @@ Value func_substitute (valVector args, ValueCalc *calc, FuncExtra *)
all = false;
}
- QString text = calc->conv()->asString (args[0]).asString();
- QString old_text = calc->conv()->asString (args[1]).asString();
- QString new_text = calc->conv()->asString (args[2]).asString();
+ TQString text = calc->conv()->asString (args[0]).asString();
+ TQString old_text = calc->conv()->asString (args[1]).asString();
+ TQString new_text = calc->conv()->asString (args[2]).asString();
if( num <= 0 ) return Value::errorVALUE();
if (old_text.length() == 0) return Value (text);
- QString result = text;
+ TQString result = text;
- int p = result.find (old_text);
+ int p = result.tqfind (old_text);
while ((p != -1) && (num > 0))
{
- result.replace( p, old_text.length(), new_text );
+ result.tqreplace( p, old_text.length(), new_text );
// find another location, starting straight after the replaced text
- p = result.find (old_text, p + new_text.length());
+ p = result.tqfind (old_text, p + new_text.length());
if( !all ) num--;
}
@@ -596,15 +596,15 @@ Value func_text (valVector args, ValueCalc *calc, FuncExtra *)
// Function: TOGGLE
Value func_toggle (valVector args, ValueCalc *calc, FuncExtra *)
{
- QString str = calc->conv()->asString (args[0]).asString();
+ TQString str = calc->conv()->asString (args[0]).asString();
int i;
int l = str.length();
for (i = 0; i < l; ++i)
{
- QChar c = str[i];
- QChar lc = c.lower();
- QChar uc = c.upper();
+ TQChar c = str[i];
+ TQChar lc = c.lower();
+ TQChar uc = c.upper();
if (c == lc) // it is in lowercase
str[i] = c.upper();