Scribus
Open source desktop publishing at your fingertips
styleitem.h
1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 
8 #ifndef STYLEITEM_H
9 #define STYLEITEM_H
10 
11 #include <QObject>
12 #include <QList>
13 #include <QPair>
14 
15 class QString;
16 class QStringList;
17 class ScribusDoc;
18 class QTabWidget;
19 
22 typedef QPair<QString, QString> RemoveItem;
23 
26 typedef QPair<QString, QString> StyleName;
27 
37 class StyleItem : public QObject {
38  Q_OBJECT
39 public:
40  StyleItem();
41  virtual ~StyleItem();
42 
52  virtual QTabWidget* widget() = 0;
53 
55  virtual QString typeNamePlural() = 0;
56 
58  virtual QString typeNameSingular() = 0;
59 
64  virtual void setCurrentDoc(ScribusDoc *doc) = 0;
65 
76  virtual QList<StyleName> styles(bool reloadFromDoc = true) = 0;
77 
85  virtual void reload() = 0;
86 
99  virtual void selected(const QStringList &styleNames) = 0;
100 
110  virtual QString fromSelection() const = 0;
111 
116  virtual void toSelection(const QString &styleName) const = 0;
117 
123  virtual QString newStyle() = 0;
124 
130  virtual QString newStyle(const QString &fromStyle) = 0;
131 
142  virtual void apply() = 0;
143 
148  virtual void editMode(bool isOn) {};
149 
151  virtual bool isDefaultStyle(const QString &stylename) const = 0;
152 
154  virtual void setDefaultStyle(bool ids) = 0;
155 
157  virtual QString shortcut(const QString &stylename) const = 0;
158 
160  virtual void setShortcut(const QString &shortcut) = 0;
161 
169  virtual void deleteStyles(const QList<RemoveItem> &removeList) = 0;
170 
172  virtual void nameChanged(const QString &newName) = 0;
173 
175  virtual QString getUniqueName(const QString &base) = 0;
176 
178  virtual void languageChange() = 0;
179 
181  virtual void unitChange() = 0;
182 
183  // do not implement this in derived classes
184  QString typeName() { return typeNamePlural(); };
185 
186 /*
187  Emit this signal when selection has been edited. SM knows to highlight the
188  edited styles based on this signal.
189 signals:
190  selectionDirty();
191 */
192 
193 private:
194  /* hide these two, StyleItem is not ment to be copied */
195  StyleItem(const StyleItem&);
196  void operator=(const StyleItem&);
197 
198 };
199 
200 #endif
virtual QTabWidget * widget()=0
return the QWidget for editing style's properties
virtual void nameChanged(const QString &newName)=0
Called when the currently selected style's name has changed.
virtual void editMode(bool isOn)
When SM switches to or away from edit mode this function is called.
Definition: styleitem.h:148
virtual void selected(const QStringList &styleNames)=0
Whenever this function is called StyleItem must update the main.
virtual QString newStyle()=0
Create a new temp. style with default values and return the.
virtual void setDefaultStyle(bool ids)=0
set if the style is a default style
virtual QList< StyleName > styles(bool reloadFromDoc=true)=0
existing styles in this category
Represents a style type that can be added to the Style Manager.
Definition: styleitem.h:37
virtual void apply()=0
apply changes made to the currently selected style(s)
the Document Class
Definition: scribusdoc.h:90
virtual bool isDefaultStyle(const QString &stylename) const =0
returns if the style is a default style
virtual QString typeNamePlural()=0
name of the style (plural) (Paragraph Styles, Character Styles...)
virtual void reload()=0
Reload styles and remove all cached (and possibly changed ones).
virtual void toSelection(const QString &styleName) const =0
Apply style called styleName to the documents current selection.
virtual void deleteStyles(const QList< RemoveItem > &removeList)=0
User has requested to delete all the selected styles.
virtual void setShortcut(const QString &shortcut)=0
set the key combination for the selected style's shortcut
virtual void setCurrentDoc(ScribusDoc *doc)=0
Whenever style manager is shown attached StyleItems get the current doc.
virtual void unitChange()=0
document unit has been changed, upgrade widgets
virtual QString typeNameSingular()=0
name of the style (singular) (Paragraph Style, Character Style...)
virtual QString shortcut(const QString &stylename) const =0
returns the key combination for the style's shortcut
virtual QString fromSelection() const =0
Return the name of the style in this category applied to the.
virtual void languageChange()=0
reload all the gui strings whenever this method is called
virtual QString getUniqueName(const QString &base)=0
Return a unique name for a style using the base in the name.