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
48 namespace SpringBoardParserInternal
49{
50 struct State;
51
52 class SubDocument;
53}
54
58 class SpringBoardParser final : public MWAWGraphicParser
59{
60 friend class SpringBoardParserInternal::SubDocument;
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
73protected:
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
95protected:
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:
MWAWDebug.hxx
MWAWInputStream.hxx
MWAWParser.hxx
MWAWEntry
basic class to store an entry in a file This contained :
Definition MWAWEntry.hxx:47
MWAWFont
Class to store font.
Definition MWAWFont.hxx:44
MWAWGraphicParser::MWAWGraphicParser
MWAWGraphicParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor (protected)
Definition MWAWParser.hxx:259
MWAWHeader
a function used by MWAWDocument to store the version of document
Definition MWAWHeader.hxx:57
SpringBoardParserInternal::SubDocument
Internal: the subdocument of a SpringBoardParser.
Definition SpringBoardParser.cxx:236
SpringBoardParser::SpringBoardParser
SpringBoardParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor
Definition SpringBoardParser.cxx:338
SpringBoardParser::m_state
std::shared_ptr< SpringBoardParserInternal::State > m_state
the state
Definition SpringBoardParser.hxx:130
SpringBoardParser::sendHeaderFooter
bool sendHeaderFooter(int hfId)
try to send a header/footer text
Definition SpringBoardParser.cxx:1695
SpringBoardParser::parse
void parse(librevenge::RVNGDrawingInterface *documentInterface) final
virtual function used to parse the input
Definition SpringBoardParser.cxx:380
SpringBoardParser::createZones
bool createZones()
finds the different objects zones
Definition SpringBoardParser.cxx:481
SpringBoardParser::readFont
bool readFont(MWAWFont &font, int szFieldSize)
try to read a font
Definition SpringBoardParser.cxx:588
SpringBoardParser::sendLinkShape
bool sendLinkShape(std::pair< int, int > const &linkId, bool isTop)
try to send a link text
Definition SpringBoardParser.cxx:1561
SpringBoardParser::parseDataList
bool parseDataList(int id, MWAWEntry const &entry)
try to parse a list of data
Definition SpringBoardParser.cxx:702
SpringBoardParser::parseLastZone
bool parseLastZone(int id, MWAWEntry const &entry)
try to parse a second entry zones
Definition SpringBoardParser.cxx:1087
SpringBoardParser::parseShape
bool parseShape(long pos, std::pair< int, int > const &pageId)
try to parse a shape
Definition SpringBoardParser.cxx:1200
SpringBoardParser::~SpringBoardParser
~SpringBoardParser() final
destructor
Definition SpringBoardParser.cxx:347
SpringBoardParser::parseParagraphStyle
bool parseParagraphStyle(MWAWEntry const &entry, MWAWVec2i const &indices)
try to parse a list of paragraph style: zone8
Definition SpringBoardParser.cxx:972
SpringBoardParser::sendFrame
bool sendFrame(std::pair< int, int > const &pageId)
try to send a frame (with a shape)
Definition SpringBoardParser.cxx:1447
SpringBoardParser::parseData
bool parseData(int id, MWAWEntry const &entry, MWAWVec2i const &indices)
try to parse some data
Definition SpringBoardParser.cxx:766
SpringBoardParser::parseFrames
bool parseFrames(int page, long pos)
try to parse a list of frames corresponding to a page
Definition SpringBoardParser.cxx:1330
SpringBoardParser::isPositionValid
bool isPositionValid(long pos) const
returns true if the position is a valid file positions, ie.
Definition SpringBoardParser.cxx:351
SpringBoardParser::createDocument
void createDocument(librevenge::RVNGDrawingInterface *documentInterface)
creates the listener which will be associated to the document
Definition SpringBoardParser.cxx:420
SpringBoardParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false) final
checks if the document header is correct (or not)
Definition SpringBoardParser.cxx:1776
SpringBoardParser::parsePageNumbering
bool parsePageNumbering(MWAWEntry const &entry)
try to parse the page numbering zone
Definition SpringBoardParser.cxx:633
SpringBoardParser::sendTextShape
bool sendTextShape(std::pair< int, int > const &pageId, int minParagraph=0, int maxParagraph=-1)
try to send a shape text
Definition SpringBoardParser.cxx:1598
SpringBoardParser::isEntryValid
bool isEntryValid(MWAWEntry const &entry) const
returns true if the zone is a valid zone positions, ie.
Definition SpringBoardParser.cxx:359
MWAWVec2i
MWAWVec2< int > MWAWVec2i
MWAWVec2 of int.
Definition libmwaw_internal.hxx:838
MWAWRSRCParserPtr
std::shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition libmwaw_internal.hxx:561
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition libmwaw_internal.hxx:551
SpringBoardParserInternal
Internal: the structures of a SpringBoardParser.
Definition SpringBoardParser.cxx:58
librevenge
Definition MWAWDocument.hxx:57
SpringBoardParserInternal::State
Internal: the state of a SpringBoardParser.
Definition SpringBoardParser.cxx:178