lib Library API Documentation

koStylist.h

00001 /* This file is part of the KDE project 00002 Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org> 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 kostylist_h 00021 #define kostylist_h 00022 00023 #include <kdialogbase.h> 00024 #include <qstringlist.h> 00025 00026 #include <koParagDia.h> 00027 #include <koUnit.h> 00028 #include <qptrlist.h> 00029 #include <kostyle.h> 00030 00031 class KoFontChooser; 00032 class KoStyle; 00033 class KoStyleEditor; 00034 class KoStyleManagerTab; 00035 class QCheckBox; 00036 class QComboBox; 00037 class QGridLayout; 00038 class QLineEdit; 00039 class QListBox; 00040 class QPushButton; 00041 class QTabWidget; 00042 class QWidget; 00043 class KoTextDocument; 00044 class KoStyleManagerPrivate; 00045 00046 /******************************************************************/ 00047 /* Class: KoStyleManager */ 00048 /******************************************************************/ 00049 class KoStyleManager : public KDialogBase 00050 { 00051 Q_OBJECT 00052 00053 public: 00054 KoStyleManager( QWidget *_parent,KoUnit::Unit unit,const QPtrList<KoStyle> & style, const QString & activeStyleName ); 00055 virtual ~KoStyleManager(); 00056 00057 virtual KoStyle* addStyleTemplate(KoStyle *style)=0; 00058 //virtual void applyStyleChange( KoStyle * changedStyle, int paragLayoutChanged, int formatChanged )=0; 00059 virtual void applyStyleChange( StyleChangeDefMap changed )=0; 00060 00061 virtual void removeStyleTemplate( KoStyle *style )=0; 00062 virtual void updateAllStyleLists()=0; 00063 virtual void updateStyleListOrder( const QStringList & list)=0; 00064 00065 protected: 00066 void updateFollowingStyle( KoStyle *s ); 00067 void updateInheritStyle( KoStyle *s ); 00068 void setupWidget(const QPtrList<KoStyle> & style); 00069 void addGeneralTab(); 00070 void apply(); 00071 void updateGUI(); 00072 void updatePreview(); 00073 void save(); 00074 int styleIndex( int pos ); 00075 00076 private: 00077 QTabWidget *m_tabs; 00078 QListBox *m_stylesList; 00079 QLineEdit *m_nameString; 00080 QComboBox *m_styleCombo; 00081 QPushButton *m_deleteButton; 00082 QPushButton *m_newButton; 00083 QPushButton *m_moveUpButton; 00084 QPushButton *m_moveDownButton; 00085 QComboBox *m_inheritCombo; 00086 KoStyleManagerPrivate *d; 00087 00088 KoStyle *m_currentStyle; 00089 QPtrList<KoStyle> m_origStyles; // internal list of orig styles we have modified 00090 QPtrList<KoStyle> m_changedStyles; // internal list of changed styles. 00091 QPtrList<KoStyleManagerTab> m_tabsList; 00092 QStringList m_styleOrder; 00093 int numStyles; 00094 bool noSignals; 00095 00096 protected slots: 00097 virtual void slotOk(); 00098 virtual void slotApply(); 00099 void switchStyle(); 00100 void switchTabs(); 00101 void addStyle(); 00102 void deleteStyle(); 00103 void moveUpStyle(); 00104 void moveDownStyle(); 00105 void renameStyle(const QString &); 00106 protected: 00107 KoStyle * style( const QString & _name ); 00108 void addTab( KoStyleManagerTab * tab ); 00109 }; 00110 00111 class KoStyleManagerTab : public QWidget { 00112 Q_OBJECT 00113 public: 00114 KoStyleManagerTab(QWidget *parent) : QWidget(parent) {}; 00115 00117 void setStyle(KoStyle *style) { m_style = style; } 00119 virtual void update() = 0; 00121 virtual QString tabName() = 0; 00123 virtual void save() = 0; 00124 protected: 00125 KoStyle *m_style; 00126 }; 00127 00128 // A tab to edit parts of the parag-layout of the style 00129 // Acts as a wrapper around KoParagLayoutWidget [which doesn't know about styles]. 00130 class KoStyleParagTab : public KoStyleManagerTab 00131 { 00132 Q_OBJECT 00133 public: 00134 KoStyleParagTab( QWidget * parent ); 00135 00136 // not a constructor parameter since 'this' is the parent of the widget 00137 void setWidget( KoParagLayoutWidget * widget ); 00138 00139 virtual void update(); 00140 virtual void save(); 00141 virtual QString tabName() { return m_widget->tabName(); } 00142 protected: 00143 virtual void resizeEvent( QResizeEvent *e ); 00144 private: 00145 KoParagLayoutWidget * m_widget; 00146 }; 00147 00148 // The "font" tab. Maybe we should put the text color at the bottom ? 00149 class KoStyleFontTab : public KoStyleManagerTab 00150 { 00151 Q_OBJECT 00152 public: 00153 KoStyleFontTab( QWidget * parent ); 00154 ~KoStyleFontTab(); 00155 virtual void update(); 00156 virtual QString tabName(); 00157 virtual void save(); 00158 protected: 00159 virtual void resizeEvent( QResizeEvent *e ); 00160 private: 00161 KoFontChooser* m_chooser; 00162 KoZoomHandler* m_zoomHandler; 00163 }; 00164 00165 /* 00166 Font simple font dia 00167 Color simple color dia 00168 Spacing and Indents paragraph spacing dia (KWParagDia) 00169 alignments KoParagDia alignment tab 00170 borders KoParagDia borders tab 00171 numbering KoParagDia tab numbering 00172 tabulators KoParagDia tab tabs */ 00173 00174 #endif
KDE Logo
This file is part of the documentation for lib Library Version 1.3.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Sep 24 18:22:26 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003