Scribus
Open source desktop publishing at your fingertips
pageitem_noteframe.h
1 #ifndef PAGEITEM_NOTEFRAME_H
2 #define PAGEITEM_NOTEFRAME_H
3 
4 #include "pageitem_textframe.h"
5 #include "notesstyles.h"
6 #include "undostate.h"
7 
8 class SCRIBUS_API PageItem_NoteFrame : public PageItem_TextFrame
9 {
10  Q_OBJECT
11  friend class ScribusDoc;
12 
13 private:
14  PageItem_NoteFrame(NotesStyle *nStyle, ScribusDoc *doc, double x, double y, double w, double h, double w2, QString fill, QString outline);
15  PageItem_NoteFrame(ScribusDoc *doc, double x, double y, double w, double h, double w2, QString fill, QString outline);
17  ~PageItem_NoteFrame() { }
18 public:
19  virtual PageItem_NoteFrame * asNoteFrame() { return this; }
20  virtual bool isNoteFrame() const { return true; }
21  virtual bool isAutoNoteFrame() const { return m_nstyle->isAutoRemoveEmptyNotesFrames(); }
22 
23  //overloaded text frame layouting
24  void layout();
25 
26  //indicate if noteframe should be deleted
27  bool deleteIt;
28 
29  //used while reading SLA file
30  void setNS(NotesStyle* nStyle, PageItem_TextFrame* master = NULL);
31  //returns Notes Style
32  NotesStyle* notesStyle() { return m_nstyle; }
33 
34  //insert notes content into notesframe
35  void updateNotes(QList<TextNote*> nList, bool clear = true);
36  //read notes text from notesframe itemText and store it in notes`s saxed text field
37  void updateNotesText();
38 
39  PageItem_TextFrame* masterFrame() { return m_masterFrame; }
40  void setMaster(PageItem* frame) { m_masterFrame = frame->asTextFrame(); }
41  bool isEndNotesFrame() { return m_nstyle->isEndNotes(); }
42  bool isAutoWelded() { return m_nstyle->isAutoWeldNotesFrames(); }
43  bool isAutoHeight() { return m_nstyle->isAutoNotesHeight(); }
44  bool isAutoWidth() { return m_nstyle->isAutoNotesWidth(); }
45 
46  //return list of notes in noteframe
47  QList<TextNote*> notesList() { return l_notes; }
48  //remove note from list
49  void removeNote(TextNote* note) { l_notes.removeOne(note); }
50 
51  void restoreDeleteNoteText(SimpleState *state, bool isUndo);
52  void restoreInsertNoteText(SimpleState *state, bool isUndo);
53  //overloaded PageItem::unWeld()
54  void unWeld(bool doUndo=true);
55 
56 private:
57  QList<TextNote*> l_notes;
58  NotesStyle* m_nstyle;
59  PageItem_TextFrame *m_masterFrame;
60 
61  //insert note at end of text in noteframe
62  void insertNote(TextNote* note);
63 
64 //not used???
65  //find position of note marker in text
66  int findNoteCpos(TextNote* note);
67 
68 };
69 
70 #endif // PAGEITEM_NOTEFRAME_H
Definition: pageitem_noteframe.h:8
virtual PageItem_NoteFrame * asNoteFrame()
Return self if Note item, otherwise null.
Definition: pageitem_noteframe.h:19
virtual bool isNoteFrame() const
Return true if Note item, otherwise false.
Definition: pageitem_noteframe.h:20
virtual void layout()
creates valid layout information
Definition: pageitem_textframe.cpp:1304
Definition: pageitem_textframe.h:45
Definition: notesstyles.h:28
the Document Class
Definition: scribusdoc.h:90
Definition: pageitem.h:92
virtual bool isAutoNoteFrame() const
Return true if Auto Note item, otherwise false.
Definition: pageitem_noteframe.h:21
Definition: notesstyles.h:91
SimpleState provides a simple implementation of the UndoState.
Definition: undostate.h:145
virtual PageItem_TextFrame * asTextFrame()
Return self if Text item, otherwise null.
Definition: pageitem.h:237