libodsstream
saxhandlercontentxml.h
1 /*
2  libodsstream is a library to read and write ODS documents as streams
3  Copyright (C) 2013 Olivier Langella <Olivier.Langella@moulon.inra.fr>
4 
5  This program is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18 */
19 
20 #ifndef SAXHANDLERCONTENTXML_H
21 #define SAXHANDLERCONTENTXML_H
22 
23 #include <QXmlDefaultHandler>
24 #include <QString>
25 #include <vector>
26 #include "../odsdocreader.h"
27 
28 class SaxHandlerContentXml : public QXmlDefaultHandler
29 {
30 
31  public:
33  virtual ~SaxHandlerContentXml();
34 
35  bool startElement(const QString &namespaceURI,
36  const QString &localName,
37  const QString &qName,
38  const QXmlAttributes &attributes);
39 
40  bool endElement(const QString &namespaceURI,
41  const QString &localName,
42  const QString &qName);
43 
44  bool endDocument();
45 
46  bool characters(const QString &str);
47 
48  bool fatalError(const QXmlParseException &exception);
49 
50  QString errorString() const;
51 
52  private:
53  bool start_element_table_row(const QXmlAttributes &attributes) const;
54  bool end_element_table_row() const;
55  bool start_element_table(const QXmlAttributes &attributes) const;
56  bool end_element_table() const;
57  bool start_element_table_cell(const QXmlAttributes &attributes);
58  bool end_element_table_cell();
59  bool start_element_p(const QXmlAttributes &attributes);
60  bool end_element_p();
61  bool end_element_a();
62  bool start_element_office_annotation(const QXmlAttributes &attributes);
63  bool end_element_office_annotation();
65  QString _errorStr;
66 
67  QString _currentText;
68 
69  std::vector<QString> _tag_stack;
70 
71  OdsDocReader &_ods_reader;
72 
73  uint _number_columns_repeated;
74 
75  OdsCell _current_cell;
76 
77  bool _is_annotation = false;
78 };
79 
80 #endif // SAXHANDLERCONTENTXML_H
OdsDocReader
Definition: odsdocreader.h:30
SaxHandlerContentXml
Definition: saxhandlercontentxml.h:28
OdsCell
Definition: odscell.h:28