Debian Codegraph @

src/lib/MWAWChart.cxx

raw
1 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2
3 /* libmwaw
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 ([email protected])
18 * Copyright (C) 2002,2004 Marc Maurer ([email protected])
19 * Copyright (C) 2004-2006 Fridrich Strba ([email protected])
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent ([email protected])
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 /*
35 * Structure to store and construct a chart from an unstructured list
36 * of cell
37 *
38 */
39
40 #include <iomanip>
41 #include <iostream>
42 #include <map>
43 #include <sstream>
44
45 #include <librevenge/librevenge.h>
46
47 #include "MWAWFontConverter.hxx"
48 #include "MWAWInputStream.hxx"
49 #include "MWAWListener.hxx"
50 #include "MWAWPosition.hxx"
51 #include "MWAWSpreadsheetListener.hxx"
52 #include "MWAWSubDocument.hxx"
53
54 #include "MWAWChart.hxx"
55
56 /** Internal: the structures of a MWAWChart */
57 namespace MWAWChartInternal
58 {
59 ////////////////////////////////////////
60 //! Internal: the subdocument of a MWAWChart
61 class SubDocument final : public MWAWSubDocument
62 {
63 public:
64 SubDocument(MWAWChart *chart, MWAWChart::TextZone::Type textZone)
65 : MWAWSubDocument(nullptr, MWAWInputStreamPtr(), MWAWEntry())
66 , m_chart(chart)
67 , m_textZone(textZone)
68 {
69 }
70
71 //! destructor
72 ~SubDocument() final {}
73
74 //! operator!=
75 bool operator!=(MWAWSubDocument const &doc) const final
76 {
77 if (MWAWSubDocument::operator!=(doc))
78 return true;
79 auto const *subDoc=dynamic_cast<SubDocument const *>(&doc);
80 if (!subDoc) return true;
81 return m_chart!=subDoc->m_chart || m_textZone!=subDoc->m_textZone;
82 }
83
84 //! the parser function
85 void parse(MWAWListenerPtr &listener, libmwaw::SubDocumentType type) final;
86 protected:
87 //! the chart
88 MWAWChart *m_chart;
89 //! the textzone type
90 MWAWChart::TextZone::Type m_textZone;
91 private:
92 SubDocument(SubDocument const &orig) = delete;
93 SubDocument &operator=(SubDocument const &orig) = delete;
94 };
95
96 void SubDocument::parse(MWAWListenerPtr &listener, libmwaw::SubDocumentType /*type*/)
97 {
98 if (!listener.get()) {
99 MWAW_DEBUG_MSG(("MWAWChartInternal::SubDocument::parse: no listener\n"));
100 return;
101 }
102
103 if (!m_chart) {
104 MWAW_DEBUG_MSG(("MWAWChartInternal::SubDocument::parse: can not find the chart\n"));
105 return;
106 }
107 m_chart->sendTextZoneContent(m_textZone, listener);
108 }
109
110 }
111
112 ////////////////////////////////////////////////////////////
113 // MWAWChart
114 ////////////////////////////////////////////////////////////
115 MWAWChart::MWAWChart(std::string const &sheetName, MWAWFontConverterPtr const &fontConverter, MWAWVec2f const &dim)
116 : m_sheetName(sheetName)
117 , m_dim(dim)
118 , m_type(MWAWChart::Series::S_Bar)
119 , m_dataStacked(false)
120 , m_legend()
121 , m_seriesList()
122 , m_textZoneMap()
123 , m_fontConverter(fontConverter)
124 {
125 }
126
127 MWAWChart::~MWAWChart()
128 {
129 }
130
131 void MWAWChart::add(int coord, MWAWChart::Axis const &axis)
132 {
133 if (coord<0 || coord>2) {
134 MWAW_DEBUG_MSG(("MWAWChart::add[Axis]: called with bad coord\n"));
135 return;
136 }
137 m_axis[coord]=axis;
138 }
139
140 MWAWChart::Axis const &MWAWChart::getAxis(int coord) const
141 {
142 if (coord<0 || coord>2) {
143 MWAW_DEBUG_MSG(("MWAWChart::getAxis: called with bad coord\n"));
144 return m_axis[3];
145 }
146 return m_axis[coord];
147 }
148
149 void MWAWChart::add(MWAWChart::Series const &series)
150 {
151 m_seriesList.push_back(series);
152 }
153
154 bool MWAWChart::getTextZone(MWAWChart::TextZone::Type type, MWAWChart::TextZone &textZone)
155 {
156 if (m_textZoneMap.find(type)==m_textZoneMap.end())
157 return false;
158 textZone=m_textZoneMap.find(type)->second;
159 return true;
160 }
161
162 void MWAWChart::sendTextZoneContent(MWAWChart::TextZone::Type type, MWAWListenerPtr &listener)
163 {
164 if (m_textZoneMap.find(type)==m_textZoneMap.end()) {
165 MWAW_DEBUG_MSG(("MWAWChart::sendTextZoneContent: called with unknown zone(%d)\n", int(type)));
166 return;
167 }
168 sendContent(m_textZoneMap.find(type)->second, listener);
169 }
170
171 void MWAWChart::add(MWAWChart::TextZone const &textZone)
172 {
173 m_textZoneMap[textZone.m_type]=textZone;
174 }
175
176 void MWAWChart::sendChart(MWAWSpreadsheetListenerPtr &listener, librevenge::RVNGSpreadsheetInterface *interface)
177 {
178 if (!listener || !interface) {
179 MWAW_DEBUG_MSG(("MWAWChart::sendChart: can not find listener or interface\n"));
180 return;
181 }
182 if (m_seriesList.empty()) {
183 MWAW_DEBUG_MSG(("MWAWChart::sendChart: can not find the series\n"));
184 return;
185 }
186 int styleId=0;
187
188 librevenge::RVNGPropertyList style;
189 style.insert("librevenge:chart-id", styleId);
190 style.insert("draw:stroke", "none");
191 style.insert("draw:fill", "none");
192 interface->defineChartStyle(style);
193
194 librevenge::RVNGPropertyList chart;
195 chart.insert("svg:width", double(m_dim[0]), librevenge::RVNG_POINT);
196 chart.insert("svg:height", double(m_dim[1]), librevenge::RVNG_POINT);
197 if (!m_seriesList.empty())
198 chart.insert("chart:class", Series::getSeriesTypeName(m_seriesList[0].m_type).c_str());
199 else
200 chart.insert("chart:class", Series::getSeriesTypeName(m_type).c_str());
201 chart.insert("librevenge:chart-id", styleId++);
202 interface->openChart(chart);
203
204 // legend
205 if (m_legend.m_show && m_fontConverter) {
206 style=librevenge::RVNGPropertyList();
207 m_legend.addStyleTo(style, m_fontConverter);
208 style.insert("librevenge:chart-id", styleId);
209 interface->defineChartStyle(style);
210 librevenge::RVNGPropertyList legend;
211 m_legend.addContentTo(legend);
212 legend.insert("librevenge:chart-id", styleId++);
213 legend.insert("librevenge:zone-type", "legend");
214 interface->openChartTextObject(legend);
215 interface->closeChartTextObject();
216 }
217 for (auto const &textIt : m_textZoneMap) {
218 TextZone const &zone= textIt.second;
219 if (zone.m_type != TextZone::T_Title && zone.m_type != TextZone::T_SubTitle)
220 continue;
221 style=librevenge::RVNGPropertyList();
222 zone.addStyleTo(style, m_fontConverter);
223 style.insert("librevenge:chart-id", styleId);
224 interface->defineChartStyle(style);
225 librevenge::RVNGPropertyList textZone;
226 zone.addContentTo(m_sheetName, textZone);
227 textZone.insert("librevenge:chart-id", styleId++);
228 textZone.insert("librevenge:zone-type", zone.m_type==TextZone::T_Title ? "title":"subtitle");
229 interface->openChartTextObject(textZone);
230 if (zone.m_contentType==TextZone::C_Text) {
231 std::shared_ptr<MWAWSubDocument> doc(new MWAWChartInternal::SubDocument(this, zone.m_type));
232 listener->handleSubDocument(doc, libmwaw::DOC_CHART_ZONE);
233 }
234 interface->closeChartTextObject();
235 }
236 // plot area
237 style=librevenge::RVNGPropertyList();
238 style.insert("librevenge:chart-id", styleId);
239 style.insert("chart:include-hidden-cells","false");
240 style.insert("chart:auto-position","true");
241 style.insert("chart:auto-size","true");
242 style.insert("chart:treat-empty-cells","leave-gap");
243 style.insert("chart:right-angled-axes","true");
244 style.insert("chart:stacked", m_dataStacked);
245 interface->defineChartStyle(style);
246
247 librevenge::RVNGPropertyList plotArea;
248 if (m_dim[0]>80) {
249 plotArea.insert("svg:x", 20, librevenge::RVNG_POINT);
250 plotArea.insert("svg:width", double(m_dim[0])-40, librevenge::RVNG_POINT);
251 }
252 if (m_dim[1]>80) {
253 plotArea.insert("svg:y", 20, librevenge::RVNG_POINT);
254 plotArea.insert("svg:height", double(m_dim[1])-40, librevenge::RVNG_POINT);
255 }
256 plotArea.insert("librevenge:chart-id", styleId++);
257
258 librevenge::RVNGPropertyList floor, wall;
259 librevenge::RVNGPropertyListVector vect;
260 style=librevenge::RVNGPropertyList();
261 style.insert("draw:stroke","solid");
262 style.insert("svg:stroke-color","#b3b3b3");
263 style.insert("draw:fill","none");
264 style.insert("librevenge:chart-id", styleId);
265 interface->defineChartStyle(style);
266 floor.insert("librevenge:type", "floor");
267 floor.insert("librevenge:chart-id", styleId++);
268 vect.append(floor);
269
270 style.insert("draw:fill","solid");
271 style.insert("draw:fill-color","#ffffff");
272 style.insert("librevenge:chart-id", styleId);
273 interface->defineChartStyle(style);
274 wall.insert("librevenge:type", "wall");
275 wall.insert("librevenge:chart-id", styleId++);
276 vect.append(wall);
277 plotArea.insert("librevenge:childs", vect);
278 interface->openChartPlotArea(plotArea);
279 // axis
280 for (int i=0; i<3; ++i) {
281 if (m_axis[i].m_type==Axis::A_None) continue;
282 style=librevenge::RVNGPropertyList();
283 m_axis[i].addStyleTo(style);
284 style.insert("librevenge:chart-id", styleId);
285 interface->defineChartStyle(style);
286 librevenge::RVNGPropertyList axis;
287 m_axis[i].addContentTo(m_sheetName, i, axis);
288 axis.insert("librevenge:chart-id", styleId++);
289 interface->insertChartAxis(axis);
290 }
291 // label
292 for (auto const &textIt : m_textZoneMap) {
293 TextZone const &zone= textIt.second;
294 if (zone.m_type == TextZone::T_Title || zone.m_type == TextZone::T_SubTitle)
295 continue;
296 style=librevenge::RVNGPropertyList();
297 zone.addStyleTo(style, m_fontConverter);
298 style.insert("librevenge:chart-id", styleId);
299 interface->defineChartStyle(style);
300 librevenge::RVNGPropertyList textZone;
301 zone.addContentTo(m_sheetName, textZone);
302 textZone.insert("librevenge:chart-id", styleId++);
303 textZone.insert("librevenge:zone-type", "label");
304 interface->openChartTextObject(textZone);
305 if (zone.m_contentType==TextZone::C_Text) {
306 std::shared_ptr<MWAWSubDocument> doc(new MWAWChartInternal::SubDocument(this, zone.m_type));
307 listener->handleSubDocument(doc, libmwaw::DOC_CHART_ZONE);
308 }
309 interface->closeChartTextObject();
310 }
311 // series
312 for (auto const &serie : m_seriesList) {
313 style=librevenge::RVNGPropertyList();
314 serie.addStyleTo(style);
315 style.insert("librevenge:chart-id", styleId);
316 interface->defineChartStyle(style);
317 librevenge::RVNGPropertyList series;
318 serie.addContentTo(m_sheetName, series);
319 series.insert("librevenge:chart-id", styleId++);
320 interface->openChartSerie(series);
321 interface->closeChartSerie();
322 }
323 interface->closeChartPlotArea();
324
325 interface->closeChart();
326 }
327
328 ////////////////////////////////////////////////////////////
329 // Axis
330 ////////////////////////////////////////////////////////////
331 MWAWChart::Axis::Axis()
332 : m_type(MWAWChart::Axis::A_None)
333 , m_showGrid(true)
334 , m_showLabel(true)
335 , m_labelRange(MWAWVec2i(0,0), MWAWVec2i(-1,-1))
336 , m_style()
337 {
338 m_style.m_lineWidth=0;
339 }
340
341 MWAWChart::Axis::~Axis()
342 {
343 }
344
345 void MWAWChart::Axis::addContentTo(std::string const &sheetName, int coord, librevenge::RVNGPropertyList &propList) const
346 {
347 std::string axis("");
348 axis += char('x'+coord);
349 propList.insert("chart:dimension",axis.c_str());
350 axis = "primary-"+axis;
351 propList.insert("chart:name",axis.c_str());
352 librevenge::RVNGPropertyListVector childs;
353 if (m_showGrid && (m_type==A_Numeric || m_type==A_Logarithmic)) {
354 librevenge::RVNGPropertyList grid;
355 grid.insert("librevenge:type", "grid");
356 grid.insert("chart:class", "major");
357 childs.append(grid);
358 }
359 if (m_showLabel && m_labelRange.size()[0]>=0 && m_labelRange.size()[1]>=0) {
360 librevenge::RVNGPropertyList range;
361 range.insert("librevenge:sheet-name", sheetName.c_str());
362 range.insert("librevenge:start-row", m_labelRange.min()[1]);
363 range.insert("librevenge:start-column", m_labelRange.min()[0]);
364 range.insert("librevenge:end-row", m_labelRange.max()[1]);
365 range.insert("librevenge:end-column", m_labelRange.max()[0]);
366 librevenge::RVNGPropertyListVector vect;
367 vect.append(range);
368 librevenge::RVNGPropertyList categories;
369 categories.insert("librevenge:type", "categories");
370 categories.insert("table:cell-range-address", vect);
371 childs.append(categories);
372 }
373 if (!childs.empty())
374 propList.insert("librevenge:childs", childs);
375 }
376
377 void MWAWChart::Axis::addStyleTo(librevenge::RVNGPropertyList &propList) const
378 {
379 propList.insert("chart:display-label", m_showLabel);
380 propList.insert("chart:axis-position", 0, librevenge::RVNG_GENERIC);
381 propList.insert("chart:reverse-direction", false);
382 propList.insert("chart:logarithmic", m_type==MWAWChart::Axis::A_Logarithmic);
383 propList.insert("text:line-break", false);
384 m_style.addTo(propList, true);
385 }
386
387 std::ostream &operator<<(std::ostream &o, MWAWChart::Axis const &axis)
388 {
389 switch (axis.m_type) {
390 case MWAWChart::Axis::A_None:
391 o << "none,";
392 break;
393 case MWAWChart::Axis::A_Numeric:
394 o << "numeric,";
395 break;
396 case MWAWChart::Axis::A_Logarithmic:
397 o << "logarithmic,";
398 break;
399 case MWAWChart::Axis::A_Sequence:
400 o << "sequence,";
401 break;
402 case MWAWChart::Axis::A_Sequence_Skip_Empty:
403 o << "sequence[noEmpty],";
404 break;
405 #if !defined(__clang__)
406 default:
407 o << "###type,";
408 MWAW_DEBUG_MSG(("MWAWChart::Axis: unexpected type\n"));
409 break;
410 #endif
411 }
412 if (axis.m_showGrid) o << "show[grid],";
413 if (axis.m_showLabel) o << "show[label],";
414 if (axis.m_labelRange.size()[0]>=0 && axis.m_labelRange.size()[1]>=0)
415 o << "label[range]=" << axis.m_labelRange << ",";
416 o << axis.m_style;
417 return o;
418 }
419
420 ////////////////////////////////////////////////////////////
421 // Legend
422 ////////////////////////////////////////////////////////////
423 void MWAWChart::Legend::addContentTo(librevenge::RVNGPropertyList &propList) const
424 {
425 propList.insert("svg:x", double(m_position[0]), librevenge::RVNG_POINT);
426 propList.insert("svg:y", double(m_position[1]), librevenge::RVNG_POINT);
427 if (!m_autoPosition || !m_relativePosition)
428 return;
429 std::stringstream s;
430 if (m_relativePosition&libmwaw::TopBit)
431 s << "top";
432 else if (m_relativePosition&libmwaw::BottomBit)
433 s << "bottom";
434 if (s.str().length() && (m_relativePosition&(libmwaw::LeftBit|libmwaw::RightBit)))
435 s << "-";
436 if (m_relativePosition&libmwaw::LeftBit)
437 s << "start";
438 else if (m_relativePosition&libmwaw::RightBit)
439 s << "end";
440 propList.insert("chart:legend-position", s.str().c_str());
441 }
442
443 void MWAWChart::Legend::addStyleTo(librevenge::RVNGPropertyList &propList, std::shared_ptr<MWAWFontConverter> fontConverter) const
444 {
445 propList.insert("chart:auto-position", m_autoPosition);
446 m_font.addTo(propList, fontConverter);
447 m_style.addTo(propList);
448 }
449
450 std::ostream &operator<<(std::ostream &o, MWAWChart::Legend const &legend)
451 {
452 if (legend.m_show)
453 o << "show,";
454 if (legend.m_autoPosition) {
455 o << "automaticPos[";
456 if (legend.m_relativePosition&libmwaw::TopBit)
457 o << "t";
458 else if (legend.m_relativePosition&libmwaw::RightBit)
459 o << "b";
460 else
461 o << "c";
462 if (legend.m_relativePosition&libmwaw::LeftBit)
463 o << "L";
464 else if (legend.m_relativePosition&libmwaw::BottomBit)
465 o << "R";
466 else
467 o << "C";
468 o << "]";
469 }
470 else
471 o << "pos=" << legend.m_position << ",";
472 o << legend.m_style;
473 return o;
474 }
475
476 ////////////////////////////////////////////////////////////
477 // Serie
478 ////////////////////////////////////////////////////////////
479 MWAWChart::Series::Series()
480 : m_type(MWAWChart::Series::S_Bar)
481 , m_range()
482 , m_style()
483 {
484 m_style.m_lineWidth=0;
485 m_style.setSurfaceColor(MWAWColor(0x80,0x80,0xFF));
486 }
487
488 MWAWChart::Series::~Series()
489 {
490 }
491
492 std::string MWAWChart::Series::getSeriesTypeName(Type type)
493 {
494 switch (type) {
495 case S_Area:
496 return "chart:area";
497 case S_Column:
498 return "chart:column";
499 case S_Line:
500 return "chart:line";
501 case S_Pie:
502 return "chart:pie";
503 case S_Scatter:
504 return "chart:scatter";
505 case S_Stock:
506 return "chart:stock";
507 case S_Bar:
508 return "chart:bar";
509 #if !defined(__clang__)
510 default:
511 break;
512 #endif
513 }
514 return "chart:bar";
515 }
516
517 void MWAWChart::Series::addContentTo(std::string const &sheetName, librevenge::RVNGPropertyList &serie) const
518 {
519 serie.insert("chart:class",getSeriesTypeName(m_type).c_str());
520 librevenge::RVNGPropertyList range, datapoint;
521 range.insert("librevenge:sheet-name", sheetName.c_str());
522 range.insert("librevenge:start-row", m_range.min()[1]);
523 range.insert("librevenge:start-column", m_range.min()[0]);
524 range.insert("librevenge:end-row", m_range.max()[1]);
525 range.insert("librevenge:end-column", m_range.max()[0]);
526 librevenge::RVNGPropertyListVector vect;
527 vect.append(range);
528 serie.insert("chart:values-cell-range-address", vect);
529 vect.clear();
530 int numPt=m_range.size()[0]>m_range.size()[1] ?
531 m_range.size()[0]+1 : m_range.size()[1]+1;
532 datapoint.insert("librevenge:type", "data-point");
533 datapoint.insert("chart:repeated", numPt);
534 vect.append(datapoint);
535 serie.insert("librevenge:childs", vect);
536 }
537
538 void MWAWChart::Series::addStyleTo(librevenge::RVNGPropertyList &propList) const
539 {
540 m_style.addTo(propList);
541 }
542
543 std::ostream &operator<<(std::ostream &o, MWAWChart::Series const &series)
544 {
545 switch (series.m_type) {
546 case MWAWChart::Series::S_Area:
547 o << "area,";
548 break;
549 case MWAWChart::Series::S_Bar:
550 o << "bar,";
551 break;
552 case MWAWChart::Series::S_Column:
553 o << "column,";
554 break;
555 case MWAWChart::Series::S_Line:
556 o << "line,";
557 break;
558 case MWAWChart::Series::S_Pie:
559 o << "pie,";
560 break;
561 case MWAWChart::Series::S_Scatter:
562 o << "scatter,";
563 break;
564 case MWAWChart::Series::S_Stock:
565 o << "stock,";
566 break;
567 #if !defined(__clang__)
568 default:
569 o << "###type,";
570 MWAW_DEBUG_MSG(("MWAWChart::Series: unexpected type\n"));
571 break;
572 #endif
573 }
574 o << "range=" << series.m_range << ",";
575 o << series.m_style;
576 return o;
577 }
578
579 ////////////////////////////////////////////////////////////
580 // TextZone
581 ////////////////////////////////////////////////////////////
582 MWAWChart::TextZone::TextZone()
583 : m_type(MWAWChart::TextZone::T_Title)
584 , m_contentType(MWAWChart::TextZone::C_Cell)
585 , m_position(-1,-1)
586 , m_cell()
587 , m_textEntry()
588 , m_font()
589 , m_style()
590 {
591 m_style.m_lineWidth=0;
592 }
593
594 MWAWChart::TextZone::~TextZone()
595 {
596 }
597
598 void MWAWChart::TextZone::addContentTo(std::string const &sheetName, librevenge::RVNGPropertyList &propList) const
599 {
600 if (m_position[0]>=0 && m_position[1]>=0) {
601 propList.insert("svg:x", double(m_position[0]), librevenge::RVNG_POINT);
602 propList.insert("svg:y", double(m_position[1]), librevenge::RVNG_POINT);
603 }
604 switch (m_type) {
605 case T_Title:
606 propList.insert("librevenge:zone-type", "title");
607 break;
608 case T_SubTitle:
609 propList.insert("librevenge:zone-type", "subtitle");
610 break;
611 case T_AxisX:
612 case T_AxisY:
613 case T_AxisZ:
614 propList.insert("librevenge:zone-type", "label");
615 return;
616 #if !defined(__clang__)
617 default:
618 MWAW_DEBUG_MSG(("MWAWChart::TextZone:addContentTo: unexpected type\n"));
619 break;
620 #endif
621 }
622 if (m_contentType==C_Cell) {
623 librevenge::RVNGPropertyList range;
624 librevenge::RVNGPropertyListVector vect;
625 range.insert("librevenge:sheet-name", sheetName.c_str());
626 range.insert("librevenge:row", m_cell[1]);
627 range.insert("librevenge:column", m_cell[0]);
628 vect.append(range);
629 propList.insert("table:cell-range", vect);
630 }
631 }
632
633 void MWAWChart::TextZone::addStyleTo(librevenge::RVNGPropertyList &propList, std::shared_ptr<MWAWFontConverter> fontConverter) const
634 {
635 m_font.addTo(propList, fontConverter);
636 m_style.addTo(propList);
637 }
638
639 std::ostream &operator<<(std::ostream &o, MWAWChart::TextZone const &zone)
640 {
641 switch (zone.m_type) {
642 case MWAWChart::TextZone::T_SubTitle:
643 o << "sub";
644 MWAW_FALLTHROUGH;
645 case MWAWChart::TextZone::T_Title:
646 o << "title";
647 if (zone.m_contentType==MWAWChart::TextZone::C_Cell)
648 o << "[" << zone.m_cell << "]";
649 o << ",";
650 break;
651 case MWAWChart::TextZone::T_AxisX:
652 case MWAWChart::TextZone::T_AxisY:
653 case MWAWChart::TextZone::T_AxisZ:
654 if (zone.m_type==MWAWChart::TextZone::T_AxisX)
655 o << "axisX";
656 else if (zone.m_type==MWAWChart::TextZone::T_AxisY)
657 o << "axisY";
658 else
659 o << "axisZ";
660 if (zone.m_contentType==MWAWChart::TextZone::C_Cell)
661 o << "[cells]";
662 o << ",";
663 break;
664 #if !defined(__clang__)
665 default:
666 o << "###type,";
667 MWAW_DEBUG_MSG(("MWAWChart::TextZone: unexpected type\n"));
668 break;
669 #endif
670 }
671 if (zone.m_contentType==MWAWChart::TextZone::C_Text)
672 o << "text,";
673 if (zone.m_position[0]>0 || zone.m_position[1]>0)
674 o << "pos=" << zone.m_position << ",";
675 o << zone.m_style;
676 return o;
677 }
678
679 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: