1 #ifndef NOTESSTYLES_H 2 #define NOTESSTYLES_H 3 4 #include <QDebug> 5 #include <QObject> 6 #include <QString> 7 #include <QList> 8 #include "numeration.h" 9 #include "pagestructs.h" 10 #include "scpage.h" 11 #include "styles/charstyle.h" 12 #include "styles/paragraphstyle.h" 13 #include "text/storytext.h" 14 15 class ScribusDoc; 16 class PageItem_NoteFrame; 17 class PageItem_TextFrame; 18 19 //used for map with endnotes frames maped with range item 20 typedef union 21 { 22 void* P; 23 int sectionIndex; 24 ScPage* page; 25 PageItem_TextFrame* firstStoryFrame; 26 } rangeItem; 27 28 class SCRIBUS_API NotesStyle 29 { 30 public: NotesStyle()31 NotesStyle() {} ~NotesStyle()32 ~NotesStyle() {} 33 bool operator!=(const NotesStyle& n2); 34 name()35 QString name() const { return m_nameStr; } setName(const QString & s)36 void setName(const QString& s) { m_nameStr = s; } start()37 int start() const { return m_startNum; } setStart(const int i)38 void setStart(const int i) { m_startNum = i; } setRange(NumerationRange ns)39 void setRange(NumerationRange ns) { m_numRange = ns; } range()40 const NumerationRange& range() const { return m_numRange; } prefix()41 QString prefix() const { return m_prefixStr; } setPrefix(const QString & str)42 void setPrefix (const QString& str) { m_prefixStr = str; } suffix()43 QString suffix() const { return m_suffixStr; } setSuffix(const QString & str)44 void setSuffix (const QString& str) { m_suffixStr = str; } 45 numString(const int num)46 QString numString(const int num) const { return m_numeration.numString(num); } setType(const NumFormat type)47 void setType(const NumFormat type) { m_numeration.numFormat = type; } getType()48 const NumFormat& getType() const { return m_numeration.numFormat; } 49 isEndNotes()50 bool isEndNotes() const { return m_endNotesStyle; } isAutoNotesHeight()51 bool isAutoNotesHeight() const { return m_autoNotesHeight; } setAutoNotesHeight(bool set)52 void setAutoNotesHeight(bool set) { m_autoNotesHeight = set; } isAutoNotesWidth()53 bool isAutoNotesWidth() const { return m_autoNotesWidth; } setAutoNotesWidth(bool set)54 void setAutoNotesWidth(bool set) { m_autoNotesWidth = set; } isAutoRemoveEmptyNotesFrames()55 bool isAutoRemoveEmptyNotesFrames() const { return m_autoRemoveEmptyNotesFrames; } setAutoRemoveEmptyNotesFrames(bool set)56 void setAutoRemoveEmptyNotesFrames(bool set) { m_autoRemoveEmptyNotesFrames = set; } isAutoWeldNotesFrames()57 bool isAutoWeldNotesFrames() const { return m_autoWeldNotesFrames; } setAutoWeldNotesFrames(bool set)58 void setAutoWeldNotesFrames(bool set) { m_autoWeldNotesFrames = set; } isSuperscriptInNote()59 bool isSuperscriptInNote() const { return m_superscriptInNote; } setSuperscriptInNote(bool set)60 void setSuperscriptInNote(bool set) { m_superscriptInNote = set; } isSuperscriptInMaster()61 bool isSuperscriptInMaster() const { return m_superscriptInMaster; } setSuperscriptInMaster(bool set)62 void setSuperscriptInMaster(bool set) { m_superscriptInMaster = set; } marksChStyle()63 const QString marksChStyle() const { return m_marksCharStyle; } setMarksCharStyle(const QString & styleName)64 void setMarksCharStyle(const QString& styleName) { m_marksCharStyle = styleName; } notesParStyle()65 const QString notesParStyle() const { return m_notesParaStyle; } setNotesParStyle(const QString & styleName)66 void setNotesParStyle(const QString& styleName) { m_notesParaStyle = styleName; } 67 68 void setEndNotes(bool); 69 70 private: 71 QString m_nameStr {"Default"}; //unique name of notes style 72 int m_startNum {1}; //numeration starts with that number 73 74 bool m_endNotesStyle {false}; //if not true this is set of footnotes 75 Numeration m_numeration; 76 NumerationRange m_numRange {NSRdocument}; //range of numeration for current set 77 QString m_prefixStr; 78 QString m_suffixStr {")"}; 79 bool m_autoNotesHeight {true}; //change height of notes frames to its content automaticaly? 80 bool m_autoNotesWidth {true}; //change width of notes frames automaticaly if width of master frame changes? 81 bool m_autoRemoveEmptyNotesFrames {true}; 82 bool m_autoWeldNotesFrames {true}; 83 bool m_superscriptInNote {true}; 84 bool m_superscriptInMaster {true}; 85 QString m_marksCharStyle; 86 QString m_notesParaStyle; 87 }; 88 89 class SCRIBUS_API TextNote : public QObject 90 { 91 Q_OBJECT 92 friend class ScribusDoc; 93 94 private: 95 //only ScribusDoc can create and delete notes TextNote(NotesStyle * nStyle)96 TextNote(NotesStyle *nStyle) : m_notesStyle(nStyle) { } ~TextNote()97 ~TextNote() {} 98 public: setNotesStyle(NotesStyle * ns)99 void setNotesStyle (NotesStyle* ns) { m_notesStyle = ns; } notesStyle()100 NotesStyle* notesStyle() { return m_notesStyle; } num()101 int num() { return m_number; } setNum(const int i)102 void setNum(const int i) { m_number = i; } 103 QString numString(); masterMark()104 Mark* masterMark() { return m_noteMasterMark; } setMasterMark(Mark * m)105 void setMasterMark(Mark* m) { m_noteMasterMark = m; } noteMark()106 Mark* noteMark() { return m_noteFrameMark; } setNoteMark(Mark * m)107 void setNoteMark(Mark* m) { m_noteFrameMark = m; } saxedText()108 const QString saxedText() { return m_noteSaxedText; } setSaxedText(const QString & string)109 void setSaxedText(const QString& string) { m_noteSaxedText = string; } clearSaxedText()110 void clearSaxedText() { m_noteSaxedText.clear(); textLen = 0; } isEndNote()111 bool isEndNote() { return m_notesStyle->isEndNotes(); } 112 int textLen {0}; 113 114 protected: 115 NotesStyle *m_notesStyle {nullptr}; 116 QString m_noteSaxedText; 117 Mark *m_noteMasterMark {nullptr}; 118 Mark *m_noteFrameMark {nullptr}; 119 int m_number {0}; 120 }; 121 122 #endif // NOTESSTYLES_H 123