RagTimeParser.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.
*/
#ifndef RAG_TIME_PARSER
# define RAG_TIME_PARSER
#include <set>
#include <vector>
#include "MWAWDebug.hxx"
#include "MWAWInputStream.hxx"
#include "MWAWParser.hxx"
namespace RagTimeParserInternal
{
struct Picture;
struct State;
class SubDocument;
}
class RagTimeText;
class RagTimeSpreadsheet;
class RagTimeParser final : public MWAWTextParser
{
friend class RagTimeParserInternal::SubDocument;
friend class RagTimeText;
friend class RagTimeSpreadsheet;
public:
RagTimeParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header);
~RagTimeParser() final;
bool checkHeader(MWAWHeader *header, bool strict=false) final;
// the main parse function
void parse(librevenge::RVNGTextInterface *documentInterface) final;
protected:
void init();
//
// interface
//
bool getColor(int colId, MWAWColor &color, int listId=-1) const;
bool getDateTimeFormat(int dtId, std::string &dtFormat) const;
int getZoneDataFieldSize(int zId) const;
int getNewZoneId();
//
// interface with text parser
//
int getFontId(int localId) const;
bool getCharStyle(int charId, MWAWFont &font) const;
bool readTextZone(MWAWEntry &entry, int width, MWAWColor const &fontColor=MWAWColor::black());
void createDocument(librevenge::RVNGTextInterface *documentInterface);
bool sendZones();
void newPage(int number);
bool createZones();
bool findDataZones();
bool readDataZoneHeader(int id, long endPos);
bool findPagesZones();
bool findRsrcZones();
bool sendPageZone(int page);
bool send(int zId);
bool sendText(int zId, MWAWListenerPtr listener);
bool sendPicture(int zId, MWAWPosition const &pos);
bool sendBitmap(RagTimeParserInternal::Picture const &pict, MWAWPosition const &pos);
bool sendBasicPicture(int zId, MWAWPosition const &pos);
void flushExtra();
bool readPageZone(MWAWEntry &entry);
bool readPictZone(MWAWEntry &entry);
bool readPictZoneV2(MWAWEntry &entry);
// some rsrc zone
bool readColorMapV2(MWAWEntry &entry);
bool readColorsMap();
bool readPrintInfo(MWAWEntry &entry, bool inRSRCFork=false);
bool readLinks(MWAWEntry &entry);
bool readFormatsMap();
bool readMacroFormats(MWAWEntry &entry);
bool readColorTable(MWAWEntry &entry);
// unknown data fork zone
bool readZone6(MWAWEntry &entry);
// unknown rsrc fork zone
bool readRsrcBeDc(MWAWEntry &entry);
bool readRsrcStructured(MWAWEntry &entry);
bool readRsrcBtch(MWAWEntry &entry);
bool readRsrcCalc(MWAWEntry &entry);
bool readRsrcfppr(MWAWEntry &entry);
bool readRsrcSele(MWAWEntry &entry);
// maybe FH=footer/header zone
bool readRsrcFHwl(MWAWEntry &entry);
protected:
//
// data
//
std::shared_ptr<RagTimeParserInternal::State> m_state;
std::shared_ptr<RagTimeSpreadsheet> m_spreadsheetParser;
std::shared_ptr<RagTimeText> m_textParser;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWDebug.hxx
MWAWInputStream.hxx
MWAWParser.hxx
MWAWEntry
basic class to store an entry in a file This contained :
Definition MWAWEntry.hxx:47
MWAWFont
Class to store font.
Definition MWAWFont.hxx:44
MWAWHeader
a function used by MWAWDocument to store the version of document
Definition MWAWHeader.hxx:57
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document.
Definition MWAWPosition.hxx:48
MWAWTextParser::MWAWTextParser
MWAWTextParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor (protected)
Definition MWAWParser.hxx:307
RagTimeParserInternal::SubDocument
Internal: the subdocument of a RagTimeParser.
Definition RagTimeParser.cxx:339
RagTimeParser::readRsrcBtch
bool readRsrcBtch(MWAWEntry &entry)
try to read the Btch zone (zone with id=0)
Definition RagTimeParser.cxx:2152
RagTimeParser::RagTimeSpreadsheet
friend class RagTimeSpreadsheet
Definition RagTimeParser.hxx:64
RagTimeParser::readTextZone
bool readTextZone(MWAWEntry &entry, int width, MWAWColor const &fontColor=MWAWColor::black())
try to read a text zone (knowing the zone width in point and the font color)
Definition RagTimeParser.cxx:457
RagTimeParser::readPageZone
bool readPageZone(MWAWEntry &entry)
try to read page zone ( unknown content of size 40).
Definition RagTimeParser.cxx:1706
RagTimeParser::readRsrcfppr
bool readRsrcfppr(MWAWEntry &entry)
try to read the fppr zone (zone with id=0)
Definition RagTimeParser.cxx:2184
RagTimeParser::sendBitmap
bool sendBitmap(RagTimeParserInternal::Picture const &pict, MWAWPosition const &pos)
sends a bitmap
Definition RagTimeParser.cxx:2487
RagTimeParser::findRsrcZones
bool findRsrcZones()
try to create the resource zones list
Definition RagTimeParser.cxx:1080
RagTimeParser::readColorsMap
bool readColorsMap()
try to read the color map:v3
Definition RagTimeParser.cxx:1429
RagTimeParser::sendPicture
bool sendPicture(int zId, MWAWPosition const &pos)
sends the picture
Definition RagTimeParser.cxx:2394
RagTimeParser::createZones
bool createZones()
finds the different objects zones
Definition RagTimeParser.cxx:562
RagTimeParser::readColorTable
bool readColorTable(MWAWEntry &entry)
try to read the color table zone: CHTa zones
Definition RagTimeParser.cxx:1836
RagTimeParser::readRsrcCalc
bool readRsrcCalc(MWAWEntry &entry)
try to read the Calc zone (zone with id=0)
Definition RagTimeParser.cxx:2009
RagTimeParser::findPagesZones
bool findPagesZones()
try to sort the zone on each page
Definition RagTimeParser.cxx:761
RagTimeParser::readFormatsMap
bool readFormatsMap()
try to read the format map:v3
Definition RagTimeParser.cxx:1824
RagTimeParser::m_spreadsheetParser
std::shared_ptr< RagTimeSpreadsheet > m_spreadsheetParser
the spreadsheet parser
Definition RagTimeParser.hxx:200
RagTimeParser::getCharStyle
bool getCharStyle(int charId, MWAWFont &font) const
returns font style corresponding to a char style id
Definition RagTimeParser.cxx:422
RagTimeParser::readPictZoneV2
bool readPictZoneV2(MWAWEntry &entry)
try to read pictZone ( a big zone):v2
Definition RagTimeParser.cxx:1310
RagTimeParser::sendPageZone
bool sendPageZone(int page)
try to send the different zones of a page
Definition RagTimeParser.cxx:2572
RagTimeParser::init
void init()
inits all internal variables
Definition RagTimeParser.cxx:403
RagTimeParser::readRsrcStructured
bool readRsrcStructured(MWAWEntry &entry)
try to read a structured zone
Definition RagTimeParser.cxx:2265
RagTimeParser::readLinks
bool readLinks(MWAWEntry &entry)
try to read the File Link zone: FLink
Definition RagTimeParser.cxx:1751
RagTimeParser::getNewZoneId
int getNewZoneId()
returns a new unique zone id
Definition RagTimeParser.cxx:452
RagTimeParser::m_textParser
std::shared_ptr< RagTimeText > m_textParser
the text parser
Definition RagTimeParser.hxx:202
RagTimeParser::RagTimeParser
RagTimeParser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header)
constructor
Definition RagTimeParser.cxx:390
RagTimeParser::getFontId
int getFontId(int localId) const
returns a mac font id corresponding to a local id
Definition RagTimeParser.cxx:417
RagTimeParser::readRsrcFHwl
bool readRsrcFHwl(MWAWEntry &entry)
try to read the FHwl zone ( one by file with id=0), maybe width length?
Definition RagTimeParser.cxx:2052
RagTimeParser::readMacroFormats
bool readMacroFormats(MWAWEntry &entry)
try to read the macro format zone: RTml zones
Definition RagTimeParser.cxx:1942
RagTimeParser::readRsrcSele
bool readRsrcSele(MWAWEntry &entry)
try to read the Sele zone (zone with id=0), maybe related to selection
Definition RagTimeParser.cxx:2220
RagTimeParser::RagTimeText
friend class RagTimeText
Definition RagTimeParser.hxx:63
RagTimeParser::readPictZone
bool readPictZone(MWAWEntry &entry)
try to read pictZone ( a big zone)
Definition RagTimeParser.cxx:1189
RagTimeParser::send
bool send(int zId)
try to send a zone
Definition RagTimeParser.cxx:2589
RagTimeParser::readRsrcBeDc
bool readRsrcBeDc(MWAWEntry &entry)
try to read the BeDc zone ( zone of size 52, one by file with id=0);
Definition RagTimeParser.cxx:2107
RagTimeParser::findDataZones
bool findDataZones()
try to create the main data zones list
Definition RagTimeParser.cxx:708
RagTimeParser::readColorMapV2
bool readColorMapV2(MWAWEntry &entry)
try to read the color map:v2
Definition RagTimeParser.cxx:1443
RagTimeParser::sendText
bool sendText(int zId, MWAWListenerPtr listener)
try to send the text zone (interface of RagTimeText)
Definition RagTimeParser.cxx:467
RagTimeParser::readPrintInfo
bool readPrintInfo(MWAWEntry &entry, bool inRSRCFork=false)
read a printInfo block (a PREC rsrc)
Definition RagTimeParser.cxx:1539
RagTimeParser::sendBasicPicture
bool sendBasicPicture(int zId, MWAWPosition const &pos)
sends a basic shape
Definition RagTimeParser.cxx:2546
RagTimeParser::newPage
void newPage(int number)
adds a new page
Definition RagTimeParser.cxx:475
RagTimeParser::getColor
bool getColor(int colId, MWAWColor &color, int listId=-1) const
returns the ith color ( if possible)
Definition RagTimeParser.cxx:427
RagTimeParser::parse
void parse(librevenge::RVNGTextInterface *documentInterface) final
virtual function used to parse the input
Definition RagTimeParser.cxx:491
RagTimeParser::sendZones
bool sendZones()
try to send the different zones
Definition RagTimeParser.cxx:2582
RagTimeParser::readDataZoneHeader
bool readDataZoneHeader(int id, long endPos)
try to read a data zone header
Definition RagTimeParser.cxx:800
RagTimeParser::~RagTimeParser
~RagTimeParser() final
destructor
Definition RagTimeParser.cxx:399
RagTimeParser::createDocument
void createDocument(librevenge::RVNGTextInterface *documentInterface)
creates the listener which will be associated to the document
Definition RagTimeParser.cxx:525
RagTimeParser::readZone6
bool readZone6(MWAWEntry &entry)
try to read zone6 ( a big zone)
Definition RagTimeParser.cxx:1608
RagTimeParser::getZoneDataFieldSize
int getZoneDataFieldSize(int zId) const
returns the size of a zone data field
Definition RagTimeParser.cxx:443
RagTimeParser::m_state
std::shared_ptr< RagTimeParserInternal::State > m_state
the state
Definition RagTimeParser.hxx:198
RagTimeParser::getDateTimeFormat
bool getDateTimeFormat(int dtId, std::string &dtFormat) const
returns the ith date format or ""
Definition RagTimeParser.cxx:462
RagTimeParser::flushExtra
void flushExtra()
flush unsent zone (debugging function)
Definition RagTimeParser.cxx:2653
RagTimeParser::checkHeader
bool checkHeader(MWAWHeader *header, bool strict=false) final
checks if the document header is correct (or not)
Definition RagTimeParser.cxx:2315
RagTimeSpreadsheet
the main class to read the spreadsheet part of ragTime file
Definition RagTimeSpreadsheet.hxx:72
RagTimeText
the main class to read the text part of ragTime file
Definition RagTimeText.hxx:71
MWAWRSRCParserPtr
std::shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition libmwaw_internal.hxx:561
MWAWListenerPtr
std::shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition libmwaw_internal.hxx:553
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition libmwaw_internal.hxx:551
RagTimeParserInternal
Internal: the structures of a RagTimeParser.
Definition RagTimeParser.cxx:63
librevenge
Definition MWAWDocument.hxx:57
MWAWColor
the class to store a color
Definition libmwaw_internal.hxx:192
RagTimeParserInternal::Picture
Internal: a picture of a RagTimeParser.
Definition RagTimeParser.cxx:106
RagTimeParserInternal::State
Internal: the state of a RagTimeParser.
Definition RagTimeParser.cxx:275