]> Shamusworld >> Repos - architektonas/blob - src/base/rs_document.h
Fixed thumbnail rendering in LibraryWidget and DXF detection.
[architektonas] / src / base / rs_document.h
1 #ifndef RS_DOCUMENT_H
2 #define RS_DOCUMENT_H
3
4 #include <QtCore>
5 #include "rs_entitycontainer.h"
6 #include "rs_undo.h"
7
8 class RS_BlockList;
9 class RS_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 RS_Document: public RS_EntityContainer, public RS_Undo
20 {
21         public:
22                 RS_Document(RS_EntityContainer * parent = NULL);
23                 virtual ~RS_Document();
24
25                 virtual RS_LayerList * getLayerList() = 0;
26                 virtual RS_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(RS_Undoable * u);
35                 RS_Pen getActivePen() const;
36                 void setActivePen(RS_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                 RS_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