00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef webpresentation_h
00022 #define webpresentation_h
00023
00024 #include <kwizard.h>
00025
00026 #include <qdialog.h>
00027 #include <qvaluelist.h>
00028
00029
00030 class KPrDocument;
00031 class KPrView;
00032
00033 class KURLRequester;
00034 class KColorButton;
00035 class KListView;
00036 class KIntNumInput;
00037 class KLineEdit;
00038 class KComboBox;
00039
00040 class QVBox;
00041 class QHBox;
00042
00043 class QListViewItem;
00044 class QCloseEvent;
00045 class KProgress;
00046 class QLabel;
00047
00048 class QCheckBox;
00049
00050 class KPrWebPresentation
00051 {
00052 public:
00053
00054 KPrWebPresentation( KPrDocument *_doc, KPrView *_view );
00055 KPrWebPresentation( const QString &_config, KPrDocument *_doc, KPrView *_view );
00056 KPrWebPresentation( const KPrWebPresentation &webPres );
00057
00058 void setAuthor( const QString &_author )
00059 { author = _author; }
00060 void setEMail( const QString &_email )
00061 { email = _email; }
00062 void setTitle( const QString &_title )
00063 { title = _title; }
00064 void setBackColor( const QColor &_backColor )
00065 { backColor = _backColor; }
00066 void setTitleColor( const QColor &_titleColor )
00067 { titleColor = _titleColor; }
00068 void setTextColor( const QColor &_textColor )
00069 { textColor = _textColor; }
00070 void setXML( bool _xml )
00071 { xml = _xml; }
00072 void setWriteHeader( bool _writeHeader )
00073 { m_bWriteHeader = _writeHeader; }
00074 void setWriteFooter( bool _writeFooter )
00075 { m_bWriteFooter = _writeFooter; }
00076 void setLoopSlides( bool _loopSlides )
00077 { m_bLoopSlides = _loopSlides; }
00078 void setPath( const QString &_path )
00079 { path = _path; }
00080 void setZoom( int _zoom )
00081 { zoom = _zoom; }
00082 void setTimeBetweenSlides( int _timeBetweenSlides )
00083 { timeBetweenSlides = _timeBetweenSlides; }
00084 void setEncoding( const QString &_encoding ) { m_encoding = _encoding; }
00085
00086 QString getAuthor() const { return author; }
00087 QString getEmail() const { return email; }
00088 QString getTitle() const { return title; }
00089 QColor getBackColor() const { return backColor; }
00090 QColor getTitleColor() const { return titleColor; }
00091 QColor getTextColor() const { return textColor; }
00092 bool isXML() const { return xml; }
00093 bool wantHeader() const { return m_bWriteHeader; }
00094 bool wantFooter() const { return m_bWriteFooter; }
00095 bool wantLoopSlides() const { return m_bLoopSlides; }
00096 QString getPath() const { return path; }
00097 int getZoom() const { return zoom; }
00098 int getTimeBetweenSlides() const { return timeBetweenSlides; }
00099 QString getEncoding() const { return m_encoding; }
00100
00101 struct SlideInfo {
00102 int pageNumber;
00103 QString slideTitle;
00104 };
00105
00106
00107 QValueList<SlideInfo> getSlideInfos() const { return slideInfos; }
00108
00109 void setSlideTitle( int i, const QString &slideTitle )
00110 { slideInfos[i].slideTitle = slideTitle; }
00111
00112 void setConfig( const QString &_config )
00113 { config = _config; }
00114 QString getConfig() const { return config; }
00115
00116 void loadConfig();
00117 void saveConfig();
00118
00119 int initSteps() const { return 7; }
00120 int slides1Steps() { return slideInfos.count(); }
00121 int slides2Steps() { return slideInfos.count(); }
00122 int mainSteps() const { return 1; }
00123
00124 void initCreation( KProgress *progressBar );
00125 void createSlidesPictures( KProgress *progressBar );
00126 void createSlidesHTML( KProgress *progressBar );
00127 void createMainPage( KProgress *progressBar );
00128
00129 protected:
00130 void init();
00131 QString escapeHtmlText( QTextCodec *codec, const QString& strText ) const;
00132 void writeStartOfHeader(QTextStream& streamOut, QTextCodec *codec,
00133 const QString& subtitle, const QString& dest );
00134
00135 KPrDocument *doc;
00136 KPrView *view;
00137 QString config;
00138 QString author, title, email;
00139 QValueList<SlideInfo> slideInfos;
00140 QColor backColor, titleColor, textColor;
00141 QString path;
00142 bool xml;
00143 bool m_bWriteHeader, m_bWriteFooter, m_bLoopSlides;
00144 int timeBetweenSlides;
00145 int zoom;
00146 QString m_encoding;
00147 };
00148
00149 class KPrWebPresentationWizard : public KWizard
00150 {
00151 Q_OBJECT
00152
00153 public:
00154 KPrWebPresentationWizard( const QString &_config, KPrDocument *_doc, KPrView *_view );
00155 ~KPrWebPresentationWizard();
00156
00157 static void createWebPresentation( const QString &_config, KPrDocument *_doc, KPrView *_view );
00158
00159 protected:
00160
00161 void setupPage1();
00162 void setupPage2();
00163 void setupPage3();
00164 void setupPage4();
00165 void setupPage5();
00166
00167 void closeEvent( QCloseEvent *e );
00168
00169 QString config;
00170 KPrDocument *doc;
00171 KPrView *view;
00172 KPrWebPresentation webPres;
00173
00174 QHBox *page1, *page2, *page3, *page4, *page5;
00175 QCheckBox *writeHeader, *writeFooter, *loopSlides;
00176 KLineEdit *author, *title, *email;
00177 KColorButton *textColor, *titleColor, *backColor;
00178 KComboBox *encoding, *doctype;
00179 KIntNumInput *zoom, *timeBetweenSlides;
00180 KURLRequester *path;
00181 KListView *slideTitles;
00182 KLineEdit *slideTitle;
00183
00184 protected slots:
00185 virtual void finish();
00186 void pageChanged();
00187 void slotChoosePath(const QString &);
00188 void slideTitleChanged( const QString & );
00189 void slideTitleChanged( QListViewItem * );
00190
00191 };
00192
00193 class KPrWebPresentationCreateDialog : public QDialog
00194 {
00195 Q_OBJECT
00196
00197 public:
00198 KPrWebPresentationCreateDialog( KPrDocument *_doc, KPrView *_view, const KPrWebPresentation &_webPres );
00199 ~KPrWebPresentationCreateDialog();
00200
00201 static void createWebPresentation( KPrDocument *_doc, KPrView *_view, const KPrWebPresentation &_webPres );
00202
00203 void start();
00204
00205 void initCreation();
00206 void createSlidesPictures();
00207 void createSlidesHTML();
00208 void createMainPage();
00209
00210 protected:
00211 void setupGUI();
00212 void resizeEvent( QResizeEvent *e );
00213
00214 KPrView *view;
00215 KPrDocument *doc;
00216 KPrWebPresentation webPres;
00217
00218 KProgress *progressBar;
00219 QLabel *step1, *step2, *step3, *step4, *step5;
00220 QPushButton *bDone, *bSave;
00221 QVBox *back;
00222
00223 protected slots:
00224 void saveConfig();
00225
00226 };
00227 #endif