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 SMCELLSTYLEWIDGET_H
11 #define SMCELLSTYLEWIDGET_H
12 
13 #include <QWidget>
14 
15 #include "ui_smcellstylewidget.h"
16 #include "styles/cellstyle.h"
17 
18 /**
19  * Widget for editing cell style attributes.
20  *
21  * NOTE: Many attributes unsupported.
22  */
23 class SMCellStyleWidget : public QWidget, public Ui::SMCellStyleWidget
24 {
25 	Q_OBJECT
26 
27 public:
28 	/// Constructor.
29 	SMCellStyleWidget(QWidget* parent = nullptr);
30 	/// Destructor.
31 	~SMCellStyleWidget();
32 
33 	void setDoc(ScribusDoc* doc);
34 
35 	/**
36 	 * Shows attributes for a single cell style.
37 	 *
38 	 * @param cellStyle cell style for which attributes should be shown.
39 	 * @param cellStyles list of all cell styles.
40 	 * @param defaultLanguage default language.
41 	 * @param unitIndex index of currently used unit.
42 	 */
43 	void show(CellStyle *cellStyle, QList<CellStyle> &cellStyles, const QString &defaultLanguage, int unitIndex);
44 
45 	/**
46 	 * Shows attributes for multiple cell styles.
47 	 *
48 	 * TODO: Implement actual support for multiple styles.
49 	 *
50 	 * @param cellStyles list of cell styles for which attributes should be shown.
51 	 * @param cellStylesAll list of all cell styles.
52 	 * @param defaultLanguage default language.
53 	 * @param unitIndex index of currently used unit.
54 	 */
55 	void show(QList<CellStyle*> &cellStyles, QList<CellStyle> &cellStylesAll, const QString &defaultLanguage, int unitIndex);
56 
57 	/**
58 	 * This function is called when the language is changed.
59 	 */
60 	void languageChange();
61 
62 	/**
63 	 * Populates the fill color combo with the given color list.
64 	 *
65 	 * @param colors list of colors to populate the combo with.
66 	 */
67 	void fillFillColorCombo(ColorList &colors);
68 	void showColors(const QList<CellStyle*> &cellStyles);
69 
70 protected:
71 	void changeEvent(QEvent *e) override;
72 
73 private:
74 	ScribusDoc * m_Doc = nullptr;
75 
76 private slots:
77 	void handleUpdateRequest(int);
78 	void iconSetChange();
79 };
80 
81 #endif // SMCELLSTYLEWIDGET_H
82