|
rpm-build |
6f7582 |
/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
/* libmwaw
|
|
rpm-build |
6f7582 |
* Version: MPL 2.0 / LGPLv2+
|
|
rpm-build |
6f7582 |
*
|
|
rpm-build |
6f7582 |
* The contents of this file are subject to the Mozilla Public License Version
|
|
rpm-build |
6f7582 |
* 2.0 (the "License"); you may not use this file except in compliance with
|
|
rpm-build |
6f7582 |
* the License or as specified alternatively below. You may obtain a copy of
|
|
rpm-build |
6f7582 |
* the License at http://www.mozilla.org/MPL/
|
|
rpm-build |
6f7582 |
*
|
|
rpm-build |
6f7582 |
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
rpm-build |
6f7582 |
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
rpm-build |
6f7582 |
* for the specific language governing rights and limitations under the
|
|
rpm-build |
6f7582 |
* License.
|
|
rpm-build |
6f7582 |
*
|
|
rpm-build |
6f7582 |
* Major Contributor(s):
|
|
rpm-build |
6f7582 |
* Copyright (C) 2002 William Lachance (wrlach@gmail.com)
|
|
rpm-build |
6f7582 |
* Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
|
|
rpm-build |
6f7582 |
* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
|
|
rpm-build |
6f7582 |
* Copyright (C) 2006, 2007 Andrew Ziem
|
|
rpm-build |
6f7582 |
* Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
|
|
rpm-build |
6f7582 |
*
|
|
rpm-build |
6f7582 |
*
|
|
rpm-build |
6f7582 |
* All Rights Reserved.
|
|
rpm-build |
6f7582 |
*
|
|
rpm-build |
6f7582 |
* For minor contributions see the git repository.
|
|
rpm-build |
6f7582 |
*
|
|
rpm-build |
6f7582 |
* Alternatively, the contents of this file may be used under the terms of
|
|
rpm-build |
6f7582 |
* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
|
|
rpm-build |
6f7582 |
* in which case the provisions of the LGPLv2+ are applicable
|
|
rpm-build |
6f7582 |
* instead of those above.
|
|
rpm-build |
6f7582 |
*/
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
/*
|
|
rpm-build |
6f7582 |
* Parser to More document
|
|
rpm-build |
6f7582 |
*
|
|
rpm-build |
6f7582 |
*/
|
|
rpm-build |
6f7582 |
#ifndef MORE_TEXT
|
|
rpm-build |
6f7582 |
# define MORE_TEXT
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
#include <set>
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
#include "libmwaw_internal.hxx"
|
|
rpm-build |
6f7582 |
#include "MWAWDebug.hxx"
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
struct MWAWListLevel;
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
namespace MoreTextInternal
|
|
rpm-build |
6f7582 |
{
|
|
rpm-build |
6f7582 |
struct Outline;
|
|
rpm-build |
6f7582 |
struct Paragraph;
|
|
rpm-build |
6f7582 |
struct State;
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
class SubDocument;
|
|
rpm-build |
6f7582 |
}
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
class MoreParser;
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
/** \brief the main class to read the text part of More Text file
|
|
rpm-build |
6f7582 |
*
|
|
rpm-build |
6f7582 |
*
|
|
rpm-build |
6f7582 |
*
|
|
rpm-build |
6f7582 |
*/
|
|
rpm-build |
6f7582 |
class MoreText
|
|
rpm-build |
6f7582 |
{
|
|
rpm-build |
6f7582 |
friend class MoreParser;
|
|
rpm-build |
6f7582 |
friend class MoreTextInternal::SubDocument;
|
|
rpm-build |
6f7582 |
public:
|
|
rpm-build |
6f7582 |
//! constructor
|
|
rpm-build |
6f7582 |
explicit MoreText(MoreParser &parser);
|
|
rpm-build |
6f7582 |
//! destructor
|
|
rpm-build |
6f7582 |
virtual ~MoreText();
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
/** returns the file version */
|
|
rpm-build |
6f7582 |
int version() const;
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
/** returns the number of pages */
|
|
rpm-build |
6f7582 |
int numPages() const;
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
protected:
|
|
rpm-build |
6f7582 |
//! try to create the text zones using read data
|
|
rpm-build |
6f7582 |
bool createZones();
|
|
rpm-build |
6f7582 |
//! send a main zone
|
|
rpm-build |
6f7582 |
bool sendMainText();
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
//! returns a subdocument to send the header or the footer
|
|
rpm-build |
6f7582 |
std::shared_ptr<MWAWSubDocument> getHeaderFooter(bool header);
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
//
|
|
rpm-build |
6f7582 |
// intermediate level
|
|
rpm-build |
6f7582 |
//
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
//! read the list of topic positions
|
|
rpm-build |
6f7582 |
bool readTopic(MWAWEntry const &entry);
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
//! returns the last sub topic id corresponding to a topic and its child
|
|
rpm-build |
6f7582 |
int getLastTopicChildId(int tId) const;
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
/** check that the topic and its child does not loop (if so, cut some edge),
|
|
rpm-build |
6f7582 |
return the number of breakpages in the sublist */
|
|
rpm-build |
6f7582 |
int checkTopicList(size_t tId, std::set<size_t> &parent);
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
//! read the list of comment/header/footer zones
|
|
rpm-build |
6f7582 |
bool readComment(MWAWEntry const &entry);
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
//! read the list of speaker note
|
|
rpm-build |
6f7582 |
bool readSpeakerNote(MWAWEntry const &entry);
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
//! send a text entry
|
|
rpm-build |
6f7582 |
bool sendText(MWAWEntry const &entry, MWAWFont const &font);
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
//! try to send a comment knowing the comment id
|
|
rpm-build |
6f7582 |
bool sendComment(int cId);
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
//! try to send a speakernote knowing the note id
|
|
rpm-build |
6f7582 |
bool sendSpeakerNote(int nId);
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
//! try to send a topic knowing the topic id
|
|
rpm-build |
6f7582 |
bool sendTopic(int tId, int dLevel, std::vector<MWAWParagraph> ¶Stack);
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
//! read the list of fonts
|
|
rpm-build |
6f7582 |
bool readFonts(MWAWEntry const &entry);
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
//! read the list of outlines
|
|
rpm-build |
6f7582 |
bool readOutlineList(MWAWEntry const &entry);
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
//! read a outline
|
|
rpm-build |
6f7582 |
bool readOutline(MWAWEntry const &entry, MoreTextInternal::Outline &outline);
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
/** try to read a fontname
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
\note: fId is set to -1 is the field contains only a fontname and can not find the associated id
|
|
rpm-build |
6f7582 |
*/
|
|
rpm-build |
6f7582 |
bool readFont(MWAWEntry const &entry, std::string &fName, int &fId);
|
|
rpm-build |
6f7582 |
/** try to read some tabs */
|
|
rpm-build |
6f7582 |
bool readTabs(MWAWEntry const &entry, MoreTextInternal::Paragraph ¶, std::string &mess);
|
|
rpm-build |
6f7582 |
/** read a custom list level */
|
|
rpm-build |
6f7582 |
bool readCustomListLevel(MWAWEntry const &entry, MWAWListLevel &level);
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
//! try to read either a font, a fontname, a pattern, a int
|
|
rpm-build |
6f7582 |
bool parseUnknown(MWAWEntry const &entry, long fDecal);
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
private:
|
|
rpm-build |
6f7582 |
MoreText(MoreText const &orig) = delete;
|
|
rpm-build |
6f7582 |
MoreText &operator=(MoreText const &orig) = delete;
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
protected:
|
|
rpm-build |
6f7582 |
//
|
|
rpm-build |
6f7582 |
// data
|
|
rpm-build |
6f7582 |
//
|
|
rpm-build |
6f7582 |
//! the parser state
|
|
rpm-build |
6f7582 |
MWAWParserStatePtr m_parserState;
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
//! the state
|
|
rpm-build |
6f7582 |
std::shared_ptr<MoreTextInternal::State> m_state;
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
//! the main parser;
|
|
rpm-build |
6f7582 |
MoreParser *m_mainParser;
|
|
rpm-build |
6f7582 |
};
|
|
rpm-build |
6f7582 |
#endif
|
|
rpm-build |
6f7582 |
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
|