diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
commit | 8362bf63dea22bbf6736609b0f49c152f975eb63 (patch) | |
tree | 0eea3928e39e50fae91d4e68b21b1e6cbae25604 /lib/kotext/KoStyleManager.h | |
download | koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip |
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/kotext/KoStyleManager.h')
-rw-r--r-- | lib/kotext/KoStyleManager.h | 185 |
1 files changed, 185 insertions, 0 deletions
diff --git a/lib/kotext/KoStyleManager.h b/lib/kotext/KoStyleManager.h new file mode 100644 index 00000000..e6f0f57e --- /dev/null +++ b/lib/kotext/KoStyleManager.h @@ -0,0 +1,185 @@ +/* This file is part of the KDE project + Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#ifndef kostylist_h +#define kostylist_h + +#include <kdialogbase.h> +#include <qstringlist.h> + +#include <KoParagDia.h> +#include <KoFontTab.h> +#include <KoDecorationTab.h> +#include <KoHighlightingTab.h> +#include <KoLayoutTab.h> +#include <KoLanguageTab.h> +#include <KoUnit.h> +#include <qptrlist.h> +#include <KoStyleCollection.h> + +//class KoFontChooser; +class KoParagStyle; +class KoStyleEditor; +class KoStyleManagerTab; +class QCheckBox; +class QComboBox; +class QGridLayout; +class QLineEdit; +class QListBox; +class QPushButton; +class QTabWidget; +class QWidget; +class KoTextDocument; +class KoStyleManagerPrivate; + +/** + * This class provides a dialog for editing named text styles. + */ +class KOTEXT_EXPORT KoStyleManager : public KDialogBase +{ + Q_OBJECT + +public: + enum { ShowIncludeInToc = 1 }; // bitfield for flags + KoStyleManager( QWidget *_parent, KoUnit::Unit unit, + const KoStyleCollection& styleCollection, + const QString & activeStyleName, + int flags = 0 ); + virtual ~KoStyleManager(); + + virtual KoParagStyle* addStyleTemplate(KoParagStyle *style)=0; + //virtual void applyStyleChange( KoParagStyle * changedStyle, int paragLayoutChanged, int formatChanged )=0; + virtual void applyStyleChange( KoStyleChangeDefMap changed )=0; + + virtual void removeStyleTemplate( KoParagStyle *style )=0; + virtual void updateAllStyleLists()=0; + virtual void updateStyleListOrder( const QStringList & list)=0; + +protected: + void updateFollowingStyle( KoParagStyle *s ); + void updateInheritStyle( KoParagStyle *s ); + void setupWidget(const KoStyleCollection & styleCollection); + void addGeneralTab( int flags ); + void apply(); + void updateGUI(); + void updatePreview(); + void save(); + int styleIndex( int pos ); + +private: + QTabWidget *m_tabs; + QListBox *m_stylesList; + QLineEdit *m_nameString; + QComboBox *m_styleCombo; + QPushButton *m_deleteButton; + QPushButton *m_newButton; + QPushButton *m_moveUpButton; + QPushButton *m_moveDownButton; + QComboBox *m_inheritCombo; + KoStyleManagerPrivate *d; + + KoParagStyle *m_currentStyle; + QPtrList<KoParagStyle> m_origStyles; // internal list of orig styles we have modified + QPtrList<KoParagStyle> m_changedStyles; // internal list of changed styles. + QPtrList<KoStyleManagerTab> m_tabsList; + QStringList m_styleOrder; + int numStyles; + bool noSignals; + +protected slots: + virtual void slotOk(); + virtual void slotApply(); + void switchStyle(); + void switchTabs(); + void addStyle(); + void deleteStyle(); + void moveUpStyle(); + void moveDownStyle(); + void renameStyle(const QString &); +protected: + KoParagStyle * style( const QString & _name ); + void addTab( KoStyleManagerTab * tab ); + QString generateUniqueName(); +}; + +class KOTEXT_EXPORT KoStyleManagerTab : public QWidget { + Q_OBJECT +public: + KoStyleManagerTab(QWidget *parent) : QWidget(parent) {}; + + /** the new style which is to be displayed */ + void setStyle(KoParagStyle *style) { m_style = style; } + /** update the GUI from the current Style*/ + virtual void update() = 0; + /** return the (i18n-ed) name of the tab */ + virtual QString tabName() = 0; + /** save the GUI to the style */ + virtual void save() = 0; +protected: + KoParagStyle *m_style; +}; + +// A tab to edit parts of the parag-layout of the style +// Acts as a wrapper around KoParagLayoutWidget [which doesn't know about styles]. +class KOTEXT_EXPORT KoStyleParagTab : public KoStyleManagerTab +{ + Q_OBJECT +public: + KoStyleParagTab( QWidget * parent ); + + // not a constructor parameter since 'this' is the parent of the widget + void setWidget( KoParagLayoutWidget * widget ); + + virtual void update(); + virtual void save(); + virtual QString tabName() { return m_widget->tabName(); } +protected: + virtual void resizeEvent( QResizeEvent *e ); +private: + KoParagLayoutWidget * m_widget; +}; + +// The "font" tab. Maybe we should put the text color at the bottom ? +class KOTEXT_EXPORT KoStyleFontTab : public KoStyleManagerTab +{ + Q_OBJECT +public: + KoStyleFontTab( QWidget * parent ); + ~KoStyleFontTab(); + virtual void update(); + virtual QString tabName(); + virtual void save(); +private: + KoFontTab *m_fontTab; + KoDecorationTab *m_decorationTab; + KoHighlightingTab *m_highlightingTab; + KoLayoutTab *m_layoutTab; + KoLanguageTab *m_languageTab; +}; + +/* +Font simple font dia +Color simple color dia +Spacing and Indents paragraph spacing dia (KWParagDia) +alignments KoParagDia alignment tab +borders KoParagDia borders tab +numbering KoParagDia tab numbering +tabulators KoParagDia tab tabs */ + +#endif |