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 <kdialog.h>
00024 #include <QStringList>
00025
00026 #include <Q3GridLayout>
00027 #include <QResizeEvent>
00028
00029 #include <KoParagDia.h>
00030 #include <KoFontTab.h>
00031 #include <KoDecorationTab.h>
00032 #include <KoHighlightingTab.h>
00033 #include <KoLayoutTab.h>
00034 #include <KoLanguageTab.h>
00035 #include <KoUnit.h>
00036 #include <q3ptrlist.h>
00037 #include <KoStyleCollection.h>
00038
00039
00040 class KoParagStyle;
00041 class KoStyleEditor;
00042 class KoStyleManagerTab;
00043 class QCheckBox;
00044 class QComboBox;
00045 class QListWidget;
00046 class Q3GridLayout;
00047 class QLineEdit;
00048 class QPushButton;
00049 class QTabWidget;
00050 class QWidget;
00051 class KoTextDocument;
00052 class KoStyleManagerPrivate;
00053
00057 class KOTEXT_EXPORT KoStyleDialog : public KDialog
00058 {
00059 Q_OBJECT
00060
00061 public:
00062 enum { ShowIncludeInToc = 1 };
00063 KoStyleDialog( QWidget *_parent, KoUnit::Unit unit,
00064 const KoStyleCollection& styleCollection,
00065 const QString & activeStyleName,
00066 int flags = 0 );
00067 virtual ~KoStyleDialog();
00068
00069 virtual KoParagStyle* addStyleTemplate(KoParagStyle *style)=0;
00070
00071 virtual void applyStyleChange( KoStyleChangeDefMap changed )=0;
00072
00073 virtual void removeStyleTemplate( KoParagStyle *style )=0;
00074 virtual void updateAllStyleLists()=0;
00075 virtual void updateStyleListOrder( const QStringList & list)=0;
00076
00077 protected:
00078 void updateFollowingStyle( KoParagStyle *s );
00079 void updateInheritStyle( KoParagStyle *s );
00080 void setupWidget(const KoStyleCollection & styleCollection);
00081 void addGeneralTab( int flags );
00082 void apply();
00083 void updateGUI();
00084 void updatePreview();
00085 void save();
00086 int styleIndex( int pos );
00087
00088 private:
00089 QTabWidget *m_tabs;
00090 QListWidget* m_stylesList;
00091 QLineEdit *m_nameString;
00092 QComboBox *m_styleCombo;
00093 QPushButton *m_deleteButton;
00094 QPushButton *m_newButton;
00095 QPushButton *m_moveUpButton;
00096 QPushButton *m_moveDownButton;
00097 QComboBox *m_inheritCombo;
00098 KoStyleManagerPrivate *d;
00099
00100 KoParagStyle *m_currentStyle;
00101 Q3PtrList<KoParagStyle> m_origStyles;
00102 Q3PtrList<KoParagStyle> m_changedStyles;
00103 Q3PtrList<KoStyleManagerTab> m_tabsList;
00104 QStringList m_styleOrder;
00105 int numStyles;
00106 bool noSignals;
00107
00108 protected slots:
00109 virtual void slotOk();
00110 virtual void slotApply();
00111 void switchStyle();
00112 void switchTabs();
00113 void addStyle();
00114 void deleteStyle();
00115 void moveUpStyle();
00116 void moveDownStyle();
00117 void renameStyle(const QString &);
00118 protected:
00119 KoParagStyle * style( const QString & _name );
00120 void addTab( KoStyleManagerTab * tab );
00121 QString generateUniqueName();
00122 };
00123
00124 class KOTEXT_EXPORT KoStyleManagerTab : public QWidget {
00125 Q_OBJECT
00126 public:
00127 KoStyleManagerTab(QWidget *parent) : QWidget(parent) {};
00128
00130 void setStyle(KoParagStyle *style) { m_style = style; }
00132 virtual void update() = 0;
00134 virtual QString tabName() = 0;
00136 virtual void save() = 0;
00137 protected:
00138 KoParagStyle *m_style;
00139 };
00140
00141
00142
00143 class KOTEXT_EXPORT KoStyleParagTab : public KoStyleManagerTab
00144 {
00145 Q_OBJECT
00146 public:
00147 KoStyleParagTab( QWidget * parent );
00148
00149
00150 void setWidget( KoParagLayoutWidget * widget );
00151
00152 virtual void update();
00153 virtual void save();
00154 virtual QString tabName() { return m_widget->tabName(); }
00155 protected:
00156 virtual void resizeEvent( QResizeEvent *e );
00157 private:
00158 KoParagLayoutWidget * m_widget;
00159 };
00160
00161
00162 class KOTEXT_EXPORT KoStyleFontTab : public KoStyleManagerTab
00163 {
00164 Q_OBJECT
00165 public:
00166 KoStyleFontTab( QWidget * parent );
00167 ~KoStyleFontTab();
00168 virtual void update();
00169 virtual QString tabName();
00170 virtual void save();
00171 private:
00172 KoFontTab *m_fontTab;
00173 KoDecorationTab *m_decorationTab;
00174 KoHighlightingTab *m_highlightingTab;
00175 KoLayoutTab *m_layoutTab;
00176 KoLanguageTab *m_languageTab;
00177 };
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188 #endif