kword

KWTableTemplate.h
1/* This file is part of the KDE project
2 Copyright (C) 2002 Nash Hoogwater <nrhoogwater@wanadoo.nl>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; using
7 version 2 of the License.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef kwtabletemplate_h
21#define kwtabletemplate_h
22
23#include "KWTableStyle.h"
24
25#include <tqdom.h>
26#include <tqptrlist.h>
27#include <tqbrush.h>
28
29class KWTableTemplate;
30class KWDocument;
31
32/******************************************************************/
33/* Class: KWTableTemplateCollection */
34/******************************************************************/
35
36class KWTableTemplateCollection
37{
38public:
39 KWTableTemplateCollection();
40 ~KWTableTemplateCollection();
41 const TQPtrList<KWTableTemplate> & tableTemplateList() const { return m_templateList; }
42 void clear();
43
44 KWTableTemplate* findTableTemplate( const TQString & name );
48 KWTableTemplate* tableTemplateAt( int i ) { return m_templateList.at(i); }
49
50 KWTableTemplate* addTableTemplate( KWTableTemplate *tt );
51
52 void removeTableTemplate ( KWTableTemplate *tt );
53
54private:
55 TQPtrList<KWTableTemplate> m_templateList;
56 TQPtrList<KWTableTemplate> m_deletedTemplates;
57 KWTableTemplate *m_lastTemplate;
58};
59
60/******************************************************************/
61/* Class: KWTableTemplate */
62/******************************************************************/
63
64class KWTableTemplate
65{
66public:
67 KWTableTemplate( const TQString & name, KWTableStyle * _firstRow=0L, KWTableStyle * _firstCol=0L,
68 KWTableStyle *_lastRow=0L, KWTableStyle *_lastCol=0L, KWTableStyle *_bodyCell=0L,
69 KWTableStyle *_topLeftCorner=0L, KWTableStyle *_topRightCorner=0L,
70 KWTableStyle *_bottomLeftCorner=0L, KWTableStyle *_bottomRightCorner=0L );
71
72 KWTableTemplate( const KWTableTemplate & rhs ) { *this = rhs; }
73
74 KWTableTemplate( TQDomElement & parentElem, KWDocument *_doc, int docVersion=2 );
75
76 ~KWTableTemplate() {}
77
78 void operator=( const KWTableTemplate & );
79
81 TQString name() const { return m_name; }
82 void setName( const TQString & name ) { m_name = name; }
84 TQString displayName() const;
85
86 // ATTRIBUTES
87 KWTableStyle firstRow() const { return *m_firstRow; }
88 KWTableStyle* pFirstRow() const { return m_firstRow; }
89 void setFirstRow( KWTableStyle *_tableStyle ) { m_firstRow = _tableStyle; }
90
91 KWTableStyle lastRow() const { return *m_lastRow; }
92 KWTableStyle* pLastRow() const { return m_lastRow; }
93 void setLastRow( KWTableStyle *_tableStyle ) { m_lastRow = _tableStyle; }
94
95 KWTableStyle firstCol() const { return *m_firstCol; }
96 KWTableStyle* pFirstCol() const { return m_firstCol; }
97 void setFirstCol( KWTableStyle *_tableStyle ) { m_firstCol = _tableStyle; }
98
99 KWTableStyle lastCol() const { return *m_lastCol; }
100 KWTableStyle* pLastCol() const { return m_lastCol; }
101 void setLastCol( KWTableStyle *_tableStyle ) { m_lastCol = _tableStyle; }
102
103 KWTableStyle bodyCell() const { return *m_bodyCell; }
104 KWTableStyle* pBodyCell() const { return m_bodyCell; }
105 void setBodyCell( KWTableStyle *_tableStyle ) { m_bodyCell = _tableStyle; }
106
107 KWTableStyle topLeftCorner() const { return *m_topLeftCorner; }
108 KWTableStyle* pTopLeftCorner() const { return m_topLeftCorner; }
109 void setTopLeftCorner( KWTableStyle *_tableStyle ) { m_topLeftCorner = _tableStyle; }
110
111 KWTableStyle topRightCorner() const { return *m_topRightCorner; }
112 KWTableStyle* pTopRightCorner() const { return m_topRightCorner; }
113 void setTopRightCorner( KWTableStyle *_tableStyle ) { m_topRightCorner = _tableStyle; }
114
115 KWTableStyle bottomRightCorner() const { return *m_bottomRightCorner; }
116 KWTableStyle* pBottomRightCorner() const { return m_bottomRightCorner; }
117 void setBottomRightCorner( KWTableStyle *_tableStyle ) { m_bottomRightCorner = _tableStyle; }
118
119 KWTableStyle bottomLeftCorner() const { return *m_bottomLeftCorner; }
120 KWTableStyle* pBottomLeftCorner() const { return m_bottomLeftCorner; }
121 void setBottomLeftCorner( KWTableStyle *_tableStyle ) { m_bottomLeftCorner = _tableStyle; }
122
123 // SAVING METHODS
124 void save( TQDomElement parentElem, KoTextZoomHandler* zh );
125 void saveTableTemplate( TQDomElement & parentElem );
126
127 // STATIC METHODS
128 static KWTableTemplate *loadTemplate( TQDomElement & parentElem, KWDocument *_doc, int docVersion=2 );
129
130private:
131 TQString m_name;
132 KWTableStyle *m_firstRow;
133 KWTableStyle *m_lastRow;
134 KWTableStyle *m_firstCol;
135 KWTableStyle *m_lastCol;
136 KWTableStyle *m_bodyCell;
137
138 KWTableStyle *m_topLeftCorner;
139 KWTableStyle *m_topRightCorner;
140 KWTableStyle *m_bottomRightCorner;
141 KWTableStyle *m_bottomLeftCorner;
142
143};
144
145#endif
Table style (can created/modified/deleted by the user) A table style is simply a paragraph style and ...