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
|
/* This file is part of the KDE project
Copyright (C) 2002 Nash Hoogwater <nrhoogwater@wanadoo.nl>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; using
version 2 of the License.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef kwtabletemplateselector_h
#define kwtabletemplateselector_h
#include <qwidget.h>
#include <qgroupbox.h>
#include <qptrlist.h>
#include <qlabel.h>
#include <qpushbutton.h>
/*#include <qlayout.h>
#include <qfont.h>
#include <qbrush.h>
*/
class QListBox;
class QCheckBox;
class QButtonGroup;
class QGroupBox;
class QRect;
class KWTableTemplate;
class KWTableTemplateCollection;
class KoRect;
class KoTextZoomHandler;
class KWTextDocument;
class KWDocument;
class KWTableFrameSet;
class KWTableStyle;
/******************************************************************/
/* Class: KWTableTemplatePreview */
/******************************************************************/
class KWTableTemplatePreview : public QGroupBox
{
Q_OBJECT
public:
KWTableTemplatePreview( const QString& title, KWTableStyle *_emptyStyle, QWidget* parent, const char* name=0L );
~KWTableTemplatePreview();
void setTableTemplate(KWTableTemplate *_tableTemplate);
KWTableTemplate *getTableTemplate()const ;
void disableRepaint(bool _b) { m_disableRepaint =_b;}
public slots:
void cbFirstRowChanged( bool );
void cbFirstColChanged( bool );
void cbLastRowChanged( bool );
void cbLastColChanged( bool );
void cbBodyChanged( bool );
protected:
int bottomBorder(const int rows, const int cols, const int rowpos, const int colpos);
int rightBorder(const int rows, const int cols, const int rowpos, const int colpos);
void drawCell( QPainter *p, const KWTableStyle *ts, const QRect globalRect,
const int rows, int cols, int rowpos, int colpos, const QString & txt);
void drawPreviewTable(QPainter *p, int rows, int cols, QRect globalRect);
void drawContents( QPainter *p );
void setSpecialCells(KWTableTemplate *);
KWTableStyle *m_emptyStyle;
KWTextDocument *m_textdoc;
KoTextZoomHandler *m_zoomHandler;
KWTableTemplate *tableTemplate;
KWTableTemplate *origTableTemplate;
//necessary when we init preview
bool m_disableRepaint;
private:
QString m_contents[2][5];
void fillContents();
};
/******************************************************************/
/* Class: KWTableTemplateSelector */
/******************************************************************/
class KWTableTemplateSelector : public QWidget
{
Q_OBJECT
public:
enum FormatType { FirstRow = 1 , FirstColumn = 2, LastRow = 4, LastCol =8, Body =16 };
KWTableTemplateSelector( KWDocument *_doc, QWidget * _parent, const QString & _tableTemplate, int _type = 31 , const char * _name = 0 );
KWTableTemplate *getTableTemplate()const ;
int getFormatType() const ;
protected:
KWDocument *m_doc;
KWTableTemplatePreview *preview;
QLabel *lTemplates;
QListBox *lbTemplates;
QPushButton *pbCustomize;
QButtonGroup *bgCustomize;
QCheckBox *cbFirstRow, *cbFirstCol, *cbLastRow, *cbLastCol, *cbBody;
int selectedTableTemplate;
void initFormat( int format);
void initPreview();
protected slots:
void changeTableTemplate();
};
#endif
|