kchart

KDChartParams_io.cpp
1/*
2 KDChart - a multi-platform charting engine
3 */
4
5/****************************************************************************
6 ** Copyright (C) 2001-2003 Klarälvdalens Datakonsult AB. All rights reserved.
7 **
8 ** This file is part of the KDChart library.
9 **
10 ** This file may be distributed and/or modified under the terms of the
11 ** GNU General Public License version 2 as published by the Free Software
12 ** Foundation and appearing in the file LICENSE.GPL included in the
13 ** packaging of this file.
14 **
15 ** Licensees holding valid commercial KDChart licenses may use this file in
16 ** accordance with the KDChart Commercial License Agreement provided with
17 ** the Software.
18 **
19 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 **
22 ** See http://www.klaralvdalens-datakonsult.se/?page=products for
23 ** information about KDChart Commercial License Agreements.
24 **
25 ** Contact info@klaralvdalens-datakonsult.se if any conditions of this
26 ** licensing are not clear to you.
27 **
28 **********************************************************************/
29#include "KDChartParams.h"
30#include <KDXMLTools.h>
31
32#include <tqintdict.h>
33
43TQTextStream& operator<<( TQTextStream& s, const KDChartParams& p )
44{
45 TQDomDocument document = p.saveXML();
46 s << document.toString();
47
48 return s;
49}
50
55void KDChartParams::saveAxesToXML(TQDomDocument& doc, TQDomElement& docRoot) const
56{
57 // the AxisSettings elements
58 for( int axis = 0; axis < 13; axis++ ) {
59 TQDomElement axisSettingsElement =
60 doc.createElement( "AxisSettings" );
61 docRoot.appendChild( axisSettingsElement );
62 axisSettingsElement.setAttribute( "Dataset",
63 _axisSettings[axis].dataset );
64 axisSettingsElement.setAttribute( "Dataset2",
65 _axisSettings[axis].dataset2 );
66 axisSettingsElement.setAttribute( "Chart",
67 _axisSettings[axis].chart );
68 {
69 // the Type element
70 KDXML::createStringNode( doc, axisSettingsElement, "Type",
71 KDChartAxisParams::axisTypeToString( _axisSettings[axis].params._axisType ) );
72
73 // the Visible element
74 KDXML::createBoolNode( doc, axisSettingsElement, "Visible",
75 _axisSettings[axis].params._axisVisible );
76
77 // the LabelsTouchEdges element
78 KDXML::createBoolNode( doc, axisSettingsElement, "LabelsTouchEdges",
79 _axisSettings[axis].params._axisLabelsTouchEdges );
80
81 // the AreaMode element
82 KDXML::createStringNode( doc, axisSettingsElement, "AreaMode",
83 KDChartAxisParams::axisAreaModeToString( _axisSettings[axis].params._axisAreaMode ) );
84
85 // the UseAvailableSpaceFrom element
86 KDXML::createIntNode( doc, axisSettingsElement, "UseAvailableSpaceFrom",
87 _axisSettings[axis].params._axisUseAvailableSpaceFrom );
88
89 // the UseAvailableSpaceTo element
90 KDXML::createIntNode( doc, axisSettingsElement, "UseAvailableSpaceTo",
91 _axisSettings[axis].params._axisUseAvailableSpaceTo );
92
93 // the IsometricReferenceAxis element
94 KDXML::createIntNode( doc, axisSettingsElement, "IsometricReferenceAxis",
95 _axisSettings[axis].params._axisIsoRefAxis );
96
97 // the AreaMin element
98 KDXML::createIntNode( doc, axisSettingsElement, "AreaMin",
99 _axisSettings[axis].params._axisAreaMin );
100
101 // the AreaMax element
102 KDXML::createIntNode( doc, axisSettingsElement, "AreaMax",
103 _axisSettings[axis].params._axisAreaMax );
104
105 // the CalcMode element
106 KDXML::createStringNode( doc, axisSettingsElement, "CalcMode",
107 KDChartAxisParams::axisCalcModeToString( _axisSettings[axis].params._axisCalcMode ) );
108
109 // the TrueAreaSize element
110 KDXML::createIntNode( doc, axisSettingsElement, "TrueAreaSize",
111 _axisSettings[axis].params._axisTrueAreaSize );
112
113 // the TrueAreaRect element
114 KDXML::createRectNode( doc, axisSettingsElement, "TrueAreaRect",
115 _axisSettings[axis].params._axisTrueAreaRect );
116
117 // the ShowSubDelimiters element
118 KDXML::createBoolNode( doc, axisSettingsElement, "ShowSubDelimiters",
119 _axisSettings[axis].params._axisShowSubDelimiters );
120
121 // the LineVisible element
122 KDXML::createBoolNode( doc, axisSettingsElement, "LineVisible",
123 _axisSettings[axis].params._axisLineVisible );
124
125 // the LineWidth element
126 KDXML::createIntNode( doc, axisSettingsElement, "LineWidth",
127 _axisSettings[axis].params._axisLineWidth );
128
129 // the TrueLineWidth element
130 KDXML::createIntNode( doc, axisSettingsElement, "TrueLineWidth",
131 _axisSettings[axis].params._axisTrueLineWidth );
132
133 // the LineColor element
134 KDXML::createColorNode( doc, axisSettingsElement, "LineColor",
135 _axisSettings[axis].params._axisLineColor );
136
137 // the ShowGrid element
138 KDXML::createBoolNode( doc, axisSettingsElement, "ShowGrid",
139 _axisSettings[axis].params._axisShowGrid );
140
141 // the GridColor element
142 KDXML::createColorNode( doc, axisSettingsElement, "GridColor",
143 _axisSettings[axis].params._axisGridColor );
144
145 // the GridLineWidth element
146 KDXML::createIntNode( doc, axisSettingsElement, "GridLineWidth",
147 _axisSettings[axis].params._axisGridLineWidth );
148
149 // the GridStyle element
150 KDXML::createStringNode( doc, axisSettingsElement, "GridStyle",
151 KDXML::penStyleToString( _axisSettings[axis].params._axisGridStyle ) );
152
153 // the GridSubColor element
154 KDXML::createColorNode( doc, axisSettingsElement, "GridSubColor",
155 _axisSettings[axis].params._axisGridSubColor );
156
157 // the GridSubLineWidth element
158 KDXML::createIntNode( doc, axisSettingsElement, "GridSubLineWidth",
159 _axisSettings[axis].params._axisGridSubLineWidth );
160
161 // the GridSubStyle element
162 KDXML::createStringNode( doc, axisSettingsElement, "GridSubStyle",
163 KDXML::penStyleToString( _axisSettings[axis].params._axisGridSubStyle ) );
164
165 // the ZeroLineColor element
166 KDXML::createColorNode( doc, axisSettingsElement, "ZeroLineColor",
167 _axisSettings[axis].params._axisZeroLineColor );
168
169 // the LabelsVisible element
170 KDXML::createBoolNode( doc, axisSettingsElement, "LabelsVisible",
171 _axisSettings[axis].params._axisLabelsVisible );
172
173 // the LabelsFont element
174 createChartFontNode( doc, axisSettingsElement, "LabelsFont",
175 _axisSettings[axis].params._axisLabelsFont,
176 _axisSettings[axis].params._axisLabelsFontUseRelSize,
177 _axisSettings[axis].params._axisLabelsFontRelSize,
178 _axisSettings[axis].params._axisLabelsFontMinSize );
179
180 // the LabelsDontShrinkFont element
181 KDXML::createBoolNode( doc, axisSettingsElement, "LabelsDontShrinkFont",
182 _axisSettings[axis].params._axisLabelsDontShrinkFont );
183
184 // the LabelsDontAutoRotate element
185 KDXML::createBoolNode( doc, axisSettingsElement, "LabelsDontAutoRotate",
186 _axisSettings[axis].params._axisLabelsDontAutoRotate );
187
188 // the LabelsRotation element
189 KDXML::createIntNode( doc, axisSettingsElement, "LabelsRotation",
190 _axisSettings[axis].params._axisLabelsRotation );
191
192 // the LabelsLeaveOut element
193 KDXML::createIntNode( doc, axisSettingsElement, "LabelsLeaveOut",
194 _axisSettings[axis].params._axisValueLeaveOut );
195
196 // the LabelsColor element
197 KDXML::createColorNode( doc, axisSettingsElement, "LabelsColor",
198 _axisSettings[axis].params._axisLabelsColor );
199
200 // the SteadyValueCalc element
201 KDXML::createBoolNode( doc, axisSettingsElement, "SteadyValueCalc",
202 _axisSettings[axis].params._axisSteadyValueCalc );
203
204 // the ValueStart element
205 if( ! ( KDCHART_AXIS_LABELS_AUTO_LIMIT == _axisSettings[axis].params._axisValueStart ))
206 createChartValueNode( doc, axisSettingsElement, "ValueStart",
207 _axisSettings[axis].params._axisValueStart,
208 0.0,
209 0 );
210
211 // the ValueStartIsExact element
212 KDXML::createBoolNode( doc, axisSettingsElement, "ValueStartIsExact",
213 _axisSettings[axis].params._axisValueStartIsExact );
214
215 // the ValueEnd element
216 if( ! ( KDCHART_AXIS_LABELS_AUTO_LIMIT == _axisSettings[axis].params._axisValueEnd ))
217 createChartValueNode( doc, axisSettingsElement, "ValueEnd",
218 _axisSettings[axis].params._axisValueEnd,
219 0.0,
220 0 );
221
222 // the ValueDelta element
223 if( ! ( KDCHART_AXIS_LABELS_AUTO_DELTA == _axisSettings[axis].params._axisValueDelta ))
224 KDXML::createDoubleNode( doc, axisSettingsElement, "ValueDelta",
225 _axisSettings[axis].params._axisValueDelta );
226 KDXML::createIntNode( doc, axisSettingsElement, "ValueDeltaScale",
227 _axisSettings[axis].params._axisValueDeltaScale );
228
229 // the ValuesDecreasing element
230 KDXML::createBoolNode( doc, axisSettingsElement, "ValuesDecreasing",
231 _axisSettings[axis].params._axisValuesDecreasing );
232
233 // the TrueLow element
234 KDXML::createDoubleNode( doc, axisSettingsElement, "TrueLow",
235 _axisSettings[axis].params._trueLow );
236
237 // the TrueHigh element
238 KDXML::createDoubleNode( doc, axisSettingsElement, "TrueHigh",
239 _axisSettings[axis].params._trueHigh );
240
241 // the TrueDelta element
242 KDXML::createDoubleNode( doc, axisSettingsElement, "TrueDelta",
243 _axisSettings[axis].params._trueDelta );
244
245 // the ZeroLineStart element
246 TQDomElement zeroLineStartElement = doc.createElement( "ZeroLineStart" );
247 axisSettingsElement.appendChild( zeroLineStartElement );
248 zeroLineStartElement.setAttribute( "X", _axisSettings[axis].params._axisZeroLineStartX );
249 zeroLineStartElement.setAttribute( "Y", _axisSettings[axis].params._axisZeroLineStartY );
250
251 // the DigitsBehindComma element
252 KDXML::createIntNode( doc, axisSettingsElement, "DigitsBehindComma",
253 _axisSettings[axis].params._axisDigitsBehindComma );
254
255 // the LabelsDateTimeFormat element
256 KDXML::createStringNode( doc, axisSettingsElement, "LabelsDateTimeFormat",
257 _axisSettings[axis].params._axisLabelsDateTimeFormat );
258
259 // the MaxEmptyInnerSpan element
260 KDXML::createIntNode( doc, axisSettingsElement, "MaxEmptyInnerSpan",
261 _axisSettings[axis].params._axisMaxEmptyInnerSpan );
262
263 // the LabelsFromDataRow element
264 KDXML::createStringNode( doc, axisSettingsElement, "LabelsFromDataRow",
265 KDChartAxisParams::labelsFromDataRowToString( _axisSettings[axis].params._takeLabelsFromDataRow ) );
266
267 // the TextsDataRow element
268 KDXML::createIntNode( doc, axisSettingsElement, "TextsDataRow",
269 _axisSettings[axis].params._labelTextsDataRow );
270
271 // the LabelString elements
272 KDXML::createStringListNodes( doc, axisSettingsElement, "LabelString",
273 &_axisSettings[axis].params._axisLabelStringList );
274
275 // the ShortLabelString elements
276 KDXML::createStringListNodes( doc, axisSettingsElement, "ShortLabelString",
277 &_axisSettings[axis].params._axisShortLabelsStringList );
278
279 // the LabelText elements
280 KDXML::createStringListNodes( doc, axisSettingsElement, "LabelText",
281 &_axisSettings[axis].params._axisLabelTexts );
282
283 // the LabelTextsDirty element
284 KDXML::createBoolNode( doc, axisSettingsElement, "LabelTextsDirty",
285 _axisSettings[axis].params._axisLabelTextsDirty );
286
287 // labels formatting:
288
289 // the extra FirstLabelText element
290 KDXML::createStringNode( doc, axisSettingsElement, "FirstLabelReplacementText",
291 _axisSettings[axis].params._axisFirstLabelText );
292
293 // the extra LastLabelText element
294 KDXML::createStringNode( doc, axisSettingsElement, "LastLabelReplacementText",
295 _axisSettings[axis].params._axisLastLabelText );
296
297 // the LabelsDivPow10 element
298 KDXML::createIntNode( doc, axisSettingsElement, "LabelsDivPow10",
299 _axisSettings[axis].params._axisLabelsDivPow10 );
300
301 // the LabelsDecimalPoint element
302 KDXML::createStringNode( doc, axisSettingsElement, "LabelsDecimalPoint",
303 _axisSettings[axis].params._axisLabelsDecimalPoint );
304
305 // the LabelsThousandsPoint element
306 KDXML::createStringNode( doc, axisSettingsElement, "LabelsThousandsPoint",
307 _axisSettings[axis].params._axisLabelsThousandsPoint );
308
309 // the LabelsNotation element
310 KDXML::createStringNode( doc, axisSettingsElement, "LabelsNotation",
311 KDChartEnums::numberNotationToString( _axisSettings[axis].params._axisLabelsNotation ) );
312
313 // the LabelsPrefix element
314 KDXML::createStringNode( doc, axisSettingsElement, "LabelsPrefix",
315 _axisSettings[axis].params._axisLabelsPrefix );
316
317 // the LabelsPostfix element
318 KDXML::createStringNode( doc, axisSettingsElement, "LabelsPostfix",
319 _axisSettings[axis].params._axisLabelsPostfix );
320
321 // the LabelsTotalLen element
322 KDXML::createIntNode( doc, axisSettingsElement, "LabelsTotalLen",
323 _axisSettings[axis].params._axisLabelsTotalLen );
324
325 // the LabelsPadFill element
326 KDXML::createStringNode( doc, axisSettingsElement, "LabelsPadFill",
327 _axisSettings[axis].params._axisLabelsPadFill );
328
329 // the LabelsBlockAlign element
330 KDXML::createBoolNode( doc, axisSettingsElement, "LabelsBlockAlign",
331 _axisSettings[axis].params._axisLabelsBlockAlign );
332 }
333 }
334}
335
336
343TQDomDocument KDChartParams::saveXML( bool withPI ) const
344{
345 // Create an inital DOM document
346 TQString docstart = "<ChartParams/>";
347
348 TQDomDocument doc( "ChartParams" );
349 doc.setContent( docstart );
350 if( withPI )
351 doc.appendChild( doc.createProcessingInstruction( "xml", "version=\"1.0\" encoding=\"UTF-8\"" ) );
352
353 TQDomElement docRoot = doc.documentElement();
354 docRoot.setAttribute( "xmlns", "http://www.klaralvdalens-datakonsult.se/kdchart" );
355 docRoot.setAttribute( "xmlns:xsi", "http://www.w3.org/2000/10/XMLSchema-instance" );
356 docRoot.setAttribute( "xsi:schemaLocation", "http://www.klaralvdalens-datakonsult.se/kdchart" );
357
358 // the ChartType element
359 TQDomElement chartTypeElement = doc.createElement( "ChartType" );
360 docRoot.appendChild( chartTypeElement );
361 chartTypeElement.setAttribute( "primary",
362 chartTypeToString( _chartType ) );
363 chartTypeElement.setAttribute( "secondary",
364 chartTypeToString( _additionalChartType ) );
365
366
367 // the NumValues element
368 KDXML::createIntNode( doc, docRoot, "NumValues", _numValues );
369
370 // the ModeAndChartMap element
371 TQDomElement modeAndChartMapElement =
372 doc.createElement( "ModeAndChartMap" );
373 docRoot.appendChild( modeAndChartMapElement );
374 for( TQMap<uint,KDChartParams::ModeAndChart>::ConstIterator it = _dataSourceModeAndChart.begin();
375 it != _dataSourceModeAndChart.end(); ++it ) {
376 // Dataset element
377 TQDomElement datasetElement = doc.createElement( "Dataset" );
378 TQDomText datasetContent =
379 doc.createTextNode( TQString::number( it.key() ) );
380 datasetElement.appendChild( datasetContent );
381 modeAndChartMapElement.appendChild( datasetElement );
382 // ModeAndChart element
383 TQDomElement modeAndChartElement = doc.createElement( "ModeAndChart" );
384 modeAndChartElement.setAttribute( "Mode", chartSourceModeToString( it.data().mode() ) );
385 modeAndChartElement.setAttribute( "Chart", it.data().chart() );
386 modeAndChartMapElement.appendChild( modeAndChartElement );
387 }
388
389 // the PropertySetMap element
390 TQDomElement propertySetMapElement =
391 doc.createElement( "PropertySetMap" );
392 docRoot.appendChild( propertySetMapElement );
393 TQIntDictIterator<KDChartPropertySet> it2( _propertySetList );
394 for( ; it2.current(); ++it2 )
395 propertySetMapElement.appendChild( it2.current()->saveXML( doc ) );
396
397 KDXML::createBoolNode( doc, docRoot, "ChartSourceModeWasUsed",
398 _setChartSourceModeWasUsed );
399
400 // the MaxDatasetSourceMode element
401 KDXML::createIntNode( doc, docRoot, "MaxDatasetSourceMode",
402 _maxDatasetSourceMode );
403
404 // the ColorSettings element
405 TQDomElement colorSettingsElement =
406 doc.createElement( "ColorSettings" );
407 docRoot.appendChild( colorSettingsElement );
408
409 {
410 // the DataColors element
411 createColorMapNode( doc, colorSettingsElement,
412 "DataColors", _dataColors );
413
414 // the MaxDatasetColor element
415 KDXML::createIntNode( doc, colorSettingsElement, "MaxDatasetColor",
416 _maxDatasetColor );
417
418 // the ShadowBrightnessFactor element
419 KDXML::createDoubleNode( doc, colorSettingsElement,
420 "ShadowBrightnessFactor",
421 _shadowBrightnessFactor );
422
423 // the ShadowPattern element
424 KDXML::createStringNode( doc, colorSettingsElement,
425 "ShadowPattern",
426 KDXML::brushStyleToString(_shadowPattern ) );
427
428 // the ThreeDShadowColors element
429 KDXML::createBoolNode( doc, colorSettingsElement,
430 "ThreeDShadowColors",
431 _threeDShadowColors );
432
433 // the DataColorsShadow1 element
434 createColorMapNode( doc, colorSettingsElement,
435 "DataColorsShadow1",
436 _dataColorsShadow1 );
437
438 // the DataColorsShadow2 element
439 createColorMapNode( doc, colorSettingsElement,
440 "DataColorsShadow2",
441 _dataColorsShadow2 );
442
443 // the OutlineDataColor element
444 KDXML::createColorNode( doc, colorSettingsElement,
445 "OutlineDataColor",
446 _outlineDataColor );
447
448 // the OutlineDataLineWidth element
449 KDXML::createIntNode( doc, colorSettingsElement,
450 "OutlineDataLineWidth",
451 _outlineDataLineWidth );
452
453 // the OutlineDataLineStyle element
454 TQDomElement outlineDataLineStyleElement =
455 doc.createElement( "OutlineDataLineStyle" );
456 colorSettingsElement.appendChild( outlineDataLineStyleElement );
457 outlineDataLineStyleElement.setAttribute( "Style",
458 KDXML::penStyleToString( _outlineDataLineStyle ) );
459 }
460
461
462 // the BarSettings elemenet
463 TQDomElement barSettingsElement =
464 doc.createElement( "BarSettings" );
465 docRoot.appendChild( barSettingsElement );
466
467 {
468 // the SubType element
469 KDXML::createStringNode( doc, barSettingsElement,
470 "SubType", KDChartParams::barChartSubTypeToString( _barChartSubType ) );
471
472 KDXML::createBoolNode( doc, barSettingsElement,
473 "ThreeDBars", _threeDBars );
474
475 KDXML::createDoubleNode( doc, barSettingsElement,
476 "ThreeDBarDepth", _threeDBarDepth );
477
478 KDXML::createIntNode( doc, barSettingsElement,
479 "DatasetGap", _datasetGap );
480
481 KDXML::createBoolNode( doc, barSettingsElement,
482 "DatasetGapIsRelative", _datasetGapIsRelative );
483
484 KDXML::createIntNode( doc, barSettingsElement,
485 "ValueBlockGap", _valueBlockGap );
486
487 KDXML::createBoolNode( doc, barSettingsElement,
488 "ValueBlockGapIsRelative",
489 _valueBlockGapIsRelative );
490
491 KDXML::createIntNode( doc, barSettingsElement,
492 "BarWidth", _barWidth );
493
494 KDXML::createBoolNode( doc, barSettingsElement,
495 "SolidExcessArrows", _solidExcessArrows );
496 }
497
498
499 // the LineSettings element
500 TQDomElement lineSettingsElement =
501 doc.createElement( "LineSettings" );
502 docRoot.appendChild( lineSettingsElement );
503
504 {
505 // the SubType element
506 KDXML::createStringNode( doc, lineSettingsElement,
507 "SubType", KDChartParams::lineChartSubTypeToString( _lineChartSubType ) );
508
509 // the Marker element
510 KDXML::createBoolNode( doc, lineSettingsElement,
511 "Marker", _lineMarker );
512
513 // the MarkerStyles elements
514 {for( TQMap<uint,KDChartParams::LineMarkerStyle>::ConstIterator it = _lineMarkerStyles.begin();
515 it != _lineMarkerStyles.end(); ++it ) {
516 TQDomElement markerStyleElement = doc.createElement( "MarkerStyle" );
517 lineSettingsElement.appendChild( markerStyleElement );
518 markerStyleElement.setAttribute( "Dataset", it.key() );
519 markerStyleElement.setAttribute( "Style", KDChartParams::lineMarkerStyleToString( it.data() ) );
520 }}
521
522 // the MarkerSize element
523 KDXML::createSizeNode( doc, lineSettingsElement,
524 "MarkerSize", _lineMarkerSize );
525
526 // the LineWidth element
527 KDXML::createIntNode( doc, lineSettingsElement,
528 "LineWidth", _lineWidth );
529
530 // the LineColor element
531 KDXML::createColorNode( doc, lineSettingsElement,
532 "LineColor",
533 _lineColor );
534
535 // the LineStyle element
536 TQDomElement lineStyleElement =
537 doc.createElement( "LineStyle" );
538 lineSettingsElement.appendChild( lineStyleElement );
539 lineStyleElement.setAttribute( "Style",
540 KDXML::penStyleToString( _lineStyle ) );
541
542 // the DatasetLineStyles elements
543 {for( TQMap<uint, TQt::PenStyle>::ConstIterator it = _datasetLineStyles.begin();
544 it != _datasetLineStyles.end(); ++it ) {
545 TQDomElement lineStyleElement = doc.createElement( "DatasetLineStyle" );
546 lineSettingsElement.appendChild( lineStyleElement );
547 lineStyleElement.setAttribute( "Dataset", it.key() );
548 lineStyleElement.setAttribute( "Style", KDXML::penStyleToString( it.data() ) );
549 }}
550
551 // the ThreeD element
552 KDXML::createBoolNode( doc, lineSettingsElement,
553 "ThreeD", _threeDLines );
554
555 // the ThreeDDepth element
556 KDXML::createIntNode( doc, lineSettingsElement,
557 "ThreeDDepth", _threeDLineDepth );
558
559 // the ThreeDXRotation element
560 KDXML::createIntNode( doc, lineSettingsElement,
561 "ThreeDXRotation", _threeDLineXRotation );
562
563 // the ThreeDYRotation element
564 KDXML::createIntNode( doc, lineSettingsElement,
565 "ThreeDYRotation", _threeDLineYRotation );
566 }
567
568
569 // the AreaSettings element
570 TQDomElement areaSettingsElement =
571 doc.createElement( "AreaSettings" );
572 docRoot.appendChild( areaSettingsElement );
573
574 {
575 // the SubType element
576 KDXML::createStringNode( doc, areaSettingsElement, "SubType",
577 KDChartParams::areaChartSubTypeToString( _areaChartSubType ) );
578
579 // the Location elemenet
580 KDXML::createStringNode( doc, areaSettingsElement, "Location",
581 KDChartParams::areaLocationToString( _areaLocation ) );
582 }
583
584
585 // the PieRingSettings element
586 TQDomElement pieRingSettingsElement =
587 doc.createElement( "PieRingSettings" );
588 docRoot.appendChild( pieRingSettingsElement );
589
590 {
591 // the Explode element
592 KDXML::createBoolNode( doc, pieRingSettingsElement, "Explode",
593 _explode );
594
595 // the DefaultExplodeFactor element
596 KDXML::createDoubleNode( doc, pieRingSettingsElement, "DefaultExplodeFactor",
597 _explodeFactor );
598
599 // the ExplodeFactors element
600 createDoubleMapNode( doc, pieRingSettingsElement, "ExplodeFactors",
601 _explodeFactors );
602
603 // the ExplodeSegment element
604 for( TQValueList<int>::ConstIterator it = _explodeList.begin();
605 it != _explodeList.end(); ++it )
606 KDXML::createIntNode( doc, pieRingSettingsElement,
607 "ExplodeSegment", *it );
608
609 // the ThreeDPies element
610 KDXML::createBoolNode( doc, pieRingSettingsElement, "ThreeDPies",
611 _threeDPies );
612
613 // the ThreeDPieHeight element
614 KDXML::createIntNode( doc, pieRingSettingsElement, "ThreeDPieHeight",
615 _threeDPieHeight );
616
617 // the PieStart element
618 KDXML::createIntNode( doc, pieRingSettingsElement, "PieStart",
619 _pieStart );
620
621 // the RingStart element
622 KDXML::createIntNode( doc, pieRingSettingsElement, "RingStart",
623 _ringStart );
624
625 // the RelativeRingThickness element
626 KDXML::createBoolNode( doc, pieRingSettingsElement,
627 "RelativeRingThickness", _relativeRingThickness );
628 }
629
630 // the HiLoSettings element
631 TQDomElement hiLoSettingsElement =
632 doc.createElement( "HiLoSettings" );
633 docRoot.appendChild( hiLoSettingsElement );
634 {
635 // the SubType element
636 KDXML::createStringNode( doc, hiLoSettingsElement, "SubType",
637 KDChartParams::hiLoChartSubTypeToString( _hiLoChartSubType ) );
638
639 // the PrintLowValues element
640 KDXML::createBoolNode( doc, hiLoSettingsElement, "PrintLowValues",
641 _hiLoChartPrintLowValues );
642
643 // the LowValuesFont element
644 createChartFontNode( doc, hiLoSettingsElement, "LowValuesFont",
645 _hiLoChartLowValuesFont,
646 _hiLoChartLowValuesUseFontRelSize,
647 _hiLoChartLowValuesFontRelSize );
648
649 // the LowValuesColor element
650 KDXML::createColorNode( doc, hiLoSettingsElement, "LowValuesColor",
651 _hiLoChartLowValuesColor );
652
653 // the PrintHighValues element
654 KDXML::createBoolNode( doc, hiLoSettingsElement, "PrintHighValues",
655 _hiLoChartPrintHighValues );
656
657 // the HighValuesFont element
658 createChartFontNode( doc, hiLoSettingsElement, "HighValuesFont",
659 _hiLoChartHighValuesFont,
660 _hiLoChartHighValuesUseFontRelSize,
661 _hiLoChartHighValuesFontRelSize );
662
663 // the HighValuesColor element
664 KDXML::createColorNode( doc, hiLoSettingsElement, "HighValuesColor",
665 _hiLoChartHighValuesColor );
666
667 // the PrintOpenValues element
668 KDXML::createBoolNode( doc, hiLoSettingsElement, "PrintOpenValues",
669 _hiLoChartPrintOpenValues );
670
671 // the OpenValuesFont element
672 createChartFontNode( doc, hiLoSettingsElement, "OpenValuesFont",
673 _hiLoChartOpenValuesFont,
674 _hiLoChartOpenValuesUseFontRelSize,
675 _hiLoChartOpenValuesFontRelSize );
676
677 // the OpenValuesColor element
678 KDXML::createColorNode( doc, hiLoSettingsElement, "OpenValuesColor",
679 _hiLoChartOpenValuesColor );
680
681 // the PrintCloseValues element
682 KDXML::createBoolNode( doc, hiLoSettingsElement, "PrintCloseValues",
683 _hiLoChartPrintCloseValues );
684
685 // the CloseValuesFont element
686 createChartFontNode( doc, hiLoSettingsElement, "CloseValuesFont",
687 _hiLoChartCloseValuesFont,
688 _hiLoChartCloseValuesUseFontRelSize,
689 _hiLoChartCloseValuesFontRelSize );
690
691 // the CloseValuesColor element
692 KDXML::createColorNode( doc, hiLoSettingsElement, "CloseValuesColor",
693 _hiLoChartCloseValuesColor );
694 }
695
696
697
698 // the BoxAndWhiskerSettings element
699 TQDomElement bWSettingsElement =
700 doc.createElement( "BoxAndWhiskerSettings" );
701 docRoot.appendChild( bWSettingsElement );
702 {
703 // the SubType element
704 KDXML::createStringNode( doc, bWSettingsElement, "SubType",
705 KDChartParams::bWChartSubTypeToString( _BWChartSubType ) );
706
707 // the fences elements
708 KDXML::createDoubleNode( doc, bWSettingsElement, "FenceUpperInner",
709 _BWChartFenceUpperInner );
710 KDXML::createDoubleNode( doc, bWSettingsElement, "FenceLowerInner",
711 _BWChartFenceLowerInner );
712 KDXML::createDoubleNode( doc, bWSettingsElement, "FenceUpperOuter",
713 _BWChartFenceUpperInner );
714 KDXML::createDoubleNode( doc, bWSettingsElement, "FenceLowerOuter",
715 _BWChartFenceLowerOuter );
716
717 // the brush to be used
718 KDXML::createBrushNode( doc, bWSettingsElement, "Brush",
719 _BWChartBrush );
720
721 // the size of the outlier markers
722 KDXML::createIntNode( doc, bWSettingsElement, "OutlierSize",
723 _BWChartOutValMarkerSize );
724
725 // the PrintStatistics elements
726 for( int i = BWStatValSTART; i <= BWStatValEND; ++i ){
727 TQDomElement printStatElement =
728 doc.createElement( "PrintStatistics"+bWChartStatValToString( (BWStatVal)i ) );
729 KDXML::createBoolNode( doc, printStatElement, "Active",
730 _BWChartStatistics[ i ].active );
731 createChartFontNode( doc, printStatElement, "Font",
732 _BWChartStatistics[ i ].font,
733 _BWChartStatistics[ i ].useRelSize,
734 _BWChartStatistics[ i ].relSize );
735 KDXML::createColorNode( doc, printStatElement, "Color",
736 _BWChartStatistics[ i ].color );
737 KDXML::createBrushNode( doc, printStatElement, "Brush",
738 _BWChartStatistics[ i ].brush );
739 }
740 }
741
742
743
744 // the PolarSettings element
745 TQDomElement polarSettingsElement =
746 doc.createElement( "PolarSettings" );
747 docRoot.appendChild( polarSettingsElement );
748
749 {
750 // the SubType element
751 KDXML::createStringNode( doc, polarSettingsElement,
752 "SubType", KDChartParams::polarChartSubTypeToString( _polarChartSubType ) );
753
754 // the Marker element
755 KDXML::createBoolNode( doc, polarSettingsElement,
756 "Marker", _polarMarker );
757
758 // the MarkerStyles elements
759 for( TQMap<uint,KDChartParams::PolarMarkerStyle>::ConstIterator it = _polarMarkerStyles.begin();
760 it != _polarMarkerStyles.end(); ++it ) {
761 TQDomElement markerStyleElement = doc.createElement( "MarkerStyle" );
762 polarSettingsElement.appendChild( markerStyleElement );
763 markerStyleElement.setAttribute( "Dataset", it.key() );
764 markerStyleElement.setAttribute( "Style", KDChartParams::polarMarkerStyleToString( it.data() ) );
765 }
766
767 // the MarkerSize element
768 KDXML::createSizeNode( doc, polarSettingsElement,
769 "MarkerSize", _polarMarkerSize );
770
771 // the PolarLineWidth element
772 KDXML::createIntNode( doc, polarSettingsElement,
773 "PolarLineWidth", _polarLineWidth );
774 }
775
776
777
778 // the LegendSettings element
779 TQDomElement legendSettingsElement =
780 doc.createElement( "LegendSettings" );
781 docRoot.appendChild( legendSettingsElement );
782 {
783 // the Position element
784 KDXML::createStringNode( doc, legendSettingsElement, "Position",
785 KDChartParams::legendPositionToString( _legendPosition ) );
786
787 // the Orientation element
788 KDXML::createOrientationNode( doc, legendSettingsElement,
789 "Orientation", _legendOrientation );
790
791 // the ShowLines element
792 KDXML::createBoolNode( doc, legendSettingsElement,
793 "ShowLines", _legendShowLines );
794
795 // the Source element
796 KDXML::createStringNode( doc, legendSettingsElement, "Source",
797 KDChartParams::legendSourceToString( _legendSource ) );
798
799 // the Text elements
800 for( TQMap<int,TQString>::ConstIterator it = _legendText.begin();
801 it != _legendText.end(); ++it ) {
802 TQDomElement legendTextElement = doc.createElement( "LegendText" );
803 legendSettingsElement.appendChild( legendTextElement );
804 legendTextElement.setAttribute( "Dataset", it.key() );
805 legendTextElement.setAttribute( "Text", it.data() );
806 }
807
808 // the TextColor element
809 KDXML::createColorNode( doc, legendSettingsElement, "TextColor",
810 _legendTextColor );
811
812 // the TextFont element
813 createChartFontNode( doc, legendSettingsElement, "TextFont",
814 _legendFont,
815 _legendFontUseRelSize,
816 _legendFontRelSize );
817
818 // the TitleText element
819 KDXML::createStringNode( doc, legendSettingsElement, "TitleText",
820 _legendTitleText );
821
822 // the TitleColor element
823 KDXML::createColorNode( doc, legendSettingsElement, "TitleColor",
824 _legendTitleTextColor );
825
826 // the TitleFont element
827 createChartFontNode( doc, legendSettingsElement, "TitleFont",
828 _legendTitleFont,
829 _legendTitleFontUseRelSize,
830 _legendTitleFontRelSize );
831
832 // the Spacing element
833 KDXML::createIntNode( doc, legendSettingsElement, "Spacing",
834 _legendSpacing );
835 }
836
837 saveAxesToXML(doc, docRoot);
838
839 // the HeaderFooterSettings elements
840 for( int hf = 0; hf < 18; hf++ ) {
841 TQDomElement hfSettingsElement =
842 doc.createElement( "HeaderFooterSettings" );
843 docRoot.appendChild( hfSettingsElement );
844 {
845 KDXML::createStringNode( doc, hfSettingsElement, "Text",
846 _hdFtParams[hf]._text );
847 createChartFontNode( doc, hfSettingsElement, "Font",
848 _hdFtParams[hf]._font,
849 _hdFtParams[hf]._fontUseRelSize,
850 _hdFtParams[hf]._fontRelSize );
851 KDXML::createColorNode( doc, hfSettingsElement, "Color",
852 _hdFtParams[hf]._color );
853 }
854 }
855
856
857 // the GlobalLeading element
858 TQDomElement globalLeadingElement =
859 doc.createElement( "GlobalLeading" );
860 docRoot.appendChild( legendSettingsElement );
861 {
862 KDXML::createIntNode( doc, globalLeadingElement, "Left",
863 _globalLeadingLeft );
864 KDXML::createIntNode( doc, globalLeadingElement, "Top",
865 _globalLeadingTop );
866 KDXML::createIntNode( doc, globalLeadingElement, "Right",
867 _globalLeadingRight );
868 KDXML::createIntNode( doc, globalLeadingElement, "Bottom",
869 _globalLeadingBottom );
870 }
871
872 // the DataValuesSettings1 element
873 TQDomElement dataValuesSettings1Element =
874 doc.createElement( "DataValuesSettings1" );
875 docRoot.appendChild( dataValuesSettings1Element );
876 {
877 KDXML::createBoolNode( doc, dataValuesSettings1Element, "PrintDataValues",
878 _printDataValuesSettings._printDataValues );
879 KDXML::createIntNode( doc, dataValuesSettings1Element, "DivPow10",
880 _printDataValuesSettings._divPow10 );
881 KDXML::createIntNode( doc, dataValuesSettings1Element, "DigitsBehindComma",
882 _printDataValuesSettings._digitsBehindComma );
883 createChartFontNode( doc, dataValuesSettings1Element, "Font",
884 _printDataValuesSettings._dataValuesFont,
885 _printDataValuesSettings._dataValuesUseFontRelSize,
886 _printDataValuesSettings._dataValuesFontRelSize );
887 KDXML::createColorNode( doc, dataValuesSettings1Element, "Color",
888 _printDataValuesSettings._dataValuesColor );
889 KDXML::createBrushNode( doc, dataValuesSettings1Element, "Background",
890 _printDataValuesSettings._dataValuesBrush );
891 KDXML::createBoolNode( doc, dataValuesSettings1Element, "AutoColor",
892 _printDataValuesSettings._dataValuesAutoColor );
893 KDXML::createStringNode( doc, dataValuesSettings1Element,
894 "AnchorNegativePosition",
895 KDChartEnums::positionFlagToString( _printDataValuesSettings._dataValuesAnchorNegativePosition ) );
896 KDXML::createIntNode( doc, dataValuesSettings1Element,
897 "AnchorNegativeAlign",
898 _printDataValuesSettings._dataValuesAnchorNegativeAlign );
899 KDXML::createIntNode( doc, dataValuesSettings1Element,
900 "AnchorNegativeDeltaX",
901 _printDataValuesSettings._dataValuesAnchorNegativeDeltaX );
902 KDXML::createIntNode( doc, dataValuesSettings1Element,
903 "AnchorNegativeDeltaY",
904 _printDataValuesSettings._dataValuesAnchorNegativeDeltaY );
905 KDXML::createIntNode( doc, dataValuesSettings1Element,
906 "NegativeRotation",
907 _printDataValuesSettings._dataValuesNegativeRotation );
908 KDXML::createStringNode( doc, dataValuesSettings1Element,
909 "AnchorPositivePosition",
910 KDChartEnums::positionFlagToString( _printDataValuesSettings._dataValuesAnchorPositivePosition ) );
911 KDXML::createIntNode( doc, dataValuesSettings1Element,
912 "AnchorPositiveAlign",
913 _printDataValuesSettings._dataValuesAnchorPositiveAlign );
914 KDXML::createIntNode( doc, dataValuesSettings1Element,
915 "AnchorPositiveDeltaX",
916 _printDataValuesSettings._dataValuesAnchorPositiveDeltaX );
917 KDXML::createIntNode( doc, dataValuesSettings1Element,
918 "AnchorPositiveDeltaY",
919 _printDataValuesSettings._dataValuesAnchorPositiveDeltaY );
920 KDXML::createIntNode( doc, dataValuesSettings1Element,
921 "PositiveRotation",
922 _printDataValuesSettings._dataValuesPositiveRotation );
923
924 KDXML::createStringNode( doc, dataValuesSettings1Element,
925 "LayoutPolicy",
926 KDChartEnums::layoutPolicyToString( _printDataValuesSettings._dataValuesLayoutPolicy ) );
927
928 KDXML::createBoolNode( doc, dataValuesSettings1Element, "ShowInfinite",
929 _printDataValuesSettings._dataValuesShowInfinite );
930 }
931
932 // the DataValuesSettings2 element
933 TQDomElement dataValuesSettings2Element =
934 doc.createElement( "DataValuesSettings2" );
935 docRoot.appendChild( dataValuesSettings2Element );
936 {
937 KDXML::createBoolNode( doc, dataValuesSettings2Element, "PrintDataValues",
938 _printDataValuesSettings2._printDataValues );
939 KDXML::createIntNode( doc, dataValuesSettings2Element, "DivPow10",
940 _printDataValuesSettings2._divPow10 );
941 KDXML::createIntNode( doc, dataValuesSettings2Element, "DigitsBehindComma",
942 _printDataValuesSettings2._digitsBehindComma );
943 createChartFontNode( doc, dataValuesSettings2Element, "Font",
944 _printDataValuesSettings2._dataValuesFont,
945 _printDataValuesSettings2._dataValuesUseFontRelSize,
946 _printDataValuesSettings2._dataValuesFontRelSize );
947 KDXML::createColorNode( doc, dataValuesSettings2Element, "Color",
948 _printDataValuesSettings2._dataValuesColor );
949 KDXML::createBrushNode( doc, dataValuesSettings2Element, "Background",
950 _printDataValuesSettings2._dataValuesBrush );
951 KDXML::createBoolNode( doc, dataValuesSettings2Element, "AutoColor",
952 _printDataValuesSettings2._dataValuesAutoColor );
953 KDXML::createStringNode( doc, dataValuesSettings2Element,
954 "AnchorNegativePosition",
955 KDChartEnums::positionFlagToString( _printDataValuesSettings2._dataValuesAnchorNegativePosition ) );
956 KDXML::createIntNode( doc, dataValuesSettings2Element,
957 "AnchorNegativeAlign",
958 _printDataValuesSettings2._dataValuesAnchorNegativeAlign );
959 KDXML::createIntNode( doc, dataValuesSettings2Element,
960 "AnchorNegativeDeltaX",
961 _printDataValuesSettings2._dataValuesAnchorNegativeDeltaX );
962 KDXML::createIntNode( doc, dataValuesSettings2Element,
963 "AnchorNegativeDeltaY",
964 _printDataValuesSettings2._dataValuesAnchorNegativeDeltaY );
965 KDXML::createIntNode( doc, dataValuesSettings2Element,
966 "NegativeRotation",
967 _printDataValuesSettings2._dataValuesNegativeRotation );
968 KDXML::createStringNode( doc, dataValuesSettings2Element,
969 "AnchorPositivePosition",
970 KDChartEnums::positionFlagToString( _printDataValuesSettings2._dataValuesAnchorPositivePosition ) );
971 KDXML::createIntNode( doc, dataValuesSettings2Element,
972 "AnchorPositiveAlign",
973 _printDataValuesSettings2._dataValuesAnchorPositiveAlign );
974 KDXML::createIntNode( doc, dataValuesSettings2Element,
975 "AnchorPositiveDeltaX",
976 _printDataValuesSettings2._dataValuesAnchorPositiveDeltaX );
977 KDXML::createIntNode( doc, dataValuesSettings2Element,
978 "AnchorPositiveDeltaY",
979 _printDataValuesSettings2._dataValuesAnchorPositiveDeltaY );
980 KDXML::createIntNode( doc, dataValuesSettings2Element,
981 "PositiveRotation",
982 _printDataValuesSettings2._dataValuesPositiveRotation );
983
984 KDXML::createStringNode( doc, dataValuesSettings2Element,
985 "LayoutPolicy",
986 KDChartEnums::layoutPolicyToString( _printDataValuesSettings2._dataValuesLayoutPolicy ) );
987
988 KDXML::createBoolNode( doc, dataValuesSettings2Element, "ShowInfinite",
989 _printDataValuesSettings2._dataValuesShowInfinite );
990 }
991
992 // global settings for data value settings of _all_ charts
993 TQDomElement dataValuesGlobalSettingsElement =
994 doc.createElement( "DataValuesGlobalSettings" );
995 docRoot.appendChild( dataValuesGlobalSettingsElement );
996 {
997 KDXML::createBoolNode( doc, dataValuesGlobalSettingsElement,
998 "allowOverlappingTexts",
999 _allowOverlappingDataValueTexts );
1000 }
1001
1002 // the AreaMap element
1003 TQDomElement areaMapElement =
1004 doc.createElement( "AreaMap" );
1005 docRoot.appendChild( areaMapElement );
1006 {
1007 TQDictIterator<KDChartFrameSettings> it( _areaDict );
1008 for( ; it.current(); ++it ){
1010 "FrameSettings",
1011 it.current(),
1012 it.currentKey().left(5).stripWhiteSpace().toUInt() );
1013 }
1014 }
1015
1016 // the CustomBoxMap element
1017 TQDomElement customBoxMapElement =
1018 doc.createElement( "CustomBoxMap" );
1019 docRoot.appendChild( customBoxMapElement );
1020 {
1021 TQIntDictIterator<KDChartCustomBox> it( _customBoxDict );
1022 for( ; it.current(); ++it ){
1023 KDXML::createIntNode( doc, customBoxMapElement, "Number", it.currentKey() );
1024 KDChartCustomBox::createCustomBoxNode( doc, customBoxMapElement,
1025 "CustomBox", it );
1026 }
1027 }
1028
1029
1030 return doc;
1031}
1032
1033
1044TQTextStream& operator>>( TQTextStream& s, KDChartParams& p )
1045{
1046 TQDomDocument doc( "ChartParams" );
1047 // would be nicer if TQDomDocument could read from a TQTextStream...
1048 TQString docString = s.read();
1049 doc.setContent( docString );
1050
1051 p.loadXML( doc );
1052
1053 return s;
1054}
1055
1056
1060void KDChartParams::loadAxesFormXML(int& curAxisSettings, TQDomElement& element)
1061{
1062 KDChartAxisParams* axisSettings =
1063 &( _axisSettings[ curAxisSettings ].params );
1064 TQDomNode node = element.firstChild();
1065 while( !node.isNull() ) {
1066 TQDomElement element = node.toElement();
1067 if( !element.isNull() ) { // was really an element
1068 TQString tagName = element.tagName();
1069 if( tagName == "Type" ) {
1070 TQString string;
1071 if( KDXML::readStringNode( element, string ) )
1072 axisSettings->_axisType = KDChartAxisParams::stringToAxisType( string );
1073 } else if( tagName == "Visible" ) {
1074 bool visible;
1075 if( KDXML::readBoolNode( element, visible ) )
1076 axisSettings->_axisVisible = visible;
1077 } else if( tagName == "LabelsTouchEdges" ) {
1078 bool labelsTouchEdges;
1079 if( KDXML::readBoolNode( element, labelsTouchEdges ) )
1080 axisSettings->_axisLabelsTouchEdges = labelsTouchEdges;
1081 } else if( tagName == "AreaMode" ) {
1082 TQString string;
1083 if( KDXML::readStringNode( element, string ) )
1084 axisSettings->_axisAreaMode = KDChartAxisParams::stringToAxisAreaMode( string );
1085 } else if( tagName == "UseAvailableSpaceFrom" ) {
1086 int spaceFrom;
1087 if( KDXML::readIntNode( element, spaceFrom ) )
1088 axisSettings->_axisUseAvailableSpaceFrom = spaceFrom;
1089 } else if( tagName == "UseAvailableSpaceTo" ) {
1090 int spaceTo;
1091 if( KDXML::readIntNode( element, spaceTo ) )
1092 axisSettings->_axisUseAvailableSpaceTo = spaceTo;
1093 } else if( tagName == "IsometricReferenceAxis" ) {
1094 int isoRefAxis;
1095 if( KDXML::readIntNode( element, isoRefAxis ) )
1096 axisSettings->_axisIsoRefAxis = isoRefAxis;
1097 } else if( tagName == "AreaMin" ) {
1098 int areaMin;
1099 if( KDXML::readIntNode( element, areaMin ) )
1100 axisSettings->_axisAreaMin = areaMin;
1101 } else if( tagName == "AreaMax" ) {
1102 int areaMax;
1103 if( KDXML::readIntNode( element, areaMax ) )
1104 axisSettings->_axisAreaMax = areaMax;
1105 } else if( tagName == "CalcMode" ) {
1106 TQString string;
1107 if( KDXML::readStringNode( element, string ) )
1108 axisSettings->_axisCalcMode = KDChartAxisParams::stringToAxisCalcMode( string );
1109 } else if( tagName == "TrueAreaSize" ) {
1110 int trueAreaSize;
1111 if( KDXML::readIntNode( element, trueAreaSize ) )
1112 axisSettings->_axisTrueAreaSize = trueAreaSize;
1113 } else if( tagName == "TrueAreaRect" ) {
1114 TQRect trueAreaRect;
1115 if( KDXML::readRectNode( element, trueAreaRect ) )
1116 axisSettings->_axisTrueAreaRect = trueAreaRect;
1117 } else if( tagName == "ShowSubDelimiters" ) {
1118 bool showSubDelimiters;
1119 if( KDXML::readBoolNode( element, showSubDelimiters ) )
1120 axisSettings->_axisShowSubDelimiters = showSubDelimiters;
1121 } else if( tagName == "LineVisible" ) {
1122 bool lineVisible;
1123 if( KDXML::readBoolNode( element, lineVisible ) )
1124 axisSettings->_axisLineVisible = lineVisible;
1125 } else if( tagName == "LineWidth" ) {
1126 int lineWidth;
1127 if( KDXML::readIntNode( element, lineWidth ) )
1128 axisSettings->_axisLineWidth = lineWidth;
1129 } else if( tagName == "TrueLineWidth" ) {
1130 int trueLineWidth;
1131 if( KDXML::readIntNode( element, trueLineWidth ) )
1132 axisSettings->_axisTrueLineWidth = trueLineWidth;
1133 } else if( tagName == "LineColor" ) {
1134 TQColor color;
1135 if( KDXML::readColorNode( element, color ) )
1136 axisSettings->_axisLineColor = color;
1137 } else if( tagName == "ShowGrid" ) {
1138 bool showGrid;
1139 if( KDXML::readBoolNode( element, showGrid ) )
1140 axisSettings->_axisShowGrid = showGrid;
1141 } else if( tagName == "GridColor" ) {
1142 TQColor color;
1143 if( KDXML::readColorNode( element, color ) )
1144 axisSettings->_axisGridColor = color;
1145 } else if( tagName == "GridLineWidth" ) {
1146 int gridLineWidth;
1147 if( KDXML::readIntNode( element, gridLineWidth ) )
1148 axisSettings->_axisGridLineWidth = gridLineWidth;
1149 } else if( tagName == "GridStyle" ) {
1150 if( element.hasAttribute( "Style" ) )
1151 axisSettings->_axisGridStyle = KDXML::stringToPenStyle( element.attribute( "Style" ) );
1152 } else if( tagName == "GridSubColor" ) {
1153 TQColor color;
1154 if( KDXML::readColorNode( element, color ) )
1155 axisSettings->_axisGridSubColor = color;
1156 } else if( tagName == "GridSubLineWidth" ) {
1157 int gridSubLineWidth;
1158 if( KDXML::readIntNode( element, gridSubLineWidth ) )
1159 axisSettings->_axisGridSubLineWidth = gridSubLineWidth;
1160 } else if( tagName == "GridSubStyle" ) {
1161 if( element.hasAttribute( "Style" ) )
1162 axisSettings->_axisGridSubStyle = KDXML::stringToPenStyle( element.attribute( "Style" ) );
1163 } else if( tagName == "ZeroLineColor" ) {
1164 TQColor color;
1165 if( KDXML::readColorNode( element, color ) )
1166 axisSettings->_axisZeroLineColor = color;
1167 } else if( tagName == "LabelsVisible" ) {
1168 bool labelsVisible;
1169 if( KDXML::readBoolNode( element, labelsVisible ) )
1170 axisSettings->_axisLabelsVisible = labelsVisible;
1171 } else if( tagName == "LabelsFont" ) {
1172 readChartFontNode( element,
1173 axisSettings->_axisLabelsFont,
1174 axisSettings->_axisLabelsFontUseRelSize,
1175 axisSettings->_axisLabelsFontRelSize,
1176 &axisSettings->_axisLabelsFontMinSize );
1177 } else if( tagName == "LabelsDontShrinkFont" ) {
1178 bool dontShrink;
1179 if( KDXML::readBoolNode( element, dontShrink ) )
1180 axisSettings->_axisLabelsDontShrinkFont = dontShrink;
1181 } else if( tagName == "LabelsDontAutoRotate" ) {
1182 bool dontRotate;
1183 if( KDXML::readBoolNode( element, dontRotate ) )
1184 axisSettings->_axisLabelsDontAutoRotate = dontRotate;
1185 } else if( tagName == "LabelsRotation" ) {
1186 int rotation;
1187 if( KDXML::readIntNode( element, rotation ) )
1188 axisSettings->_axisLabelsRotation = rotation;
1189 } else if( tagName == "LabelsLeaveOut" ) {
1190 int leaveOut;
1191 if( KDXML::readIntNode( element, leaveOut ) )
1192 axisSettings->_axisValueLeaveOut = leaveOut;
1193 } else if( tagName == "LabelsColor" ) {
1194 TQColor color;
1195 if( KDXML::readColorNode( element, color ) )
1196 axisSettings->_axisLabelsColor = color;
1197 } else if( tagName == "SteadyValueCalc" ) {
1198 bool steadyValueCalc;
1199 if( KDXML::readBoolNode( element, steadyValueCalc ) )
1200 axisSettings->_axisSteadyValueCalc = steadyValueCalc;
1201 } else if( tagName == "ValueStart" ) {
1202 TQVariant valX, valY;
1203 int propID;
1204 if( readChartValueNode( element, valY, valX, propID ) &&
1205 TQVariant::Double == valY.type() )
1206 axisSettings->_axisValueStart = valY.toDouble();
1207 } else if( tagName == "ValueStartIsExact" ) {
1208 bool isExactValue;
1209 if( KDXML::readBoolNode( element, isExactValue ) )
1210 axisSettings->_axisValueStartIsExact = isExactValue;
1211 } else if( tagName == "ValueEnd" ) {
1212 TQVariant valX, valY;
1213 int propID;
1214 if( readChartValueNode( element, valY, valX, propID ) &&
1215 TQVariant::Double == valY.type() )
1216 axisSettings->_axisValueEnd = valY.toDouble();
1217 } else if( tagName == "ValueDelta" ) {
1218 double valueDelta;
1219 if( KDXML::readDoubleNode( element, valueDelta ) )
1220 axisSettings->_axisValueDelta = valueDelta;
1221 } else if( tagName == "ValueDeltaScale" ) {
1222 int valueDeltaScale;
1223 if( KDXML::readIntNode( element, valueDeltaScale ) )
1224 axisSettings->_axisValueDeltaScale = (KDChartAxisParams::ValueScale)valueDeltaScale;
1225 } else if( tagName == "ValuesDecreasing" ) {
1226 bool decreasing;
1227 if( KDXML::readBoolNode( element, decreasing ) )
1228 axisSettings->_axisValuesDecreasing = decreasing;
1229 } else if( tagName == "TrueLow" ) {
1230 double trueLow;
1231 if( KDXML::readDoubleNode( element, trueLow ) )
1232 axisSettings->_trueLow = trueLow;
1233 } else if( tagName == "TrueHigh" ) {
1234 double trueHigh;
1235 if( KDXML::readDoubleNode( element, trueHigh ) )
1236 axisSettings->_trueHigh = trueHigh;
1237 } else if( tagName == "TrueDelta" ) {
1238 double trueDelta;
1239 if( KDXML::readDoubleNode( element, trueDelta ) )
1240 axisSettings->_trueDelta = trueDelta;
1241 } else if( tagName == "ZeroLineStart" ) {
1242 double x = 0.0;
1243 double y = 0.0;
1244 bool ok = true;
1245 if( element.hasAttribute( "X" ) &&
1246 element.hasAttribute( "Y" ) ) {
1247 x = element.attribute( "X" ).toDouble( &ok );
1248 if( ok )
1249 y = element.attribute( "Y" ).toDouble( &ok );
1250 } else
1251 ok = false;
1252
1253 if( ok ) {
1254 axisSettings->_axisZeroLineStartX = x;
1255 axisSettings->_axisZeroLineStartY = y;
1256 }
1257 } else if( tagName == "DigitsBehindComma" ) {
1258 int digitsBehindComma;
1259 if( KDXML::readIntNode( element, digitsBehindComma ) )
1260 axisSettings->_axisDigitsBehindComma = digitsBehindComma;
1261 } else if( tagName == "LabelsDateTimeFormat" ) {
1262 TQString string;
1263 if( KDXML::readStringNode( element, string ) )
1264 axisSettings->_axisLabelsDateTimeFormat = string;
1265 } else if( tagName == "MaxEmptyInnerSpan" ) {
1266 int maxEmptyInnerSpan;
1267 if( KDXML::readIntNode( element, maxEmptyInnerSpan ) )
1268 axisSettings->_axisMaxEmptyInnerSpan = maxEmptyInnerSpan;
1269 } else if( tagName == "LabelsFromDataRow" ) {
1270 TQString string;
1271 if( KDXML::readStringNode( element, string ) )
1272 axisSettings->_labelTextsDataRow = KDChartAxisParams::stringToLabelsFromDataRow( string );
1273 } else if( tagName == "TextsDataRow" ) {
1274 int textsDataRow;
1275 if( KDXML::readIntNode( element, textsDataRow ) )
1276 axisSettings->_labelTextsDataRow = textsDataRow;
1277 } else if( tagName == "LabelString" ) {
1278 TQString string;
1279 if( KDXML::readStringNode( element, string ) )
1280 axisSettings->_axisLabelStringList << string;
1281 } else if( tagName == "ShortLabelString" ) {
1282 TQString string;
1283 if( KDXML::readStringNode( element, string ) )
1284 axisSettings->_axisShortLabelsStringList << string;
1285 } else if( tagName == "LabelText" ) {
1286 TQString string;
1287 if( KDXML::readStringNode( element, string ) )
1288 axisSettings->_axisLabelTexts = string;
1289 } else if( tagName == "LabelTextsDirty" ) {
1290 bool labelTextsDirty;
1291 if( KDXML::readBoolNode( element, labelTextsDirty ) )
1292 axisSettings->_axisLabelTextsDirty = labelTextsDirty;
1293 } else if( tagName == "FirstLabelReplacementText" ) {
1294 TQString value;
1295 if( KDXML::readStringNode( element, value ) )
1296 axisSettings->_axisFirstLabelText = value;
1297 } else if( tagName == "LastLabelReplacementText" ) {
1298 TQString value;
1299 if( KDXML::readStringNode( element, value ) )
1300 axisSettings->_axisLastLabelText = value;
1301 } else if( tagName == "LabelsDivPow10" ) {
1302 int divPow10;
1303 if( KDXML::readIntNode( element, divPow10 ) )
1304 axisSettings->_axisLabelsDivPow10 = divPow10;
1305 } else if( tagName == "LabelsDecimalPoint" ) {
1306 TQString value;
1307 if( KDXML::readStringNode( element, value ) )
1308 axisSettings->_axisLabelsDecimalPoint = value;
1309 } else if( tagName == "LabelsThousandsPoint" ) {
1310 TQString value;
1311 if( KDXML::readStringNode( element, value ) )
1312 axisSettings->_axisLabelsThousandsPoint = value;
1313 } else if( tagName == "LabelsNotation" ) {
1314 TQString string;
1315 if( KDXML::readStringNode( element, string ) )
1316 axisSettings->_axisLabelsNotation = KDChartEnums::stringToNumberNotation( string );
1317 } else if( tagName == "LabelsPrefix" ) {
1318 TQString value;
1319 if( KDXML::readStringNode( element, value ) )
1320 axisSettings->_axisLabelsPrefix = value;
1321 } else if( tagName == "LabelsPostfix" ) {
1322 TQString value;
1323 if( KDXML::readStringNode( element, value ) )
1324 axisSettings->_axisLabelsPostfix = value;
1325 } else if( tagName == "LabelsTotalLen" ) {
1326 int totalLen;
1327 if( KDXML::readIntNode( element, totalLen ) )
1328 axisSettings->_axisLabelsTotalLen = totalLen;
1329 } else if( tagName == "LabelsPadFill" ) {
1330 TQString value;
1331 if( KDXML::readStringNode( element, value ) ){
1332 if( value.isEmpty() )
1333 axisSettings->_axisLabelsPadFill = ' ';
1334 else
1335 axisSettings->_axisLabelsPadFill = value.at(0);
1336 }
1337 } else if( tagName == "LabelsBlockAlign" ) {
1338 bool blockAlign;
1339 if( KDXML::readBoolNode( element, blockAlign ) )
1340 axisSettings->_axisLabelsBlockAlign = blockAlign;
1341 } else {
1342 tqDebug( "Unknown subelement of AxisSettings found: %s", tagName.latin1() );
1343 }
1344 }
1345 node = node.nextSibling();
1346 }
1347 curAxisSettings++; // one axis settings entry finished
1348}
1349
1350
1358bool KDChartParams::loadXML( const TQDomDocument& doc )
1359{
1360 int curAxisSettings = 0;
1361 int curHFSettings = 0;
1362
1363 TQDomElement docRoot = doc.documentElement(); // ChartParams element
1364 TQDomNode node = docRoot.firstChild();
1365 while( !node.isNull() ) {
1366 TQDomElement element = node.toElement();
1367 if( !element.isNull() ) { // was really an element
1368 TQString tagName = element.tagName();
1369 if( tagName == "ChartType" ) {
1370 if( element.hasAttribute( "primary" ) )
1371 _chartType = KDChartParams::stringToChartType( element.attribute( "primary" ) );
1372 if( element.hasAttribute( "secondary" ) )
1373 _additionalChartType = KDChartParams::stringToChartType( element.attribute( "secondary" ) );
1374 } else if( tagName == "NumValues" ) {
1375 int numValues;
1376 if( KDXML::readIntNode( element, numValues ) )
1377 _numValues = numValues;
1378 } else if( tagName == "ModeAndChartMap" ) {
1379 int dataset = -1;
1380 TQDomNode node = element.firstChild();
1381 while( !node.isNull() ) {
1382 TQDomElement element = node.toElement();
1383 if( !element.isNull() ) { // was really an element
1384 TQString tagName = element.tagName();
1385 if( tagName == "Dataset" ) {
1386 KDXML::readIntNode( element, dataset );
1387 } else if( tagName == "ModeAndChart" ) {
1388 Q_ASSERT( dataset != -1 ); // there must have been a dataset tag before
1389 if( element.hasAttribute( "Mode" ) &&
1390 element.hasAttribute( "Chart" ) ) {
1391 KDChartParams::SourceMode sourceMode = KDChartParams::stringToChartSourceMode( element.attribute( "Mode" ) );
1392 bool ok = false;
1393 uint chart = element.attribute( "Chart" ).toUInt( &ok );
1394 if( ok )
1395 _dataSourceModeAndChart[dataset] = KDChartParams::ModeAndChart( sourceMode, chart );
1396 }
1397 } else {
1398 tqDebug( "Unknown subelement of ModeAndChartMap found: %s", tagName.latin1() );
1399 }
1400 }
1401 node = node.nextSibling();
1402 }
1403 } else if( tagName == "PropertySetMap" ) {
1404 // the PropertySetMap element
1405 TQDomNode node = element.firstChild();
1407 while( !node.isNull() ) {
1408 TQDomElement element = node.toElement();
1409 if( !element.isNull() // was really an element
1410 && KDChartPropertySet::loadXML( element, set ) ) // parsed OK
1411 setProperties( set.id(), set );
1412 node = node.nextSibling();
1413 }
1414 } else if( tagName == "ChartSourceModeWasUsed" ) {
1415 bool chartSourceModeWasUsed;
1416 if( KDXML::readBoolNode( element, chartSourceModeWasUsed ) )
1417 _setChartSourceModeWasUsed = chartSourceModeWasUsed;
1418 } else if( tagName == "MaxDatasetSourceMode" ) {
1420 if( KDXML::readIntNode( element, maxDatasetSourceMode ) )
1421 _maxDatasetSourceMode = maxDatasetSourceMode;
1422 } else if( tagName == "ColorSettings" ) {
1423 TQDomNode node = element.firstChild();
1424 while( !node.isNull() ) {
1425 TQDomElement element = node.toElement();
1426 if( !element.isNull() ) { // was really an element
1427 TQString tagName = element.tagName();
1428 if( tagName == "DataColors" ) {
1429 TQMap<uint,TQColor>* map = &_dataColors;
1430 readColorMapNode( element, map );
1431 } else if( tagName == "MaxDatasetColor" ) {
1432 int maxDatasetColor;
1433 if( KDXML::readIntNode( element, maxDatasetColor ) )
1434 _maxDatasetColor = maxDatasetColor;
1435 } else if( tagName == "ShadowBrightnessFactor" ) {
1437 if( KDXML::readDoubleNode( element, shadowBrightnessFactor ) )
1438 _shadowBrightnessFactor = shadowBrightnessFactor;
1439 } else if( tagName == "ShadowPattern" ) {
1440 TQString value;
1441 if( KDXML::readStringNode( element, value ) )
1442 _shadowPattern = KDXML::stringToBrushStyle( value );
1443 } else if( tagName == "ThreeDShadowColors" ) {
1444 bool threeDShadowColors;
1445 if( KDXML::readBoolNode( element, threeDShadowColors ) )
1446 _threeDShadowColors = threeDShadowColors;
1447 } else if( tagName == "DataColorsShadow1" ) {
1448 TQMap<uint,TQColor>* map = &_dataColorsShadow1;
1449 readColorMapNode( element, map );
1450 } else if( tagName == "DataColorsShadow2" ) {
1451 TQMap<uint,TQColor>* map = &_dataColorsShadow2;
1452 readColorMapNode( element, map );
1453 } else if( tagName == "OutlineDataColor" ) {
1454 TQColor color;
1455 if( KDXML::readColorNode( element, color ) )
1456 _outlineDataColor = color;
1457 } else if( tagName == "OutlineDataLineWidth" ) {
1459 if( KDXML::readIntNode( element, outlineDataLineWidth ) )
1460 _outlineDataLineWidth = outlineDataLineWidth;
1461 } else if( tagName == "OutlineDataLineStyle" ) {
1462 if( element.hasAttribute( "Style" ) )
1463 _outlineDataLineStyle = KDXML::stringToPenStyle( element.attribute( "Style" ) );
1464 } else {
1465 tqDebug( "!!!Unknown subelement of ColorSettings found: %s", tagName.latin1() );
1466 }
1467 }
1468 node = node.nextSibling();
1469 }
1470 } else if( tagName == "BarSettings" ) {
1471 TQDomNode node = element.firstChild();
1472 while( !node.isNull() ) {
1473 TQDomElement element = node.toElement();
1474 if( !element.isNull() ) { // was really an element
1475 TQString tagName = element.tagName();
1476 if( tagName == "SubType" ) {
1477 TQString value;
1478 if( KDXML::readStringNode( element, value ) )
1479 _barChartSubType = KDChartParams::stringToBarChartSubType( value );
1480 } else if( tagName == "ThreeDBars" ) {
1481 bool threeDBars;
1482 if( KDXML::readBoolNode( element, threeDBars ) )
1483 _threeDBars = threeDBars;
1484 } else if( tagName == "ThreeDBarDepth" ) {
1485 double threeDBarDepth;
1486 if( KDXML::readDoubleNode( element, threeDBarDepth ) )
1487 _threeDBarDepth = threeDBarDepth;
1488 } else if( tagName == "DatasetGap" ) {
1489 int datasetGap;
1490 if( KDXML::readIntNode( element, datasetGap ) )
1491 _datasetGap = datasetGap;
1492 } else if( tagName == "DatasetGapIsRelative" ) {
1494 if( KDXML::readBoolNode( element, datasetGapIsRelative ) )
1495 _datasetGapIsRelative = datasetGapIsRelative;
1496 } else if( tagName == "ValueBlockGap" ) {
1497 int valueBlockGap;
1498 if( KDXML::readIntNode( element, valueBlockGap ) )
1499 _valueBlockGap = valueBlockGap;
1500 } else if( tagName == "ValueBlockGapIsRelative" ) {
1502 if( KDXML::readBoolNode( element, valueBlockGapIsRelative ) )
1503 _valueBlockGapIsRelative = valueBlockGapIsRelative;
1504 } else if( tagName == "BarWidth" ) {
1505 int barWidth;
1506 if( KDXML::readIntNode( element, barWidth ) )
1507 _barWidth = barWidth;
1508 } else if( tagName == "SolidExcessArrows" ) {
1509 bool solidExcessArrows;
1510 if( KDXML::readBoolNode( element, solidExcessArrows ) )
1511 _solidExcessArrows = solidExcessArrows;
1512 } else {
1513 tqDebug( "Unknown subelement of BarSettings found: %s", tagName.latin1() );
1514 }
1515 }
1516 node = node.nextSibling();
1517 }
1518 } else if( tagName == "LineSettings" ) {
1519 TQDomNode node = element.firstChild();
1520 while( !node.isNull() ) {
1521 TQDomElement element = node.toElement();
1522 if( !element.isNull() ) { // was really an element
1523 TQString tagName = element.tagName();
1524 if( tagName == "SubType" ) {
1525 TQString value;
1526 if( KDXML::readStringNode( element, value ) )
1527 _lineChartSubType = KDChartParams::stringToLineChartSubType( value );
1528 } else if( tagName == "Marker" ) {
1529 bool marker;
1530 if( KDXML::readBoolNode( element, marker ) )
1531 _lineMarker = marker;
1532 } else if( tagName == "MarkerStyle" ) {
1533 bool ok = true;
1534 uint dataset;
1535 KDChartParams::LineMarkerStyle style = LineMarkerCircle;
1536 if( element.hasAttribute( "Dataset" ) &&
1537 element.hasAttribute( "Style" ) ) {
1538 dataset = element.attribute( "Dataset" ).toUInt( &ok );
1539 if( ok )
1540 style = KDChartParams::stringToLineMarkerStyle( element.attribute( "Style" ) );
1541 } else
1542 ok = false;
1543 if( ok )
1544 _lineMarkerStyles[dataset] = style;
1545 } else if( tagName == "MarkerSize" ) {
1546 int width = 1;
1547 int height= 1;
1548 bool ok = true;
1549 if( element.hasAttribute( "Width" ) &&
1550 element.hasAttribute( "Height" ) ) {
1551 width = element.attribute( "Width" ).toInt( &ok );
1552 if( ok )
1553 height = element.attribute( "Height" ).toInt( &ok );
1554 } else
1555 ok = false;
1556
1557 if( ok ) {
1558 _lineMarkerSize.setWidth( width );
1559 _lineMarkerSize.setHeight( height );
1560 }
1561 } else if( tagName == "LineWidth" ) {
1562 int lineWidth;
1563 if( KDXML::readIntNode( element, lineWidth ) )
1564 _lineWidth = lineWidth;
1565 } else if( tagName == "LineColor" ) {
1566 TQColor color;
1567 if( KDXML::readColorNode( element, color ) )
1568 _lineColor = color;
1569 } else if( tagName == "LineStyle" ) {
1570 if( element.hasAttribute( "Style" ) )
1571 _lineStyle = KDXML::stringToPenStyle( element.attribute( "Style" ) );
1572 } else if( tagName == "DatasetLineStyle" ) {
1573 bool ok = true;
1574 uint dataset;
1575 TQt::PenStyle style = TQt::SolidLine;
1576 if( element.hasAttribute( "Dataset" ) &&
1577 element.hasAttribute( "Style" ) ) {
1578 dataset = element.attribute( "Dataset" ).toUInt( &ok );
1579 if( ok )
1580 style = KDXML::stringToPenStyle( element.attribute( "Style" ) );
1581 } else
1582 ok = false;
1583 if( ok )
1584 _datasetLineStyles[dataset] = style;
1585 } else if( tagName == "ThreeD" ) {
1586 bool threeD;
1587 if( KDXML::readBoolNode( element, threeD ) )
1588 _threeDLines = threeD;
1589 } else if( tagName == "ThreeDDepth" ) {
1590 int depth;
1591 if( KDXML::readIntNode( element, depth ) )
1592 _threeDLineDepth = depth;
1593 } else if( tagName == "ThreeDXRotation" ) {
1594 int rotation;
1595 if( KDXML::readIntNode( element, rotation ) )
1596 _threeDLineXRotation = rotation;
1597 } else if( tagName == "ThreeDYRotation" ) {
1598 int rotation;
1599 if( KDXML::readIntNode( element, rotation ) )
1600 _threeDLineYRotation = rotation;
1601 } else {
1602 tqDebug( "Unknown subelement of LineSettings found: %s", tagName.latin1() );
1603 }
1604 }
1605 node = node.nextSibling();
1606 }
1607 } else if( tagName == "AreaSettings" ) {
1608 TQDomNode node = element.firstChild();
1609 while( !node.isNull() ) {
1610 TQDomElement element = node.toElement();
1611 if( !element.isNull() ) { // was really an element
1612 TQString tagName = element.tagName();
1613 if( tagName == "SubType" ) {
1614 TQString value;
1615 if( KDXML::readStringNode( element, value ) )
1616 _areaChartSubType = KDChartParams::stringToAreaChartSubType( value );
1617 } else if( tagName == "Location" ) {
1618 TQString string;
1619 if( KDXML::readStringNode( element, string ) )
1620 _areaLocation = KDChartParams::stringToAreaLocation( string );
1621 } else {
1622 tqDebug( "Unknown subelement of AreaSettings found: %s", tagName.latin1() );
1623 }
1624 }
1625 node = node.nextSibling();
1626 }
1627 } else if( tagName == "PieRingSettings" ) {
1628 TQDomNode node = element.firstChild();
1629 while( !node.isNull() ) {
1630 TQDomElement element = node.toElement();
1631 if( !element.isNull() ) { // was really an element
1632 TQString tagName = element.tagName();
1633 if( tagName == "Explode" ) {
1634 bool explode;
1635 if( KDXML::readBoolNode( element, explode ) )
1636 _explode = explode;
1637 } else if( tagName == "DefaultExplodeFactor" ) {
1638 double defaultExplodeFactor;
1639 if( KDXML::readDoubleNode( element, defaultExplodeFactor ) )
1640 _explodeFactor = defaultExplodeFactor;
1641 } else if( tagName == "ExplodeFactors" ) {
1642 TQMap<int,double>* map = &_explodeFactors;
1643 readDoubleMapNode( element, map );
1644 } else if( tagName == "ExplodeSegment" ) {
1645 int explodeSegment;
1646 if( KDXML::readIntNode( element, explodeSegment ) )
1647 _explodeList << explodeSegment;
1648 } else if( tagName == "ThreeDPies" ) {
1649 bool threeDPies;
1650 if( KDXML::readBoolNode( element, threeDPies ) )
1651 _threeDPies = threeDPies;
1652 } else if( tagName == "ThreeDPieHeight" ) {
1653 int threeDPieHeight;
1654 if( KDXML::readIntNode( element, threeDPieHeight ) )
1655 _threeDPieHeight = threeDPieHeight;
1656 } else if( tagName == "PieStart" ) {
1657 int pieStart;
1658 if( KDXML::readIntNode( element, pieStart ) )
1659 _pieStart = pieStart;
1660 } else if( tagName == "RingStart" ) {
1661 int ringStart;
1662 if( KDXML::readIntNode( element, ringStart ) )
1663 _ringStart = ringStart;
1664 } else if( tagName == "RelativeRingThickness" ) {
1666 if( KDXML::readBoolNode( element, relativeRingThickness ) )
1667 _relativeRingThickness = relativeRingThickness;
1668 } else {
1669 tqDebug( "Unknown subelement of PieRingSettings found: %s", tagName.latin1() );
1670 }
1671 }
1672 node = node.nextSibling();
1673 }
1674 } else if( tagName == "HiLoSettings" ) {
1675 TQDomNode node = element.firstChild();
1676 while( !node.isNull() ) {
1677 TQDomElement element = node.toElement();
1678 if( !element.isNull() ) { // was really an element
1679 TQString tagName = element.tagName();
1680 if( tagName == "SubType" ) {
1681 TQString value;
1682 if( KDXML::readStringNode( element, value ) )
1683 _hiLoChartSubType = KDChartParams::stringToHiLoChartSubType( value );
1684 } else if( tagName == "PrintLowValues" ) {
1685 bool printLowValues;
1686 if( KDXML::readBoolNode( element, printLowValues ) )
1687 _hiLoChartPrintLowValues = printLowValues;
1688 } else if( tagName == "LowValuesFont" ) {
1689 readChartFontNode( element,
1690 _hiLoChartLowValuesFont,
1691 _hiLoChartLowValuesUseFontRelSize,
1692 _hiLoChartLowValuesFontRelSize );
1693 } else if( tagName == "LowValuesColor" ) {
1694 TQColor color;
1695 if( KDXML::readColorNode( element, color ) )
1696 _hiLoChartLowValuesColor = color;
1697 } else if( tagName == "PrintHighValues" ) {
1698 bool printHighValues;
1699 if( KDXML::readBoolNode( element, printHighValues ) )
1700 _hiLoChartPrintHighValues = printHighValues;
1701 } else if( tagName == "HighValuesFont" ) {
1702 readChartFontNode( element,
1703 _hiLoChartHighValuesFont,
1704 _hiLoChartHighValuesUseFontRelSize,
1705 _hiLoChartHighValuesFontRelSize );
1706 } else if( tagName == "HighValuesColor" ) {
1707 TQColor color;
1708 if( KDXML::readColorNode( element, color ) )
1709 _hiLoChartHighValuesColor = color;
1710 } else if( tagName == "PrintOpenValues" ) {
1711 bool printOpenValues;
1712 if( KDXML::readBoolNode( element, printOpenValues ) )
1713 _hiLoChartPrintOpenValues = printOpenValues;
1714 } else if( tagName == "OpenValuesFont" ) {
1715 readChartFontNode( element,
1716 _hiLoChartOpenValuesFont,
1717 _hiLoChartOpenValuesUseFontRelSize,
1718 _hiLoChartOpenValuesFontRelSize );
1719 } else if( tagName == "OpenValuesColor" ) {
1720 TQColor color;
1721 if( KDXML::readColorNode( element, color ) )
1722 _hiLoChartOpenValuesColor = color;
1723 } else if( tagName == "PrintCloseValues" ) {
1724 bool printCloseValues;
1725 if( KDXML::readBoolNode( element, printCloseValues ) )
1726 _hiLoChartPrintCloseValues = printCloseValues;
1727 } else if( tagName == "CloseValuesFont" ) {
1728 readChartFontNode( element,
1729 _hiLoChartCloseValuesFont,
1730 _hiLoChartCloseValuesUseFontRelSize,
1731 _hiLoChartCloseValuesFontRelSize );
1732 } else if( tagName == "CloseValuesColor" ) {
1733 TQColor color;
1734 if( KDXML::readColorNode( element, color ) )
1735 _hiLoChartCloseValuesColor = color;
1736 } else {
1737 tqDebug( "Unknown subelement of HiLoSettings found: %s", tagName.latin1() );
1738 }
1739 }
1740 node = node.nextSibling();
1741 }
1742
1743
1744 } else if( tagName == "BoxAndWhiskerSettings" ) {
1745 TQDomNode node = element.firstChild();
1746 while( !node.isNull() ) {
1747 TQDomElement element = node.toElement();
1748 if( !element.isNull() ) { // was really an element
1749 TQString tagName = element.tagName();
1750 if( tagName == "SubType" ) {
1751 TQString value;
1752 if( KDXML::readStringNode( element, value ) )
1753 _BWChartSubType = KDChartParams::stringToBWChartSubType( value );
1754 } else if( tagName == "FenceUpperInner" ) {
1755 double fence;
1756 if( KDXML::readDoubleNode( element, fence ) )
1757 _BWChartFenceUpperInner = fence;
1758 } else if( tagName == "FenceLowerInner" ) {
1759 double fence;
1760 if( KDXML::readDoubleNode( element, fence ) )
1761 _BWChartFenceUpperOuter = fence;
1762 } else if( tagName == "FenceUpperOuter" ) {
1763 double fence;
1764 if( KDXML::readDoubleNode( element, fence ) )
1765 _BWChartFenceUpperOuter = fence;
1766 } else if( tagName == "FenceLowerOuter" ) {
1767 double fence;
1768 if( KDXML::readDoubleNode( element, fence ) )
1769 _BWChartFenceUpperOuter = fence;
1770 } else if( tagName == "Brush" ) {
1771 TQBrush brush;
1772 if( KDXML::readBrushNode( element, brush ) )
1773 _BWChartBrush = brush;
1774 } else if( tagName == "OutlierSize" ) {
1775 int size;
1776 if( KDXML::readIntNode( element, size ) )
1777 _BWChartOutValMarkerSize = size;
1778 } else if( tagName.startsWith("PrintStatistics") ) {
1779 // 012345678901234
1780 TQString statName(tagName.mid( 15 ));
1781 BWStatVal i( stringToBWChartStatVal( statName ) );
1782 if( BWStatValSTART <= i && i <= BWStatValEND ) {
1783 TQDomNode node = element.firstChild();
1784 while( !node.isNull() ) {
1785 TQDomElement element = node.toElement();
1786 if( !element.isNull() ) { // was really an element
1787 TQString tagName = element.tagName();
1788 if( tagName == "Active" ) {
1789 bool active;
1790 if( KDXML::readBoolNode( element, active ) )
1791 _BWChartStatistics[ i ].active = active;
1792 } else if( tagName == "Font" ) {
1793 readChartFontNode( element,
1794 _BWChartStatistics[ i ].font,
1795 _BWChartStatistics[ i ].useRelSize,
1796 _BWChartStatistics[ i ].relSize );
1797 } else if( tagName == "Color" ) {
1798 TQColor color;
1799 if( KDXML::readColorNode( element, color ) )
1800 _BWChartStatistics[ i ].color = color;
1801 } else if( tagName == "Brush" ) {
1802 TQBrush brush;
1803 if( KDXML::readBrushNode( element, brush ) )
1804 _BWChartStatistics[ i ].brush = brush;
1805 } else {
1806 tqDebug( "Unknown subelement of BoxAndWhiskerSettings found: %s", tagName.latin1() );
1807 }
1808 }
1809 }
1810 } else {
1811 tqDebug( "Unknown subelement of BoxAndWhiskerSettings found: %s", tagName.latin1() );
1812 }
1813 } else {
1814 tqDebug( "Unknown subelement of BoxAndWhiskerSettings found: %s", tagName.latin1() );
1815 }
1816 }
1817 node = node.nextSibling();
1818 }
1819 } else if( tagName == "PolarSettings" ) {
1820 TQDomNode node = element.firstChild();
1821 while( !node.isNull() ) {
1822 TQDomElement element = node.toElement();
1823 if( !element.isNull() ) { // was really an element
1824 TQString tagName = element.tagName();
1825 if( tagName == "SubType" ) {
1826 TQString value;
1827 if( KDXML::readStringNode( element, value ) )
1828 _polarChartSubType = KDChartParams::stringToPolarChartSubType( value );
1829 } else if( tagName == "Marker" ) {
1830 bool marker;
1831 if( KDXML::readBoolNode( element, marker ) )
1832 _polarMarker = marker;
1833 } else if( tagName == "MarkerStyle" ) {
1834 bool ok = true;
1835 uint dataset;
1836 KDChartParams::PolarMarkerStyle style = PolarMarkerCircle;
1837 if( element.hasAttribute( "Dataset" ) &&
1838 element.hasAttribute( "Style" ) ) {
1839 dataset = element.attribute( "Dataset" ).toUInt( &ok );
1840 if( ok )
1841 style = KDChartParams::stringToPolarMarkerStyle( element.attribute( "Style" ) );
1842 } else
1843 ok = false;
1844 if( ok )
1845 _polarMarkerStyles[dataset] = style;
1846 } else if( tagName == "MarkerSize" ) {
1847 int width = 1;
1848 int height= 1;
1849 bool ok = true;
1850 if( element.hasAttribute( "Width" ) &&
1851 element.hasAttribute( "Height" ) ) {
1852 width = element.attribute( "Width" ).toInt( &ok );
1853 if( ok )
1854 height = element.attribute( "Height" ).toInt( &ok );
1855 } else
1856 ok = false;
1857
1858 if( ok ) {
1859 _polarMarkerSize.setWidth( width );
1860 _polarMarkerSize.setHeight( height );
1861 }
1862 } else if( tagName == "PolarLineWidth" ) {
1863 int polarLineWidth;
1864 if( KDXML::readIntNode( element, polarLineWidth ) )
1865 _polarLineWidth = polarLineWidth;
1866 } else {
1867 tqDebug( "Unknown subelement of PolarSettings found: %s", tagName.latin1() );
1868 }
1869 }
1870 node = node.nextSibling();
1871 }
1872 } else if( tagName == "LegendSettings" ) {
1873 TQDomNode node = element.firstChild();
1874 while( !node.isNull() ) {
1875 TQDomElement element = node.toElement();
1876 if( !element.isNull() ) { // was really an element
1877 TQString tagName = element.tagName();
1878 if( tagName == "Position" ) {
1879 TQString string;
1880 if( KDXML::readStringNode( element, string ) )
1881 _legendPosition = KDChartParams::stringToLegendPosition( string );
1882 } else if( tagName == "Orientation" ) {
1883 TQt::Orientation value=TQt::Vertical;
1884 if( KDXML::readOrientationNode( element, value ) )
1885 _legendOrientation = value;
1886 } else if( tagName == "ShowLines" ) {
1887 bool showLines;
1888 if( KDXML::readBoolNode( element, showLines ) )
1889 _legendShowLines = showLines;
1890 } else if( tagName == "Source" ) {
1891 TQString string;
1892 if( KDXML::readStringNode( element, string ) )
1893 _legendSource = KDChartParams::stringToLegendSource( string );
1894 } else if( tagName == "LegendText" ) {
1895 bool ok = true;
1896 uint dataset = 0;
1897 TQString text;
1898 if( element.hasAttribute( "Dataset" ) &&
1899 element.hasAttribute( "Text" ) ) {
1900 dataset = element.attribute( "Dataset" ).toUInt( &ok );
1901 if( ok )
1902 text = element.attribute( "Text" );
1903 } else
1904 ok = false;
1905 if( ok )
1906 _legendText[dataset] = text;
1907 } else if( tagName == "TextColor" ) {
1908 TQColor color;
1909 if( KDXML::readColorNode( element, color ) )
1910 _legendTextColor = color;
1911 } else if( tagName == "TextFont" ) {
1912 readChartFontNode( element,
1913 _legendFont,
1914 _legendFontUseRelSize,
1915 _legendFontRelSize );
1916 } else if( tagName == "TitleText" ) {
1917 TQString string;
1918 if( KDXML::readStringNode( element, string ) )
1919 _legendTitleText = string;
1920 } else if( tagName == "TitleColor" ) {
1921 TQColor color;
1922 if( KDXML::readColorNode( element, color ) )
1923 _legendTitleTextColor = color;
1924 } else if( tagName == "TitleFont" ) {
1925 readChartFontNode( element,
1926 _legendTitleFont,
1927 _legendTitleFontUseRelSize,
1928 _legendTitleFontRelSize );
1929 } else if( tagName == "Spacing" ) {
1930 int spacing;
1931 if( KDXML::readIntNode( element, spacing ) )
1932 _legendSpacing = spacing;
1933 } else {
1934 tqDebug( "Unknown subelement of LegendSettings found: %s", tagName.latin1() );
1935 }
1936 }
1937 node = node.nextSibling();
1938 }
1939 } else if( tagName == "AxisSettings" ) {
1940
1941 loadAxesFormXML(curAxisSettings, element);
1942
1943 } else if( tagName == "HeaderFooterSettings" ) {
1944 KDChartParams::HdFtParams* hfSettings =
1945 &( _hdFtParams[ curHFSettings ] );
1946 TQDomNode node = element.firstChild();
1947 while( !node.isNull() ) {
1948 TQDomElement element = node.toElement();
1949 if( !element.isNull() ) { // was really an element
1950 TQString tagName = element.tagName();
1951 if( tagName == "Text" ) {
1952 TQString string;
1953 if( KDXML::readStringNode( element, string ) )
1954 hfSettings->_text = string;
1955 } else if( tagName == "Font" ) {
1956 readChartFontNode( element,
1957 hfSettings->_font,
1958 hfSettings->_fontUseRelSize,
1959 hfSettings->_fontRelSize );
1960 } else if( tagName == "Color" ) {
1961 TQColor color;
1962 if( KDXML::readColorNode( element, color ) )
1963 hfSettings->_color = color;
1964 } else {
1965 tqDebug( "Unknown subelement of HeaderFooterSettings found: %s", tagName.latin1() );
1966 }
1967 }
1968 node = node.nextSibling();
1969 }
1970 curHFSettings++; // one header/footer setting finished
1971 } else if( tagName == "GlobalLeading" ) {
1972 TQDomNode node = element.firstChild();
1973 while( !node.isNull() ) {
1974 TQDomElement element = node.toElement();
1975 if( !element.isNull() ) { // was really an elemente
1976 TQString tagName = element.tagName();
1977 if( tagName == "Left" ) {
1978 int value;
1979 if( KDXML::readIntNode( element, value ) )
1980 _globalLeadingLeft = value;
1981 }
1982 else if( tagName == "Top" ) {
1983 int value;
1984 if( KDXML::readIntNode( element, value ) )
1985 _globalLeadingTop = value;
1986 }
1987 else if( tagName == "Right" ) {
1988 int value;
1989 if( KDXML::readIntNode( element, value ) )
1990 _globalLeadingRight = value;
1991 }
1992 else if( tagName == "Bottom" ) {
1993 int value;
1994 if( KDXML::readIntNode( element, value ) )
1995 _globalLeadingBottom = value;
1996 } else {
1997 tqDebug( "Unknown subelement of GlobalLeading found: %s", tagName.latin1() );
1998 }
1999 }
2000 node = node.nextSibling();
2001 }
2002 } else if( tagName == "DataValuesSettings1" ) {
2003 TQDomNode node = element.firstChild();
2004 while( !node.isNull() ) {
2005 TQDomElement element = node.toElement();
2006 if( !element.isNull() ) { // was really an element
2007 TQString tagName = element.tagName();
2008 if( tagName == "PrintDataValues" ) {
2009 bool value;
2010 if( KDXML::readBoolNode( element, value ) )
2011 _printDataValuesSettings._printDataValues = value;
2012 } else if( tagName == "DivPow10" ) {
2013 int value;
2014 if( KDXML::readIntNode( element, value ) )
2015 _printDataValuesSettings._divPow10 = value;
2016 } else if( tagName == "DigitsBehindComma" ) {
2017 int value;
2018 if( KDXML::readIntNode( element, value ) )
2019 _printDataValuesSettings._digitsBehindComma = value;
2020 } else if( tagName == "Font" ) {
2021 readChartFontNode( element,
2022 _printDataValuesSettings._dataValuesFont,
2023 _printDataValuesSettings._dataValuesUseFontRelSize,
2024 _printDataValuesSettings._dataValuesFontRelSize );
2025 } else if( tagName == "Color" ) {
2026 KDXML::readColorNode( element, _printDataValuesSettings._dataValuesColor );
2027 } else if( tagName == "Background" ) {
2028 KDXML::readBrushNode( element, _printDataValuesSettings._dataValuesBrush );
2029 } else if( tagName == "AutoColor" ) {
2030 KDXML::readBoolNode( element,
2031 _printDataValuesSettings._dataValuesAutoColor );
2032 } else if( tagName == "AnchorNegativePosition" ) {
2033 TQString value;
2034 if( KDXML::readStringNode( element, value ) )
2035 _printDataValuesSettings._dataValuesAnchorNegativePosition = KDChartEnums::stringToPositionFlag( value );
2036 } else if( tagName == "AnchorNegativeAlign" ) {
2037 int value;
2038 if( KDXML::readIntNode( element, value ) )
2039 _printDataValuesSettings._dataValuesAnchorNegativeAlign = value;
2040 } else if( tagName == "AnchorNegativeDeltaX" ) {
2041 int value;
2042 if( KDXML::readIntNode( element, value ) )
2043 _printDataValuesSettings._dataValuesAnchorNegativeDeltaX = value;
2044 } else if( tagName == "AnchorNegativeDeltaY" ) {
2045 int value;
2046 if( KDXML::readIntNode( element, value ) )
2047 _printDataValuesSettings._dataValuesAnchorNegativeDeltaY = value;
2048 } else if( tagName == "NegativeRotation" ) {
2049 int value;
2050 if( KDXML::readIntNode( element, value ) )
2051 _printDataValuesSettings._dataValuesNegativeRotation = value;
2052 } else if( tagName == "AnchorPositivePosition" ) {
2053 TQString value;
2054 if( KDXML::readStringNode( element, value ) )
2055 _printDataValuesSettings._dataValuesAnchorPositivePosition = KDChartEnums::stringToPositionFlag( value );
2056 } else if( tagName == "AnchorPositiveAlign" ) {
2057 int value;
2058 if( KDXML::readIntNode( element, value ) )
2059 _printDataValuesSettings._dataValuesAnchorPositiveAlign = value;
2060 } else if( tagName == "AnchorPositiveDeltaX" ) {
2061 int value;
2062 if( KDXML::readIntNode( element, value ) )
2063 _printDataValuesSettings._dataValuesAnchorPositiveDeltaX = value;
2064 } else if( tagName == "AnchorPositiveDeltaY" ) {
2065 int value;
2066 if( KDXML::readIntNode( element, value ) )
2067 _printDataValuesSettings._dataValuesAnchorPositiveDeltaY = value;
2068 } else if( tagName == "PositiveRotation" ) {
2069 int value;
2070 if( KDXML::readIntNode( element, value ) )
2071 _printDataValuesSettings._dataValuesPositiveRotation = value;
2072 } else if( tagName == "LayoutPolicy" ) {
2073 TQString value;
2074 if( KDXML::readStringNode( element, value ) )
2075 _printDataValuesSettings._dataValuesLayoutPolicy = KDChartEnums::stringToLayoutPolicy( value );
2076 } else if( tagName == "ShowInfinite" ) {
2077 KDXML::readBoolNode( element, _printDataValuesSettings._dataValuesShowInfinite );
2078 } else {
2079 tqDebug( "Unknown subelement of DataValuesSettings1 found: %s", tagName.latin1() );
2080 }
2081 }
2082 node = node.nextSibling();
2083 }
2084 } else if( tagName == "DataValuesSettings2" ) {
2085 TQDomNode node = element.firstChild();
2086 while( !node.isNull() ) {
2087 TQDomElement element = node.toElement();
2088 if( !element.isNull() ) { // was really an element
2089 TQString tagName = element.tagName();
2090 if( tagName == "PrintDataValues" ) {
2091 bool value;
2092 if( KDXML::readBoolNode( element, value ) )
2093 _printDataValuesSettings2._printDataValues = value;
2094 } else if( tagName == "DivPow10" ) {
2095 int value;
2096 if( KDXML::readIntNode( element, value ) )
2097 _printDataValuesSettings2._divPow10 = value;
2098 } else if( tagName == "DigitsBehindComma" ) {
2099 int value;
2100 if( KDXML::readIntNode( element, value ) )
2101 _printDataValuesSettings2._digitsBehindComma = value;
2102 } else if( tagName == "Font" ) {
2103 readChartFontNode( element,
2104 _printDataValuesSettings2._dataValuesFont,
2105 _printDataValuesSettings2._dataValuesUseFontRelSize,
2106 _printDataValuesSettings2._dataValuesFontRelSize );
2107 } else if( tagName == "Color" ) {
2108 KDXML::readColorNode( element, _printDataValuesSettings2._dataValuesColor );
2109 } else if( tagName == "Background" ) {
2110 KDXML::readBrushNode( element, _printDataValuesSettings2._dataValuesBrush );
2111 } else if( tagName == "AutoColor" ) {
2112 KDXML::readBoolNode( element,
2113 _printDataValuesSettings2._dataValuesAutoColor );
2114 } else if( tagName == "AnchorNegativePosition" ) {
2115 TQString value;
2116 if( KDXML::readStringNode( element, value ) )
2117 _printDataValuesSettings2._dataValuesAnchorNegativePosition = KDChartEnums::stringToPositionFlag( value );
2118 } else if( tagName == "AnchorNegativeAlign" ) {
2119 int value;
2120 if( KDXML::readIntNode( element, value ) )
2121 _printDataValuesSettings2._dataValuesAnchorNegativeAlign = value;
2122 } else if( tagName == "AnchorNegativeDeltaX" ) {
2123 int value;
2124 if( KDXML::readIntNode( element, value ) )
2125 _printDataValuesSettings2._dataValuesAnchorNegativeDeltaX = value;
2126 } else if( tagName == "AnchorNegativeDeltaY" ) {
2127 int value;
2128 if( KDXML::readIntNode( element, value ) )
2129 _printDataValuesSettings2._dataValuesAnchorNegativeDeltaY = value;
2130 } else if( tagName == "NegativeRotation" ) {
2131 int value;
2132 if( KDXML::readIntNode( element, value ) )
2133 _printDataValuesSettings2._dataValuesNegativeRotation = value;
2134 } else if( tagName == "AnchorPositivePosition" ) {
2135 TQString value;
2136 if( KDXML::readStringNode( element, value ) )
2137 _printDataValuesSettings2._dataValuesAnchorPositivePosition = KDChartEnums::stringToPositionFlag( value );
2138 } else if( tagName == "AnchorPositiveAlign" ) {
2139 int value;
2140 if( KDXML::readIntNode( element, value ) )
2141 _printDataValuesSettings2._dataValuesAnchorPositiveAlign = value;
2142 } else if( tagName == "AnchorPositiveDeltaX" ) {
2143 int value;
2144 if( KDXML::readIntNode( element, value ) )
2145 _printDataValuesSettings2._dataValuesAnchorPositiveDeltaX = value;
2146 } else if( tagName == "AnchorPositiveDeltaY" ) {
2147 int value;
2148 if( KDXML::readIntNode( element, value ) )
2149 _printDataValuesSettings2._dataValuesAnchorPositiveDeltaY = value;
2150 } else if( tagName == "PositiveRotation" ) {
2151 int value;
2152 if( KDXML::readIntNode( element, value ) )
2153 _printDataValuesSettings2._dataValuesPositiveRotation = value;
2154 } else if( tagName == "LayoutPolicy" ) {
2155 TQString value;
2156 if( KDXML::readStringNode( element, value ) )
2157 _printDataValuesSettings2._dataValuesLayoutPolicy = KDChartEnums::stringToLayoutPolicy( value );
2158 } else if( tagName == "ShowInfinite" ) {
2159 KDXML::readBoolNode( element, _printDataValuesSettings2._dataValuesShowInfinite );
2160 } else {
2161 tqDebug( "Unknown subelement of DataValuesSettings2 found: %s", tagName.latin1() );
2162 }
2163 }
2164 node = node.nextSibling();
2165 }
2166 } else if( tagName == "DataValuesGlobalSettings" ) {
2167 TQDomNode node = element.firstChild();
2168 while( !node.isNull() ) {
2169 TQDomElement element = node.toElement();
2170 if( !element.isNull() ) { // was really an element
2171 TQString tagName = element.tagName();
2172 if( tagName == "allowOverlappingTexts" ) {
2173 bool value;
2174 if( KDXML::readBoolNode( element, value ) )
2175 _allowOverlappingDataValueTexts = value;
2176 }
2177 else
2178 tqDebug( "Unknown subelement of DataValuesGlobalSettings found: %s", tagName.latin1() );
2179 // do _not_ return false here (to enable future extentions)
2180 }
2181 node = node.nextSibling();
2182 }
2183 } else if( tagName == "AreaMap" ) {
2184 TQDomNode node = element.firstChild();
2185 while( !node.isNull() ) {
2186 TQDomElement element = node.toElement();
2187 if( !element.isNull() ) { // was really an element
2188 TQString tagName = element.tagName();
2189 if( tagName == "FrameSettings" ) {
2191 uint areaId = KDChartEnums::AreaUNKNOWN;
2193 element, *frameSettings, areaId ) ) {
2194 TQString str;
2195 if(areaId == KDChartEnums::AreaChartDataRegion)
2196 str = TQString( "%1/%2/%3/%4" )
2197 .arg( areaId, 5 )
2198 .arg( frameSettings->dataRow(), 5 )
2199 .arg( frameSettings->dataCol(), 5 )
2200 .arg( 0, 5 );//frameSettings->data3rd(), 5 );
2201 else
2202 str = TQString( "%1/-----/-----/-----" ).arg( areaId, 5 );
2203 _areaDict.replace( str, frameSettings );
2204 }
2205 }
2206 else
2207 tqDebug( "Unknown tag in AreaMap found: %s", tagName.latin1() );
2208 // do _not_ return false here (to enable future extentions)
2209 }
2210 node = node.nextSibling();
2211 }
2212 } else if( tagName == "CustomBoxMap" ) {
2213 TQDomNode node = element.firstChild();
2214 int curNumber = -1;
2215 while( !node.isNull() ) {
2216 TQDomElement element = node.toElement();
2217 if( !element.isNull() ) { // was really an element
2218 TQString tagName = element.tagName();
2219 if( tagName == "Number" ) {
2220 KDXML::readIntNode( element, curNumber );
2221 } else if( tagName == "CustomBox" ) {
2222 Q_ASSERT( curNumber != -1 ); // there was a Dataset tag before
2225 customBox );
2226 _customBoxDict.insert( curNumber, customBox.clone() );
2227 }
2228 else
2229 tqDebug( "Unknown tag in CustomBoxMap found: %s", tagName.latin1() );
2230 }
2231 node = node.nextSibling();
2232 }
2233 } else {
2234 tqDebug( "Unknown second-level element found: %s", tagName.latin1() );
2235 // NOTE: We do *not* 'return false' here but continue normal operation
2236 // since additional elements might have been added in future versions
2237 }
2238 }
2239 node = node.nextSibling();
2240 }
2241 return true;
2242}
2243
2244
2254void KDChartParams::createColorMapNode( TQDomDocument& doc, TQDomNode& parent,
2255 const TQString& elementName,
2256 const TQMap< uint, TQColor >& map )
2257{
2258 TQDomElement mapElement =
2259 doc.createElement( elementName );
2260 parent.appendChild( mapElement );
2261 for( TQMap<uint,TQColor>::ConstIterator it = map.begin();
2262 it != map.end(); ++it ) {
2263 // Dataset element
2264 TQDomElement datasetElement = doc.createElement( "Dataset" );
2265 mapElement.appendChild( datasetElement );
2266 TQDomText datasetContent =
2267 doc.createTextNode( TQString::number( it.key() ) );
2268 datasetElement.appendChild( datasetContent );
2269 // Color element
2270 KDXML::createColorNode( doc, mapElement, "Color", it.data() );
2271 }
2272}
2273
2274
2284void KDChartParams::createDoubleMapNode( TQDomDocument& doc, TQDomNode& parent,
2285 const TQString& elementName,
2286 const TQMap< int, double >& map )
2287{
2288 TQDomElement mapElement =
2289 doc.createElement( elementName );
2290 parent.appendChild( mapElement );
2291 for( TQMap<int,double>::ConstIterator it = map.begin();
2292 it != map.end(); ++it ) {
2293 // Dataset element
2294 TQDomElement valueElement = doc.createElement( "Value" );
2295 mapElement.appendChild( valueElement );
2296 TQDomText valueContent =
2297 doc.createTextNode( TQString::number( it.key() ) );
2298 valueElement.appendChild( valueContent );
2299 // Color element
2300 KDXML::createDoubleNode( doc, mapElement, "Factor", it.data() );
2301 }
2302}
2303
2304
2305void dataCoordToElementAttr(const TQVariant& val, TQDomElement& element, const TQString& postfix)
2306{
2307 if( TQVariant::Double == val.type() )
2308 element.setAttribute( "DoubleValue"+postfix,
2309 TQString::number( val.toDouble() ) );
2310 else if( TQVariant::String == val.type() )
2311 element.setAttribute( "StringValue"+postfix, val.toString() );
2312 else if( TQVariant::DateTime == val.type() )
2313 element.setAttribute( "DateTimeValue"+postfix,
2314 val.toDateTime().toString( TQt::ISODate ) );
2315 else
2316 element.setAttribute( "NoValue"+postfix, "true" );
2317}
2318
2328void KDChartParams::createChartValueNode( TQDomDocument& doc, TQDomNode& parent,
2329 const TQString& elementName,
2330 const TQVariant& valY,
2331 const TQVariant& valX,
2332 const int& propID )
2333{
2334 TQDomElement element = doc.createElement( elementName );
2335 parent.appendChild( element );
2336 dataCoordToElementAttr( valY, element, "" ); // no postfix for Y value: backwards compat.
2337 dataCoordToElementAttr( valX, element, "X" );
2338 element.setAttribute( "PropertySetID",
2339 TQString::number( propID ) );
2340}
2341
2342
2343
2357void KDChartParams::createChartFontNode( TQDomDocument& doc, TQDomNode& parent,
2358 const TQString& elementName,
2359 const TQFont& font, bool useRelFont,
2360 int relFont,
2361 int minFont )
2362{
2363 TQDomElement chartFontElement = doc.createElement( elementName );
2364 parent.appendChild( chartFontElement );
2365 KDXML::createFontNode( doc, chartFontElement, "Font", font );
2366 KDXML::createBoolNode( doc, chartFontElement, "UseRelFontSize",
2367 useRelFont );
2368 KDXML::createIntNode( doc, chartFontElement, "RelFontSize", relFont );
2369 if( 0 <= minFont )
2370 KDXML::createIntNode( doc, chartFontElement, "MinFontSize", minFont );
2371}
2372
2373
2374
2375
2376
2386bool KDChartParams::readColorMapNode( const TQDomElement& element,
2387 TQMap<uint,TQColor>* value )
2388{
2389 TQDomNode node = element.firstChild();
2390 int curDataset = -1;
2391 while( !node.isNull() ) {
2392 TQDomElement element = node.toElement();
2393 if( !element.isNull() ) { // was really an element
2394 TQString tagName = element.tagName();
2395 if( tagName == "Dataset" ) {
2396 KDXML::readIntNode( element, curDataset );
2397 } else if( tagName == "Color" ) {
2398 Q_ASSERT( curDataset != -1 ); // there was a Dataset tag before
2399 TQColor color;
2400 KDXML::readColorNode( element, color );
2401 value->insert( curDataset, color );
2402 } else {
2403 tqDebug( "Unknown tag in color map" );
2404 }
2405 }
2406 node = node.nextSibling();
2407 }
2408
2409 return true;
2410}
2411
2412
2420bool KDChartParams::readDoubleMapNode( const TQDomElement& element,
2421 TQMap<int,double>* value )
2422{
2423 TQDomNode node = element.firstChild();
2424 int curValue = -1;
2425 while( !node.isNull() ) {
2426 TQDomElement element = node.toElement();
2427 if( !element.isNull() ) { // was really an element
2428 TQString tagName = element.tagName();
2429 if( tagName == "Value" ) {
2430 KDXML::readIntNode( element, curValue );
2431 } else if( tagName == "Factor" ) {
2432 Q_ASSERT( curValue != -1 ); // there was a Value tag before
2433 double doubleValue;
2434 KDXML::readDoubleNode( element, doubleValue );
2435 value->insert( curValue, doubleValue );
2436 } else {
2437 tqDebug( "Unknown tag in double map" );
2438 }
2439 }
2440 node = node.nextSibling();
2441 }
2442
2443 return true;
2444}
2445
2446
2447
2458bool KDChartParams::readChartFontNode( const TQDomElement& element,
2459 TQFont& font,
2460 bool& useRelFont,
2461 int& relFontSize,
2462 int* minFontSize )
2463{
2464 bool ok = true;
2465 TQFont tempFont;
2466 bool tempRelFont;
2467 int tempRelFontSize;
2468 int tempMinFontSize=-1;
2469 TQDomNode node = element.firstChild();
2470 while( !node.isNull() ) {
2471 TQDomElement element = node.toElement();
2472 if( !element.isNull() ) { // was really an element
2473 TQString tagName = element.tagName();
2474 if( tagName == "Font" ) {
2475 ok = ok & KDXML::readFontNode( element, tempFont );
2476 } else if( tagName == "UseRelFontSize" ) {
2477 ok = ok & KDXML::readBoolNode( element, tempRelFont );
2478 } else if( tagName == "RelFontSize" ) {
2479 ok = ok & KDXML::readIntNode( element, tempRelFontSize );
2480 } else if( tagName == "MinFontSize" ) {
2481 ok = ok & KDXML::readIntNode( element, tempMinFontSize );
2482 } else {
2483 tqDebug( "Unknown tag in color map" );
2484 }
2485 }
2486 node = node.nextSibling();
2487 }
2488
2489 if( ok ) {
2490 font = tempFont;
2491 useRelFont = tempRelFont;
2492 relFontSize = tempRelFontSize;
2493 if( minFontSize && 0 <= tempMinFontSize )
2494 *minFontSize = tempMinFontSize;
2495 }
2496
2497 return ok;
2498}
2499
2500
2501bool foundCoordAttribute( const TQDomElement& element, const TQString& postfix,
2502 TQVariant& val )
2503{
2504 if( element.hasAttribute( "NoValue"+postfix ) )
2505 val = TQVariant();
2506 else if( element.hasAttribute( "DoubleValue"+postfix ) )
2507 val = element.attribute( "DoubleValue"+postfix );
2508 else if( element.hasAttribute( "DateTimeValue"+postfix ) )
2509 val = element.attribute( "DateTimeValue"+postfix );
2510 else if( element.hasAttribute( "StringValue"+postfix ) )
2511 val = element.attribute( "StringValue"+postfix );
2512 else
2513 return false;
2514
2515 return true;
2516}
2517
2518// PENDING(kalle) Support DateTime values, even when writing.
2526bool KDChartParams::readChartValueNode( const TQDomElement& element,
2527 TQVariant& valY,
2528 TQVariant& valX,
2529 int& propID )
2530{
2531 if( foundCoordAttribute( element, "", valY ) ||
2532 foundCoordAttribute( element, "Y", valY ) ){ // valY must be there
2533 if( !foundCoordAttribute( element, "X", valX ) ){
2534 valX = TQVariant();
2535 }
2536 propID = 0;
2537 if( element.hasAttribute( "PropertySetID" ) ) {
2538 bool ok;
2539 int i = element.attribute( "PropertySetID" ).toInt( &ok );
2540 if( ok )
2541 propID = i;
2542 }
2543 return true; // if Y value found everything is OK
2544 }
2545
2546 return false;
2547}
2548
2549
2557{
2558 switch( type ) {
2559 case NoType:
2560 return "NoType";
2561 case Bar:
2562 return "Bar";
2563 case Line:
2564 return "Line";
2565 case Area:
2566 return "Area";
2567 case Pie:
2568 return "Pie";
2569 case HiLo:
2570 return "HiLo";
2571 case BoxWhisker:
2572 return "BoxWhisker";
2573 case Ring:
2574 return "Ring";
2575 case Polar:
2576 return "Polar";
2577 default: // should not happen
2578 return "NoType";
2579 }
2580}
2581
2582
2590{
2591 if( string == "NoType" )
2592 return NoType;
2593 else if( string == "Bar" )
2594 return Bar;
2595 else if( string == "Line" )
2596 return Line;
2597 else if( string == "Area" )
2598 return Area;
2599 else if( string == "Pie" )
2600 return Pie;
2601 else if( string == "HiLo" )
2602 return HiLo;
2603 else if( string == "BoxWhisker" )
2604 return BoxWhisker;
2605 else if( string == "Ring" )
2606 return Ring;
2607 else if( string == "Polar" )
2608 return Polar;
2609 else // default, should not happen
2610 return NoType;
2611}
2612
2613
2614
2615TQString KDChartParams::markerStyleToString( int style )
2616{
2617 switch( style ) {
2618 case LineMarkerSquare:
2619 return "Square";
2620 case LineMarkerDiamond:
2621 return "Diamond";
2622 case LineMarkerCircle:
2623 return "Circle";
2624 case LineMarker1Pixel:
2625 return "one Pixel";
2626 case LineMarker4Pixels:
2627 return "four Pixels";
2628 case LineMarkerRing:
2629 return "Ring";
2630 case LineMarkerCross:
2631 return "Cross";
2632 case LineMarkerFastCross:
2633 return "fast Cross";
2634 default: // should not happen
2635 tqDebug( "Unknown marker style" );
2636 return "Circle";
2637 }
2638}
2639TQString KDChartParams::markerStyleToStringTr( int style )
2640{
2641 switch( style ) {
2642 case LineMarkerSquare:
2643 return tr( "Square" );
2644 case LineMarkerDiamond:
2645 return tr( "Diamond" );
2646 case LineMarkerCircle:
2647 return tr( "Circle" );
2648 case LineMarker1Pixel:
2649 return tr( "One pixel" );
2650 case LineMarker4Pixels:
2651 return tr( "Four pixels" );
2652 case LineMarkerRing:
2653 return tr( "Ring" );
2654 case LineMarkerCross:
2655 return tr( "Cross" );
2656 case LineMarkerFastCross:
2657 return tr( "fast Cross" );
2658 default: // should not happen
2659 tqDebug( "Unknown line marker style!" );
2660 return tr( "Circle" );
2661 }
2662}
2663int KDChartParams::stringToMarkerStyle( const TQString& string )
2664{
2665 if( string == "Square" )
2666 return LineMarkerSquare;
2667 else if( string == "Diamond" )
2668 return LineMarkerDiamond;
2669 else if( string == "Circle" )
2670 return LineMarkerCircle;
2671 else if( string == "one Pixel" )
2672 return LineMarker1Pixel;
2673 else if( string == "four Pixels" )
2674 return LineMarker4Pixels;
2675 else if( string == "Ring" )
2676 return LineMarkerRing;
2677 else if( string == "Cross" )
2678 return LineMarkerCross;
2679 else if( string == "fast Cross" )
2680 return LineMarkerFastCross;
2681 else // default, should not happen
2682 return LineMarkerCircle;
2683}
2684int KDChartParams::stringToMarkerStyleTr( const TQString& string )
2685{
2686 if( string == tr( "Square" ) )
2687 return LineMarkerSquare;
2688 else if( string == tr( "Diamond" ) )
2689 return LineMarkerDiamond;
2690 else if( string == tr( "Circle" ) )
2691 return LineMarkerCircle;
2692 else if( string == tr( "One pixel" ) )
2693 return LineMarker1Pixel;
2694 else if( string == tr( "Four pixels" ) )
2695 return LineMarker4Pixels;
2696 else if( string == tr( "Ring" ) )
2697 return LineMarkerRing;
2698 else if( string == tr( "Cross" ) )
2699 return LineMarkerCross;
2700 else if( string == tr( "fast Cross" ) )
2701 return LineMarkerFastCross;
2702 else // default, should not happen
2703 return LineMarkerCircle;
2704}
2705
2706
2707
2715 switch( type ) {
2716 case BarNormal:
2717 return "BarNormal";
2718 case BarStacked:
2719 return "BarStacked";
2720 case BarPercent:
2721 return "BarPercent";
2722 case BarMultiRows:
2723 return "BarMultiRows";
2724 default: // should not happen
2725 tqDebug( "Unknown bar type" );
2726 return "BarNormal";
2727 }
2728}
2729
2730
2738 if( string == "BarNormal" )
2739 return BarNormal;
2740 else if( string == "BarStacked" )
2741 return BarStacked;
2742 else if( string == "BarPercent" )
2743 return BarPercent;
2744 else if( string == "BarMultiRows" )
2745 return BarMultiRows;
2746 else // should not happen
2747 return BarNormal;
2748}
2749
2750
2751
2759 if( string == "LineNormal" )
2760 return LineNormal;
2761 else if( string == "LineStacked" )
2762 return LineStacked;
2763 else if( string == "LinePercent" )
2764 return LinePercent;
2765 else // should not happen
2766 return LineNormal;
2767}
2768
2769
2770
2778 switch( type ) {
2779 case LineNormal:
2780 return "LineNormal";
2781 case LineStacked:
2782 return "LineStacked";
2783 case LinePercent:
2784 return "LinePercent";
2785 default: // should not happen
2786 tqDebug( "Unknown bar type" );
2787 return "LineNormal";
2788 }
2789}
2790
2791
2800{
2801 return markerStyleToString( style );
2802}
2803
2804
2813{
2814 return markerStyleToStringTr( style );
2815}
2816
2817
2825{
2826 return static_cast<KDChartParams::LineMarkerStyle>(stringToMarkerStyle( string ));
2827}
2828
2837{
2838 return static_cast<KDChartParams::LineMarkerStyle>(stringToMarkerStyleTr( string ));
2839}
2840
2841
2849 switch( type ) {
2850 case AreaNormal:
2851 return "AreaNormal";
2852 case AreaStacked:
2853 return "AreaStacked";
2854 case AreaPercent:
2855 return "AreaPercent";
2856 default: // should not happen
2857 tqDebug( "Unknown area chart subtype" );
2858 return "AreaNormal";
2859 }
2860}
2861
2862
2870 if( string == "AreaNormal" )
2871 return AreaNormal;
2872 else if( string == "AreaStacked" )
2873 return AreaStacked;
2874 else if( string == "AreaPercent" )
2875 return AreaPercent;
2876 else // should not happen
2877 return AreaNormal;
2878}
2879
2880
2888 switch( type ) {
2889 case AreaAbove:
2890 return "Above";
2891 case AreaBelow:
2892 return "Below";
2893 default: // should not happen
2894 tqDebug( "Unknown area location" );
2895 return "Below";
2896 }
2897}
2898
2899
2907 if( string == "Above" )
2908 return AreaAbove;
2909 else if( string == "Below" )
2910 return AreaBelow;
2911 else // default, should not happen
2912 return AreaBelow;
2913}
2914
2915
2923 if( string == "PolarNormal" )
2924 return PolarNormal;
2925 else if( string == "PolarStacked" )
2926 return PolarStacked;
2927 else if( string == "PolarPercent" )
2928 return PolarPercent;
2929 else // should not happen
2930 return PolarNormal;
2931}
2932
2933
2941 switch( type ) {
2942 case PolarNormal:
2943 return "PolarNormal";
2944 case LineStacked:
2945 return "PolarStacked";
2946 case LinePercent:
2947 return "PolarPercent";
2948 default: // should not happen
2949 tqDebug( "Unknown polar type" );
2950 return "PolarNormal";
2951 }
2952}
2953
2954
2963{
2964 return markerStyleToString( style );
2965}
2966
2967
2976{
2977 return markerStyleToStringTr( style );
2978}
2979
2980
2988{
2989 return static_cast<KDChartParams::PolarMarkerStyle>(stringToMarkerStyle( string ));
2990}
2991
2992
3001{
3002 return static_cast<KDChartParams::PolarMarkerStyle>(stringToMarkerStyle( string ));
3003}
3004
3005
3013 switch( type ) {
3014 case HiLoSimple:
3015 return "HiLoSimple";
3016 case HiLoClose:
3017 return "HiLoClose";
3018 case HiLoOpenClose:
3019 return "HiLoOpenClose";
3020 default: // should not happen
3021 tqDebug( "Unknown HiLo chart subtype" );
3022 return "HiLoNormal";
3023 }
3024}
3025
3026
3034 if( string == "HiLoSimple" )
3035 return HiLoSimple;
3036 else if( string == "HiLoClose" )
3037 return HiLoClose;
3038 else if( string == "HiLoOpenClose" )
3039 return HiLoOpenClose;
3040 else // should not happen
3041 return HiLoNormal;
3042}
3043
3044
3052 if( string == "BWSimple" )
3053 return BWSimple;
3054 else // should not happen
3055 return BWNormal;
3056}
3057
3065 switch( type ) {
3066 case UpperOuterFence:
3067 return "UpperOuterFence";
3068 case UpperInnerFence:
3069 return "UpperInnerFence";
3070 case Quartile3:
3071 return "Quartile3";
3072 case Median:
3073 return "Median";
3074 case Quartile1:
3075 return "Quartile1";
3076 case LowerInnerFence:
3077 return "LowerInnerFence";
3078 case LowerOuterFence:
3079 return "LowerOuterFence";
3080 case MaxValue:
3081 return "MaxValue";
3082 case MeanValue:
3083 return "MeanValue";
3084 case MinValue:
3085 return "MinValue";
3086 default: // should not happen
3087 tqDebug( "Unknown BoxWhisker statistical value type" );
3088 return "unknown";
3089 }
3090}
3091
3099 if( string == "UpperOuterFence" )
3100 return UpperOuterFence;
3101 else if( string == "UpperInnerFence" )
3102 return UpperInnerFence;
3103 else if( string == "Quartile3" )
3104 return Quartile3;
3105 else if( string == "Median" )
3106 return Median;
3107 else if( string == "Quartile1" )
3108 return Quartile1;
3109 else if( string == "LowerInnerFence" )
3110 return LowerInnerFence;
3111 else if( string == "LowerOuterFence" )
3112 return LowerOuterFence;
3113 else if( string == "MaxValue" )
3114 return MaxValue;
3115 else if( string == "MeanValue" )
3116 return MeanValue;
3117 else if( string == "MinValue" )
3118 return MinValue;
3119 else // should not happen
3120 return BWStatValUNKNOWN;
3121}
3122
3123
3131 switch( pos ) {
3132 case NoLegend:
3133 return "NoLegend";
3134 case LegendTop:
3135 return "LegendTop";
3136 case LegendBottom:
3137 return "LegendBottom";
3138 case LegendLeft:
3139 return "LegendLeft";
3140 case LegendRight:
3141 return "LegendRight";
3142 case LegendTopLeft:
3143 return "LegendTopLeft";
3144 case LegendTopLeftTop:
3145 return "LegendTopLeftTop";
3146 case LegendTopLeftLeft:
3147 return "LegendTopLeftLeft";
3148 case LegendBottomLeft:
3149 return "LegendBottomLeft";
3150 case LegendBottomLeftBottom:
3151 return "LegendBottomLeftBottom";
3152 case LegendBottomLeftLeft:
3153 return "LegendBottomLeftLeft";
3154 case LegendTopRight:
3155 return "LegendTopRight";
3156 case LegendTopRightTop:
3157 return "LegendTopRightTop";
3158 case LegendTopRightRight:
3159 return "LegendTopRightRight";
3160 case LegendBottomRight:
3161 return "LegendBottomRight";
3162 case LegendBottomRightBottom:
3163 return "LegendBottomRightBottom";
3164 case LegendBottomRightRight:
3165 return "LegendBottomRightRight";
3166 default: // should not happen
3167 tqDebug( "Unknown legend position" );
3168 return "LegendLeft";
3169 }
3170}
3171
3172
3180 if( string == "NoLegend" )
3181 return NoLegend;
3182 else if( string == "LegendTop" )
3183 return LegendTop;
3184 else if( string == "LegendBottom" )
3185 return LegendBottom;
3186 else if( string == "LegendLeft" )
3187 return LegendLeft;
3188 else if( string == "LegendRight" )
3189 return LegendRight;
3190 else if( string == "LegendTopLeft" )
3191 return LegendTopLeft;
3192 else if( string == "LegendTopLeftTop" )
3193 return LegendTopLeftTop;
3194 else if( string == "LegendTopLeftLeft" )
3195 return LegendTopLeftLeft;
3196 else if( string == "LegendBottomLeft" )
3197 return LegendBottomLeft;
3198 else if( string == "LegendBottomLeftBottom" )
3199 return LegendBottomLeftBottom;
3200 else if( string == "LegendBottomLeftLeft" )
3201 return LegendBottomLeftLeft;
3202 else if( string == "LegendTopRight" )
3203 return LegendTopRight;
3204 else if( string == "LegendTopRightTop" )
3205 return LegendTopRightTop;
3206 else if( string == "LegendTopRightRight" )
3207 return LegendTopRightRight;
3208 else if( string == "LegendBottomRight" )
3209 return LegendBottomRight;
3210 else if( string == "LegendBottomRightBottom" )
3211 return LegendBottomRightBottom;
3212 else if( string == "LegendBottomRightRight" )
3213 return LegendBottomRightRight;
3214 else // default, should not happen
3215 return LegendLeft;
3216}
3217
3225 switch( source ) {
3226 case LegendManual:
3227 return "Manual";
3228 case LegendFirstColumn:
3229 return "FirstColumn";
3230 case LegendAutomatic:
3231 return "Automatic";
3232 default: // should not happen
3233 tqDebug( "Unknown legend source" );
3234 return "Automatic";
3235 }
3236}
3237
3238
3246 if( string == "Manual" )
3247 return LegendManual;
3248 else if( string == "FirstColumn" )
3249 return LegendFirstColumn;
3250 else if( string == "Automatic" )
3251 return LegendAutomatic;
3252 else // default, should not happen
3253 return LegendAutomatic;
3254}
3255
3256
3264{
3265 switch( mode ){
3266 case UnknownMode:
3267 return "UnknownMode";
3268 case DontUse:
3269 return "DontUse";
3270 case DataEntry:
3271 return "DataEntry";
3272 case AxisLabel:
3273 return "AxisLabel";
3274 case LegendText:
3275 return "LegendText";
3276 case ExtraLinesAnchor:
3277 return "ExtraLinesAnchor";
3278 default: // should not happen
3279 return "UnknownMode";
3280 }
3281}
3282
3283
3291{
3292 if( string.isEmpty() )
3293 return UnknownMode;
3294 // compatibility with pre-1.0 KDChart stream format:
3295 bool bOk;
3296 int mode = string.toInt( &bOk );
3297 if( bOk && mode >= 0 && mode <= Last_SourceMode )
3298 return (KDChartParams::SourceMode)mode;
3299 // new (KDChart 1.0...) stream format:
3300 if( string == "UnknownMode" )
3301 return UnknownMode;
3302 if( string == "DontUse" )
3303 return DontUse;
3304 if( string == "DataEntry" )
3305 return DataEntry;
3306 if( string == "AxisLabel" )
3307 return AxisLabel;
3308 if( string == "LegendText" )
3309 return LegendText;
3310 if( string == "ExtraLinesAnchor" )
3311 return ExtraLinesAnchor;
3312 // should not happen
3313 return UnknownMode;
3314}
3315
3316
3325 switch( type ) {
3326 case BWSimple:
3327 return "BWSimple";
3328 default: // should not happen
3329 tqDebug( "Unknown BoxWhisker chart subtype" );
3330 return "BWNormal";
3331 }
3332}
3333
#define KDCHART_AXIS_LABELS_AUTO_LIMIT
Use this to specify that the axis label limits are to be calculated automatically.
#define KDCHART_AXIS_LABELS_AUTO_DELTA
Use this to specify that the step-width from one label to the other shall be calculated automatically...
Header for all common chart parameters.
TQTextStream & operator>>(TQTextStream &s, KDChartParams &p)
Reads the an XML document from the text stream s into the KDChartParams object p.
TQTextStream & operator<<(TQTextStream &s, const KDChartParams &p)
Writes the KDChartParams object p as an XML document to the text stream s.
access the chart axis parameters.
static AxisType stringToAxisType(const TQString &type)
Converts the specified string to an axis type enum value.
static TQString axisTypeToString(AxisType type)
Converts the specified axis type enum to a string representation.
static TQString labelsFromDataRowToString(LabelsFromDataRow mode)
enum LabelsFromDataRow { LabelsFromDataRowYes, LabelsFromDataRowNo, LabelsFromDataRowGuess };
static LabelsFromDataRow stringToLabelsFromDataRow(const TQString &type)
Converts the specified string to a data row enum value.
static TQString axisAreaModeToString(AxisAreaMode mode)
Converts the specified axis area mode enum to a string representation.
static AxisAreaMode stringToAxisAreaMode(const TQString &type)
Converts the specified string to an axis area mode enum value.
static AxisCalcMode stringToAxisCalcMode(const TQString &type)
Converts the specified string to an axis calc mode enum value.
static TQString axisCalcModeToString(AxisCalcMode mode)
Converts the specified axis calc mode enum to a string representation.
Class for specifying and drawing custom boxes.
const KDChartCustomBox * clone() const
Create a new box on the heap, copy the settings stored by this box into the newly created box and ret...
static bool readCustomBoxNode(const TQDomElement &element, KDChartCustomBox &custombox)
Reads data from a DOM element node that represents a custom box object and fills a KDChartCustomBox o...
static void createCustomBoxNode(TQDomDocument &document, TQDomNode &parent, const TQString &elementName, const KDChartCustomBox *custombox)
Creates a DOM element node that represents a custom box for use in a DOM document.
static PositionFlag stringToPositionFlag(const TQString &string)
Converts the specified string to a content position enum value.
static TQString layoutPolicyToString(TextLayoutPolicy type)
Converts the specified text layout policy enum to a string representation.
static TextLayoutPolicy stringToLayoutPolicy(const TQString &string)
Converts the specified string to a text layout policy enum value.
static TQString numberNotationToString(NumberNotation notation)
Converts the specified number notation enum to a string representation.
static TQString positionFlagToString(PositionFlag type)
Converts the specified content position enum to a string representation.
static NumberNotation stringToNumberNotation(const TQString &notation)
Converts the specified string to a number notation enum value.
Stores the frame settings for one of the chart areas:
static bool readFrameSettingsNode(const TQDomElement &element, KDChartFrameSettings &settings, uint &areaId)
Reads data from a DOM element node that represents a frame settings object and fills a KDChartFrameSe...
static void createFrameSettingsNode(TQDomDocument &document, TQDomNode &parent, const TQString &elementName, const KDChartFrameSettings *settings, uint areaId)
Creates a DOM element node that represents a frame settings object for use in a DOM document.
Bundles the display parameters of a chart.
int threeDPieHeight() const
Returns the height of the 3D effect for pies in pixels.
static TQString legendSourceToString(LegendSource source)
Converts the specified legend source enum to a string representation.
static TQString legendPositionToString(LegendPosition pos)
Converts the specified legend position enum to a string representation.
void setProperties(int id, KDChartPropertySet &rSet)
Overwrites a property set with a new property set.
static TQString lineMarkerStyleToString(LineMarkerStyle style)
Converts the specified line marker style enum to a string representation.
int datasetGap() const
Returns the number of pixels between two dataset values.
static TQString polarMarkerStyleToString(PolarMarkerStyle style)
Converts the specified polar marker style enum to a string representation.
TQDomDocument saveXML(bool withPI=true) const
Saves the parameters to an XML document.
double threeDBarDepth() const
Returns the depth of the 3D Effect used for 3D bars.
static bool readColorMapNode(const TQDomElement &element, TQMap< uint, TQColor > *map)
Creates a DOM element node that represents a color map for use in a DOM document.
BarChartSubType
The bar subtype.
static TQString barChartSubTypeToString(BarChartSubType type)
Converts the specified bar chart subtype enum to a string representation.
AreaLocation
Specifies whether the area above the value points or below the value points should be filled.
double shadowBrightnessFactor() const
Returns a factor to be used to adjust the built-in brightness of shadow colors in 3-dimensional drawi...
bool valueBlockGapIsRelative() const
Returns if the value set by setValueBlockGap is a per mille value of the chart data area width.
const KDChartFrameSettings * frameSettings(uint area, bool &bFound, int *pIterIdx=0) const
Return the frame settings of one of the chart areas.
static TQString polarMarkerStyleToStringTr(PolarMarkerStyle style)
Converts the specified polar marker style enum to a localized string representation that can be used ...
int polarLineWidth() const
Returns the line width of the lines in polar charts.
PolarChartSubType
The polar subtype.
static ChartType stringToChartType(const TQString &string)
Converts the specified string to a chart type enum value.
static void createColorMapNode(TQDomDocument &doc, TQDomNode &parent, const TQString &elementName, const TQMap< uint, TQColor > &map)
Creates a DOM element node that represents a map of TQColor objects for use in a DOM document.
LineChartSubType
The line subtype.
static PolarChartSubType stringToPolarChartSubType(const TQString &string)
Converts the specified string to a polar chart subtype enum value.
int barWidth() const
Returns the width of one bar as set by setBarWidth or KDCHART_AUTO_SIZE if setBarWidth was never call...
static void createChartValueNode(TQDomDocument &doc, TQDomNode &parent, const TQString &elementName, const TQVariant &valY, const TQVariant &valX, const int &propID)
Creates a DOM element node that represents a chart value for use in a DOM document.
const KDChartCustomBox * customBox(uint box) const
Retrieve a const pointer to a custom box from the list.
HiLoChartSubType
The HiLo subtype.
static LineMarkerStyle stringToLineMarkerStyleTr(const TQString &string)
Converts the specified localized string to a line marker style value.
static TQString lineMarkerStyleToStringTr(LineMarkerStyle style)
Converts the specified line marker style enum to a localized string representation that can be used f...
static TQString lineChartSubTypeToString(LineChartSubType type)
Converts the specified line chart subtype enum to a string representation.
void loadAxesFormXML(int &curAxisSettings, TQDomElement &element)
Helper method called by loadXML() only.
LegendSource
The possible ways for getting the legend text.
bool relativeRingThickness() const
Returns whether the ring thickness is relative to the sum of values in the dataset that the ring repr...
static void createDoubleMapNode(TQDomDocument &doc, TQDomNode &parent, const TQString &elementName, const TQMap< int, double > &map)
Creates a DOM element node that represents a map of doubles for use in a DOM document.
static TQString bWChartStatValToString(BWStatVal type)
Converts the specified BWStatVal enum to a string representation.
LineMarkerStyle
The available line marker styles.
PolarMarkerStyle
The available polar marker styles.
AreaChartSubType
The area subtype.
int numValues() const
Returns how many of the values should be shown.
bool threeDShadowColors() const
Returns whether the engine should draw the sides and tops of 3D effects in shadowed versions of the d...
static bool readChartFontNode(const TQDomElement &element, TQFont &font, bool &useRelFont, int &relFontSize, int *minFontSize=0)
Reads data from a DOM element node that represents a font uses in a chart and fills the reference par...
static LineChartSubType stringToLineChartSubType(const TQString &string)
Converts the specified string to a line chart subtype enum value.
static AreaLocation stringToAreaLocation(const TQString &string)
Converts the specified string to an area location enum value.
int valueBlockGap() const
Returns the number of pixels between each value block.
static SourceMode stringToChartSourceMode(const TQString &string)
Converts the specified string to a chart source mode enum value.
static void createChartFontNode(TQDomDocument &doc, TQDomNode &parent, const TQString &elementName, const TQFont &font, bool useRelFont, int relFont, int minFont=-1)
Creates a DOM element node that represents a font used in a chart for use in a DOM document.
uint maxDatasetSourceMode() const
Returns the number of the highest dataset for which a SourceMode has been defined.
static HiLoChartSubType stringToHiLoChartSubType(const TQString &string)
Converts the specified string to a HiLo chart subtype enum value.
SourceMode
The chart source mode.
static LegendPosition stringToLegendPosition(const TQString &string)
Converts the specified string to a legend position enum value.
static TQString areaLocationToString(AreaLocation type)
Converts the specified area location enum to a string representation.
bool threeDPies() const
Returns whether the engine should draw any pies in 3D.
static AreaChartSubType stringToAreaChartSubType(const TQString &string)
Converts the specified string to a area chart subtype enum value.
LegendPosition
The possible positions for a legend.
static TQString chartTypeToString(ChartType type)
Converts the specified chart type enum to a string representation.
bool datasetGapIsRelative() const
Returns if the value set by setDatasetGap is a per mille value of the chart data area width.
bool showGrid() const
Returns if any grid will be drawn at the data area.
static bool readDoubleMapNode(const TQDomElement &element, TQMap< int, double > *map)
Reads data from a DOM element node that represents a double map and fills a double map with the data.
BWStatVal
The different statistical values that can be printed into or asked from a Box and Whisker chart.
ChartType
The chart type.
int lineWidth() const
Returns the line width of the lines in line charts.
void saveAxesToXML(TQDomDocument &doc, TQDomElement &docRoot) const
Helper method saving the axis parameters to an XML file, this is called by saveXML() only.
static TQString chartSourceModeToString(const SourceMode &mode)
Converts the specified chart source mode enum value to a string.
static BarChartSubType stringToBarChartSubType(const TQString &string)
Converts the specified string to a bar chart subtype enum value.
bool threeDBars() const
Returns whether the engine should draw any bars in 3D.
static bool readChartValueNode(const TQDomElement &element, TQVariant &valY, TQVariant &valX, int &propID)
Reads data from a DOM element node that represents a chart value and fills a KDChartData object with ...
static TQString polarChartSubTypeToString(PolarChartSubType type)
Converts the specified polar chart subtype enum to a string representation.
bool explode() const
Returns whether the pie or ring chart should be exploding or not.
static PolarMarkerStyle stringToPolarMarkerStyleTr(const TQString &string)
Converts the specified localized string to a polar marker style value.
int pieStart() const
Returns the starting point of the pie circle.
BWChartSubType
The BoxWhisker subtype.
bool loadXML(const TQDomDocument &doc)
Reads the parameters from an XML document.
static LineMarkerStyle stringToLineMarkerStyle(const TQString &string)
Converts the specified string to a line marker style value.
int ringStart() const
Returns the starting point of the ring circle.
static PolarMarkerStyle stringToPolarMarkerStyle(const TQString &string)
Converts the specified string to a polar marker style value.
static LegendSource stringToLegendSource(const TQString &string)
Converts the specified string to a legend source enum value.
static BWChartSubType stringToBWChartSubType(const TQString &string)
Converts the specified string to a BoxWhisker chart subtype enum value.
static TQString hiLoChartSubTypeToString(HiLoChartSubType type)
Converts the specified HiLo chart subtype enum to a string representation.
static TQString bWChartSubTypeToString(BWChartSubType type)
Converts the specified BoxWhisker chart subtype enum to a string representation.
static TQString areaChartSubTypeToString(AreaChartSubType type)
Converts the specified area chart subtype enum to a string representation.
static BWStatVal stringToBWChartStatVal(const TQString &string)
Converts the specified string to a BWStatVal enum value.
uint outlineDataLineWidth() const
Returns the width of the outlines of data displays.
Property settings of a single KDChart data cell.
int id() const
Returns the name of this property set.
static bool loadXML(const TQDomElement &element, KDChartPropertySet &set)
Retrieves a property set and stores it in parameter set.