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 SMTEXTSTYLES_H 9 #define SMTEXTSTYLES_H 10 11 #include "styleitem.h" 12 #include "styles/styleset.h" 13 #include "styles/paragraphstyle.h" 14 15 class CharStyle; 16 class ScribusDoc; 17 class SMCStyleWidget; 18 class SMPStyleWidget; 19 class SMCharacterStyle; 20 21 class SMParagraphStyle : public StyleItem 22 { 23 Q_OBJECT 24 public: 25 SMParagraphStyle(SMCharacterStyle* cstyleItem); 26 ~SMParagraphStyle(); 27 28 QTabWidget* widget(); 29 QString typeNamePlural(); 30 QString typeNameSingular(); 31 void setCurrentDoc(ScribusDoc *doc); 32 QList<StyleName> styles(bool reloadFromDoc = true); 33 void reload(); 34 void selected(const QStringList &styleNames); 35 QString fromSelection() const; 36 void toSelection(const QString &styleName) const; 37 QString newStyle(); 38 QString newStyle(const QString &fromStyle); 39 void apply(); 40 void editMode(bool isOn); 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 StyleSet<ParagraphStyle>* tmpStyles(); // butt ugly 51 52 signals: 53 void selectionDirty(); 54 55 private: 56 SMPStyleWidget *m_pwidget = nullptr; 57 SMCharacterStyle* m_cstyleItem = nullptr; 58 ScribusDoc *m_doc = nullptr; 59 bool m_selectionIsDirty = false; 60 double m_unitRatio = 1.0; 61 StyleSet<ParagraphStyle> m_tmpStyles; 62 StyleSet<CharStyle> *m_cstyles = nullptr; 63 QList<ParagraphStyle*> m_selection; 64 QList<RemoveItem> m_deleted; 65 66 void setupConnections(); 67 void removeConnections(); 68 void updateStyleList(); 69 void reloadTmpStyles(); 70 QList<CharStyle> getCharStyles(); 71 72 private slots: 73 // pstyle 74 void slotLineSpacingMode(int mode); 75 void slotLineSpacing(); 76 void slotParentParaEffects(); 77 void slotDropCap(bool isOn); 78 void slotDropCapLines(int lines); 79 void slotParEffectOffset(); 80 void slotParEffectIndent(bool); 81 void slotParEffectCharStyle(int); 82 void slotBullet(bool isOn); 83 void slotBulletStr(const QString &str); 84 void slotNumeration(bool isOn); 85 void slotNumName(const QString &str); 86 void slotNumNew(); 87 void slotSelectionDirty(); 88 void slotNumFormat(int); 89 void slotNumLevel(int level); 90 void slotNumPrefix(const QString &str); 91 void slotNumSuffix(const QString &str); 92 void slotNumStart(int start); 93 void slotNumRestart(int restart); 94 void slotNumOther(bool isOn); 95 void slotNumHigher(bool isOn); 96 void slotSpaceAbove(); 97 void slotSpaceBelow(); 98 void slotAlignment(); 99 void slotDirection(); 100 void slotOpticalMargin(int i); 101 void slotOpticalMarginSelector(); 102 void slotParentOpticalMargin(); 103 void slotMinSpace(); 104 void slotMinGlyphExt(); 105 void slotMaxGlyphExt(); 106 void slotConsecutiveLines(); 107 void handleKeepLinesStart(); 108 void handleKeepLinesEnd(); 109 void handleKeepTogether(); 110 void handleKeepWithNext(); 111 void slotTabRuler(); 112 void slotLeftIndent(); 113 void slotRightIndent(); 114 void slotFirstLine(); 115 void slotBackPColor(); 116 void slotBackPShade(); 117 // cstyle 118 void slotFontSize(); 119 void slotEffects(int e); 120 void slotEffectProperties(); 121 void slotFillColor(); 122 void slotFillShade(); 123 void slotStrokeColor(); 124 void slotStrokeShade(); 125 void slotBackColor(); 126 void slotBackShade(); 127 void slotLanguage(); 128 void slotWordMin(); 129 void slotHyphenChar(); 130 void slotScaleH(); 131 void slotScaleV(); 132 void slotTracking(); 133 void slotWordTracking(); 134 void slotBaselineOffset(); 135 void slotFont(const QString& s); 136 void slotParentChanged(const QString &parent); 137 void slotCharParentChanged(const QString &parent); 138 void slotFontFeatures(); 139 void slotCharStylesDeleted(const QList<RemoveItem> &removeList); 140 }; 141 142 class SMCharacterStyle : public StyleItem 143 { 144 Q_OBJECT 145 public: 146 SMCharacterStyle(); 147 ~SMCharacterStyle(); 148 149 QTabWidget* widget(); 150 QString typeNamePlural(); 151 QString typeNameSingular(); 152 void setCurrentDoc(ScribusDoc *doc); 153 QList<StyleName> styles(bool reloadFromDoc = true); 154 void reload(); 155 void selected(const QStringList &styleNames); 156 QString fromSelection() const; 157 void toSelection(const QString &styleName) const; 158 QString newStyle(); 159 QString newStyle(const QString &fromStyle); 160 void apply(); 161 void editMode(bool isOn); 162 bool isDefaultStyle(const QString &stylename) const; 163 void setDefaultStyle(bool ids); 164 QString shortcut(const QString &stylename) const; 165 void setShortcut(const QString &shortcut); 166 void deleteStyles(const QList<RemoveItem> &removeList); 167 void nameChanged(const QString &newName); 168 QString getUniqueName(const QString &name); 169 void languageChange(); 170 void unitChange(); 171 StyleSet<CharStyle>* tmpStyles(); 172 173 signals: 174 void selectionDirty(); 175 void charStylesDeleted(const QList<RemoveItem> &removeList); 176 177 private: 178 QTabWidget *m_widget = nullptr; 179 SMCStyleWidget *m_page = nullptr; 180 ScribusDoc *m_doc = nullptr; 181 StyleSet<CharStyle> m_tmpStyles; 182 QList<CharStyle*> m_selection; 183 QList<RemoveItem> m_deleted; 184 bool m_selectionIsDirty = false; 185 186 void reloadTmpStyles(); 187 void setupConnections(); 188 void removeConnections(); 189 190 private slots: 191 void slotFontSize(); 192 void slotEffects(int e); 193 void slotEffectProperties(); 194 void slotFillColor(); 195 void slotFillShade(); 196 void slotBackColor(); 197 void slotBackShade(); 198 void slotStrokeColor(); 199 void slotStrokeShade(); 200 void slotLanguage(); 201 void slotScaleH(); 202 void slotScaleV(); 203 void slotTracking(); 204 void slotWordTracking(); 205 void slotBaselineOffset(); 206 void slotHyphenChar(); 207 void slotSmallestWord(); 208 void slotFont(const QString& s); 209 void slotParentChanged(const QString &parent); 210 void slotFontFeatures(); 211 void slotSelectionDirty(); 212 }; 213 214 #endif 215