kword
KWTableTemplateSelector.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef kwtabletemplateselector_h
00021 #define kwtabletemplateselector_h
00022
00023 #include <qwidget.h>
00024 #include <qgroupbox.h>
00025 #include <qptrlist.h>
00026
00027 #include <qlabel.h>
00028 #include <qpushbutton.h>
00029
00030
00031
00032
00033
00034 class QListBox;
00035 class QCheckBox;
00036 class QButtonGroup;
00037 class QGroupBox;
00038 class QRect;
00039
00040 class KWTableTemplate;
00041 class KWTableTemplateCollection;
00042 class KoRect;
00043 class KoTextZoomHandler;
00044 class KWTextDocument;
00045 class KWDocument;
00046 class KWTableFrameSet;
00047 class KWTableStyle;
00048
00049
00050
00051
00052
00053 class KWTableTemplatePreview : public QGroupBox
00054 {
00055 Q_OBJECT
00056
00057 public:
00058 KWTableTemplatePreview( const QString& title, KWTableStyle *_emptyStyle, QWidget* parent, const char* name=0L );
00059 ~KWTableTemplatePreview();
00060 void setTableTemplate(KWTableTemplate *_tableTemplate);
00061 KWTableTemplate *getTableTemplate()const ;
00062 void disableRepaint(bool _b) { m_disableRepaint =_b;}
00063 public slots:
00064 void cbFirstRowChanged( bool );
00065 void cbFirstColChanged( bool );
00066 void cbLastRowChanged( bool );
00067 void cbLastColChanged( bool );
00068 void cbBodyChanged( bool );
00069
00070 protected:
00071 int bottomBorder(const int rows, const int cols, const int rowpos, const int colpos);
00072 int rightBorder(const int rows, const int cols, const int rowpos, const int colpos);
00073 void drawCell( QPainter *p, const KWTableStyle *ts, const QRect globalRect,
00074 const int rows, int cols, int rowpos, int colpos, const QString & txt);
00075 void drawPreviewTable(QPainter *p, int rows, int cols, QRect globalRect);
00076 void drawContents( QPainter *p );
00077 void setSpecialCells(KWTableTemplate *);
00078
00079 KWTableStyle *m_emptyStyle;
00080 KWTextDocument *m_textdoc;
00081 KoTextZoomHandler *m_zoomHandler;
00082 KWTableTemplate *tableTemplate;
00083 KWTableTemplate *origTableTemplate;
00084
00085 bool m_disableRepaint;
00086 private:
00087 QString m_contents[2][5];
00088
00089 void fillContents();
00090 };
00091
00092
00093
00094
00095
00096 class KWTableTemplateSelector : public QWidget
00097 {
00098 Q_OBJECT
00099
00100 public:
00101 enum FormatType { FirstRow = 1 , FirstColumn = 2, LastRow = 4, LastCol =8, Body =16 };
00102 KWTableTemplateSelector( KWDocument *_doc, QWidget * _parent, const QString & _tableTemplate, int _type = 31 , const char * _name = 0 );
00103
00104 KWTableTemplate *getTableTemplate()const ;
00105 int getFormatType() const ;
00106 protected:
00107 KWDocument *m_doc;
00108
00109 KWTableTemplatePreview *preview;
00110 QLabel *lTemplates;
00111 QListBox *lbTemplates;
00112 QPushButton *pbCustomize;
00113
00114 QButtonGroup *bgCustomize;
00115 QCheckBox *cbFirstRow, *cbFirstCol, *cbLastRow, *cbLastCol, *cbBody;
00116
00117 int selectedTableTemplate;
00118 void initFormat( int format);
00119 void initPreview();
00120 protected slots:
00121 void changeTableTemplate();
00122 };
00123
00124 #endif
00125
00126
|