MORText.hxx
Go to the documentation of this file.
00001 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
00002 
00003 /* libmwaw
00004 * Version: MPL 2.0 / LGPLv2+
00005 *
00006 * The contents of this file are subject to the Mozilla Public License Version
00007 * 2.0 (the "License"); you may not use this file except in compliance with
00008 * the License or as specified alternatively below. You may obtain a copy of
00009 * the License at http://www.mozilla.org/MPL/
00010 *
00011 * Software distributed under the License is distributed on an "AS IS" basis,
00012 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00013 * for the specific language governing rights and limitations under the
00014 * License.
00015 *
00016 * Major Contributor(s):
00017 * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
00018 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
00019 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
00020 * Copyright (C) 2006, 2007 Andrew Ziem
00021 * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
00022 *
00023 *
00024 * All Rights Reserved.
00025 *
00026 * For minor contributions see the git repository.
00027 *
00028 * Alternatively, the contents of this file may be used under the terms of
00029 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
00030 * in which case the provisions of the LGPLv2+ are applicable
00031 * instead of those above.
00032 */
00033 
00034 /*
00035  * Parser to More document
00036  *
00037  */
00038 #ifndef MOR_TEXT
00039 #  define MOR_TEXT
00040 
00041 #include <set>
00042 
00043 #include "libmwaw_internal.hxx"
00044 #include "MWAWDebug.hxx"
00045 
00046 struct MWAWListLevel;
00047 
00048 namespace MORTextInternal
00049 {
00050 struct Outline;
00051 struct Paragraph;
00052 struct State;
00053 
00054 class SubDocument;
00055 }
00056 
00057 class MORParser;
00058 
00064 class MORText
00065 {
00066   friend class MORParser;
00067   friend class MORTextInternal::SubDocument;
00068 public:
00070   MORText(MORParser &parser);
00072   virtual ~MORText();
00073 
00075   int version() const;
00076 
00078   int numPages() const;
00079 
00080 protected:
00082   bool createZones();
00084   bool sendMainText();
00085 
00087   shared_ptr<MWAWSubDocument> getHeaderFooter(bool header);
00088 
00089   //
00090   // intermediate level
00091   //
00092 
00094   bool readTopic(MWAWEntry const &entry);
00095 
00097   int getLastTopicChildId(int tId) const;
00098 
00101   int checkTopicList(size_t tId, std::set<size_t> &parent);
00102 
00104   bool readComment(MWAWEntry const &entry);
00105 
00107   bool readSpeakerNote(MWAWEntry const &entry);
00108 
00110   bool sendText(MWAWEntry const &entry, MWAWFont const &font);
00111 
00113   bool sendComment(int cId);
00114 
00116   bool sendSpeakerNote(int nId);
00117 
00119   bool sendTopic(int tId, int dLevel, std::vector<MWAWParagraph> &paraStack);
00120 
00122   bool readFonts(MWAWEntry const &entry);
00123 
00125   bool readOutlineList(MWAWEntry const &entry);
00126 
00128   bool readOutline(MWAWEntry const &entry, MORTextInternal::Outline &outline);
00129 
00134   bool readFont(MWAWEntry const &entry, std::string &fName, int &fId);
00136   bool readTabs(MWAWEntry const &entry, MORTextInternal::Paragraph &para, std::string &mess);
00138   bool readCustomListLevel(MWAWEntry const &entry, MWAWListLevel &level);
00139 
00141   bool parseUnknown(MWAWEntry const &entry, long fDecal);
00142 
00143 private:
00144   MORText(MORText const &orig);
00145   MORText &operator=(MORText const &orig);
00146 
00147 protected:
00148   //
00149   // data
00150   //
00152   MWAWParserStatePtr m_parserState;
00153 
00155   shared_ptr<MORTextInternal::State> m_state;
00156 
00158   MORParser *m_mainParser;
00159 };
00160 #endif
00161 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: