summaryrefslogtreecommitdiffstats
path: root/kchart/kdchart/KDChart.cpp
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 /kchart/kdchart/KDChart.cpp
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 'kchart/kdchart/KDChart.cpp')
-rw-r--r--kchart/kdchart/KDChart.cpp154
1 files changed, 77 insertions, 77 deletions
diff --git a/kchart/kdchart/KDChart.cpp b/kchart/kdchart/KDChart.cpp
index 5a4b4719..c7c80250 100644
--- a/kchart/kdchart/KDChart.cpp
+++ b/kchart/kdchart/KDChart.cpp
@@ -39,14 +39,14 @@
#include <KDChartGlobal.h>
#include <KDChartAxisParams.h>
-#include <qglobal.h>
-#include <qpainter.h>
-#include <qpaintdevice.h>
-#include <qpaintdevicemetrics.h>
+#include <tqglobal.h>
+#include <tqpainter.h>
+#include <tqpaintdevice.h>
+#include <tqpaintdevicemetrics.h>
-#ifdef QSA
+#ifdef TQSA
#if 0 // Disabled by ingwa to make it compile
-#include <qsinterpreter.h>
+#include <tqsinterpreter.h>
#include "KDChartWrapperFactory.h"
#include "KDChartObjectFactory.h"
#endif
@@ -56,15 +56,15 @@
\class KDChart KDChart.h
\brief Provides a single entry-point to the charting engine for
- applications that wish to provide their own QPainter.
+ applications that wish to provide their own TQPainter.
- It is not useful to instantiate this class as it contains
+ It is not useful to instantiate this class as it tqcontains
static methods only.
\note If for some reason you are NOT using the
KDChartWidget class but calling the painting methods of KDChart directly,
you probably will also use the KDChartDataRegionList class:
- This class is derived from QPtrList, so all of the Qt documentation
+ This class is derived from TQPtrList, so all of the TQt documentation
for this class is valid for KDChartDataRegionList too, e.g. freeing
of the pointers stored can either be done automatically or
manually - so PLEASE take the time to read the reference information for this class!
@@ -107,9 +107,9 @@ bool hasCartesianAxes( KDChartParams::ChartType chartType )
/**
- Calculates the drawing area from a given QPainter.
+ Calculates the drawing area from a given TQPainter.
- Use this function to get a QRect that you may pass to
+ Use this function to get a TQRect that you may pass to
KDChart::setupGeometry() if you need to know the positions and
sizes of the axis areas and/or the data area *before* drawing
the chart. After calling KDChart::setupGeometry() you may use
@@ -119,16 +119,16 @@ bool hasCartesianAxes( KDChartParams::ChartType chartType )
\return True if the painter was valid and the drawing area
could be calculated successfully, else false.
*/
-bool KDChart::painterToDrawRect( QPainter* painter, QRect& drawRect )
+bool KDChart::painterToDrawRect( TQPainter* painter, TQRect& drawRect )
{
if( painter ){
- QPaintDeviceMetrics painterMetrics( painter->device() );
- drawRect = QRect( 0, 0, painterMetrics.width(), painterMetrics.height() );
+ TQPaintDeviceMetrics painterMetrics( painter->device() );
+ drawRect = TQRect( 0, 0, painterMetrics.width(), painterMetrics.height() );
drawRect.setWidth( drawRect.width() -2 );
drawRect.setHeight( drawRect.height()-2 );
return true;
}else{
- drawRect = QRect( QPoint(0,0), QSize(0,0) );
+ drawRect = TQRect( TQPoint(0,0), TQSize(0,0) );
qDebug("ERROR: KDChartPainter::painterToDrawRect() was called with *no* painter.");
return false;
}
@@ -145,7 +145,7 @@ bool KDChart::painterToDrawRect( QPainter* painter, QRect& drawRect )
KDChartParams::axisArea() and/or KDChartParams::dataArea()
to retrieve the desired information.
- To get the right drawing area from a given QPainter please
+ To get the right drawing area from a given TQPainter please
use the static method KDChart::painterToDrawRect().
\param painter the painter that is eventually to be used for drawing
@@ -153,10 +153,10 @@ bool KDChart::painterToDrawRect( QPainter* painter, QRect& drawRect )
\param data the data that should be displayed as a chart
\param drawRect the position and size of the drawing area to be used
*/
-bool KDChart::setupGeometry( QPainter* painter,
+bool KDChart::setupGeometry( TQPainter* painter,
KDChartParams* params,
KDChartTableDataBase* data,
- const QRect& drawRect )
+ const TQRect& drawRect )
{
//qDebug("INVOKING: KDChart::setupGeometry()");
if( !params ){
@@ -168,11 +168,11 @@ bool KDChart::setupGeometry( QPainter* painter,
return false;
}
// don't crash due to memory problems when running on windows
-#ifdef Q_WS_WIN
- QPixmap::setDefaultOptimization(QPixmap::MemoryOptim);
+#ifdef TQ_WS_WIN
+ TQPixmap::setDefaultOptimization(TQPixmap::MemoryOptim);
#endif
- // Install a cleanup routine that is called when the Qt
+ // Install a cleanup routine that is called when the TQt
// application shuts down and cleans up any potentially still
// existing painters. Only do this once.
static bool bFirstCleanUpInstall = true;
@@ -239,7 +239,7 @@ bool KDChart::setupGeometry( QPainter* painter,
data structure, in case you need to keep track of region information,
that was valid for such previous times.
- \param painter the QPainter onto which the chart should be painted
+ \param painter the TQPainter onto which the chart should be painted
\param params the parameters defining the chart
\param data the data that should be displayed as a chart
\param regions if not null, this points to a
@@ -253,14 +253,14 @@ bool KDChart::setupGeometry( QPainter* painter,
immediately after a previous call of setupGeometry() to save some
time in case you have specified a lot of data cells.
*/
-void KDChart::paint( QPainter* painter,
+void KDChart::paint( TQPainter* painter,
KDChartParams* paraParams,
KDChartTableDataBase* paraData,
KDChartDataRegionList* regions,
- const QRect* rect,
+ const TQRect* rect,
bool mustCalculateGeometry )
{
-//qDebug("KDChart::paint() mustCalculateGeometry: "+QString(mustCalculateGeometry?"TRUE":"FALSE") );
+//qDebug("KDChart::paint() mustCalculateGeometry: "+TQString(mustCalculateGeometry?"TRUE":"FALSE") );
#if defined KDAB_EVAL
EvalDialog::checkEvalLicense( "KD Chart" );
#endif
@@ -291,7 +291,7 @@ void KDChart::paint( QPainter* painter,
data->setCell( 2, 0, 15.0 );
}
- QRect drawRect;
+ TQRect drawRect;
bool bOk = true;
if( mustCalculateGeometry || !cpainter || cpainter->outermostRect().isNull() ){
if( rect )
@@ -302,7 +302,7 @@ void KDChart::paint( QPainter* painter,
}
//qDebug("xxx" );
if( (params || data) && !setupGeometry( painter, params, data, drawRect ) ){
- qDebug("ERROR: KDChart::paint() could not calculate the chart geometry.");
+ qDebug("ERROR: KDChart::paint() could not calculate the chart tqgeometry.");
bOk = false;
}
}else{
@@ -340,7 +340,7 @@ void KDChart::paint( QPainter* painter,
/**
Paints a chart with the specified parameters on the specified
- painter which should use a QPrinter as it's output device.
+ painter which should use a TQPrinter as it's output device.
This method is provided for your convenience, it behaves
like the paint() method described above but additionally
@@ -351,10 +351,10 @@ void KDChart::paint( QPainter* painter,
\sa paint
*/
-void KDChart::print( QPainter* painter, KDChartParams* params,
+void KDChart::print( TQPainter* painter, KDChartParams* params,
KDChartTableDataBase* data,
KDChartDataRegionList* regions,
- const QRect* rect,
+ const TQRect* rect,
bool mustCalculateGeometry )
{
bool oldOpt=true;
@@ -379,23 +379,23 @@ void cleanupPainter()
KDChart::oldParams = 0;
}
-#ifdef QSA
-void KDChart::initInterpreter( QSInterpreter* interpreter )
+#ifdef TQSA
+void KDChart::initInterpreter( TQSInterpreter* interpreter )
{
privateInitInterpreter( interpreter );
interpreter->evaluate( globals() );
}
-void KDChart::initProject( QSProject* project )
+void KDChart::initProject( TQSProject* project )
{
- project->createScript( QString::fromLatin1( "KDCHART_Globals" ), globals() );
+ project->createScript( TQString::tqfromLatin1( "KDCHART_Globals" ), globals() );
privateInitInterpreter( project->interpreter() );
}
-QString KDChart::globals()
+TQString KDChart::globals()
{
- QString globals;
- QMap<char*, double> intMap;
+ TQString globals;
+ TQMap<char*, double> intMap;
intMap.insert( "KDCHART_POS_INFINITE", KDCHART_POS_INFINITE );
intMap.insert( "KDCHART_NEG_INFINITE", KDCHART_NEG_INFINITE );
@@ -429,60 +429,60 @@ QString KDChart::globals()
intMap.insert( "DBL_MIN", DBL_MIN );
intMap.insert( "DBL_MAX", DBL_MAX );
- for( QMapIterator<char*,double> it= intMap.begin(); it != intMap.end(); ++it ) {
+ for( TQMapIterator<char*,double> it= intMap.begin(); it != intMap.end(); ++it ) {
// This is written this way to be efficient
- globals += QString::fromLatin1( "const " );
+ globals += TQString::tqfromLatin1( "const " );
globals += it.key();
globals += " = ";
- globals += QString::number( it.data() );
+ globals += TQString::number( it.data() );
globals += ";\n";
}
- globals += QString::fromLatin1( "const KDCHART_AXIS_LABELS_AUTO_DATETIME_FORMAT=\"%1\";\n" )
- .arg( QString::fromLatin1( KDCHART_AXIS_LABELS_AUTO_DATETIME_FORMAT ) );
- globals += QString::fromLatin1( "const KDCHART_AXIS_LABELS_AUTO_LIMIT = 140319.64;\n" );
- globals += QString::fromLatin1( "const KDCHART_DEFAULT_AXIS_GRID_COLOR = new Color(\"%1\");\n" )
- .arg(KDCHART_DEFAULT_AXIS_GRID_COLOR.name());
- globals += QString::fromLatin1( "const KDCHART_DATA_VALUE_AUTO_COLOR = new Color(\"%1\");\n" )
- .arg( (KDCHART_DATA_VALUE_AUTO_COLOR)->name());
-
-
- QMap<char*,QColor> colorMap;
- colorMap.insert( "Qt.color0", Qt::color0 );
- colorMap.insert( "Qt.color1", Qt::color1 );
- colorMap.insert( "Qt.black", Qt::black );
- colorMap.insert( "Qt.white", Qt::white );
- colorMap.insert( "Qt.darkGray", Qt::darkGray );
- colorMap.insert( "Qt.gray", Qt::gray );
- colorMap.insert( "Qt.lightGray", Qt::lightGray );
- colorMap.insert( "Qt.red", Qt::red );
- colorMap.insert( "Qt.green", Qt::green );
- colorMap.insert( "Qt.blue", Qt::blue );
- colorMap.insert( "Qt.cyan", Qt::cyan );
- colorMap.insert( "Qt.magenta", Qt::magenta );
- colorMap.insert( "Qt.yellow", Qt::yellow );
- colorMap.insert( "Qt.darkRed", Qt::darkRed );
- colorMap.insert( "Qt.darkGreen", Qt::darkGreen );
- colorMap.insert( "Qt.darkBlue", Qt::darkBlue );
- colorMap.insert( "Qt.darkCyan", Qt::darkCyan );
- colorMap.insert( "Qt.darkMagenta", Qt::darkMagenta );
- colorMap.insert( "Qt.darkYellow", Qt::darkYellow );
- for( QMapIterator<char*,QColor> it2= colorMap.begin(); it2 != colorMap.end(); ++it2 ) {
+ globals += TQString::tqfromLatin1( "const KDCHART_AXIS_LABELS_AUTO_DATETIME_FORMAT=\"%1\";\n" )
+ .tqarg( TQString::tqfromLatin1( KDCHART_AXIS_LABELS_AUTO_DATETIME_FORMAT ) );
+ globals += TQString::tqfromLatin1( "const KDCHART_AXIS_LABELS_AUTO_LIMIT = 140319.64;\n" );
+ globals += TQString::tqfromLatin1( "const KDCHART_DEFAULT_AXIS_GRID_COLOR = new Color(\"%1\");\n" )
+ .tqarg(KDCHART_DEFAULT_AXIS_GRID_COLOR.name());
+ globals += TQString::tqfromLatin1( "const KDCHART_DATA_VALUE_AUTO_COLOR = new Color(\"%1\");\n" )
+ .tqarg( (KDCHART_DATA_VALUE_AUTO_COLOR)->name());
+
+
+ TQMap<char*,TQColor> colorMap;
+ colorMap.insert( "TQt.color0", TQt::color0 );
+ colorMap.insert( "TQt.color1", TQt::color1 );
+ colorMap.insert( "TQt.black", TQt::black );
+ colorMap.insert( "TQt.white", TQt::white );
+ colorMap.insert( "TQt.darkGray", TQt::darkGray );
+ colorMap.insert( "TQt.gray", TQt::gray );
+ colorMap.insert( "TQt.lightGray", TQt::lightGray );
+ colorMap.insert( "TQt.red", TQt::red );
+ colorMap.insert( "TQt.green", TQt::green );
+ colorMap.insert( "TQt.blue", TQt::blue );
+ colorMap.insert( "TQt.cyan", TQt::cyan );
+ colorMap.insert( "TQt.magenta", TQt::magenta );
+ colorMap.insert( "TQt.yellow", TQt::yellow );
+ colorMap.insert( "TQt.darkRed", TQt::darkRed );
+ colorMap.insert( "TQt.darkGreen", TQt::darkGreen );
+ colorMap.insert( "TQt.darkBlue", TQt::darkBlue );
+ colorMap.insert( "TQt.darkCyan", TQt::darkCyan );
+ colorMap.insert( "TQt.darkMagenta", TQt::darkMagenta );
+ colorMap.insert( "TQt.darkYellow", TQt::darkYellow );
+ for( TQMapIterator<char*,TQColor> it2= colorMap.begin(); it2 != colorMap.end(); ++it2 ) {
// This is written this way to be efficient
- globals += QString::fromLatin1( it2.key() );
- globals += QString::fromLatin1( " = new Color( " );
- globals += QString::number( it2.data().red() );
+ globals += TQString::tqfromLatin1( it2.key() );
+ globals += TQString::tqfromLatin1( " = new Color( " );
+ globals += TQString::number( it2.data().red() );
globals += ',';
- globals += QString::number( it2.data().green() );
+ globals += TQString::number( it2.data().green() );
globals += ',';
- globals += QString::number( it2.data().blue() );
- globals += QString::fromLatin1( " );\n" );
+ globals += TQString::number( it2.data().blue() );
+ globals += TQString::tqfromLatin1( " );\n" );
}
//qDebug( "%s",globals.latin1() );
return globals;
}
-void KDChart::privateInitInterpreter( QSInterpreter* interpreter )
+void KDChart::privateInitInterpreter( TQSInterpreter* interpreter )
{
interpreter->addWrapperFactory( new KDChartWrapperFactory );
interpreter->addObjectFactory ( new KDChartObjectFactory );