WPS4Graph.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  * Copyright (C) 2009, 2011 Alonso Laurent (alonso@loria.fr)
00004  * Copyright (C) 2006, 2007 Andrew Ziem
00005  * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
00006  * Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
00007  * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
00008  *
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Library General Public
00011  * License as published by the Free Software Foundation; either
00012  * version 2 of the License, or (at your option) any later version.
00013  *
00014  * This library is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  * Library General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU Library General Public
00020  * License along with this library; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
00022  *
00023  * For further information visit http://libwps.sourceforge.net
00024  */
00025 
00026 /* "This product is not manufactured, approved, or supported by
00027  * Corel Corporation or Corel Corporation Limited."
00028  */
00029 
00030 #ifndef WPS4_GRAPH
00031 #  define WPS4_GRAPH
00032 
00033 #include <vector>
00034 
00035 #include "libwps_internal.h"
00036 
00037 #include "WPSDebug.h"
00038 
00039 class WPXBinaryData;
00040 
00041 class WPSEntry;
00042 class WPS4Parser;
00043 class WPSPosition;
00044 
00045 typedef class WPSContentListener WPS4ContentListener;
00046 typedef shared_ptr<WPS4ContentListener> WPS4ContentListenerPtr;
00047 
00048 namespace WPS4GraphInternal
00049 {
00050 struct State;
00051 }
00052 
00054 //
00055 // class to parse the object
00056 //
00058 
00066 class WPS4Graph
00067 {
00068         friend class WPS4Parser;
00069 public:
00071         WPS4Graph(WPS4Parser &parser);
00072 
00074         ~WPS4Graph();
00075 
00077         void setListener(WPS4ContentListenerPtr &listen)
00078         {
00079                 m_listener = listen;
00080         }
00081 
00088         void computePositions() const;
00089 
00091         int numPages() const;
00092 
00093 protected:
00095         int version() const;
00096 
00098         void storeObjects(std::vector<WPXBinaryData> const &objects,
00099                           std::vector<int> const &ids,
00100                           std::vector<WPSPosition> const &positions);
00101 
00107         int readObject(WPXInputStreamPtr input, WPSEntry const &entry);
00108 
00110         void sendObject(Vec2f const &size, int id);
00111 
00118         void sendObjects(int page);
00119 
00121         libwps::DebugFile &ascii()
00122         {
00123                 return m_asciiFile;
00124         }
00125 
00126 private:
00127         WPS4Graph(WPS4Graph const &orig);
00128         WPS4Graph &operator=(WPS4Graph const &orig);
00129 protected:
00131         WPS4ContentListenerPtr m_listener;
00132 
00134         WPS4Parser &m_mainParser;
00135 
00137         mutable shared_ptr<WPS4GraphInternal::State> m_state;
00138 
00140         libwps::DebugFile &m_asciiFile;
00141 };
00142 
00143 #endif
00144 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
00145