1 /* TableStyle: Stores (and writes) table-based information that is
2  * needed at the head of an OO document.
3  *
4  * Copyright (C) 2002-2003 William Lachance (william.lachance@sympatico.ca)
5  * Copyright (C) 2004 Fridrich Strba (fridrich.strba@bluewin.ch)
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
20  *
21  * For further information visit http://libwpd.sourceforge.net
22  *
23  */
24 
25 /* "This product is not manufactured, approved, or supported by
26  * Corel Corporation or Corel Corporation Limited."
27  */
28 #ifndef _TABLESTYLE_H
29 #define _TABLESTYLE_H
30 #if defined _MSC_VER
31 #pragma warning( push, 1 )
32 #endif
33 #include <libwpd/libwpd.h>
34 #if defined _MSC_VER
35 #pragma warning( pop )
36 #endif
37 #include <vector>
38 
39 #include "Style.hxx"
40 #include "WriterProperties.hxx"
41 
42 class DocumentElement;
43 class DocumentHandler;
44 
45 class TableCellStyle : public Style
46 {
47 public:
48 	TableCellStyle(const WPXPropertyList &xPropList, const char *psName);
49 	virtual void write(DocumentHandler *pHandler) const;
50 private:
51         WPXPropertyList mPropList;
52 };
53 
54 class TableRowStyle : public Style
55 {
56 public:
57 	TableRowStyle(const WPXPropertyList &propList, const char *psName);
58 	virtual void write(DocumentHandler *pHandler) const;
59 private:
60         WPXPropertyList mPropList;
61 };
62 
63 class TableStyle : public Style, public TopLevelElementStyle
64 {
65 public:
66 	TableStyle(const WPXPropertyList &xPropList, const WPXPropertyListVector &columns, const char *psName);
67 	~TableStyle();
68 	virtual void write(DocumentHandler *pHandler) const;
getNumColumns() const69 	int getNumColumns() const { return mColumns.count(); }
addTableCellStyle(TableCellStyle * pTableCellStyle)70 	void addTableCellStyle(TableCellStyle *pTableCellStyle) { mTableCellStyles.push_back(pTableCellStyle); }
getNumTableCellStyles()71 	int getNumTableCellStyles() { return mTableCellStyles.size(); }
addTableRowStyle(TableRowStyle * pTableRowStyle)72 	void addTableRowStyle(TableRowStyle *pTableRowStyle) { mTableRowStyles.push_back(pTableRowStyle); }
getNumTableRowStyles()73 	int getNumTableRowStyles() { return mTableRowStyles.size(); }
74 private:
75         WPXPropertyList mPropList;
76 	WPXPropertyListVector mColumns;
77 	std::vector<TableCellStyle *> mTableCellStyles;
78 	std::vector<TableRowStyle *> mTableRowStyles;
79 };
80 #endif
81