Scribus
Open source desktop publishing at your fingertips
notesstyles.h
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:
31  NotesStyle() : nameStr ("Default"), startNum(1), m_endNotesStyle(false), numeration(), numRange(NSRdocument), prefixStr(""), suffixStr(")"),
32  autoNotesHeight(true), autoNotesWidth(true), autoRemoveEmptyNotesFrames(true), autoWeldNotesFrames(true),
33  superscriptInNote(true), superscriptInMaster(true), marksCharStyle(""), notesParaStyle("") {}
34  ~NotesStyle() {}
35  bool operator!=(const NotesStyle& n2);
36 
37  QString name() const { return nameStr; }
38  void setName(const QString s) { nameStr = s; }
39  int start() const { return startNum; }
40  void setStart(const int i) { startNum = i; }
41  void setRange(NumerationRange ns) { numRange = ns; }
42  const NumerationRange& range() const { return numRange; }
43  QString prefix() const { return prefixStr; }
44  void setPrefix (const QString str) { prefixStr = str; }
45  QString suffix() const { return suffixStr; }
46  void setSuffix (const QString str) { suffixStr = str; }
47 
48  QString numString(const int num) const { return numeration.numString(num); }
49  void setType(const NumFormat type) { numeration.numFormat = type; }
50  const NumFormat& getType() const { return numeration.numFormat; }
51 
52  bool isEndNotes() const { return m_endNotesStyle; }
53  bool isAutoNotesHeight() const { return autoNotesHeight; }
54  void setAutoNotesHeight(bool set) { autoNotesHeight = set; }
55  bool isAutoNotesWidth() const { return autoNotesWidth; }
56  void setAutoNotesWidth(bool set) { autoNotesWidth = set; }
57  bool isAutoRemoveEmptyNotesFrames() const { return autoRemoveEmptyNotesFrames; }
58  void setAutoRemoveEmptyNotesFrames(bool set) { autoRemoveEmptyNotesFrames = set; }
59  bool isAutoWeldNotesFrames() const { return autoWeldNotesFrames; }
60  void setAutoWeldNotesFrames(bool set) { autoWeldNotesFrames = set; }
61  bool isSuperscriptInNote() const { return superscriptInNote; }
62  void setSuperscriptInNote(bool set) { superscriptInNote = set; }
63  bool isSuperscriptInMaster() const { return superscriptInMaster; }
64  void setSuperscriptInMaster(bool set) { superscriptInMaster = set; }
65  const QString marksChStyle() const { return marksCharStyle; }
66  void setMarksCharStyle(const QString styleName) { marksCharStyle = styleName; }
67  const QString notesParStyle() const { return notesParaStyle; }
68  void setNotesParStyle(const QString styleName) { notesParaStyle = styleName; }
69 
70  void setEndNotes(bool);
71 
72 private:
73  QString nameStr; //unique name of notes style
74  int startNum; //numeration starts with that number
75 
76  bool m_endNotesStyle; //if not true this is set of footnotes
77  Numeration numeration;
78  NumerationRange numRange; //range of numeration for current set
79  QString prefixStr;
80  QString suffixStr;
81  bool autoNotesHeight; //change height of notes frames to its content automaticaly?
82  bool autoNotesWidth; //change width of notes frames automaticaly if width of master frame changes?
83  bool autoRemoveEmptyNotesFrames;
84  bool autoWeldNotesFrames;
85  bool superscriptInNote;
86  bool superscriptInMaster;
87  QString marksCharStyle;
88  QString notesParaStyle;
89 };
90 
91 class SCRIBUS_API TextNote : public QObject
92 {
93  Q_OBJECT
94  friend class ScribusDoc;
95 
96 private:
97  //only ScribusDoc can create and delete notes
98  TextNote(NotesStyle *nStyle) : m_notesStyle(nStyle), m_noteSaxedText(""), m_noteMasterMark(NULL), m_noteFrameMark(NULL), m_number(0) { }
99  ~TextNote() {}
100 public:
101  void setNotesStyle (NotesStyle* ns) { m_notesStyle = ns; }
102  NotesStyle* notesStyle() { return m_notesStyle; }
103  const int num() { return m_number; }
104  void setNum(const int i) { m_number = i; }
105  const QString numString();
106  Mark* masterMark() { return m_noteMasterMark; }
107  void setMasterMark(Mark* m) { m_noteMasterMark = m; }
108  Mark* noteMark() { return m_noteFrameMark; }
109  void setNoteMark(Mark* m) { m_noteFrameMark = m; }
110  const QString saxedText() { return m_noteSaxedText; }
111  void setSaxedText(const QString string) { m_noteSaxedText = string; }
112  bool isEndNote() { return m_notesStyle->isEndNotes(); }
113  int textLen;
114 
115 protected:
116  NotesStyle *m_notesStyle;
117  QString m_noteSaxedText;
118  Mark *m_noteMasterMark;
119  Mark *m_noteFrameMark;
120  int m_number;
121 };
122 
123 #endif // NOTESSTYLES_H
Definition: pageitem_noteframe.h:8
Definition: pageitem_textframe.h:45
Definition: scpage.h:46
Definition: notesstyles.h:28
Definition: marks.h:40
the Document Class
Definition: scribusdoc.h:90
Definition: numeration.h:29
Definition: notesstyles.h:20
Definition: notesstyles.h:91