|
|
@ -30,17 +30,9 @@ class UBGraphicsPixmapItem; |
|
|
|
class UBGraphicsItemDelegate; |
|
|
|
class UBGraphicsItemDelegate; |
|
|
|
class QTransform; |
|
|
|
class QTransform; |
|
|
|
class QPainter; |
|
|
|
class QPainter; |
|
|
|
|
|
|
|
class UBGraphicsItem; |
|
|
|
|
|
|
|
class QGraphicsItem; |
|
|
|
|
|
|
|
|
|
|
|
struct IwbExt { |
|
|
|
|
|
|
|
IwbExt() {;} |
|
|
|
|
|
|
|
IwbExt(QDomNode element) : element(element), extAttr(*(new QVector<QDomNode>())) {;} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QDomNode group; |
|
|
|
|
|
|
|
QDomNode element; |
|
|
|
|
|
|
|
QVector<QDomNode> extAttr; |
|
|
|
|
|
|
|
QHash<QString, QString> textAttributes; |
|
|
|
|
|
|
|
operator bool() const {return !group.isNull() || !element.isNull();} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class UBCFFSubsetAdaptor |
|
|
|
class UBCFFSubsetAdaptor |
|
|
|
{ |
|
|
|
{ |
|
|
@ -52,22 +44,9 @@ public: |
|
|
|
private: |
|
|
|
private: |
|
|
|
class UBCFFSubsetReader |
|
|
|
class UBCFFSubsetReader |
|
|
|
{ |
|
|
|
{ |
|
|
|
//xml parse states definition
|
|
|
|
|
|
|
|
enum |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
NONE, |
|
|
|
|
|
|
|
IWB, |
|
|
|
|
|
|
|
SVG, |
|
|
|
|
|
|
|
PAGESET, |
|
|
|
|
|
|
|
PAGE, |
|
|
|
|
|
|
|
TEXTAREA, |
|
|
|
|
|
|
|
TSPAN |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public: |
|
|
|
public: |
|
|
|
UBCFFSubsetReader(UBDocumentProxy *proxy, QFile *content); |
|
|
|
UBCFFSubsetReader(UBDocumentProxy *proxy, QFile *content); |
|
|
|
|
|
|
|
|
|
|
|
QXmlStreamReader mReader; |
|
|
|
|
|
|
|
UBDocumentProxy *mProxy; |
|
|
|
UBDocumentProxy *mProxy; |
|
|
|
QString pwdContent; |
|
|
|
QString pwdContent; |
|
|
|
|
|
|
|
|
|
|
@ -79,6 +58,8 @@ private: |
|
|
|
QRectF mCurrentSceneRect; |
|
|
|
QRectF mCurrentSceneRect; |
|
|
|
QString mIndent; |
|
|
|
QString mIndent; |
|
|
|
QRectF mViewBox; |
|
|
|
QRectF mViewBox; |
|
|
|
|
|
|
|
QRectF mViewPort; |
|
|
|
|
|
|
|
qreal mVBTransFactor; |
|
|
|
QPointF mViewBoxCenter; |
|
|
|
QPointF mViewBoxCenter; |
|
|
|
QSize mSize; |
|
|
|
QSize mSize; |
|
|
|
|
|
|
|
|
|
|
@ -86,8 +67,8 @@ private: |
|
|
|
// to kill
|
|
|
|
// to kill
|
|
|
|
QDomDocument mDOMdoc; |
|
|
|
QDomDocument mDOMdoc; |
|
|
|
QDomNode mCurrentDOMElement; |
|
|
|
QDomNode mCurrentDOMElement; |
|
|
|
QHash<QString, IwbExt> iwbExtProperties; |
|
|
|
QHash<QString, UBGraphicsItem*> persistedItems; |
|
|
|
QHash<QString, UBGraphicsItemDelegate*> persistedItems; |
|
|
|
QDir mTmpFlashDir; |
|
|
|
|
|
|
|
|
|
|
|
bool hashElements(); |
|
|
|
bool hashElements(); |
|
|
|
void addExtentionsToHash(QDomElement *parent, QDomElement *topGroup); |
|
|
|
void addExtentionsToHash(QDomElement *parent, QDomElement *topGroup); |
|
|
@ -99,6 +80,8 @@ private: |
|
|
|
bool parseSvgPage(const QDomElement &parent); |
|
|
|
bool parseSvgPage(const QDomElement &parent); |
|
|
|
bool parseSvgPageset(const QDomElement &parent); |
|
|
|
bool parseSvgPageset(const QDomElement &parent); |
|
|
|
bool parseSvgElement(const QDomElement &parent); |
|
|
|
bool parseSvgElement(const QDomElement &parent); |
|
|
|
|
|
|
|
bool parseIwbMeta(const QDomElement &element); |
|
|
|
|
|
|
|
bool parseSvg(const QDomElement &svgSection); |
|
|
|
|
|
|
|
|
|
|
|
inline bool parseSvgRect(const QDomElement &element); |
|
|
|
inline bool parseSvgRect(const QDomElement &element); |
|
|
|
inline bool parseSvgEllipse(const QDomElement &element); |
|
|
|
inline bool parseSvgEllipse(const QDomElement &element); |
|
|
@ -107,61 +90,44 @@ private: |
|
|
|
inline bool parseSvgText(const QDomElement &element); |
|
|
|
inline bool parseSvgText(const QDomElement &element); |
|
|
|
inline bool parseSvgTextarea(const QDomElement &element); |
|
|
|
inline bool parseSvgTextarea(const QDomElement &element); |
|
|
|
inline bool parseSvgImage(const QDomElement &element); |
|
|
|
inline bool parseSvgImage(const QDomElement &element); |
|
|
|
// inline bool parseSvgTSpan(const QDomElement)
|
|
|
|
inline bool parseSvgFlash(const QDomElement &element); |
|
|
|
bool parseIwbGroup(QDomNode *element); |
|
|
|
inline bool parseSvgAudio(const QDomElement &element); |
|
|
|
inline void hashSceneItem(QDomNode *element, UBGraphicsItemDelegate *item); |
|
|
|
inline bool parseSvgVideo(const QDomElement &element); |
|
|
|
|
|
|
|
inline bool parseIwbGroup(QDomElement &parent); |
|
|
|
|
|
|
|
inline bool parseIwbElement(QDomElement &element); |
|
|
|
|
|
|
|
inline void parseTSpan(const QDomElement &parent, QPainter &painter |
|
|
|
|
|
|
|
, qreal &curX, qreal &curY, qreal &width, qreal &height, qreal &linespacing, QRectF &lastDrawnTextBoundingRect |
|
|
|
|
|
|
|
, qreal &fontSize, QColor &fontColor, QString &fontFamily, QString &fontStretch, bool &italic |
|
|
|
|
|
|
|
, int &fontWeight, int &textAlign, QTransform &fontTransform); |
|
|
|
|
|
|
|
inline void hashSceneItem(const QDomElement &element, UBGraphicsItem *item); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// to kill
|
|
|
|
// to kill
|
|
|
|
void parseTextAttributes(const QDomElement &element, qreal &fontSize, QColor &fontColor, |
|
|
|
void parseTextAttributes(const QDomElement &element, qreal &fontSize, QColor &fontColor, |
|
|
|
QString &fontFamily, QString &fontStretch, bool &italic, |
|
|
|
QString &fontFamily, QString &fontStretch, bool &italic, |
|
|
|
int &fontWeight, int &textAlign, QTransform &fontTransform); |
|
|
|
int &fontWeight, int &textAlign, QTransform &fontTransform); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//methods to store current xml parse state
|
|
|
|
|
|
|
|
int PopState(); |
|
|
|
|
|
|
|
void PushState(int state); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//elements parsing methods
|
|
|
|
//elements parsing methods
|
|
|
|
bool parseDoc(); |
|
|
|
bool parseDoc(); |
|
|
|
|
|
|
|
|
|
|
|
bool parseCurrentElementStart(); |
|
|
|
|
|
|
|
bool parseCurrentElementCharacters(); |
|
|
|
|
|
|
|
bool parseCurrentElementEnd(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool parseIwb(); |
|
|
|
|
|
|
|
bool parseIwbMeta(); |
|
|
|
|
|
|
|
bool parseSvg(); |
|
|
|
|
|
|
|
bool parseRect(); |
|
|
|
|
|
|
|
bool parseEllipse(); |
|
|
|
|
|
|
|
bool parseTextArea(); |
|
|
|
|
|
|
|
bool parseText(); |
|
|
|
|
|
|
|
bool parsePolygon(); |
|
|
|
|
|
|
|
bool parsePolyline(); |
|
|
|
|
|
|
|
bool parsePage(); |
|
|
|
|
|
|
|
bool parsePageSet(); |
|
|
|
|
|
|
|
bool parseIwbElementRef(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool createNewScene(); |
|
|
|
bool createNewScene(); |
|
|
|
bool persistCurrentScene(); |
|
|
|
bool persistCurrentScene(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QStack<int> stateStack; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int currentState; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// helper methods
|
|
|
|
// helper methods
|
|
|
|
bool getCurElementTransorm(QTransform &transform); |
|
|
|
// bool getCurElementTransorm(QTransform &transform);
|
|
|
|
void repositionSvgItem(UBGraphicsSvgItem *item, qreal width, qreal height, qreal x, qreal y, bool useTransform, QTransform &transform); |
|
|
|
void repositionSvgItem(QGraphicsItem *item, qreal width, qreal height, |
|
|
|
void repositionPixmapItem(UBGraphicsPixmapItem *item, qreal width, qreal height, qreal x, qreal y |
|
|
|
qreal x, qreal y, |
|
|
|
, bool useTransform, QTransform &transform); |
|
|
|
bool useTransform, QTransform &transform); |
|
|
|
|
|
|
|
void experimentalReposition(QGraphicsItem *item, qreal width, qreal height, |
|
|
|
|
|
|
|
qreal x, qreal y, |
|
|
|
|
|
|
|
bool useTransform, QTransform &transform); |
|
|
|
QColor colorFromString(const QString& clrString); |
|
|
|
QColor colorFromString(const QString& clrString); |
|
|
|
QTransform transformFromString(const QString trString); |
|
|
|
QTransform transformFromString(const QString trString); |
|
|
|
bool getViewBoxDimenstions(const QString& viewBox); |
|
|
|
bool getViewBoxDimenstions(const QString& viewBox); |
|
|
|
QSvgGenerator* createSvgGenerator(qreal width, qreal height); |
|
|
|
QSvgGenerator* createSvgGenerator(qreal width, qreal height); |
|
|
|
bool getTempFileName(); |
|
|
|
bool getTempFileName(); |
|
|
|
void parseTextAttributes(qreal &fontSize, QColor &fontColor, |
|
|
|
inline bool strToBool(QString); |
|
|
|
QString &fontFamily, QString &fontStretch, bool &italic, |
|
|
|
bool createTempFlashPath(); |
|
|
|
int &fontWeight, int &textAlign, QTransform &fontTransform); |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|