|
|
|
@ -31,17 +31,8 @@ class UBGraphicsItemDelegate; |
|
|
|
|
class QTransform; |
|
|
|
|
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 |
|
|
|
|
{ |
|
|
|
@ -53,22 +44,9 @@ public: |
|
|
|
|
private: |
|
|
|
|
class UBCFFSubsetReader |
|
|
|
|
{ |
|
|
|
|
//xml parse states definition
|
|
|
|
|
enum |
|
|
|
|
{ |
|
|
|
|
NONE, |
|
|
|
|
IWB, |
|
|
|
|
SVG, |
|
|
|
|
PAGESET, |
|
|
|
|
PAGE, |
|
|
|
|
TEXTAREA, |
|
|
|
|
TSPAN |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
public: |
|
|
|
|
UBCFFSubsetReader(UBDocumentProxy *proxy, QFile *content); |
|
|
|
|
|
|
|
|
|
QXmlStreamReader mReader; |
|
|
|
|
UBDocumentProxy *mProxy; |
|
|
|
|
QString pwdContent; |
|
|
|
|
|
|
|
|
@ -87,8 +65,8 @@ private: |
|
|
|
|
// to kill
|
|
|
|
|
QDomDocument mDOMdoc; |
|
|
|
|
QDomNode mCurrentDOMElement; |
|
|
|
|
QHash<QString, IwbExt> iwbExtProperties; |
|
|
|
|
QHash<QString, UBGraphicsItem*> persistedItems; |
|
|
|
|
QDir mTmpFlashDir; |
|
|
|
|
|
|
|
|
|
bool hashElements(); |
|
|
|
|
void addExtentionsToHash(QDomElement *parent, QDomElement *topGroup); |
|
|
|
@ -100,6 +78,8 @@ private: |
|
|
|
|
bool parseSvgPage(const QDomElement &parent); |
|
|
|
|
bool parseSvgPageset(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 parseSvgEllipse(const QDomElement &element); |
|
|
|
@ -108,8 +88,11 @@ private: |
|
|
|
|
inline bool parseSvgText(const QDomElement &element); |
|
|
|
|
inline bool parseSvgTextarea(const QDomElement &element); |
|
|
|
|
inline bool parseSvgImage(const QDomElement &element); |
|
|
|
|
// inline bool parseSvgTSpan(const QDomElement)
|
|
|
|
|
bool parseIwbGroup(QDomNode *element); |
|
|
|
|
inline bool parseSvgFlash(const QDomElement &element); |
|
|
|
|
inline bool parseSvgAudio(const QDomElement &element); |
|
|
|
|
inline bool parseSvgVideo(const QDomElement &element); |
|
|
|
|
inline bool parseIwbGroup(QDomElement &parent); |
|
|
|
|
inline bool parseIwbElement(QDomElement &element); |
|
|
|
|
inline void hashSceneItem(const QDomElement &element, UBGraphicsItem *item); |
|
|
|
|
|
|
|
|
|
// to kill
|
|
|
|
@ -117,52 +100,24 @@ private: |
|
|
|
|
QString &fontFamily, QString &fontStretch, bool &italic, |
|
|
|
|
int &fontWeight, int &textAlign, QTransform &fontTransform); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//methods to store current xml parse state
|
|
|
|
|
int PopState(); |
|
|
|
|
void PushState(int state); |
|
|
|
|
|
|
|
|
|
//elements parsing methods
|
|
|
|
|
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 persistCurrentScene(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QStack<int> stateStack; |
|
|
|
|
|
|
|
|
|
int currentState; |
|
|
|
|
|
|
|
|
|
// helper methods
|
|
|
|
|
bool getCurElementTransorm(QTransform &transform); |
|
|
|
|
void repositionSvgItem(UBGraphicsSvgItem *item, qreal width, qreal height, qreal x, qreal y, bool useTransform, QTransform &transform); |
|
|
|
|
void repositionPixmapItem(UBGraphicsPixmapItem *item, qreal width, qreal height, qreal x, qreal y |
|
|
|
|
, bool useTransform, QTransform &transform); |
|
|
|
|
// bool getCurElementTransorm(QTransform &transform);
|
|
|
|
|
void repositionSvgItem(QGraphicsItem *item, qreal width, qreal height, |
|
|
|
|
qreal x, qreal y, |
|
|
|
|
bool useTransform, QTransform &transform); |
|
|
|
|
QColor colorFromString(const QString& clrString); |
|
|
|
|
QTransform transformFromString(const QString trString); |
|
|
|
|
bool getViewBoxDimenstions(const QString& viewBox); |
|
|
|
|
QSvgGenerator* createSvgGenerator(qreal width, qreal height); |
|
|
|
|
bool getTempFileName(); |
|
|
|
|
void parseTextAttributes(qreal &fontSize, QColor &fontColor, |
|
|
|
|
QString &fontFamily, QString &fontStretch, bool &italic, |
|
|
|
|
int &fontWeight, int &textAlign, QTransform &fontTransform); |
|
|
|
|
inline bool strToBool(QString); |
|
|
|
|
bool createTempFlashPath(); |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|