odsstream
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 #pragma once
21 
22 #include <QXmlDefaultHandler>
23 #include <QString>
24 #include <vector>
25 #include "../odsdocreader.h"
26 
27 class SaxHandlerContentXml : public QXmlDefaultHandler
28 {
29 
30  public:
32  virtual ~SaxHandlerContentXml();
33 
34  bool startElement(const QString &namespaceURI,
35  const QString &localName,
36  const QString &qName,
37  const QXmlAttributes &attributes);
38 
39  bool endElement(const QString &namespaceURI,
40  const QString &localName,
41  const QString &qName);
42 
43  bool endDocument();
44 
45  bool characters(const QString &str);
46 
47  bool fatalError(const QXmlParseException &exception);
48 
49  QString errorString() const;
50 
51  private:
52  bool start_element_table_row(const QXmlAttributes &attributes) const;
53  bool end_element_table_row() const;
54  bool start_element_table(const QXmlAttributes &attributes) const;
55  bool end_element_table() const;
56  bool start_element_table_cell(const QXmlAttributes &attributes);
57  bool end_element_table_cell();
58  bool start_element_p(const QXmlAttributes &attributes);
59  bool end_element_p();
60  bool end_element_a();
61  bool start_element_office_annotation(const QXmlAttributes &attributes);
62  bool end_element_office_annotation();
64  QString _errorStr;
65 
66  QString _currentText;
67 
68  std::vector<QString> _tag_stack;
69 
70  OdsDocReader &_ods_reader;
71 
72  uint _number_columns_repeated;
73 
74  OdsCell _current_cell;
75 
76  bool _is_annotation = false;
77 };
OdsDocReader
Definition: odsdocreader.h:30
SaxHandlerContentXml
Definition: saxhandlercontentxml.h:28
OdsCell
Definition: odscell.h:29