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 #ifndef TEXTPALETTE_H
8 #define TEXTPALETTE_H
9 
10 #include <QListWidgetItem>
11 #include <QLineEdit>
12 
13 class QCloseEvent;
14 class QEvent;
15 class QFocusEvent;
16 class QToolBox;
17 class QVBoxLayout;
18 class QWidget;
19 
20 
21 #include "pageitem.h"
22 #include "scdockpalette.h"
23 #include "scribusapi.h"
24 
25 class PropertiesPalette_Text;
26 class ScribusDoc;
27 class ScribusMainWindow;
28 class UndoManager;
29 
30 class SCRIBUS_API TextPalette : public ScDockPalette
31 {
32 	Q_OBJECT
33 
34 public:
35 	TextPalette(QWidget* parent);
~TextPalette()36 	~TextPalette() {}
37 
38 	void updateColorList();
39 	void endPatchAdd();
40 
41 	/** @brief Returns true if there is a user action going on at the moment of call. */
42 	bool userActionOn(); // not yet implemented!!! This is needed badly.
43                          // When user releases the mouse button or arrow key, changes must be checked
44                          // and if in ScribusView a groupTransaction has been started it must be also
45                          // commmited
46 
47 	PropertiesPalette_Text*  textPal { nullptr };
48 
49 private:
50 	PageItem* currentItemFromSelection();
51 
52 public slots:
53 	void setMainWindow(ScribusMainWindow *mw);
54 
55 	void setDoc(ScribusDoc *d);
56 	void AppModeChanged();
57 	void setCurrentItem(PageItem *item);
58 	void unsetDoc();
59 	void unsetItem();
60 
61 	void handleSelectionChanged();
62 
63 	void unitChange();
64 	void languageChange();
65 
66 private slots:
67 	void NewLineMode(int mode);
68 
69 protected:
70 	ScribusMainWindow *m_ScMW { nullptr };
71 
72 	bool      m_haveDoc { false };
73 	bool      m_haveItem { false };
74 	double    m_unitRatio { 1.0 };
75 	int       m_unitIndex { 0 };
76 	PageItem* m_item { nullptr };
77 	UndoManager *undoManager { nullptr };
78 
79 	ScGuardedPtr<ScribusDoc> m_doc;
80 
81 	int idTextItem;
82 
83 	void changeEvent(QEvent *e) override;
84 	void closeEvent(QCloseEvent *closeEvent) override;
85 };
86 
87 #endif
88