BeagleWksStructManager.hxx
Go to the documentation of this file.
/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
/* libmwaw
* Version: MPL 2.0 / LGPLv2+
*
* The contents of this file are subject to the Mozilla Public License Version
* 2.0 (the "License"); you may not use this file except in compliance with
* the License or as specified alternatively below. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Major Contributor(s):
* Copyright (C) 2002 William Lachance (wrlach@gmail.com)
* Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
* Copyright (C) 2006, 2007 Andrew Ziem
* Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
*
*
* All Rights Reserved.
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms of
* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
* in which case the provisions of the LGPLv2+ are applicable
* instead of those above.
*/
/*
* Parser to BeagleWorks document
*
*/
#ifndef BEAGLE_WKS_STRUCT_MANAGER
# define BEAGLE_WKS_STRUCT_MANAGER
#include <map>
#include "libmwaw_internal.hxx"
#include "MWAWCell.hxx"
#include "MWAWDebug.hxx"
namespace BeagleWksStructManagerInternal
{
struct State;
}
class BeagleWksStructManager
{
public:
struct Frame;
explicit BeagleWksStructManager(MWAWParserStatePtr const &parserState);
~BeagleWksStructManager();
bool getFrame(int fId, Frame &frame) const;
std::map<int,Frame> const &getIdFrameMap() const;
int getFontId(int fFontId) const;
void getHeaderFooterEntries(MWAWEntry &header, MWAWEntry &footer) const;
bool readFontNames(MWAWEntry const &entry);
bool readFrame(MWAWEntry const &entry);
bool readDocumentInfo();
bool readDocumentPreferences();
// resource fork
bool readPicture(int pId, librevenge::RVNGBinaryData &pict, bool readEDTP=true);
bool readwPos(MWAWEntry const &entry);
bool readFontStyle(MWAWEntry const &entry);
//
// formula data
//
/* reads a cell */
bool readCellInFormula(MWAWVec2i actPos, MWAWCellContent::FormulaInstruction &instr);
/* reads a formula */
bool readFormula(long endPos, MWAWVec2i const &pos, std::vector<MWAWCellContent::FormulaInstruction> &formula, std::string &error);
struct Frame {
Frame()
: m_charAnchor(true)
, m_id(0)
, m_pictId(0)
, m_origin()
, m_dim()
, m_page(1)
, m_wrap(0)
, m_border()
, m_bordersSet(0)
, m_extra("")
{
}
friend std::ostream &operator<<(std::ostream &o, Frame const &frm)
{
if (frm.m_id) o << "id=" << frm.m_id << ",";
if (!frm.m_charAnchor) o << "pageFrame,";
if (frm.m_page!=1) o << "page=" << frm.m_page << ",";
if (frm.m_origin[0]>0||frm.m_origin[1]>0)
o << "origin=" << frm.m_origin << ",";
o << "dim=" << frm.m_dim << ",";
if (frm.m_pictId) o << "picId=" << std::hex << frm.m_pictId << std::dec << ",";
o << frm.m_extra;
return o;
}
bool m_charAnchor;
int m_id;
int m_pictId;
MWAWVec2f m_origin;
MWAWVec2f m_dim;
int m_page;
int m_wrap;
MWAWBorder m_border;
int m_bordersSet;
std::string m_extra;
};
protected:
MWAWInputStreamPtr getInput();
libmwaw::DebugFile &ascii();
MWAWInputStreamPtr rsrcInput();
libmwaw::DebugFile &rsrcAscii();
private:
BeagleWksStructManager(BeagleWksStructManager const &orig) = delete;
BeagleWksStructManager &operator=(BeagleWksStructManager const &orig) = delete;
protected:
//
// data
//
MWAWParserStatePtr m_parserState;
std::shared_ptr<BeagleWksStructManagerInternal::State> m_state;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWCell.hxx
Defines MWAWCell (cell content and format).
MWAWDebug.hxx
BeagleWksStructManager::BeagleWksStructManager
BeagleWksStructManager(BeagleWksStructManager const &orig)=delete
BeagleWksStructManager::readCellInFormula
bool readCellInFormula(MWAWVec2i actPos, MWAWCellContent::FormulaInstruction &instr)
Definition BeagleWksStructManager.cxx:631
BeagleWksStructManager::readFrame
bool readFrame(MWAWEntry const &entry)
read the frame
Definition BeagleWksStructManager.cxx:144
BeagleWksStructManager::~BeagleWksStructManager
~BeagleWksStructManager()
destructor
Definition BeagleWksStructManager.cxx:85
BeagleWksStructManager::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition BeagleWksStructManager.hxx:171
BeagleWksStructManager::readFontStyle
bool readFontStyle(MWAWEntry const &entry)
read the font style ressource
Definition BeagleWksStructManager.cxx:550
BeagleWksStructManager::getHeaderFooterEntries
void getHeaderFooterEntries(MWAWEntry &header, MWAWEntry &footer) const
returns the header, footer entries (find by readDocumentInfo)
Definition BeagleWksStructManager.cxx:99
BeagleWksStructManager::readFormula
bool readFormula(long endPos, MWAWVec2i const &pos, std::vector< MWAWCellContent::FormulaInstruction > &formula, std::string &error)
Definition BeagleWksStructManager.cxx:706
BeagleWksStructManager::readDocumentPreferences
bool readDocumentPreferences()
read the document preferences
Definition BeagleWksStructManager.cxx:469
BeagleWksStructManager::getFrame
bool getFrame(int fId, Frame &frame) const
returns a frame corresponding to an id
Definition BeagleWksStructManager.cxx:110
BeagleWksStructManager::getFontId
int getFontId(int fFontId) const
returns a font id corresponding to a file id (or -3)
Definition BeagleWksStructManager.cxx:89
BeagleWksStructManager::getIdFrameMap
std::map< int, Frame > const & getIdFrameMap() const
returns the id to frame map
Definition BeagleWksStructManager.cxx:105
BeagleWksStructManager::getInput
MWAWInputStreamPtr getInput()
return the input input
Definition BeagleWksStructManager.cxx:121
BeagleWksStructManager::ascii
libmwaw::DebugFile & ascii()
a DebugFile used to write what we recognize when we parse the document
Definition BeagleWksStructManager.cxx:126
BeagleWksStructManager::readFontNames
bool readFontNames(MWAWEntry const &entry)
read the font names
Definition BeagleWksStructManager.cxx:332
BeagleWksStructManager::m_state
std::shared_ptr< BeagleWksStructManagerInternal::State > m_state
the state
Definition BeagleWksStructManager.hxx:174
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::readPicture
bool readPicture(int pId, librevenge::RVNGBinaryData &pict, bool readEDTP=true)
read a picture (edtp or PICT resource )
Definition BeagleWksStructManager.cxx:578
BeagleWksStructManager::operator=
BeagleWksStructManager & operator=(BeagleWksStructManager const &orig)=delete
BeagleWksStructManager::readDocumentInfo
bool readDocumentInfo()
read the document information ( pagespan + header/footer)
Definition BeagleWksStructManager.cxx:386
BeagleWksStructManager::readwPos
bool readwPos(MWAWEntry const &entry)
read the windows positions ( wPos 1001 resource block )
Definition BeagleWksStructManager.cxx:525
BeagleWksStructManager::rsrcInput
MWAWInputStreamPtr rsrcInput()
return the input input
Definition BeagleWksStructManager.cxx:131
BeagleWksStructManager::BeagleWksStructManager
BeagleWksStructManager(MWAWParserStatePtr const &parserState)
constructor
Definition BeagleWksStructManager.cxx:79
MWAWEntry
basic class to store an entry in a file This contained :
Definition MWAWEntry.hxx:47
libmwaw::DebugFile
Definition MWAWDebug.hxx:66
libmwaw_internal.hxx
MWAWVec2i
MWAWVec2< int > MWAWVec2i
MWAWVec2 of int.
Definition libmwaw_internal.hxx:838
MWAWParserStatePtr
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition libmwaw_internal.hxx:557
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
BeagleWksStructManagerInternal
Internal: the structures of a BeagleWksStructManager.
Definition BeagleWksStructManager.cxx:51
BeagleWksStructManagerInternal::State
Internal: the state of a BeagleWksStructManager.
Definition BeagleWksStructManager.cxx:55
BeagleWksStructManager::Frame
Internal: a structure use to store a frame in a BeagleWorks files.
Definition BeagleWksStructManager.hxx:103
BeagleWksStructManager::Frame::m_extra
std::string m_extra
extra data
Definition BeagleWksStructManager.hxx:150
BeagleWksStructManager::Frame::m_pictId
int m_pictId
the picture id
Definition BeagleWksStructManager.hxx:136
BeagleWksStructManager::Frame::m_dim
MWAWVec2f m_dim
the dimension
Definition BeagleWksStructManager.hxx:140
BeagleWksStructManager::Frame::m_border
MWAWBorder m_border
the border
Definition BeagleWksStructManager.hxx:146
BeagleWksStructManager::Frame::m_wrap
int m_wrap
the wrapping: 0=none, 1=rectangle, 2=irregular
Definition BeagleWksStructManager.hxx:144
BeagleWksStructManager::Frame::m_page
int m_page
the page ( for a page frame )
Definition BeagleWksStructManager.hxx:142
BeagleWksStructManager::Frame::m_bordersSet
int m_bordersSet
the list of border which are set in form libmwaw::LeftBit|...
Definition BeagleWksStructManager.hxx:148
BeagleWksStructManager::Frame::Frame
Frame()
constructor
Definition BeagleWksStructManager.hxx:105
BeagleWksStructManager::Frame::m_id
int m_id
frame id
Definition BeagleWksStructManager.hxx:134
BeagleWksStructManager::Frame::m_charAnchor
bool m_charAnchor
a flag to know if this is a char or a page frame
Definition BeagleWksStructManager.hxx:132
BeagleWksStructManager::Frame::m_origin
MWAWVec2f m_origin
the origin ( for a page frame )
Definition BeagleWksStructManager.hxx:138
BeagleWksStructManager::Frame::operator<<
friend std::ostream & operator<<(std::ostream &o, Frame const &frm)
operator<<
Definition BeagleWksStructManager.hxx:119
MWAWBorder
a border
Definition libmwaw_internal.hxx:333
MWAWCellContent::FormulaInstruction
small class use to define a formula instruction
Definition MWAWCell.hxx:397