koFontDia.h
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 #include <koffice_export.h>
00029 #include <config.h>
00030 #ifdef HAVE_LIBKSPELL2
00031 #include <kspell2/broker.h>
00032 #endif
00033 class QComboBox;
00034
00038 class KOTEXT_EXPORT KoFontChooser : public QTabWidget
00039 {
00040 Q_OBJECT
00041 public:
00049 KoFontChooser( QWidget * parent, const char* name = 0,
00050 bool _withSubSuperScript = true, uint fontListCriteria=0
00051 #ifdef HAVE_LIBKSPELL2
00052 , KSpell2::Broker::Ptr broker = 0
00053 #endif
00054 );
00055
00056 virtual ~KoFontChooser();
00057
00060 void setFormat( const KoTextFormat& format );
00061
00064 KoTextFormat newFormat() const;
00065
00068 int changedFlags() const { return m_changedFlags; }
00069
00070 protected:
00071 void setFont( const QFont &_font, bool _subscript, bool _superscript );
00072 void setColor( const QColor & col );
00073 void setBackGroundColor( const QColor & col );
00074
00075 bool superScript() const { return m_superScript->isChecked(); }
00076 bool subScript() const { return m_subScript->isChecked(); }
00077 KoTextFormat::VerticalAlignment vAlign() const {
00078 return m_subScript->isChecked() ? KoTextFormat::AlignSubScript :
00079 m_superScript->isChecked() ? KoTextFormat::AlignSuperScript :
00080 KoTextFormat::AlignNormal; }
00081
00082 QFont newFont() const { return m_newFont; }
00083 QColor color() const;
00084 QColor backGroundColor() const { return m_backGroundColor;}
00085 QColor underlineColor() const { return m_underlineColor ; }
00086
00087 void setUnderlineColor( const QColor & col );
00088
00089
00090 KoTextFormat::UnderlineType underlineType() const;
00091 KoTextFormat::UnderlineStyle underlineStyle() const;
00092 KoTextFormat::StrikeOutType strikeOutType() const;
00093 KoTextFormat::StrikeOutStyle strikeOutStyle() const;
00094
00095 void setUnderlineType(KoTextFormat::UnderlineType nb);
00096 void setStrikeOutlineType(KoTextFormat::StrikeOutType nb);
00097 void setUnderlineStyle(KoTextFormat::UnderlineStyle _t);
00098 void setStrikeOutStyle(KoTextFormat::StrikeOutStyle _t);
00099
00100 void setShadow( double shadowDistanceX, double shadowDistanceY, const QColor& shadowColor );
00101 double shadowDistanceX() const;
00102 double shadowDistanceY() const;
00103 QColor shadowColor() const;
00104
00105 bool wordByWord()const;
00106 void setWordByWord( bool _b);
00107
00108 bool hyphenation() const;
00109 void setHyphenation( bool _b);
00110
00111 QString language() const;
00112 void setLanguage( const QString & );
00113
00114 KoTextFormat::AttributeStyle fontAttribute() const;
00115 void setFontAttribute( KoTextFormat::AttributeStyle _att);
00116
00117
00118 double relativeTextSize() const;
00119 void setRelativeTextSize(double _size);
00120
00121 int offsetFromBaseLine() const;
00122 void setOffsetFromBaseLine(int _offset);
00123
00124 void setupTab1( uint fontListCriteria );
00125 void setupTab2( bool _withSubSuperScript );
00126 void updatePositionButton();
00127
00128 protected slots:
00129 void slotSuperScriptClicked();
00130 void slotSubScriptClicked();
00131 void slotStrikeOutTypeChanged( int );
00132 void slotFontChanged(const QFont &);
00133 void slotChangeColor();
00134 void slotChangeBackGroundColor();
00135 void slotUnderlineColor();
00136 void slotChangeUnderlineType( int );
00137 void slotChangeUnderlining( int);
00138
00139 void slotChangeStrikeOutType( int );
00140 void slotShadowChanged();
00141 void slotRelativeSizeChanged( int );
00142 void slotOffsetFromBaseLineChanged( int );
00143 void slotChangeAttributeFont( int );
00144 void slotWordByWordClicked();
00145 void slotChangeLanguage( int );
00146 void slotHyphenationClicked();
00147 private:
00148 KFontChooser *m_chooseFont;
00149 QCheckBox *m_superScript;
00150 QCheckBox *m_subScript;
00151
00152 QComboBox *m_underlining;
00153 QComboBox *m_underlineType;
00154
00155 QComboBox *m_strikeOutType;
00156 QPushButton *m_underlineColorButton;
00157
00158 QPushButton *m_colorButton;
00159 QPushButton *m_backGroundColorButton;
00160
00161 class KoFontChooserPrivate;
00162 KoFontChooserPrivate* d;
00163
00164 QFont m_newFont;
00165 QColor m_backGroundColor;
00166 QColor m_underlineColor;
00167
00168 int m_changedFlags;
00169 };
00170
00171 class KOTEXT_EXPORT KoFontDia : public KDialogBase
00172 {
00173 Q_OBJECT
00174 public:
00175 KoFontDia( const KoTextFormat& initialFormat,
00176 QWidget* parent, const char* name );
00177
00178 #ifdef HAVE_LIBKSPELL2
00181 KoFontDia( const KoTextFormat& initialFormat,
00182 KSpell2::Broker::Ptr broker,
00183 QWidget* parent, const char* name );
00184 #endif
00185
00186 int changedFlags() const { return m_chooser->changedFlags(); }
00187
00188 KoTextFormat newFormat() const { return m_chooser->newFormat(); }
00189
00190 protected slots:
00191 void slotReset();
00192 virtual void slotApply();
00193 virtual void slotOk();
00194 signals:
00195 void applyFont();
00196
00197 private:
00198 void init();
00199
00200 KoFontChooser * m_chooser;
00201 KoTextFormat m_initialFormat;
00202 };
00203
00204 #endif
This file is part of the documentation for lib Library Version 1.4.2.