CanvasParser.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 CANVAS_PARSER
35 # define CANVAS_PARSER
36 
37 #include <string>
38 #include <vector>
39 
40 #include <librevenge/librevenge.h>
41 
42 #include "MWAWDebug.hxx"
43 #include "MWAWGraphicStyle.hxx"
44 #include "MWAWInputStream.hxx"
45 #include "MWAWPosition.hxx"
46 
47 #include "MWAWParser.hxx"
48 
49 namespace CanvasParserInternal
50 {
51 struct Layer;
52 struct State;
53 
54 class SubDocument;
55 }
56 
57 class CanvasGraph;
58 class CanvasStyleManager;
59 
63 class CanvasParser final : public MWAWGraphicParser
64 {
65  friend class CanvasGraph;
66  friend class CanvasStyleManager;
67 public:
69  CanvasParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
71  ~CanvasParser() final;
72 
74  bool checkHeader(MWAWHeader *header, bool strict=false) final;
75 
76  // the main parse function
77  void parse(librevenge::RVNGDrawingInterface *documentInterface) final;
78 
79 protected:
81  void createDocument(librevenge::RVNGDrawingInterface *documentInterface);
82 
83  //
84  // interface
85  //
86 
88  bool isWindowsFile() const;
89 
90 protected:
92  bool createZones();
95 
96 
97  // Intermediate level
98 
100  bool readFileHeader();
102  bool readDocumentHeader();
104  bool readBrushes();
106  bool readGrids();
108  bool readLayers();
110  bool readMacroNames();
112  bool readFormats();
114  bool readSprays();
116  bool readViews();
117 
118  //
119  // last v3 zones
120  //
121 
123  bool readEndV3();
124 
125  //
126  // Mac RSRC
127  //
128 
130  bool readRSRCFileHeader(MWAWInputStreamPtr input, MWAWEntry const &entry, libmwaw::DebugFile &ascFile);
132  bool readPrintInfo(MWAWInputStreamPtr input, MWAWEntry const &entry, libmwaw::DebugFile &ascFile);
134  bool readLPOL(MWAWInputStreamPtr input, MWAWEntry const &entry, libmwaw::DebugFile &ascFile);
136  bool readUsers(MWAWInputStreamPtr input, MWAWEntry const &entry, libmwaw::DebugFile &ascFile);
138  bool readWindows(MWAWInputStreamPtr input, MWAWEntry const &entry, libmwaw::DebugFile &ascFile);
139 
140  //
141  // Windows RSRC
142  //
143 
145  bool readRSRCWindowsFile();
147  bool readCNam(MWAWEntry const &entry);
149  bool readCSet(MWAWEntry const &entry);
151  bool readPrinterDev(MWAWEntry const &entry);
153  bool readPage(MWAWEntry const &entry);
155  bool readPrinterSST(MWAWEntry const &entry);
156 
158  bool readUnknownZoneHeader();
160  bool readUnknownZone0();
162  bool readUnknownZone1();
164  bool readUnknownZone2();
166  bool readUnknownZone3();
168  bool readUnknownZone4();
169 
170  //
171  // send data to the listener
172  //
173 
175  bool send(CanvasParserInternal::Layer const &layer);
176 
177  //
178  // low level
179  //
180 
182  bool readString(librevenge::RVNGString &string, int maxSize, bool canBeCString=false);
184  bool readString(MWAWInputStreamPtr input, librevenge::RVNGString &string, int maxSize, bool canBeCString=false);
185 
187  bool decode(long length);
188 
189  //
190  // data
191  //
193  std::shared_ptr<CanvasParserInternal::State> m_state;
195  std::shared_ptr<CanvasGraph> m_graphParser;
197  std::shared_ptr<CanvasStyleManager> m_styleManager;
198 };
199 #endif
200 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
a function used by MWAWDocument to store the version of document
Definition: MWAWHeader.hxx:56
Definition: MWAWDocument.hxx:56
the main class to read a Canvas 2 and 3 files
Definition: CanvasParser.hxx:63
namespace used to regroup all libwpd functions, enumerations which we have redefined for internal usa...
Definition: libmwaw_internal.cxx:50
std::shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:561
friend class CanvasParser
Definition: CanvasStyleManager.hxx:69
the main class to read the graphic part of Canvas file
Definition: CanvasGraph.hxx:70
the main class to read the style part of Canvas file
Definition: CanvasStyleManager.hxx:66
Internal: the structures of a CanvasParser.
Definition: CanvasParser.cxx:64
virtual class which defines the ancestor of all graphic zone parser
Definition: MWAWParser.hxx:250
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:551
std::shared_ptr< CanvasStyleManagerInternal::State > m_state
the state
Definition: CanvasStyleManager.hxx:142
MWAWInputStreamPtr & getInput()
returns the current input
Definition: CanvasStyleManager.cxx:108
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
bool readSprays()
try to read the spray

Generated on Sun Sep 27 2020 08:28:54 for libmwaw by doxygen 1.8.13