]> Shamusworld >> Repos - architektonas/blob - src/base/document.h
8c0044e1bd499e5e0ff298aca8c5f54df7c9fe73
[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 graphics or
13  * blocks and are typically shown in graphic views. Documents hold
14  * an active pen for drawing in the Document, a file name and they
15  * know whether they have been modified or not.
16  *
17  * @author Andrew Mustun
18  */
19 class Document: public EntityContainer, public Undo
20 {
21         public:
22                 Document(EntityContainer * parent = NULL);
23                 virtual ~Document();
24
25                 virtual LayerList * getLayerList() = 0;
26                 virtual BlockList * getBlockList() = 0;
27
28                 virtual void newDoc() = 0;
29                 virtual bool save() = 0;
30                 virtual bool saveAs(const QString &filename, RS2::FormatType type) = 0;
31                 virtual bool open(const QString &filename, RS2::FormatType type) = 0;
32
33                 virtual bool isDocument() const;
34                 virtual void removeUndoable(Undoable * u);
35                 Pen getActivePen() const;
36                 void setActivePen(Pen p);
37                 QString getFilename() const;
38                 void setFilename(const QString & fn);
39                 virtual void setModified(bool m);
40                 virtual bool isModified() const;
41                 virtual void startUndoCycle();
42
43         protected:
44                 /** Flag set if the document was modified and not yet saved. */
45                 bool modified;
46                 /** Active pen. */
47                 Pen activePen;
48                 /** File name of the document or empty for a new document. */
49                 QString filename;
50                 /** Format type */
51                 RS2::FormatType formatType;
52 };
53
54 #endif