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 
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 
51 {
52  friend class WPS8Text;
53 public:
54  struct FontData;
55 
56  WPS8TextStyle(WPS8Text &parser);
58 
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:
102  {
103  return m_asciiFile;
104  }
105 
106 private:
108  WPS8TextStyle(WPS8TextStyle const &orig );
110  WPS8TextStyle &operator=(WPS8TextStyle const &orig);
111 
112 protected:
120  mutable shared_ptr<WPS8TextStyleInternal::State> m_state;
123 public:
124  struct FontData
125  {
128  friend std::ostream &operator<<(std::ostream &o, FontData const &fData);
130  std::string format() const;
131 
134  int m_type;
135  enum { F_None=0, F_PageNumber=-1, F_Date=-4, F_Time=-5 };
140  };
141 protected:
142 };
143 
144 
145 #endif /* WPS8_TEXT_H */
146 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
void sendFont(int fId, FontData &data)
Definition: WPS8TextStyle.cpp:644
Definition: WPS8TextStyle.h:50
Definition: WPS8TextStyle.h:124
shared_ptr< WPXInputStream > WPXInputStreamPtr
Definition: libwps_internal.h:74
friend std::ostream & operator<<(std::ostream &o, FontData const &fData)
operator &lt;&lt;
Definition: WPS8TextStyle.cpp:1345
Definition: WPS8TextStyle.h:135
Definition: WPS8Text.h:53
Definition: WPSDebug.h:198
~WPS8TextStyle()
Definition: WPS8TextStyle.cpp:192
Definition: WPS8TextStyle.h:132
bool readSTSH(WPSEntry const &entry)
reads a style sheet zone
Definition: WPS8TextStyle.cpp:1096
int m_type
the main type: footnote, ...
Definition: WPS8TextStyle.h:134
bool findFDPStructures(int which, std::vector< WPSEntry > &result)
finds the FDPC/FDPP structure using the BTEC/BTEP entries which == 0 means FDPP, 1 means FDPC ...
Definition: WPS8TextStyle.cpp:1238
int m_fieldType
the field type: pagenumber, data, time, ...
Definition: WPS8TextStyle.h:137
Definition: WPSContentListener.h:168
std::string format() const
returns a format to used with strftime
Definition: WPS8TextStyle.cpp:1391
bool findFDPStructuresByHand(int which, std::vector< WPSEntry > &result)
finds the FDPC/FDPP structure by searching after the text zone which == 0 means FDPP, 1 means FDPC
Definition: WPS8TextStyle.cpp:1322
bool readStructures()
finds all entries which correspond to the styles, parses them and stores data
Definition: WPS8TextStyle.cpp:199
bool readFont(long endPos, int &id, std::string &mess)
reads a font properties
Definition: WPS8TextStyle.cpp:378
void sendParagraph(int pId)
Definition: WPS8TextStyle.cpp:1080
Definition: WPS8TextStyle.h:132
bool readParagraph(long endPos, int &id, std::string &mess)
the paragraph
Definition: WPS8TextStyle.cpp:662
Definition: WPS8TextStyle.h:135
Definition: WPS8TextStyle.h:135
Definition: WPS8TextStyle.h:135
bool readSGP(WPSEntry const &entry)
parses a SGP zone: style general property ?
Definition: WPS8TextStyle.cpp:324
shared_ptr< WPS8ContentListener > WPS8ContentListenerPtr
Definition: WPS8Graph.h:43
WPXInputStreamPtr m_input
the main input
Definition: WPS8TextStyle.h:116
Definition: WPS8TextStyle.h:132
libwps::DebugFile & ascii()
a DebugFile used to write what we recognize when we parse the document
Definition: WPS8TextStyle.h:101
WPS8Text & m_mainParser
the main parser
Definition: WPS8TextStyle.h:114
Definition: WPS8TextStyle.h:132
void setListener(WPS8ContentListenerPtr &listen)
sets the listener
Definition: WPS8TextStyle.h:60
WPS8ContentListenerPtr m_listener
the listener
Definition: WPS8TextStyle.h:118
Definition: WPS8TextStyle.h:132
libwps::DebugFile & m_asciiFile
the ascii file
Definition: WPS8TextStyle.h:122
int m_fieldFormat
the field format
Definition: WPS8TextStyle.h:139
WPS8TextStyle(WPS8Text &parser)
Definition: WPS8TextStyle.cpp:185
basic class to store an entry in a file This contained :
Definition: WPSEntry.h:37
shared_ptr< WPS8TextStyleInternal::State > m_state
the internal state
Definition: WPS8TextStyle.h:120
Definition: WPS8TextStyle.h:132
WPS8TextStyle & operator=(WPS8TextStyle const &orig)
private copy operator: forbidden
FontData()
Definition: WPS8TextStyle.h:126
bool readFontNames(WPSEntry const &entry)
reads the font names
Definition: WPS8TextStyle.cpp:246

Generated on Wed Jun 11 2014 02:26:01 for libwps by doxygen 1.8.5