valentina/xml/vdomdocument.h

96 lines
3.9 KiB
C
Raw Normal View History

2013-07-13 12:51:31 +02:00
#ifndef VDOMDOCUMENT_H
#define VDOMDOCUMENT_H
2013-08-20 12:26:02 +02:00
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
2013-08-20 12:26:02 +02:00
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
2013-07-13 12:51:31 +02:00
#include <QDomDocument>
#include <QMap>
#include <QObject>
#include <QComboBox>
#include "../container/vcontainer.h"
#include "../widgets/vmaingraphicsscene.h"
#include "../tools/vdatatool.h"
2013-08-20 12:26:02 +02:00
#pragma GCC diagnostic pop
2013-08-15 22:39:00 +02:00
#include "vtoolrecord.h"
2013-07-13 12:51:31 +02:00
namespace Document{
enum Enum
{
LiteParse,
FullParse
};
}
2013-08-20 12:26:02 +02:00
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
2013-07-13 12:51:31 +02:00
class VDomDocument : public QObject, public QDomDocument
{
Q_OBJECT
public:
2013-08-15 22:39:00 +02:00
VDomDocument(VContainer *data,QComboBox *comboBoxDraws);
VDomDocument(const QString& name, VContainer *data,QComboBox *comboBoxDraws);
VDomDocument(const QDomDocumentType& doctype, VContainer *data, QComboBox *comboBoxDraws);
~VDomDocument();
2013-07-13 12:51:31 +02:00
QDomElement elementById(const QString& id);
void CreateEmptyFile();
2013-08-15 22:39:00 +02:00
void ChangeActivDraw(const QString& name, Document::Enum parse = Document::FullParse);
2013-07-13 12:51:31 +02:00
QString GetNameActivDraw() const;
bool GetActivDrawElement(QDomElement &element);
bool GetActivCalculationElement(QDomElement &element);
bool GetActivModelingElement(QDomElement &element);
bool GetActivPathsElement(QDomElement &element);
bool appendDraw(const QString& name);
void SetNameDraw(const QString& name);
2013-08-15 22:39:00 +02:00
void Parse(Document::Enum parse, VMainGraphicsScene *scene);
QMap<qint64, VDataTool*>* getTools();
2013-08-15 22:39:00 +02:00
QVector<VToolRecord> *getHistory();
qint64 getCursor() const;
void setCursor(const qint64 &value);
void setCurrentData();
2013-07-13 12:51:31 +02:00
signals:
void ChangedActivDraw(const QString newName);
void ChangedNameDraw(const QString oldName, const QString newName);
void FullUpdateFromFile();
void haveChange();
2013-08-15 22:39:00 +02:00
void ShowTool(qint64 id, Qt::GlobalColor color, bool enable);
void ChangedCursor(qint64 id);
2013-07-13 12:51:31 +02:00
public slots:
void FullUpdateTree();
void haveLiteChange();
2013-08-15 22:39:00 +02:00
void ShowHistoryTool(qint64 id, Qt::GlobalColor color, bool enable);
2013-07-13 12:51:31 +02:00
private:
QMap<QString, QDomElement> map;
QString nameActivDraw;
VContainer *data;
QMap<qint64, VDataTool*> tools;
2013-08-15 22:39:00 +02:00
QVector<VToolRecord> history;
qint64 cursor;
QComboBox *comboBoxDraws;
2013-08-20 12:26:02 +02:00
VDomDocument(const VDomDocument & doc);
const VDomDocument &operator=(const VDomDocument& doc);
2013-07-13 12:51:31 +02:00
bool find(QDomElement node, const QString& id);
bool CheckNameDraw(const QString& name) const;
void SetActivDraw(const QString& name);
bool GetActivNodeElement(const QString& name, QDomElement& element);
void ParseDrawElement(VMainGraphicsScene *scene,
const QDomNode& node, Document::Enum parse);
void ParseCalculationElement(VMainGraphicsScene *scene, const QDomNode& node,
Document::Enum parse);
void ParsePointElement(VMainGraphicsScene *scene, const QDomElement& domElement,
Document::Enum parse, const QString &type);
2013-07-25 20:39:51 +02:00
void ParseLineElement(VMainGraphicsScene *scene, const QDomElement& domElement,
Document::Enum parse);
2013-08-05 10:37:56 +02:00
void ParseSplineElement(VMainGraphicsScene *scene, const QDomElement& domElement,
Document::Enum parse, const QString& type);
2013-08-06 09:56:09 +02:00
void ParseArcElement(VMainGraphicsScene *scene, const QDomElement& domElement,
Document::Enum parse, const QString& type);
2013-07-17 13:38:11 +02:00
void ParseIncrementsElement(const QDomNode& node);
2013-07-13 12:51:31 +02:00
};
2013-08-20 12:26:02 +02:00
#pragma GCC diagnostic pop
2013-07-13 12:51:31 +02:00
#endif // VDOMDOCUMENT_H