MSW1Parser.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2 
3 /* libmwaw
4 * Version: MPL 2.0 / LGPLv2+
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 2.0 (the "License"); you may not use this file except in compliance with
8 * the License or as specified alternatively below. You may obtain a copy of
9 * the License at http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * Major Contributor(s):
17 * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
18 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
22 *
23 *
24 * All Rights Reserved.
25 *
26 * For minor contributions see the git repository.
27 *
28 * Alternatively, the contents of this file may be used under the terms of
29 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30 * in which case the provisions of the LGPLv2+ are applicable
31 * instead of those above.
32 */
33 
34 #ifndef MSW1_PARSER
35 # define MSW1_PARSER
36 
37 #include <vector>
38 
39 #include "MWAWPageSpan.hxx"
40 
41 #include "MWAWDebug.hxx"
42 #include "MWAWInputStream.hxx"
43 
44 #include "MWAWParser.hxx"
45 
46 class MWAWEntry;
47 
48 namespace MSW1ParserInternal
49 {
50 struct Font;
51 struct Paragraph;
52 struct State;
53 class SubDocument;
54 }
55 
61 class MSW1Parser : public MWAWParser
62 {
64 public:
66  MSW1Parser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
68  virtual ~MSW1Parser();
69 
71  bool checkHeader(MWAWHeader *header, bool strict=false);
72 
73  // the main parse function
74  void parse(WPXDocumentInterface *documentInterface);
75 
76 protected:
78  void init();
81 
83  void createDocument(WPXDocumentInterface *documentInterface);
84 
86  void sendMain();
87 
89  float pageHeight() const;
91  float pageWidth() const;
92 
94  void newPage(int number);
95 
96 
98  bool createZones();
99 
101  bool sendText(MWAWEntry const &entry, bool main=false);
102 
103  //
104  // internal level
105  //
106 
108  bool readFont(long fPos, MSW1ParserInternal::Font &font);
109 
111  bool readParagraph(long fPos, MSW1ParserInternal::Paragraph &para);
112 
114  bool readFootnoteCorrespondance(Vec2i limit);
115 
117  bool readDocInfo(Vec2i limit);
119  bool readZones(Vec2i limit);
121  bool readPageBreak(Vec2i limit);
122 
124  bool prepareTextZones();
125 
126  //
127  // low level
128  //
129 
131  bool isFilePos(long pos);
133  void removeLastCharIfEOL(MWAWEntry &entry);
135  bool readPLC(Vec2i limits, int wh);
136 
138  void setProperty(MSW1ParserInternal::Paragraph const &para);
139 
140 
141 protected:
142  //
143  // data
144  //
146  shared_ptr<MSW1ParserInternal::State> m_state;
147 
150 };
151 #endif
152 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:

Generated on Sat May 4 2013 20:11:08 for libmwaw by doxygen 1.8.3.1