ScoopParser.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 SCOOP_PARSER
35 # define SCOOP_PARSER
36 
37 #include <string>
38 #include <vector>
39 
40 #include <librevenge/librevenge.h>
41 
42 #include "MWAWDebug.hxx"
43 #include "MWAWInputStream.hxx"
44 
45 #include "MWAWParser.hxx"
46 
47 namespace ScoopParserInternal
48 {
49 struct FrameZone;
50 struct Paragraph;
51 struct Shape;
52 struct TextZone;
53 
54 struct State;
55 
56 class SubDocument;
57 }
58 
62 class ScoopParser final : public MWAWGraphicParser
63 {
65 public:
67  ScoopParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
69  ~ScoopParser() final;
70 
72  bool checkHeader(MWAWHeader *header, bool strict=false) final;
73 
74  // the main parse function
75  void parse(librevenge::RVNGDrawingInterface *documentInterface) final;
76 
77 protected:
79  void createDocument(librevenge::RVNGDrawingInterface *documentInterface);
80 
81 protected:
83  bool createZones();
84 
85  // Intermediate level
86 
88  bool readPrintInfo();
90  bool readHeader();
91 
94  bool readTextZone(ScoopParserInternal::TextZone &tZone);
96  bool readTextZoneParagraph(ScoopParserInternal::Paragraph &para, int id);
97 
99  bool readFont(MWAWFont &font);
101  bool readParagraph(MWAWParagraph &para, bool define=false);
103  bool readText(MWAWEntry &entry, std::string const &what);
104 
106  bool readShapesList(std::vector<ScoopParserInternal::Shape> &shapes);
108  bool readShape(ScoopParserInternal::Shape &shape, int id);
110  bool readBitmap(MWAWEntry const &entry, MWAWEmbeddedObject &object, bool compressed=true);
111 
112  //
113  // low level
114  //
115 
116  //
117  // data
118  //
119 
121  bool send(ScoopParserInternal::Shape const &shape, MWAWVec2i const &decal);
123  bool sendText(long tZoneId, int subZone);
125  bool sendText(ScoopParserInternal::Paragraph const &paragraph);
126 
128  std::shared_ptr<ScoopParserInternal::State> m_state;
129 };
130 #endif
131 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
bool sendText(long tZoneId, int subZone)
try to send the text of a text zone
Definition: ScoopParser.cxx:747
a function used by MWAWDocument to store the version of document
Definition: MWAWHeader.hxx:56
Internal: the subdocument of a ScoopParser.
Definition: ScoopParser.cxx:293
bool checkHeader(MWAWHeader *header, bool strict=false) final
checks if the document header is correct (or not)
Definition: ScoopParser.cxx:1921
Definition: MWAWDocument.hxx:56
bool readParagraph(MWAWParagraph &para, bool define=false)
try to read a paragraph style
Definition: ScoopParser.cxx:1295
Internal: the structures of a ScoopParser.
Definition: ScoopParser.cxx:56
bool readText(MWAWEntry &entry, std::string const &what)
try to read a text zone
Definition: ScoopParser.cxx:1496
bool readTextZoneParagraph(ScoopParserInternal::Paragraph &para, int id)
try to read a frame paragraph
Definition: ScoopParser.cxx:1061
std::shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:561
Class to store font.
Definition: MWAWFont.hxx:43
void parse(librevenge::RVNGDrawingInterface *documentInterface) final
virtual function used to parse the input
Definition: ScoopParser.cxx:367
ScoopParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor
Definition: ScoopParser.cxx:351
~ScoopParser() final
destructor
Definition: ScoopParser.cxx:360
bool readPrintInfo()
try to read the print info zone
Definition: ScoopParser.cxx:2071
small class use to define a embedded object
Definition: libmwaw_internal.hxx:467
bool readHeader()
try to the header zone
Definition: ScoopParser.cxx:1957
bool readFont(MWAWFont &font)
try to read a font style
Definition: ScoopParser.cxx:1250
the main class to read a Scoop v1 file
Definition: ScoopParser.hxx:62
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
bool createZones()
finds the different objects zones
Definition: ScoopParser.cxx:467
class to store the paragraph properties
Definition: MWAWParagraph.hxx:84
std::shared_ptr< ScoopParserInternal::State > m_state
the state
Definition: ScoopParser.hxx:128
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
void createDocument(librevenge::RVNGDrawingInterface *documentInterface)
creates the listener which will be associated to the document
Definition: ScoopParser.cxx:425
bool readBitmap(MWAWEntry const &entry, MWAWEmbeddedObject &object, bool compressed=true)
try to read a bitmap
Definition: ScoopParser.cxx:1840
bool send(ScoopParserInternal::Shape const &shape, MWAWVec2i const &decal)
try to send a shape
Definition: ScoopParser.cxx:501
bool readTextZone(ScoopParserInternal::TextZone &tZone)
try to read the data associated to a text zone: its name, its content, the list of shape which displa...
Definition: ScoopParser.cxx:842
bool readShape(ScoopParserInternal::Shape &shape, int id)
try to read a shape
Definition: ScoopParser.cxx:1561
bool readShapesList(std::vector< ScoopParserInternal::Shape > &shapes)
try to read a list of shape
Definition: ScoopParser.cxx:1524

Generated for libmwaw by doxygen 1.8.14