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 CONTENTPALETTE_H 8 #define CONTENTPALETTE_H 9 10 #include "scribusapi.h" 11 #include "scdockpalette.h" 12 #include "scguardedptr.h" 13 14 class QStackedWidget; 15 16 class ScribusMainWindow; 17 class ScribusDoc; 18 class PageItem; 19 20 class ContentPalette_Default; 21 class ContentPalette_Page; 22 class PropertiesPalette_Group; 23 class PropertiesPalette_Image; 24 class PropertiesPalette_Table; 25 class PropertiesPalette_Text; 26 class PageItem_TextFrame; 27 class PageItem_ImageFrame; 28 class ParagraphStyle; 29 class CharStyle; 30 31 class SCRIBUS_API ContentPalette : public ScDockPalette 32 { 33 Q_OBJECT 34 35 public: 36 ContentPalette(QWidget* parent); ~ContentPalette()37 ~ContentPalette() {} 38 39 void updateColorList(); 40 bool userActionOn(); 41 void changeEvent(QEvent *e) override; 42 void update(PageItem_ImageFrame* image); 43 void update(const ParagraphStyle& style); 44 void update(PageItem_TextFrame* image); 45 void updateTextStyles(); 46 void updateTextAlignment(int i); 47 void updateTextDirection(int i); 48 void updateTextFontSize(int i); 49 void updateTextLanguage(const QString& language); 50 51 public slots: 52 void setMainWindow(ScribusMainWindow *mw); 53 54 void setDoc(ScribusDoc *doc); 55 void unsetDoc(); 56 void unsetItem(); 57 void AppModeChanged(); 58 void setCurrentItem(PageItem *i); 59 PageItem* currentItemFromSelection(); 60 void handleSelectionChanged(); 61 62 void update(const CharStyle& style); 63 64 void unitChange(); 65 void languageChange(); 66 67 private: 68 ScribusMainWindow *m_ScMW {nullptr}; 69 ScGuardedPtr<ScribusDoc> m_doc {nullptr}; 70 PageItem* m_item {nullptr}; 71 72 bool m_haveDoc {false}; 73 bool m_haveItem {false}; 74 double m_unitRatio {1.0}; 75 int m_unitIndex {0}; 76 77 QStackedWidget* stackedWidget {nullptr}; 78 ContentPalette_Default* defaultPal {nullptr}; 79 PropertiesPalette_Group* groupPal {nullptr}; 80 PropertiesPalette_Image* imagePal {nullptr}; 81 ContentPalette_Page* pagePal {nullptr}; 82 PropertiesPalette_Table* tablePal {nullptr}; 83 PropertiesPalette_Text* textPal {nullptr}; 84 85 void updatePanelTitle(); 86 87 // the order must match the insertion of the widgets in the constructor 88 enum class Panel { 89 empty, 90 group, 91 image, 92 page, 93 table, 94 text 95 }; 96 }; 97 98 #endif 99