lib Library API Documentation

koFontDia.h

00001 /* This file is part of the KDE project
00002    Copyright (C)  2001,2002,2003 Montel Laurent <lmontel@mandrakesoft.com>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017    Boston, MA 02111-1307, USA.
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     bool getHyphenation() const { return m_chooser->getHyphenation(); }
00167     bool getSuperScript() const { return m_chooser->getSuperScript(); }
00168     bool getSubScript() const { return m_chooser->getSubScript(); }
00169     QFont getNewFont() const { return m_chooser->getNewFont(); }
00170     QColor color() const { return m_chooser->color(); }
00171     QColor backGroundColor() const {return m_chooser->backGroundColor();}
00172     QColor underlineColor() const { return m_chooser->underlineColor() ; }
00173     KoTextFormat::UnderlineType getUnderlineType() const { return m_chooser->getUnderlineType();}
00174     KoTextFormat::StrikeOutType getStrikeOutType() const { return m_chooser->getStrikeOutType();}
00175 
00176     KoTextFormat::UnderlineStyle getUnderlineStyle() const { return m_chooser->getUnderlineStyle();}
00177     KoTextFormat::StrikeOutStyle getStrikeOutStyle() const { return m_chooser->getStrikeOutStyle();}
00178 
00179     double shadowDistanceX() const { return m_chooser->shadowDistanceX(); }
00180     double shadowDistanceY() const { return m_chooser->shadowDistanceY(); }
00181     QColor shadowColor() const { return m_chooser->shadowColor(); }
00182 
00183     double getRelativeTextSize()const{ return m_chooser->getRelativeTextSize();}
00184 
00185     int getOffsetFromBaseLine() const {return m_chooser->getOffsetFromBaseLine();}
00186     bool getWordByWord()const{ return m_chooser->getWordByWord();}
00187 
00188     QString getLanguage() const { return m_chooser->getLanguage();}
00189 
00190     KoTextFormat::AttributeStyle getFontAttribute()const { return m_chooser->getFontAttribute();}
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     QFont m_font;
00208     bool m_bSubscript;
00209     bool m_bSuperscript;
00210     bool m_bStrikeOut;
00211     QColor m_color;
00212     QColor m_backGroundColor;
00213     QColor m_underlineColor;
00214     KoTextFormat::UnderlineType m_underlineType;
00215     KoTextFormat::UnderlineStyle m_underlineStyle;
00216     KoTextFormat::StrikeOutStyle m_strikeOutStyle;
00217     KoTextFormat::StrikeOutType m_strikeOutType;
00218     double m_relativeSize;
00219     int m_offsetBaseLine;
00220     bool m_bWordByWord;
00221     bool m_bHyphenation;
00222     KoTextFormat::AttributeStyle m_fontAttribute;
00223     QString m_language;
00224     */
00225     KoTextFormat m_initialFormat;
00226 };
00227 
00228 #endif
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Mar 11 11:47:41 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003