1 | /*******************************************************************************
|
---|
2 | * You may amend and distribute as you like, but don't remove this header!
|
---|
3 | *
|
---|
4 | * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
|
---|
5 | * See http://www.codeplex.com/EPPlus for details.
|
---|
6 | *
|
---|
7 | * Copyright (C) 2011 Jan Källman
|
---|
8 | *
|
---|
9 | * This library is free software; you can redistribute it and/or
|
---|
10 | * modify it under the terms of the GNU Lesser General Public
|
---|
11 | * License as published by the Free Software Foundation; either
|
---|
12 | * version 2.1 of the License, or (at your option) any later version.
|
---|
13 |
|
---|
14 | * This library is distributed in the hope that it will be useful,
|
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
---|
17 | * See the GNU Lesser General Public License for more details.
|
---|
18 | *
|
---|
19 | * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
|
---|
20 | * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
|
---|
21 | *
|
---|
22 | * All code and executables are provided "as is" with no warranty either express or implied.
|
---|
23 | * The author accepts no liability for any damage or loss of business that this product may cause.
|
---|
24 | *
|
---|
25 | * Code change notes:
|
---|
26 | *
|
---|
27 | * Author Change Date
|
---|
28 | * ******************************************************************************
|
---|
29 | * Jan Källman Initial Release 2009-10-01
|
---|
30 | * Jan Källman License changed GPL-->LGPL 2011-12-16
|
---|
31 | *******************************************************************************/
|
---|
32 | using System;
|
---|
33 | using System.Collections.Generic;
|
---|
34 | using System.Text;
|
---|
35 | using System.Xml;
|
---|
36 | using System.Globalization;
|
---|
37 |
|
---|
38 | namespace OfficeOpenXml.Drawing
|
---|
39 | {
|
---|
40 | /// <summary>
|
---|
41 | /// 3D settings
|
---|
42 | /// </summary>
|
---|
43 | public sealed class ExcelView3D : XmlHelper
|
---|
44 | {
|
---|
45 | internal ExcelView3D(XmlNamespaceManager ns, XmlNode node)
|
---|
46 | : base(ns,node)
|
---|
47 | {
|
---|
48 | SchemaNodeOrder = new string[] { "rotX", "hPercent", "rotY", "depthPercent","rAngAx", "perspective"};
|
---|
49 | }
|
---|
50 | const string perspectivePath = "c:perspective/@val";
|
---|
51 | /// <summary>
|
---|
52 | /// Degree of perspective
|
---|
53 | /// </summary>
|
---|
54 | public decimal Perspective
|
---|
55 | {
|
---|
56 | get
|
---|
57 | {
|
---|
58 | return GetXmlNodeInt(perspectivePath);
|
---|
59 | }
|
---|
60 | set
|
---|
61 | {
|
---|
62 | SetXmlNodeString(perspectivePath, value.ToString(CultureInfo.InvariantCulture));
|
---|
63 | }
|
---|
64 | }
|
---|
65 | const string rotXPath = "c:rotX/@val";
|
---|
66 | /// <summary>
|
---|
67 | /// Rotation X-axis
|
---|
68 | /// </summary>
|
---|
69 | public decimal RotX
|
---|
70 | {
|
---|
71 | get
|
---|
72 | {
|
---|
73 | return GetXmlNodeDecimal(rotXPath);
|
---|
74 | }
|
---|
75 | set
|
---|
76 | {
|
---|
77 | CreateNode(rotXPath);
|
---|
78 | SetXmlNodeString(rotXPath, value.ToString(CultureInfo.InvariantCulture));
|
---|
79 | }
|
---|
80 | }
|
---|
81 | const string rotYPath = "c:rotY/@val";
|
---|
82 | /// <summary>
|
---|
83 | /// Rotation Y-axis
|
---|
84 | /// </summary>
|
---|
85 | public decimal RotY
|
---|
86 | {
|
---|
87 | get
|
---|
88 | {
|
---|
89 | return GetXmlNodeDecimal(rotYPath);
|
---|
90 | }
|
---|
91 | set
|
---|
92 | {
|
---|
93 | CreateNode(rotYPath);
|
---|
94 | SetXmlNodeString(rotYPath, value.ToString(CultureInfo.InvariantCulture));
|
---|
95 | }
|
---|
96 | }
|
---|
97 | const string rAngAxPath = "c:rAngAx/@val";
|
---|
98 | /// <summary>
|
---|
99 | /// Right Angle Axes
|
---|
100 | /// </summary>
|
---|
101 | public bool RightAngleAxes
|
---|
102 | {
|
---|
103 | get
|
---|
104 | {
|
---|
105 | return GetXmlNodeBool(rAngAxPath);
|
---|
106 | }
|
---|
107 | set
|
---|
108 | {
|
---|
109 | SetXmlNodeBool(rAngAxPath, value);
|
---|
110 | }
|
---|
111 | }
|
---|
112 | const string depthPercentPath = "c:depthPercent/@val";
|
---|
113 | /// <summary>
|
---|
114 | /// Depth % of base
|
---|
115 | /// </summary>
|
---|
116 | public int DepthPercent
|
---|
117 | {
|
---|
118 | get
|
---|
119 | {
|
---|
120 | return GetXmlNodeInt(depthPercentPath);
|
---|
121 | }
|
---|
122 | set
|
---|
123 | {
|
---|
124 | if (value < 0 || value > 2000)
|
---|
125 | {
|
---|
126 | throw(new ArgumentOutOfRangeException("Value must be between 0 and 2000"));
|
---|
127 | }
|
---|
128 | SetXmlNodeString(depthPercentPath, value.ToString());
|
---|
129 | }
|
---|
130 | }
|
---|
131 | const string heightPercentPath = "c:hPercent/@val";
|
---|
132 | /// <summary>
|
---|
133 | /// Height % of base
|
---|
134 | /// </summary>
|
---|
135 | public int HeightPercent
|
---|
136 | {
|
---|
137 | get
|
---|
138 | {
|
---|
139 | return GetXmlNodeInt(heightPercentPath);
|
---|
140 | }
|
---|
141 | set
|
---|
142 | {
|
---|
143 | if (value < 5 || value > 500)
|
---|
144 | {
|
---|
145 | throw (new ArgumentOutOfRangeException("Value must be between 5 and 500"));
|
---|
146 | }
|
---|
147 | SetXmlNodeString(heightPercentPath, value.ToString());
|
---|
148 | }
|
---|
149 | }
|
---|
150 | }
|
---|
151 | }
|
---|