~ubuntu-branches/ubuntu/edgy/koffice/edgy-updates

« back to all changes in this revision

Viewing changes to kpresenter/styledia.h

  • Committer: Bazaar Package Importer
  • Author(s): Ben Burton
  • Date: 2004-05-09 11:33:00 UTC
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20040509113300-xi5t1z4yxe7n03x7
Tags: upstream-1.3.1
ImportĀ upstreamĀ versionĀ 1.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4; -*-
1
2
/* This file is part of the KDE project
2
3
   Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
3
4
 
20
21
#ifndef STYLEDIA_H
21
22
#define STYLEDIA_H
22
23
 
23
 
#include <global.h>
 
24
#include "global.h"
24
25
 
25
26
#include <qtabdialog.h>
26
27
#include <qframe.h>
27
28
#include <qpen.h>
28
 
 
 
29
#include <koRect.h>
29
30
class QPainter;
30
31
class KColorButton;
31
 
class QComboBox;
32
 
class QSpinBox;
 
32
class KComboBox;
 
33
class KIntNumInput;
33
34
class QCheckBox;
34
35
class QSlider;
35
36
class KPGradient;
36
37
class QResizeEvent;
37
38
class QWidgetStack;
38
39
class QLabel;
 
40
class KoZoomHandler;
 
41
class QLineEdit;
 
42
class ConfPieDia;
 
43
class ConfRectDia;
 
44
class ConfPolygonDia;
 
45
class ConfPictureDia;
 
46
class KPrCanvas;
 
47
class KPresenterDoc;
 
48
class KDoubleNumInput;
39
49
 
40
50
/******************************************************************/
41
 
/* class Pen and Brush preview                                    */
 
51
/* class Pen and Brush preview                    */
42
52
/******************************************************************/
43
53
 
44
54
class PBPreview : public QFrame
47
57
 
48
58
public:
49
59
    enum PaintType {
50
 
        Pen,
51
 
        Brush,
52
 
        Gradient
 
60
        Pen,
 
61
        Brush,
 
62
        Gradient
53
63
    };
54
64
 
55
65
    PBPreview( QWidget* parent, const char* name, PaintType _paintType );
56
 
 
57
 
    void setPen( QPen _pen ) { pen = _pen; repaint( true ); }
58
 
    void setBrush( QBrush _brush ) { brush = _brush; }
 
66
    ~PBPreview();
 
67
    void setPen( const QPen &_pen ) { pen = _pen; repaint( true ); }
 
68
    void setBrush( const QBrush &_brush ) { brush = _brush; }
59
69
    void setLineBegin( LineEnd lb ) { lineBegin = lb; repaint( true ); }
60
70
    void setLineEnd( LineEnd le ) { lineEnd = le; repaint( true ); }
61
71
    void setGradient( KPGradient *g ) { gradient = g; }
62
 
    void setPaintType( PaintType pt ) { paintType = pt; }
 
72
    void setPaintType( PaintType pt ) { paintType = pt; repaint(true);}
63
73
 
64
74
protected:
65
75
    void drawContents( QPainter *p );
71
81
    QBrush brush;
72
82
    LineEnd lineBegin, lineEnd;
73
83
    KPGradient *gradient;
74
 
 
 
84
    KoZoomHandler *_zoomHandler;
75
85
};
76
86
 
77
87
/******************************************************************/
78
 
/* class StyleDia                                                 */
 
88
/* class ConfPenDia                                               */
79
89
/******************************************************************/
80
90
 
81
 
class StyleDia : public QTabDialog
 
91
class ConfPenDia : public QWidget
82
92
{
83
93
    Q_OBJECT
84
94
 
85
95
public:
86
 
    enum PbType {
87
 
        SdPen = 1,
88
 
        SdBrush = 2,
89
 
        SdGradient = 4,
90
 
        SdEndBeginLine = 8,
91
 
        SdAll = SdPen | SdBrush | SdGradient | SdEndBeginLine
92
 
    };
93
 
 
94
 
    StyleDia( QWidget* parent = 0, const char* name = 0, int flags = SdAll );
95
 
    ~StyleDia();
 
96
    ConfPenDia( QWidget* parent, const char* name, int flags);
 
97
    ~ConfPenDia();
96
98
 
97
99
    void setPen( const QPen &_pen );
98
 
    void setBrush( const QBrush &_brush );
99
100
    void setLineBegin( LineEnd lb );
100
101
    void setLineEnd( LineEnd le );
 
102
    void resetConfigChangedValues();
 
103
 
 
104
    QPen getPen()const;
 
105
    LineEnd getLineBegin()const;
 
106
    LineEnd getLineEnd()const;
 
107
    int getPenConfigChange() const;
 
108
 
 
109
private:
 
110
    int m_flags;
 
111
    bool m_bLineBeginChanged, m_bLineEndChanged;
 
112
    bool m_bColorChanged, m_bStyleChanged, m_bWidthChanged;
 
113
    QPen oldPen;
 
114
    LineEnd oldLb;
 
115
    LineEnd oldLe;
 
116
    KColorButton *choosePCol;
 
117
    KIntNumInput *choosePWidth;
 
118
    PBPreview *penPrev;
 
119
    KComboBox *choosePStyle, *clineBegin, *clineEnd;
 
120
 
 
121
private slots:
 
122
    void slotReset();
 
123
    void slotColorChanged();
 
124
    void slotStyleChanged();
 
125
    void slotWidthChanged();
 
126
    void slotLineBeginChanged();
 
127
    void slotLineEndChanged();
 
128
};
 
