KD Reports API Documentation  2.2
KDReportsXmlParser_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** This file is part of the KD Reports library.
4 **
5 ** SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6 **
7 ** SPDX-License-Identifier: MIT
8 **
9 ****************************************************************************/
10 
11 #ifndef KDREPORTSXMLPARSER_H
12 #define KDREPORTSXMLPARSER_H
13 
14 //
15 // W A R N I N G
16 // -------------
17 //
18 // This file is not part of the KD Reports API. It exists purely as an
19 // implementation detail. This header file may change from version to
20 // version without notice, or even be removed.
21 //
22 // We mean it.
23 //
24 //
25 
26 #include "KDReportsErrorDetails.h"
27 #include "KDReportsGlobal.h"
28 #include "KDReportsReport.h"
29 #include <QPixmap>
30 #include <QtCore/QHash>
31 
32 QT_BEGIN_NAMESPACE
33 class QDomDocument;
34 class QDomNode;
35 QT_END_NAMESPACE
36 
37 namespace KDReports {
38 class TableElement;
39 class XmlElementHandler;
40 class AbstractTableElement;
41 
46 class XmlParser
47 {
48 public:
49  XmlParser(const QHash<QString, QString> &textValues, const QHash<QString, QImage> &imageValues, XmlElementHandler *xmlHandler, KDReports::Report *report, ErrorDetails *details)
50  : m_textValues(textValues)
51  , m_imageValues(imageValues)
52  , m_xmlElementHandler(xmlHandler)
53  , m_report(report)
54  , m_errorDetails(details)
55  {
56  }
57 
58  bool processDocument(const QDomDocument &document, KDReports::ReportBuilder *builder);
59 
60 private:
61  bool processNode(const QDomNode &node, KDReports::ReportBuilder *builder, bool inHeader, bool inFooter);
62  void addElement(KDReports::Element &reportElement, KDReports::ReportBuilder *builder, const QDomElement &element);
63  bool parseTableContents(KDReports::TableElement &table, const QDomNode &tableNode, KDReports::ReportBuilder &builder, bool inHeader, bool inFooter);
64  static void parseCommonTableAttributes(KDReports::AbstractTableElement &tableElement, QDomElement &element);
65  void parseTabs(KDReports::ReportBuilder *builder, const QDomElement &element);
66  void parseParagraphMargins(KDReports::ReportBuilder *builder, const QDomElement &element);
67  QString extractText(const QDomElement &element, QString *id, const QAbstractItemModel *currentModel = nullptr, int currentRow = -1) const;
68  QImage extractImage(const QDomElement &element, QString *pId) const;
69  bool testForErrorAndFillErrorDetails();
70  void error(const QString &errorString);
71 
72  QHash<QString, QString> m_textValues;
73  QHash<QString, QImage> m_imageValues;
74  XmlElementHandler *m_xmlElementHandler;
75  KDReports::Report *m_report;
76  ErrorDetails *m_errorDetails;
77 };
78 
79 }
80 
81 #endif
bool processDocument(const QDomDocument &document, KDReports::ReportBuilder *builder)
XmlParser(const QHash< QString, QString > &textValues, const QHash< QString, QImage > &imageValues, XmlElementHandler *xmlHandler, KDReports::Report *report, ErrorDetails *details)

© Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
https://www.kdab.com/development-resources/qt-tools/kd-reports/
Generated by doxygen 1.9.1