WPS8.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_H
23 #define WPS8_H
24 
25 #include <vector>
26 
27 #include <librevenge/librevenge.h>
28 
29 #include "libwps_internal.h"
30 #include "WPSParser.h"
31 
32 class WPSPageSpan;
33 
34 namespace WPS8ParserInternal
35 {
36 class SubDocument;
37 struct State;
38 }
39 
40 class WPS8Graph;
41 class WPS8Table;
42 class WPS8Text;
43 
48 class WPS8Parser : public WPSParser
49 {
51  friend class WPS8Graph;
52  friend class WPS8Table;
53  friend class WPS8Text;
54 
55 public:
59  ~WPS8Parser();
61  void parse(librevenge::RVNGTextInterface *documentInterface);
62 protected:
64  bool checkInFile(long pos);
65 
67  void newPage(int number);
69  void setListener(shared_ptr<WPSContentListener> listener);
71  shared_ptr<WPSContentListener> createListener(librevenge::RVNGTextInterface *interface);
72 
74  bool createStructures();
76  bool createOLEStructures();
77 
79  float pageHeight() const;
81  float pageWidth() const;
83  int numColumns() const;
84 
86  void sendPageFrames();
87  // interface with text parser
88 
90  void sendTextBox(WPSPosition const &pos, int strsid,
91  librevenge::RVNGPropertyList frameExtras=librevenge::RVNGPropertyList());
92 
94  void send(WPSEntry const &entry);
96  void send(int strsId);
97 
99  void sendTextInCell(int strsId, int cellId);
100 
101  // interface with table parser
102 
104  bool sendTable(Vec2f const &size, int objectId);
106  int getTableSTRSId(int tableId) const;
107 
108  // interface with graph parser
109 
115  bool sendObject(Vec2f const &size, int objectId, bool ole);
116 
117  //
118  // low level
119  //
120 
122  bool parseHeaderIndexEntry();
125  bool parseHeaderIndexEntryEnd(long endPos, WPSEntry &hie,std::string &mess);
126 
131  bool parseHeaderIndex();
132 
136  bool readDocProperties(WPSEntry const &entry, WPSPageSpan &page);
137 
140  bool readFRAM(WPSEntry const &entry);
141 
146  bool readSYID(WPSEntry const &entry, std::vector<int> &listId);
147 
151  bool readWNPR(WPSEntry const &entry);
152 
154  bool readSPELLING(RVNGInputStreamPtr input, std::string const &oleName);
155 
156  shared_ptr<WPSContentListener> m_listener; /* the listener (if set)*/
158  shared_ptr<WPS8Graph> m_graphParser;
160  shared_ptr<WPS8Table> m_tableParser;
162  shared_ptr<WPS8Text> m_textParser;
164  shared_ptr<WPS8ParserInternal::State> m_state;
165 };
166 
167 #endif /* WPS8_H */
168 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
bool createOLEStructures()
tries to parse the different OLE zones ( except the main zone )
Definition: WPS8.cpp:646
This class parses Works version 2000 through 8.
Definition: WPS8.h:48
float pageHeight() const
returns the page height, ie. paper size less margin (in inches)
Definition: WPS8.cpp:307
shared_ptr< WPS8Table > m_tableParser
the table parser
Definition: WPS8.h:160
the main class to read/store pictures in a Pc MS Works document v5-8
Definition: WPS8Graph.h:54
void newPage(int number)
adds a new page
Definition: WPS8.cpp:390
Definition: WPS8Text.h:47
the main class to read/store table in a Pc MS Works document v5-8
Definition: WPS8Table.h:57
bool checkInFile(long pos)
return true if the pos is in the file, update the file size if need
Definition: WPS8.cpp:322
void send(WPSEntry const &entry)
sends text corresponding to the entry to the listener (via WPS8Text)
Definition: WPS8.cpp:408
void parse(librevenge::RVNGTextInterface *documentInterface)
called by WPSDocument to parse the file
Definition: WPS8.cpp:497
Internal: the subdocument of a WPS8Parser.
Definition: WPS8.cpp:49
bool createStructures()
tries to parse the main zone, ...
Definition: WPS8.cpp:558
Definition: WPSParser.h:35
shared_ptr< WPSContentListener > m_listener
Definition: WPS8.h:156
bool readSYID(WPSEntry const &entry, std::vector< int > &listId)
parses a SYID zone
Definition: WPS8.cpp:1605
shared_ptr< WPSHeader > WPSHeaderPtr
shared pointer to WPSHeader
Definition: libwps_internal.h:102
void sendPageFrames()
send the frames which corresponds to a given page to the listener
Definition: WPS8.cpp:696
bool readSPELLING(RVNGInputStreamPtr input, std::string const &oleName)
finds the structures of the Ole zone &quot;SPELLING&quot;
Definition: WPS8.cpp:1809
void setListener(shared_ptr< WPSContentListener > listener)
set the listener
Definition: WPS8.cpp:336
shared_ptr< WPSContentListener > createListener(librevenge::RVNGTextInterface *interface)
creates the main listener
Definition: WPS8.cpp:344
bool sendTable(Vec2f const &size, int objectId)
sends a table as a character with given size ( via its WPS8Table )
Definition: WPS8.cpp:451
bool readFRAM(WPSEntry const &entry)
reads the FRAM zone: ie a zone which can contains textbox, picture, ...
Definition: WPS8.cpp:1231
shared_ptr< WPS8Text > m_textParser
the text parser
Definition: WPS8.h:162
WPS8Parser(RVNGInputStreamPtr &input, WPSHeaderPtr &header)
constructor
Definition: WPS8.cpp:291
shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:81
bool parseHeaderIndexEntry()
parses an index entry
Definition: WPS8.cpp:749
bool readDocProperties(WPSEntry const &entry, WPSPageSpan &page)
reads the DOP zone: the document properties
Definition: WPS8.cpp:970
void sendTextInCell(int strsId, int cellId)
send the text of a cell to a listener (via WPS8Text)
Definition: WPS8.cpp:421
float pageWidth() const
returns the page width, ie. paper size less margin (in inches)
Definition: WPS8.cpp:312
int getTableSTRSId(int tableId) const
retrieve the strsId corresponding to a table ( mainly for debug)
Definition: WPS8.cpp:481
bool readWNPR(WPSEntry const &entry)
parses the WNPR zone : a zone which seems to contain the printer preferences.
Definition: WPS8.cpp:1654
shared_ptr< WPS8ParserInternal::State > m_state
the internal state
Definition: WPS8.h:164
~WPS8Parser()
destructor
Definition: WPS8.cpp:302
Definition: WPSPageSpan.h:38
bool sendObject(Vec2f const &size, int objectId, bool ole)
sends an object as a character with given size (via its WPS8Graph )
Definition: WPS8.cpp:442
int numColumns() const
returns the number of columns
Definition: WPS8.cpp:317
basic class to store an entry in a file This contained :
Definition: WPSEntry.h:37
shared_ptr< WPS8Graph > m_graphParser
the graph parser
Definition: WPS8.h:158
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: WPSPosition.h:39
void sendTextBox(WPSPosition const &pos, int strsid, librevenge::RVNGPropertyList frameExtras=librevenge::RVNGPropertyList())
creates a subdocument to send a textbox which correspond to the strsid text zone
Definition: WPS8.cpp:429
bool parseHeaderIndexEntryEnd(long endPos, WPSEntry &hie, std::string &mess)
function which is called, if some data remains after the basic content of an entry: by default does n...
Definition: WPS8.cpp:858
bool parseHeaderIndex()
tries to find the beginning of the list of indices, then try to find all entries in this list...
Definition: WPS8.cpp:888

Generated on Mon Nov 23 2015 07:09:19 for libwps by doxygen 1.8.5