kword

KWTableStyleManager.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 kwtablestylemanager_h
21#define kwtablestylemanager_h
22
23#include "KWFrameStyle.h"
24#include "KWTableStyle.h"
25
26#include <kdialogbase.h>
27#include <tqgroupbox.h>
28#include <tqptrlist.h>
29
30
31class TQGridLayout;
32class TQLineEdit;
33class TQListBox;
34class TQPushButton;
35class TQWidget;
36class TQFrame;
37class TQComboBox;
38
39class KWDocument;
40class KoParagStyle;
41
42class KoTextDocument;
43
44/******************************************************************/
45/* Class: KWTableStylePreview */
46/******************************************************************/
47
48class KWTableStylePreview : public TQGroupBox
49{
50 TQ_OBJECT
51
52
53public:
54 KWTableStylePreview(const TQString &title, const TQString &text, TQWidget *parent, const char* name = 0);
55 virtual ~KWTableStylePreview();
56
57 void setTableStyle(KWTableStyle *_tableStyle);
58
59protected:
60 void drawContents( TQPainter *p );
61
62 KWTableStyle *tableStyle;
63
64 KoTextDocument *m_textdoc;
65 KoTextZoomHandler *m_zoomHandler;
66};
67
68class KWTableStyleListItem
69{
70 public:
71 KWTableStyleListItem() {}
72 ~KWTableStyleListItem();
73 KWTableStyleListItem(KWTableStyle *orig, KWTableStyle *changed) {
74 m_origTableStyle = orig;
75 m_changedTableStyle = changed;
76 }
77
78 KWTableStyle *origTableStyle()const { return m_origTableStyle; }
79 KWTableStyle *changedTableStyle()const { return m_changedTableStyle; }
80 void setOrigTableStyle( KWTableStyle *_orig ) { m_origTableStyle = _orig; }
81 void setChangedTableStyle( KWTableStyle *_changed ) { m_changedTableStyle = _changed; }
82 void deleteOrigTableStyle() { delete m_changedTableStyle; }
83 void deleteChangedTableStyle() { delete m_changedTableStyle; }
84
85 void switchStyle();
86 void deleteStyle( KWTableStyle *current );
87 void apply();
88
89 protected:
90 KWTableStyle *m_origTableStyle;
91 KWTableStyle *m_changedTableStyle;
92};
93
94/******************************************************************/
95/* Class: KWTableStyleManager */
96/******************************************************************/
97class KWTableStyleManager : public KDialogBase
98{
99 TQ_OBJECT
100
101
102public:
103 KWTableStyleManager( TQWidget *_parent, KWDocument *_doc );
104 ~KWTableStyleManager();
105
106private:
107 void setupWidget();
108 void addGeneralTab();
109 void apply();
110 void updateGUI();
111 void updatePreview();
112 void save();
113 int tableStyleIndex( int pos );
114
115 void addStyles(const TQPtrList<KWTableStyle> &listStyle );
116
117 TQListBox *m_stylesList;
118 TQLineEdit *m_nameString;
119 TQPushButton *m_deleteButton;
120 TQPushButton *m_newButton;
121 TQPushButton *m_moveUpButton;
122 TQPushButton *m_moveDownButton;
123 TQComboBox *m_frameStyle;
124 TQComboBox *m_style;
125 TQPushButton *m_changeFrameStyleButton;
126 TQPushButton *m_changeStyleButton;
127 TQStringList m_styleOrder;
128 TQGroupBox *previewBox;
129 KWTableStylePreview *preview;
130
131 TQWidget *main;
132
133 KWTableStyle *m_currentTableStyle;
134 TQPtrList<KWTableStyleListItem> m_tableStyles;
135 int numTableStyles;
136 bool noSignals;
137
138 KWDocument *m_doc;
139
140protected slots:
141 virtual void slotOk();
142 virtual void slotApply();
143 void updateAllStyleCombos();
144 void changeFrameStyle();
145 void changeStyle();
146 void selectFrameStyle(int);
147 void selectStyle(int);
148 void switchStyle();
149 void addStyle();
150 void deleteStyle();
151 void moveUpStyle();
152 void moveDownStyle();
153 void renameStyle(const TQString &);
154 void setupMain();
155 void importFromFile();
156};
157
158#endif