Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef _WPXTABLE_H
00036 #define _WPXTABLE_H
00037 #include <stddef.h>
00038 #include <vector>
00039 #include "libwpd_types.h"
00040
00041 typedef struct _WPXTableCell WPXTableCell;
00042
00043 struct _WPXTableCell
00044 {
00045 _WPXTableCell(uint8_t colSpan, uint8_t rowSpan, uint8_t borderBits);
00046 uint8_t m_colSpan;
00047 uint8_t m_rowSpan;
00048 uint8_t m_borderBits;
00049 };
00050
00051 class WPXTable
00052 {
00053 public:
00054 WPXTable() : m_tableRows() {}
00055 ~WPXTable();
00056 void insertRow();
00057 void insertCell(uint8_t colSpan, uint8_t rowSpan, uint8_t borderBits);
00058 const WPXTableCell* getCell(int i, int j) { return (m_tableRows[i])[j]; }
00059 void makeBordersConsistent();
00060 void _makeCellBordersConsistent(WPXTableCell *cell, std::vector<WPXTableCell *> &adjacentCells,
00061 int adjacencyBitCell, int adjacencyBitBoundCells);
00062 std::vector<WPXTableCell *> _getCellsBottomAdjacent(int i, int j);
00063 std::vector<WPXTableCell *> _getCellsRightAdjacent(int i, int j);
00064
00065 const std::vector< std::vector<WPXTableCell *> >& getRows() const { return m_tableRows; }
00066 const bool isEmpty() const { return m_tableRows.size() == 0; }
00067
00068 private:
00069 std::vector< std::vector<WPXTableCell *> > m_tableRows;
00070 };
00071
00072 class WPXTableList
00073 {
00074 public:
00075 WPXTableList();
00076 WPXTableList(const WPXTableList &);
00077 WPXTableList & operator=(const WPXTableList & tableList);
00078 virtual ~WPXTableList();
00079
00080 WPXTable * operator[](size_t i) { return (*m_tableList)[i]; }
00081 void add(WPXTable *table) { m_tableList->push_back(table); }
00082
00083 private:
00084 void release();
00085 void acquire(int *refCount, std::vector<WPXTable *> *tableList);
00086 int * getRef() const { return m_refCount; }
00087 std::vector<WPXTable *> * get() const { return m_tableList; }
00088
00089 std::vector<WPXTable *> *m_tableList;
00090 int *m_refCount;
00091 };
00092 #endif