00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
#ifndef __kofontdia_h__
00021
#define __kofontdia_h__
00022
00023
#include <kfontdialog.h>
00024
#include <qtabwidget.h>
00025
#include <kotextformat.h>
00026
#include <qcheckbox.h>
00027
class QComboBox;
00028
00032 class KoFontChooser :
public QTabWidget
00033 {
00034 Q_OBJECT
00035
public:
00041
KoFontChooser(
QWidget * parent,
const char* name = 0L,
00042
bool _withSubSuperScript =
true, uint fontListCriteria=0);
00043
virtual ~
KoFontChooser();
00044
00047
void setFormat(
const KoTextFormat& format );
00048
00051
KoTextFormat newFormat()
const;
00052
00055 int changedFlags()
const {
return m_changedFlags; }
00056
00057
protected:
00058
void setFont(
const QFont &_font,
bool _subscript,
bool _superscript );
00059
void setColor(
const QColor & col );
00060
void setBackGroundColor(
const QColor & col );
00061
00062
bool superScript()
const {
return m_superScript->isChecked(); }
00063
bool subScript()
const {
return m_subScript->isChecked(); }
00064 KoTextFormat::VerticalAlignment vAlign()
const {
00065
return m_subScript->isChecked() ? KoTextFormat::AlignSubScript :
00066 m_superScript->isChecked() ? KoTextFormat::AlignSuperScript :
00067 KoTextFormat::AlignNormal; }
00068
00069
QFont newFont()
const {
return m_newFont; }
00070
QColor color() const;
00071
QColor backGroundColor()
const {
return m_backGroundColor;}
00072
QColor underlineColor()
const {
return m_underlineColor ; }
00073
00074
void setUnderlineColor(
const QColor & col );
00075
00076
00077 KoTextFormat::UnderlineType underlineType() const;
00078
KoTextFormat::UnderlineStyle underlineStyle() const;
00079
KoTextFormat::StrikeOutType strikeOutType() const;
00080
KoTextFormat::StrikeOutStyle strikeOutStyle() const;
00081
00082
void setUnderlineType(
KoTextFormat::UnderlineType nb);
00083
void setStrikeOutlineType(
KoTextFormat::StrikeOutType nb);
00084
void setUnderlineStyle(
KoTextFormat::UnderlineStyle _t);
00085
void setStrikeOutStyle(
KoTextFormat::StrikeOutStyle _t);
00086
00087
void setShadow(
double shadowDistanceX,
double shadowDistanceY, const
QColor& shadowColor );
00088
double shadowDistanceX() const;
00089
double shadowDistanceY() const;
00090
QColor shadowColor() const;
00091
00092
bool wordByWord()const;
00093
void setWordByWord(
bool _b);
00094
00095
bool hyphenation() const;
00096
void setHyphenation(
bool _b);
00097
00098
QString language() const;
00099
void setLanguage( const
QString & );
00100
00101
KoTextFormat::AttributeStyle fontAttribute() const;
00102
void setFontAttribute(
KoTextFormat::AttributeStyle _att);
00103
00104
00105
double relativeTextSize() const;
00106
void setRelativeTextSize(
double _size);
00107
00108
int offsetFromBaseLine() const;
00109
void setOffsetFromBaseLine(
int _offset);
00110
00111
void setupTab1(
bool _withSubSuperScript, uint fontListCriteria );
00112
void setupTab2();
00113
void updatePositionButton();
00114
00115 protected slots:
00116
void slotSuperScriptClicked();
00117
void slotSubScriptClicked();
00118
void slotStrikeOutTypeChanged(
int );
00119
void slotFontChanged(const
QFont &);
00120
void slotChangeColor();
00121
void slotChangeBackGroundColor();
00122
void slotUnderlineColor();
00123
void slotChangeUnderlineType(
int );
00124
void slotChangeUnderlining(
int);
00125
00126
void slotChangeStrikeOutType(
int );
00127
void slotShadowChanged();
00128
void slotRelativeSizeChanged(
int );
00129
void slotOffsetFromBaseLineChanged(
int );
00130
void slotChangeAttributeFont(
int );
00131
void slotWordByWordClicked();
00132
void slotChangeLanguage(
int );
00133
void slotHyphenationClicked();
00134 private:
00135 KFontChooser *m_chooseFont;
00136
QCheckBox *m_superScript;
00137
QCheckBox *m_subScript;
00138
00139
QComboBox *m_underlining;
00140
QComboBox *m_underlineType;
00141
00142
QComboBox *m_strikeOutType;
00143
QPushButton *m_underlineColorButton;
00144
00145
QPushButton *m_colorButton;
00146
QPushButton *m_backGroundColorButton;
00147
00148 class KoFontChooserPrivate;
00149 KoFontChooserPrivate* d;
00150
00151 QFont m_newFont;
00152
QColor m_backGroundColor;
00153
QColor m_underlineColor;
00154
00155
int m_changedFlags;
00156 };
00157
00158 class KoFontDia : public KDialogBase
00159 {
00160 Q_OBJECT
00161
public:
00162 KoFontDia(
const KoTextFormat& initialFormat,
00163
QWidget* parent,
const char* name );
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
int changedFlags()
const {
return m_chooser->changedFlags(); }
00194
00195
KoTextFormat newFormat()
const {
return m_chooser->newFormat(); }
00196
00197
protected slots:
00198
void slotReset();
00199
virtual void slotApply();
00200
virtual void slotOk();
00201 signals:
00202
void applyFont();
00203
00204
private:
00205
KoFontChooser * m_chooser;
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
KoTextFormat m_initialFormat;
00226 };
00227
00228
#endif