]> Shamusworld >> Repos - architektonas/blob - src/base/document.h
Fixed problem with MDI activation.
[architektonas] / src / base / document.h
1 #ifndef __DOCUMENT_H__
2 #define __DOCUMENT_H__
3
4 #include <QtCore>
5 #include "entitycontainer.h"
6 #include "undo.h"
7
8 class BlockList;
9 class LayerList;
10
11 /**
12  * Base class for documents. Documents can be either Drawings or Blocks and are
13  * typically shown in graphic views. Documents hold an active pen for drawing
14  * in the Document, a file name and they know whether they have been modified
15  * or not.
16  *
17  * @author James Hammons
18  * @author Andrew Mustun
19  */
20 class Document: public EntityContainer, public Undo
21 {
22         public:
23                 Document(EntityContainer * parent = NULL);
24                 virtual ~Document();
25
26                 virtual LayerList * getLayerList() = 0;
27                 virtual BlockList * getBlockList() = 0;
28
29                 virtual void newDoc() = 0;
30                 virtual bool save() = 0;
31                 virtual bool saveAs(const QString &filename, RS2::FormatType type) = 0;
32                 virtual bool open(const QString &filename, RS2::FormatType type) = 0;
33
34                 virtual bool isDocument() const;
35                 virtual void removeUndoable(Undoable * u);
36                 Pen getActivePen() const;
37                 void setActivePen(Pen p);
38                 QString getFilename() const;
39                 void setFilename(const QString & fn);
40                 virtual void setModified(bool m);
41                 virtual bool isModified() const;
42                 virtual void startUndoCycle();
43
44         protected:
45                 /** Flag set if the document was modified and not yet saved. */
46                 bool modified;
47                 /** Active pen. */
48                 Pen activePen;
49                 /** File name of the document or empty for a new document. */
50                 QString filename;
51                 /** Format type */
52                 RS2::FormatType formatType;
53 };
54
55 #endif