129
 
 
130
/******************************************************************/
 
131
/* class ConfBrushDia                                             */
 
132
/******************************************************************/
 
133
 
 
134
class ConfBrushDia : public QWidget
 
135
{
 
136
    Q_OBJECT
 
137
 
 
138
public:
 
139
    ConfBrushDia( QWidget* parent, const char* name, int flags);
 
140
    ~ConfBrushDia();
 
141
 
 
142
    void setBrush( const QBrush &_brush );
101
143
    void setFillType( FillType ft );
102
144
    void setGradient( const QColor &_c1, const QColor &_c2, BCType _t,
103
 
                      bool _unbalanced, int _xfactor, int _yfactor );
104
 
    void setSticky( bool s );
 
145
                      bool _unbalanced, int _xfactor, int _yfactor );
 
146
    void resetConfigChangedValues();
105
147
 
106
 
    QPen getPen();
107
 
    QBrush getBrush();
108
 
    LineEnd getLineBegin();
109
 
    LineEnd getLineEnd();
110
 
    FillType getFillType();
111
 
    QColor getGColor1();
112
 
    QColor getGColor2();
113
 
    BCType getGType();
114
 
    bool getGUnbalanced();
115
 
    int getGXFactor();
116
 
    int getGYFactor();
117
 
    bool isSticky();
 
148
    QBrush getBrush()const;
 
149
    FillType getFillType() const;
 
150
    QColor getGColor1()const;
 
151
    QColor getGColor2()const;
 
152
    BCType getGType()const;
 
153
    bool getGUnbalanced()const;
 
154
    int getGXFactor() const;
 
155
    int getGYFactor() const;
 
156
    int getBrushConfigChange() const;
118
157
 
119
158
private:
120
 
    void setupTab1();
121
 
    void setupTab2();
122
 
    void setupTab3();
123
 
 
124
 
    QWidgetStack *stack;
125
 
    KColorButton *choosePCol, *chooseBCol;
126
 
    QComboBox *choosePStyle, *chooseBStyle, *clineBegin, *clineEnd, *cFillType;
127
 
    QSpinBox *choosePWidth;
128
 
    PBPreview *penPrev, *brushPrev;
129
 
    QCheckBox *unbalanced, *sticky;
130
 
    QComboBox *gradients;
 
159
    bool oldUnbalanced;
 
160
    bool m_bBrushColorChanged, m_bBrushStyleChanged, m_bFillTypeChanged;
 
161
    bool m_bGColor1Changed, m_bGColor2Changed, m_bGTypeChanged, m_bGUnbalancedChanged;
 
162
    int m_flags, oldXfactor, oldYfactor;
 
163
    QCheckBox *unbalanced;
 
164
    QBrush oldBrush;
 
165
    FillType oldFillType;
 
166
    QColor oldC1, oldC2;
 
167
    BCType oldBCType;
 
168
    KComboBox *gradients, *chooseBStyle, *cFillType;
131
169
    KColorButton *gradient1, *gradient2;
132
170
    QSlider *xfactor, *yfactor;
133
171
    QLabel *xfactorLabel, *yfactorLabel;
134
172
    KPGradient *gradient;
135
 
    bool lockUpdate;
 
173
    QWidgetStack *stack;
 
174
    KColorButton *chooseBCol;
 
175
    PBPreview *brushPrev;
 
176
 
 
177
private slots:
 
178
    void slotReset();
 
179
    void slotBrushColorChanged();
 
180
    void slotBrushStyleChanged();
 
181
    void slotFillTypeChanged();
 
182
    void slotGColor1Changed();
 
183
    void slotGColor2Changed();
 
184
    void slotGTypeChanged();
 
185
    void slotGUnbalancedChanged();
 
186
    void slotGXFactorChanged();
 
187
    void slotGYFactorChanged();
 
188
};
 
189
 
 
190
/******************************************************************/
 
191
/* class StyleDia                         */
 
192
/******************************************************************/
 
193
 
 
194
class StyleDia : public QTabDialog
 
