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 namespace WPS8TextStyleInternal
34 {
35 struct State;
36 }
37 
38 class WPS8Text;
39 
41 {
42  friend class WPS8Text;
43 public:
44  struct FontData;
45 
46  explicit WPS8TextStyle(WPS8Text &parser);
48 
51  {
52  m_listener = listen;
53  }
54 
56  bool readStructures();
57 
58 protected:
60  bool readFontNames(WPSEntry const &entry);
62  bool readFont(long endPos, int &id, std::string &mess);
63 
64  void sendFont(int fId, FontData &data);
65 
67  bool readParagraph(long endPos, int &id, std::string &mess);
68 
69  void sendParagraph(int pId);
70 
73  bool readSTSH(WPSEntry const &entry);
74 
76  bool readSGP(WPSEntry const &entry);
77 
78  //----------------------------------------
79  // FDP parsing
80  //----------------------------------------
81 
84  bool findFDPStructures(int which, std::vector<WPSEntry> &result);
87  bool findFDPStructuresByHand(int which, std::vector<WPSEntry> &result);
88 
89 protected:
92  {
93  return m_asciiFile;
94  }
95 
96 private:
98  WPS8TextStyle(WPS8TextStyle const &orig);
100  WPS8TextStyle &operator=(WPS8TextStyle const &orig);
101 
102 protected:
110  mutable shared_ptr<WPS8TextStyleInternal::State> m_state;
113 public:
114  struct FontData
115  {
118  friend std::ostream &operator<<(std::ostream &o, FontData const &fData);
120  std::string format() const;
121 
124  int m_type;
125  enum { F_None=0, F_PageNumber=-1, F_Date=-4, F_Time=-5 };
130  };
131 protected:
132 };
133 
134 
135 #endif /* WPS8_TEXT_H */
136 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
void sendFont(int fId, FontData &data)
Definition: WPS8TextStyle.cpp:610
shared_ptr< WPSContentListener > WPSContentListenerPtr
shared pointer to WPSContentListener
Definition: libwps_internal.h:122
Definition: WPS8TextStyle.h:40
Definition: WPS8TextStyle.h:114
friend std::ostream & operator<<(std::ostream &o, FontData const &fData)
operator &lt;&lt;
Definition: WPS8TextStyle.cpp:1307
Definition: WPS8TextStyle.h:125
Definition: WPS8Text.h:47
Definition: WPSDebug.h:196
~WPS8TextStyle()
Definition: WPS8TextStyle.cpp:154
Definition: WPS8TextStyle.h:122
bool readSTSH(WPSEntry const &entry)
reads a style sheet zone
Definition: WPS8TextStyle.cpp:1063
int m_type
the main type: footnote, ...
Definition: WPS8TextStyle.h:124
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:1204
int m_fieldType
the field type: pagenumber, data, time, ...
Definition: WPS8TextStyle.h:127
void setListener(WPSContentListenerPtr &listen)
sets the listener
Definition: WPS8TextStyle.h:50
std::string format() const
returns a format to used with strftime
Definition: WPS8TextStyle.cpp:1353
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:1285
bool readStructures()
finds all entries which correspond to the styles, parses them and stores data
Definition: WPS8TextStyle.cpp:161
bool readFont(long endPos, int &id, std::string &mess)
reads a font properties
Definition: WPS8TextStyle.cpp:344
void sendParagraph(int pId)
Definition: WPS8TextStyle.cpp:1047
Definition: WPS8TextStyle.h:122
bool readParagraph(long endPos, int &id, std::string &mess)
the paragraph
Definition: WPS8TextStyle.cpp:628
Definition: WPS8TextStyle.h:125
Definition: WPS8TextStyle.h:125
Definition: WPS8TextStyle.h:125
bool readSGP(WPSEntry const &entry)
parses a SGP zone: style general property ?
Definition: WPS8TextStyle.cpp:290
Definition: WPS8TextStyle.h:122
libwps::DebugFile & ascii()
a DebugFile used to write what we recognize when we parse the document
Definition: WPS8TextStyle.h:91
WPS8Text & m_mainParser
the main parser
Definition: WPS8TextStyle.h:104
Definition: WPS8TextStyle.h:122
Definition: WPS8TextStyle.h:122
shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:102
libwps::DebugFile & m_asciiFile
the ascii file
Definition: WPS8TextStyle.h:112
RVNGInputStreamPtr m_input
the main input
Definition: WPS8TextStyle.h:106
int m_fieldFormat
the field format
Definition: WPS8TextStyle.h:129
WPS8TextStyle(WPS8Text &parser)
Definition: WPS8TextStyle.cpp:147
WPSContentListenerPtr m_listener
the listener
Definition: WPS8TextStyle.h:108
basic class to store an entry in a file This contained :
Definition: WPSEntry.h:38
shared_ptr< WPS8TextStyleInternal::State > m_state
the internal state
Definition: WPS8TextStyle.h:110
Definition: WPS8TextStyle.h:122
WPS8TextStyle & operator=(WPS8TextStyle const &orig)
private copy operator: forbidden
FontData()
Definition: WPS8TextStyle.h:116
bool readFontNames(WPSEntry const &entry)
reads the font names
Definition: WPS8TextStyle.cpp:207

Generated on Wed Apr 11 2018 00:19:12 for libwps by doxygen 1.8.5