HMWKText.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 text document
*
*/
#ifndef HMWK_TEXT
# define HMWK_TEXT
#include <map>
#include "libmwaw_internal.hxx"
#include "MWAWDebug.hxx"
namespace HMWKTextInternal
{
struct Paragraph;
struct Token;
struct State;
}
struct HMWKZone;
class HMWKParser;
class HMWKText
{
friend class HMWKParser;
public:
HMWKText(HMWKParser &parser);
virtual ~HMWKText();
int version() const;
int numPages() const;
protected:
bool sendMainText();
bool sendText(long id, long subId=0);
void flushExtra();
void updateTextZoneTypes(std::map<long,int> const &idTypeMap);
std::vector<long> const &getTokenIdList() const;
void getHeaderFooterId(long &headerId, long &footerId) const;
//
// intermediate level
//
bool readTextZone(shared_ptr<HMWKZone> zone);
bool readFontNames(shared_ptr<HMWKZone> zone);
bool readStyles(shared_ptr<HMWKZone> zone);
bool readSections(shared_ptr<HMWKZone> zone);
bool sendText(HMWKZone &zone);
//
// low level
//
bool readFont(HMWKZone &zone, MWAWFont &font);
bool readParagraph(HMWKZone &zone, HMWKTextInternal::Paragraph &para);
void setProperty(HMWKTextInternal::Paragraph const &para, float width);
bool readToken(HMWKZone &zone, HMWKTextInternal::Token &token);
private:
HMWKText(HMWKText const &orig);
HMWKText &operator=(HMWKText const &orig);
protected:
//
// data
//
MWAWParserStatePtr m_parserState;
shared_ptr<HMWKTextInternal::State> m_state;
HMWKParser *m_mainParser;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
HMWKText::m_mainParser
HMWKParser * m_mainParser
the main parser;
Definition: HMWKText.hxx:135
HMWKParser
the main class to read a HanMac Word-K file
Definition: HMWKParser.hxx:173
HMWKText::m_state
shared_ptr< HMWKTextInternal::State > m_state
the state
Definition: HMWKText.hxx:132
libmwaw_internal.hxx
HMWKText::operator=
HMWKText & operator=(HMWKText const &orig)
HMWKText
the main class to read the text part of HanMac Word file
Definition: HMWKText.hxx:61
HMWKText::getHeaderFooterId
void getHeaderFooterId(long &headerId, long &footerId) const
return sthe header/footer id
Definition: HMWKText.cxx:260
HMWKText::updateTextZoneTypes
void updateTextZoneTypes(std::map< long, int > const &idTypeMap)
update the text zone type with map id->type
Definition: HMWKText.cxx:271
HMWKText::setProperty
void setProperty(HMWKTextInternal::Paragraph const &para, float width)
send the ruler properties
Definition: HMWKText.cxx:993
HMWKZone
Small class used to store the decoded zone of HMWKParser.
Definition: HMWKParser.hxx:58
HMWKText::numPages
int numPages() const
returns the number of pages
Definition: HMWKText.cxx:255
HMWKText::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition: HMWKText.cxx:1372
HMWKText::readSections
bool readSections(shared_ptr< HMWKZone > zone)
try to read a section info zone (type 4)
Definition: HMWKText.cxx:1263
HMWKText::~HMWKText
virtual ~HMWKText()
destructor
Definition: HMWKText.cxx:244
HMWKText::HMWKText
HMWKText(HMWKParser &parser)
constructor
Definition: HMWKText.cxx:239
HMWKText::readTextZone
bool readTextZone(shared_ptr< HMWKZone > zone)
try to read a text zone (type 1)
Definition: HMWKText.cxx:298
HMWKText::readFont
bool readFont(HMWKZone &zone, MWAWFont &font)
try to read a font in a text zone
Definition: HMWKText.cxx:683
HMWKText::getTokenIdList
std::vector< long > const & getTokenIdList() const
returns the list of zoneId which corresponds to the token
Definition: HMWKText.cxx:266
HMWKText::version
int version() const
returns the file version
Definition: HMWKText.cxx:248
HMWKText::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition: HMWKText.hxx:129
MWAWDebug.hxx
HMWKText::sendMainText
bool sendMainText()
send the main text zone
Definition: HMWKText.cxx:398
HMWKText::readStyles
bool readStyles(shared_ptr< HMWKZone > zone)
try to read the style zone (type 3)
Definition: HMWKText.cxx:867
HMWKText::sendText
bool sendText(long id, long subId=0)
send a text zone
Definition: HMWKText.cxx:380
HMWKText::readToken
bool readToken(HMWKZone &zone, HMWKTextInternal::Token &token)
try to read an token in a text zone
Definition: HMWKText.cxx:1219
HMWKTextInternal::Token
Internal: class to store the token properties of a HMWKText.
Definition: HMWKText.cxx:155
MWAWParserStatePtr
shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:342
HMWKText::readFontNames
bool readFontNames(shared_ptr< HMWKZone > zone)
try to read the fonts name zone (type 5)
Definition: HMWKText.cxx:807
HMWKText::readParagraph
bool readParagraph(HMWKZone &zone, HMWKTextInternal::Paragraph &para)
try to read a paragraph in a text zone
Definition: HMWKText.cxx:999
HMWKTextInternal::Paragraph
Internal: class to store the paragraph properties of a HMWKText.
Definition: HMWKText.cxx:59