195
{
 
196
    Q_OBJECT
 
197
 
 
198
public:
 
199
    enum PbType {
 
200
        SdPen = 1,
 
201
        SdBrush = 2,
 
202
        SdGradient = 4,
 
203
        SdEndBeginLine = 8,
 
204
        SdPie = 16,
 
205
        SdPicture = 32,
 
206
        SdPolygon = 64,
 
207
        SdRectangle = 128,
 
208
        SdOther = 256,
 
209
        SdAll = SdPen | SdBrush | SdGradient | SdEndBeginLine
 
210
    };
 
211
 
 
212
    StyleDia( QWidget* parent = 0, const char* name = 0, KPresenterDoc *_doc = 0,
 
213
              bool _noStickyObj = true, bool _oneObject=true, bool _alltextobj=false );
 
214
    ~StyleDia();
 
215
 
 
216
    void setSticky( PropValue p );
 
217
    bool isSticky()const;
 
218
    bool stickyNoChange()const;
 
219
 
 
220
    void setObjectName( QString &name );
 
221
    QString getObjectName()const;
 
222
 
 
223
    bool isOneObject()const {return oneObject;}
 
224
 
 
225
    void setProtected( PropValue p );
 
226
    bool isProtected()const;
 
227
    bool protectNoChange()const;
 
228
 
 
229
    void setKeepRatio( PropValue p );
 
230
    bool isKeepRatio()const;
 
231
    bool keepRatioNoChange()const;
 
232
 
 
233
 
 
234
    void setMargins( double left, double right, double top, double bottom);
 
235
 
 
236
    double marginsLeft();
 
237
    double marginsRight();
 
238
    double marginsBottom();
 
239
    double marginsTop();
 
240
 
 
241
    KoRect getNewSize() const;
 
242
    void setSize(const KoRect &);
 
243
 
 
244
    bool isAllTextObject()const {return allTextObj;}
 
245
    void setProtectContent( bool p );
 
246
    bool isProtectContent()const;
 
247
 
 
248
 
 
249
    ConfPenDia* getConfPenDia()const { return m_confPenDia; }
 
250
    ConfPieDia* getConfPieDia()const { return m_confPieDia; }
 
251
    ConfBrushDia* getConfBrushDia()const { return m_confBrushDia; }
 
252
    ConfRectDia* getConfRectangleDia()const { return m_confRectDia; }
 
253
    ConfPolygonDia* getConfPolygonDia()const { return m_confPolygonDia; }
 
254
    ConfPictureDia* getConfPictureDia()const { return m_confPictureDia; }
 
255
 
 
256
private:
 
257
    void setupTabPen();
 
258
    void setupTabBrush();
 
259
    void setupTabGeneral();
 
260
    void setupTabGeometry();
 
261
    void setupTabPie();
 
262
    void setupTabPolygon();
 
263
    void setupTabPicture();
 
264
    void setupTabRectangle();
 
265
 
 
266
    KoRect oldRect;
 
267
    QCheckBox *sticky, *protect, *keepRatio, *protectContent;
 
268
    QCheckBox *synchronize;
 
269
    QLineEdit *objectName;
 
270
    KDoubleNumInput *m_lineTop, *m_lineLeft, *m_lineWidth, *m_lineHeight;
 
271
    KDoubleNumInput *sml, *smt, *smb, *smr;
 
272
 
 
273
    KPresenterDoc *m_doc;
 
274
    KPrCanvas *m_canvas;
 
275
    ConfPenDia *m_confPenDia;
 
276
    ConfPieDia *m_confPieDia;
 
277
    ConfRectDia *m_confRectDia;
 
278
    ConfBrushDia *m_confBrushDia;
 
279
    ConfPolygonDia *m_confPolygonDia;
 
280
    ConfPictureDia *m_confPictureDia;
 
281
 
136
282
    int flags;
 
283
    bool lockUpdate, stickyObj, oneObject;
 
284
    bool allTextObj;
 
285
    PropValue oldSticky;
 
286
    QString oldObjectName;
 
287
    bool oldProtectContent;
 
288
    PropValue oldProtect;
 
289
    PropValue oldKeepRatio;
 
290
    double oldLeft;
 
291
    double oldTop;
 
292
    double oldBottom;
 
293
    double oldRight;
 
294
    double heightByWidthRatio;
137
295
 
138
296
private slots:
139
 
    void styleDone() { emit styleOk(); }
140
 
    void updatePenConfiguration();
141
 
    void updateBrushConfiguration();
142
 
 
 
297
    void slotReset();
 
298
    void styleDone();
 
299
    void protectChanged();
 
300
    void slotMarginsChanged( double );
 
301
    void slotProtectContentChanged( bool );
 
302
    void slotUpdateWidthForHeight( double );
 
303
    void slotUpdateHeightForWidth( double );
 
304
    void slotKeepRatioToggled( bool );
143
305
signals:
144
306
    void styleOk();
145
 
 
146
307
};
147
308
 
148
309
#endif //STYLEDIA_H