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 PROPERTIESPALETTE_XYZ_H
8 #define PROPERTIESPALETTE_XYZ_H
9 
10 #include "ui_propertiespalette_xyzbase.h"
11 
12 #include "scribusapi.h"
13 #include "scrspinbox.h"
14 #include "linkbutton.h"
15 #include "sclistboxpixmap.h"
16 #include "scguardedptr.h"
17 #include "units.h"
18 
19 class BasePointWidget;
20 class NameWidget;
21 class PageItem;
22 class ScribusDoc;
23 class Selection;
24 class ScribusMainWindow;
25 class UserActionSniffer;
26 
27 class SCRIBUS_API PropertiesPalette_XYZ : public QWidget, public Ui::PropertiesPalette_XYZBase
28 {
29 	Q_OBJECT
30 
31 public:
32 	PropertiesPalette_XYZ(QWidget* parent);
~PropertiesPalette_XYZ()33 	~PropertiesPalette_XYZ() {};
34 
35 	/** @brief Returns true if there is a user action going on at the moment of call. */
36 	bool userActionOn(); // not yet implemented!!! This is needed badly.
37                          // When user releases the mouse button or arrow key, changes must be checked
38                          // and if in ScribusView a groupTransaction has been started it must be also
39                          // commmited
40 
41 	void setLineMode(int lineMode);
42 
43 private:
44 	PageItem* currentItemFromSelection();
45 
46 public slots:
47 	void setMainWindow(ScribusMainWindow *mw);
48 
49 	void setDoc(ScribusDoc *d);
50 	void setCurrentItem(PageItem *item);
51 	void unsetDoc();
52 	void unsetItem();
53 
54 	void iconSetChange();
55 	void languageChange();
56 	void unitChange();
57 	void localeChange();
58 
59 	void showXY(double x, double y);
60 	void showWH(double x, double y);
61 	void showRotation(double r);
62 	void showLocked(bool);
63 	void showSizeLocked(bool);
64 	void showPrintingEnabled(bool);
65 	void showFlippedH(bool);
66 	void showFlippedV(bool);
67 
68 	void handleAppModeChanged(int oldMode, int mode);
69 	void handleSelectionChanged();
70 
71 private slots:
72 	void handleNewX();
73 	void handleNewY();
74 	void handleNewW();
75 	void handleNewH();
76 	void handleRotation();
77 	void handleFlipH();
78 	void handleFlipV();
79 	void handleLower();
80 	void handleRaise();
81 	void handleFront();
82 	void handleBack();
83 	void handleBasePoint(int m);
84 	void handleLock();
85 	void handleLockSize();
86 	void handlePrint();
87 	void handleNewName();
88 	void handleGrouping();
89 	void handleUngrouping();
90 
91 protected slots:
92 	//virtual void reject();
93 	void spinboxStartUserAction();
94 	void spinboxFinishUserAction();
95 	void updateSpinBoxConstants();
96 
97 protected:
98 	bool m_lineMode {false};
99 	bool m_haveDoc {false};
100 	bool m_haveItem {false};
101 	double m_unitRatio {1.0};
102 	int m_unitIndex {SC_PT};
103 	PageItem *m_item {nullptr};
104 	ScribusMainWindow* m_ScMW {nullptr};
105 	ScGuardedPtr<ScribusDoc> m_doc;
106 
107 	double m_oldRotation {0.0};
108 
109 	bool _userActionOn;
110 	UserActionSniffer *userActionSniffer;
111 	void installSniffer(ScrSpinBox *spinBox);
112 
113 	void changeEvent(QEvent *e) override;
114 };
115 
116 #endif
117