Commit 0808562a authored by Inge Wallin's avatar Inge Wallin
Browse files

SVM: Implement more of the TEXTARRAY action.

This fixes Bug 275518: SVM: Rendering of text in the embedded ppt in
           the attached ODT file is not proper (libsvm in vectorshape
           renders title 2 times)

BUG: 275518
parent 76288fd0
......@@ -645,10 +645,10 @@ It contains the following parts
Point startPoint
String string
uint16 index
uint16 startIndex
uint16 len
uint32 dxArrayLen
int32 dxArray[arrayLen] // If arrayLen > 0
int32 dxArray[]
If version is greater than 1:
uint16 len2
unicodechar chars[len2]
......@@ -658,15 +658,17 @@ startPoint The point where the string is drawn
string the text string
index ?
startIndex The index of the first character of the string that
should be drawn.
len ?
len The number of characters that should be drawn,
starting with the character at 'startIndex'.
dxArrayLen The number of character offsets in dxArray
dxArray An array of character offsets for the characters in
the string. The number of offsets is stored in
dxArrayLen.
dxArrayLen. FIXME: What unit is this in?
2.3.4 Unsorted Action Types
......
......@@ -92,7 +92,9 @@ public:
virtual void polygon(SvmGraphicsContext &context, const QPolygon &polygon) = 0;
virtual void textArray(SvmGraphicsContext &context,
const QPoint &point, const QString &string) = 0;
const QPoint &point, const QString &string,
quint16 startIndex, quint16 len,
quint32 dxArrayLen, qint32 *dxArray) = 0;
};
......
......@@ -35,7 +35,7 @@
#include "SvmGraphicsContext.h"
#define DEBUG_SVMPAINT 0
#define DEBUG_SVMPAINT 1
/**
......@@ -126,13 +126,21 @@ void SvmPainterBackend::polygon( SvmGraphicsContext &context, const QPolygon &po
}
void SvmPainterBackend::textArray(SvmGraphicsContext &context,
const QPoint &point, const QString &string)
const QPoint &point, const QString &string,
quint16 startIndex, quint16 len,
quint32 dxArrayLen, qint32 *dxArray)
{
updateFromGraphicscontext(context);
m_painter->save();
m_painter->setPen(context.textColor);
m_painter->drawText(point, string);
// FIXME: Handle text background color. How do we get the area? A testfile would be nice.
m_painter->drawText(point, string.mid(startIndex, len));
// FIXME: DxArray not handled yet.
Q_UNUSED(dxArrayLen);
Q_UNUSED(dxArray);
m_painter->restore();
}
......
......@@ -94,7 +94,9 @@ public:
virtual void polygon( SvmGraphicsContext &context, const QPolygon &polygon );
virtual void textArray(SvmGraphicsContext &context,
const QPoint &point, const QString &string);
const QPoint &point, const QString &string,
quint16 startIndex, quint16 len,
quint32 dxArrayLen, qint32 *dxArray);
private:
void updateFromGraphicscontext(SvmGraphicsContext &context);
......
......@@ -300,14 +300,46 @@ bool SvmParser::parse(const QByteArray &data)
{
QPoint startPoint;
QString string;
quint16 startIndex;
quint16 len;
quint32 dxArrayLen;
qint32 *dxArray;
stream >> startPoint;
parseString(stream, string);
stream >> startIndex;
stream >> len;
stream >> dxArrayLen;
if (dxArrayLen > 0) {
dxArray = new qint32[dxArrayLen]; // FIXME: Should cap to a reasonable value.
for (uint i = 0; i < dxArrayLen; ++i)
stream >> dxArray[i];
}
if (version > 1) {
quint16 len2;
// FIXME: Much more here
stream >> len2;
// FIXME: More here
}
#if 0
kDebug(31000) << "Text: " << startPoint << string
<< startIndex << len;
if (dxArrayLen > 0) {
kDebug(31000) << "dxArrayLen:" << dxArrayLen;
for (uint i = 0; i < dxArrayLen; ++i)
kDebug(31000) << dxArray[i];
}
else
kDebug(31000) << "dxArrayLen = 0";
#endif
mBackend->textArray(mContext, startPoint, string, startIndex, len,
dxArrayLen, dxArray);
kDebug(31000) << "Text: " << startPoint << string;
mBackend->textArray(mContext, startPoint, string);
if (dxArrayLen)
delete[] dxArray;
}
break;
case META_STRETCHTEXT_ACTION:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment