1 /* 2 Copyright (C) 2011 Elvis Stansvik <elvstone@gmail.com> 3 4 For general Scribus (>=1.3.2) copyright and licensing information please refer 5 to the COPYING file provided with the program. Following this notice may exist 6 a copyright and/or license notice that predates the release of Scribus 1.3.2 7 for which a new license (GPL+exception) is in place. 8 */ 9 10 #ifndef SMTABLESTYLES_H 11 #define SMTABLESTYLES_H 12 13 #include <QList> 14 15 #include "styleitem.h" 16 #include "styles/styleset.h" 17 #include "styles/tablestyle.h" 18 19 class SMTableStyleWidget; 20 class QTabWidget; 21 class ScribusDoc; 22 23 class SMTableStyle : public StyleItem 24 { 25 Q_OBJECT 26 public: 27 /// Constructor. 28 SMTableStyle(); 29 /// Destructor. 30 ~SMTableStyle(); 31 32 /// Reimplemented from StyleItem. 33 QTabWidget* widget(); 34 /// Reimplemented from StyleItem. 35 QString typeNamePlural(); 36 /// Reimplemented from StyleItem. 37 QString typeNameSingular(); 38 /// Reimplemented from StyleItem. 39 void setCurrentDoc(ScribusDoc *doc); 40 /// Reimplemented from StyleItem. 41 QList<StyleName> styles(bool reloadFromDoc = true); 42 /// Reimplemented from StyleItem. 43 void reload(); 44 /// Reimplemented from StyleItem. 45 void selected(const QStringList &styleNames); 46 /// Reimplemented from StyleItem. 47 QString fromSelection() const; 48 /// Reimplemented from StyleItem. 49 void toSelection(const QString &styleName) const; 50 /// Reimplemented from StyleItem. 51 QString newStyle(); 52 /// Reimplemented from StyleItem. 53 QString newStyle(const QString &fromStyle); 54 /// Reimplemented from StyleItem. 55 void apply(); 56 /// Reimplemented from StyleItem. 57 void editMode(bool isOn); 58 /// Reimplemented from StyleItem. 59 bool isDefaultStyle(const QString &styleName) const; 60 /// Reimplemented from StyleItem. 61 void setDefaultStyle(bool isDefaultStyle); 62 /// Reimplemented from StyleItem. 63 QString shortcut(const QString &styleName) const; 64 /// Reimplemented from StyleItem. 65 void setShortcut(const QString &shortcut); 66 /// Reimplemented from StyleItem. 67 void deleteStyles(const QList<RemoveItem> &removeList); 68 /// Reimplemented from StyleItem. 69 void nameChanged(const QString &newName); 70 /// Reimplemented from StyleItem. 71 QString getUniqueName(const QString &name); 72 /// Reimplemented from StyleItem. 73 void languageChange(); 74 /// Reimplemented from StyleItem. 75 void unitChange(); 76 77 signals: 78 void selectionDirty(); 79 80 private: 81 QTabWidget *m_widget = nullptr; 82 SMTableStyleWidget *m_page = nullptr; 83 ScribusDoc *m_doc = nullptr; 84 StyleSet<TableStyle> m_cachedStyles; 85 QList<TableStyle*> m_selection; 86 QList<RemoveItem> m_deleted; 87 bool m_selectionIsDirty = false; 88 89 void updateStylesCache(); 90 void setupConnections(); 91 void removeConnections(); 92 93 private slots: 94 void slotFillColor(); 95 void slotFillShade(); 96 void slotParentChanged(const QString &parent); 97 }; 98 99 #endif // SMTABLESTYLES_H 100