[go: up one dir, main page]

Menu

[5cdb4d]: / src / lib / WPS8Table.h  Maximize  Restore  History

Download this file

133 lines (108 with data), 3.8 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* libwps
* Version: MPL 2.0 / LGPLv2.1+
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Major Contributor(s):
* Copyright (C) 2009, 2011 Alonso Laurent (alonso@loria.fr)
* Copyright (C) 2006, 2007 Andrew Ziem
* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
* Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
* Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms
* of the GNU Lesser General Public License Version 2.1 or later
* (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
* applicable instead of those above.
*
* For further information visit http://libwps.sourceforge.net
*/
#ifndef WPS8_TABLE
# define WPS8_TABLE
#include "libwps_internal.h"
#include "WPSDebug.h"
class WPS8Parser;
namespace WPS8TableInternal
{
struct Cell;
struct State;
}
////////////////////////////////////////////////////////////
//
// class to parse the object
//
////////////////////////////////////////////////////////////
/** \brief the main class to read/store table in a Pc MS Works document v5-8
*
* This class must be associated with a WPS8Parser. It contains code to read
* the MCLD entries which seems to correspond to a table entry (potentially a table
* entry with only one cells).
*
* \note Actually, the relations between the MCLD entries and the FRAM entries (which
* seems to store all the object positions) are not fully understood ; so the result
* of this parsing is not used to create the document.
*/
class WPS8Table
{
friend struct WPS8TableInternal::Cell;
friend class WPS8Parser;
public:
//! constructor
WPS8Table(WPS8Parser &parser);
//! destructor
~WPS8Table();
//! sets the listener
void setListener(WPSContentListenerPtr &listen)
{
m_listener = listen;
}
//! computes the final position of all table: does nothing as table anchors seem always a char
void computePositions() const;
//! returns the number page where we find a picture. In practice, 0/1
int numPages() const;
/** sends the data which have not been send to the listener. */
void flushExtra();
protected:
//! finds all structures which correspond to a table
bool readStructures(RVNGInputStreamPtr input);
/** tries to send a table corresponding to strsid with actual size siz
*
* \param siz the size of the table in the document
* \param tableId the table identificator
* \param strsid indicates the text entry (and its corresponding TCD )
* \param inTextBox indicates if we have already created a textbox to insert the table
* which contains the cells' text.
*/
bool sendTable(Vec2f const &siz, int tableId, int strsid, bool inTextBox=false);
// interface with main parser
void sendTextInCell(int strsId, int cellId);
protected: // low level
//! reads a MCLD zone: a zone which stores the tables structures
bool readMCLD(RVNGInputStreamPtr input, WPSEntry const &entry);
//! returns the file version
int version() const;
//! returns the debug file
libwps::DebugFile &ascii()
{
return m_asciiFile;
}
private:
WPS8Table(WPS8Table const &orig);
WPS8Table &operator=(WPS8Table const &orig);
protected:
//! the listener
WPSContentListenerPtr m_listener;
//! the main parser
WPS8Parser &m_mainParser;
//! the state
mutable shared_ptr<WPS8TableInternal::State> m_state;
//! the ascii file
libwps::DebugFile &m_asciiFile;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: