HMWJText.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 HanMac Word-J text document
*
*/
#ifndef HMWJ_TEXT
# define HMWJ_TEXT
#include <map>
#include <vector>
#include "libmwaw_internal.hxx"
#include "MWAWDebug.hxx"
namespace HMWJTextInternal
{
struct Paragraph;
class SubDocument;
struct TextZone;
struct State;
}
class HMWJParser;
class HMWJText
{
friend class HMWJTextInternal::SubDocument;
friend class HMWJParser;
public:
HMWJText(HMWJParser &parser);
virtual ~HMWJText();
int version() const;
int numPages() const;
protected:
bool sendMainText();
bool sendText(long id, long cPos);
bool sendText(HMWJTextInternal::TextZone const &zone, long cPos=0);
void flushExtra();
int computeNumPages(HMWJTextInternal::TextZone const &zone);
std::vector<long> getTokenIdList() const;
void updateTextZoneTypes(std::map<long,int> const &idTypeMap);
void updateFootnoteInformations(long const &textZId, std::vector<long> const &fPosList);
//
// intermediate level
//
bool readFontNames(MWAWEntry const &entry);
bool readFonts(MWAWEntry const &entry);
bool readFont(MWAWFont &font, long endPos=-1);
bool readParagraphs(MWAWEntry const &entry);
bool readParagraph(HMWJTextInternal::Paragraph &para, long endPos=-1);
bool readStyles(MWAWEntry const &entry);
bool readTextZonesList(MWAWEntry const &entry);
bool readTextZone(MWAWEntry const &entry, int actZone);
bool readTextToken(long endPos, HMWJTextInternal::TextZone &zone);
bool readSections(MWAWEntry const &entry);
bool readFtnPos(MWAWEntry const &entry);
//
// low level
//
private:
HMWJText(HMWJText const &orig);
HMWJText &operator=(HMWJText const &orig);
protected:
//
// data
//
MWAWParserStatePtr m_parserState;
shared_ptr<HMWJTextInternal::State> m_state;
HMWJParser *m_mainParser;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
HMWJText::readFtnPos
bool readFtnPos(MWAWEntry const &entry)
try to read the footnote position
Definition: HMWJText.cxx:2163
HMWJText::readFontNames
bool readFontNames(MWAWEntry const &entry)
try to read the fonts name zone (type 15)
Definition: HMWJText.cxx:1528
HMWJText::m_state
shared_ptr< HMWJTextInternal::State > m_state
the state
Definition: HMWJText.hxx:140
HMWJText::updateTextZoneTypes
void updateTextZoneTypes(std::map< long, int > const &idTypeMap)
update the text zone type with map id->type
Definition: HMWJText.cxx:782
HMWJText::readTextZonesList
bool readTextZonesList(MWAWEntry const &entry)
try to read the list of textzones ( type 4)
Definition: HMWJText.cxx:805
libmwaw_internal.hxx
HMWJText::readTextZone
bool readTextZone(MWAWEntry const &entry, int actZone)
try to read a text zone ( type 5 )
Definition: HMWJText.cxx:953
HMWJText::m_mainParser
HMWJParser * m_mainParser
the main parser;
Definition: HMWJText.hxx:143
HMWJText::readParagraphs
bool readParagraphs(MWAWEntry const &entry)
try to read the paragraphs zone (type 1)
Definition: HMWJText.cxx:1973
HMWJText::operator=
HMWJText & operator=(HMWJText const &orig)
HMWJText::numPages
int numPages() const
returns the number of pages
Definition: HMWJText.cxx:392
HMWJText::sendMainText
bool sendMainText()
send the main text zone
Definition: HMWJText.cxx:438
HMWJText::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition: HMWJText.hxx:137
HMWJText::updateFootnoteInformations
void updateFootnoteInformations(long const &textZId, std::vector< long > const &fPosList)
update the footnote text zone id and the list of first char position
Definition: HMWJText.cxx:799
HMWJTextInternal::TextZone
Internal: a struct used to store a text zone.
Definition: HMWJText.cxx:207
HMWJText::readFonts
bool readFonts(MWAWEntry const &entry)
try to read the fonts zone (type 0)
Definition: HMWJText.cxx:1445
HMWJTextInternal::Paragraph
Internal: class to store the paragraph properties of a HMWJText.
Definition: HMWJText.cxx:233
HMWJText::getTokenIdList
std::vector< long > getTokenIdList() const
returns the list of zoneId which corresponds to the token
Definition: HMWJText.cxx:405
HMWJText::computeNumPages
int computeNumPages(HMWJTextInternal::TextZone const &zone)
compute the number of pages present in a zone
Definition: HMWJText.cxx:729
HMWJText::HMWJText
HMWJText(HMWJParser &parser)
constructor
Definition: HMWJText.cxx:376
HMWJText::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: HMWJText.cxx:2256
HMWJText::readSections
bool readSections(MWAWEntry const &entry)
try to read the different sections
Definition: HMWJText.cxx:2054
HMWJText::~HMWJText
virtual ~HMWJText()
destructor
Definition: HMWJText.cxx:381
HMWJText::readParagraph
bool readParagraph(HMWJTextInternal::Paragraph &para, long endPos=-1)
try to read a paragraph ( reading up to endPos if endPos is defined )
Definition: HMWJText.cxx:1751
HMWJParser
the main class to read a HanMac Word-J file
Definition: HMWJParser.hxx:102
MWAWDebug.hxx
HMWJText::version
int version() const
returns the file version
Definition: HMWJText.cxx:385
HMWJTextInternal::SubDocument
Internal: the subdocument of a HMWJText.
Definition: HMWJText.cxx:296
HMWJText::readTextToken
bool readTextToken(long endPos, HMWJTextInternal::TextZone &zone)
try to read the token in the text zone
Definition: HMWJText.cxx:1208
MWAWParserStatePtr
shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:342
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
HMWJText::sendText
bool sendText(long id, long cPos)
send a text zone (not implemented)
Definition: HMWJText.cxx:426
HMWJText::readStyles
bool readStyles(MWAWEntry const &entry)
try to read the style zone (type 2)
Definition: HMWJText.cxx:1607
HMWJText
the main class to read the text part of HanMac Word-J file
Definition: HMWJText.hxx:62
HMWJText::readFont
bool readFont(MWAWFont &font, long endPos=-1)
try to read the font ( reading up to endPos if endPos is defined )
Definition: HMWJText.cxx:1316