BeagleWksSSParser.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 BEAGLE_WKS_SS_PARSER
35# define BEAGLE_WKS_SS_PARSER
36
37#include <string>
38#include <vector>
39
40#include <librevenge/librevenge.h>
41
42#include "MWAWCell.hxx"
43#include "MWAWDebug.hxx"
44#include "MWAWGraphicStyle.hxx"
45#include "MWAWInputStream.hxx"
46
47#include "MWAWParser.hxx"
48
49#include "BeagleWksStructManager.hxx"
50
51 namespace BeagleWksSSParserInternal
52{
53 class SubDocument;
54
55 struct Cell;
56 struct Chart;
57 struct Spreadsheet;
58 struct State;
59}
60
61 class BeagleWksStructManager;
62
65 class BeagleWksSSParser final : public MWAWSpreadsheetParser
66{
67 friend struct BeagleWksSSParserInternal::Chart;
68 friend class BeagleWksSSParserInternal::SubDocument;
69 public:
71 BeagleWksSSParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
73 ~BeagleWksSSParser() final;
74
76 bool checkHeader(MWAWHeader *header, bool strict=false) final;
77
78 // the main parse function
79 void parse(librevenge::RVNGSpreadsheetInterface *documentInterface) final;
80
81protected:
83 void init();
84
86 void createDocument(librevenge::RVNGSpreadsheetInterface *documentInterface);
87
89 MWAWVec2f getPageLeftTop() const;
91 void newPage(int number);
92
94 bool sendSpreadsheet();
96 bool sendText(MWAWEntry const &entry, bool headerFooter=false);
98 bool sendPageFrames();
100 bool sendFrame(BeagleWksStructManager::Frame const &frame);
102 bool sendPicture(int pId, MWAWPosition const &pos,
103 MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle());
104protected:
106 bool createZones();
107
109 bool readRSRCZones();
110
111 //
112 // low level
113 //
114
115 // data fork similar than in BeagleWksParser ...
116
118 bool readPrintInfo();
119
120 // data fork
121
123 bool readChartZone();
124
126 bool readChart();
127
129 bool readSpreadsheet();
130
132 bool readRowSheet(BeagleWksSSParserInternal::Spreadsheet &sheet);
133
135 bool readCellSheet(BeagleWksSSParserInternal::Cell &cell);
136
138 bool readZone0();
139
141 bool readColumnWidths(BeagleWksSSParserInternal::Spreadsheet &sheet);
142
144 bool readFormula(BeagleWksSSParserInternal::Spreadsheet &sheet);
145
146 // resource fork
147
149 MWAWInputStreamPtr rsrcInput();
150
152 libmwaw::DebugFile &rsrcAscii();
153
155 std::shared_ptr<BeagleWksSSParserInternal::State> m_state;
156
158 std::shared_ptr<BeagleWksStructManager> m_structureManager;
159};
160#endif
161// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
BeagleWksStructManager.hxx
MWAWCell.hxx
Defines MWAWCell (cell content and format).
MWAWDebug.hxx
MWAWGraphicStyle.hxx
MWAWInputStream.hxx
MWAWParser.hxx
BeagleWksSSParserInternal::SubDocument
Internal: the subdocument of a BeagleWksSSParser.
Definition BeagleWksSSParser.cxx:272
BeagleWksSSParser::createZones
bool createZones()
finds the different objects zones
Definition BeagleWksSSParser.cxx:457
BeagleWksSSParser::readSpreadsheet
bool readSpreadsheet()
read the spreadsheet zone
Definition BeagleWksSSParser.cxx:943
BeagleWksSSParser::rsrcAscii
libmwaw::DebugFile & rsrcAscii()
a DebugFile used to write what we recognize when we parse the document in rsrc
Definition BeagleWksSSParser.cxx:348
BeagleWksSSParser::sendPicture
bool sendPicture(int pId, MWAWPosition const &pos, MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle())
try to send a picture
Definition BeagleWksSSParser.cxx:1446
BeagleWksSSParser::rsrcInput
MWAWInputStreamPtr rsrcInput()
return the input input
Definition BeagleWksSSParser.cxx:343
BeagleWksSSParser::sendText
bool sendText(MWAWEntry const &entry, bool headerFooter=false)
try to send a text zone
Definition BeagleWksSSParser.cxx:1471
BeagleWksSSParser::readPrintInfo
bool readPrintInfo()
read the print info zone
Definition BeagleWksSSParser.cxx:580
BeagleWksSSParser::readFormula
bool readFormula(BeagleWksSSParserInternal::Spreadsheet &sheet)
read the differents formula
Definition BeagleWksSSParser.cxx:1374
BeagleWksSSParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false) final
checks if the document header is correct (or not)
Definition BeagleWksSSParser.cxx:1576
BeagleWksSSParser::readColumnWidths
bool readColumnWidths(BeagleWksSSParserInternal::Spreadsheet &sheet)
read the columns widths
Definition BeagleWksSSParser.cxx:1326
BeagleWksSSParser::readRSRCZones
bool readRSRCZones()
read the resource fork zone
Definition BeagleWksSSParser.cxx:542
BeagleWksSSParser::sendPageFrames
bool sendPageFrames()
try to send the page graphic
Definition BeagleWksSSParser.cxx:1423
BeagleWksSSParser::readCellSheet
bool readCellSheet(BeagleWksSSParserInternal::Cell &cell)
read a cell row
Definition BeagleWksSSParser.cxx:1024
BeagleWksSSParser::getPageLeftTop
MWAWVec2f getPageLeftTop() const
returns the page left top point ( in inches)
Definition BeagleWksSSParser.cxx:356
BeagleWksSSParser::sendSpreadsheet
bool sendSpreadsheet()
try to send the main spreadsheet
Definition BeagleWksSSParser.cxx:1507
BeagleWksSSParser::readChart
bool readChart()
read a chart
Definition BeagleWksSSParser.cxx:670
BeagleWksSSParser::readRowSheet
bool readRowSheet(BeagleWksSSParserInternal::Spreadsheet &sheet)
read the spreadsheet row
Definition BeagleWksSSParser.cxx:975
BeagleWksSSParser::readChartZone
bool readChartZone()
read the chart zone
Definition BeagleWksSSParser.cxx:636
BeagleWksSSParser::parse
void parse(librevenge::RVNGSpreadsheetInterface *documentInterface) final
virtual function used to parse the input
Definition BeagleWksSSParser.cxx:381
BeagleWksSSParser::~BeagleWksSSParser
~BeagleWksSSParser() final
destructor
Definition BeagleWksSSParser.cxx:327
BeagleWksSSParser::m_structureManager
std::shared_ptr< BeagleWksStructManager > m_structureManager
the structure manager
Definition BeagleWksSSParser.hxx:158
BeagleWksSSParser::newPage
void newPage(int number)
adds a new page
Definition BeagleWksSSParser.cxx:365
BeagleWksSSParser::init
void init()
inits all internal variables
Definition BeagleWksSSParser.cxx:331
BeagleWksSSParser::m_state
std::shared_ptr< BeagleWksSSParserInternal::State > m_state
the state
Definition BeagleWksSSParser.hxx:155
BeagleWksSSParser::readZone0
bool readZone0()
read an unknown zone ( which appears before and after the columns's width zone )
Definition BeagleWksSSParser.cxx:1305
BeagleWksSSParser::BeagleWksSSParser
BeagleWksSSParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor
Definition BeagleWksSSParser.cxx:319
BeagleWksSSParser::createDocument
void createDocument(librevenge::RVNGSpreadsheetInterface *documentInterface)
creates the listener which will be associated to the document
Definition BeagleWksSSParser.cxx:410
BeagleWksSSParser::sendFrame
bool sendFrame(BeagleWksStructManager::Frame const &frame)
try to send a frame
Definition BeagleWksSSParser.cxx:1431
BeagleWksStructManager
the main class to read the structure shared between different BeagleWorks files
Definition BeagleWksStructManager.hxx:58
MWAWEntry
basic class to store an entry in a file This contained :
Definition MWAWEntry.hxx:47
MWAWGraphicStyle
a structure used to define a picture style
Definition MWAWGraphicStyle.hxx:48
MWAWHeader
a function used by MWAWDocument to store the version of document
Definition MWAWHeader.hxx:57
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document.
Definition MWAWPosition.hxx:48
MWAWSpreadsheetParser::MWAWSpreadsheetParser
MWAWSpreadsheetParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor (protected)
Definition MWAWParser.hxx:291
MWAWRSRCParserPtr
std::shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition libmwaw_internal.hxx:561
MWAWVec2f
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition libmwaw_internal.hxx:842
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition libmwaw_internal.hxx:551
BeagleWksSSParserInternal
Internal: the structures of a BeagleWksSSParser.
Definition BeagleWksSSParser.cxx:61
libmwaw
namespace used to regroup all libwpd functions, enumerations which we have redefined for internal usa...
Definition libmwaw_internal.cxx:51
librevenge
Definition MWAWDocument.hxx:57
BeagleWksSSParserInternal::Cell
Internal: the cell of a BeagleWksSSParser.
Definition BeagleWksSSParser.cxx:63
BeagleWksSSParserInternal::Chart
Internal: the chart of a BeagleWksSSParser.
Definition BeagleWksSSParser.cxx:173
BeagleWksSSParserInternal::Spreadsheet
Internal: the spreadsheet of a BeagleWksSSParser.
Definition BeagleWksSSParser.cxx:89
BeagleWksSSParserInternal::State
Internal: the state of a BeagleWksSSParser.
Definition BeagleWksSSParser.cxx:206