File indexing completed on 2025-02-16 13:49:57
0001 0002 /* 0003 ** Header file for inclusion with words_xml2latex.c 0004 ** 0005 ** Copyright (C) 2000-2002 Robert JACOLIN 0006 ** 0007 ** This library is free software; you can redistribute it and/or 0008 ** modify it under the terms of the GNU Library General Public 0009 ** License as published by the Free Software Foundation; either 0010 ** version 2 of the License, or (at your option) any later version. 0011 ** 0012 ** This library is distributed in the hope that it will be useful, 0013 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0015 ** Library General Public License for more details. 0016 ** 0017 ** To receive a copy of the GNU Library General Public License, write to the 0018 ** Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0019 * Boston, MA 02110-1301, USA. 0020 ** 0021 */ 0022 0023 #ifndef __LATEX_XMLPARSER_H__ 0024 #define __LATEX_XMLPARSER_H__ 0025 0026 #include <QString> 0027 #include <QDomDocument> 0028 0029 class FileHeader; 0030 class Document; 0031 class KoStore; 0032 0033 class XmlParser 0034 { 0035 /** Latex output file */ 0036 QString _filename; 0037 /** The Calligra app document stored in a XML DOM Tree. */ 0038 QDomDocument _document; 0039 /** The calligra document (maindoc, picture, ...). */ 0040 static KoStore* _in; 0041 0042 protected: 0043 /* All the inherit class must be have a link with 0044 * the header to specify to use special package 0045 */ 0046 static FileHeader *_fileHeader; 0047 static Document *_root; 0048 0049 public: 0050 explicit XmlParser(const QString&); 0051 explicit XmlParser(QByteArray); /* deprecated */ 0052 explicit XmlParser(const KoStore*); 0053 XmlParser(); 0054 virtual ~XmlParser(); 0055 0056 QString getFilename() const { 0057 return _filename; 0058 } 0059 QString getDocument() const { 0060 return _document.toString(); 0061 } 0062 Document* getRoot() const { 0063 return _root; 0064 } 0065 FileHeader* getFileHeader() const { 0066 return _fileHeader; 0067 } 0068 QString getChildName(const QDomNode &, int); 0069 QDomNode getChild(const QDomNode &, QString); 0070 QDomNode getChild(const QDomNode &, QString, int); 0071 QDomNode getChild(const QDomNode &, int); 0072 QString getData(const QDomNode &, int); 0073 QString getData(const QDomNode &, QString); 0074 int getNbChild(const QDomNode &, QString); 0075 int getNbChild(const QDomNode &); 0076 QString getAttr(const QDomNode &, QString) const; 0077 bool isChild(const QDomNode &, QString); 0078 0079 void setFileHeader(FileHeader* h) { 0080 _fileHeader = h; 0081 } 0082 void setRoot(Document* r) { 0083 _root = r; 0084 } 0085 0086 QDomNode init() { 0087 return _document.documentElement(); 0088 } 0089 0090 }; 0091 0092 #endif /* __LATEX_XMLPARSER_H__ */ 0093