summaryrefslogtreecommitdiffstats
path: root/lib/kwmf/kwmf.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 /lib/kwmf/kwmf.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 'lib/kwmf/kwmf.cc')
-rw-r--r--lib/kwmf/kwmf.cc176
1 files changed, 88 insertions, 88 deletions
diff --git a/lib/kwmf/kwmf.cc b/lib/kwmf/kwmf.cc
index 989b3e29..0a0d2c12 100644
--- a/lib/kwmf/kwmf.cc
+++ b/lib/kwmf/kwmf.cc
@@ -26,10 +26,10 @@ DESCRIPTION
#include <kdebug.h>
#include <math.h>
-#include <qfile.h>
-#include <qpointarray.h>
+#include <tqfile.h>
+#include <tqpointarray.h>
#include <kwmf.h>
-#include <qrect.h>
+#include <tqrect.h>
#define PI (3.14159265358979323846)
@@ -73,13 +73,13 @@ unsigned KWmf::getColour(
}
void KWmf::genericArc(
- QString type,
- QDataStream &operands)
+ TQString type,
+ TQDataStream &operands)
{
- QPoint topLeft;
- QPoint bottomRight;
- QPoint start;
- QPoint end;
+ TQPoint topLeft;
+ TQPoint bottomRight;
+ TQPoint start;
+ TQPoint end;
topLeft = normalisePoint(operands);
bottomRight = normalisePoint(operands);
@@ -90,8 +90,8 @@ void KWmf::genericArc(
// From each point draw a line to the center of the ellipse: the intercepts define
// the ends of the arc.
- QRect ellipse(topLeft, bottomRight);
- QPoint centre = ellipse.center();
+ TQRect ellipse(topLeft, bottomRight);
+ TQPoint centre = ellipse.center();
double startAngle = atan2((double)(centre.y() - start.y()), (double)(centre.x() - start.x()));
double stopAngle = atan2((double)(centre.y() - end.y()), (double)(centre.x() - end.x()));
@@ -155,9 +155,9 @@ void KWmf::handleDelete(int idx)
void KWmf::invokeHandler(
S16 opcode,
U32 words,
- QDataStream &operands)
+ TQDataStream &operands)
{
- typedef void (KWmf::*method)(U32 words, QDataStream &operands);
+ typedef void (KWmf::*method)(U32 words, TQDataStream &operands);
typedef struct
{
@@ -262,7 +262,7 @@ void KWmf::invokeHandler(
" operands: " << words << endl;
else
kdError(s_area) << "invokeHandler: unsupported opcode: 0x" <<
- QString::number(opcode, 16) <<
+ TQString::number(opcode, 16) <<
" operands: " << words << endl;
// Skip data we cannot use.
@@ -287,19 +287,19 @@ void KWmf::invokeHandler(
if (words)
{
- QByteArray *record = new QByteArray(words * 2);
- QDataStream *body;
+ TQByteArray *record = new TQByteArray(words * 2);
+ TQDataStream *body;
operands.readRawBytes(record->data(), words * 2);
- body = new QDataStream(*record, IO_ReadOnly);
- body->setByteOrder(QDataStream::LittleEndian);
+ body = new TQDataStream(*record, IO_ReadOnly);
+ body->setByteOrder(TQDataStream::LittleEndian);
(this->*result)(words, *body);
delete body;
delete record;
}
else
{
- QDataStream *body = new QDataStream();
+ TQDataStream *body = new TQDataStream();
(this->*result)(words, *body);
delete body;
@@ -307,52 +307,52 @@ void KWmf::invokeHandler(
}
}
-QPoint KWmf::normalisePoint(
- QDataStream &operands)
+TQPoint KWmf::normalisePoint(
+ TQDataStream &operands)
{
S16 x;
S16 y;
operands >> x >> y;
- return QPoint((x - m_windowOrgX) * m_windowFlipX / m_dpi, (y - m_windowOrgY) * m_windowFlipY / m_dpi);
+ return TQPoint((x - m_windowOrgX) * m_windowFlipX / m_dpi, (y - m_windowOrgY) * m_windowFlipY / m_dpi);
}
-QSize KWmf::normaliseSize(
- QDataStream &operands)
+TQSize KWmf::normaliseSize(
+ TQDataStream &operands)
{
S16 width;
S16 height;
operands >> width >> height;
- return QSize(width / m_dpi, height / m_dpi);
+ return TQSize(width / m_dpi, height / m_dpi);
}
bool KWmf::parse(
- const QString &file)
+ const TQString &file)
{
- QFile in(file);
+ TQFile in(file);
if (!in.open(IO_ReadOnly))
{
kdError(s_area) << "Unable to open input file!" << endl;
in.close();
return false;
}
- QDataStream stream(&in);
+ TQDataStream stream(&in);
bool result = parse(stream, in.size());
in.close();
return result;
}
bool KWmf::parse(
- QDataStream &stream,
+ TQDataStream &stream,
unsigned size)
{
int startedAt;
bool isPlaceable;
bool isEnhanced;
- startedAt = stream.device()->at();
- stream.setByteOrder(QDataStream::LittleEndian); // Great, I love Qt !
+ startedAt = stream.tqdevice()->at();
+ stream.setByteOrder(TQDataStream::LittleEndian); // Great, I love TQt !
for (int i = 0; i < s_maxHandles; i++)
m_objectHandles[i] = NULL;
@@ -400,7 +400,7 @@ bool KWmf::parse(
S16 nHandles; // Number of handles in the handle table
// Handle index zero is reserved.
S16 sReserved; // Reserved. Must be zero.
- S32 nDescription; // Number of chars in the unicode description string
+ S32 nDescription; // Number of chars in the tqunicode description string
// This is 0 if there is no description string
S32 offDescription; // Offset to the metafile description record.
// This is 0 if there is no description string
@@ -477,7 +477,7 @@ bool KWmf::parse(
}
else
{
- stream.device()->at(startedAt);
+ stream.tqdevice()->at(startedAt);
m_dpi = (unsigned)((double)576 / m_dpi);
m_windowOrgX = 0;
m_windowOrgY = 0;
@@ -487,7 +487,7 @@ bool KWmf::parse(
//----- Read as enhanced metafile header
- fileAt = stream.device()->at();
+ fileAt = stream.tqdevice()->at();
stream >> eheader.iType;
stream >> eheader.nSize;
stream >> eheader.rclBounds.left;
@@ -539,7 +539,7 @@ bool KWmf::parse(
{
// debug("WMF Header");
//----- Read as standard metafile header
- stream.device()->at(fileAt);
+ stream.tqdevice()->at(fileAt);
stream >> header.mtType;
stream >> header.mtHeaderSize;
stream >> header.mtVersion;
@@ -558,42 +558,42 @@ bool KWmf::parse(
*/
}
- walk((size - (stream.device()->at() - startedAt)) / 2, stream);
+ walk((size - (stream.tqdevice()->at() - startedAt)) / 2, stream);
return true;
}
void KWmf::opArc(
U32 /*words*/,
- QDataStream &operands)
+ TQDataStream &operands)
{
genericArc("arc", operands);
}
void KWmf::opBrushCreateIndirect(
U32 /*words*/,
- QDataStream &operands)
+ TQDataStream &operands)
{
- static Qt::BrushStyle hatchedStyleTab[] =
+ static TQt::BrushStyle hatchedStyleTab[] =
{
- Qt::HorPattern,
- Qt::FDiagPattern,
- Qt::BDiagPattern,
- Qt::CrossPattern,
- Qt::DiagCrossPattern
+ TQt::HorPattern,
+ TQt::FDiagPattern,
+ TQt::BDiagPattern,
+ TQt::CrossPattern,
+ TQt::DiagCrossPattern
};
- static Qt::BrushStyle styleTab[] =
- {
- Qt::SolidPattern,
- Qt::NoBrush,
- Qt::FDiagPattern, // hatched
- Qt::Dense4Pattern, // should be custom bitmap pattern
- Qt::HorPattern, // should be BS_INDEXED (?)
- Qt::VerPattern, // should be device-independent bitmap
- Qt::Dense6Pattern, // should be device-independent packed-bitmap
- Qt::Dense2Pattern, // should be BS_PATTERN8x8
- Qt::Dense3Pattern // should be device-independent BS_DIBPATTERN8x8
+ static TQt::BrushStyle styleTab[] =
+ {
+ TQt::SolidPattern,
+ TQt::NoBrush,
+ TQt::FDiagPattern, // hatched
+ TQt::Dense4Pattern, // should be custom bitmap pattern
+ TQt::HorPattern, // should be BS_INDEXED (?)
+ TQt::VerPattern, // should be device-independent bitmap
+ TQt::Dense6Pattern, // should be device-independent packed-bitmap
+ TQt::Dense2Pattern, // should be BS_PATTERN8x8
+ TQt::Dense3Pattern // should be device-independent BS_DIBPATTERN8x8
};
- Qt::BrushStyle style;
+ TQt::BrushStyle style;
WinObjBrushHandle *handle = handleCreateBrush();
S16 arg;
S32 colour;
@@ -611,7 +611,7 @@ void KWmf::opBrushCreateIndirect(
else
{
kdError(s_area) << "createBrushIndirect: invalid hatched brush " << arg << endl;
- style = Qt::SolidPattern;
+ style = TQt::SolidPattern;
}
}
else
@@ -623,7 +623,7 @@ void KWmf::opBrushCreateIndirect(
else
{
kdError(s_area) << "createBrushIndirect: invalid brush " << arg << endl;
- style = Qt::SolidPattern;
+ style = TQt::SolidPattern;
operands >> discard;
}
handle->m_style = style;
@@ -631,27 +631,27 @@ void KWmf::opBrushCreateIndirect(
void KWmf::opEllipse(
U32 /*words*/,
- QDataStream &operands)
+ TQDataStream &operands)
{
- QPoint topLeft;
- QPoint bottomRight;
+ TQPoint topLeft;
+ TQPoint bottomRight;
topLeft = normalisePoint(operands);
bottomRight = normalisePoint(operands);
- QRect ellipse(topLeft, bottomRight);
+ TQRect ellipse(topLeft, bottomRight);
gotEllipse(m_dc, "full", ellipse.center(), ellipse.size() / 2, 0, 0);
}
void KWmf::opLineTo(
U32 /*words*/,
- QDataStream &operands)
+ TQDataStream &operands)
{
- QPoint lineTo;
+ TQPoint lineTo;
lineTo = normalisePoint(operands);
- QPointArray points(2);
+ TQPointArray points(2);
points.setPoint(0, m_lineFrom);
points.setPoint(1, lineTo);
gotPolyline(m_dc, points);
@@ -663,14 +663,14 @@ void KWmf::opLineTo(
void KWmf::opMoveTo(
U32 /*words*/,
- QDataStream &operands)
+ TQDataStream &operands)
{
m_lineFrom = normalisePoint(operands);
}
void KWmf::opNoop(
U32 words,
- QDataStream &operands)
+ TQDataStream &operands)
{
skip(words, operands);
}
@@ -678,7 +678,7 @@ void KWmf::opNoop(
//-----------------------------------------------------------------------------
void KWmf::opObjectDelete(
U32 /*words*/,
- QDataStream &operands)
+ TQDataStream &operands)
{
S16 idx;
@@ -689,7 +689,7 @@ void KWmf::opObjectDelete(
//-----------------------------------------------------------------------------
void KWmf::opObjectSelect(
U32 /*words*/,
- QDataStream &operands)
+ TQDataStream &operands)
{
S16 idx;
@@ -704,7 +704,7 @@ void KWmf::opObjectSelect(
void KWmf::opPenCreateIndirect(
U32 /*words*/,
- QDataStream &operands)
+ TQDataStream &operands)
{
static Qt::PenStyle styleTab[] =
{
@@ -730,7 +730,7 @@ void KWmf::opPenCreateIndirect(
else
{
kdError(s_area) << "createPenIndirect: invalid pen " << arg << endl;
- handle->m_style = Qt::SolidLine;
+ handle->m_style = TQt::SolidLine;
}
operands >> arg;
handle->m_width = arg;
@@ -740,14 +740,14 @@ void KWmf::opPenCreateIndirect(
void KWmf::opPie(
U32 /*words*/,
- QDataStream &operands)
+ TQDataStream &operands)
{
genericArc("pie", operands);
}
void KWmf::opPolygonSetFillMode(
U32 /*words*/,
- QDataStream &operands)
+ TQDataStream &operands)
{
S16 tmp;
@@ -757,12 +757,12 @@ void KWmf::opPolygonSetFillMode(
void KWmf::opPolygon(
U32 /*words*/,
- QDataStream &operands)
+ TQDataStream &operands)
{
S16 tmp;
operands >> tmp;
- QPointArray points(tmp);
+ TQPointArray points(tmp);
for (int i = 0; i < tmp; i++)
{
@@ -773,12 +773,12 @@ void KWmf::opPolygon(
void KWmf::opPolyline(
U32 /*words*/,
- QDataStream &operands)
+ TQDataStream &operands)
{
S16 tmp;
operands >> tmp;
- QPointArray points(tmp);
+ TQPointArray points(tmp);
for (int i = 0; i < tmp; i++)
{
@@ -789,15 +789,15 @@ void KWmf::opPolyline(
void KWmf::opRectangle(
U32 /*words*/,
- QDataStream &operands)
+ TQDataStream &operands)
{
- QPoint topLeft;
- QSize size;
+ TQPoint topLeft;
+ TQSize size;
topLeft = normalisePoint(operands);
size = normaliseSize(operands);
- QRect rect(topLeft, size);
- QPointArray points(4);
+ TQRect rect(topLeft, size);
+ TQPointArray points(4);
points.setPoint(0, topLeft);
points.setPoint(1, rect.topRight());
@@ -808,7 +808,7 @@ void KWmf::opRectangle(
void KWmf::opRestoreDc(
U32 /*words*/,
- QDataStream &operands)
+ TQDataStream &operands)
{
S16 pop;
S16 i;
@@ -822,7 +822,7 @@ void KWmf::opRestoreDc(
void KWmf::opSaveDc(
U32 /*words*/,
- QDataStream &/*operands*/)
+ TQDataStream &/*operands*/)
{
m_savedDcs.push(m_dc);
@@ -831,7 +831,7 @@ void KWmf::opSaveDc(
void KWmf::opWindowSetOrg(
U32 /*words*/,
- QDataStream &operands)
+ TQDataStream &operands)
{
S16 top;
S16 left;
@@ -843,7 +843,7 @@ void KWmf::opWindowSetOrg(
void KWmf::opWindowSetExt(
U32 /*words*/,
- QDataStream &operands)
+ TQDataStream &operands)
{
S16 height;
S16 width;
@@ -871,7 +871,7 @@ void KWmf::penSet(
void KWmf::skip(
U32 words,
- QDataStream &operands)
+ TQDataStream &operands)
{
if ((int)words < 0)
{
@@ -893,7 +893,7 @@ void KWmf::skip(
void KWmf::walk(
U32 words,
- QDataStream &operands)
+ TQDataStream &operands)
{
// Read bits:
//