ClarisDrawParser.hxx Source File documentation

ClarisDrawParser.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 CLARISDRAW_PARSER
35 # define CLARISDRAW_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 #include "ClarisWksStruct.hxx"
48
49 namespace ClarisDrawParserInternal
50 {
51 struct State;
52
53 class SubDocument;
54 }
55
56 class ClarisDrawGraph;
57 class ClarisDrawText;
58 class ClarisDrawStyleManager;
59
63 class ClarisDrawParser final : public MWAWGraphicParser
64 {
65 friend class ClarisDrawGraph;
66 friend class ClarisDrawText;
67 public:
69 ClarisDrawParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
71 ~ClarisDrawParser() final;
72
74 bool checkHeader(MWAWHeader *header, bool strict=false) final;
75
77 void parse(librevenge::RVNGDrawingInterface *documentInterface) final;
78
80 int getFileType(int zoneId) const;
82 MWAWVec2f getPageLeftTop();
84 bool sendTextZone(int number, int subZone=-1);
85
86 protected:
88 void init();
89
91 void createDocument(librevenge::RVNGDrawingInterface *documentInterface);
92
93 protected:
95 bool createZones();
97 bool readZone();
98
99 // Intermediate level
100
102 bool readDocHeader();
104 bool readLibraryHeader();
106 std::shared_ptr<ClarisWksStruct::DSET> readDSET(bool isLibHeader=false);
107
109 bool readPrintInfo();
111 bool readDocInfo();
113 bool readLayouts();
115 bool readLibraryNames();
116
117 //
118 // low level
119 //
120
121 protected:
122 //
123 // data
124 //
125
127 std::shared_ptr<ClarisDrawParserInternal::State> m_state;
129 std::shared_ptr<ClarisDrawStyleManager> m_styleManager;
131 std::shared_ptr<ClarisDrawGraph> m_graphParser;
133 std::shared_ptr<ClarisDrawText> m_textParser;
134 };
135 #endif
136 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
ClarisDrawParser::init
void init()
inits all internal variables
Definition: ClarisDrawParser.cxx:153
ClarisDrawParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false) final
checks if the document header is correct (or not)
Definition: ClarisDrawParser.cxx:1095
MWAWHeader
a function used by MWAWDocument to store the version of document
Definition: MWAWHeader.hxx:56
MWAWParser.hxx
librevenge
Definition: MWAWDocument.hxx:56
ClarisDrawParser::createDocument
void createDocument(librevenge::RVNGDrawingInterface *documentInterface)
creates the listener which will be associated to the document
Definition: ClarisDrawParser.cxx:254
ClarisDrawParser::parse
void parse(librevenge::RVNGDrawingInterface *documentInterface) final
the main parse function
Definition: ClarisDrawParser.cxx:189
ClarisWksStruct.hxx
ClarisDrawParser::m_state
std::shared_ptr< ClarisDrawParserInternal::State > m_state
the state
Definition: ClarisDrawParser.hxx:127
ClarisDrawParserInternal
Internal: the structures of a ClarisDrawParser.
Definition: ClarisDrawParser.cxx:62
ClarisDrawParser::m_styleManager
std::shared_ptr< ClarisDrawStyleManager > m_styleManager
the style manager
Definition: ClarisDrawParser.hxx:129
ClarisDrawParser::readDSET
std::shared_ptr< ClarisWksStruct::DSET > readDSET(bool isLibHeader=false)
try to read a DSET structure
Definition: ClarisDrawParser.cxx:1453
ClarisDrawParser::getPageLeftTop
MWAWVec2f getPageLeftTop()
returns the page left top point ( in inches)
Definition: ClarisDrawParser.cxx:180
ClarisDrawParser::ClarisDrawParser
ClarisDrawParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor
Definition: ClarisDrawParser.cxx:139
ClarisDrawStyleManager
the main class to read a ClarisDraw style
Definition: ClarisDrawStyleManager.hxx:59
ClarisDrawParser::readPrintInfo
bool readPrintInfo()
try to read the print info zone
Definition: ClarisDrawParser.cxx:1394
ClarisDrawParser::readDocInfo
bool readDocInfo()
try to read the document info zone
Definition: ClarisDrawParser.cxx:1348
ClarisDrawParser::m_graphParser
std::shared_ptr< ClarisDrawGraph > m_graphParser
the graph parser
Definition: ClarisDrawParser.hxx:131
MWAWRSRCParserPtr
std::shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:557
ClarisDrawParser::readLibraryNames
bool readLibraryNames()
try to read the library names(two zone)
Definition: ClarisDrawParser.cxx:1231
ClarisDrawParser::getFileType
int getFileType(int zoneId) const
returns the file type corresponding to a zone id
Definition: ClarisDrawParser.cxx:166
ClarisDrawParser::~ClarisDrawParser
~ClarisDrawParser() final
destructor
Definition: ClarisDrawParser.cxx:149
ClarisDrawParser::createZones
bool createZones()
finds the different objects zones
Definition: ClarisDrawParser.cxx:321
MWAWGraphicParser
virtual class which defines the ancestor of all graphic zone parser
Definition: MWAWParser.hxx:250
MWAWInputStream.hxx
MWAWDebug.hxx
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:547
ClarisDrawParser
the main class to read a ClarisDraw v1 file
Definition: ClarisDrawParser.hxx:63
ClarisDrawParser::readDocHeader
bool readDocHeader()
try to read a document header
Definition: ClarisDrawParser.cxx:402
ClarisDrawParser::readLayouts
bool readLayouts()
try to read the layout
Definition: ClarisDrawParser.cxx:1134
ClarisDrawParser::sendTextZone
bool sendTextZone(int number, int subZone=-1)
sends a text zone
Definition: ClarisDrawParser.cxx:175
ClarisDrawParser::readLibraryHeader
bool readLibraryHeader()
try to read the library header
Definition: ClarisDrawParser.cxx:817
ClarisWksStruct
namespace to store the main structure which appears in a ClarisDraw/ClarisWorks file ...
Definition: ClarisWksStruct.cxx:50
ClarisDrawParser::m_textParser
std::shared_ptr< ClarisDrawText > m_textParser
the text parser
Definition: ClarisDrawParser.hxx:133
ClarisDrawGraph
the main class to read the graphic part of Claris Works file
Definition: ClarisDrawGraph.hxx:73
ClarisDrawParser::readZone
bool readZone()
try to read a zone
Definition: ClarisDrawParser.cxx:360
MWAWVec2< float >
ClarisDrawText
the main class to read the text part of ClarisDraw file
Definition: ClarisDrawText.hxx:72