F:/KPlato/koffice/libs/kotext/KoStyleDialog.h

Aller à la documentation de ce fichier.
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., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef kostylist_h
00021 #define kostylist_h
00022 
00023 #include <kdialog.h>
00024 #include <QStringList>
00025 //Added by qt3to4:
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 //class KoFontChooser;
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 }; // bitfield for flags
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     //virtual void applyStyleChange( KoParagStyle * changedStyle, int paragLayoutChanged, int formatChanged )=0;
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;      // internal list of orig styles we have modified
00102     Q3PtrList<KoParagStyle> m_changedStyles;   // internal list of changed styles.
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 // A tab to edit parts of the parag-layout of the style
00142 // Acts as a wrapper around KoParagLayoutWidget [which doesn't know about styles].
00143 class KOTEXT_EXPORT KoStyleParagTab : public KoStyleManagerTab
00144 {
00145     Q_OBJECT
00146 public:
00147     KoStyleParagTab( QWidget * parent );
00148 
00149     // not a constructor parameter since 'this' is the parent of the widget
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 // The "font" tab. Maybe we should put the text color at the bottom ?
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 Font            simple font dia
00181 Color           simple color dia
00182 Spacing and Indents     paragraph spacing dia (KWParagDia)
00183 alignments      KoParagDia alignment tab
00184 borders         KoParagDia  borders tab
00185 numbering       KoParagDia  tab numbering
00186 tabulators      KoParagDia  tab tabs */
00187 
00188 #endif

Généré le Wed Nov 22 23:41:09 2006 pour KPlato par  doxygen 1.5.1-p1