Scribus
Open source desktop publishing at your fingertips
smlinestyle.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 SMLINESTYLE_H
9 #define SMLINESTYLE_H
10 
11 class QEvent;
12 
13 #include "scribusstructs.h"
14 #include "styleitem.h"
15 
16 class ScribusDoc;
17 class SMLineStyleWidget;
18 
19 
20 class SMLineStyle : public StyleItem
21 {
22  Q_OBJECT
23 public:
24  SMLineStyle();
25  ~SMLineStyle();
26 
27  virtual void changeEvent(QEvent *e);
28 
29  QTabWidget* widget();
30  QString typeNamePlural();
31  QString typeNameSingular();
32  void setCurrentDoc(ScribusDoc *doc);
33  QList<StyleName> styles(bool reloadFromDoc = true);
34  void reload();
35  void selected(const QStringList &styleNames);
36  QString fromSelection() const;
37  void toSelection(const QString &styleName) const;
38  QString newStyle();
39  QString newStyle(const QString &fromStyle);
40  void apply();
41  bool isDefaultStyle(const QString &stylename) const;
42  void setDefaultStyle(bool ids);
43  QString shortcut(const QString &stylename) const;
44  void setShortcut(const QString &shortcut);
45  void deleteStyles(const QList<RemoveItem> &removeList);
46  void nameChanged(const QString &newName);
47  QString getUniqueName(const QString &name);
48  void languageChange();
49  void unitChange();
50 
51 signals:
52  void deleteDone();
53  void selectionDirty();
54 
55 private:
56  ScribusDoc *m_doc;
57  SMLineStyleWidget *m_widget;
58  QTabWidget *m_twidget;
59  QHash<QString, multiLine> m_tmpLines;
60  bool m_selectionIsDirty;
61  double m_unitRatio;
62  QHash<QString, multiLine*> m_selection;
63  QList<RemoveItem> m_deleted;
64  int m_currentLine;
65 
66  void setSelection(const QString& styleName);
67  void setMultiSelection(const QStringList& styles);
68  void setupConnections();
69  void removeConnections();
70  void updateSList();
71  void updatePreview();
72  void resort();
73  void rebuildList();
74  QColor calcFarbe(const QString &name, int shade);
75 
76 private slots:
77  void slotCurrentLineChanged(int i);
78  void slotLineStyle(int i);
79  void slotSetEnd(int i);
80  void slotSetJoin(int i);
81  void slotColor(const QString &s);
82  void slotShade(int i);
83  void slotLineWidth();
84  void slotAddLine();
85  void slotDeleteLine();
86 
87  // FIXME make line styles subclass of Style and remove this hack
88  // ugly hack which will be removed once all styles are subclassed from Style
89  friend class StyleManager;
90 };
91 
92 #endif
void selected(const QStringList &styleNames)
Whenever this function is called StyleItem must update the main.
Definition: smlinestyle.cpp:97
void reload()
Reload styles and remove all cached (and possibly changed ones).
Definition: smlinestyle.cpp:88
void toSelection(const QString &styleName) const
Apply style called styleName to the documents current selection.
Definition: smlinestyle.cpp:163
void unitChange()
document unit has been changed, upgrade widgets
Definition: smlinestyle.cpp:382
void setShortcut(const QString &shortcut)
set the key combination for the selected style's shortcut
Definition: smlinestyle.cpp:310
void nameChanged(const QString &newName)
Called when the currently selected style's name has changed.
Definition: smlinestyle.cpp:337
bool isDefaultStyle(const QString &stylename) const
returns if the style is a default style
Definition: smlinestyle.cpp:275
QString getUniqueName(const QString &name)
Return a unique name for a style using the base in the name.
Definition: smlinestyle.cpp:207
Represents a style type that can be added to the Style Manager.
Definition: styleitem.h:37
Definition: smlinestylewidget.h:21
void setCurrentDoc(ScribusDoc *doc)
Whenever style manager is shown attached StyleItems get the current doc.
Definition: smlinestyle.cpp:53
void setDefaultStyle(bool ids)
set if the style is a default style
Definition: smlinestyle.cpp:282
the Document Class
Definition: scribusdoc.h:90
QString typeNamePlural()
name of the style (plural) (Paragraph Styles, Character Styles...)
Definition: smlinestyle.cpp:43
QTabWidget * widget()
return the QWidget for editing style's properties
Definition: smlinestyle.cpp:29
QString fromSelection() const
Return the name of the style in this category applied to the.
Definition: smlinestyle.cpp:140
void apply()
apply changes made to the currently selected style(s)
Definition: smlinestyle.cpp:224
QString newStyle()
Create a new temp. style with default values and return the.
Definition: smlinestyle.cpp:179
QString shortcut(const QString &stylename) const
returns the key combination for the style's shortcut
Definition: smlinestyle.cpp:301
void languageChange()
reload all the gui strings whenever this method is called
Definition: smlinestyle.cpp:377
QString typeNameSingular()
name of the style (singular) (Paragraph Style, Character Style...)
Definition: smlinestyle.cpp:48
Definition: smlinestyle.h:20
void deleteStyles(const QList< RemoveItem > &removeList)
User has requested to delete all the selected styles.
Definition: smlinestyle.cpp:327
QList< StyleName > styles(bool reloadFromDoc=true)
existing styles in this category
Definition: smlinestyle.cpp:73