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_SHAPE_H
8 #define PROPERTIESPALETTE_SHAPE_H
9 
10 #include "ui_propertiespalette_shapebase.h"
11 
12 #include "scribusapi.h"
13 #include "scrspinbox.h"
14 #include "pageitem.h"
15 #include "linkbutton.h"
16 #include "sclistboxpixmap.h"
17 #include "scguardedptr.h"
18 #include "sctreewidget.h"
19 #include "units.h"
20 
21 class Autoforms;
22 class ScribusDoc;
23 class ScribusMainWindow;
24 class Selection;
25 
26 class SCRIBUS_API PropertiesPalette_Shape : public QWidget, Ui::PropertiesPalette_ShapeBase
27 {
28 	Q_OBJECT
29 
30 public:
31 	PropertiesPalette_Shape(QWidget* parent);
~PropertiesPalette_Shape()32 	~PropertiesPalette_Shape() {};
33 
34 	void setCustomShapeIcon(int submode);
35 	void setLocked(bool isLocked);
36 	void setSizeLocked(bool isLocked);
37 	void setRoundRectEnabled(bool enabled);
38 	void showTextFlowMode(PageItem::TextFlowMode mode);
39 
40 protected:
41 	bool m_haveDoc {false};
42 	bool m_haveItem {false};
43 	double m_unitRatio {1.0};
44 	int m_unitIndex {SC_PT};
45 	PageItem *m_item {nullptr};
46 	ScGuardedPtr<ScribusDoc> m_doc;
47 
48 	Selection* m_tmpSelection {nullptr};
49 
50 	void changeEvent(QEvent *e) override;
51 
52 private:
53 	PageItem* currentItemFromSelection();
54 
55 protected:
56 	ScribusMainWindow *m_ScMW {nullptr};
57 
58 	void enableCustomShape();
59 	void enableEditShape();
60 
61 public slots:
62 	void setMainWindow(ScribusMainWindow *mw);
63 
64 	void setDoc(ScribusDoc *d);
65 	void setCurrentItem(PageItem *item);
66 	void unsetDoc();
67 	void unsetItem();
68 
69 	void handleSelectionChanged();
70 	void handleUpdateRequest(int);
71 
72 	void iconSetChange();
73 	void languageChange();
74 	void unitChange();
75 	void localeChange();
76 
77 private slots:
78 
79 	void handleTextFlow();
80 	void handleShapeEdit();
81 	void handleShapeEditEnded();
82 	void handleCornerRadius();
83 	void handleFillRule();
84 	void handleNewShape(int, int, qreal *);
85 };
86 
87 #endif
88