BeagleWksStructManager.hxx Source File documentation

BeagleWksStructManager.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 /*
35 * Parser to BeagleWorks document
36 *
37 */
38 #ifndef BEAGLE_WKS_STRUCT_MANAGER
39 # define BEAGLE_WKS_STRUCT_MANAGER
40
41 #include <map>
42
43 #include "libmwaw_internal.hxx"
44
45 #include "MWAWCell.hxx"
46
47 namespace BeagleWksStructManagerInternal
48 {
49 struct State;
50 }
56 class BeagleWksStructManager
57 {
58 public:
59 struct Frame;
60
62 explicit BeagleWksStructManager(MWAWParserStatePtr const &parserState);
64 ~BeagleWksStructManager();
65
67 bool getFrame(int fId, Frame &frame) const;
69 std::map<int,Frame> const &getIdFrameMap() const;
70
72 int getFontId(int fFontId) const;
74 void getHeaderFooterEntries(MWAWEntry &header, MWAWEntry &footer) const;
76 bool readFontNames(MWAWEntry const &entry);
78 bool readFrame(MWAWEntry const &entry);
80 bool readDocumentInfo();
82 bool readDocumentPreferences();
83
84 // resource fork
85
87 bool readPicture(int pId, librevenge::RVNGBinaryData &pict, bool readEDTP=true);
89 bool readwPos(MWAWEntry const &entry);
91 bool readFontStyle(MWAWEntry const &entry);
92
93 //
94 // formula data
95 //
96 /* reads a cell */
97 bool readCellInFormula(MWAWVec2i actPos, MWAWCellContent::FormulaInstruction &instr);
98 /* reads a formula */
99 bool readFormula(long endPos, MWAWVec2i const &pos, std::vector<MWAWCellContent::FormulaInstruction> &formula, std::string &error);
100
102 struct Frame {
104 Frame()
105 : m_charAnchor(true)
106 , m_id(0)
107 , m_pictId(0)
108 , m_origin()
109 , m_dim()
110 , m_page(1)
111 , m_wrap(0)
112 , m_border()
113 , m_bordersSet(0)
114 , m_extra("")
115 {
116 }
118 friend std::ostream &operator<<(std::ostream &o, Frame const &frm)
119 {
120 if (frm.m_id) o << "id=" << frm.m_id << ",";
121 if (!frm.m_charAnchor) o << "pageFrame,";
122 if (frm.m_page!=1) o << "page=" << frm.m_page << ",";
123 if (frm.m_origin[0]>0||frm.m_origin[1]>0)
124 o << "origin=" << frm.m_origin << ",";
125 o << "dim=" << frm.m_dim << ",";
126 if (frm.m_pictId) o << "picId=" << std::hex << frm.m_pictId << std::dec << ",";
127 o << frm.m_extra;
128 return o;
129 }
131 bool m_charAnchor;
133 int m_id;
135 int m_pictId;
137 MWAWVec2f m_origin;
139 MWAWVec2f m_dim;
141 int m_page;
143 int m_wrap;
145 MWAWBorder m_border;
147 int m_bordersSet;
149 std::string m_extra;
150 };
151 protected:
153 MWAWInputStreamPtr getInput();
155 libmwaw::DebugFile &ascii();
157 MWAWInputStreamPtr rsrcInput();
159 libmwaw::DebugFile &rsrcAscii();
160
161 private:
162 BeagleWksStructManager(BeagleWksStructManager const &orig) = delete;
163 BeagleWksStructManager &operator=(BeagleWksStructManager const &orig) = delete;
164
165 protected:
166 //
167 // data
168 //
170 MWAWParserStatePtr m_parserState;
171
173 std::shared_ptr<BeagleWksStructManagerInternal::State> m_state;
174 };
175
176 #endif
177 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWCellContent::FormulaInstruction
small class use to define a formula instruction
Definition: MWAWCell.hxx:382
BeagleWksStructManager::Frame::m_pictId
int m_pictId
the picture id
Definition: BeagleWksStructManager.hxx:135
MWAWParserStatePtr
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:555
libmwaw_internal.hxx
BeagleWksStructManager::readwPos
bool readwPos(MWAWEntry const &entry)
read the windows positions ( wPos 1001 resource block )
Definition: BeagleWksStructManager.cxx:521
libmwaw::DebugFile
an interface used to insert comment in a binary file, written in ascii form (if debug_with_files is n...
Definition: MWAWDebug.hxx:65
BeagleWksStructManager::readDocumentInfo
bool readDocumentInfo()
read the document information ( pagespan + header/footer)
Definition: BeagleWksStructManager.cxx:382
BeagleWksStructManager::rsrcInput
MWAWInputStreamPtr rsrcInput()
return the input input
Definition: BeagleWksStructManager.cxx:131
BeagleWksStructManager::readCellInFormula
bool readCellInFormula(MWAWVec2i actPos, MWAWCellContent::FormulaInstruction &instr)
Definition: BeagleWksStructManager.cxx:627
BeagleWksStructManager::Frame::m_charAnchor
bool m_charAnchor
a flag to know if this is a char or a page frame
Definition: BeagleWksStructManager.hxx:131
BeagleWksStructManager::ascii
libmwaw::DebugFile & ascii()
a DebugFile used to write what we recognize when we parse the document
Definition: BeagleWksStructManager.cxx:126
BeagleWksStructManager::getFontId
int getFontId(int fFontId) const
returns a font id corresponding to a file id (or -3)
Definition: BeagleWksStructManager.cxx:89
BeagleWksStructManager::Frame::Frame
Frame()
constructor
Definition: BeagleWksStructManager.hxx:104
BeagleWksStructManager::getIdFrameMap
std::map< int, Frame > const & getIdFrameMap() const
returns the id to frame map
Definition: BeagleWksStructManager.cxx:105
BeagleWksStructManager::~BeagleWksStructManager
~BeagleWksStructManager()
destructor
Definition: BeagleWksStructManager.cxx:85
BeagleWksStructManager::readDocumentPreferences
bool readDocumentPreferences()
read the document preferences
Definition: BeagleWksStructManager.cxx:465
BeagleWksStructManager::readFrame
bool readFrame(MWAWEntry const &entry)
read the frame
Definition: BeagleWksStructManager.cxx:144
BeagleWksStructManagerInternal
Internal: the structures of a BeagleWksStructManager.
Definition: BeagleWksStructManager.cxx:50
BeagleWksStructManager::Frame
Internal: a structure use to store a frame in a BeagleWorks files.
Definition: BeagleWksStructManager.hxx:102
BeagleWksStructManager::Frame::m_bordersSet
int m_bordersSet
the list of border which are set in form libmwaw::LeftBit|...
Definition: BeagleWksStructManager.hxx:147
MWAWBorder
a border
Definition: libmwaw_internal.hxx:333
BeagleWksStructManager::Frame::m_extra
std::string m_extra
extra data
Definition: BeagleWksStructManager.hxx:149
BeagleWksStructManager::readFormula
bool readFormula(long endPos, MWAWVec2i const &pos, std::vector< MWAWCellContent::FormulaInstruction > &formula, std::string &error)
Definition: BeagleWksStructManager.cxx:705
BeagleWksStructManager::BeagleWksStructManager
BeagleWksStructManager(MWAWParserStatePtr const &parserState)
constructor
Definition: BeagleWksStructManager.cxx:79
BeagleWksStructManager::Frame::operator<<
friend std::ostream & operator<<(std::ostream &o, Frame const &frm)
operator<<
Definition: BeagleWksStructManager.hxx:118
BeagleWksStructManager::readFontStyle
bool readFontStyle(MWAWEntry const &entry)
read the font style ressource
Definition: BeagleWksStructManager.cxx:546
BeagleWksStructManager::getFrame
bool getFrame(int fId, Frame &frame) const
returns a frame corresponding to an id
Definition: BeagleWksStructManager.cxx:110
BeagleWksStructManager::Frame::m_wrap
int m_wrap
the wrapping: 0=none, 1=rectangle, 2=irregular
Definition: BeagleWksStructManager.hxx:143
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:549
BeagleWksStructManager::m_state
std::shared_ptr< BeagleWksStructManagerInternal::State > m_state
the state
Definition: BeagleWksStructManager.hxx:173
BeagleWksStructManager::Frame::m_id
int m_id
frame id
Definition: BeagleWksStructManager.hxx:133
BeagleWksStructManager::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition: BeagleWksStructManager.hxx:170
BeagleWksStructManager
the main class to read the structure shared between different BeagleWorks files
Definition: BeagleWksStructManager.hxx:56
MWAWCell.hxx
Defines MWAWCell (cell content and format)
BeagleWksStructManager::getHeaderFooterEntries
void getHeaderFooterEntries(MWAWEntry &header, MWAWEntry &footer) const
returns the header, footer entries (find by readDocumentInfo)
Definition: BeagleWksStructManager.cxx:99
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
BeagleWksStructManager::Frame::m_border
MWAWBorder m_border
the border
Definition: BeagleWksStructManager.hxx:145
BeagleWksStructManager::Frame::m_page
int m_page
the page ( for a page frame )
Definition: BeagleWksStructManager.hxx:141
BeagleWksStructManager::Frame::m_dim
MWAWVec2f m_dim
the dimension
Definition: BeagleWksStructManager.hxx:139
BeagleWksStructManager::getInput
MWAWInputStreamPtr getInput()
return the input input
Definition: BeagleWksStructManager.cxx:121
BeagleWksStructManager::rsrcAscii
libmwaw::DebugFile & rsrcAscii()
a DebugFile used to write what we recognize when we parse the document in rsrc
Definition: BeagleWksStructManager.cxx:136
BeagleWksStructManager::Frame::m_origin
MWAWVec2f m_origin
the origin ( for a page frame )
Definition: BeagleWksStructManager.hxx:137
BeagleWksStructManager::readFontNames
bool readFontNames(MWAWEntry const &entry)
read the font names
Definition: BeagleWksStructManager.cxx:332
MWAWVec2< int >
BeagleWksStructManager::operator=
BeagleWksStructManager & operator=(BeagleWksStructManager const &orig)=delete
BeagleWksStructManager::readPicture
bool readPicture(int pId, librevenge::RVNGBinaryData &pict, bool readEDTP=true)
read a picture (edtp or PICT resource )
Definition: BeagleWksStructManager.cxx:574