- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

WPS8TextStyle.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* libwps
3 * Version: MPL 2.0 / LGPLv2.1+
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * Major Contributor(s):
10 * Copyright (C) 2006, 2007 Andrew Ziem
11 * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
12 * Copyright (C) 2003 Marc Maurer (uwog@uwog.net)
13 *
14 * For minor contributions see the git repository.
15 *
16 * Alternatively, the contents of this file may be used under the terms
17 * of the GNU Lesser General Public License Version 2.1 or later
18 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
19 * applicable instead of those above.
20 */
21
22 #ifndef WPS8_TEXTSTYLE_H
23 #define WPS8_TEXTSTYLE_H
24
25 #include <ostream>
26 #include <string>
27 #include <vector>
28
29 #include "libwps_internal.h"
30
31 #include "WPSDebug.h"
32
33 class WPSEntry;
34
35 typedef class WPSContentListener WPS8ContentListener;
36 typedef shared_ptr<WPS8ContentListener> WPS8ContentListenerPtr;
37
38 namespace WPS8Struct
39 {
40 struct FileData;
41 }
42
43 namespace WPS8TextStyleInternal
44 {
45 struct State;
46 }
47
48 class WPS8Text;
49
50 class WPS8TextStyle
51 {
52 friend class WPS8Text;
53 public:
54 struct FontData;
55
56 WPS8TextStyle(WPS8Text &parser);
57 ~WPS8TextStyle();
58
60 void setListener(WPS8ContentListenerPtr &listen)
61 {
62 m_listener = listen;
63 }
64
66 bool readStructures();
67
68 protected:
70 bool readFontNames(WPSEntry const &entry);
72 bool readFont(long endPos, int &id, std::string &mess);
73
74 void sendFont(int fId, FontData &data);
75
77 bool readParagraph(long endPos, int &id, std::string &mess);
78
79 void sendParagraph(int pId);
80
83 bool readSTSH(WPSEntry const &entry);
84
86 bool readSGP(WPSEntry const &entry);
87
88 //----------------------------------------
89 // FDP parsing
90 //----------------------------------------
91
94 bool findFDPStructures(int which, std::vector<WPSEntry> &result);
97 bool findFDPStructuresByHand(int which, std::vector<WPSEntry> &result);
98
99 protected:
101 libwps::DebugFile &ascii()
102 {
103 return m_asciiFile;
104 }
105
106 private:
108 WPS8TextStyle(WPS8TextStyle const &orig );
110 WPS8TextStyle &operator=(WPS8TextStyle const &orig);
111
112 protected:
114 WPS8Text &m_mainParser;
116 WPXInputStreamPtr m_input;
118 WPS8ContentListenerPtr m_listener;
120 mutable shared_ptr<WPS8TextStyleInternal::State> m_state;
122 libwps::DebugFile &m_asciiFile;
123 public:
124 struct FontData
125 {
126 FontData() : m_type(T_None), m_fieldType(F_None), m_fieldFormat(0) {}
128 friend std::ostream &operator<<(std::ostream &o, FontData const &fData);
130 std::string format() const;
131
132 enum { T_None=0, T_Object=2, T_Footnote=3, T_Endnote=4, T_Field=5, T_Comment=6 };
134 int m_type;
135 enum { F_None=0, F_PageNumber=-1, F_Date=-4, F_Time=-5 };
137 int m_fieldType;
139 int m_fieldFormat;
140 };
141 protected:
142 };
143
144
145 #endif /* WPS8_TEXT_H */
146 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */