HanMacWrdKText.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 HAN_MAC_WRD_K_TEXT
# define HAN_MAC_WRD_K_TEXT
#include <map>
#include "libmwaw_internal.hxx"
#include "MWAWDebug.hxx"
namespace HanMacWrdKTextInternal
{
struct Paragraph;
struct Token;
struct State;
}
struct HanMacWrdKZone;
class HanMacWrdKParser;
class HanMacWrdKText
{
friend class HanMacWrdKParser;
public:
explicit HanMacWrdKText(HanMacWrdKParser &parser);
virtual ~HanMacWrdKText();
int version() const;
int numPages() const;
protected:
bool sendMainText();
bool sendText(long id, long subId, MWAWListenerPtr listener=MWAWListenerPtr());
bool canSendTextAsGraphic(long id, long subId);
void flushExtra();
void updateTextZoneTypes(std::map<long,int> const &idTypeMap);
int computeNumPages(HanMacWrdKZone const &zone) const;
std::vector<long> const &getTokenIdList() const;
void getHeaderFooterId(long &headerId, long &footerId) const;
//
// intermediate level
//
bool readTextZone(std::shared_ptr<HanMacWrdKZone> zone);
bool readFontNames(std::shared_ptr<HanMacWrdKZone> zone);
bool readStyles(std::shared_ptr<HanMacWrdKZone> zone);
bool readSections(std::shared_ptr<HanMacWrdKZone> zone);
bool sendText(HanMacWrdKZone &zone, MWAWListenerPtr listener=MWAWListenerPtr());
bool canSendTextAsGraphic(HanMacWrdKZone &zone);
//
// low level
//
bool readFont(HanMacWrdKZone const &zone, MWAWFont &font) const;
bool readParagraph(HanMacWrdKZone const &zone, HanMacWrdKTextInternal::Paragraph &para) const;
void setProperty(HanMacWrdKTextInternal::Paragraph const &para, float width);
bool readToken(HanMacWrdKZone const &zone, HanMacWrdKTextInternal::Token &token) const;
private:
HanMacWrdKText(HanMacWrdKText const &orig) = delete;
HanMacWrdKText &operator=(HanMacWrdKText const &orig) = delete;
protected:
//
// data
//
MWAWParserStatePtr m_parserState;
std::shared_ptr<HanMacWrdKTextInternal::State> m_state;
HanMacWrdKParser *m_mainParser;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWDebug.hxx
HanMacWrdKParser
the main class to read a HanMac Word-K file
Definition HanMacWrdKParser.hxx:186
HanMacWrdKText::getHeaderFooterId
void getHeaderFooterId(long &headerId, long &footerId) const
return sthe header/footer id
Definition HanMacWrdKText.cxx:316
HanMacWrdKText::canSendTextAsGraphic
bool canSendTextAsGraphic(long id, long subId)
check if we can send a textzone as graphic
Definition HanMacWrdKText.cxx:519
HanMacWrdKText::m_mainParser
HanMacWrdKParser * m_mainParser
the main parser;
Definition HanMacWrdKText.hxx:141
HanMacWrdKText::numPages
int numPages() const
returns the number of pages
Definition HanMacWrdKText.cxx:304
HanMacWrdKText::computeNumPages
int computeNumPages(HanMacWrdKZone const &zone) const
compute the number of pages present in a zone
Definition HanMacWrdKText.cxx:353
HanMacWrdKText::HanMacWrdKText
HanMacWrdKText(HanMacWrdKParser &parser)
constructor
Definition HanMacWrdKText.cxx:286
HanMacWrdKText::version
int version() const
returns the file version
Definition HanMacWrdKText.cxx:297
HanMacWrdKText::readFontNames
bool readFontNames(std::shared_ptr< HanMacWrdKZone > zone)
try to read the fonts name zone (type 5)
Definition HanMacWrdKText.cxx:1021
HanMacWrdKText::readTextZone
bool readTextZone(std::shared_ptr< HanMacWrdKZone > zone)
try to read a text zone (type 1)
Definition HanMacWrdKText.cxx:452
HanMacWrdKText::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition HanMacWrdKText.hxx:135
HanMacWrdKText::m_state
std::shared_ptr< HanMacWrdKTextInternal::State > m_state
the state
Definition HanMacWrdKText.hxx:138
HanMacWrdKText::flushExtra
void flushExtra()
sends the data which have not yet been sent to the listener
Definition HanMacWrdKText.cxx:1584
HanMacWrdKText::getTokenIdList
std::vector< long > const & getTokenIdList() const
returns the list of zoneId which corresponds to the token
Definition HanMacWrdKText.cxx:322
HanMacWrdKText::readSections
bool readSections(std::shared_ptr< HanMacWrdKZone > zone)
try to read a section info zone (type 4)
Definition HanMacWrdKText.cxx:1481
HanMacWrdKText::readParagraph
bool readParagraph(HanMacWrdKZone const &zone, HanMacWrdKTextInternal::Paragraph &para) const
try to read a paragraph in a text zone
Definition HanMacWrdKText.cxx:1215
HanMacWrdKText::~HanMacWrdKText
virtual ~HanMacWrdKText()
destructor
Definition HanMacWrdKText.cxx:293
HanMacWrdKText::readFont
bool readFont(HanMacWrdKZone const &zone, MWAWFont &font) const
try to read a font in a text zone
Definition HanMacWrdKText.cxx:896
HanMacWrdKText::sendText
bool sendText(long id, long subId, MWAWListenerPtr listener=MWAWListenerPtr())
send a text zone
Definition HanMacWrdKText.cxx:532
HanMacWrdKText::updateTextZoneTypes
void updateTextZoneTypes(std::map< long, int > const &idTypeMap)
update the text zone type with map id->type
Definition HanMacWrdKText.cxx:327
HanMacWrdKText::HanMacWrdKText
HanMacWrdKText(HanMacWrdKText const &orig)=delete
HanMacWrdKText::setProperty
void setProperty(HanMacWrdKTextInternal::Paragraph const &para, float width)
send the ruler properties
Definition HanMacWrdKText.cxx:1209
HanMacWrdKText::operator=
HanMacWrdKText & operator=(HanMacWrdKText const &orig)=delete
HanMacWrdKText::HanMacWrdKParser
friend class HanMacWrdKParser
Definition HanMacWrdKText.hxx:63
HanMacWrdKText::sendMainText
bool sendMainText()
send the main text zone
Definition HanMacWrdKText.cxx:549
HanMacWrdKText::readStyles
bool readStyles(std::shared_ptr< HanMacWrdKZone > zone)
try to read the style zone (type 3)
Definition HanMacWrdKText.cxx:1082
HanMacWrdKText::readToken
bool readToken(HanMacWrdKZone const &zone, HanMacWrdKTextInternal::Token &token) const
try to read an token in a text zone
Definition HanMacWrdKText.cxx:1436
MWAWFont
Class to store font.
Definition MWAWFont.hxx:44
libmwaw_internal.hxx
MWAWParserStatePtr
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition libmwaw_internal.hxx:557
MWAWListenerPtr
std::shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition libmwaw_internal.hxx:553
HanMacWrdKTextInternal
Internal: the structures of a HanMacWrdKText.
Definition HanMacWrdKText.cxx:58
HanMacWrdKTextInternal::Paragraph
Internal: class to store the paragraph properties of a HanMacWrdKText.
Definition HanMacWrdKText.cxx:60
HanMacWrdKTextInternal::State
Internal: the state of a HanMacWrdKText.
Definition HanMacWrdKText.cxx:240
HanMacWrdKTextInternal::Token
Internal: class to store the token properties of a HanMacWrdKText.
Definition HanMacWrdKText.cxx:175
HanMacWrdKZone
Small class used to store the decoded zone of HanMacWrdKParser.
Definition HanMacWrdKParser.hxx:58