MSK4Zone.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 #ifndef MSK4_ZONE
00035 #  define MSK4_ZONE
00036 
00037 #include <map>
00038 #include <string>
00039 
00040 #include "MWAWDebug.hxx"
00041 #include "MWAWEntry.hxx"
00042 #include "MWAWInputStream.hxx"
00043 
00044 #include "MSKParser.hxx"
00045 
00046 class MSK4Parser;
00047 class MSK4Text;
00048 class MSKGraph;
00049 
00050 namespace MSK4ZoneInternal
00051 {
00052 struct State;
00053 }
00054 namespace MSK4ParserInternal
00055 {
00056 class SubDocument;
00057 }
00058 
00076 class MSK4Zone : public MSKParser
00077 {
00078   friend class MSK4ParserInternal::SubDocument;
00079   friend class MSK4Parser;
00080   friend class MSKGraph;
00081   friend class MSK4Text;
00082 
00083 public:
00085   MSK4Zone(MWAWInputStreamPtr input, MWAWParserStatePtr parserState,
00086            MSK4Parser &parser, std::string const &oleName);
00088   ~MSK4Zone();
00089 
00090 protected:
00092   void init();
00093 
00098   bool parseHeaderIndex(MWAWInputStreamPtr &input);
00099 
00101   bool parseHeaderIndexEntry(MWAWInputStreamPtr &input);
00102 
00104   bool createZones(bool mainOle);
00105 
00109   void readContentZones(MWAWEntry const &entry, bool mainOle);
00110 
00112   MWAWContentListenerPtr createListener
00113   (WPXDocumentInterface *interface,
00114    MWAWSubDocumentPtr &header, MWAWSubDocumentPtr &footer);
00115 
00117   double getTextHeight() const;
00118 
00120   Vec2f getPageLeftTop() const;
00121 
00123   void newPage(int number);
00124 
00128   void sendFootNote(int id);
00130   void readFootNote(int id);
00131 
00133   void sendFrameText(MWAWEntry const &entry, std::string const &frame);
00134 
00136   void sendRBIL(int id, Vec2i const &sz);
00137 
00139   void sendOLE(int id, MWAWPosition const &pos, WPXPropertyList frameExtras);
00140 
00142   MWAWEntry getTextPosition() const;
00143 
00145   void parse(WPXDocumentInterface *) {
00146     MWAW_DEBUG_MSG(("MSK4Zone::parse: must not be called\n"));
00147   }
00149   bool checkHeader(MWAWHeader *, bool) {
00150     MWAW_DEBUG_MSG(("MSK4Zone::checkHeader: must not be called\n"));
00151     return false;
00152   }
00153 
00154   //
00155   // low level
00156   //
00157 
00159   bool readPRNT(MWAWInputStreamPtr input, MWAWEntry const &entry, MWAWPageSpan &page);
00160 
00164   bool readDOP(MWAWInputStreamPtr input, MWAWEntry const &entry, MWAWPageSpan &page);
00165 
00169   bool readFRAM(MWAWInputStreamPtr input, MWAWEntry const &entry);
00170 
00174   bool readRLRB(MWAWInputStreamPtr input, MWAWEntry const &entry);
00175 
00179   bool readSELN(MWAWInputStreamPtr input, MWAWEntry const &entry);
00180 
00182   void setAscii(std::string const &oleName);
00183 
00184 private:
00185   MSK4Zone(MSK4Zone const &orig);
00186   MSK4Zone &operator=(MSK4Zone const &orig);
00187 protected:
00188   //
00189   // data
00190   //
00191 
00193   MSK4Parser *m_mainParser;
00194 
00196   shared_ptr<MSK4ZoneInternal::State> m_state;
00197 
00199   std::multimap<std::string, MWAWEntry> m_entryMap;
00200 
00202   shared_ptr<MSK4Text> m_textParser;
00203 
00205   shared_ptr<MSKGraph> m_graphParser;
00206 };
00207 #endif
00208 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: