Mercurial > clickerconvert
comparison src/xlsx/xlsxabstractsheet.cpp @ 1:93d3106bb9a4
Add qt xlsx library
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Tue, 22 Mar 2016 10:38:08 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:49cd5cc0b072 | 1:93d3106bb9a4 |
---|---|
1 /**************************************************************************** | |
2 ** Copyright (c) 2013-2014 Debao Zhang <hello@debao.me> | |
3 ** All right reserved. | |
4 ** | |
5 ** Permission is hereby granted, free of charge, to any person obtaining | |
6 ** a copy of this software and associated documentation files (the | |
7 ** "Software"), to deal in the Software without restriction, including | |
8 ** without limitation the rights to use, copy, modify, merge, publish, | |
9 ** distribute, sublicense, and/or sell copies of the Software, and to | |
10 ** permit persons to whom the Software is furnished to do so, subject to | |
11 ** the following conditions: | |
12 ** | |
13 ** The above copyright notice and this permission notice shall be | |
14 ** included in all copies or substantial portions of the Software. | |
15 ** | |
16 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
17 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
18 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
19 ** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |
20 ** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |
21 ** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
22 ** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
23 ** | |
24 ****************************************************************************/ | |
25 #include "xlsxabstractsheet.h" | |
26 #include "xlsxabstractsheet_p.h" | |
27 #include "xlsxworkbook.h" | |
28 | |
29 QT_BEGIN_NAMESPACE_XLSX | |
30 | |
31 AbstractSheetPrivate::AbstractSheetPrivate(AbstractSheet *p, AbstractSheet::CreateFlag flag) | |
32 : AbstractOOXmlFilePrivate(p, flag) | |
33 { | |
34 type = AbstractSheet::ST_WorkSheet; | |
35 sheetState = AbstractSheet::SS_Visible; | |
36 } | |
37 | |
38 AbstractSheetPrivate::~AbstractSheetPrivate() | |
39 { | |
40 } | |
41 | |
42 /*! | |
43 \class AbstractSheet | |
44 \inmodule QtXlsx | |
45 \brief Base class for worksheet, chartsheet, etc. | |
46 */ | |
47 | |
48 /*! | |
49 \enum AbstractSheet::SheetType | |
50 | |
51 \value ST_WorkSheet | |
52 \value ST_ChartSheet | |
53 \omitvalue ST_DialogSheet | |
54 \omitvalue ST_MacroSheet | |
55 */ | |
56 | |
57 /*! | |
58 \enum AbstractSheet::SheetState | |
59 | |
60 \value SS_Visible | |
61 \value SS_Hidden | |
62 \value SS_VeryHidden User cann't make a veryHidden sheet visible in normal way. | |
63 */ | |
64 | |
65 /*! | |
66 \fn AbstractSheet::copy(const QString &distName, int distId) const | |
67 | |
68 Copies the current sheet to a sheet called \a distName with \a distId. | |
69 Returns the new sheet. | |
70 */ | |
71 | |
72 /*! | |
73 * \internal | |
74 */ | |
75 AbstractSheet::AbstractSheet(const QString &name, int id, Workbook *workbook, AbstractSheetPrivate *d) : | |
76 AbstractOOXmlFile(d) | |
77 { | |
78 d_func()->name = name; | |
79 d_func()->id = id; | |
80 d_func()->workbook = workbook; | |
81 } | |
82 | |
83 | |
84 /*! | |
85 * Returns the name of the sheet. | |
86 */ | |
87 QString AbstractSheet::sheetName() const | |
88 { | |
89 Q_D(const AbstractSheet); | |
90 return d->name; | |
91 } | |
92 | |
93 /*! | |
94 * \internal | |
95 */ | |
96 void AbstractSheet::setSheetName(const QString &sheetName) | |
97 { | |
98 Q_D(AbstractSheet); | |
99 d->name = sheetName; | |
100 } | |
101 | |
102 /*! | |
103 * Returns the type of the sheet. | |
104 */ | |
105 AbstractSheet::SheetType AbstractSheet::sheetType() const | |
106 { | |
107 Q_D(const AbstractSheet); | |
108 return d->type; | |
109 } | |
110 | |
111 /*! | |
112 * \internal | |
113 */ | |
114 void AbstractSheet::setSheetType(SheetType type) | |
115 { | |
116 Q_D(AbstractSheet); | |
117 d->type = type; | |
118 } | |
119 | |
120 /*! | |
121 * Returns the state of the sheet. | |
122 * | |
123 * \sa isHidden(), isVisible(), setSheetState() | |
124 */ | |
125 AbstractSheet::SheetState AbstractSheet::sheetState() const | |
126 { | |
127 Q_D(const AbstractSheet); | |
128 return d->sheetState; | |
129 } | |
130 | |
131 /*! | |
132 * Set the state of the sheet to \a state. | |
133 */ | |
134 void AbstractSheet::setSheetState(SheetState state) | |
135 { | |
136 Q_D(AbstractSheet); | |
137 d->sheetState = state; | |
138 } | |
139 | |
140 /*! | |
141 * Returns true if the sheet is not visible, otherwise false will be returned. | |
142 * | |
143 * \sa sheetState(), setHidden() | |
144 */ | |
145 bool AbstractSheet::isHidden() const | |
146 { | |
147 Q_D(const AbstractSheet); | |
148 return d->sheetState != SS_Visible; | |
149 } | |
150 | |
151 /*! | |
152 * Returns true if the sheet is visible. | |
153 */ | |
154 bool AbstractSheet::isVisible() const | |
155 { | |
156 return !isHidden(); | |
157 } | |
158 | |
159 /*! | |
160 * Make the sheet hiden or visible based on \a hidden. | |
161 */ | |
162 void AbstractSheet::setHidden(bool hidden) | |
163 { | |
164 Q_D(AbstractSheet); | |
165 if (hidden == isHidden()) | |
166 return; | |
167 | |
168 d->sheetState = hidden ? SS_Hidden : SS_Visible; | |
169 } | |
170 | |
171 /*! | |
172 * Convenience function, equivalent to setHidden(! \a visible). | |
173 */ | |
174 void AbstractSheet::setVisible(bool visible) | |
175 { | |
176 setHidden(!visible); | |
177 } | |
178 | |
179 /*! | |
180 * \internal | |
181 */ | |
182 int AbstractSheet::sheetId() const | |
183 { | |
184 Q_D(const AbstractSheet); | |
185 return d->id; | |
186 } | |
187 | |
188 /*! | |
189 * \internal | |
190 */ | |
191 Drawing *AbstractSheet::drawing() const | |
192 { | |
193 Q_D(const AbstractSheet); | |
194 return d->drawing.data(); | |
195 } | |
196 | |
197 /*! | |
198 * Return the workbook | |
199 */ | |
200 Workbook *AbstractSheet::workbook() const | |
201 { | |
202 Q_D(const AbstractSheet); | |
203 return d->workbook; | |
204 } | |
205 | |
206 QT_END_NAMESPACE_XLSX |