/src/libstaroffice/src/lib/StarGraphicAttribute.cxx
Line | Count | Source |
1 | | /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */ |
2 | | |
3 | | /* libstaroffice |
4 | | * Version: MPL 2.0 / LGPLv2+ |
5 | | * |
6 | | * The contents of this file are subject to the Mozilla Public License Version |
7 | | * 2.0 (the "License"); you may not use this file except in compliance with |
8 | | * the License or as specified alternatively below. You may obtain a copy of |
9 | | * the License at http://www.mozilla.org/MPL/ |
10 | | * |
11 | | * Software distributed under the License is distributed on an "AS IS" basis, |
12 | | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
13 | | * for the specific language governing rights and limitations under the |
14 | | * License. |
15 | | * |
16 | | * Major Contributor(s): |
17 | | * Copyright (C) 2002 William Lachance (wrlach@gmail.com) |
18 | | * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net) |
19 | | * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch) |
20 | | * Copyright (C) 2006, 2007 Andrew Ziem |
21 | | * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr) |
22 | | * |
23 | | * |
24 | | * All Rights Reserved. |
25 | | * |
26 | | * For minor contributions see the git repository. |
27 | | * |
28 | | * Alternatively, the contents of this file may be used under the terms of |
29 | | * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"), |
30 | | * in which case the provisions of the LGPLv2+ are applicable |
31 | | * instead of those above. |
32 | | */ |
33 | | |
34 | | #include <iostream> |
35 | | |
36 | | #include "STOFFCellStyle.hxx" |
37 | | #include "STOFFFont.hxx" |
38 | | #include "STOFFGraphicStyle.hxx" |
39 | | #include "STOFFPageSpan.hxx" |
40 | | #include "STOFFParagraph.hxx" |
41 | | |
42 | | #include "StarAttribute.hxx" |
43 | | #include "StarBitmap.hxx" |
44 | | #include "StarGraphicStruct.hxx" |
45 | | #include "StarItemPool.hxx" |
46 | | #include "StarObject.hxx" |
47 | | #include "StarState.hxx" |
48 | | #include "StarZone.hxx" |
49 | | |
50 | | #include "StarGraphicAttribute.hxx" |
51 | | |
52 | | namespace StarGraphicAttribute |
53 | | { |
54 | | //! a character bool attribute |
55 | | class StarGAttributeBool final : public StarAttributeBool |
56 | | { |
57 | | public: |
58 | | //! constructor |
59 | | StarGAttributeBool(Type type, std::string const &debugName, bool value) |
60 | 4.44M | : StarAttributeBool(type, debugName, value) |
61 | 4.44M | { |
62 | 4.44M | } |
63 | | //! create a new attribute |
64 | | std::shared_ptr<StarAttribute> create() const final |
65 | 33.7k | { |
66 | 33.7k | return std::shared_ptr<StarAttribute>(new StarGAttributeBool(*this)); |
67 | 33.7k | } |
68 | | //! add to a graphic style |
69 | | void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final; |
70 | | |
71 | | protected: |
72 | | //! copy constructor |
73 | 33.7k | StarGAttributeBool(StarGAttributeBool const &) = default; |
74 | | }; |
75 | | |
76 | | //! a character color attribute |
77 | | class StarGAttributeColor final : public StarAttributeColor |
78 | | { |
79 | | public: |
80 | | //! constructor |
81 | | StarGAttributeColor(Type type, std::string const &debugName, STOFFColor const &value) |
82 | | : StarAttributeColor(type, debugName, value) |
83 | 0 | { |
84 | 0 | } |
85 | | //! destructor |
86 | | ~StarGAttributeColor() final; |
87 | | //! create a new attribute |
88 | | std::shared_ptr<StarAttribute> create() const final |
89 | 0 | { |
90 | 0 | return std::shared_ptr<StarAttribute>(new StarGAttributeColor(*this)); |
91 | 0 | } |
92 | | //! add to a graphic style |
93 | | // void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final; |
94 | | protected: |
95 | | //! copy constructor |
96 | 0 | StarGAttributeColor(StarGAttributeColor const &) = default; |
97 | | }; |
98 | | |
99 | | StarGAttributeColor::~StarGAttributeColor() |
100 | 0 | { |
101 | 0 | } |
102 | | |
103 | | //! an integer attribute |
104 | | class StarGAttributeFraction final : public StarAttribute |
105 | | { |
106 | | public: |
107 | | //! constructor |
108 | | StarGAttributeFraction(Type type, std::string const &debugName) |
109 | 889k | : StarAttribute(type, debugName) |
110 | 889k | , m_numerator(0) |
111 | 889k | , m_denominator(1) |
112 | 889k | { |
113 | 889k | } |
114 | | //! create a new attribute |
115 | | std::shared_ptr<StarAttribute> create() const final |
116 | 4.99k | { |
117 | 4.99k | return std::shared_ptr<StarAttribute>(new StarGAttributeFraction(*this)); |
118 | 4.99k | } |
119 | | //! read a zone |
120 | | bool read(StarZone &zone, int vers, long endPos, StarObject &object) final; |
121 | | //! debug function to print the data |
122 | | void printData(libstoff::DebugStream &o) const final |
123 | 4.84k | { |
124 | 4.84k | o << m_debugName; |
125 | 4.84k | if (m_numerator) o << "=" << m_numerator << "/" << m_denominator; |
126 | 4.84k | o << ","; |
127 | 4.84k | } |
128 | | |
129 | | protected: |
130 | | //! copy constructor |
131 | 4.99k | StarGAttributeFraction(StarGAttributeFraction const &) = default; |
132 | | // numerator |
133 | | int m_numerator; |
134 | | // denominator |
135 | | int m_denominator; |
136 | | }; |
137 | | |
138 | | bool StarGAttributeFraction::read(StarZone &zone, int /*vers*/, long endPos, StarObject &/*object*/) |
139 | 4.84k | { |
140 | 4.84k | STOFFInputStreamPtr input=zone.input(); |
141 | 4.84k | long pos=input->tell(); |
142 | 4.84k | libstoff::DebugFile &ascFile=zone.ascii(); |
143 | 4.84k | libstoff::DebugStream f; |
144 | 4.84k | f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:"; |
145 | 4.84k | m_numerator=int(input->readLong(4)); |
146 | 4.84k | m_denominator=int(input->readLong(4)); |
147 | | |
148 | 4.84k | printData(f); |
149 | 4.84k | ascFile.addPos(pos); |
150 | 4.84k | ascFile.addNote(f.str().c_str()); |
151 | 4.84k | return pos+8<=endPos; |
152 | 4.84k | } |
153 | | |
154 | | //! a character integer attribute |
155 | | class StarGAttributeInt final : public StarAttributeInt |
156 | | { |
157 | | public: |
158 | | //! constructor |
159 | | StarGAttributeInt(Type type, std::string const &debugName, int intSize, int value) |
160 | 12.6M | : StarAttributeInt(type, debugName, intSize, value) |
161 | 12.6M | { |
162 | 12.6M | } |
163 | | //! add to a graphic style |
164 | | void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final; |
165 | | //! create a new attribute |
166 | | std::shared_ptr<StarAttribute> create() const final |
167 | 139k | { |
168 | 139k | return std::shared_ptr<StarAttribute>(new StarGAttributeInt(*this)); |
169 | 139k | } |
170 | | protected: |
171 | | //! copy constructor |
172 | 139k | StarGAttributeInt(StarGAttributeInt const &) = default; |
173 | | }; |
174 | | |
175 | | //! a character unsigned integer attribute |
176 | | class StarGAttributeUInt final : public StarAttributeUInt |
177 | | { |
178 | | public: |
179 | | //! constructor |
180 | | StarGAttributeUInt(Type type, std::string const &debugName, int intSize, unsigned int value) |
181 | 5.86M | : StarAttributeUInt(type, debugName, intSize, value) |
182 | 5.86M | { |
183 | 5.86M | } |
184 | | //! create a new attribute |
185 | | std::shared_ptr<StarAttribute> create() const final |
186 | 55.7k | { |
187 | 55.7k | return std::shared_ptr<StarAttribute>(new StarGAttributeUInt(*this)); |
188 | 55.7k | } |
189 | | //! add to a graphic style |
190 | | void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final; |
191 | | protected: |
192 | | //! copy constructor |
193 | 55.7k | StarGAttributeUInt(StarGAttributeUInt const &) = default; |
194 | | }; |
195 | | |
196 | | //! a void attribute |
197 | | class StarGAttributeVoid final : public StarAttributeVoid |
198 | | { |
199 | | public: |
200 | | //! constructor |
201 | | StarGAttributeVoid(Type type, std::string const &debugName) |
202 | 11.7M | : StarAttributeVoid(type, debugName) |
203 | 11.7M | { |
204 | 11.7M | } |
205 | | //! destructor |
206 | | ~StarGAttributeVoid() final; |
207 | | //! create a new attribute |
208 | | std::shared_ptr<StarAttribute> create() const final |
209 | 32.0k | { |
210 | 32.0k | return std::shared_ptr<StarAttribute>(new StarGAttributeVoid(*this)); |
211 | 32.0k | } |
212 | | //! add to a graphic style |
213 | | void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final; |
214 | | protected: |
215 | | //! copy constructor |
216 | 32.0k | StarGAttributeVoid(StarGAttributeVoid const &) = default; |
217 | | }; |
218 | | |
219 | | StarGAttributeVoid::~StarGAttributeVoid() |
220 | 11.7M | { |
221 | 11.7M | } |
222 | | |
223 | | //! a list of item attribute of StarAttributeInternal |
224 | | class StarGAttributeItemSet final : public StarAttributeItemSet |
225 | | { |
226 | | public: |
227 | | //! constructor |
228 | | StarGAttributeItemSet(Type type, std::string const &debugName, std::vector<STOFFVec2i> const &limits) |
229 | 1.77M | : StarAttributeItemSet(type, debugName, limits) |
230 | 1.77M | { |
231 | 1.77M | } |
232 | | //! destructor |
233 | | ~StarGAttributeItemSet() final; |
234 | | //! create a new attribute |
235 | | std::shared_ptr<StarAttribute> create() const final |
236 | 246k | { |
237 | 246k | return std::shared_ptr<StarAttribute>(new StarGAttributeItemSet(*this)); |
238 | 246k | } |
239 | | |
240 | | protected: |
241 | | //! copy constructor |
242 | 246k | StarGAttributeItemSet(StarGAttributeItemSet const &) = default; |
243 | | }; |
244 | | |
245 | | StarGAttributeItemSet::~StarGAttributeItemSet() |
246 | 2.02M | { |
247 | 2.02M | } |
248 | | |
249 | | void StarGAttributeBool::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const |
250 | 27.6k | { |
251 | 27.6k | if (m_type==XATTR_LINESTARTCENTER) |
252 | 4.60k | state.m_graphic.m_propertyList.insert("draw:marker-start-center", m_value); |
253 | 23.0k | else if (m_type==XATTR_LINEENDCENTER) |
254 | 4.47k | state.m_graphic.m_propertyList.insert("draw:marker-end-center", m_value); |
255 | 18.5k | else if (m_type==XATTR_FILLBMP_TILE && m_value) |
256 | 327 | state.m_graphic.m_propertyList.insert("style:repeat", "repeat"); |
257 | 18.1k | else if (m_type==XATTR_FILLBMP_STRETCH && m_value) |
258 | 222 | state.m_graphic.m_propertyList.insert("style:repeat", "stretch"); |
259 | 17.9k | else if (m_type==XATTR_FILLBACKGROUND) |
260 | 302 | state.m_graphic.m_hasBackground=m_value; |
261 | 17.6k | else if (m_type==StarAttribute::SDRATTR_SHADOW) |
262 | 5.74k | state.m_graphic.m_propertyList.insert("draw:shadow", m_value ? "visible" : "hidden"); |
263 | 11.9k | else if (m_type==SDRATTR_TEXT_AUTOGROWHEIGHT) |
264 | 3.78k | state.m_graphic.m_propertyList.insert("draw:auto-grow-height", m_value); |
265 | 8.14k | else if (m_type==SDRATTR_TEXT_AUTOGROWWIDTH) |
266 | 1.01k | state.m_graphic.m_propertyList.insert("draw:auto-grow-width", m_value); |
267 | 7.13k | else if (m_type==SDRATTR_TEXT_ANISTARTINSIDE) |
268 | 869 | state.m_graphic.m_propertyList.insert("text:animation-start-inside", m_value); |
269 | 6.26k | else if (m_type==SDRATTR_TEXT_ANISTOPINSIDE) |
270 | 763 | state.m_graphic.m_propertyList.insert("text:animation-stop-inside", m_value); |
271 | 5.50k | else if (m_type==SDRATTR_TEXT_CONTOURFRAME) // checkme |
272 | 254 | state.m_graphic.m_propertyList.insert("style:wrap-contour", m_value); |
273 | 5.24k | else if (m_type==SDRATTR_OBJMOVEPROTECT) |
274 | 317 | state.m_graphic.m_protections[0]=m_value; |
275 | 4.92k | else if (m_type==SDRATTR_OBJSIZEPROTECT) |
276 | 234 | state.m_graphic.m_protections[1]=m_value; |
277 | 4.69k | else if (m_type==SDRATTR_OBJPRINTABLE) |
278 | 279 | state.m_graphic.m_protections[2]=!m_value; |
279 | 4.41k | else if (m_type==SDRATTR_MEASUREBELOWREFEDGE) |
280 | 415 | state.m_graphic.m_propertyList.insert("draw:placing", m_value ? "below" : "above"); |
281 | 4.00k | else if (m_type==SDRATTR_MEASURESHOWUNIT) |
282 | 335 | state.m_graphic.m_propertyList.insert("draw:show-unit", m_value); |
283 | 3.66k | else if (m_type==SDRATTR_GRAFINVERT) |
284 | 272 | state.m_graphic.m_propertyList.insert("draw:color-inversion", m_value); |
285 | | // TODO: XATTR_FILLBMP_SIZELOG |
286 | 27.6k | } |
287 | | |
288 | | void StarGAttributeInt::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const |
289 | 62.9k | { |
290 | 62.9k | if (m_type==XATTR_LINEWIDTH) |
291 | 12.9k | state.m_graphic.m_propertyList.insert("svg:stroke-width", state.convertInPoint(m_value),librevenge::RVNG_POINT); |
292 | 49.9k | else if (m_type==XATTR_LINESTARTWIDTH) |
293 | 5.22k | state.m_graphic.m_propertyList.insert("draw:marker-start-width", state.convertInPoint(m_value),librevenge::RVNG_POINT); |
294 | 44.7k | else if (m_type==XATTR_LINEENDWIDTH) |
295 | 4.75k | state.m_graphic.m_propertyList.insert("draw:marker-end-width", state.convertInPoint(m_value),librevenge::RVNG_POINT); |
296 | 39.9k | else if (m_type==XATTR_FILLBMP_SIZEX) |
297 | 2.86k | state.m_graphic.m_propertyList.insert("draw:fill-image-width", state.convertInPoint(m_value),librevenge::RVNG_POINT); |
298 | 37.0k | else if (m_type==XATTR_FILLBMP_SIZEY) |
299 | 2.91k | state.m_graphic.m_propertyList.insert("draw:fill-image-height", state.convertInPoint(m_value),librevenge::RVNG_POINT); |
300 | 34.1k | else if (m_type==SDRATTR_SHADOWXDIST) |
301 | 5.48k | state.m_graphic.m_propertyList.insert("draw:shadow-offset-x", state.convertInPoint(m_value), librevenge::RVNG_POINT); |
302 | 28.6k | else if (m_type==SDRATTR_SHADOWYDIST) |
303 | 5.89k | state.m_graphic.m_propertyList.insert("draw:shadow-offset-y", state.convertInPoint(m_value), librevenge::RVNG_POINT); |
304 | 22.7k | else if (m_type==SDRATTR_TEXT_MAXFRAMEHEIGHT) |
305 | 678 | state.m_graphic.m_propertyList.insert("fo:max-height", state.convertInPoint(m_value), librevenge::RVNG_POINT); |
306 | 22.1k | else if (m_type==SDRATTR_TEXT_MINFRAMEHEIGHT) // checkme |
307 | 2.85k | state.m_graphic.m_propertyList.insert("fo:min-height", state.convertInPoint(m_value), librevenge::RVNG_POINT); |
308 | 19.2k | else if (m_type==SDRATTR_TEXT_MAXFRAMEWIDTH) |
309 | 575 | state.m_graphic.m_propertyList.insert("fo:max-width", state.convertInPoint(m_value), librevenge::RVNG_POINT); |
310 | 18.6k | else if (m_type==SDRATTR_TEXT_MINFRAMEWIDTH) // checkme |
311 | 389 | state.m_graphic.m_propertyList.insert("fo:min-width", state.convertInPoint(m_value), librevenge::RVNG_POINT); |
312 | 18.2k | else if (m_type==SDRATTR_CIRCSTARTANGLE) |
313 | 480 | state.m_graphic.m_propertyList.insert("draw:start-angle", double(m_value)/100., librevenge::RVNG_GENERIC); |
314 | 17.8k | else if (m_type==SDRATTR_CIRCENDANGLE) |
315 | 1.09k | state.m_graphic.m_propertyList.insert("draw:end-angle", double(m_value)/100., librevenge::RVNG_GENERIC); |
316 | 16.7k | else if (m_type==SDRATTR_MEASURELINEDIST) |
317 | 390 | state.m_graphic.m_propertyList.insert("draw:line-distance", state.convertInPoint(m_value), librevenge::RVNG_POINT); |
318 | 16.3k | else if (m_type==SDRATTR_MEASUREOVERHANG) |
319 | 298 | state.m_graphic.m_propertyList.insert("draw:guide-overhang", state.convertInPoint(m_value), librevenge::RVNG_POINT); |
320 | 16.0k | else if (m_type==SDRATTR_GRAFRED) |
321 | 204 | state.m_graphic.m_propertyList.insert("draw:red", double(m_value)/100., librevenge::RVNG_PERCENT); |
322 | 15.8k | else if (m_type==SDRATTR_GRAFGREEN) |
323 | 192 | state.m_graphic.m_propertyList.insert("draw:green", double(m_value)/100., librevenge::RVNG_PERCENT); |
324 | 15.6k | else if (m_type==SDRATTR_GRAFBLUE) |
325 | 383 | state.m_graphic.m_propertyList.insert("draw:blue", double(m_value)/100., librevenge::RVNG_PERCENT); |
326 | 15.2k | else if (m_type==SDRATTR_GRAFLUMINANCE) |
327 | 247 | state.m_graphic.m_propertyList.insert("draw:luminance", double(m_value)/100., librevenge::RVNG_PERCENT); |
328 | 15.0k | else if (m_type==SDRATTR_GRAFCONTRAST) |
329 | 307 | state.m_graphic.m_propertyList.insert("draw:contrast", double(m_value)/100., librevenge::RVNG_PERCENT); |
330 | 14.6k | else if (m_type==SDRATTR_ECKENRADIUS) |
331 | 604 | state.m_graphic.m_propertyList.insert("draw:corner-radius", state.convertInPoint(m_value),librevenge::RVNG_POINT); |
332 | 62.9k | } |
333 | | |
334 | | void StarGAttributeUInt::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const |
335 | 105k | { |
336 | 105k | if (m_type==XATTR_LINESTYLE) { |
337 | 20.7k | if (m_value<=2) { |
338 | 19.8k | char const *wh[]= {"none", "solid", "dash"}; |
339 | 19.8k | state.m_graphic.m_propertyList.insert("draw:stroke", wh[m_value]); |
340 | 19.8k | } |
341 | 965 | else { |
342 | 965 | STOFF_DEBUG_MSG(("StarGAttributeUInt::addTo: unknown line style %d\n", int(m_value))); |
343 | 965 | } |
344 | 20.7k | } |
345 | 84.3k | else if (m_type==XATTR_FILLSTYLE) { |
346 | 19.3k | if (m_value<=4) { |
347 | 18.3k | char const *wh[]= {"none", "solid", "gradient", "hatch", "bitmap"}; |
348 | 18.3k | state.m_graphic.m_propertyList.insert("draw:fill", wh[m_value]); |
349 | 18.3k | } |
350 | 996 | else { |
351 | 996 | STOFF_DEBUG_MSG(("StarGAttributeUInt::addTo: unknown fill style %d\n", int(m_value))); |
352 | 996 | } |
353 | 19.3k | } |
354 | 64.9k | else if (m_type==XATTR_LINETRANSPARENCE) |
355 | 755 | state.m_graphic.m_propertyList.insert("svg:stroke-opacity", 1-double(m_value)/100., librevenge::RVNG_PERCENT); |
356 | 64.1k | else if (m_type==XATTR_FILLTRANSPARENCE) |
357 | 502 | state.m_graphic.m_propertyList.insert("draw:opacity", 1-double(m_value)/100., librevenge::RVNG_PERCENT); |
358 | 63.6k | else if (m_type==XATTR_LINEJOINT) { |
359 | 1.75k | if (m_value<=4) { |
360 | 1.65k | char const *wh[]= {"none", "middle", "bevel", "miter", "round"}; |
361 | 1.65k | state.m_graphic.m_propertyList.insert("draw:stroke-linejoin", wh[m_value]); |
362 | 1.65k | } |
363 | 104 | else { |
364 | 104 | STOFF_DEBUG_MSG(("StarGAttributeUInt::addTo: unknown line join %d\n", int(m_value))); |
365 | 104 | } |
366 | 1.75k | } |
367 | 61.9k | else if (m_type==XATTR_FILLBMP_POS) { |
368 | 362 | if (m_value<9) { |
369 | 318 | char const *wh[]= {"top-left", "top", "top-right", "left", "center", "right", "bottom-left", "bottom", "bottom-right"}; |
370 | 318 | state.m_graphic.m_propertyList.insert("draw:fill-image-ref-point", wh[m_value]); |
371 | 318 | } |
372 | 44 | else { |
373 | 44 | STOFF_DEBUG_MSG(("StarGAttributeUInt::addTo: unknown bmp position %d\n", int(m_value))); |
374 | 44 | } |
375 | 362 | } |
376 | | // CHECKME: from here never seen |
377 | 61.5k | else if (m_type==XATTR_GRADIENTSTEPCOUNT) |
378 | 2.83k | state.m_graphic.m_propertyList.insert("draw:gradient-step-count", m_value, librevenge::RVNG_GENERIC); |
379 | 58.7k | else if (m_type==XATTR_FILLBMP_POSOFFSETX) |
380 | 359 | state.m_graphic.m_propertyList.insert("draw:fill-image-ref-point-x", double(m_value)/100, librevenge::RVNG_PERCENT); |
381 | 58.3k | else if (m_type==XATTR_FILLBMP_POSOFFSETY) |
382 | 389 | state.m_graphic.m_propertyList.insert("draw:fill-image-ref-point-y", double(m_value)/100, librevenge::RVNG_PERCENT); |
383 | 57.9k | else if (m_type==XATTR_FILLBMP_TILEOFFSETX || m_type==XATTR_FILLBMP_TILEOFFSETY) { |
384 | 799 | std::stringstream s; |
385 | 799 | s << m_value << "% " << (m_type==XATTR_FILLBMP_TILEOFFSETX ? "horizontal" : "vertical"); |
386 | 799 | state.m_graphic.m_propertyList.insert("draw:tile-repeat-offset", s.str().c_str()); |
387 | 799 | } |
388 | 57.1k | else if (m_type==SDRATTR_SHADOWTRANSPARENCE) |
389 | 838 | state.m_graphic.m_propertyList.insert("draw:shadow-opacity", 1.0-double(m_value)/255., librevenge::RVNG_PERCENT); |
390 | 56.3k | else if (m_type==SDRATTR_TEXT_LEFTDIST || m_type==SDRATTR_TEXT_RIGHTDIST || |
391 | 56.3k | m_type==SDRATTR_TEXT_UPPERDIST || m_type==SDRATTR_TEXT_LOWERDIST) { |
392 | 0 | char const *wh[] = {"left", "right", "top", "bottom"}; |
393 | 0 | state.m_graphic.m_propertyList.insert((std::string("padding-")+wh[(m_type-SDRATTR_TEXT_LEFTDIST)]).c_str(), state.convertInPoint(m_value), librevenge::RVNG_POINT); |
394 | 0 | } |
395 | 56.3k | else if (m_type==SDRATTR_TEXT_FITTOSIZE) |
396 | | // TODO: 0: none, 1: proportional, allline, autofit |
397 | 457 | state.m_graphic.m_propertyList.insert("draw:fit-to-size", m_value!=0); |
398 | 55.8k | else if (m_type==SDRATTR_TEXT_HORZADJUST) { |
399 | 21.9k | if (m_value<4) { |
400 | 21.4k | char const *wh[]= {"left", "center", "right", "justify"}; |
401 | 21.4k | state.m_graphic.m_propertyList.insert("draw:textarea-horizontal-align", wh[m_value]); |
402 | 21.4k | } |
403 | 463 | else { |
404 | 463 | STOFF_DEBUG_MSG(("StarGAttributeUInt::addTo: unknown text horizontal position %d\n", int(m_value))); |
405 | 463 | } |
406 | 21.9k | } |
407 | 33.9k | else if (m_type==SDRATTR_TEXT_VERTADJUST) { |
408 | 25.8k | if (m_value<4) { |
409 | 25.0k | char const *wh[]= {"top", "middle", "bottom", "justify"}; |
410 | 25.0k | state.m_graphic.m_propertyList.insert("draw:textarea-vertical-align", wh[m_value]); |
411 | 25.0k | } |
412 | 821 | else { |
413 | 821 | STOFF_DEBUG_MSG(("StarGAttributeUInt::addTo: unknown text vertical position %d\n", int(m_value))); |
414 | 821 | } |
415 | 25.8k | } |
416 | 8.05k | else if (m_type==SDRATTR_TEXT_ANIAMOUNT) // unsure |
417 | 0 | state.m_graphic.m_propertyList.insert("text:animation-steps", double(m_value)/100., librevenge::RVNG_PERCENT); |
418 | 8.05k | else if (m_type==SDRATTR_TEXT_ANICOUNT) |
419 | 892 | state.m_graphic.m_propertyList.insert("text:animation-repeat", int(m_value)); |
420 | 7.15k | else if (m_type==SDRATTR_TEXT_ANIDELAY) { // check unit |
421 | 581 | librevenge::RVNGString delay; |
422 | 581 | delay.sprintf("PT%fS", double(m_value)); |
423 | 581 | state.m_graphic.m_propertyList.insert("text:animation-delay", delay); |
424 | 581 | } |
425 | 6.57k | else if (m_type==SDRATTR_TEXT_ANIDIRECTION) { |
426 | 1.72k | if (m_value<4) { |
427 | 1.61k | char const *wh[]= {"left", "right", "up", "down"}; |
428 | 1.61k | state.m_graphic.m_propertyList.insert("text:animation-direction", wh[m_value]); |
429 | 1.61k | } |
430 | 117 | else { |
431 | 117 | STOFF_DEBUG_MSG(("StarGAttributeUInt::addTo: unknown animation direction %d\n", int(m_value))); |
432 | 117 | } |
433 | 1.72k | } |
434 | 4.85k | else if (m_type==SDRATTR_TEXT_ANIKIND) { |
435 | 646 | if (m_value<5) { |
436 | 564 | char const *wh[]= {"none", "none" /*blink*/, "scroll", "alternate", "slide"}; |
437 | 564 | state.m_graphic.m_propertyList.insert("text:animation", wh[m_value]); |
438 | 564 | if (m_value) { |
439 | 128 | if (!state.m_graphic.m_propertyList["text:animation-direction"]) |
440 | 79 | state.m_graphic.m_propertyList.insert("text:animation-direction", "left"); |
441 | 128 | if (!state.m_graphic.m_propertyList["text:animation-steps"]) |
442 | 79 | state.m_graphic.m_propertyList.insert("text:animation-steps", 0.02, librevenge::RVNG_PERCENT); |
443 | 128 | } |
444 | 564 | } |
445 | 82 | else { |
446 | 82 | STOFF_DEBUG_MSG(("StarGAttributeUInt::addTo: unknown animation direction %d\n", int(m_value))); |
447 | 82 | } |
448 | 646 | } |
449 | 4.20k | else if (m_type==SDRATTR_CIRCKIND) { |
450 | 671 | if (m_value<4) { |
451 | 544 | char const *wh[]= {"full", "section", "cut", "arc"}; |
452 | 544 | state.m_graphic.m_propertyList.insert("draw:kind", wh[m_value]); |
453 | 544 | } |
454 | 127 | else { |
455 | 127 | STOFF_DEBUG_MSG(("StarGAttributeUInt::addTo: unknown circle kind %d\n", int(m_value))); |
456 | 127 | } |
457 | 671 | } |
458 | 3.53k | else if (m_type==SDRATTR_GRAFGAMMA) |
459 | 316 | state.m_graphic.m_propertyList.insert("draw:gamma", double(m_value)/100., librevenge::RVNG_PERCENT); |
460 | 3.21k | else if (m_type==SDRATTR_GRAFTRANSPARENCE) |
461 | 300 | state.m_graphic.m_propertyList.insert("draw:opacity", 1.0-double(m_value)/100., librevenge::RVNG_PERCENT); |
462 | 2.91k | else if (m_type==SDRATTR_GRAFMODE) { |
463 | 441 | if (m_value<4) { |
464 | 364 | char const *wh[]= {"standard", "greyscale", "mono", "watermark"}; |
465 | 364 | state.m_graphic.m_propertyList.insert("draw:color-mode", wh[m_value]); |
466 | 364 | } |
467 | 77 | else { |
468 | 77 | STOFF_DEBUG_MSG(("StarGAttributeUInt::addTo: unknown graf color mode %d\n", int(m_value))); |
469 | 77 | } |
470 | 441 | } |
471 | 105k | } |
472 | | |
473 | | void StarGAttributeVoid::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const |
474 | 14.4k | { |
475 | 14.4k | if (m_type==StarAttribute::SDRATTR_SHADOW3D) |
476 | 822 | state.m_graphic.m_propertyList.insert("dr3d:shadow", "visible"); |
477 | | // also SDRATTR_SHADOWPERSP, ok to ignore ? |
478 | 14.4k | } |
479 | | |
480 | | //! add a bool attribute |
481 | | inline void addAttributeBool(std::map<int, std::shared_ptr<StarAttribute> > &map, StarAttribute::Type type, std::string const &debugName, bool defValue) |
482 | 4.44M | { |
483 | 4.44M | map[type]=std::shared_ptr<StarAttribute>(new StarGAttributeBool(type,debugName, defValue)); |
484 | 4.44M | } |
485 | | //! add a color attribute |
486 | | inline void addAttributeColor(std::map<int, std::shared_ptr<StarAttribute> > &map, StarAttribute::Type type, std::string const &debugName, STOFFColor const &defValue) |
487 | 0 | { |
488 | 0 | map[type]=std::shared_ptr<StarAttribute>(new StarGAttributeColor(type,debugName, defValue)); |
489 | 0 | } |
490 | | //! add a fraction attribute |
491 | | inline void addAttributeFraction(std::map<int, std::shared_ptr<StarAttribute> > &map, StarAttribute::Type type, std::string const &debugName) |
492 | 889k | { |
493 | 889k | map[type]=std::shared_ptr<StarAttribute>(new StarGAttributeFraction(type,debugName)); |
494 | 889k | } |
495 | | //! add a int attribute |
496 | | inline void addAttributeInt(std::map<int, std::shared_ptr<StarAttribute> > &map, StarAttribute::Type type, std::string const &debugName, int numBytes, int defValue) |
497 | 12.6M | { |
498 | 12.6M | map[type]=std::shared_ptr<StarAttribute>(new StarGAttributeInt(type,debugName, numBytes, defValue)); |
499 | 12.6M | } |
500 | | //! add a unsigned int attribute |
501 | | inline void addAttributeUInt(std::map<int, std::shared_ptr<StarAttribute> > &map, StarAttribute::Type type, std::string const &debugName, int numBytes, unsigned int defValue) |
502 | 5.86M | { |
503 | 5.86M | map[type]=std::shared_ptr<StarAttribute>(new StarGAttributeUInt(type,debugName, numBytes, defValue)); |
504 | 5.86M | } |
505 | | //! add a void attribute |
506 | | inline void addAttributeVoid(std::map<int, std::shared_ptr<StarAttribute> > &map, StarAttribute::Type type, std::string const &debugName) |
507 | 11.7M | { |
508 | 11.7M | map[type]=std::shared_ptr<StarAttribute>(new StarGAttributeVoid(type,debugName)); |
509 | 11.7M | } |
510 | | |
511 | | } |
512 | | |
513 | | namespace StarGraphicAttribute |
514 | | { |
515 | | // ------------------------------------------------------------ |
516 | | |
517 | | //! a box info attribute |
518 | | class StarGAttributeBoxInfo final : public StarAttribute |
519 | | { |
520 | | public: |
521 | | //! constructor |
522 | | StarGAttributeBoxInfo(Type type, std::string const &debugName) |
523 | 177k | : StarAttribute(type, debugName) |
524 | 177k | , m_distance(0) |
525 | 177k | , m_borderList() |
526 | 177k | , m_flags(0) |
527 | 177k | { |
528 | 177k | } |
529 | | //! create a new attribute |
530 | | std::shared_ptr<StarAttribute> create() const final |
531 | 20.3k | { |
532 | 20.3k | return std::shared_ptr<StarAttribute>(new StarGAttributeBoxInfo(*this)); |
533 | 20.3k | } |
534 | | //! read a zone |
535 | | bool read(StarZone &zone, int vers, long endPos, StarObject &object) final; |
536 | | //! debug function to print the data |
537 | | void printData(libstoff::DebugStream &o) const final |
538 | 19.6k | { |
539 | 19.6k | o << m_debugName << "=["; |
540 | 19.6k | if (m_distance) o << "dist=" << m_distance << ","; |
541 | 21.6k | for (size_t i=0; i<m_borderList.size(); ++i) { |
542 | 2.01k | if (!m_borderList[i].isEmpty()) |
543 | 1.09k | o << "border" << i << "=[" << m_borderList[i] << "],"; |
544 | 2.01k | } |
545 | 19.6k | if (m_flags&1) o << "set[table],"; |
546 | 19.6k | if (m_flags&2) o << "set[dist],"; |
547 | 19.6k | if (m_flags&4) o << "set[minDist],"; |
548 | 19.6k | o << "],"; |
549 | 19.6k | } |
550 | | |
551 | | protected: |
552 | | //! copy constructor |
553 | 20.3k | StarGAttributeBoxInfo(StarGAttributeBoxInfo const &) = default; |
554 | | //! the distance |
555 | | int m_distance; |
556 | | //! the boxInfo list: top, left, right, bottom |
557 | | std::vector<STOFFBorderLine> m_borderList; |
558 | | //! some flags: setTable, setDist, setMinDist |
559 | | int m_flags; |
560 | | }; |
561 | | |
562 | | //! a crop attribute |
563 | | class StarGAttributeCrop final : public StarAttribute |
564 | | { |
565 | | public: |
566 | | //! constructor |
567 | | StarGAttributeCrop(Type type, std::string const &debugName) |
568 | 177k | : StarAttribute(type, debugName) |
569 | 177k | , m_leftTop(0,0) |
570 | 177k | , m_rightBottom(0,0) |
571 | 177k | { |
572 | 177k | } |
573 | | //! create a new attribute |
574 | | std::shared_ptr<StarAttribute> create() const final |
575 | 29.9k | { |
576 | 29.9k | return std::shared_ptr<StarAttribute>(new StarGAttributeCrop(*this)); |
577 | 29.9k | } |
578 | | //! read a zone |
579 | | bool read(StarZone &zone, int vers, long endPos, StarObject &object) final; |
580 | | //! add to a graphic style |
581 | | void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final; |
582 | | //! debug function to print the data |
583 | | void printData(libstoff::DebugStream &o) const final |
584 | 29.8k | { |
585 | 29.8k | o << m_debugName << "=[" << m_leftTop << "<->" << m_rightBottom << "],"; |
586 | 29.8k | } |
587 | | |
588 | | protected: |
589 | | //! copy constructor |
590 | 29.9k | StarGAttributeCrop(StarGAttributeCrop const &) = default; |
591 | | //! the cropping left/top |
592 | | STOFFVec2i m_leftTop; |
593 | | //! the cropping right/bottom |
594 | | STOFFVec2i m_rightBottom; |
595 | | }; |
596 | | |
597 | | //! a named attribute |
598 | | class StarGAttributeNamed : public StarAttribute |
599 | | { |
600 | | public: |
601 | | //! constructor |
602 | 1.95M | StarGAttributeNamed(Type type, std::string const &debugName) : StarAttribute(type, debugName), m_named(), m_namedId(0) |
603 | 1.95M | { |
604 | 1.95M | } |
605 | | //! read a zone |
606 | | bool read(StarZone &zone, int vers, long endPos, StarObject &object) override; |
607 | | //! debug function to print the data |
608 | | void printData(libstoff::DebugStream &o) const override |
609 | 190k | { |
610 | 190k | o << m_debugName << "=["; |
611 | 190k | if (!m_named.empty()) |
612 | 36.2k | o << m_named.cstr() << ","; |
613 | 190k | if (m_namedId>=0) |
614 | 91.9k | o << "id=" << m_namedId << ","; |
615 | 190k | o << "]"; |
616 | 190k | } |
617 | | |
618 | | protected: |
619 | | //! copy constructor |
620 | 360k | StarGAttributeNamed(StarGAttributeNamed const &) = default; |
621 | | //! the named |
622 | | librevenge::RVNGString m_named; |
623 | | //! the name id |
624 | | int m_namedId; |
625 | | }; |
626 | | |
627 | | //! a arrow's named attribute |
628 | | class StarGAttributeNamedArrow final : public StarGAttributeNamed |
629 | | { |
630 | | public: |
631 | | //! constructor |
632 | | StarGAttributeNamedArrow(Type type, std::string const &debugName) |
633 | 355k | : StarGAttributeNamed(type, debugName) |
634 | 355k | , m_polygon() |
635 | 355k | { |
636 | 355k | } |
637 | | //! create a new attribute |
638 | | std::shared_ptr<StarAttribute> create() const final |
639 | 47.3k | { |
640 | 47.3k | return std::shared_ptr<StarAttribute>(new StarGAttributeNamedArrow(*this)); |
641 | 47.3k | } |
642 | | //! read a zone |
643 | | bool read(StarZone &zone, int vers, long endPos, StarObject &object) final; |
644 | | //! add to a graphic style |
645 | | void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final; |
646 | | //! debug function to print the data |
647 | | void printData(libstoff::DebugStream &o) const final |
648 | 28.3k | { |
649 | 28.3k | StarGAttributeNamed::printData(o); |
650 | 28.3k | o << ":[" << m_polygon << "],"; |
651 | 28.3k | } |
652 | | |
653 | | protected: |
654 | | //! copy constructor |
655 | 47.3k | StarGAttributeNamedArrow(StarGAttributeNamedArrow const &) = default; |
656 | | //! the polygon |
657 | | StarGraphicStruct::StarPolygon m_polygon; |
658 | | }; |
659 | | |
660 | | //! a bitmap's named attribute |
661 | | class StarGAttributeNamedBitmap final : public StarGAttributeNamed |
662 | | { |
663 | | public: |
664 | | //! constructor |
665 | | StarGAttributeNamedBitmap(Type type, std::string const &debugName) |
666 | 177k | : StarGAttributeNamed(type, debugName) |
667 | 177k | , m_bitmap() |
668 | 177k | { |
669 | 177k | } |
670 | | //! create a new attribute |
671 | | std::shared_ptr<StarAttribute> create() const final |
672 | 25.1k | { |
673 | 25.1k | return std::shared_ptr<StarAttribute>(new StarGAttributeNamedBitmap(*this)); |
674 | 25.1k | } |
675 | | //! read a zone |
676 | | bool read(StarZone &zone, int vers, long endPos, StarObject &object) final; |
677 | | //! add to a graphic style |
678 | | void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final; |
679 | | //! debug function to print the data |
680 | | void printData(libstoff::DebugStream &o) const final |
681 | 15.8k | { |
682 | 15.8k | StarGAttributeNamed::printData(o); |
683 | 15.8k | if (m_bitmap.isEmpty()) o << "empty"; |
684 | 15.8k | o << ","; |
685 | 15.8k | } |
686 | | |
687 | | protected: |
688 | | //! copy constructor |
689 | 25.1k | StarGAttributeNamedBitmap(StarGAttributeNamedBitmap const &) = default; |
690 | | //! the bitmap |
691 | | STOFFEmbeddedObject m_bitmap; |
692 | | }; |
693 | | |
694 | | //! a color's named attribute |
695 | | class StarGAttributeNamedColor final : public StarGAttributeNamed |
696 | | { |
697 | | public: |
698 | | //! constructor |
699 | | StarGAttributeNamedColor(Type type, std::string const &debugName, STOFFColor const &defColor) |
700 | 711k | : StarGAttributeNamed(type, debugName) |
701 | 711k | , m_color(defColor) |
702 | 711k | { |
703 | 711k | } |
704 | | //! create a new attribute |
705 | | std::shared_ptr<StarAttribute> create() const final |
706 | 128k | { |
707 | 128k | return std::shared_ptr<StarAttribute>(new StarGAttributeNamedColor(*this)); |
708 | 128k | } |
709 | | //! read a zone |
710 | | bool read(StarZone &zone, int vers, long endPos, StarObject &object) final; |
711 | | //! add to a font/graphic style |
712 | | void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final; |
713 | | //! debug function to print the data |
714 | | void printData(libstoff::DebugStream &o) const final |
715 | 73.9k | { |
716 | 73.9k | StarGAttributeNamed::printData(o); |
717 | 73.9k | o << ":[" << m_color << "],"; |
718 | 73.9k | } |
719 | | |
720 | | protected: |
721 | | //! copy constructor |
722 | 128k | StarGAttributeNamedColor(StarGAttributeNamedColor const &) = default; |
723 | | //! the color |
724 | | STOFFColor m_color; |
725 | | }; |
726 | | |
727 | | //! a dash's named attribute |
728 | | class StarGAttributeNamedDash final : public StarGAttributeNamed |
729 | | { |
730 | | public: |
731 | | //! constructor |
732 | | StarGAttributeNamedDash(Type type, std::string const &debugName) |
733 | 177k | : StarGAttributeNamed(type, debugName) |
734 | 177k | , m_dashStyle(0) |
735 | 177k | , m_distance(20) |
736 | 177k | { |
737 | 355k | for (int &number : m_numbers) number=1; |
738 | 355k | for (int &length : m_lengths) length=20; |
739 | 177k | } |
740 | | //! create a new attribute |
741 | | std::shared_ptr<StarAttribute> create() const final |
742 | 16.6k | { |
743 | 16.6k | return std::shared_ptr<StarAttribute>(new StarGAttributeNamedDash(*this)); |
744 | 16.6k | } |
745 | | //! read a zone |
746 | | bool read(StarZone &zone, int vers, long endPos, StarObject &object) final; |
747 | | //! add to a graphic style |
748 | | void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final; |
749 | | //! debug function to print the data |
750 | | void printData(libstoff::DebugStream &o) const final |
751 | 11.7k | { |
752 | 11.7k | StarGAttributeNamed::printData(o); |
753 | 11.7k | o << ":["; |
754 | 11.7k | o << "style=" << m_dashStyle << ","; |
755 | 35.2k | for (int i=0; i<2; ++i) { |
756 | 23.4k | if (m_numbers[i]) |
757 | 21.9k | o << (i==0 ? "dots" : "dashes") << "=" << m_numbers[i] << ":" << m_lengths[i] << ","; |
758 | 23.4k | } |
759 | 11.7k | if (m_distance) o << "distance=" << m_distance << ","; |
760 | 11.7k | o << "],"; |
761 | 11.7k | } |
762 | | |
763 | | protected: |
764 | | //! copy constructor |
765 | 16.6k | StarGAttributeNamedDash(StarGAttributeNamedDash const &) = default; |
766 | | //! the style: XDASH_RECT, XDASH_ROUND, XDASH_RECTRELATIVE, XDASH_ROUNDRELATIVE |
767 | | int m_dashStyle; |
768 | | //! the number of dot/dash |
769 | | int m_numbers[2]; |
770 | | //! the lengths of dot/dash |
771 | | int m_lengths[2]; |
772 | | //! the distance |
773 | | int m_distance; |
774 | | }; |
775 | | |
776 | | //! a gradient's named attribute |
777 | | class StarGAttributeNamedGradient final : public StarGAttributeNamed |
778 | | { |
779 | | public: |
780 | | //! constructor |
781 | | StarGAttributeNamedGradient(Type type, std::string const &debugName) |
782 | 355k | : StarGAttributeNamed(type, debugName) |
783 | 355k | , m_gradientType(0) |
784 | 355k | , m_enable(true) |
785 | 355k | , m_angle(0) |
786 | 355k | , m_border(0) |
787 | 355k | , m_step(0) |
788 | 355k | { |
789 | 1.06M | for (int i=0; i<2; ++i) { |
790 | 711k | m_offsets[i]=50; |
791 | 711k | m_intensities[i]=100; |
792 | 711k | } |
793 | 355k | } |
794 | | //! create a new attribute |
795 | | std::shared_ptr<StarAttribute> create() const final |
796 | 99.2k | { |
797 | 99.2k | return std::shared_ptr<StarAttribute>(new StarGAttributeNamedGradient(*this)); |
798 | 99.2k | } |
799 | | //! read a zone |
800 | | bool read(StarZone &zone, int vers, long endPos, StarObject &object) final; |
801 | | //! add to a graphic style |
802 | | void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final; |
803 | | //! debug function to print the data |
804 | | void printData(libstoff::DebugStream &o) const final |
805 | 39.7k | { |
806 | 39.7k | StarGAttributeNamed::printData(o); |
807 | 39.7k | o << ":["; |
808 | 39.7k | o << "type=" << m_gradientType << ","; |
809 | 39.7k | if (m_angle) o << "angle=" << m_angle << ","; |
810 | 39.7k | if (m_border) o << "border=" << m_border << ","; |
811 | 39.7k | if (m_step) o << "step=" << m_step << ","; |
812 | 39.7k | o << m_colors[0] << "->" << m_colors[1] << ","; |
813 | 39.7k | o << "offset=" << m_offsets[0] << "->" << m_offsets[1] << ","; |
814 | 39.7k | o << "intensity=" << m_intensities[0] << "->" << m_intensities[1] << ","; |
815 | 39.7k | if (!m_enable) o << "disable,"; |
816 | 39.7k | o << "],"; |
817 | 39.7k | } |
818 | | |
819 | | protected: |
820 | | //! copy constructor |
821 | 99.2k | StarGAttributeNamedGradient(StarGAttributeNamedGradient const &) = default; |
822 | | //! the gradient type |
823 | | int m_gradientType; |
824 | | //! a flag to know if the gradient is enable |
825 | | bool m_enable; |
826 | | //! the angle |
827 | | int m_angle; |
828 | | //! the border |
829 | | int m_border; |
830 | | //! the step |
831 | | int m_step; |
832 | | //! the colors |
833 | | STOFFColor m_colors[2]; |
834 | | //! the x offsets |
835 | | int m_offsets[2]; |
836 | | //! the intensities |
837 | | int m_intensities[2]; |
838 | | }; |
839 | | |
840 | | //! a hatch's named attribute |
841 | | class StarGAttributeNamedHatch final : public StarGAttributeNamed |
842 | | { |
843 | | public: |
844 | | //! constructor |
845 | | StarGAttributeNamedHatch(Type type, std::string const &debugName) |
846 | 177k | : StarGAttributeNamed(type, debugName) |
847 | 177k | , m_hatchType(0) |
848 | 177k | , m_color(STOFFColor::black()) |
849 | 177k | , m_distance(0) |
850 | 177k | , m_angle(0) |
851 | 177k | { |
852 | 177k | } |
853 | | //! create a new attribute |
854 | | std::shared_ptr<StarAttribute> create() const final |
855 | 44.1k | { |
856 | 44.1k | return std::shared_ptr<StarAttribute>(new StarGAttributeNamedHatch(*this)); |
857 | 44.1k | } |
858 | | //! read a zone |
859 | | bool read(StarZone &zone, int vers, long endPos, StarObject &object) final; |
860 | | //! add to a graphic style |
861 | | void addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const final; |
862 | | //! debug function to print the data |
863 | | void printData(libstoff::DebugStream &o) const final |
864 | 20.3k | { |
865 | 20.3k | StarGAttributeNamed::printData(o); |
866 | 20.3k | o << ":["; |
867 | 20.3k | o << "type=" << m_hatchType << ","; |
868 | 20.3k | o << m_color << ","; |
869 | 20.3k | if (m_distance) o << "distance=" << m_distance << ","; |
870 | 20.3k | if (m_angle) o << "angle=" << m_angle << ","; |
871 | 20.3k | } |
872 | | |
873 | | protected: |
874 | | //! copy constructor |
875 | 44.1k | StarGAttributeNamedHatch(StarGAttributeNamedHatch const &) = default; |
876 | | //! the type |
877 | | int m_hatchType; |
878 | | //! the color |
879 | | STOFFColor m_color; |
880 | | //! the distance |
881 | | int m_distance; |
882 | | //! the angle |
883 | | int m_angle; |
884 | | }; |
885 | | |
886 | | void StarGAttributeCrop::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const |
887 | 284 | { |
888 | 284 | if (m_type==SDRATTR_GRAFCROP) { |
889 | 284 | if (m_leftTop==STOFFVec2i(0,0) && m_rightBottom==STOFFVec2i(0,0)) |
890 | 200 | state.m_graphic.m_propertyList.insert("fo:clip", "auto"); |
891 | 84 | else { |
892 | 84 | librevenge::RVNGString clip; |
893 | 84 | clip.sprintf("rect(%fpt,%ftt,%fpt,%fpt)", state.convertInPoint(m_leftTop[1]), state.convertInPoint(m_rightBottom[0]), |
894 | 84 | state.convertInPoint(m_rightBottom[1]), state.convertInPoint(m_leftTop[0])); |
895 | 84 | state.m_graphic.m_propertyList.insert("fo:clip", clip); |
896 | 84 | } |
897 | 284 | } |
898 | 284 | } |
899 | | |
900 | | void StarGAttributeNamedArrow::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const |
901 | 10.8k | { |
902 | 10.8k | if (m_type==XATTR_LINESTART || m_type==XATTR_LINEEND) { |
903 | 10.8k | char const *pathName=m_type==XATTR_LINESTART ? "draw:marker-start-path" : "draw:marker-end-path"; |
904 | 10.8k | char const *viewboxName=m_type==XATTR_LINESTART ? "draw:marker-start-viewbox" : "draw:marker-end-viewbox"; |
905 | 10.8k | if (m_polygon.empty()) { |
906 | 8.98k | if (state.m_graphic.m_propertyList[pathName]) state.m_graphic.m_propertyList.remove(pathName); |
907 | 8.98k | if (state.m_graphic.m_propertyList[viewboxName]) state.m_graphic.m_propertyList.remove(viewboxName); |
908 | 8.98k | } |
909 | 1.86k | else { |
910 | 1.86k | librevenge::RVNGString path, viewbox; |
911 | 1.86k | if (m_polygon.convert(path, viewbox, state.m_global->m_relativeUnit, STOFFVec2f(0,0))) { |
912 | 1.86k | state.m_graphic.m_propertyList.insert(pathName, path); |
913 | 1.86k | state.m_graphic.m_propertyList.insert(viewboxName, viewbox); |
914 | 1.86k | } |
915 | 1.86k | } |
916 | 10.8k | } |
917 | 10.8k | } |
918 | | |
919 | | void StarGAttributeNamedBitmap::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const |
920 | 3.80k | { |
921 | 3.80k | if (m_type==XATTR_FILLBITMAP) { |
922 | 3.80k | if (!m_bitmap.isEmpty()) |
923 | 918 | m_bitmap.addAsFillImageTo(state.m_graphic.m_propertyList); |
924 | 2.88k | else { |
925 | 2.88k | STOFF_DEBUG_MSG(("StarGAttributeNamedBitmap::addTo: can not find the bitmap\n")); |
926 | 2.88k | } |
927 | 3.80k | } |
928 | 3.80k | } |
929 | | |
930 | | void StarGAttributeNamedColor::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const |
931 | 31.2k | { |
932 | 31.2k | if (m_type==XATTR_LINECOLOR) |
933 | 12.8k | state.m_graphic.m_propertyList.insert("svg:stroke-color", m_color.str().c_str()); |
934 | 18.3k | else if (m_type==XATTR_FILLCOLOR) |
935 | 12.8k | state.m_graphic.m_propertyList.insert("draw:fill-color", m_color.str().c_str()); |
936 | 5.49k | else if (m_type==SDRATTR_SHADOWCOLOR) { |
937 | 5.08k | state.m_graphic.m_propertyList.insert("draw:shadow-color", m_color.str().c_str()); |
938 | 5.08k | state.m_font.m_shadowColor=m_color; |
939 | 5.08k | } |
940 | 31.2k | } |
941 | | |
942 | | void StarGAttributeNamedDash::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const |
943 | 4.95k | { |
944 | 4.95k | if (m_type==XATTR_LINEDASH) { |
945 | 4.95k | state.m_graphic.m_propertyList.insert("draw:dots1", m_numbers[0]); |
946 | 4.95k | state.m_graphic.m_propertyList.insert("draw:dots1-length", state.convertInPoint(m_lengths[0]), librevenge::RVNG_POINT); |
947 | 4.95k | state.m_graphic.m_propertyList.insert("draw:dots2", m_numbers[1]); |
948 | 4.95k | state.m_graphic.m_propertyList.insert("draw:dots2-length", state.convertInPoint(m_lengths[1]), librevenge::RVNG_POINT); |
949 | 4.95k | state.m_graphic.m_propertyList.insert("draw:distance", state.convertInPoint(m_distance), librevenge::RVNG_POINT); |
950 | 4.95k | } |
951 | 4.95k | } |
952 | | |
953 | | void StarGAttributeNamedGradient::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const |
954 | 8.08k | { |
955 | 8.08k | if (m_type==XATTR_FILLGRADIENT) { |
956 | | // TODO XATTR_FILLFLOATTRANSPARENCE |
957 | 7.65k | if (!m_enable) |
958 | 0 | return; |
959 | 7.65k | if (m_gradientType>=0 && m_gradientType<=5) { |
960 | 7.19k | char const *wh[]= {"linear", "axial", "radial", "ellipsoid", "square", "rectangle"}; |
961 | 7.19k | state.m_graphic.m_propertyList.insert("draw:style", wh[m_gradientType]); |
962 | 7.19k | } |
963 | 469 | else { |
964 | 469 | STOFF_DEBUG_MSG(("StarGAttributeNamedGradient::addTo: unknown hash type %d\n", m_gradientType)); |
965 | 469 | } |
966 | 7.65k | state.m_graphic.m_propertyList.insert("draw:angle", double(m_angle)/10, librevenge::RVNG_GENERIC); |
967 | 7.65k | state.m_graphic.m_propertyList.insert("draw:border", double(m_border)/100, librevenge::RVNG_PERCENT); |
968 | 7.65k | state.m_graphic.m_propertyList.insert("draw:start-color", m_colors[0].str().c_str()); |
969 | 7.65k | state.m_graphic.m_propertyList.insert("librevenge:start-opacity", double(m_intensities[0])/100, librevenge::RVNG_PERCENT); |
970 | 7.65k | state.m_graphic.m_propertyList.insert("draw:end-color", m_colors[1].str().c_str()); |
971 | 7.65k | state.m_graphic.m_propertyList.insert("librevenge:end-opacity", double(m_intensities[1])/100, librevenge::RVNG_PERCENT); |
972 | 7.65k | state.m_graphic.m_propertyList.insert("svg:cx", double(m_offsets[0])/100, librevenge::RVNG_PERCENT); |
973 | 7.65k | state.m_graphic.m_propertyList.insert("svg:cy", double(m_offsets[1])/100, librevenge::RVNG_PERCENT); |
974 | | // m_step ? |
975 | 7.65k | } |
976 | 8.08k | } |
977 | | |
978 | | void StarGAttributeNamedHatch::addTo(StarState &state, std::set<StarAttribute const *> &/*done*/) const |
979 | 3.83k | { |
980 | 3.83k | if (m_type==XATTR_FILLHATCH && m_distance>0) { |
981 | 1.59k | if (m_hatchType>=0 && m_hatchType<3) { |
982 | 1.43k | char const *wh[]= {"single", "double", "triple"}; |
983 | 1.43k | state.m_graphic.m_propertyList.insert("draw:style", wh[m_hatchType]); |
984 | 1.43k | } |
985 | 161 | else { |
986 | 161 | STOFF_DEBUG_MSG(("StarGraphicAttribute::StarGAttributeNamedHatch::addTo: unknown hash type %d\n", m_hatchType)); |
987 | 161 | } |
988 | 1.59k | state.m_graphic.m_propertyList.insert("draw:color", m_color.str().c_str()); |
989 | 1.59k | state.m_graphic.m_propertyList.insert("draw:distance", state.convertInPoint(m_distance),librevenge::RVNG_POINT); |
990 | 1.59k | if (m_angle) state.m_graphic.m_propertyList.insert("draw:rotation", double(m_angle)/10, librevenge::RVNG_GENERIC); |
991 | 1.59k | } |
992 | 3.83k | } |
993 | | |
994 | | bool StarGAttributeBoxInfo::read(StarZone &zone, int /*nVers*/, long endPos, StarObject &/*object*/) |
995 | 19.6k | { |
996 | | // frmitem.cxx SvxBoxInfoItem::Create |
997 | 19.6k | STOFFInputStreamPtr input=zone.input(); |
998 | 19.6k | long pos=input->tell(); |
999 | 19.6k | libstoff::DebugFile &ascFile=zone.ascii(); |
1000 | 19.6k | libstoff::DebugStream f; |
1001 | 19.6k | f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:"; |
1002 | 19.6k | m_flags=int(input->readULong(1)); |
1003 | 19.6k | m_distance=int(input->readULong(2)); |
1004 | 19.6k | bool ok=true; |
1005 | 21.6k | while (input->tell()<endPos) { |
1006 | 6.37k | auto cLine=int(input->readULong(1)); |
1007 | 6.37k | if (cLine>1) break; |
1008 | 2.62k | STOFFBorderLine border; |
1009 | 2.62k | if (!input->readColor(border.m_color)) { |
1010 | 609 | STOFF_DEBUG_MSG(("StarGraphicAttribute::StarGAttributeBoxInfo::read: can not find a box's color\n")); |
1011 | 609 | f << "###color,"; |
1012 | 609 | ok=false; |
1013 | 609 | break; |
1014 | 609 | } |
1015 | 2.01k | border.m_outWidth=int(input->readULong(2)); |
1016 | 2.01k | border.m_inWidth=int(input->readULong(2)); |
1017 | 2.01k | border.m_distance=int(input->readULong(2)); |
1018 | 2.01k | m_borderList.push_back(border); |
1019 | 2.01k | } |
1020 | 19.6k | printData(f); |
1021 | 19.6k | ascFile.addPos(pos); |
1022 | 19.6k | ascFile.addNote(f.str().c_str()); |
1023 | 19.6k | return ok && input->tell()<=endPos; |
1024 | 19.6k | } |
1025 | | |
1026 | | bool StarGAttributeCrop::read(StarZone &zone, int vers, long endPos, StarObject &/*object*/) |
1027 | 29.8k | { |
1028 | 29.8k | STOFFInputStreamPtr input=zone.input(); |
1029 | 29.8k | long pos=input->tell(); |
1030 | 29.8k | libstoff::DebugFile &ascFile=zone.ascii(); |
1031 | 29.8k | libstoff::DebugStream f; |
1032 | 29.8k | f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:" << m_debugName; |
1033 | 29.8k | if (vers!=0) { |
1034 | 28.4k | int dim[4]; // TLRB |
1035 | 113k | for (int &i : dim) i=int(input->readLong(4)); |
1036 | 28.4k | m_leftTop=STOFFVec2i(dim[1],dim[0]); |
1037 | 28.4k | m_rightBottom=STOFFVec2i(dim[2],dim[3]); |
1038 | 28.4k | } |
1039 | 29.8k | printData(f); |
1040 | 29.8k | ascFile.addPos(pos); |
1041 | 29.8k | ascFile.addNote(f.str().c_str()); |
1042 | 29.8k | return pos+8<=endPos; |
1043 | 29.8k | } |
1044 | | |
1045 | | bool StarGAttributeNamed::read(StarZone &zone, int /*nVers*/, long endPos, StarObject &/*object*/) |
1046 | 348k | { |
1047 | 348k | STOFFInputStreamPtr input=zone.input(); |
1048 | 348k | std::vector<uint32_t> text; |
1049 | 348k | if (!zone.readString(text)) { |
1050 | 52.9k | STOFF_DEBUG_MSG(("StarGAttributeNamed::read: can not read a string\n")); |
1051 | 52.9k | return false; |
1052 | 52.9k | } |
1053 | 295k | m_named=libstoff::getString(text); |
1054 | 295k | m_namedId=int(input->readLong(4)); |
1055 | 295k | return input->tell()<=endPos; |
1056 | 348k | } |
1057 | | |
1058 | | bool StarGAttributeNamedArrow::read(StarZone &zone, int nVers, long endPos, StarObject &object) |
1059 | 44.7k | { |
1060 | 44.7k | STOFFInputStreamPtr input=zone.input(); |
1061 | 44.7k | long pos=input->tell(); |
1062 | 44.7k | libstoff::DebugFile &ascFile=zone.ascii(); |
1063 | 44.7k | libstoff::DebugStream f; |
1064 | 44.7k | f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:"; |
1065 | 44.7k | if (!StarGAttributeNamed::read(zone, nVers, endPos, object)) { |
1066 | 16.3k | STOFF_DEBUG_MSG(("StarGAttributeArrowNamed::read: can not read header\n")); |
1067 | 16.3k | f << "###header"; |
1068 | 16.3k | ascFile.addPos(pos); |
1069 | 16.3k | ascFile.addNote(f.str().c_str()); |
1070 | 16.3k | return false; |
1071 | 16.3k | } |
1072 | 28.3k | bool ok=true; |
1073 | 28.3k | if (m_namedId<0) { |
1074 | 16.3k | uint32_t nPoints; |
1075 | 16.3k | *input >> nPoints; |
1076 | 16.3k | if (uint32_t(endPos-input->tell())/12<nPoints || input->tell()+12*long(nPoints)>endPos) { |
1077 | 2.84k | STOFF_DEBUG_MSG(("StarGAttributeArrowNamed::read: bad num point\n")); |
1078 | 2.84k | f << "###nPoints=" << nPoints << ","; |
1079 | 2.84k | ok=false; |
1080 | 2.84k | nPoints=0; |
1081 | 2.84k | } |
1082 | 16.3k | f << "pts=["; |
1083 | 16.3k | m_polygon.m_points.resize(size_t(nPoints)); |
1084 | 121k | for (size_t i=0; i<size_t(nPoints); ++i) { |
1085 | 105k | int dim[2]; |
1086 | 210k | for (int &j : dim) j=int(input->readLong(4)); |
1087 | 105k | m_polygon.m_points[i].m_point=STOFFVec2i(dim[0],dim[1]); |
1088 | 105k | m_polygon.m_points[i].m_flags=int(input->readULong(4)); |
1089 | 105k | } |
1090 | 16.3k | f << "],"; |
1091 | 16.3k | } |
1092 | 28.3k | printData(f); |
1093 | 28.3k | ascFile.addPos(pos); |
1094 | 28.3k | ascFile.addNote(f.str().c_str()); |
1095 | 28.3k | return ok && input->tell()<=endPos; |
1096 | 44.7k | } |
1097 | | |
1098 | | bool StarGAttributeNamedBitmap::read(StarZone &zone, int nVers, long endPos, StarObject &object) |
1099 | 23.9k | { |
1100 | 23.9k | STOFFInputStreamPtr input=zone.input(); |
1101 | 23.9k | long pos=input->tell(); |
1102 | 23.9k | libstoff::DebugFile &ascFile=zone.ascii(); |
1103 | 23.9k | libstoff::DebugStream f; |
1104 | 23.9k | f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:"; |
1105 | 23.9k | if (!StarGAttributeNamed::read(zone, nVers, endPos, object)) { |
1106 | 8.04k | STOFF_DEBUG_MSG(("StarGAttributeNamedBitmap::read: can not read header\n")); |
1107 | 8.04k | f << "###header"; |
1108 | 8.04k | ascFile.addPos(pos); |
1109 | 8.04k | ascFile.addNote(f.str().c_str()); |
1110 | 8.04k | return false; |
1111 | 8.04k | } |
1112 | 15.8k | bool ok=true; |
1113 | 15.8k | if (m_namedId<0) { |
1114 | 8.68k | if (nVers==1) { |
1115 | 7.77k | int16_t style, type; |
1116 | 7.77k | *input >> style >> type; |
1117 | 7.77k | if (style) f << "style=" << style << ","; |
1118 | 7.77k | if (type) f << "type=" << type << ","; |
1119 | 7.77k | if (type==1) { |
1120 | 1.25k | if (input->tell()+128+2>endPos) { |
1121 | 253 | STOFF_DEBUG_MSG(("StarGAttributeNamedBitmap::read: the zone seems too short\n")); |
1122 | 253 | f << "###short,"; |
1123 | 253 | ok=false; |
1124 | 253 | } |
1125 | 998 | else { |
1126 | 998 | f << "val=["; |
1127 | 998 | uint32_t values[32]; |
1128 | 31.9k | for (unsigned int &value : values) { |
1129 | 31.9k | *input>>value; |
1130 | 31.9k | if (value) f << std::hex << value << std::dec << ","; |
1131 | 13.7k | else f << "_,"; |
1132 | 31.9k | } |
1133 | 998 | f << "],"; |
1134 | 998 | STOFFColor colors[2]; |
1135 | 2.67k | for (int i=0; i<2; ++i) { |
1136 | 1.84k | if (!input->readColor(colors[i])) { |
1137 | 160 | STOFF_DEBUG_MSG(("StarGAttributeNamedBitmap::read: can not read a color\n")); |
1138 | 160 | f << "###color,"; |
1139 | 160 | ok=false; |
1140 | 160 | break; |
1141 | 160 | } |
1142 | 1.68k | f << "col" << i << "=" << colors[i] << ","; |
1143 | 1.68k | } |
1144 | 998 | if (ok) { |
1145 | 838 | StarBitmap bitmap(values, colors); |
1146 | 838 | librevenge::RVNGBinaryData data; |
1147 | 838 | std::string dType; |
1148 | 838 | if (bitmap.getData(data, dType)) |
1149 | 838 | m_bitmap.add(data,dType); |
1150 | 838 | } |
1151 | 998 | } |
1152 | 1.25k | } |
1153 | 6.52k | else if (type!=2 && type!=0) { |
1154 | 851 | STOFF_DEBUG_MSG(("StarGAttributeNamedBitmap::read: unexpected type\n")); |
1155 | 851 | f << "###type,"; |
1156 | 851 | ok=false; |
1157 | 851 | } |
1158 | 7.77k | if (type!=0 || !ok) { |
1159 | 2.22k | printData(f); |
1160 | 2.22k | ascFile.addPos(pos); |
1161 | 2.22k | ascFile.addNote(f.str().c_str()); |
1162 | 2.22k | return ok && input->tell()<=endPos; |
1163 | 2.22k | } |
1164 | 7.77k | } |
1165 | 6.46k | StarBitmap bitmap; |
1166 | 6.46k | librevenge::RVNGBinaryData data; |
1167 | 6.46k | std::string dType; |
1168 | 6.46k | if (bitmap.readBitmap(zone, true, endPos, data, dType)) |
1169 | 3.01k | m_bitmap.add(data,dType); |
1170 | 3.44k | else |
1171 | 3.44k | ok=false; |
1172 | 6.46k | } |
1173 | 13.6k | printData(f); |
1174 | 13.6k | ascFile.addPos(pos); |
1175 | 13.6k | ascFile.addNote(f.str().c_str()); |
1176 | 13.6k | return ok && input->tell()<=endPos; |
1177 | 15.8k | } |
1178 | | |
1179 | | bool StarGAttributeNamedColor::read(StarZone &zone, int nVers, long endPos, StarObject &object) |
1180 | 123k | { |
1181 | 123k | STOFFInputStreamPtr input=zone.input(); |
1182 | 123k | long pos=input->tell(); |
1183 | 123k | libstoff::DebugFile &ascFile=zone.ascii(); |
1184 | 123k | libstoff::DebugStream f; |
1185 | 123k | f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:"; |
1186 | 123k | if (!StarGAttributeNamed::read(zone, nVers, endPos, object)) { |
1187 | 49.7k | STOFF_DEBUG_MSG(("StarGAttributeNamedColor::read: can not read header\n")); |
1188 | 49.7k | f << "###header"; |
1189 | 49.7k | ascFile.addPos(pos); |
1190 | 49.7k | ascFile.addNote(f.str().c_str()); |
1191 | 49.7k | return false; |
1192 | 49.7k | } |
1193 | 73.9k | bool ok=true; |
1194 | 73.9k | if (m_namedId<0) { |
1195 | 37.1k | if (!input->readColor(m_color)) { |
1196 | 2.00k | STOFF_DEBUG_MSG(("StarGAttributeNamedColor::read: can not read a color\n")); |
1197 | 2.00k | f << "###color,"; |
1198 | 2.00k | ok=false; |
1199 | 2.00k | } |
1200 | 37.1k | } |
1201 | 73.9k | printData(f); |
1202 | 73.9k | ascFile.addPos(pos); |
1203 | 73.9k | ascFile.addNote(f.str().c_str()); |
1204 | 73.9k | return ok && input->tell()<=endPos; |
1205 | 123k | } |
1206 | | |
1207 | | bool StarGAttributeNamedDash::read(StarZone &zone, int nVers, long endPos, StarObject &object) |
1208 | 15.3k | { |
1209 | 15.3k | STOFFInputStreamPtr input=zone.input(); |
1210 | 15.3k | long pos=input->tell(); |
1211 | 15.3k | libstoff::DebugFile &ascFile=zone.ascii(); |
1212 | 15.3k | libstoff::DebugStream f; |
1213 | 15.3k | f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:"; |
1214 | 15.3k | if (!StarGAttributeNamed::read(zone, nVers, endPos, object)) { |
1215 | 3.62k | STOFF_DEBUG_MSG(("StarGAttributeNamedDash::read: can not read header\n")); |
1216 | 3.62k | f << "###header"; |
1217 | 3.62k | ascFile.addPos(pos); |
1218 | 3.62k | ascFile.addNote(f.str().c_str()); |
1219 | 3.62k | return false; |
1220 | 3.62k | } |
1221 | 11.7k | if (m_namedId<0) { |
1222 | 8.44k | m_dashStyle=int(input->readULong(4)); |
1223 | 25.3k | for (int i=0; i<2; ++i) { |
1224 | 16.8k | m_numbers[i]=int(input->readULong(2)); |
1225 | 16.8k | m_lengths[i]=int(input->readULong(4)); |
1226 | 16.8k | } |
1227 | 8.44k | m_distance=int(input->readULong(4)); |
1228 | 8.44k | } |
1229 | 11.7k | printData(f); |
1230 | 11.7k | ascFile.addPos(pos); |
1231 | 11.7k | ascFile.addNote(f.str().c_str()); |
1232 | 11.7k | return input->tell()<=endPos; |
1233 | 15.3k | } |
1234 | | |
1235 | | bool StarGAttributeNamedGradient::read(StarZone &zone, int nVers, long endPos, StarObject &object) |
1236 | 97.5k | { |
1237 | 97.5k | STOFFInputStreamPtr input=zone.input(); |
1238 | 97.5k | long pos=input->tell(); |
1239 | 97.5k | libstoff::DebugFile &ascFile=zone.ascii(); |
1240 | 97.5k | libstoff::DebugStream f; |
1241 | 97.5k | f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:"; |
1242 | 97.5k | if (!StarGAttributeNamed::read(zone, nVers, endPos, object)) { |
1243 | 57.7k | STOFF_DEBUG_MSG(("StarGAttributeNamedGradient::read: can not read header\n")); |
1244 | 57.7k | f << "###header"; |
1245 | 57.7k | ascFile.addPos(pos); |
1246 | 57.7k | ascFile.addNote(f.str().c_str()); |
1247 | 57.7k | return false; |
1248 | 57.7k | } |
1249 | 39.7k | if (m_namedId<0) { |
1250 | 23.0k | m_gradientType=int(input->readULong(2)); |
1251 | 23.0k | uint16_t red, green, blue, red2, green2, blue2; |
1252 | 23.0k | *input >> red >> green >> blue >> red2 >> green2 >> blue2; |
1253 | 23.0k | m_colors[0]=STOFFColor(uint8_t(red>>8),uint8_t(green>>8),uint8_t(blue>>8)); |
1254 | 23.0k | m_colors[1]=STOFFColor(uint8_t(red2>>8),uint8_t(green2>>8),uint8_t(blue2>>8)); |
1255 | 23.0k | m_angle=int(input->readULong(4)); |
1256 | 23.0k | m_border=int(input->readULong(2)); |
1257 | 46.0k | for (int &offset : m_offsets) offset=int(input->readULong(2)); |
1258 | 46.0k | for (int &intensity : m_intensities) intensity=int(input->readULong(2)); |
1259 | 23.0k | if (nVers>=1) m_step=int(input->readULong(2)); |
1260 | 23.0k | if (m_type==XATTR_FILLFLOATTRANSPARENCE) *input >> m_enable; |
1261 | 23.0k | } |
1262 | 39.7k | printData(f); |
1263 | 39.7k | ascFile.addPos(pos); |
1264 | 39.7k | ascFile.addNote(f.str().c_str()); |
1265 | 39.7k | return input->tell()<=endPos; |
1266 | 97.5k | } |
1267 | | |
1268 | | bool StarGAttributeNamedHatch::read(StarZone &zone, int nVers, long endPos, StarObject &object) |
1269 | 42.8k | { |
1270 | 42.8k | STOFFInputStreamPtr input=zone.input(); |
1271 | 42.8k | long pos=input->tell(); |
1272 | 42.8k | libstoff::DebugFile &ascFile=zone.ascii(); |
1273 | 42.8k | libstoff::DebugStream f; |
1274 | 42.8k | f << "Entries(StarAttribute)[" << zone.getRecordLevel() << "]:"; |
1275 | 42.8k | if (!StarGAttributeNamed::read(zone, nVers, endPos, object)) { |
1276 | 22.5k | STOFF_DEBUG_MSG(("StarGAttributeNamedHatch::read: can not read header\n")); |
1277 | 22.5k | f << "###header"; |
1278 | 22.5k | ascFile.addPos(pos); |
1279 | 22.5k | ascFile.addNote(f.str().c_str()); |
1280 | 22.5k | return false; |
1281 | 22.5k | } |
1282 | 20.3k | if (m_namedId<0) { |
1283 | | // XFillHatchItem::XFillHatchItem svx_xattr.cxx |
1284 | 4.60k | m_hatchType=int(input->readULong(2)); |
1285 | 4.60k | uint16_t red, green, blue; |
1286 | 4.60k | *input >> red >> green >> blue; |
1287 | 4.60k | m_color=STOFFColor(uint8_t(red>>8),uint8_t(green>>8),uint8_t(blue>>8)); |
1288 | 4.60k | m_distance=int(input->readLong(4)); |
1289 | 4.60k | m_angle=int(input->readLong(4)); |
1290 | 4.60k | } |
1291 | 20.3k | printData(f); |
1292 | 20.3k | ascFile.addPos(pos); |
1293 | 20.3k | ascFile.addNote(f.str().c_str()); |
1294 | 20.3k | return input->tell()<=endPos; |
1295 | 42.8k | } |
1296 | | |
1297 | | } |
1298 | | |
1299 | | namespace StarGraphicAttribute |
1300 | | { |
1301 | | void addInitTo(std::map<int, std::shared_ptr<StarAttribute> > &map) |
1302 | 177k | { |
1303 | | // --- xattr --- svx_xpool.cxx |
1304 | 177k | addAttributeUInt(map, StarAttribute::XATTR_LINESTYLE,"line[style]",2,1); // solid |
1305 | 177k | addAttributeInt(map, StarAttribute::XATTR_LINEWIDTH, "line[width]",4, 0); // metric |
1306 | 177k | addAttributeInt(map, StarAttribute::XATTR_LINESTARTWIDTH, "line[start,width]",4, 200); // metric |
1307 | 177k | addAttributeInt(map, StarAttribute::XATTR_LINEENDWIDTH, "line[end,width]",4, 200); // metric |
1308 | 177k | addAttributeBool(map, StarAttribute::XATTR_LINESTARTCENTER,"line[startCenter]", false); |
1309 | 177k | addAttributeBool(map, StarAttribute::XATTR_LINEENDCENTER,"line[endCenter]", false); |
1310 | 177k | addAttributeUInt(map, StarAttribute::XATTR_LINETRANSPARENCE,"line[transparence]",2,0); |
1311 | 177k | addAttributeUInt(map, StarAttribute::XATTR_LINEJOINT,"line[joint]",2,4); // use arc |
1312 | 177k | addAttributeUInt(map, StarAttribute::XATTR_FILLSTYLE,"fill[style]",2,1); // solid |
1313 | 177k | addAttributeUInt(map, StarAttribute::XATTR_FILLTRANSPARENCE,"fill[transparence]",2,0); |
1314 | 177k | addAttributeInt(map, StarAttribute::XATTR_FILLBMP_SIZEX, "fill[bmp,sizeX]",4, 0); // metric |
1315 | 177k | addAttributeInt(map, StarAttribute::XATTR_FILLBMP_SIZEY, "fill[bmp,sizeY]",4, 0); // metric |
1316 | 177k | addAttributeBool(map, StarAttribute::XATTR_FILLBMP_TILE,"fill[bmp,tile]", true); |
1317 | 177k | addAttributeBool(map, StarAttribute::XATTR_FILLBMP_STRETCH,"fill[bmp,stretch]", true); |
1318 | 177k | addAttributeUInt(map, StarAttribute::XATTR_FILLBMP_POS,"fill[bmp,pos]",2,4); // middle-middle |
1319 | 177k | addAttributeUInt(map, StarAttribute::XATTR_FILLBMP_POSOFFSETX,"fill[bmp,pos,offX]",2,0); |
1320 | 177k | addAttributeUInt(map, StarAttribute::XATTR_FILLBMP_POSOFFSETY,"fill[bmp,pos,offY]",2,0); |
1321 | 177k | addAttributeUInt(map, StarAttribute::XATTR_FILLBMP_TILEOFFSETX,"fill[bmp,tile,offX]",2,0); |
1322 | 177k | addAttributeUInt(map, StarAttribute::XATTR_FILLBMP_TILEOFFSETY,"fill[bmp,tile,offY]",2,0); |
1323 | 177k | addAttributeBool(map, StarAttribute::XATTR_FILLBACKGROUND,"fill[background]", false); |
1324 | 177k | addAttributeUInt(map, StarAttribute::XATTR_GRADIENTSTEPCOUNT,"gradient[stepCount]",2,0); |
1325 | | |
1326 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_ECKENRADIUS, "radius[ecken]",4, 0); // metric |
1327 | 177k | addAttributeBool(map, StarAttribute::SDRATTR_SHADOW,"shadow", false); // onOff |
1328 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_SHADOWXDIST, "shadow[xDist]",4, 0); // metric |
1329 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_SHADOWYDIST, "shadow[yDist]",4, 0); // metric |
1330 | 177k | addAttributeUInt(map, StarAttribute::SDRATTR_SHADOWTRANSPARENCE, "shadow[transparence]",2,0); |
1331 | 177k | addAttributeVoid(map, StarAttribute::SDRATTR_SHADOW3D, "shadow[3d]"); |
1332 | 177k | addAttributeVoid(map, StarAttribute::SDRATTR_SHADOWPERSP, "shadow[persp]"); // useme |
1333 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_TEXT_LEFTDIST, "text[left,dist]",4, 0); // metric |
1334 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_TEXT_RIGHTDIST, "text[right,dist]",4, 0); // metric |
1335 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_TEXT_UPPERDIST, "text[upper,dist]",4, 0); // metric |
1336 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_TEXT_LOWERDIST, "text[lower,dist]",4, 0); // metric |
1337 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_TEXT_MINFRAMEHEIGHT, "text[min,frameHeight]",4, 0); // metric |
1338 | 177k | addAttributeBool(map, StarAttribute::SDRATTR_TEXT_AUTOGROWHEIGHT,"text[autoGrow,height]", true); // onOff |
1339 | 177k | addAttributeUInt(map, StarAttribute::SDRATTR_TEXT_FITTOSIZE, "text[fitToSize]",2,0); // none |
1340 | 177k | addAttributeUInt(map, StarAttribute::SDRATTR_TEXT_VERTADJUST, "text[vert,adjust]",2,0); // top |
1341 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_TEXT_MAXFRAMEHEIGHT, "text[max,frameHeight]",4, 0); // metric |
1342 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_TEXT_MINFRAMEWIDTH, "text[min,frameWidth]",4, 0); // metric |
1343 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_TEXT_MAXFRAMEWIDTH, "text[max,frameWidth]",4, 0); // metric |
1344 | 177k | addAttributeBool(map, StarAttribute::SDRATTR_TEXT_AUTOGROWWIDTH,"text[autoGrow,width]", false); // onOff |
1345 | 177k | addAttributeUInt(map, StarAttribute::SDRATTR_TEXT_HORZADJUST, "text[horz,adjust]",2,3); // block |
1346 | 177k | addAttributeUInt(map, StarAttribute::SDRATTR_TEXT_ANIKIND, "text[ani,kind]",2,0); // none |
1347 | 177k | addAttributeUInt(map, StarAttribute::SDRATTR_TEXT_ANIDIRECTION, "text[ani,direction]",2,0); // left |
1348 | 177k | addAttributeBool(map, StarAttribute::SDRATTR_TEXT_ANISTARTINSIDE,"text[ani,startInside]", false); // yesNo |
1349 | 177k | addAttributeBool(map, StarAttribute::SDRATTR_TEXT_ANISTOPINSIDE,"text[ani,stopInside]", false); // yesNo |
1350 | 177k | addAttributeUInt(map, StarAttribute::SDRATTR_TEXT_ANICOUNT, "text[ani,count]",2,0); |
1351 | 177k | addAttributeUInt(map, StarAttribute::SDRATTR_TEXT_ANIDELAY, "text[ani,delay]",2,0); |
1352 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_TEXT_ANIAMOUNT, "text[ani,amount]",2, 0); |
1353 | 177k | addAttributeBool(map, StarAttribute::SDRATTR_TEXT_CONTOURFRAME,"text[contourFrame]", false); // onOff |
1354 | 177k | addAttributeVoid(map, StarAttribute::SDRATTR_XMLATTRIBUTES,"sdr[xmlAttrib]"); |
1355 | 177k | addAttributeUInt(map, StarAttribute::SDRATTR_CIRCKIND, "circle[kind]",2,0); // full |
1356 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_CIRCSTARTANGLE, "circle[angle,start]",4, 0); // sdrAngle |
1357 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_CIRCENDANGLE, "circle[angle,end]",4, 36000); // sdrAngle |
1358 | | |
1359 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_MEASURELINEDIST, "measure[line,dist]",4, 800); // metric |
1360 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_MEASUREOVERHANG, "measure[overHang]",4, 600); // metric |
1361 | 177k | addAttributeBool(map, StarAttribute::SDRATTR_MEASUREBELOWREFEDGE,"measure[belowRefEdge]", false); // yesNo |
1362 | 177k | addAttributeBool(map, StarAttribute::SDRATTR_MEASURESHOWUNIT,"measure[showUnit]", false); // yesNo |
1363 | 177k | addAttributeBool(map, StarAttribute::SDRATTR_OBJMOVEPROTECT,"obj[move,protect]", false); // yesNo |
1364 | 177k | addAttributeBool(map, StarAttribute::SDRATTR_OBJSIZEPROTECT,"obj[size,protect]", false); // yesNo |
1365 | 177k | addAttributeBool(map, StarAttribute::SDRATTR_OBJPRINTABLE,"obj[printable]", false); // yesNo |
1366 | | |
1367 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_GRAFRED, "graf[red]",2, 0); // signed percent |
1368 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_GRAFGREEN, "graf[green]",2, 0); // signed percent |
1369 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_GRAFBLUE, "graf[blue]",2, 0); // signed percent |
1370 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_GRAFLUMINANCE, "graf[luminance]",2, 0); // signed percent |
1371 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_GRAFCONTRAST, "graf[contrast]",2, 0); // signed percent |
1372 | 177k | addAttributeUInt(map, StarAttribute::SDRATTR_GRAFGAMMA, "graf[gamma]",4,100); |
1373 | 177k | addAttributeUInt(map, StarAttribute::SDRATTR_GRAFTRANSPARENCE, "graf[transparence]",2,0); |
1374 | 177k | addAttributeBool(map, StarAttribute::SDRATTR_GRAFINVERT,"graf[invert]", false); // onOff |
1375 | 177k | addAttributeUInt(map, StarAttribute::SDRATTR_GRAFMODE, "graf[mode]",2,0); // standard |
1376 | | |
1377 | 177k | map[StarAttribute::XATTR_LINECOLOR]=std::shared_ptr<StarAttribute> |
1378 | 177k | (new StarGAttributeNamedColor(StarAttribute::XATTR_LINECOLOR,"line[color]",STOFFColor::black())); |
1379 | 177k | map[StarAttribute::XATTR_LINESTART]=std::shared_ptr<StarAttribute> |
1380 | 177k | (new StarGAttributeNamedArrow(StarAttribute::XATTR_LINESTART,"line[start]")); |
1381 | 177k | map[StarAttribute::XATTR_LINEEND]=std::shared_ptr<StarAttribute> |
1382 | 177k | (new StarGAttributeNamedArrow(StarAttribute::XATTR_LINEEND,"line[end]")); |
1383 | 177k | map[StarAttribute::XATTR_LINEDASH]=std::shared_ptr<StarAttribute> |
1384 | 177k | (new StarGAttributeNamedDash(StarAttribute::XATTR_LINEDASH,"line[dash]")); |
1385 | 177k | map[StarAttribute::XATTR_FILLCOLOR]=std::shared_ptr<StarAttribute> |
1386 | 177k | (new StarGAttributeNamedColor(StarAttribute::XATTR_FILLCOLOR,"fill[color]",STOFFColor::white())); |
1387 | 177k | map[StarAttribute::XATTR_FILLGRADIENT]=std::shared_ptr<StarAttribute> |
1388 | 177k | (new StarGAttributeNamedGradient(StarAttribute::XATTR_FILLGRADIENT,"gradient[fill]")); |
1389 | 177k | map[StarAttribute::XATTR_FILLHATCH]=std::shared_ptr<StarAttribute> |
1390 | 177k | (new StarGAttributeNamedHatch(StarAttribute::XATTR_FILLHATCH,"hatch[fill]")); |
1391 | 177k | map[StarAttribute::XATTR_FILLBITMAP]=std::shared_ptr<StarAttribute> |
1392 | 177k | (new StarGAttributeNamedBitmap(StarAttribute::XATTR_FILLBITMAP,"bitmap[fill]")); |
1393 | 177k | map[StarAttribute::XATTR_FORMTXTSHDWCOLOR]=std::shared_ptr<StarAttribute> |
1394 | 177k | (new StarGAttributeNamedColor(StarAttribute::XATTR_FORMTXTSHDWCOLOR,"shadow[form,color]",STOFFColor::black())); |
1395 | 177k | map[StarAttribute::SDRATTR_SHADOWCOLOR]=std::shared_ptr<StarAttribute> |
1396 | 177k | (new StarGAttributeNamedColor(StarAttribute::SDRATTR_SHADOWCOLOR,"sdrShadow[color]",STOFFColor::black())); |
1397 | 177k | map[StarAttribute::SDRATTR_GRAFCROP]=std::shared_ptr<StarAttribute> |
1398 | 177k | (new StarGAttributeCrop(StarAttribute::SDRATTR_GRAFCROP, "graf[crop],")); |
1399 | | |
1400 | 177k | std::vector<STOFFVec2i> limits; |
1401 | 177k | limits.resize(1); |
1402 | 177k | limits[0]=STOFFVec2i(1000,1016); |
1403 | 177k | map[StarAttribute::XATTR_SET_LINE]=std::shared_ptr<StarAttribute>(new StarGAttributeItemSet(StarAttribute::XATTR_SET_LINE,"setLine",limits)); |
1404 | 177k | limits[0]=STOFFVec2i(1018,1046); |
1405 | 177k | map[StarAttribute::XATTR_SET_FILL]=std::shared_ptr<StarAttribute>(new StarGAttributeItemSet(StarAttribute::XATTR_SET_FILL,"setFill",limits)); |
1406 | 177k | limits[0]=STOFFVec2i(1048,1064); |
1407 | 177k | map[StarAttribute::XATTR_SET_TEXT]=std::shared_ptr<StarAttribute>(new StarGAttributeItemSet(StarAttribute::XATTR_SET_TEXT,"setText",limits)); |
1408 | 177k | limits[0]=STOFFVec2i(1067,1078); |
1409 | 177k | map[StarAttribute::SDRATTR_SET_SHADOW]=std::shared_ptr<StarAttribute>(new StarGAttributeItemSet(StarAttribute::SDRATTR_SET_SHADOW,"setShadow",limits)); |
1410 | 177k | limits[0]=STOFFVec2i(1080,1094); |
1411 | 177k | map[StarAttribute::SDRATTR_SET_CAPTION]=std::shared_ptr<StarAttribute>(new StarGAttributeItemSet(StarAttribute::SDRATTR_SET_CAPTION,"setCaption",limits)); |
1412 | 177k | limits[0]=STOFFVec2i(1097,1125); |
1413 | 177k | map[StarAttribute::SDRATTR_SET_MISC]=std::shared_ptr<StarAttribute>(new StarGAttributeItemSet(StarAttribute::SDRATTR_SET_MISC,"setMisc",limits)); |
1414 | 177k | limits[0]=STOFFVec2i(1127,1145); |
1415 | 177k | map[StarAttribute::SDRATTR_SET_EDGE]=std::shared_ptr<StarAttribute>(new StarGAttributeItemSet(StarAttribute::SDRATTR_SET_EDGE,"setEdge",limits)); |
1416 | 177k | limits[0]=STOFFVec2i(1147,1170); |
1417 | 177k | map[StarAttribute::SDRATTR_SET_MEASURE]=std::shared_ptr<StarAttribute>(new StarGAttributeItemSet(StarAttribute::SDRATTR_SET_MEASURE,"setMeasure",limits)); |
1418 | 177k | limits[0]=STOFFVec2i(1172,1178); |
1419 | 177k | map[StarAttribute::SDRATTR_SET_CIRC]=std::shared_ptr<StarAttribute>(new StarGAttributeItemSet(StarAttribute::SDRATTR_SET_CIRC,"setCircle",limits)); |
1420 | 177k | limits[0]=STOFFVec2i(1180,1242); |
1421 | 177k | map[StarAttribute::SDRATTR_SET_GRAF]=std::shared_ptr<StarAttribute>(new StarGAttributeItemSet(StarAttribute::SDRATTR_SET_GRAF,"setGraf",limits)); |
1422 | | |
1423 | | // probably ok to ignore as we have the path |
1424 | 177k | addAttributeUInt(map, StarAttribute::SDRATTR_EDGEKIND, "edge[kind]",2,0); // ortholine |
1425 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_EDGENODE1HORZDIST, "edge[node1,hori,dist]",4, 500); // metric |
1426 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_EDGENODE1VERTDIST, "edge[node1,vert,dist]",4, 500); // metric |
1427 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_EDGENODE2HORZDIST, "edge[node2,hori,dist]",4, 500); // metric |
1428 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_EDGENODE2VERTDIST, "edge[node2,vert,dist]",4, 500); // metric |
1429 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_EDGENODE1GLUEDIST, "edge[node1,glue,dist]",4, 0); // metric |
1430 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_EDGENODE2GLUEDIST, "edge[node2,glue,dist]",4, 0); // metric |
1431 | 177k | addAttributeUInt(map, StarAttribute::SDRATTR_EDGELINEDELTAANZ, "edge[line,deltaAnz]",2,0); |
1432 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_EDGELINE1DELTA, "edge[delta,line1]",4, 0); // metric |
1433 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_EDGELINE2DELTA, "edge[delta,line2]",4, 0); // metric |
1434 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_EDGELINE3DELTA, "edge[delta,line3]",4, 0); // metric |
1435 | | // can we retrieve these properties ? |
1436 | 177k | addAttributeUInt(map, StarAttribute::SDRATTR_MEASUREKIND, "measure[kind]",2,0); // standard |
1437 | 177k | addAttributeUInt(map, StarAttribute::SDRATTR_MEASURETEXTHPOS, "measure[text,hpos]",2,0); // auto |
1438 | 177k | addAttributeUInt(map, StarAttribute::SDRATTR_MEASURETEXTVPOS, "measure[text,vpos]",2,0); // auto |
1439 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_MEASUREHELPLINEOVERHANG, "measure[help,line,overhang]",4, 200); // metric |
1440 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_MEASUREHELPLINEDIST, "measure[help,line,dist]",4, 100); // metric |
1441 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_MEASUREHELPLINE1LEN, "measure[help,line1,len]",4, 0); // metric |
1442 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_MEASUREHELPLINE2LEN, "measure[help,line2,len]",4, 0); // metric |
1443 | 177k | addAttributeBool(map, StarAttribute::SDRATTR_MEASURETEXTROTA90,"measure[textRot90]", false); // yesNo |
1444 | 177k | addAttributeBool(map, StarAttribute::SDRATTR_MEASURETEXTUPSIDEDOWN,"measure[textUpsideDown]", false); // yesNo |
1445 | 177k | addAttributeUInt(map, StarAttribute::SDRATTR_MEASUREUNIT, "measure[unit]",2,0); // NONE |
1446 | 177k | addAttributeBool(map, StarAttribute::SDRATTR_MEASURETEXTAUTOANGLE,"measure[text,isAutoAngle]", true); // yesNo |
1447 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_MEASURETEXTAUTOANGLEVIEW,"measure[text,autoAngle]", 4,31500); // angle |
1448 | 177k | addAttributeBool(map, StarAttribute::SDRATTR_MEASURETEXTISFIXEDANGLE,"measure[text,isFixedAngle]", false); // yesNo |
1449 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_MEASURETEXTFIXEDANGLE,"measure[text,fixedAngle]", 4,0); // angle |
1450 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_MEASUREDECIMALPLACES,"measure[decimal,place]", 2,2); |
1451 | 177k | addAttributeFraction(map, StarAttribute::SDRATTR_MEASURESCALE, "measure[scale,mult]"); |
1452 | | // can we retrieve these properties ? |
1453 | 177k | addAttributeUInt(map, StarAttribute::SDRATTR_CAPTIONTYPE, "caption[type]",2,2); // type3 |
1454 | 177k | addAttributeBool(map, StarAttribute::SDRATTR_CAPTIONFIXEDANGLE,"caption[fixedAngle]", true); // onOff |
1455 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_CAPTIONANGLE, "caption[angle]",4, 0); // angle |
1456 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_CAPTIONGAP, "caption[gap]",4, 0); // metric |
1457 | 177k | addAttributeUInt(map, StarAttribute::SDRATTR_CAPTIONESCDIR, "caption[esc,dir]",2,0); // horizontal |
1458 | 177k | addAttributeBool(map, StarAttribute::SDRATTR_CAPTIONESCISREL,"caption[esc,isRel]", true); // yesNo |
1459 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_CAPTIONESCREL, "caption[esc,rel]",4, 5000); |
1460 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_CAPTIONESCABS, "caption[esc,abs]",4, 0); // metric |
1461 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_CAPTIONLINELEN, "caption[line,len]",4, 0); // metric |
1462 | 177k | addAttributeBool(map, StarAttribute::SDRATTR_CAPTIONFITLINELEN,"caption[fit,lineLen]", true); // yesNo |
1463 | | |
1464 | 1.06M | for (int type=StarAttribute::XATTR_LINERESERVED2; type<=StarAttribute::XATTR_LINERESERVED_LAST; ++type) { |
1465 | 889k | std::stringstream s; |
1466 | 889k | s << "line[reserved" << type-StarAttribute::XATTR_LINERESERVED2+2 << "]"; |
1467 | 889k | addAttributeVoid(map, StarAttribute::Type(type), s.str()); |
1468 | 889k | } |
1469 | 1.95M | for (int type=StarAttribute::XATTR_FILLRESERVED2; type<=StarAttribute::XATTR_FILLRESERVED_LAST; ++type) { |
1470 | 1.77M | std::stringstream s; |
1471 | 1.77M | s << "fill[reserved" << type-StarAttribute::XATTR_FILLRESERVED2+2 << "]"; |
1472 | 1.77M | addAttributeVoid(map, StarAttribute::Type(type), s.str()); |
1473 | 1.77M | } |
1474 | 1.06M | for (int type=StarAttribute::SDRATTR_SHADOWRESERVE1; type<=StarAttribute::SDRATTR_SHADOWRESERVE5; ++type) { |
1475 | 889k | std::stringstream s; |
1476 | 889k | s << "shadow[reserved" << type-StarAttribute::SDRATTR_SHADOWRESERVE1+1 << "]"; |
1477 | 889k | addAttributeVoid(map, StarAttribute::Type(type), s.str()); |
1478 | 889k | } |
1479 | 1.06M | for (int type=StarAttribute::SDRATTR_RESERVE15; type<=StarAttribute::SDRATTR_RESERVE19; ++type) { |
1480 | 889k | std::stringstream s; |
1481 | 889k | s << "sdr[reserved" << type-StarAttribute::SDRATTR_RESERVE15+15 << "]"; |
1482 | 889k | addAttributeVoid(map, StarAttribute::Type(type), s.str()); |
1483 | 889k | } |
1484 | 889k | for (int type=StarAttribute::SDRATTR_CIRCRESERVE0; type<=StarAttribute::SDRATTR_CIRCRESERVE3; ++type) { |
1485 | 711k | std::stringstream s; |
1486 | 711k | s << "circle[reserved" << type-StarAttribute::SDRATTR_CIRCRESERVE0 << "]"; |
1487 | 711k | addAttributeVoid(map, StarAttribute::Type(type), s.str()); |
1488 | 711k | } |
1489 | 1.60M | for (int type=StarAttribute::SDRATTR_EDGERESERVE02; type<=StarAttribute::SDRATTR_EDGERESERVE09; ++type) { |
1490 | 1.42M | std::stringstream s; |
1491 | 1.42M | s << "edge[reserved" << type-StarAttribute::SDRATTR_EDGERESERVE02+2 << "]"; |
1492 | 1.42M | addAttributeVoid(map, StarAttribute::Type(type), s.str()); |
1493 | 1.42M | } |
1494 | 711k | for (int type=StarAttribute::SDRATTR_MEASURERESERVE05; type<=StarAttribute::SDRATTR_MEASURERESERVE07; ++type) { |
1495 | 533k | std::stringstream s; |
1496 | 533k | s << "measure[reserved" << type-StarAttribute::SDRATTR_MEASURERESERVE05+5 << "]"; |
1497 | 533k | addAttributeVoid(map, StarAttribute::Type(type), s.str()); |
1498 | 533k | } |
1499 | 1.06M | for (int type=StarAttribute::SDRATTR_CAPTIONRESERVE1; type<=StarAttribute::SDRATTR_CAPTIONRESERVE5; ++type) { |
1500 | 889k | std::stringstream s; |
1501 | 889k | s << "caption[reserved" << type-StarAttribute::SDRATTR_CAPTIONRESERVE1+1 << "]"; |
1502 | 889k | addAttributeVoid(map, StarAttribute::Type(type), s.str()); |
1503 | 889k | } |
1504 | 889k | for (int type=StarAttribute::SDRATTR_GRAFRESERVE3; type<=StarAttribute::SDRATTR_GRAFRESERVE6; ++type) { |
1505 | 711k | std::stringstream s; |
1506 | 711k | s << "graf[reserved" << type-StarAttribute::SDRATTR_GRAFRESERVE3+3 << "]"; |
1507 | 711k | addAttributeVoid(map, StarAttribute::Type(type), s.str()); |
1508 | 711k | } |
1509 | 2.66M | for (int type=StarAttribute::SDRATTR_NOTPERSISTRESERVE2; type<=StarAttribute::SDRATTR_NOTPERSISTRESERVE15; ++type) { |
1510 | 2.48M | std::stringstream s; |
1511 | 2.48M | s << "notpersist[reserved" << type-StarAttribute::SDRATTR_NOTPERSISTRESERVE2+2 << "]"; |
1512 | 2.48M | addAttributeVoid(map, StarAttribute::Type(type), s.str()); |
1513 | 2.48M | } |
1514 | | |
1515 | | // to do |
1516 | 177k | addAttributeUInt(map, StarAttribute::SDRATTR_LAYERID, "layer[id]",2,0); |
1517 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_ALLPOSITIONX, "positionX[all]",4, 0); // metric |
1518 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_ALLPOSITIONY, "positionY[all]",4, 0); // metric |
1519 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_ALLSIZEWIDTH, "size[all,width]",4, 0); // metric |
1520 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_ALLSIZEHEIGHT, "size[all,height]",4, 0); // metric |
1521 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_ONEPOSITIONX, "poitionX[one]",4, 0); // metric |
1522 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_ONEPOSITIONY, "poitionY[one]",4, 0); // metric |
1523 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_ONESIZEWIDTH, "size[one,width]",4, 0); // metric |
1524 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_ONESIZEHEIGHT, "size[one,height]",4, 0); // metric |
1525 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_LOGICSIZEWIDTH, "size[logic,width]",4, 0); // metric |
1526 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_LOGICSIZEHEIGHT, "size[logic,height]",4, 0); // metric |
1527 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_ROTATEANGLE, "rotate[angle]",4, 0); // sdrAngle |
1528 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_SHEARANGLE, "shear[angle]",4, 0); // sdrAngle |
1529 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_MOVEX, "moveX",4, 0); // metric |
1530 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_MOVEY, "moveY",4, 0); // metric |
1531 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_ROTATEONE, "rotate[one]",4, 0); // sdrAngle |
1532 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_HORZSHEARONE, "shear[horzOne]",4, 0); // sdrAngle |
1533 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_VERTSHEARONE, "shear[vertOne]",4, 0); // sdrAngle |
1534 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_ROTATEALL, "rotate[all]",4, 0); // sdrAngle |
1535 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_HORZSHEARALL, "shear[horzAll]",4, 0); // sdrAngle |
1536 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_VERTSHEARALL, "shear[vertAll]",4, 0); // sdrAngle |
1537 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_TRANSFORMREF1X, "transform[ref1X]",4, 0); // metric |
1538 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_TRANSFORMREF1Y, "transform[ref1Y]",4, 0); // metric |
1539 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_TRANSFORMREF2X, "transform[ref2X]",4, 0); // metric |
1540 | 177k | addAttributeInt(map, StarAttribute::SDRATTR_TRANSFORMREF2Y, "transform[ref2Y]",4, 0); // metric |
1541 | 177k | addAttributeUInt(map, StarAttribute::SDRATTR_TEXTDIRECTION, "text[direction]",2,0); // LRTB |
1542 | 177k | addAttributeFraction(map, StarAttribute::SDRATTR_RESIZEXONE, "sdrResizeX[one]"); |
1543 | 177k | addAttributeFraction(map, StarAttribute::SDRATTR_RESIZEYONE, "sdrResizeY[one]"); |
1544 | 177k | addAttributeFraction(map, StarAttribute::SDRATTR_RESIZEXALL, "sdrResizeX[all]"); |
1545 | 177k | addAttributeFraction(map, StarAttribute::SDRATTR_RESIZEYALL, "sdrResizeY[all]"); |
1546 | | |
1547 | 177k | addAttributeBool(map, StarAttribute::XATTR_FILLBMP_SIZELOG,"fill[bmp,sizeLog]", true); |
1548 | | |
1549 | 177k | map[StarAttribute::XATTR_FILLFLOATTRANSPARENCE]=std::shared_ptr<StarAttribute> |
1550 | 177k | (new StarGAttributeNamedGradient(StarAttribute::XATTR_FILLFLOATTRANSPARENCE,"gradient[trans,fill]")); |
1551 | | |
1552 | | |
1553 | | // TOUSE |
1554 | 177k | map[StarAttribute::ATTR_SC_BORDER_INNER]=std::shared_ptr<StarAttribute>(new StarGAttributeBoxInfo(StarAttribute::ATTR_SC_BORDER_INNER,"scBorder[inner]")); |
1555 | | |
1556 | 177k | } |
1557 | | } |
1558 | | // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: |