WPSTable.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 WPS_TABLE
00031 #  define WPS_TABLE
00032 
00033 #include <iostream>
00034 #include <vector>
00035 
00036 #include "libwps_internal.h"
00037 
00038 class WPSContentListener;
00039 typedef shared_ptr<WPSContentListener> WPSContentListenerPtr;
00040 
00041 class WPSCell;
00042 typedef shared_ptr<WPSCell> WPSCellPtr;
00043 
00044 /*
00045  * Structure to store and construct a table from an unstructured list
00046  * of cell
00047  *
00048  */
00049 class WPSTable
00050 {
00051 public:
00053         WPSTable() : m_cellsList(), m_rowsSize(), m_colsSize() {}
00054 
00056         virtual ~WPSTable();
00057 
00059         void add(WPSCellPtr &cell);
00060 
00062         int numCells() const
00063         {
00064                 return m_cellsList.size();
00065         }
00067         WPSCellPtr get(int id);
00068 
00073         bool sendTable(WPSContentListenerPtr listener);
00074 
00076         bool sendAsText(WPSContentListenerPtr listener);
00077 
00078 protected:
00080         bool buildStructures();
00081 
00083         std::vector<WPSCellPtr> m_cellsList;
00085         std::vector<float> m_rowsSize, m_colsSize;
00086 };
00087 
00088 #endif
00089 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */