00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef framedia_h
00022 #define framedia_h
00023
00024 #include "defs.h"
00025 #include "KWTextFrameSet.h"
00026 #include <kdialogbase.h>
00027 #include <KoUnit.h>
00028 #include <KoUnitWidgets.h>
00029 #include <qgroupbox.h>
00030
00031 class KoBorderPreview;
00032 class KWFrame;
00033 class KWDocument;
00034 class KWPage;
00035 class QWidget;
00036 class QGridLayout;
00037 class QGroupBox;
00038 class QRadioButton;
00039 class QCheckBox;
00040 class QLabel;
00041 class QCloseEvent;
00042 class QListView;
00043 class QListViewItem;
00044 class QLineEdit;
00045 class KColorButton;
00046 class KDoubleNumInput;
00047
00048
00049
00050
00051 class KWBrushStylePreview : public QFrame
00052 {
00053 Q_OBJECT
00054 public:
00055 KWBrushStylePreview( QWidget* );
00056 ~KWBrushStylePreview() {}
00057 void setBrush( const QBrush& _brush ) { brush = _brush; }
00058 protected:
00059 void drawContents( QPainter* );
00060 private:
00061 QBrush brush;
00062 };
00063
00068 class KWFourSideConfigWidget : public QGroupBox
00069 {
00070 Q_OBJECT
00071 public:
00072 KWFourSideConfigWidget( KWDocument* m_doc, const QString& title, QWidget*, const char* name = 0 );
00073
00074 bool changed() const { return m_changed; }
00075
00076 void setValues( double left, double right, double top, double bottom );
00077 double leftValue() const;
00078 double rightValue() const;
00079 double topValue() const;
00080 double bottomValue() const;
00081
00082 signals:
00083
00084 public slots:
00085 void slotValueChanged( double );
00086
00087 private:
00088 KoUnitDoubleSpinBox *m_inputLeft, *m_inputRight, *m_inputTop, *m_inputBottom;
00089 QCheckBox *m_synchronize;
00090 KWDocument *m_doc;
00091 bool m_changed;
00092 bool m_noSignal;
00093 };
00094
00095
00096
00097
00098 class KWFrameDia : public KDialogBase
00099 {
00100 Q_OBJECT
00101 public:
00103 KWFrameDia( QWidget *parent, KWFrame *_frame,KWDocument *_doc,FrameSetType _ft);
00104 KWFrameDia( QWidget *parent, KWFrame *_frame);
00105 KWFrameDia( QWidget *parent, QPtrList<KWFrame> allFrames);
00106
00107
00108
00109
00110 protected:
00111 void init();
00112 bool applyChanges();
00113 void setupTab1();
00114 void setupTab2();
00115 void setupTab3();
00116 void setupTab4();
00117 void setupTab5();
00118 void setupTab6();
00119 void initBorderSettings();
00120 void initGeometrySettings();
00121
00122 void updateFrames();
00123 void enableOnNewPageOptions();
00124 void initBrush();
00125 bool mayDeleteFrameSet(KWTextFrameSet *fs);
00126 void enableSizeAndPosition();
00127
00128 QBrush frameBrushStyle() const;
00129 void calcRatio();
00130
00131 protected slots:
00132 virtual void slotApply();
00133 virtual void slotOk();
00134 void connectListSelected( QListViewItem * );
00135 void setFrameBehaviorInputOn();
00136 void setFrameBehaviorInputOff();
00137 void slotFloatingToggled(bool);
00138 void slotProtectSizeToggled(bool);
00139 void textNameFrameChanged ( const QString & );
00140
00141 void slotProtectContentChanged( bool );
00142 void enableRunAround();
00143 void selectExistingFrameset();
00144 void selectNewFrameset(bool on);
00145 void slotUpdateWidthForHeight(double height);
00146 void slotUpdateHeightForWidth( double width );
00147 void slotKeepRatioToggled(bool on);
00148 void ensureValidFramesetSelected();
00149 void brdLeftToggled( bool );
00150 void brdRightToggled( bool );
00151 void brdTopToggled( bool );
00152 void brdBottomToggled( bool );
00153 void slotPressEvent(QMouseEvent *_ev);
00154 private:
00155
00156 QWidget *m_tab1;
00157 QGridLayout *m_grid1, *m_eofGrid, *m_onpGrid, *m_sideGrid;
00158 QGroupBox *m_endOfFrame, *m_onNewPage, *m_sideHeads;
00159 QCheckBox *m_cbCopy, *m_cbAspectRatio, *m_cbAllFrames;
00160 QCheckBox *m_cbProtectContent;
00161 QRadioButton *m_rResizeFrame, *m_rAppendFrame, *m_rNoShow, *m_reconnect, *m_noFollowup, *m_copyRadio;
00162 QLabel *sideTitle1, *sideTitle2;
00163 QLineEdit *m_sideWidth, *m_sideGap;
00164 QComboBox *m_sideAlign;
00165
00166
00167 QWidget *m_tab2;
00168 QRadioButton *m_rRunNo, *m_rRunBounding, *m_rRunSkip;
00169 QRadioButton *m_rRunLeft, *m_rRunRight, *m_rRunBiggest;
00170 QGroupBox *m_runGroup, *m_runSideGroup;
00171 KWFourSideConfigWidget* m_raDistConfigWidget;
00172
00173
00174 QWidget *m_tab3;
00175 QLineEdit *m_eFrameSetName;
00176 QListView *m_lFrameSList;
00177 QRadioButton *m_rExistingFrameset, *m_rNewFrameset;
00178
00179
00180
00181 QWidget *m_tab4;
00182 QGroupBox *m_grp1;
00183 QLabel *m_lx, *m_ly, *m_lw, *m_lh;
00184 KoUnitDoubleSpinBox *m_sx, *m_sy, *m_sw, *m_sh;
00185 KWFourSideConfigWidget* m_paddingConfigWidget;
00186 QCheckBox *m_floating;
00187 QCheckBox *m_protectSize;
00188
00189
00190 QWidget *m_tab5;
00191
00192
00193 QWidget *m_tab6;
00194 QComboBox *m_cWidth, *m_cStyle;
00195 QPushButton *m_bLeft, *m_bRight, *m_bTop, *m_bBottom;
00196 KColorButton *m_bColor;
00197 KoBorder m_leftBorder, m_rightBorder, m_topBorder, m_bottomBorder;
00198 KoBorderPreview *m_prev3;
00199
00200
00201 QCheckBox* m_transparentCB;
00202 KColorButton *m_brushColor;
00203
00204 QCheckBox *m_overwriteColor;
00205
00206 KWFrame *m_frame;
00207 KWFrame *m_mainFrame;
00208 QPtrList<KWFrame> m_allFrames;
00209 KWDocument *m_doc;
00210 FrameSetType m_frameType;
00211 bool m_frameSetFloating;
00212 bool m_frameSetProtectedSize;
00213 bool m_mainFrameSetIncluded;
00214 bool m_defaultFrameSetIncluded;
00215 double m_oldX, m_oldY, m_oldW, m_oldH;
00216 double m_heightByWidthRatio;
00217 int m_frameBehavior;
00218 KoUnit::Unit m_frameUnits;
00219 QString m_oldFrameSetName;
00220 QBrush m_newBrushStyle;
00221 bool m_noSignal;
00222 };
00223
00224 #endif