Debian Codegraph @

src/lib/BeagleWksBMParser.hxx

raw
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 ([email protected])
18 * Copyright (C) 2002,2004 Marc Maurer ([email protected])
19 * Copyright (C) 2004-2006 Fridrich Strba ([email protected])
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent ([email protected])
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_BM_PARSER
35 # define BEAGLE_WKS_BM_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 BeagleWksBMParserInternal
52 {
53 struct Bitmap;
54
55 struct State;
56 }
57
58 class BeagleWksStructManager;
59
60 /** \brief the main class to read a BeagleWorks bitmap file
61 */
62 class BeagleWksBMParser final : public MWAWGraphicParser
63 {
64 public:
65 //! constructor
66 BeagleWksBMParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
67 //! destructor
68 ~BeagleWksBMParser() final;
69
70 //! checks if the document header is correct (or not)
71 bool checkHeader(MWAWHeader *header, bool strict=false) final;
72
73 // the main parse function
74 void parse(librevenge::RVNGDrawingInterface *documentInterface) final;
75
76 protected:
77 //! inits all internal variables
78 void init();
79
80 //! creates the listener which will be associated to the document
81 void createDocument(librevenge::RVNGDrawingInterface *documentInterface);
82
83 //! returns the page left top point ( in inches)
84 MWAWVec2f getPageLeftTop() const;
85 //! adds a new page
86 void newPage(int number);
87
88 protected:
89 //! finds the different objects zones
90 bool createZones();
91
92 //! read the resource fork zone
93 bool readRSRCZones();
94
95 // send data
96
97 //! try to send the bitmap
98 bool sendBitmap();
99 //! try to send the page graphic
100 bool sendPageFrames();
101 //! try to send a frame
102 bool sendFrame(BeagleWksStructManager::Frame const &frame);
103 //! try to send a picture
104 bool sendPicture(int pId, MWAWPosition const &pos,
105 MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle());
106
107 //
108 // low level
109 //
110
111 // data fork similar than in BeagleWksParser ...
112
113 //! read the print info zone
114 bool readPrintInfo();
115
116 // data fork
117
118 //! read the preference color map
119 bool readPrefColorMap();
120 //! read the bitmap color map (if colored bitmap)
121 bool readColorMap();
122 //! try to read a bitmap
123 bool readBitmap(bool onlyCheck = false);
124
125 // resource fork
126
127 //! return the input input
128 MWAWInputStreamPtr rsrcInput();
129
130 //! a DebugFile used to write what we recognize when we parse the document in rsrc
131 libmwaw::DebugFile &rsrcAscii();
132
133
134 //! the state
135 std::shared_ptr<BeagleWksBMParserInternal::State> m_state;
136
137 //! the structure manager
138 std::shared_ptr<BeagleWksStructManager> m_structureManager;
139 };
140 #endif
141 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: