summaryrefslogtreecommitdiffstats
path: root/kspread/kspread_numformat.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_numformat.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_numformat.cc')
-rw-r--r--kspread/kspread_numformat.cc256
1 files changed, 128 insertions, 128 deletions
diff --git a/kspread/kspread_numformat.cc b/kspread/kspread_numformat.cc
index e57d01b9..ed118ec1 100644
--- a/kspread/kspread_numformat.cc
+++ b/kspread/kspread_numformat.cc
@@ -29,9 +29,9 @@ Tomas
#include <ctype.h>
#include <math.h>
-#include <qdatetime.h>
-#include <qmap.h>
-#include <qstring.h>
+#include <tqdatetime.h>
+#include <tqmap.h>
+#include <tqstring.h>
#include <kcalendarsystem.h>
#include <klocale.h>
@@ -43,44 +43,44 @@ namespace NumFormat_Local
{
enum { Unknown, TimeDate, Number, Scientific, Fraction } Type;
- QString g_Monday;
- QString g_Tuesday;
- QString g_Wednesday;
- QString g_Thursday;
- QString g_Friday;
- QString g_Saturday;
- QString g_Sunday;
- QString g_Mon;
- QString g_Tue;
- QString g_Wed;
- QString g_Thu;
- QString g_Fri;
- QString g_Sat;
- QString g_Sun;
- QString g_January;
- QString g_February;
- QString g_March;
- QString g_April;
- QString g_MayL;
- QString g_June;
- QString g_July;
- QString g_August;
- QString g_September;
- QString g_October;
- QString g_November;
- QString g_December;
- QString g_Jan;
- QString g_Feb;
- QString g_Mar;
- QString g_Apr;
- QString g_May;
- QString g_Jun;
- QString g_Jul;
- QString g_Aug;
- QString g_Sep;
- QString g_Oct;
- QString g_Nov;
- QString g_Dec;
+ TQString g_Monday;
+ TQString g_Tuesday;
+ TQString g_Wednesday;
+ TQString g_Thursday;
+ TQString g_Friday;
+ TQString g_Saturday;
+ TQString g_Sunday;
+ TQString g_Mon;
+ TQString g_Tue;
+ TQString g_Wed;
+ TQString g_Thu;
+ TQString g_Fri;
+ TQString g_Sat;
+ TQString g_Sun;
+ TQString g_January;
+ TQString g_February;
+ TQString g_March;
+ TQString g_April;
+ TQString g_MayL;
+ TQString g_June;
+ TQString g_July;
+ TQString g_August;
+ TQString g_September;
+ TQString g_October;
+ TQString g_November;
+ TQString g_December;
+ TQString g_Jan;
+ TQString g_Feb;
+ TQString g_Mar;
+ TQString g_Apr;
+ TQString g_May;
+ TQString g_Jun;
+ TQString g_Jul;
+ TQString g_Aug;
+ TQString g_Sep;
+ TQString g_Oct;
+ TQString g_Nov;
+ TQString g_Dec;
struct DateTime
{
@@ -103,7 +103,7 @@ namespace NumFormat_Local
int leftSpace;
int upReq;
- int reqCounter;
+ int retqCounter;
int reqFirst;
int optFirst;
@@ -113,8 +113,8 @@ namespace NumFormat_Local
bool showMinus;
bool negRed;
bool negBr;
- QString postfix;
- QString prefix;
+ TQString postfix;
+ TQString prefix;
};
class BaseFormat
@@ -122,8 +122,8 @@ namespace NumFormat_Local
public:
int type;
- QString postfix;
- QString prefix;
+ TQString postfix;
+ TQString prefix;
};
class NumberFormat : public BaseFormat
@@ -149,7 +149,7 @@ namespace NumFormat_Local
bool negBr;
int optFirst;
int reqFirst;
- int reqCounter;
+ int retqCounter;
int fraction;
int fractionDigists;
};
@@ -158,7 +158,7 @@ namespace NumFormat_Local
{
public:
bool ampm;
- QString format;
+ TQString format;
};
class ScientificFormat : public BaseFormat
@@ -180,9 +180,9 @@ namespace NumFormat_Local
{
public:
- int getType( QString const & format, BaseFormat * f ) const
+ int getType( TQString const & format, BaseFormat * f ) const
{
- FormatMap::const_iterator iter = m_formats.find( format );
+ FormatMap::const_iterator iter = m_formats.tqfind( format );
if ( iter == m_formats.end() )
{
f = 0;
@@ -193,35 +193,35 @@ namespace NumFormat_Local
return f->type;
}
- void addFraction( QString const & format, FractionFormat * f )
+ void addFraction( TQString const & format, FractionFormat * f )
{
m_formats.insert( format, f );
}
- void addNumber( QString const & format, NumberFormat * n )
+ void addNumber( TQString const & format, NumberFormat * n )
{
m_formats.insert( format, n );
}
- void addDateTime( QString const & format, DateTimeFormat * d )
+ void addDateTime( TQString const & format, DateTimeFormat * d )
{
m_formats.insert( format, d );
}
- void addScientific( QString const & format, ScientificFormat * d )
+ void addScientific( TQString const & format, ScientificFormat * d )
{
m_formats.insert( format, d );
}
private:
- class FormatMap : public QMap<QString, BaseFormat *> {};
+ class FormatMap : public TQMap<TQString, BaseFormat *> {};
FormatMap m_formats;
};
- QChar g_dcSymbol;
- QChar g_thSymbol;
- QChar g_posSymbol;
- QChar g_negSymbol;
+ TQChar g_dcSymbol;
+ TQChar g_thSymbol;
+ TQChar g_posSymbol;
+ TQChar g_negSymbol;
DateTime g_dateTime;
ConvertionInfo g_convertionInfo;
bool g_init = false;
@@ -239,7 +239,7 @@ void resetGlobals()
g_convertionInfo.showMinus = true;
g_convertionInfo.negRed = false;
g_convertionInfo.negBr = false;
- g_convertionInfo.reqCounter = 0;
+ g_convertionInfo.retqCounter = 0;
g_convertionInfo.reqFirst = 0;
g_convertionInfo.prefix = "";
g_convertionInfo.postfix = "";
@@ -304,9 +304,9 @@ void initGlobals( KLocale const * const locale )
void convertDateTime( Value const & value )
{
- QDateTime dt( value.asDateTime() );
- QDate d( dt.date() );
- QTime t( dt.time() );
+ TQDateTime dt( value.asDateTime() );
+ TQDate d( dt.date() );
+ TQTime t( dt.time() );
g_dateTime.year = d.year();
g_dateTime.month = d.month();
@@ -318,7 +318,7 @@ void convertDateTime( Value const & value )
g_convertionInfo.dt = &g_dateTime;
}
-void parseNegativePart( QString & format, int i,
+void parseNegativePart( TQString & format, int i,
int l, bool acceptDigits )
{
g_convertionInfo.showMinus = false;
@@ -328,7 +328,7 @@ void parseNegativePart( QString & format, int i,
while ( i < l && !end)
{
- QChar c( format[i] );
+ TQChar c( format[i] );
switch( c )
{
case '-':
@@ -338,7 +338,7 @@ void parseNegativePart( QString & format, int i,
g_convertionInfo.negBr = true;
break;
case '[':
- if ( format.find( "[red]", i, false ) == i )
+ if ( format.tqfind( "[red]", i, false ) == i )
{
g_convertionInfo.negRed = true;
i += 5;
@@ -370,16 +370,16 @@ void parseNegativePart( QString & format, int i,
}
}
- int p = g_convertionInfo.postfix.find( '"' );
+ int p = g_convertionInfo.postfix.tqfind( '"' );
while ( p != -1 )
{
g_convertionInfo.postfix.remove( p, 1 );
- p = g_convertionInfo.postfix.find( '"', p );
+ p = g_convertionInfo.postfix.tqfind( '"', p );
}
}
-void createNumberStruct( BaseFormat * data, QString const & format, bool insert )
+void createNumberStruct( BaseFormat * data, TQString const & format, bool insert )
{
NumberFormat * d = new NumberFormat();
d->type = Number;
@@ -400,8 +400,8 @@ void createNumberStruct( BaseFormat * data, QString const & format, bool insert
data = d;
}
-void createDateTimeStruct( BaseFormat * data, QString const & format,
- QString const & optFormat, bool insert )
+void createDateTimeStruct( BaseFormat * data, TQString const & format,
+ TQString const & optFormat, bool insert )
{
DateTimeFormat * d = new DateTimeFormat();
d->type = TimeDate;
@@ -415,7 +415,7 @@ void createDateTimeStruct( BaseFormat * data, QString const & format,
data = d;
}
-void createScientificStruct( BaseFormat * data, QString const & format, bool insert )
+void createScientificStruct( BaseFormat * data, TQString const & format, bool insert )
{
ScientificFormat * d = new ScientificFormat();
d->type = Scientific;
@@ -438,7 +438,7 @@ void createScientificStruct( BaseFormat * data, QString const & format, bool ins
}
-int doPreScan( QString & format, QString const & formatBack, KLocale const * const /* locale */,
+int doPreScan( TQString & format, TQString const & formatBack, KLocale const * const /* locale */,
bool insert, BaseFormat * data )
{
int type = g_formatStore.getType( format, data );
@@ -463,18 +463,18 @@ int doPreScan( QString & format, QString const & formatBack, KLocale const * con
int len = 0;
int n = 0;
bool ok = false;
- QString frac;
+ TQString frac;
while ( i < l )
{
- QString s;
+ TQString s;
if ( endFixed )
{
g_convertionInfo.postfix += format.mid( i );
format.remove( i, l - i );
break;
}
- QChar ch( format[i] );
+ TQChar ch( format[i] );
switch( ch )
{
case '[':
@@ -527,7 +527,7 @@ int doPreScan( QString & format, QString const & formatBack, KLocale const * con
{
type = TimeDate;
++i;
- QChar c( format[i] );
+ TQChar c( format[i] );
++i;
while ( i < l && format[i] != ']' )
{
@@ -575,7 +575,7 @@ int doPreScan( QString & format, QString const & formatBack, KLocale const * con
case '0':
if ( spaceInNum > 0 )
{ // for fractions
- ++g_convertionInfo.reqCounter;
+ ++g_convertionInfo.retqCounter;
break;
}
type = Number;
@@ -640,7 +640,7 @@ int doPreScan( QString & format, QString const & formatBack, KLocale const * con
df->negRed = g_convertionInfo.negRed;
df->negBr = g_convertionInfo.negBr;
df->fractionDigists = d;
- df->reqCounter = g_convertionInfo.reqCounter;
+ df->retqCounter = g_convertionInfo.retqCounter;
df->reqFirst = g_convertionInfo.reqFirst;
df->prefix = g_convertionInfo.prefix;
df->postfix = g_convertionInfo.postfix;
@@ -919,8 +919,8 @@ int doPreScan( QString & format, QString const & formatBack, KLocale const * con
return type;
}
-void createNumber( QString & result, Value const & value,
- QString const & /*format*/, bool & setRed,
+void createNumber( TQString & result, Value const & value,
+ TQString const & /*format*/, bool & setRed,
NumberFormat const * const data )
{
int prec = data->rightReq + data->rightOpt;
@@ -933,12 +933,12 @@ void createNumber( QString & result, Value const & value,
bool negative = ( num < 0 ? true : false );
double nnum = ( negative ? -num : num );
- result = QString::number( nnum, 'f', prec );
+ result = TQString::number( nnum, 'f', prec );
- int pos = result.find( '.' );
+ int pos = result.tqfind( '.' );
if ( pos >= 0 )
{
- result = result.replace( pos, 1, g_dcSymbol );
+ result = result.tqreplace( pos, 1, g_dcSymbol );
// remove '0' from the end if not required
if ( data->rightOpt > 0 )
@@ -1006,8 +1006,8 @@ void createNumber( QString & result, Value const & value,
result.append( data->postfix );
}
-void createFraction( QString & result, Value const & value,
- QString const & /*format*/, bool & setRed,
+void createFraction( TQString & result, Value const & value,
+ TQString const & /*format*/, bool & setRed,
FractionFormat const * const data )
{
double num = value.asFloat();
@@ -1088,21 +1088,21 @@ void createFraction( QString & result, Value const & value,
if ( data->optFirst == 0 && data->reqFirst == 0 && fnum > 0 )
index += (int) (fnum * fraction);
- QString frac;
- QString left;
+ TQString frac;
+ TQString left;
if ( index > 0 )
{
- QString numerator;
- QString denominator;
+ TQString numerator;
+ TQString denominator;
- numerator = QString::number( index );
- int n = numerator.length() - data->reqCounter;
+ numerator = TQString::number( index );
+ int n = numerator.length() - data->retqCounter;
for ( int i = 0; i < n; ++i )
{
numerator.prepend( '0' );
}
- denominator = QString::number( fraction );
+ denominator = TQString::number( fraction );
frac = numerator + '/' + denominator;
}
@@ -1115,7 +1115,7 @@ void createFraction( QString & result, Value const & value,
}
else if ( fnum > 0 )
{
- left = QString::number( fnum );
+ left = TQString::number( fnum );
int n = data->reqFirst - left.length();
if ( n > 0 )
{
@@ -1157,8 +1157,8 @@ void createFraction( QString & result, Value const & value,
result = left;
}
-void createScientific( QString & result, Value const & value,
- QString const & /*format*/, bool & setRed,
+void createScientific( TQString & result, Value const & value,
+ TQString const & /*format*/, bool & setRed,
ScientificFormat const * const data )
{
double num = value.asFloat();
@@ -1166,15 +1166,15 @@ void createScientific( QString & result, Value const & value,
bool negative = ( num < 0 ? true : false );
double nnum = ( negative ? -num : num );
- result = QString::number( nnum, 'E', data->rightReq + data->rightOpt );
+ result = TQString::number( nnum, 'E', data->rightReq + data->rightOpt );
- int pos = result.find( '.' );
+ int pos = result.tqfind( '.' );
if ( pos >= 0 )
{
- result = result.replace( pos, 1, g_dcSymbol );
+ result = result.tqreplace( pos, 1, g_dcSymbol );
if ( data->rightOpt > 0 )
{
- int i = result.find( 'E', pos, false ) - 1;
+ int i = result.tqfind( 'E', pos, false ) - 1;
int n = result.length() - data->rightOpt;
if ( i > 0 )
@@ -1227,7 +1227,7 @@ void createScientific( QString & result, Value const & value,
result.append( data->postfix );
}
-void appendAMPM( QString & result, Value const & value )
+void appendAMPM( TQString & result, Value const & value )
{
if ( !g_convertionInfo.dt )
convertDateTime( value );
@@ -1239,7 +1239,7 @@ void appendAMPM( QString & result, Value const & value )
result.append( i18n("AM") );
}
-void appendHour( QString & result, Value const & value,
+void appendHour( TQString & result, Value const & value,
int digits, bool elapsed, bool ampm )
{
if ( !g_convertionInfo.dt )
@@ -1248,8 +1248,8 @@ void appendHour( QString & result, Value const & value,
int hour = g_convertionInfo.dt->hour;
if ( elapsed )
{
- QDate d1( g_convertionInfo.dt->year, g_convertionInfo.dt->month, g_convertionInfo.dt->day );
- QDate d2( 1900, 1, 1 );
+ TQDate d1( g_convertionInfo.dt->year, g_convertionInfo.dt->month, g_convertionInfo.dt->day );
+ TQDate d2( 1900, 1, 1 );
hour += ( d2.daysTo( d1 ) * 24 );
}
if ( hour < 10 && digits == 2 )
@@ -1262,10 +1262,10 @@ void appendHour( QString & result, Value const & value,
result += '0';
}
- result += QString::number( hour );
+ result += TQString::number( hour );
}
-void appendMinutes( QString & result, Value const & value,
+void appendMinutes( TQString & result, Value const & value,
int digits, bool elapsed )
{
if ( !g_convertionInfo.dt )
@@ -1274,17 +1274,17 @@ void appendMinutes( QString & result, Value const & value,
int minute = g_convertionInfo.dt->minute;
if ( elapsed )
{
- QDate d1( g_convertionInfo.dt->year, g_convertionInfo.dt->month, g_convertionInfo.dt->day );
- QDate d2( 1900, 1, 1 );
+ TQDate d1( g_convertionInfo.dt->year, g_convertionInfo.dt->month, g_convertionInfo.dt->day );
+ TQDate d2( 1900, 1, 1 );
minute += ( d2.daysTo( d1 ) * 24 * 60 );
}
if ( minute < 10 && digits == 2 )
result += '0';
- result += QString::number( minute );
+ result += TQString::number( minute );
}
-void appendSecond( QString & result, Value const & value,
+void appendSecond( TQString & result, Value const & value,
int digits, bool elapsed )
{
if ( !g_convertionInfo.dt )
@@ -1293,17 +1293,17 @@ void appendSecond( QString & result, Value const & value,
int second = g_convertionInfo.dt->second;
if ( elapsed )
{
- QDate d1( g_convertionInfo.dt->year, g_convertionInfo.dt->month, g_convertionInfo.dt->day );
- QDate d2( 1900, 1, 1 );
+ TQDate d1( g_convertionInfo.dt->year, g_convertionInfo.dt->month, g_convertionInfo.dt->day );
+ TQDate d2( 1900, 1, 1 );
second += ( d2.daysTo( d1 ) * 24 * 60 * 60 );
}
if ( second < 10 && digits == 2 )
result += '0';
- result += QString::number( second );
+ result += TQString::number( second );
}
-void appendYear( QString & result, Value const & value,
+void appendYear( TQString & result, Value const & value,
int digits )
{
if ( !g_convertionInfo.dt )
@@ -1311,12 +1311,12 @@ void appendYear( QString & result, Value const & value,
int year = g_convertionInfo.dt->year;
if ( digits <= 2 )
- result += QString::number( year ).right( 2 );
+ result += TQString::number( year ).right( 2 );
else
- result += QString::number( year );
+ result += TQString::number( year );
}
-void appendMonth( QString & result, Value const & value,
+void appendMonth( TQString & result, Value const & value,
int digits )
{
if ( !g_convertionInfo.dt )
@@ -1324,14 +1324,14 @@ void appendMonth( QString & result, Value const & value,
int month = g_convertionInfo.dt->month;
if ( digits == 1 )
- result += QString::number( month );
+ result += TQString::number( month );
else
if ( digits == 2 )
{
if ( month < 10 )
result += '0';
- result += QString::number( month );
+ result += TQString::number( month );
}
else
{
@@ -1388,7 +1388,7 @@ void appendMonth( QString & result, Value const & value,
}
}
-void appendDays( QString & result, Value const & value,
+void appendDays( TQString & result, Value const & value,
int digits )
{
if ( !g_convertionInfo.dt )
@@ -1396,18 +1396,18 @@ void appendDays( QString & result, Value const & value,
int day = g_convertionInfo.dt->day;
if ( digits == 1 )
- result += QString::number( day );
+ result += TQString::number( day );
else
if ( digits == 2 )
{
if ( day < 10 )
result += '0';
- result += QString::number( day );
+ result += TQString::number( day );
}
else
{
- QDate date( g_convertionInfo.dt->year, g_convertionInfo.dt->month, g_convertionInfo.dt->day );
+ TQDate date( g_convertionInfo.dt->year, g_convertionInfo.dt->month, g_convertionInfo.dt->day );
int weekDay = date.dayOfWeek();
switch ( weekDay )
{
@@ -1442,8 +1442,8 @@ void appendDays( QString & result, Value const & value,
}
}
-void createDateTime( QString & result, Value const & value,
- QString const & /*format*/,
+void createDateTime( TQString & result, Value const & value,
+ TQString const & /*format*/,
DateTimeFormat const * const data )
{
result = data->prefix;
@@ -1570,15 +1570,15 @@ void createDateTime( QString & result, Value const & value,
result += data->postfix;
}
-QString formatNumber( Value const & value, QString format, bool & setRed,
+TQString formatNumber( Value const & value, TQString format, bool & setRed,
KLocale const * const locale, bool insert )
{
// need delocalized strings: dcSymbol: '.', thSymbol = ','
if ( !g_init )
initGlobals( locale );
- QString backup( format );
- QString result;
+ TQString backup( format );
+ TQString result;
BaseFormat * data = 0;
setRed = false;