ClarisDrawText.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 ClarisDraw text part
00036  *
00037  */
00038 #ifndef CLARIS_DRAW_TEXT
00039 #  define CLARIS_DRAW_TEXT
00040 
00041 #include <list>
00042 #include <string>
00043 #include <vector>
00044 
00045 #include "libmwaw_internal.hxx"
00046 
00047 #include "MWAWEntry.hxx"
00048 #include "MWAWSubDocument.hxx"
00049 
00050 #include "MWAWDebug.hxx"
00051 #include "MWAWInputStream.hxx"
00052 
00053 #include "MWAWParser.hxx"
00054 
00055 #include "ClarisWksStruct.hxx"
00056 
00057 namespace ClarisDrawTextInternal
00058 {
00059 struct Paragraph;
00060 struct DSET;
00061 struct State;
00062 }
00063 
00064 class ClarisDrawStyleManager;
00065 class ClarisDrawParser;
00066 
00072 class ClarisDrawText
00073 {
00074   friend class ClarisDrawParser;
00075 
00076 public:
00078   ClarisDrawText(ClarisDrawParser &parser);
00080   virtual ~ClarisDrawText();
00081 
00083   int version() const;
00085   void resetState();
00087   int numPages() const;
00088 
00090   shared_ptr<ClarisWksStruct::DSET> readDSETZone(ClarisWksStruct::DSET const &zone, MWAWEntry const &entry);
00091 protected:
00093   bool sendZone(int number, int subZone=-1);
00095   void flushExtra();
00096 
00097   //
00098   // low level
00099   //
00100 
00102   bool readFont(int id, int &posC, MWAWFont &font);
00103 
00105   bool readParagraphs();
00106 
00110   bool readParagraph(int id=-1);
00112   bool readParagraphs(MWAWEntry const &entry, ClarisDrawTextInternal::DSET &zone);
00113 
00115   bool readFonts(MWAWEntry const &entry, ClarisDrawTextInternal::DSET &zone);
00116 
00118   bool readTokens(MWAWEntry const &entry, ClarisDrawTextInternal::DSET &zone);
00119 
00121   bool readTextZoneSize(MWAWEntry const &entry, ClarisDrawTextInternal::DSET &zone);
00122 
00124   bool sendText(ClarisDrawTextInternal::DSET const &zone, int subZone);
00125 
00126 private:
00127   ClarisDrawText(ClarisDrawText const &orig);
00128   ClarisDrawText &operator=(ClarisDrawText const &orig);
00129 
00130 protected:
00131   //
00132   // data
00133   //
00134 
00136   MWAWParserStatePtr m_parserState;
00137 
00139   shared_ptr<ClarisDrawTextInternal::State> m_state;
00140 
00142   ClarisDrawParser *m_mainParser;
00144   shared_ptr<ClarisDrawStyleManager> m_styleManager;
00145 };
00146 #endif
00147 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: