koStylist.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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 KoParagStyle;
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
00048
00049 class KOTEXT_EXPORT KoStyleManager : public KDialogBase
00050 {
00051 Q_OBJECT
00052
00053 public:
00054 enum { ShowIncludeInToc = 1 };
00055 KoStyleManager( QWidget *_parent, KoUnit::Unit unit,
00056 const QPtrList<KoParagStyle> & style, const QString & activeStyleName,
00057 int flags = 0 );
00058 virtual ~KoStyleManager();
00059
00060 virtual KoParagStyle* addStyleTemplate(KoParagStyle *style)=0;
00061
00062 virtual void applyStyleChange( KoStyleChangeDefMap changed )=0;
00063
00064 virtual void removeStyleTemplate( KoParagStyle *style )=0;
00065 virtual void updateAllStyleLists()=0;
00066 virtual void updateStyleListOrder( const QStringList & list)=0;
00067
00068 protected:
00069 void updateFollowingStyle( KoParagStyle *s );
00070 void updateInheritStyle( KoParagStyle *s );
00071 void setupWidget(const QPtrList<KoParagStyle> & style);
00072 void addGeneralTab( int flags );
00073 void apply();
00074 void updateGUI();
00075 void updatePreview();
00076 void save();
00077 int styleIndex( int pos );
00078
00079 private:
00080 QTabWidget *m_tabs;
00081 QListBox *m_stylesList;
00082 QLineEdit *m_nameString;
00083 QComboBox *m_styleCombo;
00084 QPushButton *m_deleteButton;
00085 QPushButton *m_newButton;
00086 QPushButton *m_moveUpButton;
00087 QPushButton *m_moveDownButton;
00088 QComboBox *m_inheritCombo;
00089 KoStyleManagerPrivate *d;
00090
00091 KoParagStyle *m_currentStyle;
00092 QPtrList<KoParagStyle> m_origStyles;
00093 QPtrList<KoParagStyle> m_changedStyles;
00094 QPtrList<KoStyleManagerTab> m_tabsList;
00095 QStringList m_styleOrder;
00096 int numStyles;
00097 bool noSignals;
00098
00099 protected slots:
00100 virtual void slotOk();
00101 virtual void slotApply();
00102 void switchStyle();
00103 void switchTabs();
00104 void addStyle();
00105 void deleteStyle();
00106 void moveUpStyle();
00107 void moveDownStyle();
00108 void renameStyle(const QString &);
00109 protected:
00110 KoParagStyle * style( const QString & _name );
00111 void addTab( KoStyleManagerTab * tab );
00112 QString generateUniqueName();
00113 };
00114
00115 class KOTEXT_EXPORT KoStyleManagerTab : public QWidget {
00116 Q_OBJECT
00117 public:
00118 KoStyleManagerTab(QWidget *parent) : QWidget(parent) {};
00119
00121 void setStyle(KoParagStyle *style) { m_style = style; }
00123 virtual void update() = 0;
00125 virtual QString tabName() = 0;
00127 virtual void save() = 0;
00128 protected:
00129 KoParagStyle *m_style;
00130 };
00131
00132
00133
00134 class KOTEXT_EXPORT KoStyleParagTab : public KoStyleManagerTab
00135 {
00136 Q_OBJECT
00137 public:
00138 KoStyleParagTab( QWidget * parent );
00139
00140
00141 void setWidget( KoParagLayoutWidget * widget );
00142
00143 virtual void update();
00144 virtual void save();
00145 virtual QString tabName() { return m_widget->tabName(); }
00146 protected:
00147 virtual void resizeEvent( QResizeEvent *e );
00148 private:
00149 KoParagLayoutWidget * m_widget;
00150 };
00151
00152
00153 class KOTEXT_EXPORT KoStyleFontTab : public KoStyleManagerTab
00154 {
00155 Q_OBJECT
00156 public:
00157 KoStyleFontTab( QWidget * parent );
00158 ~KoStyleFontTab();
00159 virtual void update();
00160 virtual QString tabName();
00161 virtual void save();
00162 protected:
00163 virtual void resizeEvent( QResizeEvent *e );
00164 private:
00165 KoFontChooser* m_chooser;
00166 KoZoomHandler* m_zoomHandler;
00167 };
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178 #endif
This file is part of the documentation for lib Library Version 1.4.2.