kword

KWTableTemplateSelector.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 kwtabletemplateselector_h
21#define kwtabletemplateselector_h
22
23#include <tqwidget.h>
24#include <tqgroupbox.h>
25#include <tqptrlist.h>
26
27#include <tqlabel.h>
28#include <tqpushbutton.h>
29/*#include <tqlayout.h>
30#include <tqfont.h>
31#include <tqbrush.h>
32*/
33
34class TQListBox;
35class TQCheckBox;
36class TQButtonGroup;
37class TQGroupBox;
38class TQRect;
39
40class KWTableTemplate;
41class KWTableTemplateCollection;
42class KoRect;
43class KoTextZoomHandler;
44class KWTextDocument;
45class KWDocument;
46class KWTableFrameSet;
47class KWTableStyle;
48
49/******************************************************************/
50/* Class: KWTableTemplatePreview */
51/******************************************************************/
52
53class KWTableTemplatePreview : public TQGroupBox
54{
55 TQ_OBJECT
56
57
58public:
59 KWTableTemplatePreview( const TQString& title, KWTableStyle *_emptyStyle, TQWidget* parent, const char* name=0L );
60 ~KWTableTemplatePreview();
61 void setTableTemplate(KWTableTemplate *_tableTemplate);
62 KWTableTemplate *getTableTemplate()const ;
63 void disableRepaint(bool _b) { m_disableRepaint =_b;}
64public slots:
65 void cbFirstRowChanged( bool );
66 void cbFirstColChanged( bool );
67 void cbLastRowChanged( bool );
68 void cbLastColChanged( bool );
69 void cbBodyChanged( bool );
70
71protected:
72 int bottomBorder(const int rows, const int cols, const int rowpos, const int colpos);
73 int rightBorder(const int rows, const int cols, const int rowpos, const int colpos);
74 void drawCell( TQPainter *p, const KWTableStyle *ts, const TQRect globalRect,
75 const int rows, int cols, int rowpos, int colpos, const TQString & txt);
76 void drawPreviewTable(TQPainter *p, int rows, int cols, TQRect globalRect);
77 void drawContents( TQPainter *p );
78 void setSpecialCells(KWTableTemplate *);
79
80 KWTableStyle *m_emptyStyle;
81 KWTextDocument *m_textdoc;
82 KoTextZoomHandler *m_zoomHandler;
83 KWTableTemplate *tableTemplate;
84 KWTableTemplate *origTableTemplate;
85 //necessary when we init preview
86 bool m_disableRepaint;
87private:
88 TQString m_contents[2][5];
89
90 void fillContents();
91};
92
93/******************************************************************/
94/* Class: KWTableTemplateSelector */
95/******************************************************************/
96
97class KWTableTemplateSelector : public TQWidget
98{
99 TQ_OBJECT
100
101
102public:
103 enum FormatType { FirstRow = 1 , FirstColumn = 2, LastRow = 4, LastCol =8, Body =16 };
104 KWTableTemplateSelector( KWDocument *_doc, TQWidget * _parent, const TQString & _tableTemplate, int _type = 31 , const char * _name = 0 );
105
106 KWTableTemplate *getTableTemplate()const ;
107 int getFormatType() const ;
108protected:
109 KWDocument *m_doc;
110
111 KWTableTemplatePreview *preview;
112 TQLabel *lTemplates;
113 TQListBox *lbTemplates;
114 TQPushButton *pbCustomize;
115
116 TQButtonGroup *bgCustomize;
117 TQCheckBox *cbFirstRow, *cbFirstCol, *cbLastRow, *cbLastCol, *cbBody;
118
119 int selectedTableTemplate;
120 void initFormat( int format);
121 void initPreview();
122protected slots:
123 void changeTableTemplate();
124};
125
126#endif
127
128
This class implements tables by acting as the manager for the frame(set)s which make up the table cel...
Table style (can created/modified/deleted by the user) A table style is simply a paragraph style and ...
This is our KoTextDocument reimplementation, to create KWTextParag instead of KoTextParags,...