SpringBoardParser.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 SPRINGBOARD_PARSER
35 # define SPRINGBOARD_PARSER
36 
37 #include <string>
38 #include <utility>
39 #include <vector>
40 
41 #include <librevenge/librevenge.h>
42 
43 #include "MWAWDebug.hxx"
44 #include "MWAWInputStream.hxx"
45 
46 #include "MWAWParser.hxx"
47 
49 {
50 struct State;
51 
52 class SubDocument;
53 }
54 
59 {
61 public:
63  SpringBoardParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
65  ~SpringBoardParser() final;
66 
68  bool checkHeader(MWAWHeader *header, bool strict=false) final;
69 
70  // the main parse function
71  void parse(librevenge::RVNGDrawingInterface *documentInterface) final;
72 
73 protected:
75  void createDocument(librevenge::RVNGDrawingInterface *documentInterface);
77  bool parsePageNumbering(MWAWEntry const &entry);
79  bool parseDataList(int id, MWAWEntry const &entry);
81  bool parseLastZone(int id, MWAWEntry const &entry);
82 
84  bool parseFrames(int page, long pos);
85 
86  // data
87 
89  bool parseData(int id, MWAWEntry const &entry, MWAWVec2i const &indices);
91  bool parseParagraphStyle(MWAWEntry const &entry, MWAWVec2i const &indices);
93  bool parseShape(long pos, std::pair<int,int> const &pageId);
94 
95 protected:
96 
98  bool createZones();
99 
100  // Intermediate level
101 
103  bool readFont(MWAWFont &font, int szFieldSize);
104 
106  bool sendHeaderFooter(int hfId);
108  bool sendFrame(std::pair<int,int> const &pageId);
110  bool sendTextShape(std::pair<int,int> const &pageId, int minParagraph=0, int maxParagraph=-1);
112  bool sendLinkShape(std::pair<int,int> const &linkId, bool isTop);
113 
114  //
115  // low level
116  //
117 
120  bool isPositionValid(long pos) const;
123  bool isEntryValid(MWAWEntry const &entry) const;
124 
125  //
126  // data
127  //
128 
130  std::shared_ptr<SpringBoardParserInternal::State> m_state;
131 };
132 #endif
133 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
bool checkHeader(MWAWHeader *header, bool strict=false) final
checks if the document header is correct (or not)
Definition: SpringBoardParser.cxx:1776
a function used by MWAWDocument to store the version of document
Definition: MWAWHeader.hxx:56
bool parseParagraphStyle(MWAWEntry const &entry, MWAWVec2i const &indices)
try to parse a list of paragraph style: zone8
Definition: SpringBoardParser.cxx:972
bool sendLinkShape(std::pair< int, int > const &linkId, bool isTop)
try to send a link text
Definition: SpringBoardParser.cxx:1561
bool isPositionValid(long pos) const
returns true if the position is a valid file positions, ie.
Definition: SpringBoardParser.cxx:351
Definition: MWAWDocument.hxx:56
Internal: the structures of a SpringBoardParser.
Definition: SpringBoardParser.cxx:57
SpringBoardParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor
Definition: SpringBoardParser.cxx:338
bool sendFrame(std::pair< int, int > const &pageId)
try to send a frame (with a shape)
Definition: SpringBoardParser.cxx:1447
bool parseDataList(int id, MWAWEntry const &entry)
try to parse a list of data
Definition: SpringBoardParser.cxx:702
bool parseData(int id, MWAWEntry const &entry, MWAWVec2i const &indices)
try to parse some data
Definition: SpringBoardParser.cxx:766
bool parsePageNumbering(MWAWEntry const &entry)
try to parse the page numbering zone
Definition: SpringBoardParser.cxx:633
std::shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:561
Class to store font.
Definition: MWAWFont.hxx:43
the main class to read a SpringBoard v1 file
Definition: SpringBoardParser.hxx:58
Internal: the subdocument of a SpringBoardParser.
Definition: SpringBoardParser.cxx:235
bool parseLastZone(int id, MWAWEntry const &entry)
try to parse a second entry zones
Definition: SpringBoardParser.cxx:1087
void createDocument(librevenge::RVNGDrawingInterface *documentInterface)
creates the listener which will be associated to the document
Definition: SpringBoardParser.cxx:420
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
void parse(librevenge::RVNGDrawingInterface *documentInterface) final
virtual function used to parse the input
Definition: SpringBoardParser.cxx:380
std::shared_ptr< SpringBoardParserInternal::State > m_state
the state
Definition: SpringBoardParser.hxx:130
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
bool createZones()
finds the different objects zones
Definition: SpringBoardParser.cxx:481
bool isEntryValid(MWAWEntry const &entry) const
returns true if the zone is a valid zone positions, ie.
Definition: SpringBoardParser.cxx:359
bool readFont(MWAWFont &font, int szFieldSize)
try to read a font
Definition: SpringBoardParser.cxx:588
bool sendHeaderFooter(int hfId)
try to send a header/footer text
Definition: SpringBoardParser.cxx:1695
bool sendTextShape(std::pair< int, int > const &pageId, int minParagraph=0, int maxParagraph=-1)
try to send a shape text
Definition: SpringBoardParser.cxx:1598
bool parseFrames(int page, long pos)
try to parse a list of frames corresponding to a page
Definition: SpringBoardParser.cxx:1330
~SpringBoardParser() final
destructor
Definition: SpringBoardParser.cxx:347
bool parseShape(long pos, std::pair< int, int > const &pageId)
try to parse a shape
Definition: SpringBoardParser.cxx:1200

Generated on Thu May 30 2024 13:09:12 for libmwaw by doxygen 1.8.10