kpresenter

KPrWebPresentation.h
1/* This file is part of the KDE project
2 Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
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; either
7 version 2 of the License, or (at your option) any later version.
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 webpresentation_h
21#define webpresentation_h
22
23#include <kwizard.h>
24
25#include <tqdialog.h>
26#include <tqvaluelist.h>
27
28
29class KPrDocument;
30class KPrView;
31
32class KURLRequester;
33class KColorButton;
34class TDEListView;
35class KIntNumInput;
36class KLineEdit;
37class KComboBox;
38
39class TQVBox;
40class TQHBox;
41
42class TQListViewItem;
43class TQCloseEvent;
44class KProgress;
45class TQLabel;
46
47class TQCheckBox;
48
49class KPrWebPresentation
50{
51public:
52
53 KPrWebPresentation( KPrDocument *_doc, KPrView *_view );
54 KPrWebPresentation( const TQString &_config, KPrDocument *_doc, KPrView *_view );
55 KPrWebPresentation( const KPrWebPresentation &webPres );
56
57 void setAuthor( const TQString &_author )
58 { author = _author; }
59 void setEMail( const TQString &_email )
60 { email = _email; }
61 void setTitle( const TQString &_title )
62 { title = _title; }
63 void setBackColor( const TQColor &_backColor )
64 { backColor = _backColor; }
65 void setTitleColor( const TQColor &_titleColor )
66 { titleColor = _titleColor; }
67 void setTextColor( const TQColor &_textColor )
68 { textColor = _textColor; }
69 void setXML( bool _xml )
70 { xml = _xml; }
71 void setWriteHeader( bool _writeHeader )
72 { m_bWriteHeader = _writeHeader; }
73 void setWriteFooter( bool _writeFooter )
74 { m_bWriteFooter = _writeFooter; }
75 void setLoopSlides( bool _loopSlides )
76 { m_bLoopSlides = _loopSlides; }
77 void setPath( const TQString &_path )
78 { path = _path; }
79 void setZoom( int _zoom )
80 { zoom = _zoom; }
81 void setTimeBetweenSlides( int _timeBetweenSlides )
82 { timeBetweenSlides = _timeBetweenSlides; } // PAU
83 void setEncoding( const TQString &_encoding ) { m_encoding = _encoding; }
84
85 TQString getAuthor() const { return author; }
86 TQString getEmail() const { return email; }
87 TQString getTitle() const { return title; }
88 TQColor getBackColor() const { return backColor; }
89 TQColor getTitleColor() const { return titleColor; }
90 TQColor getTextColor() const { return textColor; }
91 bool isXML() const { return xml; }
92 bool wantHeader() const { return m_bWriteHeader; }
93 bool wantFooter() const { return m_bWriteFooter; }
94 bool wantLoopSlides() const { return m_bLoopSlides; }
95 TQString getPath() const { return path; }
96 int getZoom() const { return zoom; }
97 int getTimeBetweenSlides() const { return timeBetweenSlides; } // PAU
98 TQString getEncoding() const { return m_encoding; }
99
100 struct SlideInfo {
101 int pageNumber; /* 0-based */
102 TQString slideTitle;
103 };
104 // Each entry in this list is a page (number+title).
105 // This allows to skip pages.
106 TQValueList<SlideInfo> getSlideInfos() const { return slideInfos; }
107
108 void setSlideTitle( int i, const TQString &slideTitle )
109 { slideInfos[i].slideTitle = slideTitle; }
110
111 void setConfig( const TQString &_config )
112 { config = _config; }
113 TQString getConfig() const { return config; }
114
115 void loadConfig();
116 void saveConfig();
117
118 int initSteps() const { return 7; }
119 int slides1Steps() { return slideInfos.count(); }
120 int slides2Steps() { return slideInfos.count(); }
121 int mainSteps() const { return 1; }
122
123 void initCreation( KProgress *progressBar );
124 void createSlidesPictures( KProgress *progressBar );
125 void createSlidesHTML( KProgress *progressBar );
126 void createMainPage( KProgress *progressBar );
127
128protected:
129 void init();
130 TQString escapeHtmlText( TQTextCodec *codec, const TQString& strText ) const;
131 void writeStartOfHeader(TQTextStream& streamOut, TQTextCodec *codec,
132 const TQString& subtitle, const TQString& dest );
133
134 KPrDocument *doc;
135 KPrView *view;
136 TQString config;
137 TQString author, title, email;
138 TQValueList<SlideInfo> slideInfos;
139 TQColor backColor, titleColor, textColor;
140 TQString path;
141 bool xml;
142 bool m_bWriteHeader, m_bWriteFooter, m_bLoopSlides;
143 int timeBetweenSlides;
144 int zoom;
145 TQString m_encoding;
146};
147
148class KPrWebPresentationWizard : public KWizard
149{
150 TQ_OBJECT
151
152
153public:
154 KPrWebPresentationWizard( const TQString &_config, KPrDocument *_doc, KPrView *_view );
155 ~KPrWebPresentationWizard();
156
157 static void createWebPresentation( const TQString &_config, KPrDocument *_doc, KPrView *_view );
158
159protected:
160
161 void setupPage1();
162 void setupPage2();
163 void setupPage3();
164 void setupPage4();
165 void setupPage5(); // PAU
166
167 void closeEvent( TQCloseEvent *e );
168
169 TQString config;
170 KPrDocument *doc;
171 KPrView *view;
172 KPrWebPresentation webPres;
173
174 TQHBox *page1, *page2, *page3, *page4, *page5; // PAU
175 TQCheckBox *writeHeader, *writeFooter, *loopSlides; // PAU
176 KLineEdit *author, *title, *email;
177 KColorButton *textColor, *titleColor, *backColor;
178 KComboBox *encoding, *doctype;
179 KIntNumInput *zoom, *timeBetweenSlides; // PAU
180 KURLRequester *path;
181 TDEListView *slideTitles;
182 KLineEdit *slideTitle;
183
184protected slots:
185 virtual void finish();
186 void pageChanged();
187 void slotChoosePath(const TQString &);
188 void slideTitleChanged( const TQString & );
189 void slideTitleChanged( TQListViewItem * );
190
191};
192
193class KPrWebPresentationCreateDialog : public TQDialog
194{
195 TQ_OBJECT
196
197
198public:
199 KPrWebPresentationCreateDialog( KPrDocument *_doc, KPrView *_view, const KPrWebPresentation &_webPres );
200 ~KPrWebPresentationCreateDialog();
201
202 static void createWebPresentation( KPrDocument *_doc, KPrView *_view, const KPrWebPresentation &_webPres );
203
204 void start();
205
206 void initCreation();
207 void createSlidesPictures();
208 void createSlidesHTML();
209 void createMainPage();
210
211protected:
212 void setupGUI();
213 void resizeEvent( TQResizeEvent *e );
214
215 KPrView *view;
216 KPrDocument *doc;
217 KPrWebPresentation webPres;
218
219 KProgress *progressBar;
220 TQLabel *step1, *step2, *step3, *step4, *step5;
221 TQPushButton *bDone, *bSave;
222 TQVBox *back;
223
224protected slots:
225 void saveConfig();
226
227};
228#endif