1 //------------------------------------------------------------------------------
2 // emSvgFileModel.h
3 //
4 // Copyright (C) 2010,2014,2018 Oliver Hamann.
5 //
6 // Homepage: http://eaglemode.sourceforge.net/
7 //
8 // This program is free software: you can redistribute it and/or modify it under
9 // the terms of the GNU General Public License version 3 as published by the
10 // Free Software Foundation.
11 //
12 // This program is distributed in the hope that it will be useful, but WITHOUT
13 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 // FOR A PARTICULAR PURPOSE. See the GNU General Public License version 3 for
15 // more details.
16 //
17 // You should have received a copy of the GNU General Public License version 3
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 //------------------------------------------------------------------------------
20 
21 #ifndef emSvgFileModel_h
22 #define emSvgFileModel_h
23 
24 #ifndef emFileModel_h
25 #include <emCore/emFileModel.h>
26 #endif
27 
28 #ifndef emSvgServerModel_h
29 #include <emSvg/emSvgServerModel.h>
30 #endif
31 
32 
33 class emSvgFileModel : public emFileModel {
34 
35 public:
36 
37 	static emRef<emSvgFileModel> Acquire(
38 		emContext & context, const emString & name, bool common=true
39 	);
40 
41 	double GetWidth() const;
42 	double GetHeight() const;
43 	const emString & GetTitle() const;
44 	const emString & GetDescription() const;
45 
46 	emSvgServerModel * GetServerModel() const;
47 	emSvgServerModel::SvgHandle GetSvgHandle() const;
48 
49 protected:
50 
51 	emSvgFileModel(emContext & context, const emString & name);
52 	virtual ~emSvgFileModel();
53 	virtual void ResetData();
54 	virtual void TryStartLoading();
55 	virtual bool TryContinueLoading();
56 	virtual void QuitLoading();
57 	virtual void TryStartSaving();
58 	virtual bool TryContinueSaving();
59 	virtual void QuitSaving();
60 	virtual emUInt64 CalcMemoryNeed();
61 	virtual double CalcFileProgress();
62 
63 private:
64 
65 	emRef<emSvgServerModel> ServerModel;
66 	emSvgServerModel::JobHandle JobHandle;
67 	emSvgServerModel::SvgHandle SvgHandle;
68 	emUInt64 FileSize;
69 	double Width;
70 	double Height;
71 	emString Title;
72 	emString Description;
73 };
74 
GetWidth()75 inline double emSvgFileModel::GetWidth() const
76 {
77 	return Width;
78 }
79 
GetHeight()80 inline double emSvgFileModel::GetHeight() const
81 {
82 	return Height;
83 }
84 
GetTitle()85 inline const emString & emSvgFileModel::GetTitle() const
86 {
87 	return Title;
88 }
89 
GetDescription()90 inline const emString & emSvgFileModel::GetDescription() const
91 {
92 	return Description;
93 }
94 
GetServerModel()95 inline emSvgServerModel * emSvgFileModel::GetServerModel() const
96 {
97 	return ServerModel;
98 }
99 
GetSvgHandle()100 inline emSvgServerModel::SvgHandle emSvgFileModel::GetSvgHandle() const
101 {
102 	return SvgHandle;
103 }
104 
105 
106 #endif
107