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 
48 {
49 struct State;
50 }
57 {
58 public:
59  struct Frame;
60 
62  explicit BeagleWksStructManager(MWAWParserStatePtr parserState);
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();
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 */
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() : m_charAnchor(true), m_id(0), m_pictId(0), m_origin(), m_dim(), m_page(1),
105  m_wrap(0), m_border(), m_bordersSet(0), m_extra("")
106  {
107  }
109  friend std::ostream &operator<<(std::ostream &o, Frame const &frm)
110  {
111  if (frm.m_id) o << "id=" << frm.m_id << ",";
112  if (!frm.m_charAnchor) o << "pageFrame,";
113  if (frm.m_page!=1) o << "page=" << frm.m_page << ",";
114  if (frm.m_origin[0]>0||frm.m_origin[1]>0)
115  o << "origin=" << frm.m_origin << ",";
116  o << "dim=" << frm.m_dim << ",";
117  if (frm.m_pictId) o << "picId=" << std::hex << frm.m_pictId << std::dec << ",";
118  o << frm.m_extra;
119  return o;
120  }
124  int m_id;
126  int m_pictId;
132  int m_page;
134  int m_wrap;
140  std::string m_extra;
141  };
142 protected:
151 
152 private:
155 
156 protected:
157  //
158  // data
159  //
162 
164  shared_ptr<BeagleWksStructManagerInternal::State> m_state;
165 };
166 
167 #endif
168 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWCellContent::FormulaInstruction::F_CellList
@ F_CellList
Definition: MWAWCell.hxx:360
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:47
BeagleWksStructManager::Frame::m_dim
MWAWVec2f m_dim
the dimension
Definition: BeagleWksStructManager.hxx:130
BeagleWksStructManagerInternal::Functions::m_arity
int m_arity
Definition: BeagleWksStructManager.cxx:662
BeagleWksStructManager::BeagleWksStructManager
BeagleWksStructManager(BeagleWksStructManager const &orig)
MWAWDocument::MWAW_K_SPREADSHEET
@ MWAW_K_SPREADSHEET
spreadsheet
Definition: MWAWDocument.hxx:86
MWAW_DEBUG_MSG
#define MWAW_DEBUG_MSG(M)
Definition: libmwaw_internal.hxx:127
BeagleWksStructManager::operator=
BeagleWksStructManager & operator=(BeagleWksStructManager const &orig)
MWAWVec2f
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition: libmwaw_internal.hxx:785
libmwaw::DebugFile::addDelimiter
void addDelimiter(long pos, char c)
adds a not breaking delimiter in position pos
Definition: MWAWDebug.cxx:73
BeagleWksStructManager::Frame::m_border
MWAWBorder m_border
the border
Definition: BeagleWksStructManager.hxx:136
BeagleWksStructManager::Frame::Frame
Frame()
constructor
Definition: BeagleWksStructManager.hxx:104
MWAWCellContent::FormulaInstruction::F_Operator
@ F_Operator
Definition: MWAWCell.hxx:360
BeagleWksStructManager::readFrame
bool readFrame(MWAWEntry const &entry)
read the frame
Definition: BeagleWksStructManager.cxx:138
libmwaw::BottomBit
@ BottomBit
Definition: libmwaw_internal.hxx:168
MWAWCellContent::FormulaInstruction
small class use to define a formula instruction
Definition: MWAWCell.hxx:359
MWAWEntry::id
int id() const
returns the id
Definition: MWAWEntry.hxx:153
BeagleWksStructManager::Frame::m_id
int m_id
frame id
Definition: BeagleWksStructManager.hxx:124
MWAWPageSpan::setMarginBottom
void setMarginBottom(const double marginBottom)
set the page bottom margin
Definition: MWAWPageSpan.hxx:202
MWAWFontConverter.hxx
BeagleWksStructManagerInternal::State::m_idFrameMap
std::map< int, BeagleWksStructManager::Frame > m_idFrameMap
the map id to frame
Definition: BeagleWksStructManager.cxx:67
BeagleWksStructManager::readFormula
bool readFormula(long endPos, MWAWVec2i const &pos, std::vector< MWAWCellContent::FormulaInstruction > &formula, std::string &error)
Definition: BeagleWksStructManager.cxx:704
BeagleWksStructManager::Frame::m_origin
MWAWVec2f m_origin
the origin ( for a page frame )
Definition: BeagleWksStructManager.hxx:128
BeagleWksStructManager::getFrame
bool getFrame(int fId, Frame &frame) const
returns a frame corresponding to an id
Definition: BeagleWksStructManager.cxx:105
BeagleWksStructManager::Frame::m_page
int m_page
the page ( for a page frame )
Definition: BeagleWksStructManager.hxx:132
MWAWPageSpan::setMarginLeft
void setMarginLeft(const double marginLeft)
set the page left margin
Definition: MWAWPageSpan.hxx:187
BeagleWksStructManagerInternal::State::m_footer
MWAWEntry m_footer
the footer
Definition: BeagleWksStructManager.cxx:65
MWAWCellContent::FormulaInstruction::F_Function
@ F_Function
Definition: MWAWCell.hxx:360
BeagleWksStructManager::readPicture
bool readPicture(int pId, librevenge::RVNGBinaryData &pict, bool readEDTP=true)
read a picture (edtp or PICT resource )
Definition: BeagleWksStructManager.cxx:572
BeagleWksStructManager::m_state
shared_ptr< BeagleWksStructManagerInternal::State > m_state
the state
Definition: BeagleWksStructManager.hxx:164
MWAWParserStatePtr
shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:509
MWAWEntry::setParsed
void setParsed(bool ok=true) const
sets the flag m_parsed to true or false
Definition: MWAWEntry.hxx:115
libmwaw::DebugFile::addNote
void addNote(char const *note)
adds a note in the file, in actual position
Definition: MWAWDebug.cxx:59
MWAWCellContent::FormulaInstruction::m_content
std::string m_content
the content ( if type == F_Operator or type = F_Function or type==F_Text)
Definition: MWAWCell.hxx:376
BeagleWksStructManager::readFontNames
bool readFontNames(MWAWEntry const &entry)
read the font names
Definition: BeagleWksStructManager.cxx:329
MWAWCell.hxx
BeagleWksStructManagerInternal::Functions::m_name
char const * m_name
Definition: BeagleWksStructManager.cxx:661
MWAWCellContent::FormulaInstruction::F_Text
@ F_Text
Definition: MWAWCell.hxx:360
BeagleWksStructManager
the main class to read the structure shared between different BeagleWorks files
Definition: BeagleWksStructManager.hxx:57
BeagleWksStructManager::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition: BeagleWksStructManager.hxx:161
BeagleWksStructManager::Frame
Internal: a structure use to store a frame in a BeagleWorks files.
Definition: BeagleWksStructManager.hxx:102
BeagleWksStructManager.hxx
libmwaw::DebugFile::skipZone
void skipZone(long beginPos, long endPos)
skips the file zone defined by beginPos-endPos
Definition: MWAWDebug.hxx:105
MWAWRSRCParser.hxx
libmwaw::Debug::dumpFile
bool dumpFile(librevenge::RVNGBinaryData &data, char const *fileName)
a debug function to store in a datafile in the current directory WARNING: this function erase the fil...
Definition: MWAWDebug.cxx:197
libmwaw_internal.hxx
MWAWCellContent::FormulaInstruction::m_type
Type m_type
the type
Definition: MWAWCell.hxx:374
BeagleWksStructManager::getHeaderFooterEntries
void getHeaderFooterEntries(MWAWEntry &header, MWAWEntry &footer) const
returns the header, footer entries (find by readDocumentInfo)
Definition: BeagleWksStructManager.cxx:94
BeagleWksStructManager::rsrcInput
MWAWInputStreamPtr rsrcInput()
return the input input
Definition: BeagleWksStructManager.cxx:125
BeagleWksStructManagerInternal::State::State
State()
constructor
Definition: BeagleWksStructManager.cxx:57
MWAWBorder
a border
Definition: libmwaw_internal.hxx:314
MWAWEntry::setBegin
void setBegin(long off)
sets the begin offset
Definition: MWAWEntry.hxx:56
BeagleWksStructManagerInternal::State
Internal: the state of a BeagleWksStructManager.
Definition: BeagleWksStructManager.cxx:55
BeagleWksStructManagerInternal::State::m_header
MWAWEntry m_header
the header
Definition: BeagleWksStructManager.cxx:63
MWAWEntry::length
long length() const
returns the length of the zone
Definition: MWAWEntry.hxx:82
BeagleWksStructManager::BeagleWksStructManager
BeagleWksStructManager(MWAWParserStatePtr parserState)
constructor
Definition: BeagleWksStructManager.cxx:75
MWAWPageSpan::getFormWidth
double getFormWidth() const
returns the page width
Definition: MWAWPageSpan.hxx:116
BeagleWksStructManagerInternal::Functions
Definition: BeagleWksStructManager.cxx:660
libmwaw::RightBit
@ RightBit
Definition: libmwaw_internal.hxx:168
MWAWVec2< int >
BeagleWksStructManagerInternal::State::m_fileIdFontIdList
std::vector< int > m_fileIdFontIdList
a list to get the correspondance between fileId and fontId
Definition: BeagleWksStructManager.cxx:61
MWAWDebug.hxx
MWAWEntry::begin
long begin() const
returns the begin offset
Definition: MWAWEntry.hxx:72
MWAWEntry::setLength
void setLength(long l)
sets the zone size
Definition: MWAWEntry.hxx:61
BeagleWksStructManager::Frame::m_pictId
int m_pictId
the picture id
Definition: BeagleWksStructManager.hxx:126
MWAWCellContent::FormulaInstruction::m_longValue
double m_longValue
value ( if type==F_Long )
Definition: MWAWCell.hxx:378
BeagleWksStructManager::rsrcAscii
libmwaw::DebugFile & rsrcAscii()
a DebugFile used to write what we recognize when we parse the document in rsrc
Definition: BeagleWksStructManager.cxx:130
MWAWPageSpan::setMarginTop
void setMarginTop(const double marginTop)
set the page top margin
Definition: MWAWPageSpan.hxx:197
MWAWCellContent::FormulaInstruction::m_doubleValue
double m_doubleValue
value ( if type==F_Double )
Definition: MWAWCell.hxx:380
BeagleWksStructManager::getInput
MWAWInputStreamPtr getInput()
return the input input
Definition: BeagleWksStructManager.cxx:115
BeagleWksStructManager::getIdFrameMap
std::map< int, Frame > const & getIdFrameMap() const
returns the id to frame map
Definition: BeagleWksStructManager.cxx:100
MWAWCellContent::FormulaInstruction::F_Cell
@ F_Cell
Definition: MWAWCell.hxx:360
BeagleWksStructManager::readDocumentPreferences
bool readDocumentPreferences()
read the document preferences
Definition: BeagleWksStructManager.cxx:462
MWAWInputStreamPtr
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:503
BeagleWksStructManagerInternal::s_listFunctions
static Functions const s_listFunctions[]
Definition: BeagleWksStructManager.cxx:665
MWAWCellContent::FormulaInstruction::F_Long
@ F_Long
Definition: MWAWCell.hxx:360
MWAWEntry::end
long end() const
returns the end offset
Definition: MWAWEntry.hxx:77
BeagleWksStructManager::ascii
libmwaw::DebugFile & ascii()
a DebugFile used to write what we recognize when we parse the document
Definition: BeagleWksStructManager.cxx:120
libmwaw::LeftBit
@ LeftBit
Definition: libmwaw_internal.hxx:168
BeagleWksStructManager::getFontId
int getFontId(int fFontId) const
returns a font id corresponding to a file id (or -3)
Definition: BeagleWksStructManager.cxx:84
BeagleWksStructManagerInternal
Internal: the structures of a BeagleWksStructManager.
Definition: BeagleWksStructManager.cxx:51
BeagleWksStructManager::Frame::m_wrap
int m_wrap
the wrapping: 0=none, 1=rectangle, 2=irregular
Definition: BeagleWksStructManager.hxx:134
BeagleWksStructManager::~BeagleWksStructManager
~BeagleWksStructManager()
destructor
Definition: BeagleWksStructManager.cxx:80
MWAWCellContent::FormulaInstruction::F_Double
@ F_Double
Definition: MWAWCell.hxx:360
libmwaw::TopBit
@ TopBit
Definition: libmwaw_internal.hxx:168
MWAWCellContent::FormulaInstruction::m_position
MWAWVec2i m_position[2]
cell position ( if type==F_Cell or F_CellList )
Definition: MWAWCell.hxx:382
libmwaw::DebugFile::addPos
void addPos(long pos)
adds a new position in the file
Definition: MWAWDebug.cxx:53
MWAWPageSpan::setMarginRight
void setMarginRight(const double marginRight)
set the page right margin
Definition: MWAWPageSpan.hxx:192
MWAWEntry::valid
bool valid() const
returns true if the zone length is positive
Definition: MWAWEntry.hxx:88
MWAWRSRCParserPtr
shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:513
BeagleWksStructManager::Frame::m_charAnchor
bool m_charAnchor
a flag to know if this is a char or a page frame
Definition: BeagleWksStructManager.hxx:122
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:66
BeagleWksStructManager::readFontStyle
bool readFontStyle(MWAWEntry const &entry)
read the font style ressource
Definition: BeagleWksStructManager.cxx:544
MWAWCellContent::FormulaInstruction::m_positionRelative
MWAWVec2b m_positionRelative[2]
relative cell position ( if type==F_Cell or F_CellList )
Definition: MWAWCell.hxx:384
BeagleWksStructManager::readDocumentInfo
bool readDocumentInfo()
read the document information ( pagespan + header/footer)
Definition: BeagleWksStructManager.cxx:379
BeagleWksStructManager::readwPos
bool readwPos(MWAWEntry const &entry)
read the windows positions ( wPos 1001 resource block )
Definition: BeagleWksStructManager.cxx:518
MWAWPageSpan::getFormLength
double getFormLength() const
returns the page length
Definition: MWAWPageSpan.hxx:111
MWAWVec2b
MWAWVec2< bool > MWAWVec2b
MWAWVec2 of bool.
Definition: libmwaw_internal.hxx:779
MWAWVec2i
MWAWVec2< int > MWAWVec2i
MWAWVec2 of int.
Definition: libmwaw_internal.hxx:781
BeagleWksStructManager::Frame::m_extra
std::string m_extra
extra data
Definition: BeagleWksStructManager.hxx:140
BeagleWksStructManager::readCellInFormula
bool readCellInFormula(MWAWVec2i actPos, MWAWCellContent::FormulaInstruction &instr)
Definition: BeagleWksStructManager.cxx:626
libmwaw::DebugStream
std::stringstream DebugStream
a basic stream (if debug_with_files is not defined, does nothing)
Definition: MWAWDebug.hxx:61
BeagleWksStructManager::Frame::m_bordersSet
int m_bordersSet
the list of border which are set in form libmwaw::LeftBit|...
Definition: BeagleWksStructManager.hxx:138
MWAWParser.hxx
MWAWPageSpan
A class which defines the page properties.
Definition: MWAWPageSpan.hxx:96
BeagleWksStructManager::Frame::operator<<
friend std::ostream & operator<<(std::ostream &o, Frame const &frm)
operator<<
Definition: BeagleWksStructManager.hxx:109

Generated on Wed Jun 17 2020 06:30:08 for libmwaw by doxygen 1.8.18