WPS8Graph.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
00002 /* libwps
00003  * Version: MPL 2.0 / LGPLv2.1+
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  *
00009  * Major Contributor(s):
00010  * Copyright (C) 2009, 2011 Alonso Laurent (alonso@loria.fr)
00011  * Copyright (C) 2006, 2007 Andrew Ziem
00012  * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
00013  * Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
00014  * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
00015  *
00016  * For minor contributions see the git repository.
00017  *
00018  * Alternatively, the contents of this file may be used under the terms
00019  * of the GNU Lesser General Public License Version 2.1 or later
00020  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
00021  * applicable instead of those above.
00022  *
00023  * For further information visit http://libwps.sourceforge.net
00024  */
00025 
00026 #ifndef WPS8_GRAPH
00027 #  define WPS8_GRAPH
00028 
00029 #include <list>
00030 #include <vector>
00031 
00032 #include "libwps_internal.h"
00033 
00034 #include "WPSDebug.h"
00035 
00036 struct WPSOLEParserObject;
00037 class WPS8Parser;
00038 
00039 namespace WPS8GraphInternal
00040 {
00041 struct State;
00042 }
00043 
00054 class WPS8Graph
00055 {
00056         friend class WPS8Parser;
00057 public:
00059         WPS8Graph(WPS8Parser &parser);
00060 
00062         ~WPS8Graph();
00063 
00065         void setListener(WPSContentListenerPtr &listen)
00066         {
00067                 m_listener = listen;
00068         }
00069 
00074         void computePositions() const;
00075 
00077         int numPages() const;
00078 
00083         bool sendObject(WPSPosition const &pos, int id, bool ole);
00084 
00086         bool sendIBGF(WPSPosition const &pos, int ibgfId);
00087 
00095         void sendObjects(int page, int pageToIgnore=-2);
00096 
00097 protected:
00099         int version() const;
00100 
00104         void sendBorder(int borderId);
00105 
00107         void storeObjects(std::vector<WPSOLEParserObject> const &objects,
00108                           std::vector<int> const &ids);
00109 
00111         bool readStructures(RVNGInputStreamPtr input);
00112 
00113         // low level
00114 
00118         bool readPICT(RVNGInputStreamPtr input, WPSEntry const &entry);
00119 
00124         bool readIBGF(RVNGInputStreamPtr input, WPSEntry const &entry);
00125 
00127         bool readBDR(RVNGInputStreamPtr input, WPSEntry const &entry);
00128 
00132         bool readMetaFile(RVNGInputStreamPtr input, long endPos, librevenge::RVNGBinaryData &pict);
00133 
00135         libwps::DebugFile &ascii()
00136         {
00137                 return m_asciiFile;
00138         }
00139 private:
00140         WPS8Graph(WPS8Graph const &orig);
00141         WPS8Graph &operator=(WPS8Graph const &orig);
00142 
00143 protected:
00145         WPSContentListenerPtr m_listener;
00146 
00148         WPS8Parser &m_mainParser;
00149 
00151         mutable shared_ptr<WPS8GraphInternal::State> m_state;
00152 
00154         libwps::DebugFile &m_asciiFile;
00155 };
00156 
00157 #endif
00158 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */