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