MsWrdParser.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 /*
35  * parser for Microsoft Word ( version 3.0-5.1 )
36  */
37 #ifndef MS_WRD_MWAW_PARSER
38 # define MS_WRD_MWAW_PARSER
39 
40 #include <list>
41 #include <map>
42 #include <string>
43 #include <vector>
44 
45 #include "MWAWDebug.hxx"
46 #include "MWAWEntry.hxx"
47 #include "MWAWInputStream.hxx"
48 #include "MWAWPosition.hxx"
49 
50 #include "MWAWParser.hxx"
51 
52 namespace MsWrdParserInternal
53 {
54 struct Object;
55 struct State;
56 class SubDocument;
57 }
58 
59 class MsWrdText;
60 class MsWrdTextStyles;
61 
63 struct MsWrdEntry : public MWAWEntry {
65  {
66  }
71  int pictType() const
72  {
73  return m_pictType;
74  }
76  void setPictType(int newId)
77  {
78  m_pictType = newId;
79  }
81  friend std::ostream &operator<<(std::ostream &o, MsWrdEntry const &entry);
84 };
85 
92 {
93  friend class MsWrdText;
94  friend class MsWrdTextStyles;
96 
97 public:
99  MsWrdParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
101  virtual ~MsWrdParser();
102 
104  bool checkHeader(MWAWHeader *header, bool strict=false);
105 
107  void parse(librevenge::RVNGTextInterface *documentInterface);
108 
109 protected:
111  void init();
112 
114  void createDocument(librevenge::RVNGTextInterface *documentInterface);
115 
117  bool createZones();
118 
120  bool readHeaderEndV3();
121 
123  bool readZoneList();
124 
126  bool readPrintInfo(MsWrdEntry &entry);
127 
129  bool readPrinter(MsWrdEntry &entry);
130 
132  bool readDocSum(MsWrdEntry &entry);
133 
135  bool readStringsZone(MsWrdEntry &entry, std::vector<std::string> &list);
136 
138  bool readObjects();
139 
141  bool readObjectList(MsWrdEntry &entry);
142 
144  bool readObjectFlags(MsWrdEntry &entry);
145 
148 
150  bool readDocumentInfo(MsWrdEntry &entry);
151 
153  bool readZone17(MsWrdEntry &entry);
154 
156  bool checkPicturePos(long pos, int type);
157 
159  bool readPicture(MsWrdEntry &entry);
161  void sendPicture(long fPos, int cPos, MWAWPosition::AnchorTo anchor=MWAWPosition::Char);
162 
164  bool getColor(int id, MWAWColor &col) const;
165 
167  void newPage(int number);
168 
169  /*
170  * interface with subdocument
171  */
173  void sendFootnote(int id);
174 
176  void sendFieldComment(int id);
177 
179  void send(int id, libmwaw::SubDocumentType type);
181  void send(MWAWEntry const &entry);
182 
183  //
184  // low level
185  //
186 
188  MsWrdEntry readEntry(std::string type, int id=-1);
189 
190 protected:
191  //
192  // data
193  //
195  shared_ptr<MsWrdParserInternal::State> m_state;
196 
198  std::multimap<std::string, MsWrdEntry> m_entryMap;
199 
201  shared_ptr<MsWrdText> m_textParser;
202 };
203 #endif
204 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:

Generated on Tue Mar 1 2016 23:42:50 for libmwaw by doxygen 1.8.4