00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "KDChartParams.h"
00030
00031 #include <qintdict.h>
00032
00042 QTextStream& operator<<( QTextStream& s, const KDChartParams& p )
00043 {
00044 QDomDocument document = p.saveXML();
00045 s << document.toString();
00046
00047 return s;
00048 }
00049
00054 void KDChartParams::saveAxesToXML(QDomDocument& doc, QDomElement& docRoot) const
00055 {
00056
00057 for( int axis = 0; axis < 13; axis++ ) {
00058 QDomElement axisSettingsElement =
00059 doc.createElement( "AxisSettings" );
00060 docRoot.appendChild( axisSettingsElement );
00061 axisSettingsElement.setAttribute( "Dataset",
00062 _axisSettings[axis].dataset );
00063 axisSettingsElement.setAttribute( "Dataset2",
00064 _axisSettings[axis].dataset2 );
00065 axisSettingsElement.setAttribute( "Chart",
00066 _axisSettings[axis].chart );
00067 {
00068
00069 KDXML::createStringNode( doc, axisSettingsElement, "Type",
00070 KDChartAxisParams::axisTypeToString( _axisSettings[axis].params._axisType ) );
00071
00072
00073 KDXML::createBoolNode( doc, axisSettingsElement, "Visible",
00074 _axisSettings[axis].params._axisVisible );
00075
00076
00077 KDXML::createBoolNode( doc, axisSettingsElement, "LabelsTouchEdges",
00078 _axisSettings[axis].params._axisLabelsTouchEdges );
00079
00080
00081 KDXML::createStringNode( doc, axisSettingsElement, "AreaMode",
00082 KDChartAxisParams::axisAreaModeToString( _axisSettings[axis].params._axisAreaMode ) );
00083
00084
00085 KDXML::createIntNode( doc, axisSettingsElement, "UseAvailableSpaceFrom",
00086 _axisSettings[axis].params._axisUseAvailableSpaceFrom );
00087
00088
00089 KDXML::createIntNode( doc, axisSettingsElement, "UseAvailableSpaceTo",
00090 _axisSettings[axis].params._axisUseAvailableSpaceTo );
00091
00092
00093 KDXML::createIntNode( doc, axisSettingsElement, "IsometricReferenceAxis",
00094 _axisSettings[axis].params._axisIsoRefAxis );
00095
00096
00097 KDXML::createIntNode( doc, axisSettingsElement, "AreaMin",
00098 _axisSettings[axis].params._axisAreaMin );
00099
00100
00101 KDXML::createIntNode( doc, axisSettingsElement, "AreaMax",
00102 _axisSettings[axis].params._axisAreaMax );
00103
00104
00105 KDXML::createStringNode( doc, axisSettingsElement, "CalcMode",
00106 KDChartAxisParams::axisCalcModeToString( _axisSettings[axis].params._axisCalcMode ) );
00107
00108
00109 KDXML::createIntNode( doc, axisSettingsElement, "TrueAreaSize",
00110 _axisSettings[axis].params._axisTrueAreaSize );
00111
00112
00113 KDXML::createRectNode( doc, axisSettingsElement, "TrueAreaRect",
00114 _axisSettings[axis].params._axisTrueAreaRect );
00115
00116
00117 KDXML::createBoolNode( doc, axisSettingsElement, "ShowSubDelimiters",
00118 _axisSettings[axis].params._axisShowSubDelimiters );
00119
00120
00121 KDXML::createBoolNode( doc, axisSettingsElement, "LineVisible",
00122 _axisSettings[axis].params._axisLineVisible );
00123
00124
00125 KDXML::createIntNode( doc, axisSettingsElement, "LineWidth",
00126 _axisSettings[axis].params._axisLineWidth );
00127
00128
00129 KDXML::createIntNode( doc, axisSettingsElement, "TrueLineWidth",
00130 _axisSettings[axis].params._axisTrueLineWidth );
00131
00132
00133 KDXML::createColorNode( doc, axisSettingsElement, "LineColor",
00134 _axisSettings[axis].params._axisLineColor );
00135
00136
00137 KDXML::createBoolNode( doc, axisSettingsElement, "ShowGrid",
00138 _axisSettings[axis].params._axisShowGrid );
00139
00140
00141 KDXML::createColorNode( doc, axisSettingsElement, "GridColor",
00142 _axisSettings[axis].params._axisGridColor );
00143
00144
00145 KDXML::createIntNode( doc, axisSettingsElement, "GridLineWidth",
00146 _axisSettings[axis].params._axisGridLineWidth );
00147
00148
00149 KDXML::createStringNode( doc, axisSettingsElement, "GridStyle",
00150 KDXML::penStyleToString( _axisSettings[axis].params._axisGridStyle ) );
00151
00152
00153 KDXML::createColorNode( doc, axisSettingsElement, "GridSubColor",
00154 _axisSettings[axis].params._axisGridSubColor );
00155
00156
00157 KDXML::createIntNode( doc, axisSettingsElement, "GridSubLineWidth",
00158 _axisSettings[axis].params._axisGridSubLineWidth );
00159
00160
00161 KDXML::createStringNode( doc, axisSettingsElement, "GridSubStyle",
00162 KDXML::penStyleToString( _axisSettings[axis].params._axisGridSubStyle ) );
00163
00164
00165 KDXML::createColorNode( doc, axisSettingsElement, "ZeroLineColor",
00166 _axisSettings[axis].params._axisZeroLineColor );
00167
00168
00169 KDXML::createBoolNode( doc, axisSettingsElement, "LabelsVisible",
00170 _axisSettings[axis].params._axisLabelsVisible );
00171
00172
00173 createChartFontNode( doc, axisSettingsElement, "LabelsFont",
00174 _axisSettings[axis].params._axisLabelsFont,
00175 _axisSettings[axis].params._axisLabelsFontUseRelSize,
00176 _axisSettings[axis].params._axisLabelsFontRelSize,
00177 _axisSettings[axis].params._axisLabelsFontMinSize );
00178
00179
00180 KDXML::createBoolNode( doc, axisSettingsElement, "LabelsDontShrinkFont",
00181 _axisSettings[axis].params._axisLabelsDontShrinkFont );
00182
00183
00184 KDXML::createBoolNode( doc, axisSettingsElement, "LabelsDontAutoRotate",
00185 _axisSettings[axis].params._axisLabelsDontAutoRotate );
00186
00187
00188 KDXML::createIntNode( doc, axisSettingsElement, "LabelsRotation",
00189 _axisSettings[axis].params._axisLabelsRotation );
00190
00191
00192 KDXML::createIntNode( doc, axisSettingsElement, "LabelsLeaveOut",
00193 _axisSettings[axis].params._axisValueLeaveOut );
00194
00195
00196 KDXML::createColorNode( doc, axisSettingsElement, "LabelsColor",
00197 _axisSettings[axis].params._axisLabelsColor );
00198
00199
00200 KDXML::createBoolNode( doc, axisSettingsElement, "SteadyValueCalc",
00201 _axisSettings[axis].params._axisSteadyValueCalc );
00202
00203
00204 if( ! ( KDCHART_AXIS_LABELS_AUTO_LIMIT == _axisSettings[axis].params._axisValueStart ))
00205 createChartValueNode( doc, axisSettingsElement, "ValueStart",
00206 _axisSettings[axis].params._axisValueStart,
00207 0.0,
00208 0 );
00209
00210
00211 KDXML::createBoolNode( doc, axisSettingsElement, "ValueStartIsExact",
00212 _axisSettings[axis].params._axisValueStartIsExact );
00213
00214
00215 if( ! ( KDCHART_AXIS_LABELS_AUTO_LIMIT == _axisSettings[axis].params._axisValueEnd ))
00216 createChartValueNode( doc, axisSettingsElement, "ValueEnd",
00217 _axisSettings[axis].params._axisValueEnd,
00218 0.0,
00219 0 );
00220
00221
00222 if( ! ( KDCHART_AXIS_LABELS_AUTO_DELTA == _axisSettings[axis].params._axisValueDelta ))
00223 KDXML::createDoubleNode( doc, axisSettingsElement, "ValueDelta",
00224 _axisSettings[axis].params._axisValueDelta );
00225 KDXML::createIntNode( doc, axisSettingsElement, "ValueDeltaScale",
00226 _axisSettings[axis].params._axisValueDeltaScale );
00227
00228
00229 KDXML::createBoolNode( doc, axisSettingsElement, "ValuesDecreasing",
00230 _axisSettings[axis].params._axisValuesDecreasing );
00231
00232
00233 KDXML::createDoubleNode( doc, axisSettingsElement, "TrueLow",
00234 _axisSettings[axis].params._trueLow );
00235
00236
00237 KDXML::createDoubleNode( doc, axisSettingsElement, "TrueHigh",
00238 _axisSettings[axis].params._trueHigh );
00239
00240
00241 KDXML::createDoubleNode( doc, axisSettingsElement, "TrueDelta",
00242 _axisSettings[axis].params._trueDelta );
00243
00244
00245 QDomElement zeroLineStartElement = doc.createElement( "ZeroLineStart" );
00246 axisSettingsElement.appendChild( zeroLineStartElement );
00247 zeroLineStartElement.setAttribute( "X", _axisSettings[axis].params._axisZeroLineStartX );
00248 zeroLineStartElement.setAttribute( "Y", _axisSettings[axis].params._axisZeroLineStartY );
00249
00250
00251 KDXML::createIntNode( doc, axisSettingsElement, "DigitsBehindComma",
00252 _axisSettings[axis].params._axisDigitsBehindComma );
00253
00254
00255 KDXML::createStringNode( doc, axisSettingsElement, "LabelsDateTimeFormat",
00256 _axisSettings[axis].params._axisLabelsDateTimeFormat );
00257
00258
00259 KDXML::createIntNode( doc, axisSettingsElement, "MaxEmptyInnerSpan",
00260 _axisSettings[axis].params._axisMaxEmptyInnerSpan );
00261
00262
00263 KDXML::createStringNode( doc, axisSettingsElement, "LabelsFromDataRow",
00264 KDChartAxisParams::labelsFromDataRowToString( _axisSettings[axis].params._takeLabelsFromDataRow ) );
00265
00266
00267 KDXML::createIntNode( doc, axisSettingsElement, "TextsDataRow",
00268 _axisSettings[axis].params._labelTextsDataRow );
00269
00270
00271 KDXML::createStringListNodes( doc, axisSettingsElement, "LabelString",
00272 &_axisSettings[axis].params._axisLabelStringList );
00273
00274
00275 KDXML::createStringListNodes( doc, axisSettingsElement, "ShortLabelString",
00276 &_axisSettings[axis].params._axisShortLabelsStringList );
00277
00278
00279 KDXML::createStringListNodes( doc, axisSettingsElement, "LabelText",
00280 &_axisSettings[axis].params._axisLabelTexts );
00281
00282
00283 KDXML::createBoolNode( doc, axisSettingsElement, "LabelTextsDirty",
00284 _axisSettings[axis].params._axisLabelTextsDirty );
00285
00286
00287
00288
00289 KDXML::createStringNode( doc, axisSettingsElement, "FirstLabelReplacementText",
00290 _axisSettings[axis].params._axisFirstLabelText );
00291
00292
00293 KDXML::createStringNode( doc, axisSettingsElement, "LastLabelReplacementText",
00294 _axisSettings[axis].params._axisLastLabelText );
00295
00296
00297 KDXML::createIntNode( doc, axisSettingsElement, "LabelsDivPow10",
00298 _axisSettings[axis].params._axisLabelsDivPow10 );
00299
00300
00301 KDXML::createStringNode( doc, axisSettingsElement, "LabelsDecimalPoint",
00302 _axisSettings[axis].params._axisLabelsDecimalPoint );
00303
00304
00305 KDXML::createStringNode( doc, axisSettingsElement, "LabelsThousandsPoint",
00306 _axisSettings[axis].params._axisLabelsThousandsPoint );
00307
00308
00309 KDXML::createStringNode( doc, axisSettingsElement, "LabelsPrefix",
00310 _axisSettings[axis].params._axisLabelsPrefix );
00311
00312
00313 KDXML::createStringNode( doc, axisSettingsElement, "LabelsPostfix",
00314 _axisSettings[axis].params._axisLabelsPostfix );
00315
00316
00317 KDXML::createIntNode( doc, axisSettingsElement, "LabelsTotalLen",
00318 _axisSettings[axis].params._axisLabelsTotalLen );
00319
00320
00321 KDXML::createStringNode( doc, axisSettingsElement, "LabelsPadFill",
00322 _axisSettings[axis].params._axisLabelsPadFill );
00323
00324
00325 KDXML::createBoolNode( doc, axisSettingsElement, "LabelsBlockAlign",
00326 _axisSettings[axis].params._axisLabelsBlockAlign );
00327 }
00328 }
00329 }
00330
00331
00338 QDomDocument KDChartParams::saveXML( bool withPI ) const
00339 {
00340
00341 QString docstart = "<ChartParams/>";
00342
00343 QDomDocument doc( "ChartParams" );
00344 doc.setContent( docstart );
00345 if( withPI )
00346 doc.appendChild( doc.createProcessingInstruction( "xml", "version=\"1.0\" encoding=\"UTF-8\"" ) );
00347
00348 QDomElement docRoot = doc.documentElement();
00349 docRoot.setAttribute( "xmlns", "http://www.klaralvdalens-datakonsult.se/kdchart" );
00350 docRoot.setAttribute( "xmlns:xsi", "http://www.w3.org/2000/10/XMLSchema-instance" );
00351 docRoot.setAttribute( "xsi:schemaLocation", "http://www.klaralvdalens-datakonsult.se/kdchart" );
00352
00353
00354 QDomElement chartTypeElement = doc.createElement( "ChartType" );
00355 docRoot.appendChild( chartTypeElement );
00356 chartTypeElement.setAttribute( "primary",
00357 chartTypeToString( _chartType ) );
00358 chartTypeElement.setAttribute( "secondary",
00359 chartTypeToString( _additionalChartType ) );
00360
00361
00362
00363 KDXML::createIntNode( doc, docRoot, "NumValues", _numValues );
00364
00365
00366 QDomElement modeAndChartMapElement =
00367 doc.createElement( "ModeAndChartMap" );
00368 docRoot.appendChild( modeAndChartMapElement );
00369 for( QMap<uint,KDChartParams::ModeAndChart>::ConstIterator it = _dataSourceModeAndChart.begin();
00370 it != _dataSourceModeAndChart.end(); ++it ) {
00371
00372 QDomElement datasetElement = doc.createElement( "Dataset" );
00373 QDomText datasetContent =
00374 doc.createTextNode( QString::number( it.key() ) );
00375 datasetElement.appendChild( datasetContent );
00376 modeAndChartMapElement.appendChild( datasetElement );
00377
00378 QDomElement modeAndChartElement = doc.createElement( "ModeAndChart" );
00379 modeAndChartElement.setAttribute( "Mode", chartSourceModeToString( it.data().mode() ) );
00380 modeAndChartElement.setAttribute( "Chart", it.data().chart() );
00381 modeAndChartMapElement.appendChild( modeAndChartElement );
00382 }
00383
00384
00385 QDomElement propertySetMapElement =
00386 doc.createElement( "PropertySetMap" );
00387 docRoot.appendChild( propertySetMapElement );
00388 QIntDictIterator<KDChartPropertySet> it2( _propertySetList );
00389 for( ; it2.current(); ++it2 )
00390 propertySetMapElement.appendChild( it2.current()->saveXML( doc ) );
00391
00392 KDXML::createBoolNode( doc, docRoot, "ChartSourceModeWasUsed",
00393 _setChartSourceModeWasUsed );
00394
00395
00396 KDXML::createIntNode( doc, docRoot, "MaxDatasetSourceMode",
00397 _maxDatasetSourceMode );
00398
00399
00400 QDomElement colorSettingsElement =
00401 doc.createElement( "ColorSettings" );
00402 docRoot.appendChild( colorSettingsElement );
00403
00404 {
00405
00406 createColorMapNode( doc, colorSettingsElement,
00407 "DataColors", _dataColors );
00408
00409
00410 KDXML::createIntNode( doc, colorSettingsElement, "MaxDatasetColor",
00411 _maxDatasetColor );
00412
00413
00414 KDXML::createDoubleNode( doc, colorSettingsElement,
00415 "ShadowBrightnessFactor",
00416 _shadowBrightnessFactor );
00417
00418
00419 KDXML::createStringNode( doc, colorSettingsElement,
00420 "ShadowPattern",
00421 KDXML::brushStyleToString(_shadowPattern ) );
00422
00423
00424 KDXML::createBoolNode( doc, colorSettingsElement,
00425 "ThreeDShadowColors",
00426 _threeDShadowColors );
00427
00428
00429 createColorMapNode( doc, colorSettingsElement,
00430 "DataColorsShadow1",
00431 _dataColorsShadow1 );
00432
00433
00434 createColorMapNode( doc, colorSettingsElement,
00435 "DataColorsShadow2",
00436 _dataColorsShadow2 );
00437
00438
00439 KDXML::createColorNode( doc, colorSettingsElement,
00440 "OutlineDataColor",
00441 _outlineDataColor );
00442
00443
00444 KDXML::createIntNode( doc, colorSettingsElement,
00445 "OutlineDataLineWidth",
00446 _outlineDataLineWidth );
00447
00448
00449 QDomElement outlineDataLineStyleElement =
00450 doc.createElement( "OutlineDataLineStyle" );
00451 colorSettingsElement.appendChild( outlineDataLineStyleElement );
00452 outlineDataLineStyleElement.setAttribute( "Style",
00453 KDXML::penStyleToString( _outlineDataLineStyle ) );
00454 }
00455
00456
00457
00458 QDomElement barSettingsElement =
00459 doc.createElement( "BarSettings" );
00460 docRoot.appendChild( barSettingsElement );
00461
00462 {
00463
00464 KDXML::createStringNode( doc, barSettingsElement,
00465 "SubType", KDChartParams::barChartSubTypeToString( _barChartSubType ) );
00466
00467 KDXML::createBoolNode( doc, barSettingsElement,
00468 "ThreeDBars", _threeDBars );
00469
00470 KDXML::createDoubleNode( doc, barSettingsElement,
00471 "ThreeDBarDepth", _threeDBarDepth );
00472
00473 KDXML::createIntNode( doc, barSettingsElement,
00474 "DatasetGap", _datasetGap );
00475
00476 KDXML::createBoolNode( doc, barSettingsElement,
00477 "DatasetGapIsRelative", _datasetGapIsRelative );
00478
00479 KDXML::createIntNode( doc, barSettingsElement,
00480 "ValueBlockGap", _valueBlockGap );
00481
00482 KDXML::createBoolNode( doc, barSettingsElement,
00483 "ValueBlockGapIsRelative",
00484 _valueBlockGapIsRelative );
00485
00486 KDXML::createIntNode( doc, barSettingsElement,
00487 "BarWidth", _barWidth );
00488
00489 KDXML::createBoolNode( doc, barSettingsElement,
00490 "SolidExcessArrows", _solidExcessArrows );
00491 }
00492
00493
00494
00495 QDomElement lineSettingsElement =
00496 doc.createElement( "LineSettings" );
00497 docRoot.appendChild( lineSettingsElement );
00498
00499 {
00500
00501 KDXML::createStringNode( doc, lineSettingsElement,
00502 "SubType", KDChartParams::lineChartSubTypeToString( _lineChartSubType ) );
00503
00504
00505 KDXML::createBoolNode( doc, lineSettingsElement,
00506 "Marker", _lineMarker );
00507
00508
00509 {for( QMap<uint,KDChartParams::LineMarkerStyle>::ConstIterator it = _lineMarkerStyles.begin();
00510 it != _lineMarkerStyles.end(); ++it ) {
00511 QDomElement markerStyleElement = doc.createElement( "MarkerStyle" );
00512 lineSettingsElement.appendChild( markerStyleElement );
00513 markerStyleElement.setAttribute( "Dataset", it.key() );
00514 markerStyleElement.setAttribute( "Style", KDChartParams::lineMarkerStyleToString( it.data() ) );
00515 }}
00516
00517
00518 KDXML::createSizeNode( doc, lineSettingsElement,
00519 "MarkerSize", _lineMarkerSize );
00520
00521
00522 KDXML::createIntNode( doc, lineSettingsElement,
00523 "LineWidth", _lineWidth );
00524
00525
00526 KDXML::createColorNode( doc, lineSettingsElement,
00527 "LineColor",
00528 _lineColor );
00529
00530
00531 QDomElement lineStyleElement =
00532 doc.createElement( "LineStyle" );
00533 lineSettingsElement.appendChild( lineStyleElement );
00534 lineStyleElement.setAttribute( "Style",
00535 KDXML::penStyleToString( _lineStyle ) );
00536
00537
00538 {for( QMap<uint, PenStyle>::ConstIterator it = _datasetLineStyles.begin();
00539 it != _datasetLineStyles.end(); ++it ) {
00540 QDomElement lineStyleElement = doc.createElement( "DatasetLineStyle" );
00541 lineSettingsElement.appendChild( lineStyleElement );
00542 lineStyleElement.setAttribute( "Dataset", it.key() );
00543 lineStyleElement.setAttribute( "Style", KDXML::penStyleToString( it.data() ) );
00544 }}
00545
00546
00547 KDXML::createBoolNode( doc, lineSettingsElement,
00548 "ThreeD", _threeDLines );
00549
00550
00551 KDXML::createIntNode( doc, lineSettingsElement,
00552 "ThreeDDepth", _threeDLineDepth );
00553
00554
00555 KDXML::createIntNode( doc, lineSettingsElement,
00556 "ThreeDXRotation", _threeDLineXRotation );
00557
00558
00559 KDXML::createIntNode( doc, lineSettingsElement,
00560 "ThreeDYRotation", _threeDLineYRotation );
00561 }
00562
00563
00564
00565 QDomElement areaSettingsElement =
00566 doc.createElement( "AreaSettings" );
00567 docRoot.appendChild( areaSettingsElement );
00568
00569 {
00570
00571 KDXML::createStringNode( doc, areaSettingsElement, "SubType",
00572 KDChartParams::areaChartSubTypeToString( _areaChartSubType ) );
00573
00574
00575 KDXML::createStringNode( doc, areaSettingsElement, "Location",
00576 KDChartParams::areaLocationToString( _areaLocation ) );
00577 }
00578
00579
00580
00581 QDomElement pieRingSettingsElement =
00582 doc.createElement( "PieRingSettings" );
00583 docRoot.appendChild( pieRingSettingsElement );
00584
00585 {
00586
00587 KDXML::createBoolNode( doc, pieRingSettingsElement, "Explode",
00588 _explode );
00589
00590
00591 KDXML::createDoubleNode( doc, pieRingSettingsElement, "DefaultExplodeFactor",
00592 _explodeFactor );
00593
00594
00595 createDoubleMapNode( doc, pieRingSettingsElement, "ExplodeFactors",
00596 _explodeFactors );
00597
00598
00599 for( QValueList<int>::ConstIterator it = _explodeList.begin();
00600 it != _explodeList.end(); ++it )
00601 KDXML::createIntNode( doc, pieRingSettingsElement,
00602 "ExplodeSegment", *it );
00603
00604
00605 KDXML::createBoolNode( doc, pieRingSettingsElement, "ThreeDPies",
00606 _threeDPies );
00607
00608
00609 KDXML::createIntNode( doc, pieRingSettingsElement, "ThreeDPieHeight",
00610 _threeDPieHeight );
00611
00612
00613 KDXML::createIntNode( doc, pieRingSettingsElement, "PieStart",
00614 _pieStart );
00615
00616
00617 KDXML::createIntNode( doc, pieRingSettingsElement, "RingStart",
00618 _ringStart );
00619
00620
00621 KDXML::createBoolNode( doc, pieRingSettingsElement,
00622 "RelativeRingThickness", _relativeRingThickness );
00623 }
00624
00625
00626 QDomElement hiLoSettingsElement =
00627 doc.createElement( "HiLoSettings" );
00628 docRoot.appendChild( hiLoSettingsElement );
00629 {
00630
00631 KDXML::createStringNode( doc, hiLoSettingsElement, "SubType",
00632 KDChartParams::hiLoChartSubTypeToString( _hiLoChartSubType ) );
00633
00634
00635 KDXML::createBoolNode( doc, hiLoSettingsElement, "PrintLowValues",
00636 _hiLoChartPrintLowValues );
00637
00638
00639 createChartFontNode( doc, hiLoSettingsElement, "LowValuesFont",
00640 _hiLoChartLowValuesFont,
00641 _hiLoChartLowValuesUseFontRelSize,
00642 _hiLoChartLowValuesFontRelSize );
00643
00644
00645 KDXML::createColorNode( doc, hiLoSettingsElement, "LowValuesColor",
00646 _hiLoChartLowValuesColor );
00647
00648
00649 KDXML::createBoolNode( doc, hiLoSettingsElement, "PrintHighValues",
00650 _hiLoChartPrintHighValues );
00651
00652
00653 createChartFontNode( doc, hiLoSettingsElement, "HighValuesFont",
00654 _hiLoChartHighValuesFont,
00655 _hiLoChartHighValuesUseFontRelSize,
00656 _hiLoChartHighValuesFontRelSize );
00657
00658
00659 KDXML::createColorNode( doc, hiLoSettingsElement, "HighValuesColor",
00660 _hiLoChartHighValuesColor );
00661
00662
00663 KDXML::createBoolNode( doc, hiLoSettingsElement, "PrintOpenValues",
00664 _hiLoChartPrintOpenValues );
00665
00666
00667 createChartFontNode( doc, hiLoSettingsElement, "OpenValuesFont",
00668 _hiLoChartOpenValuesFont,
00669 _hiLoChartOpenValuesUseFontRelSize,
00670 _hiLoChartOpenValuesFontRelSize );
00671
00672
00673 KDXML::createColorNode( doc, hiLoSettingsElement, "OpenValuesColor",
00674 _hiLoChartOpenValuesColor );
00675
00676
00677 KDXML::createBoolNode( doc, hiLoSettingsElement, "PrintCloseValues",
00678 _hiLoChartPrintCloseValues );
00679
00680
00681 createChartFontNode( doc, hiLoSettingsElement, "CloseValuesFont",
00682 _hiLoChartCloseValuesFont,
00683 _hiLoChartCloseValuesUseFontRelSize,
00684 _hiLoChartCloseValuesFontRelSize );
00685
00686
00687 KDXML::createColorNode( doc, hiLoSettingsElement, "CloseValuesColor",
00688 _hiLoChartCloseValuesColor );
00689 }
00690
00691
00692
00693
00694 QDomElement bWSettingsElement =
00695 doc.createElement( "BoxAndWhiskerSettings" );
00696 docRoot.appendChild( bWSettingsElement );
00697 {
00698
00699 KDXML::createStringNode( doc, bWSettingsElement, "SubType",
00700 KDChartParams::bWChartSubTypeToString( _BWChartSubType ) );
00701
00702
00703 KDXML::createDoubleNode( doc, bWSettingsElement, "FenceUpperInner",
00704 _BWChartFenceUpperInner );
00705 KDXML::createDoubleNode( doc, bWSettingsElement, "FenceLowerInner",
00706 _BWChartFenceLowerInner );
00707 KDXML::createDoubleNode( doc, bWSettingsElement, "FenceUpperOuter",
00708 _BWChartFenceUpperInner );
00709 KDXML::createDoubleNode( doc, bWSettingsElement, "FenceLowerOuter",
00710 _BWChartFenceLowerOuter );
00711
00712
00713 KDXML::createBrushNode( doc, bWSettingsElement, "Brush",
00714 _BWChartBrush );
00715
00716
00717 KDXML::createIntNode( doc, bWSettingsElement, "OutlierSize",
00718 _BWChartOutValMarkerSize );
00719
00720
00721 for( int i = BWStatValSTART; i <= BWStatValEND; ++i ){
00722 QDomElement printStatElement =
00723 doc.createElement( "PrintStatistics"+bWChartStatValToString( (BWStatVal)i ) );
00724 KDXML::createBoolNode( doc, printStatElement, "Active",
00725 _BWChartStatistics[ i ].active );
00726 createChartFontNode( doc, printStatElement, "Font",
00727 _BWChartStatistics[ i ].font,
00728 _BWChartStatistics[ i ].useRelSize,
00729 _BWChartStatistics[ i ].relSize );
00730 KDXML::createColorNode( doc, printStatElement, "Color",
00731 _BWChartStatistics[ i ].color );
00732 KDXML::createBrushNode( doc, printStatElement, "Brush",
00733 _BWChartStatistics[ i ].brush );
00734 }
00735 }
00736
00737
00738
00739
00740 QDomElement polarSettingsElement =
00741 doc.createElement( "PolarSettings" );
00742 docRoot.appendChild( polarSettingsElement );
00743
00744 {
00745
00746 KDXML::createStringNode( doc, polarSettingsElement,
00747 "SubType", KDChartParams::polarChartSubTypeToString( _polarChartSubType ) );
00748
00749
00750 KDXML::createBoolNode( doc, polarSettingsElement,
00751 "Marker", _polarMarker );
00752
00753
00754 for( QMap<uint,KDChartParams::PolarMarkerStyle>::ConstIterator it = _polarMarkerStyles.begin();
00755 it != _polarMarkerStyles.end(); ++it ) {
00756 QDomElement markerStyleElement = doc.createElement( "MarkerStyle" );
00757 polarSettingsElement.appendChild( markerStyleElement );
00758 markerStyleElement.setAttribute( "Dataset", it.key() );
00759 markerStyleElement.setAttribute( "Style", KDChartParams::polarMarkerStyleToString( it.data() ) );
00760 }
00761
00762
00763 KDXML::createSizeNode( doc, polarSettingsElement,
00764 "MarkerSize", _polarMarkerSize );
00765
00766
00767 KDXML::createIntNode( doc, polarSettingsElement,
00768 "PolarLineWidth", _polarLineWidth );
00769 }
00770
00771
00772
00773
00774 QDomElement legendSettingsElement =
00775 doc.createElement( "LegendSettings" );
00776 docRoot.appendChild( legendSettingsElement );
00777 {
00778
00779 KDXML::createStringNode( doc, legendSettingsElement, "Position",
00780 KDChartParams::legendPositionToString( _legendPosition ) );
00781
00782
00783 KDXML::createOrientationNode( doc, legendSettingsElement,
00784 "Orientation", _legendOrientation );
00785
00786
00787 KDXML::createBoolNode( doc, legendSettingsElement,
00788 "ShowLines", _legendShowLines );
00789
00790
00791 KDXML::createStringNode( doc, legendSettingsElement, "Source",
00792 KDChartParams::legendSourceToString( _legendSource ) );
00793
00794
00795 for( QMap<int,QString>::ConstIterator it = _legendText.begin();
00796 it != _legendText.end(); ++it ) {
00797 QDomElement legendTextElement = doc.createElement( "LegendText" );
00798 legendSettingsElement.appendChild( legendTextElement );
00799 legendTextElement.setAttribute( "Dataset", it.key() );
00800 legendTextElement.setAttribute( "Text", it.data() );
00801 }
00802
00803
00804 KDXML::createColorNode( doc, legendSettingsElement, "TextColor",
00805 _legendTextColor );
00806
00807
00808 createChartFontNode( doc, legendSettingsElement, "TextFont",
00809 _legendFont,
00810 _legendFontUseRelSize,
00811 _legendFontRelSize );
00812
00813
00814 KDXML::createStringNode( doc, legendSettingsElement, "TitleText",
00815 _legendTitleText );
00816
00817
00818 KDXML::createColorNode( doc, legendSettingsElement, "TitleColor",
00819 _legendTitleTextColor );
00820
00821
00822 createChartFontNode( doc, legendSettingsElement, "TitleFont",
00823 _legendTitleFont,
00824 _legendTitleFontUseRelSize,
00825 _legendTitleFontRelSize );
00826
00827
00828 KDXML::createIntNode( doc, legendSettingsElement, "Spacing",
00829 _legendSpacing );
00830 }
00831
00832 saveAxesToXML(doc, docRoot);
00833
00834
00835 for( int hf = 0; hf < 18; hf++ ) {
00836 QDomElement hfSettingsElement =
00837 doc.createElement( "HeaderFooterSettings" );
00838 docRoot.appendChild( hfSettingsElement );
00839 {
00840 KDXML::createStringNode( doc, hfSettingsElement, "Text",
00841 _hdFtParams[hf]._text );
00842 createChartFontNode( doc, hfSettingsElement, "Font",
00843 _hdFtParams[hf]._font,
00844 _hdFtParams[hf]._fontUseRelSize,
00845 _hdFtParams[hf]._fontRelSize );
00846 KDXML::createColorNode( doc, hfSettingsElement, "Color",
00847 _hdFtParams[hf]._color );
00848 }
00849 }
00850
00851
00852
00853 QDomElement globalLeadingElement =
00854 doc.createElement( "GlobalLeading" );
00855 docRoot.appendChild( legendSettingsElement );
00856 {
00857 KDXML::createIntNode( doc, globalLeadingElement, "Left",
00858 _globalLeadingLeft );
00859 KDXML::createIntNode( doc, globalLeadingElement, "Top",
00860 _globalLeadingTop );
00861 KDXML::createIntNode( doc, globalLeadingElement, "Right",
00862 _globalLeadingRight );
00863 KDXML::createIntNode( doc, globalLeadingElement, "Bottom",
00864 _globalLeadingBottom );
00865 }
00866
00867
00868 QDomElement dataValuesSettings1Element =
00869 doc.createElement( "DataValuesSettings1" );
00870 docRoot.appendChild( dataValuesSettings1Element );
00871 {
00872 KDXML::createBoolNode( doc, dataValuesSettings1Element, "PrintDataValues",
00873 _printDataValuesSettings._printDataValues );
00874 KDXML::createIntNode( doc, dataValuesSettings1Element, "DivPow10",
00875 _printDataValuesSettings._divPow10 );
00876 KDXML::createIntNode( doc, dataValuesSettings1Element, "DigitsBehindComma",
00877 _printDataValuesSettings._digitsBehindComma );
00878 createChartFontNode( doc, dataValuesSettings1Element, "Font",
00879 _printDataValuesSettings._dataValuesFont,
00880 _printDataValuesSettings._dataValuesUseFontRelSize,
00881 _printDataValuesSettings._dataValuesFontRelSize );
00882 KDXML::createColorNode( doc, dataValuesSettings1Element, "Color",
00883 _printDataValuesSettings._dataValuesColor );
00884 KDXML::createBrushNode( doc, dataValuesSettings1Element, "Background",
00885 _printDataValuesSettings._dataValuesBrush );
00886 KDXML::createBoolNode( doc, dataValuesSettings1Element, "AutoColor",
00887 _printDataValuesSettings._dataValuesAutoColor );
00888 KDXML::createStringNode( doc, dataValuesSettings1Element,
00889 "AnchorNegativePosition",
00890 KDChartEnums::positionFlagToString( _printDataValuesSettings._dataValuesAnchorNegativePosition ) );
00891 KDXML::createIntNode( doc, dataValuesSettings1Element,
00892 "AnchorNegativeAlign",
00893 _printDataValuesSettings._dataValuesAnchorNegativeAlign );
00894 KDXML::createIntNode( doc, dataValuesSettings1Element,
00895 "AnchorNegativeDeltaX",
00896 _printDataValuesSettings._dataValuesAnchorNegativeDeltaX );
00897 KDXML::createIntNode( doc, dataValuesSettings1Element,
00898 "AnchorNegativeDeltaY",
00899 _printDataValuesSettings._dataValuesAnchorNegativeDeltaY );
00900 KDXML::createIntNode( doc, dataValuesSettings1Element,
00901 "NegativeRotation",
00902 _printDataValuesSettings._dataValuesNegativeRotation );
00903 KDXML::createStringNode( doc, dataValuesSettings1Element,
00904 "AnchorPositivePosition",
00905 KDChartEnums::positionFlagToString( _printDataValuesSettings._dataValuesAnchorPositivePosition ) );
00906 KDXML::createIntNode( doc, dataValuesSettings1Element,
00907 "AnchorPositiveAlign",
00908 _printDataValuesSettings._dataValuesAnchorPositiveAlign );
00909 KDXML::createIntNode( doc, dataValuesSettings1Element,
00910 "AnchorPositiveDeltaX",
00911 _printDataValuesSettings._dataValuesAnchorPositiveDeltaX );
00912 KDXML::createIntNode( doc, dataValuesSettings1Element,
00913 "AnchorPositiveDeltaY",
00914 _printDataValuesSettings._dataValuesAnchorPositiveDeltaY );
00915 KDXML::createIntNode( doc, dataValuesSettings1Element,
00916 "PositiveRotation",
00917 _printDataValuesSettings._dataValuesPositiveRotation );
00918
00919 KDXML::createStringNode( doc, dataValuesSettings1Element,
00920 "LayoutPolicy",
00921 KDChartEnums::layoutPolicyToString( _printDataValuesSettings._dataValuesLayoutPolicy ) );
00922
00923 KDXML::createBoolNode( doc, dataValuesSettings1Element, "ShowInfinite",
00924 _printDataValuesSettings._dataValuesShowInfinite );
00925 }
00926
00927
00928 QDomElement dataValuesSettings2Element =
00929 doc.createElement( "DataValuesSettings2" );
00930 docRoot.appendChild( dataValuesSettings2Element );
00931 {
00932 KDXML::createBoolNode( doc, dataValuesSettings2Element, "PrintDataValues",
00933 _printDataValuesSettings2._printDataValues );
00934 KDXML::createIntNode( doc, dataValuesSettings2Element, "DivPow10",
00935 _printDataValuesSettings2._divPow10 );
00936 KDXML::createIntNode( doc, dataValuesSettings2Element, "DigitsBehindComma",
00937 _printDataValuesSettings2._digitsBehindComma );
00938 createChartFontNode( doc, dataValuesSettings2Element, "Font",
00939 _printDataValuesSettings2._dataValuesFont,
00940 _printDataValuesSettings2._dataValuesUseFontRelSize,
00941 _printDataValuesSettings2._dataValuesFontRelSize );
00942 KDXML::createColorNode( doc, dataValuesSettings2Element, "Color",
00943 _printDataValuesSettings2._dataValuesColor );
00944 KDXML::createBrushNode( doc, dataValuesSettings2Element, "Background",
00945 _printDataValuesSettings2._dataValuesBrush );
00946 KDXML::createBoolNode( doc, dataValuesSettings2Element, "AutoColor",
00947 _printDataValuesSettings2._dataValuesAutoColor );
00948 KDXML::createStringNode( doc, dataValuesSettings2Element,
00949 "AnchorNegativePosition",
00950 KDChartEnums::positionFlagToString( _printDataValuesSettings2._dataValuesAnchorNegativePosition ) );
00951 KDXML::createIntNode( doc, dataValuesSettings2Element,
00952 "AnchorNegativeAlign",
00953 _printDataValuesSettings2._dataValuesAnchorNegativeAlign );
00954 KDXML::createIntNode( doc, dataValuesSettings2Element,
00955 "AnchorNegativeDeltaX",
00956 _printDataValuesSettings2._dataValuesAnchorNegativeDeltaX );
00957 KDXML::createIntNode( doc, dataValuesSettings2Element,
00958 "AnchorNegativeDeltaY",
00959 _printDataValuesSettings2._dataValuesAnchorNegativeDeltaY );
00960 KDXML::createIntNode( doc, dataValuesSettings2Element,
00961 "NegativeRotation",
00962 _printDataValuesSettings2._dataValuesNegativeRotation );
00963 KDXML::createStringNode( doc, dataValuesSettings2Element,
00964 "AnchorPositivePosition",
00965 KDChartEnums::positionFlagToString( _printDataValuesSettings2._dataValuesAnchorPositivePosition ) );
00966 KDXML::createIntNode( doc, dataValuesSettings2Element,
00967 "AnchorPositiveAlign",
00968 _printDataValuesSettings2._dataValuesAnchorPositiveAlign );
00969 KDXML::createIntNode( doc, dataValuesSettings2Element,
00970 "AnchorPositiveDeltaX",
00971 _printDataValuesSettings2._dataValuesAnchorPositiveDeltaX );
00972 KDXML::createIntNode( doc, dataValuesSettings2Element,
00973 "AnchorPositiveDeltaY",
00974 _printDataValuesSettings2._dataValuesAnchorPositiveDeltaY );
00975 KDXML::createIntNode( doc, dataValuesSettings2Element,
00976 "PositiveRotation",
00977 _printDataValuesSettings2._dataValuesPositiveRotation );
00978
00979 KDXML::createStringNode( doc, dataValuesSettings2Element,
00980 "LayoutPolicy",
00981 KDChartEnums::layoutPolicyToString( _printDataValuesSettings2._dataValuesLayoutPolicy ) );
00982
00983 KDXML::createBoolNode( doc, dataValuesSettings2Element, "ShowInfinite",
00984 _printDataValuesSettings2._dataValuesShowInfinite );
00985 }
00986
00987
00988 QDomElement dataValuesGlobalSettingsElement =
00989 doc.createElement( "DataValuesGlobalSettings" );
00990 docRoot.appendChild( dataValuesGlobalSettingsElement );
00991 {
00992 KDXML::createBoolNode( doc, dataValuesGlobalSettingsElement,
00993 "allowOverlappingTexts",
00994 _allowOverlappingDataValueTexts );
00995 }
00996
00997
00998 QDomElement areaMapElement =
00999 doc.createElement( "AreaMap" );
01000 docRoot.appendChild( areaMapElement );
01001 {
01002 QDictIterator<KDChartFrameSettings> it( _areaDict );
01003 for( ; it.current(); ++it ){
01004 KDChartFrameSettings::createFrameSettingsNode( doc, areaMapElement,
01005 "FrameSettings",
01006 it.current(),
01007 it.currentKey().left(5).stripWhiteSpace().toUInt() );
01008 }
01009 }
01010
01011
01012 QDomElement customBoxMapElement =
01013 doc.createElement( "CustomBoxMap" );
01014 docRoot.appendChild( customBoxMapElement );
01015 {
01016 QIntDictIterator<KDChartCustomBox> it( _customBoxDict );
01017 for( ; it.current(); ++it ){
01018 KDXML::createIntNode( doc, customBoxMapElement, "Number", it.currentKey() );
01019 KDChartCustomBox::createCustomBoxNode( doc, customBoxMapElement,
01020 "CustomBox", it );
01021 }
01022 }
01023
01024
01025 return doc;
01026 }
01027
01028
01039 QTextStream& operator>>( QTextStream& s, KDChartParams& p )
01040 {
01041 QDomDocument doc( "ChartParams" );
01042
01043 QString docString = s.read();
01044 doc.setContent( docString );
01045
01046 p.loadXML( doc );
01047
01048 return s;
01049 }
01050
01051
01055 void KDChartParams::loadAxesFormXML(int& curAxisSettings, QDomElement& element)
01056 {
01057 KDChartAxisParams* axisSettings =
01058 &( _axisSettings[ curAxisSettings ].params );
01059 QDomNode node = element.firstChild();
01060 while( !node.isNull() ) {
01061 QDomElement element = node.toElement();
01062 if( !element.isNull() ) {
01063 QString tagName = element.tagName();
01064 if( tagName == "Type" ) {
01065 QString string;
01066 if( KDXML::readStringNode( element, string ) )
01067 axisSettings->_axisType = KDChartAxisParams::stringToAxisType( string );
01068 } else if( tagName == "Visible" ) {
01069 bool visible;
01070 if( KDXML::readBoolNode( element, visible ) )
01071 axisSettings->_axisVisible = visible;
01072 } else if( tagName == "LabelsTouchEdges" ) {
01073 bool labelsTouchEdges;
01074 if( KDXML::readBoolNode( element, labelsTouchEdges ) )
01075 axisSettings->_axisLabelsTouchEdges = labelsTouchEdges;
01076 } else if( tagName == "AreaMode" ) {
01077 QString string;
01078 if( KDXML::readStringNode( element, string ) )
01079 axisSettings->_axisAreaMode = KDChartAxisParams::stringToAxisAreaMode( string );
01080 } else if( tagName == "UseAvailableSpaceFrom" ) {
01081 int spaceFrom;
01082 if( KDXML::readIntNode( element, spaceFrom ) )
01083 axisSettings->_axisUseAvailableSpaceFrom = spaceFrom;
01084 } else if( tagName == "UseAvailableSpaceTo" ) {
01085 int spaceTo;
01086 if( KDXML::readIntNode( element, spaceTo ) )
01087 axisSettings->_axisUseAvailableSpaceTo = spaceTo;
01088 } else if( tagName == "IsometricReferenceAxis" ) {
01089 int isoRefAxis;
01090 if( KDXML::readIntNode( element, isoRefAxis ) )
01091 axisSettings->_axisIsoRefAxis = isoRefAxis;
01092 } else if( tagName == "AreaMin" ) {
01093 int areaMin;
01094 if( KDXML::readIntNode( element, areaMin ) )
01095 axisSettings->_axisAreaMin = areaMin;
01096 } else if( tagName == "AreaMax" ) {
01097 int areaMax;
01098 if( KDXML::readIntNode( element, areaMax ) )
01099 axisSettings->_axisAreaMax = areaMax;
01100 } else if( tagName == "CalcMode" ) {
01101 QString string;
01102 if( KDXML::readStringNode( element, string ) )
01103 axisSettings->_axisCalcMode = KDChartAxisParams::stringToAxisCalcMode( string );
01104 } else if( tagName == "TrueAreaSize" ) {
01105 int trueAreaSize;
01106 if( KDXML::readIntNode( element, trueAreaSize ) )
01107 axisSettings->_axisTrueAreaSize = trueAreaSize;
01108 } else if( tagName == "TrueAreaRect" ) {
01109 QRect trueAreaRect;
01110 if( KDXML::readRectNode( element, trueAreaRect ) )
01111 axisSettings->_axisTrueAreaRect = trueAreaRect;
01112 } else if( tagName == "ShowSubDelimiters" ) {
01113 bool showSubDelimiters;
01114 if( KDXML::readBoolNode( element, showSubDelimiters ) )
01115 axisSettings->_axisShowSubDelimiters = showSubDelimiters;
01116 } else if( tagName == "LineVisible" ) {
01117 bool lineVisible;
01118 if( KDXML::readBoolNode( element, lineVisible ) )
01119 axisSettings->_axisLineVisible = lineVisible;
01120 } else if( tagName == "LineWidth" ) {
01121 int lineWidth;
01122 if( KDXML::readIntNode( element, lineWidth ) )
01123 axisSettings->_axisLineWidth = lineWidth;
01124 } else if( tagName == "TrueLineWidth" ) {
01125 int trueLineWidth;
01126 if( KDXML::readIntNode( element, trueLineWidth ) )
01127 axisSettings->_axisTrueLineWidth = trueLineWidth;
01128 } else if( tagName == "LineColor" ) {
01129 QColor color;
01130 if( KDXML::readColorNode( element, color ) )
01131 axisSettings->_axisLineColor = color;
01132 } else if( tagName == "ShowGrid" ) {
01133 bool showGrid;
01134 if( KDXML::readBoolNode( element, showGrid ) )
01135 axisSettings->_axisShowGrid = showGrid;
01136 } else if( tagName == "GridColor" ) {
01137 QColor color;
01138 if( KDXML::readColorNode( element, color ) )
01139 axisSettings->_axisGridColor = color;
01140 } else if( tagName == "GridLineWidth" ) {
01141 int gridLineWidth;
01142 if( KDXML::readIntNode( element, gridLineWidth ) )
01143 axisSettings->_axisGridLineWidth = gridLineWidth;
01144 } else if( tagName == "GridStyle" ) {
01145 if( element.hasAttribute( "Style" ) )
01146 axisSettings->_axisGridStyle = KDXML::stringToPenStyle( element.attribute( "Style" ) );
01147 } else if( tagName == "GridSubColor" ) {
01148 QColor color;
01149 if( KDXML::readColorNode( element, color ) )
01150 axisSettings->_axisGridSubColor = color;
01151 } else if( tagName == "GridSubLineWidth" ) {
01152 int gridSubLineWidth;
01153 if( KDXML::readIntNode( element, gridSubLineWidth ) )
01154 axisSettings->_axisGridSubLineWidth = gridSubLineWidth;
01155 } else if( tagName == "GridSubStyle" ) {
01156 if( element.hasAttribute( "Style" ) )
01157 axisSettings->_axisGridSubStyle = KDXML::stringToPenStyle( element.attribute( "Style" ) );
01158 } else if( tagName == "ZeroLineColor" ) {
01159 QColor color;
01160 if( KDXML::readColorNode( element, color ) )
01161 axisSettings->_axisZeroLineColor = color;
01162 } else if( tagName == "LabelsVisible" ) {
01163 bool labelsVisible;
01164 if( KDXML::readBoolNode( element, labelsVisible ) )
01165 axisSettings->_axisLabelsVisible = labelsVisible;
01166 } else if( tagName == "LabelsFont" ) {
01167 readChartFontNode( element,
01168 axisSettings->_axisLabelsFont,
01169 axisSettings->_axisLabelsFontUseRelSize,
01170 axisSettings->_axisLabelsFontRelSize,
01171 &axisSettings->_axisLabelsFontMinSize );
01172 } else if( tagName == "LabelsDontShrinkFont" ) {
01173 bool dontShrink;
01174 if( KDXML::readBoolNode( element, dontShrink ) )
01175 axisSettings->_axisLabelsDontShrinkFont = dontShrink;
01176 } else if( tagName == "LabelsDontAutoRotate" ) {
01177 bool dontRotate;
01178 if( KDXML::readBoolNode( element, dontRotate ) )
01179 axisSettings->_axisLabelsDontAutoRotate = dontRotate;
01180 } else if( tagName == "LabelsRotation" ) {
01181 int rotation;
01182 if( KDXML::readIntNode( element, rotation ) )
01183 axisSettings->_axisLabelsRotation = rotation;
01184 } else if( tagName == "LabelsLeaveOut" ) {
01185 int leaveOut;
01186 if( KDXML::readIntNode( element, leaveOut ) )
01187 axisSettings->_axisValueLeaveOut = leaveOut;
01188 } else if( tagName == "LabelsColor" ) {
01189 QColor color;
01190 if( KDXML::readColorNode( element, color ) )
01191 axisSettings->_axisLabelsColor = color;
01192 } else if( tagName == "SteadyValueCalc" ) {
01193 bool steadyValueCalc;
01194 if( KDXML::readBoolNode( element, steadyValueCalc ) )
01195 axisSettings->_axisSteadyValueCalc = steadyValueCalc;
01196 } else if( tagName == "ValueStart" ) {
01197 QVariant valX, valY;
01198 int propID;
01199 if( readChartValueNode( element, valY, valX, propID ) &&
01200 QVariant::Double == valY.type() )
01201 axisSettings->_axisValueStart = valY.toDouble();
01202 } else if( tagName == "ValueStartIsExact" ) {
01203 bool isExactValue;
01204 if( KDXML::readBoolNode( element, isExactValue ) )
01205 axisSettings->_axisValueStartIsExact = isExactValue;
01206 } else if( tagName == "ValueEnd" ) {
01207 QVariant valX, valY;
01208 int propID;
01209 if( readChartValueNode( element, valY, valX, propID ) &&
01210 QVariant::Double == valY.type() )
01211 axisSettings->_axisValueEnd = valY.toDouble();
01212 } else if( tagName == "ValueDelta" ) {
01213 double valueDelta;
01214 if( KDXML::readDoubleNode( element, valueDelta ) )
01215 axisSettings->_axisValueDelta = valueDelta;
01216 } else if( tagName == "ValueDeltaScale" ) {
01217 int valueDeltaScale;
01218 if( KDXML::readIntNode( element, valueDeltaScale ) )
01219 axisSettings->_axisValueDeltaScale = (KDChartAxisParams::ValueScale)valueDeltaScale;
01220 } else if( tagName == "ValuesDecreasing" ) {
01221 bool decreasing;
01222 if( KDXML::readBoolNode( element, decreasing ) )
01223 axisSettings->_axisValuesDecreasing = decreasing;
01224 } else if( tagName == "TrueLow" ) {
01225 double trueLow;
01226 if( KDXML::readDoubleNode( element, trueLow ) )
01227 axisSettings->_trueLow = trueLow;
01228 } else if( tagName == "TrueHigh" ) {
01229 double trueHigh;
01230 if( KDXML::readDoubleNode( element, trueHigh ) )
01231 axisSettings->_trueHigh = trueHigh;
01232 } else if( tagName == "TrueDelta" ) {
01233 double trueDelta;
01234 if( KDXML::readDoubleNode( element, trueDelta ) )
01235 axisSettings->_trueDelta = trueDelta;
01236 } else if( tagName == "ZeroLineStart" ) {
01237 double x = 0.0;
01238 double y = 0.0;
01239 bool ok = true;
01240 if( element.hasAttribute( "X" ) &&
01241 element.hasAttribute( "Y" ) ) {
01242 x = element.attribute( "X" ).toDouble( &ok );
01243 if( ok )
01244 y = element.attribute( "Y" ).toDouble( &ok );
01245 } else
01246 ok = false;
01247
01248 if( ok ) {
01249 axisSettings->_axisZeroLineStartX = x;
01250 axisSettings->_axisZeroLineStartY = y;
01251 }
01252 } else if( tagName == "DigitsBehindComma" ) {
01253 int digitsBehindComma;
01254 if( KDXML::readIntNode( element, digitsBehindComma ) )
01255 axisSettings->_axisDigitsBehindComma = digitsBehindComma;
01256 } else if( tagName == "LabelsDateTimeFormat" ) {
01257 QString string;
01258 if( KDXML::readStringNode( element, string ) )
01259 axisSettings->_axisLabelsDateTimeFormat = string;
01260 } else if( tagName == "MaxEmptyInnerSpan" ) {
01261 int maxEmptyInnerSpan;
01262 if( KDXML::readIntNode( element, maxEmptyInnerSpan ) )
01263 axisSettings->_axisMaxEmptyInnerSpan = maxEmptyInnerSpan;
01264 } else if( tagName == "LabelsFromDataRow" ) {
01265 QString string;
01266 if( KDXML::readStringNode( element, string ) )
01267 axisSettings->_labelTextsDataRow = KDChartAxisParams::stringToLabelsFromDataRow( string );
01268 } else if( tagName == "TextsDataRow" ) {
01269 int textsDataRow;
01270 if( KDXML::readIntNode( element, textsDataRow ) )
01271 axisSettings->_labelTextsDataRow = textsDataRow;
01272 } else if( tagName == "LabelString" ) {
01273 QString string;
01274 if( KDXML::readStringNode( element, string ) )
01275 axisSettings->_axisLabelStringList << string;
01276 } else if( tagName == "ShortLabelString" ) {
01277 QString string;
01278 if( KDXML::readStringNode( element, string ) )
01279 axisSettings->_axisShortLabelsStringList << string;
01280 } else if( tagName == "LabelText" ) {
01281 QString string;
01282 if( KDXML::readStringNode( element, string ) )
01283 axisSettings->_axisLabelTexts = string;
01284 } else if( tagName == "LabelTextsDirty" ) {
01285 bool labelTextsDirty;
01286 if( KDXML::readBoolNode( element, labelTextsDirty ) )
01287 axisSettings->_axisLabelTextsDirty = labelTextsDirty;
01288 } else if( tagName == "FirstLabelReplacementText" ) {
01289 QString value;
01290 if( KDXML::readStringNode( element, value ) )
01291 axisSettings->_axisFirstLabelText = value;
01292 } else if( tagName == "LastLabelReplacementText" ) {
01293 QString value;
01294 if( KDXML::readStringNode( element, value ) )
01295 axisSettings->_axisLastLabelText = value;
01296 } else if( tagName == "LabelsDivPow10" ) {
01297 int divPow10;
01298 if( KDXML::readIntNode( element, divPow10 ) )
01299 axisSettings->_axisLabelsDivPow10 = divPow10;
01300 } else if( tagName == "LabelsDecimalPoint" ) {
01301 QString value;
01302 if( KDXML::readStringNode( element, value ) )
01303 axisSettings->_axisLabelsDecimalPoint = value;
01304 } else if( tagName == "LabelsThousandsPoint" ) {
01305 QString value;
01306 if( KDXML::readStringNode( element, value ) )
01307 axisSettings->_axisLabelsThousandsPoint = value;
01308 } else if( tagName == "LabelsPrefix" ) {
01309 QString value;
01310 if( KDXML::readStringNode( element, value ) )
01311 axisSettings->_axisLabelsPrefix = value;
01312 } else if( tagName == "LabelsPostfix" ) {
01313 QString value;
01314 if( KDXML::readStringNode( element, value ) )
01315 axisSettings->_axisLabelsPostfix = value;
01316 } else if( tagName == "LabelsTotalLen" ) {
01317 int totalLen;
01318 if( KDXML::readIntNode( element, totalLen ) )
01319 axisSettings->_axisLabelsTotalLen = totalLen;
01320 } else if( tagName == "LabelsPadFill" ) {
01321 QString value;
01322 if( KDXML::readStringNode( element, value ) ){
01323 if( value.isEmpty() )
01324 axisSettings->_axisLabelsPadFill = ' ';
01325 else
01326 axisSettings->_axisLabelsPadFill = value.at(0);
01327 }
01328 } else if( tagName == "LabelsBlockAlign" ) {
01329 bool blockAlign;
01330 if( KDXML::readBoolNode( element, blockAlign ) )
01331 axisSettings->_axisLabelsBlockAlign = blockAlign;
01332 } else {
01333 qDebug( "Unknown subelement of AxisSettings found: %s", tagName.latin1() );
01334 }
01335 }
01336 node = node.nextSibling();
01337 }
01338 curAxisSettings++;
01339 }
01340
01341
01349 bool KDChartParams::loadXML( const QDomDocument& doc )
01350 {
01351 int curAxisSettings = 0;
01352 int curHFSettings = 0;
01353
01354 QDomElement docRoot = doc.documentElement();
01355 QDomNode node = docRoot.firstChild();
01356 while( !node.isNull() ) {
01357 QDomElement element = node.toElement();
01358 if( !element.isNull() ) {
01359 QString tagName = element.tagName();
01360 if( tagName == "ChartType" ) {
01361 if( element.hasAttribute( "primary" ) )
01362 _chartType = KDChartParams::stringToChartType( element.attribute( "primary" ) );
01363 if( element.hasAttribute( "secondary" ) )
01364 _additionalChartType = KDChartParams::stringToChartType( element.attribute( "secondary" ) );
01365 } else if( tagName == "NumValues" ) {
01366 int numValues;
01367 if( KDXML::readIntNode( element, numValues ) )
01368 _numValues = numValues;
01369 } else if( tagName == "ModeAndChartMap" ) {
01370 int dataset = -1;
01371 QDomNode node = element.firstChild();
01372 while( !node.isNull() ) {
01373 QDomElement element = node.toElement();
01374 if( !element.isNull() ) {
01375 QString tagName = element.tagName();
01376 if( tagName == "Dataset" ) {
01377 KDXML::readIntNode( element, dataset );
01378 } else if( tagName == "ModeAndChart" ) {
01379 Q_ASSERT( dataset != -1 );
01380 if( element.hasAttribute( "Mode" ) &&
01381 element.hasAttribute( "Chart" ) ) {
01382 KDChartParams::SourceMode sourceMode = KDChartParams::stringToChartSourceMode( element.attribute( "Mode" ) );
01383 bool ok = false;
01384 uint chart = element.attribute( "Chart" ).toUInt( &ok );
01385 if( ok )
01386 _dataSourceModeAndChart[dataset] = KDChartParams::ModeAndChart( sourceMode, chart );
01387 }
01388 } else {
01389 qDebug( "Unknown subelement of ModeAndChartMap found: %s", tagName.latin1() );
01390 }
01391 }
01392 node = node.nextSibling();
01393 }
01394 } else if( tagName == "PropertySetMap" ) {
01395
01396 QDomNode node = element.firstChild();
01397 KDChartPropertySet set;
01398 while( !node.isNull() ) {
01399 QDomElement element = node.toElement();
01400 if( !element.isNull()
01401 && KDChartPropertySet::loadXML( element, set ) )
01402 setProperties( set.id(), set );
01403 node = node.nextSibling();
01404 }
01405 } else if( tagName == "ChartSourceModeWasUsed" ) {
01406 bool chartSourceModeWasUsed;
01407 if( KDXML::readBoolNode( element, chartSourceModeWasUsed ) )
01408 _setChartSourceModeWasUsed = chartSourceModeWasUsed;
01409 } else if( tagName == "MaxDatasetSourceMode" ) {
01410 int maxDatasetSourceMode;
01411 if( KDXML::readIntNode( element, maxDatasetSourceMode ) )
01412 _maxDatasetSourceMode = maxDatasetSourceMode;
01413 } else if( tagName == "ColorSettings" ) {
01414 QDomNode node = element.firstChild();
01415 while( !node.isNull() ) {
01416 QDomElement element = node.toElement();
01417 if( !element.isNull() ) {
01418 QString tagName = element.tagName();
01419 if( tagName == "DataColors" ) {
01420 QMap<uint,QColor>* map = &_dataColors;
01421 readColorMapNode( element, map );
01422 } else if( tagName == "MaxDatasetColor" ) {
01423 int maxDatasetColor;
01424 if( KDXML::readIntNode( element, maxDatasetColor ) )
01425 _maxDatasetColor = maxDatasetColor;
01426 } else if( tagName == "ShadowBrightnessFactor" ) {
01427 double shadowBrightnessFactor;
01428 if( KDXML::readDoubleNode( element, shadowBrightnessFactor ) )
01429 _shadowBrightnessFactor = shadowBrightnessFactor;
01430 } else if( tagName == "ShadowPattern" ) {
01431 QString value;
01432 if( KDXML::readStringNode( element, value ) )
01433 _shadowPattern = KDXML::stringToBrushStyle( value );
01434 } else if( tagName == "ThreeDShadowColors" ) {
01435 bool threeDShadowColors;
01436 if( KDXML::readBoolNode( element, threeDShadowColors ) )
01437 _threeDShadowColors = threeDShadowColors;
01438 } else if( tagName == "DataColorsShadow1" ) {
01439 QMap<uint,QColor>* map = &_dataColorsShadow1;
01440 readColorMapNode( element, map );
01441 } else if( tagName == "DataColorsShadow2" ) {
01442 QMap<uint,QColor>* map = &_dataColorsShadow2;
01443 readColorMapNode( element, map );
01444 } else if( tagName == "OutlineDataColor" ) {
01445 QColor color;
01446 if( KDXML::readColorNode( element, color ) )
01447 _outlineDataColor = color;
01448 } else if( tagName == "OutlineDataLineWidth" ) {
01449 int outlineDataLineWidth;
01450 if( KDXML::readIntNode( element, outlineDataLineWidth ) )
01451 _outlineDataLineWidth = outlineDataLineWidth;
01452 } else if( tagName == "OutlineDataLineStyle" ) {
01453 if( element.hasAttribute( "Style" ) )
01454 _outlineDataLineStyle = KDXML::stringToPenStyle( element.attribute( "Style" ) );
01455 } else {
01456 qDebug( "!!!Unknown subelement of ColorSettings found: %s", tagName.latin1() );
01457 }
01458 }
01459 node = node.nextSibling();
01460 }
01461 } else if( tagName == "BarSettings" ) {
01462 QDomNode node = element.firstChild();
01463 while( !node.isNull() ) {
01464 QDomElement element = node.toElement();
01465 if( !element.isNull() ) {
01466 QString tagName = element.tagName();
01467 if( tagName == "SubType" ) {
01468 QString value;
01469 if( KDXML::readStringNode( element, value ) )
01470 _barChartSubType = KDChartParams::stringToBarChartSubType( value );
01471 } else if( tagName == "ThreeDBars" ) {
01472 bool threeDBars;
01473 if( KDXML::readBoolNode( element, threeDBars ) )
01474 _threeDBars = threeDBars;
01475 } else if( tagName == "ThreeDBarDepth" ) {
01476 double threeDBarDepth;
01477 if( KDXML::readDoubleNode( element, threeDBarDepth ) )
01478 _threeDBarDepth = threeDBarDepth;
01479 } else if( tagName == "DatasetGap" ) {
01480 int datasetGap;
01481 if( KDXML::readIntNode( element, datasetGap ) )
01482 _datasetGap = datasetGap;
01483 } else if( tagName == "DatasetGapIsRelative" ) {
01484 bool datasetGapIsRelative;
01485 if( KDXML::readBoolNode( element, datasetGapIsRelative ) )
01486 _datasetGapIsRelative = datasetGapIsRelative;
01487 } else if( tagName == "ValueBlockGap" ) {
01488 int valueBlockGap;
01489 if( KDXML::readIntNode( element, valueBlockGap ) )
01490 _valueBlockGap = valueBlockGap;
01491 } else if( tagName == "ValueBlockGapIsRelative" ) {
01492 bool valueBlockGapIsRelative;
01493 if( KDXML::readBoolNode( element, valueBlockGapIsRelative ) )
01494 _valueBlockGapIsRelative = valueBlockGapIsRelative;
01495 } else if( tagName == "BarWidth" ) {
01496 int barWidth;
01497 if( KDXML::readIntNode( element, barWidth ) )
01498 _barWidth = barWidth;
01499 } else if( tagName == "SolidExcessArrows" ) {
01500 bool solidExcessArrows;
01501 if( KDXML::readBoolNode( element, solidExcessArrows ) )
01502 _solidExcessArrows = solidExcessArrows;
01503 } else {
01504 qDebug( "Unknown subelement of BarSettings found: %s", tagName.latin1() );
01505 }
01506 }
01507 node = node.nextSibling();
01508 }
01509 } else if( tagName == "LineSettings" ) {
01510 QDomNode node = element.firstChild();
01511 while( !node.isNull() ) {
01512 QDomElement element = node.toElement();
01513 if( !element.isNull() ) {
01514 QString tagName = element.tagName();
01515 if( tagName == "SubType" ) {
01516 QString value;
01517 if( KDXML::readStringNode( element, value ) )
01518 _lineChartSubType = KDChartParams::stringToLineChartSubType( value );
01519 } else if( tagName == "Marker" ) {
01520 bool marker;
01521 if( KDXML::readBoolNode( element, marker ) )
01522 _lineMarker = marker;
01523 } else if( tagName == "MarkerStyle" ) {
01524 bool ok = true;
01525 uint dataset;
01526 KDChartParams::LineMarkerStyle style = LineMarkerCircle;
01527 if( element.hasAttribute( "Dataset" ) &&
01528 element.hasAttribute( "Style" ) ) {
01529 dataset = element.attribute( "Dataset" ).toUInt( &ok );
01530 if( ok )
01531 style = KDChartParams::stringToLineMarkerStyle( element.attribute( "Style" ) );
01532 } else
01533 ok = false;
01534 if( ok )
01535 _lineMarkerStyles[dataset] = style;
01536 } else if( tagName == "MarkerSize" ) {
01537 int width = 1;
01538 int height= 1;
01539 bool ok = true;
01540 if( element.hasAttribute( "Width" ) &&
01541 element.hasAttribute( "Height" ) ) {
01542 width = element.attribute( "Width" ).toInt( &ok );
01543 if( ok )
01544 height = element.attribute( "Height" ).toInt( &ok );
01545 } else
01546 ok = false;
01547
01548 if( ok ) {
01549 _lineMarkerSize.setWidth( width );
01550 _lineMarkerSize.setHeight( height );
01551 }
01552 } else if( tagName == "LineWidth" ) {
01553 int lineWidth;
01554 if( KDXML::readIntNode( element, lineWidth ) )
01555 _lineWidth = lineWidth;
01556 } else if( tagName == "LineColor" ) {
01557 QColor color;
01558 if( KDXML::readColorNode( element, color ) )
01559 _lineColor = color;
01560 } else if( tagName == "LineStyle" ) {
01561 if( element.hasAttribute( "Style" ) )
01562 _lineStyle = KDXML::stringToPenStyle( element.attribute( "Style" ) );
01563 } else if( tagName == "DatasetLineStyle" ) {
01564 bool ok = true;
01565 uint dataset;
01566 PenStyle style = Qt::SolidLine;
01567 if( element.hasAttribute( "Dataset" ) &&
01568 element.hasAttribute( "Style" ) ) {
01569 dataset = element.attribute( "Dataset" ).toUInt( &ok );
01570 if( ok )
01571 style = KDXML::stringToPenStyle( element.attribute( "Style" ) );
01572 } else
01573 ok = false;
01574 if( ok )
01575 _datasetLineStyles[dataset] = style;
01576 } else if( tagName == "ThreeD" ) {
01577 bool threeD;
01578 if( KDXML::readBoolNode( element, threeD ) )
01579 _threeDLines = threeD;
01580 } else if( tagName == "ThreeDDepth" ) {
01581 int depth;
01582 if( KDXML::readIntNode( element, depth ) )
01583 _threeDLineDepth = depth;
01584 } else if( tagName == "ThreeDXRotation" ) {
01585 int rotation;
01586 if( KDXML::readIntNode( element, rotation ) )
01587 _threeDLineXRotation = rotation;
01588 } else if( tagName == "ThreeDYRotation" ) {
01589 int rotation;
01590 if( KDXML::readIntNode( element, rotation ) )
01591 _threeDLineYRotation = rotation;
01592 } else {
01593 qDebug( "Unknown subelement of LineSettings found: %s", tagName.latin1() );
01594 }
01595 }
01596 node = node.nextSibling();
01597 }
01598 } else if( tagName == "AreaSettings" ) {
01599 QDomNode node = element.firstChild();
01600 while( !node.isNull() ) {
01601 QDomElement element = node.toElement();
01602 if( !element.isNull() ) {
01603 QString tagName = element.tagName();
01604 if( tagName == "SubType" ) {
01605 QString value;
01606 if( KDXML::readStringNode( element, value ) )
01607 _areaChartSubType = KDChartParams::stringToAreaChartSubType( value );
01608 } else if( tagName == "Location" ) {
01609 QString string;
01610 if( KDXML::readStringNode( element, string ) )
01611 _areaLocation = KDChartParams::stringToAreaLocation( string );
01612 } else {
01613 qDebug( "Unknown subelement of AreaSettings found: %s", tagName.latin1() );
01614 }
01615 }
01616 node = node.nextSibling();
01617 }
01618 } else if( tagName == "PieRingSettings" ) {
01619 QDomNode node = element.firstChild();
01620 while( !node.isNull() ) {
01621 QDomElement element = node.toElement();
01622 if( !element.isNull() ) {
01623 QString tagName = element.tagName();
01624 if( tagName == "Explode" ) {
01625 bool explode;
01626 if( KDXML::readBoolNode( element, explode ) )
01627 _explode = explode;
01628 } else if( tagName == "DefaultExplodeFactor" ) {
01629 double defaultExplodeFactor;
01630 if( KDXML::readDoubleNode( element, defaultExplodeFactor ) )
01631 _explodeFactor = defaultExplodeFactor;
01632 } else if( tagName == "ExplodeFactors" ) {
01633 QMap<int,double>* map = &_explodeFactors;
01634 readDoubleMapNode( element, map );
01635 } else if( tagName == "ExplodeSegment" ) {
01636 int explodeSegment;
01637 if( KDXML::readIntNode( element, explodeSegment ) )
01638 _explodeList << explodeSegment;
01639 } else if( tagName == "ThreeDPies" ) {
01640 bool threeDPies;
01641 if( KDXML::readBoolNode( element, threeDPies ) )
01642 _threeDPies = threeDPies;
01643 } else if( tagName == "ThreeDPieHeight" ) {
01644 int threeDPieHeight;
01645 if( KDXML::readIntNode( element, threeDPieHeight ) )
01646 _threeDPieHeight = threeDPieHeight;
01647 } else if( tagName == "PieStart" ) {
01648 int pieStart;
01649 if( KDXML::readIntNode( element, pieStart ) )
01650 _pieStart = pieStart;
01651 } else if( tagName == "RingStart" ) {
01652 int ringStart;
01653 if( KDXML::readIntNode( element, ringStart ) )
01654 _ringStart = ringStart;
01655 } else if( tagName == "RelativeRingThickness" ) {
01656 bool relativeRingThickness;
01657 if( KDXML::readBoolNode( element, relativeRingThickness ) )
01658 _relativeRingThickness = relativeRingThickness;
01659 } else {
01660 qDebug( "Unknown subelement of PieRingSettings found: %s", tagName.latin1() );
01661 }
01662 }
01663 node = node.nextSibling();
01664 }
01665 } else if( tagName == "HiLoSettings" ) {
01666 QDomNode node = element.firstChild();
01667 while( !node.isNull() ) {
01668 QDomElement element = node.toElement();
01669 if( !element.isNull() ) {
01670 QString tagName = element.tagName();
01671 if( tagName == "SubType" ) {
01672 QString value;
01673 if( KDXML::readStringNode( element, value ) )
01674 _hiLoChartSubType = KDChartParams::stringToHiLoChartSubType( value );
01675 } else if( tagName == "PrintLowValues" ) {
01676 bool printLowValues;
01677 if( KDXML::readBoolNode( element, printLowValues ) )
01678 _hiLoChartPrintLowValues = printLowValues;
01679 } else if( tagName == "LowValuesFont" ) {
01680 readChartFontNode( element,
01681 _hiLoChartLowValuesFont,
01682 _hiLoChartLowValuesUseFontRelSize,
01683 _hiLoChartLowValuesFontRelSize );
01684 } else if( tagName == "LowValuesColor" ) {
01685 QColor color;
01686 if( KDXML::readColorNode( element, color ) )
01687 _hiLoChartLowValuesColor = color;
01688 } else if( tagName == "PrintHighValues" ) {
01689 bool printHighValues;
01690 if( KDXML::readBoolNode( element, printHighValues ) )
01691 _hiLoChartPrintHighValues = printHighValues;
01692 } else if( tagName == "HighValuesFont" ) {
01693 readChartFontNode( element,
01694 _hiLoChartHighValuesFont,
01695 _hiLoChartHighValuesUseFontRelSize,
01696 _hiLoChartHighValuesFontRelSize );
01697 } else if( tagName == "HighValuesColor" ) {
01698 QColor color;
01699 if( KDXML::readColorNode( element, color ) )
01700 _hiLoChartHighValuesColor = color;
01701 } else if( tagName == "PrintOpenValues" ) {
01702 bool printOpenValues;
01703 if( KDXML::readBoolNode( element, printOpenValues ) )
01704 _hiLoChartPrintOpenValues = printOpenValues;
01705 } else if( tagName == "OpenValuesFont" ) {
01706 readChartFontNode( element,
01707 _hiLoChartOpenValuesFont,
01708 _hiLoChartOpenValuesUseFontRelSize,
01709 _hiLoChartOpenValuesFontRelSize );
01710 } else if( tagName == "OpenValuesColor" ) {
01711 QColor color;
01712 if( KDXML::readColorNode( element, color ) )
01713 _hiLoChartOpenValuesColor = color;
01714 } else if( tagName == "PrintCloseValues" ) {
01715 bool printCloseValues;
01716 if( KDXML::readBoolNode( element, printCloseValues ) )
01717 _hiLoChartPrintCloseValues = printCloseValues;
01718 } else if( tagName == "CloseValuesFont" ) {
01719 readChartFontNode( element,
01720 _hiLoChartCloseValuesFont,
01721 _hiLoChartCloseValuesUseFontRelSize,
01722 _hiLoChartCloseValuesFontRelSize );
01723 } else if( tagName == "CloseValuesColor" ) {
01724 QColor color;
01725 if( KDXML::readColorNode( element, color ) )
01726 _hiLoChartCloseValuesColor = color;
01727 } else {
01728 qDebug( "Unknown subelement of HiLoSettings found: %s", tagName.latin1() );
01729 }
01730 }
01731 node = node.nextSibling();
01732 }
01733
01734
01735 } else if( tagName == "BoxAndWhiskerSettings" ) {
01736 QDomNode node = element.firstChild();
01737 while( !node.isNull() ) {
01738 QDomElement element = node.toElement();
01739 if( !element.isNull() ) {
01740 QString tagName = element.tagName();
01741 if( tagName == "SubType" ) {
01742 QString value;
01743 if( KDXML::readStringNode( element, value ) )
01744 _BWChartSubType = KDChartParams::stringToBWChartSubType( value );
01745 } else if( tagName == "FenceUpperInner" ) {
01746 double fence;
01747 if( KDXML::readDoubleNode( element, fence ) )
01748 _BWChartFenceUpperInner = fence;
01749 } else if( tagName == "FenceLowerInner" ) {
01750 double fence;
01751 if( KDXML::readDoubleNode( element, fence ) )
01752 _BWChartFenceUpperOuter = fence;
01753 } else if( tagName == "FenceUpperOuter" ) {
01754 double fence;
01755 if( KDXML::readDoubleNode( element, fence ) )
01756 _BWChartFenceUpperOuter = fence;
01757 } else if( tagName == "FenceLowerOuter" ) {
01758 double fence;
01759 if( KDXML::readDoubleNode( element, fence ) )
01760 _BWChartFenceUpperOuter = fence;
01761 } else if( tagName == "Brush" ) {
01762 QBrush brush;
01763 if( KDXML::readBrushNode( element, brush ) )
01764 _BWChartBrush = brush;
01765 } else if( tagName == "OutlierSize" ) {
01766 int size;
01767 if( KDXML::readIntNode( element, size ) )
01768 _BWChartOutValMarkerSize = size;
01769 } else if( tagName.startsWith("PrintStatistics") ) {
01770
01771 QString statName(tagName.mid( 15 ));
01772 BWStatVal i( stringToBWChartStatVal( statName ) );
01773 if( BWStatValSTART <= i && i <= BWStatValEND ) {
01774 QDomNode node = element.firstChild();
01775 while( !node.isNull() ) {
01776 QDomElement element = node.toElement();
01777 if( !element.isNull() ) {
01778 QString tagName = element.tagName();
01779 if( tagName == "Active" ) {
01780 bool active;
01781 if( KDXML::readBoolNode( element, active ) )
01782 _BWChartStatistics[ i ].active = active;
01783 } else if( tagName == "Font" ) {
01784 readChartFontNode( element,
01785 _BWChartStatistics[ i ].font,
01786 _BWChartStatistics[ i ].useRelSize,
01787 _BWChartStatistics[ i ].relSize );
01788 } else if( tagName == "Color" ) {
01789 QColor color;
01790 if( KDXML::readColorNode( element, color ) )
01791 _BWChartStatistics[ i ].color = color;
01792 } else if( tagName == "Brush" ) {
01793 QBrush brush;
01794 if( KDXML::readBrushNode( element, brush ) )
01795 _BWChartStatistics[ i ].brush = brush;
01796 } else {
01797 qDebug( "Unknown subelement of BoxAndWhiskerSettings found: %s", tagName.latin1() );
01798 }
01799 }
01800 }
01801 } else {
01802 qDebug( "Unknown subelement of BoxAndWhiskerSettings found: %s", tagName.latin1() );
01803 }
01804 } else {
01805 qDebug( "Unknown subelement of BoxAndWhiskerSettings found: %s", tagName.latin1() );
01806 }
01807 }
01808 node = node.nextSibling();
01809 }
01810 } else if( tagName == "PolarSettings" ) {
01811 QDomNode node = element.firstChild();
01812 while( !node.isNull() ) {
01813 QDomElement element = node.toElement();
01814 if( !element.isNull() ) {
01815 QString tagName = element.tagName();
01816 if( tagName == "SubType" ) {
01817 QString value;
01818 if( KDXML::readStringNode( element, value ) )
01819 _polarChartSubType = KDChartParams::stringToPolarChartSubType( value );
01820 } else if( tagName == "Marker" ) {
01821 bool marker;
01822 if( KDXML::readBoolNode( element, marker ) )
01823 _polarMarker = marker;
01824 } else if( tagName == "MarkerStyle" ) {
01825 bool ok = true;
01826 uint dataset;
01827 KDChartParams::PolarMarkerStyle style = PolarMarkerCircle;
01828 if( element.hasAttribute( "Dataset" ) &&
01829 element.hasAttribute( "Style" ) ) {
01830 dataset = element.attribute( "Dataset" ).toUInt( &ok );
01831 if( ok )
01832 style = KDChartParams::stringToPolarMarkerStyle( element.attribute( "Style" ) );
01833 } else
01834 ok = false;
01835 if( ok )
01836 _polarMarkerStyles[dataset] = style;
01837 } else if( tagName == "MarkerSize" ) {
01838 int width = 1;
01839 int height= 1;
01840 bool ok = true;
01841 if( element.hasAttribute( "Width" ) &&
01842 element.hasAttribute( "Height" ) ) {
01843 width = element.attribute( "Width" ).toInt( &ok );
01844 if( ok )
01845 height = element.attribute( "Height" ).toInt( &ok );
01846 } else
01847 ok = false;
01848
01849 if( ok ) {
01850 _polarMarkerSize.setWidth( width );
01851 _polarMarkerSize.setHeight( height );
01852 }
01853 } else if( tagName == "PolarLineWidth" ) {
01854 int polarLineWidth;
01855 if( KDXML::readIntNode( element, polarLineWidth ) )
01856 _polarLineWidth = polarLineWidth;
01857 } else {
01858 qDebug( "Unknown subelement of PolarSettings found: %s", tagName.latin1() );
01859 }
01860 }
01861 node = node.nextSibling();
01862 }
01863 } else if( tagName == "LegendSettings" ) {
01864 QDomNode node = element.firstChild();
01865 while( !node.isNull() ) {
01866 QDomElement element = node.toElement();
01867 if( !element.isNull() ) {
01868 QString tagName = element.tagName();
01869 if( tagName == "Position" ) {
01870 QString string;
01871 if( KDXML::readStringNode( element, string ) )
01872 _legendPosition = KDChartParams::stringToLegendPosition( string );
01873 } else if( tagName == "Orientation" ) {
01874 Qt::Orientation value=Qt::Vertical;
01875 if( KDXML::readOrientationNode( element, value ) )
01876 _legendOrientation = value;
01877 } else if( tagName == "ShowLines" ) {
01878 bool showLines;
01879 if( KDXML::readBoolNode( element, showLines ) )
01880 _legendShowLines = showLines;
01881 } else if( tagName == "Source" ) {
01882 QString string;
01883 if( KDXML::readStringNode( element, string ) )
01884 _legendSource = KDChartParams::stringToLegendSource( string );
01885 } else if( tagName == "LegendText" ) {
01886 bool ok = true;
01887 uint dataset = 0;
01888 QString text;
01889 if( element.hasAttribute( "Dataset" ) &&
01890 element.hasAttribute( "Text" ) ) {
01891 dataset = element.attribute( "Dataset" ).toUInt( &ok );
01892 if( ok )
01893 text = element.attribute( "Text" );
01894 } else
01895 ok = false;
01896 if( ok )
01897 _legendText[dataset] = text;
01898 } else if( tagName == "TextColor" ) {
01899 QColor color;
01900 if( KDXML::readColorNode( element, color ) )
01901 _legendTextColor = color;
01902 } else if( tagName == "TextFont" ) {
01903 readChartFontNode( element,
01904 _legendFont,
01905 _legendFontUseRelSize,
01906 _legendFontRelSize );
01907 } else if( tagName == "TitleText" ) {
01908 QString string;
01909 if( KDXML::readStringNode( element, string ) )
01910 _legendTitleText = string;
01911 } else if( tagName == "TitleColor" ) {
01912 QColor color;
01913 if( KDXML::readColorNode( element, color ) )
01914 _legendTitleTextColor = color;
01915 } else if( tagName == "TitleFont" ) {
01916 readChartFontNode( element,
01917 _legendTitleFont,
01918 _legendTitleFontUseRelSize,
01919 _legendTitleFontRelSize );
01920 } else if( tagName == "Spacing" ) {
01921 int spacing;
01922 if( KDXML::readIntNode( element, spacing ) )
01923 _legendSpacing = spacing;
01924 } else {
01925 qDebug( "Unknown subelement of LegendSettings found: %s", tagName.latin1() );
01926 }
01927 }
01928 node = node.nextSibling();
01929 }
01930 } else if( tagName == "AxisSettings" ) {
01931
01932 loadAxesFormXML(curAxisSettings, element);
01933
01934 } else if( tagName == "HeaderFooterSettings" ) {
01935 KDChartParams::HdFtParams* hfSettings =
01936 &( _hdFtParams[ curHFSettings ] );
01937 QDomNode node = element.firstChild();
01938 while( !node.isNull() ) {
01939 QDomElement element = node.toElement();
01940 if( !element.isNull() ) {
01941 QString tagName = element.tagName();
01942 if( tagName == "Text" ) {
01943 QString string;
01944 if( KDXML::readStringNode( element, string ) )
01945 hfSettings->_text = string;
01946 } else if( tagName == "Font" ) {
01947 readChartFontNode( element,
01948 hfSettings->_font,
01949 hfSettings->_fontUseRelSize,
01950 hfSettings->_fontRelSize );
01951 } else if( tagName == "Color" ) {
01952 QColor color;
01953 if( KDXML::readColorNode( element, color ) )
01954 hfSettings->_color = color;
01955 } else {
01956 qDebug( "Unknown subelement of HeaderFooterSettings found: %s", tagName.latin1() );
01957 }
01958 }
01959 node = node.nextSibling();
01960 }
01961 curHFSettings++;
01962 } else if( tagName == "GlobalLeading" ) {
01963 QDomNode node = element.firstChild();
01964 while( !node.isNull() ) {
01965 QDomElement element = node.toElement();
01966 if( !element.isNull() ) {
01967 QString tagName = element.tagName();
01968 if( tagName == "Left" ) {
01969 int value;
01970 if( KDXML::readIntNode( element, value ) )
01971 _globalLeadingLeft = value;
01972 }
01973 else if( tagName == "Top" ) {
01974 int value;
01975 if( KDXML::readIntNode( element, value ) )
01976 _globalLeadingTop = value;
01977 }
01978 else if( tagName == "Right" ) {
01979 int value;
01980 if( KDXML::readIntNode( element, value ) )
01981 _globalLeadingRight = value;
01982 }
01983 else if( tagName == "Bottom" ) {
01984 int value;
01985 if( KDXML::readIntNode( element, value ) )
01986 _globalLeadingBottom = value;
01987 } else {
01988 qDebug( "Unknown subelement of GlobalLeading found: %s", tagName.latin1() );
01989 }
01990 }
01991 node = node.nextSibling();
01992 }
01993 } else if( tagName == "DataValuesSettings1" ) {
01994 QDomNode node = element.firstChild();
01995 while( !node.isNull() ) {
01996 QDomElement element = node.toElement();
01997 if( !element.isNull() ) {
01998 QString tagName = element.tagName();
01999 if( tagName == "PrintDataValues" ) {
02000 bool value;
02001 if( KDXML::readBoolNode( element, value ) )
02002 _printDataValuesSettings._printDataValues = value;
02003 } else if( tagName == "DivPow10" ) {
02004 int value;
02005 if( KDXML::readIntNode( element, value ) )
02006 _printDataValuesSettings._divPow10 = value;
02007 } else if( tagName == "DigitsBehindComma" ) {
02008 int value;
02009 if( KDXML::readIntNode( element, value ) )
02010 _printDataValuesSettings._digitsBehindComma = value;
02011 } else if( tagName == "Font" ) {
02012 readChartFontNode( element,
02013 _printDataValuesSettings._dataValuesFont,
02014 _printDataValuesSettings._dataValuesUseFontRelSize,
02015 _printDataValuesSettings._dataValuesFontRelSize );
02016 } else if( tagName == "Color" ) {
02017 KDXML::readColorNode( element, _printDataValuesSettings._dataValuesColor );
02018 } else if( tagName == "Background" ) {
02019 KDXML::readBrushNode( element, _printDataValuesSettings._dataValuesBrush );
02020 } else if( tagName == "AutoColor" ) {
02021 KDXML::readBoolNode( element,
02022 _printDataValuesSettings._dataValuesAutoColor );
02023 } else if( tagName == "AnchorNegativePosition" ) {
02024 QString value;
02025 if( KDXML::readStringNode( element, value ) )
02026 _printDataValuesSettings._dataValuesAnchorNegativePosition = KDChartEnums::stringToPositionFlag( value );
02027 } else if( tagName == "AnchorNegativeAlign" ) {
02028 int value;
02029 if( KDXML::readIntNode( element, value ) )
02030 _printDataValuesSettings._dataValuesAnchorNegativeAlign = value;
02031 } else if( tagName == "AnchorNegativeDeltaX" ) {
02032 int value;
02033 if( KDXML::readIntNode( element, value ) )
02034 _printDataValuesSettings._dataValuesAnchorNegativeDeltaX = value;
02035 } else if( tagName == "AnchorNegativeDeltaY" ) {
02036 int value;
02037 if( KDXML::readIntNode( element, value ) )
02038 _printDataValuesSettings._dataValuesAnchorNegativeDeltaY = value;
02039 } else if( tagName == "NegativeRotation" ) {
02040 int value;
02041 if( KDXML::readIntNode( element, value ) )
02042 _printDataValuesSettings._dataValuesNegativeRotation = value;
02043 } else if( tagName == "AnchorPositivePosition" ) {
02044 QString value;
02045 if( KDXML::readStringNode( element, value ) )
02046 _printDataValuesSettings._dataValuesAnchorPositivePosition = KDChartEnums::stringToPositionFlag( value );
02047 } else if( tagName == "AnchorPositiveAlign" ) {
02048 int value;
02049 if( KDXML::readIntNode( element, value ) )
02050 _printDataValuesSettings._dataValuesAnchorPositiveAlign = value;
02051 } else if( tagName == "AnchorPositiveDeltaX" ) {
02052 int value;
02053 if( KDXML::readIntNode( element, value ) )
02054 _printDataValuesSettings._dataValuesAnchorPositiveDeltaX = value;
02055 } else if( tagName == "AnchorPositiveDeltaY" ) {
02056 int value;
02057 if( KDXML::readIntNode( element, value ) )
02058 _printDataValuesSettings._dataValuesAnchorPositiveDeltaY = value;
02059 } else if( tagName == "PositiveRotation" ) {
02060 int value;
02061 if( KDXML::readIntNode( element, value ) )
02062 _printDataValuesSettings._dataValuesPositiveRotation = value;
02063 } else if( tagName == "LayoutPolicy" ) {
02064 QString value;
02065 if( KDXML::readStringNode( element, value ) )
02066 _printDataValuesSettings._dataValuesLayoutPolicy = KDChartEnums::stringToLayoutPolicy( value );
02067 } else if( tagName == "ShowInfinite" ) {
02068 KDXML::readBoolNode( element, _printDataValuesSettings._dataValuesShowInfinite );
02069 } else {
02070 qDebug( "Unknown subelement of DataValuesSettings1 found: %s", tagName.latin1() );
02071 }
02072 }
02073 node = node.nextSibling();
02074 }
02075 } else if( tagName == "DataValuesSettings2" ) {
02076 QDomNode node = element.firstChild();
02077 while( !node.isNull() ) {
02078 QDomElement element = node.toElement();
02079 if( !element.isNull() ) {
02080 QString tagName = element.tagName();
02081 if( tagName == "PrintDataValues" ) {
02082 bool value;
02083 if( KDXML::readBoolNode( element, value ) )
02084 _printDataValuesSettings2._printDataValues = value;
02085 } else if( tagName == "DivPow10" ) {
02086 int value;
02087 if( KDXML::readIntNode( element, value ) )
02088 _printDataValuesSettings2._divPow10 = value;
02089 } else if( tagName == "DigitsBehindComma" ) {
02090 int value;
02091 if( KDXML::readIntNode( element, value ) )
02092 _printDataValuesSettings2._digitsBehindComma = value;
02093 } else if( tagName == "Font" ) {
02094 readChartFontNode( element,
02095 _printDataValuesSettings2._dataValuesFont,
02096 _printDataValuesSettings2._dataValuesUseFontRelSize,
02097 _printDataValuesSettings2._dataValuesFontRelSize );
02098 } else if( tagName == "Color" ) {
02099 KDXML::readColorNode( element, _printDataValuesSettings2._dataValuesColor );
02100 } else if( tagName == "Background" ) {
02101 KDXML::readBrushNode( element, _printDataValuesSettings2._dataValuesBrush );
02102 } else if( tagName == "AutoColor" ) {
02103 KDXML::readBoolNode( element,
02104 _printDataValuesSettings2._dataValuesAutoColor );
02105 } else if( tagName == "AnchorNegativePosition" ) {
02106 QString value;
02107 if( KDXML::readStringNode( element, value ) )
02108 _printDataValuesSettings2._dataValuesAnchorNegativePosition = KDChartEnums::stringToPositionFlag( value );
02109 } else if( tagName == "AnchorNegativeAlign" ) {
02110 int value;
02111 if( KDXML::readIntNode( element, value ) )
02112 _printDataValuesSettings2._dataValuesAnchorNegativeAlign = value;
02113 } else if( tagName == "AnchorNegativeDeltaX" ) {
02114 int value;
02115 if( KDXML::readIntNode( element, value ) )
02116 _printDataValuesSettings2._dataValuesAnchorNegativeDeltaX = value;
02117 } else if( tagName == "AnchorNegativeDeltaY" ) {
02118 int value;
02119 if( KDXML::readIntNode( element, value ) )
02120 _printDataValuesSettings2._dataValuesAnchorNegativeDeltaY = value;
02121 } else if( tagName == "NegativeRotation" ) {
02122 int value;
02123 if( KDXML::readIntNode( element, value ) )
02124 _printDataValuesSettings2._dataValuesNegativeRotation = value;
02125 } else if( tagName == "AnchorPositivePosition" ) {
02126 QString value;
02127 if( KDXML::readStringNode( element, value ) )
02128 _printDataValuesSettings2._dataValuesAnchorPositivePosition = KDChartEnums::stringToPositionFlag( value );
02129 } else if( tagName == "AnchorPositiveAlign" ) {
02130 int value;
02131 if( KDXML::readIntNode( element, value ) )
02132 _printDataValuesSettings2._dataValuesAnchorPositiveAlign = value;
02133 } else if( tagName == "AnchorPositiveDeltaX" ) {
02134 int value;
02135 if( KDXML::readIntNode( element, value ) )
02136 _printDataValuesSettings2._dataValuesAnchorPositiveDeltaX = value;
02137 } else if( tagName == "AnchorPositiveDeltaY" ) {
02138 int value;
02139 if( KDXML::readIntNode( element, value ) )
02140 _printDataValuesSettings2._dataValuesAnchorPositiveDeltaY = value;
02141 } else if( tagName == "PositiveRotation" ) {
02142 int value;
02143 if( KDXML::readIntNode( element, value ) )
02144 _printDataValuesSettings2._dataValuesPositiveRotation = value;
02145 } else if( tagName == "LayoutPolicy" ) {
02146 QString value;
02147 if( KDXML::readStringNode( element, value ) )
02148 _printDataValuesSettings2._dataValuesLayoutPolicy = KDChartEnums::stringToLayoutPolicy( value );
02149 } else if( tagName == "ShowInfinite" ) {
02150 KDXML::readBoolNode( element, _printDataValuesSettings2._dataValuesShowInfinite );
02151 } else {
02152 qDebug( "Unknown subelement of DataValuesSettings2 found: %s", tagName.latin1() );
02153 }
02154 }
02155 node = node.nextSibling();
02156 }
02157 } else if( tagName == "DataValuesGlobalSettings" ) {
02158 QDomNode node = element.firstChild();
02159 while( !node.isNull() ) {
02160 QDomElement element = node.toElement();
02161 if( !element.isNull() ) {
02162 QString tagName = element.tagName();
02163 if( tagName == "allowOverlappingTexts" ) {
02164 bool value;
02165 if( KDXML::readBoolNode( element, value ) )
02166 _allowOverlappingDataValueTexts = value;
02167 }
02168 else
02169 qDebug( "Unknown subelement of DataValuesGlobalSettings found: %s", tagName.latin1() );
02170
02171 }
02172 node = node.nextSibling();
02173 }
02174 } else if( tagName == "AreaMap" ) {
02175 QDomNode node = element.firstChild();
02176 while( !node.isNull() ) {
02177 QDomElement element = node.toElement();
02178 if( !element.isNull() ) {
02179 QString tagName = element.tagName();
02180 if( tagName == "FrameSettings" ) {
02181 KDChartFrameSettings* frameSettings = new KDChartFrameSettings;
02182 uint areaId = KDChartEnums::AreaUNKNOWN;
02183 if( KDChartFrameSettings::readFrameSettingsNode(
02184 element, *frameSettings, areaId ) ) {
02185 QString str;
02186 if(areaId == KDChartEnums::AreaChartDataRegion)
02187 str = QString( "%1/%2/%3/%4" )
02188 .arg( areaId, 5 )
02189 .arg( frameSettings->dataRow(), 5 )
02190 .arg( frameSettings->dataCol(), 5 )
02191 .arg( 0, 5 );
02192 else
02193 str = QString( "%1/-----/-----/-----" ).arg( areaId, 5 );
02194 _areaDict.insert( str, frameSettings );
02195 }
02196 }
02197 else
02198 qDebug( "Unknown tag in AreaMap found: %s", tagName.latin1() );
02199
02200 }
02201 node = node.nextSibling();
02202 }
02203 } else if( tagName == "CustomBoxMap" ) {
02204 QDomNode node = element.firstChild();
02205 int curNumber = -1;
02206 while( !node.isNull() ) {
02207 QDomElement element = node.toElement();
02208 if( !element.isNull() ) {
02209 QString tagName = element.tagName();
02210 if( tagName == "Number" ) {
02211 KDXML::readIntNode( element, curNumber );
02212 } else if( tagName == "FrameSettings" ) {
02213 Q_ASSERT( curNumber != -1 );
02214 KDChartCustomBox customBox;
02215 KDChartCustomBox::readCustomBoxNode( element,
02216 customBox );
02217 _customBoxDict.insert( curNumber, customBox.clone() );
02218 }
02219 else
02220 qDebug( "Unknown tag in CustomBoxMap found: %s", tagName.latin1() );
02221 }
02222 node = node.nextSibling();
02223 }
02224 } else {
02225
02226
02227
02228 }
02229 }
02230 node = node.nextSibling();
02231 }
02232 return true;
02233 }
02234
02235
02245 void KDChartParams::createColorMapNode( QDomDocument& doc, QDomNode& parent,
02246 const QString& elementName,
02247 const QMap< uint, QColor >& map )
02248 {
02249 QDomElement mapElement =
02250 doc.createElement( elementName );
02251 parent.appendChild( mapElement );
02252 for( QMap<uint,QColor>::ConstIterator it = map.begin();
02253 it != map.end(); ++it ) {
02254
02255 QDomElement datasetElement = doc.createElement( "Dataset" );
02256 mapElement.appendChild( datasetElement );
02257 QDomText datasetContent =
02258 doc.createTextNode( QString::number( it.key() ) );
02259 datasetElement.appendChild( datasetContent );
02260
02261 KDXML::createColorNode( doc, mapElement, "Color", it.data() );
02262 }
02263 }
02264
02265
02275 void KDChartParams::createDoubleMapNode( QDomDocument& doc, QDomNode& parent,
02276 const QString& elementName,
02277 const QMap< int, double >& map )
02278 {
02279 QDomElement mapElement =
02280 doc.createElement( elementName );
02281 parent.appendChild( mapElement );
02282 for( QMap<int,double>::ConstIterator it = map.begin();
02283 it != map.end(); ++it ) {
02284
02285 QDomElement valueElement = doc.createElement( "Value" );
02286 mapElement.appendChild( valueElement );
02287 QDomText valueContent =
02288 doc.createTextNode( QString::number( it.key() ) );
02289 valueElement.appendChild( valueContent );
02290
02291 KDXML::createDoubleNode( doc, mapElement, "Factor", it.data() );
02292 }
02293 }
02294
02295
02296 void dataCoordToElementAttr(const QVariant& val, QDomElement& element, const QString& postfix)
02297 {
02298 if( QVariant::Double == val.type() )
02299 element.setAttribute( "DoubleValue"+postfix,
02300 QString::number( val.toDouble() ) );
02301 else if( QVariant::String == val.type() )
02302 element.setAttribute( "StringValue"+postfix, val.toString() );
02303 else if( QVariant::DateTime == val.type() )
02304 element.setAttribute( "DateTimeValue"+postfix,
02305 val.toDateTime().toString( Qt::ISODate ) );
02306 else
02307 element.setAttribute( "NoValue"+postfix, "true" );
02308 }
02309
02319 void KDChartParams::createChartValueNode( QDomDocument& doc, QDomNode& parent,
02320 const QString& elementName,
02321 const QVariant& valY,
02322 const QVariant& valX,
02323 const int& propID )
02324 {
02325 QDomElement element = doc.createElement( elementName );
02326 parent.appendChild( element );
02327 dataCoordToElementAttr( valY, element, "" );
02328 dataCoordToElementAttr( valX, element, "X" );
02329 element.setAttribute( "PropertySetID",
02330 QString::number( propID ) );
02331 }
02332
02333
02334
02348 void KDChartParams::createChartFontNode( QDomDocument& doc, QDomNode& parent,
02349 const QString& elementName,
02350 const QFont& font, bool useRelFont,
02351 int relFont,
02352 int minFont )
02353 {
02354 QDomElement chartFontElement = doc.createElement( elementName );
02355 parent.appendChild( chartFontElement );
02356 KDXML::createFontNode( doc, chartFontElement, "Font", font );
02357 KDXML::createBoolNode( doc, chartFontElement, "UseRelFontSize",
02358 useRelFont );
02359 KDXML::createIntNode( doc, chartFontElement, "RelFontSize", relFont );
02360 if( 0 <= minFont )
02361 KDXML::createIntNode( doc, chartFontElement, "MinFontSize", minFont );
02362 }
02363
02364
02365
02366
02367
02377 bool KDChartParams::readColorMapNode( const QDomElement& element,
02378 QMap<uint,QColor>* value )
02379 {
02380 QDomNode node = element.firstChild();
02381 int curDataset = -1;
02382 while( !node.isNull() ) {
02383 QDomElement element = node.toElement();
02384 if( !element.isNull() ) {
02385 QString tagName = element.tagName();
02386 if( tagName == "Dataset" ) {
02387 KDXML::readIntNode( element, curDataset );
02388 } else if( tagName == "Color" ) {
02389 Q_ASSERT( curDataset != -1 );
02390 QColor color;
02391 KDXML::readColorNode( element, color );
02392 value->insert( curDataset, color );
02393 } else {
02394 qDebug( "Unknown tag in color map" );
02395 }
02396 }
02397 node = node.nextSibling();
02398 }
02399
02400 return true;
02401 }
02402
02403
02411 bool KDChartParams::readDoubleMapNode( const QDomElement& element,
02412 QMap<int,double>* value )
02413 {
02414 QDomNode node = element.firstChild();
02415 int curValue = -1;
02416 while( !node.isNull() ) {
02417 QDomElement element = node.toElement();
02418 if( !element.isNull() ) {
02419 QString tagName = element.tagName();
02420 if( tagName == "Value" ) {
02421 KDXML::readIntNode( element, curValue );
02422 } else if( tagName == "Factor" ) {
02423 Q_ASSERT( curValue != -1 );
02424 double doubleValue;
02425 KDXML::readDoubleNode( element, doubleValue );
02426 value->insert( curValue, doubleValue );
02427 } else {
02428 qDebug( "Unknown tag in double map" );
02429 }
02430 }
02431 node = node.nextSibling();
02432 }
02433
02434 return true;
02435 }
02436
02437
02438
02449 bool KDChartParams::readChartFontNode( const QDomElement& element,
02450 QFont& font,
02451 bool& useRelFont,
02452 int& relFontSize,
02453 int* minFontSize )
02454 {
02455 bool ok = true;
02456 QFont tempFont;
02457 bool tempRelFont;
02458 int tempRelFontSize;
02459 int tempMinFontSize=-1;
02460 QDomNode node = element.firstChild();
02461 while( !node.isNull() ) {
02462 QDomElement element = node.toElement();
02463 if( !element.isNull() ) {
02464 QString tagName = element.tagName();
02465 if( tagName == "Font" ) {
02466 ok = ok & KDXML::readFontNode( element, tempFont );
02467 } else if( tagName == "UseRelFontSize" ) {
02468 ok = ok & KDXML::readBoolNode( element, tempRelFont );
02469 } else if( tagName == "RelFontSize" ) {
02470 ok = ok & KDXML::readIntNode( element, tempRelFontSize );
02471 } else if( tagName == "MinFontSize" ) {
02472 ok = ok & KDXML::readIntNode( element, tempMinFontSize );
02473 } else {
02474 qDebug( "Unknown tag in color map" );
02475 }
02476 }
02477 node = node.nextSibling();
02478 }
02479
02480 if( ok ) {
02481 font = tempFont;
02482 useRelFont = tempRelFont;
02483 relFontSize = tempRelFontSize;
02484 if( minFontSize && 0 <= tempMinFontSize )
02485 *minFontSize = tempMinFontSize;
02486 }
02487
02488 return ok;
02489 }
02490
02491
02492 bool foundCoordAttribute( const QDomElement& element, const QString& postfix,
02493 QVariant& val )
02494 {
02495 if( element.hasAttribute( "NoValue"+postfix ) )
02496 val = QVariant();
02497 else if( element.hasAttribute( "DoubleValue"+postfix ) )
02498 val = element.attribute( "DoubleValue"+postfix );
02499 else if( element.hasAttribute( "DateTimeValue"+postfix ) )
02500 val = element.attribute( "DateTimeValue"+postfix );
02501 else if( element.hasAttribute( "StringValue"+postfix ) )
02502 val = element.attribute( "StringValue"+postfix );
02503 else
02504 return false;
02505
02506 return true;
02507 }
02508
02509
02517 bool KDChartParams::readChartValueNode( const QDomElement& element,
02518 QVariant& valY,
02519 QVariant& valX,
02520 int& propID )
02521 {
02522 if( foundCoordAttribute( element, "", valY ) ||
02523 foundCoordAttribute( element, "Y", valY ) ){
02524 if( !foundCoordAttribute( element, "X", valX ) ){
02525 valX = QVariant();
02526 }
02527 propID = 0;
02528 if( element.hasAttribute( "PropertySetID" ) ) {
02529 bool ok;
02530 int i = element.attribute( "PropertySetID" ).toInt( &ok );
02531 if( ok )
02532 propID = i;
02533 }
02534 return true;
02535 }
02536
02537 return false;
02538 }
02539
02540
02547 QString KDChartParams::chartTypeToString( ChartType type )
02548 {
02549 switch( type ) {
02550 case NoType:
02551 return "NoType";
02552 case Bar:
02553 return "Bar";
02554 case Line:
02555 return "Line";
02556 case Area:
02557 return "Area";
02558 case Pie:
02559 return "Pie";
02560 case HiLo:
02561 return "HiLo";
02562 case BoxWhisker:
02563 return "BoxWhisker";
02564 case Ring:
02565 return "Ring";
02566 case Polar:
02567 return "Polar";
02568 default:
02569 return "NoType";
02570 }
02571 }
02572
02573
02580 KDChartParams::ChartType KDChartParams::stringToChartType( const QString& string )
02581 {
02582 if( string == "NoType" )
02583 return NoType;
02584 else if( string == "Bar" )
02585 return Bar;
02586 else if( string == "Line" )
02587 return Line;
02588 else if( string == "Area" )
02589 return Area;
02590 else if( string == "Pie" )
02591 return Pie;
02592 else if( string == "HiLo" )
02593 return HiLo;
02594 else if( string == "BoxWhisker" )
02595 return BoxWhisker;
02596 else if( string == "Ring" )
02597 return Ring;
02598 else if( string == "Polar" )
02599 return Polar;
02600 else
02601 return NoType;
02602 }
02603
02604
02605
02606 QString KDChartParams::markerStyleToString( int style )
02607 {
02608 switch( style ) {
02609 case LineMarkerSquare:
02610 return "Square";
02611 case LineMarkerDiamond:
02612 return "Diamond";
02613 case LineMarkerCircle:
02614 return "Circle";
02615 case LineMarker1Pixel:
02616 return "one Pixel";
02617 case LineMarker4Pixels:
02618 return "four Pixels";
02619 case LineMarkerRing:
02620 return "Ring";
02621 case LineMarkerCross:
02622 return "Cross";
02623 case LineMarkerFastCross:
02624 return "fast Cross";
02625 default:
02626 qDebug( "Unknown marker style" );
02627 return "Circle";
02628 }
02629 }
02630 QString KDChartParams::markerStyleToStringTr( int style )
02631 {
02632 switch( style ) {
02633 case LineMarkerSquare:
02634 return tr( "Square" );
02635 case LineMarkerDiamond:
02636 return tr( "Diamond" );
02637 case LineMarkerCircle:
02638 return tr( "Circle" );
02639 case LineMarker1Pixel:
02640 return tr( "One pixel" );
02641 case LineMarker4Pixels:
02642 return tr( "Four pixels" );
02643 case LineMarkerRing:
02644 return tr( "Ring" );
02645 case LineMarkerCross:
02646 return tr( "Cross" );
02647 case LineMarkerFastCross:
02648 return tr( "fast Cross" );
02649 default:
02650 qDebug( "Unknown line marker style!" );
02651 return tr( "Circle" );
02652 }
02653 }
02654 int KDChartParams::stringToMarkerStyle( const QString& string )
02655 {
02656 if( string == "Square" )
02657 return LineMarkerSquare;
02658 else if( string == "Diamond" )
02659 return LineMarkerDiamond;
02660 else if( string == "Circle" )
02661 return LineMarkerCircle;
02662 else if( string == "one Pixel" )
02663 return LineMarker1Pixel;
02664 else if( string == "four Pixels" )
02665 return LineMarker4Pixels;
02666 else if( string == "Ring" )
02667 return LineMarkerRing;
02668 else if( string == "Cross" )
02669 return LineMarkerCross;
02670 else if( string == "fast Cross" )
02671 return LineMarkerFastCross;
02672 else
02673 return LineMarkerCircle;
02674 }
02675 int KDChartParams::stringToMarkerStyleTr( const QString& string )
02676 {
02677 if( string == tr( "Square" ) )
02678 return LineMarkerSquare;
02679 else if( string == tr( "Diamond" ) )
02680 return LineMarkerDiamond;
02681 else if( string == tr( "Circle" ) )
02682 return LineMarkerCircle;
02683 else if( string == tr( "One pixel" ) )
02684 return LineMarker1Pixel;
02685 else if( string == tr( "Four pixels" ) )
02686 return LineMarker4Pixels;
02687 else if( string == tr( "Ring" ) )
02688 return LineMarkerRing;
02689 else if( string == tr( "Cross" ) )
02690 return LineMarkerCross;
02691 else if( string == tr( "fast Cross" ) )
02692 return LineMarkerFastCross;
02693 else
02694 return LineMarkerCircle;
02695 }
02696
02697
02698
02705 QString KDChartParams::barChartSubTypeToString( BarChartSubType type ) {
02706 switch( type ) {
02707 case BarNormal:
02708 return "BarNormal";
02709 case BarStacked:
02710 return "BarStacked";
02711 case BarPercent:
02712 return "BarPercent";
02713 case BarMultiRows:
02714 return "BarMultiRows";
02715 default:
02716 qDebug( "Unknown bar type" );
02717 return "BarNormal";
02718 }
02719 }
02720
02721
02728 KDChartParams::BarChartSubType KDChartParams::stringToBarChartSubType( const QString& string ) {
02729 if( string == "BarNormal" )
02730 return BarNormal;
02731 else if( string == "BarStacked" )
02732 return BarStacked;
02733 else if( string == "BarPercent" )
02734 return BarPercent;
02735 else if( string == "BarMultiRows" )
02736 return BarMultiRows;
02737 else
02738 return BarNormal;
02739 }
02740
02741
02742
02749 KDChartParams::LineChartSubType KDChartParams::stringToLineChartSubType( const QString& string ) {
02750 if( string == "LineNormal" )
02751 return LineNormal;
02752 else if( string == "LineStacked" )
02753 return LineStacked;
02754 else if( string == "LinePercent" )
02755 return LinePercent;
02756 else
02757 return LineNormal;
02758 }
02759
02760
02761
02768 QString KDChartParams::lineChartSubTypeToString( LineChartSubType type ) {
02769 switch( type ) {
02770 case LineNormal:
02771 return "LineNormal";
02772 case LineStacked:
02773 return "LineStacked";
02774 case LinePercent:
02775 return "LinePercent";
02776 default:
02777 qDebug( "Unknown bar type" );
02778 return "LineNormal";
02779 }
02780 }
02781
02782
02790 QString KDChartParams::lineMarkerStyleToString( LineMarkerStyle style )
02791 {
02792 return markerStyleToString( style );
02793 }
02794
02795
02803 QString KDChartParams::lineMarkerStyleToStringTr( LineMarkerStyle style )
02804 {
02805 return markerStyleToStringTr( style );
02806 }
02807
02808
02815 KDChartParams::LineMarkerStyle KDChartParams::stringToLineMarkerStyle( const QString& string )
02816 {
02817 return static_cast<KDChartParams::LineMarkerStyle>(stringToMarkerStyle( string ));
02818 }
02819
02827 KDChartParams::LineMarkerStyle KDChartParams::stringToLineMarkerStyleTr( const QString& string )
02828 {
02829 return static_cast<KDChartParams::LineMarkerStyle>(stringToMarkerStyleTr( string ));
02830 }
02831
02832
02839 QString KDChartParams::areaChartSubTypeToString( AreaChartSubType type ) {
02840 switch( type ) {
02841 case AreaNormal:
02842 return "AreaNormal";
02843 case AreaStacked:
02844 return "AreaStacked";
02845 case AreaPercent:
02846 return "AreaPercent";
02847 default:
02848 qDebug( "Unknown area chart subtype" );
02849 return "AreaNormal";
02850 }
02851 }
02852
02853
02860 KDChartParams::AreaChartSubType KDChartParams::stringToAreaChartSubType( const QString& string ) {
02861 if( string == "AreaNormal" )
02862 return AreaNormal;
02863 else if( string == "AreaStacked" )
02864 return AreaStacked;
02865 else if( string == "AreaPercent" )
02866 return AreaPercent;
02867 else
02868 return AreaNormal;
02869 }
02870
02871
02878 QString KDChartParams::areaLocationToString( AreaLocation type ) {
02879 switch( type ) {
02880 case AreaAbove:
02881 return "Above";
02882 case AreaBelow:
02883 return "Below";
02884 default:
02885 qDebug( "Unknown area location" );
02886 return "Below";
02887 }
02888 }
02889
02890
02897 KDChartParams::AreaLocation KDChartParams::stringToAreaLocation( const QString& string ) {
02898 if( string == "Above" )
02899 return AreaAbove;
02900 else if( string == "Below" )
02901 return AreaBelow;
02902 else
02903 return AreaBelow;
02904 }
02905
02906
02913 KDChartParams::PolarChartSubType KDChartParams::stringToPolarChartSubType( const QString& string ) {
02914 if( string == "PolarNormal" )
02915 return PolarNormal;
02916 else if( string == "PolarStacked" )
02917 return PolarStacked;
02918 else if( string == "PolarPercent" )
02919 return PolarPercent;
02920 else
02921 return PolarNormal;
02922 }
02923
02924
02931 QString KDChartParams::polarChartSubTypeToString( PolarChartSubType type ) {
02932 switch( type ) {
02933 case PolarNormal:
02934 return "PolarNormal";
02935 case LineStacked:
02936 return "PolarStacked";
02937 case LinePercent:
02938 return "PolarPercent";
02939 default:
02940 qDebug( "Unknown polar type" );
02941 return "PolarNormal";
02942 }
02943 }
02944
02945
02953 QString KDChartParams::polarMarkerStyleToString( PolarMarkerStyle style )
02954 {
02955 return markerStyleToString( style );
02956 }
02957
02958
02966 QString KDChartParams::polarMarkerStyleToStringTr( PolarMarkerStyle style )
02967 {
02968 return markerStyleToStringTr( style );
02969 }
02970
02971
02978 KDChartParams::PolarMarkerStyle KDChartParams::stringToPolarMarkerStyle( const QString& string )
02979 {
02980 return static_cast<KDChartParams::PolarMarkerStyle>(stringToMarkerStyle( string ));
02981 }
02982
02983
02991 KDChartParams::PolarMarkerStyle KDChartParams::stringToPolarMarkerStyleTr( const QString& string )
02992 {
02993 return static_cast<KDChartParams::PolarMarkerStyle>(stringToMarkerStyle( string ));
02994 }
02995
02996
03003 QString KDChartParams::hiLoChartSubTypeToString( HiLoChartSubType type ) {
03004 switch( type ) {
03005 case HiLoSimple:
03006 return "HiLoSimple";
03007 case HiLoClose:
03008 return "HiLoClose";
03009 case HiLoOpenClose:
03010 return "HiLoOpenClose";
03011 default:
03012 qDebug( "Unknown HiLo chart subtype" );
03013 return "HiLoNormal";
03014 }
03015 }
03016
03017
03024 KDChartParams::HiLoChartSubType KDChartParams::stringToHiLoChartSubType( const QString& string ) {
03025 if( string == "HiLoSimple" )
03026 return HiLoSimple;
03027 else if( string == "HiLoClose" )
03028 return HiLoClose;
03029 else if( string == "HiLoOpenClose" )
03030 return HiLoOpenClose;
03031 else
03032 return HiLoNormal;
03033 }
03034
03035
03042 KDChartParams::BWChartSubType KDChartParams::stringToBWChartSubType( const QString& string ) {
03043 if( string == "BWSimple" )
03044 return BWSimple;
03045 else
03046 return BWNormal;
03047 }
03048
03055 QString KDChartParams::bWChartStatValToString( BWStatVal type ) {
03056 switch( type ) {
03057 case UpperOuterFence:
03058 return "UpperOuterFence";
03059 case UpperInnerFence:
03060 return "UpperInnerFence";
03061 case Quartile3:
03062 return "Quartile3";
03063 case Median:
03064 return "Median";
03065 case Quartile1:
03066 return "Quartile1";
03067 case LowerInnerFence:
03068 return "LowerInnerFence";
03069 case LowerOuterFence:
03070 return "LowerOuterFence";
03071 case MaxValue:
03072 return "MaxValue";
03073 case MeanValue:
03074 return "MeanValue";
03075 case MinValue:
03076 return "MinValue";
03077 default:
03078 qDebug( "Unknown BoxWhisker statistical value type" );
03079 return "unknown";
03080 }
03081 }
03082
03089 KDChartParams::BWStatVal KDChartParams::stringToBWChartStatVal( const QString& string ) {
03090 if( string == "UpperOuterFence" )
03091 return UpperOuterFence;
03092 else if( string == "UpperInnerFence" )
03093 return UpperInnerFence;
03094 else if( string == "Quartile3" )
03095 return Quartile3;
03096 else if( string == "Median" )
03097 return Median;
03098 else if( string == "Quartile1" )
03099 return Quartile1;
03100 else if( string == "LowerInnerFence" )
03101 return LowerInnerFence;
03102 else if( string == "LowerOuterFence" )
03103 return LowerOuterFence;
03104 else if( string == "MaxValue" )
03105 return MaxValue;
03106 else if( string == "MeanValue" )
03107 return MeanValue;
03108 else if( string == "MinValue" )
03109 return MinValue;
03110 else
03111 return BWStatValUNKNOWN;
03112 }
03113
03114
03121 QString KDChartParams::legendPositionToString( LegendPosition pos ) {
03122 switch( pos ) {
03123 case NoLegend:
03124 return "NoLegend";
03125 case LegendTop:
03126 return "LegendTop";
03127 case LegendBottom:
03128 return "LegendBottom";
03129 case LegendLeft:
03130 return "LegendLeft";
03131 case LegendRight:
03132 return "LegendRight";
03133 case LegendTopLeft:
03134 return "LegendTopLeft";
03135 case LegendTopLeftTop:
03136 return "LegendTopLeftTop";
03137 case LegendTopLeftLeft:
03138 return "LegendTopLeftLeft";
03139 case LegendBottomLeft:
03140 return "LegendBottomLeft";
03141 case LegendBottomLeftBottom:
03142 return "LegendBottomLeftTop";
03143 case LegendBottomLeftLeft:
03144 return "LegendBottomLeftLeft";
03145 case LegendTopRight:
03146 return "LegendTopRight";
03147 case LegendTopRightTop:
03148 return "LegendTopRightTop";
03149 case LegendTopRightRight:
03150 return "LegendTopRightRight";
03151 case LegendBottomRight:
03152 return "LegendBottomRight";
03153 case LegendBottomRightBottom:
03154 return "LegendBottomRightTop";
03155 case LegendBottomRightRight:
03156 return "LegendBottomRightRight";
03157 default:
03158 qDebug( "Unknown legend position" );
03159 return "LegendLeft";
03160 }
03161 }
03162
03163
03170 KDChartParams::LegendPosition KDChartParams::stringToLegendPosition( const QString& string ) {
03171 if( string == "NoLegend" )
03172 return NoLegend;
03173 else if( string == "LegendTop" )
03174 return LegendTop;
03175 else if( string == "LegendBottom" )
03176 return LegendBottom;
03177 else if( string == "LegendLeft" )
03178 return LegendLeft;
03179 else if( string == "LegendRight" )
03180 return LegendRight;
03181 else if( string == "LegendTopLeft" )
03182 return LegendTopLeft;
03183 else if( string == "LegendTopLeftTop" )
03184 return LegendTopLeftTop;
03185 else if( string == "LegendTopLeftLeft" )
03186 return LegendTopLeftLeft;
03187 else if( string == "LegendBottomLeft" )
03188 return LegendBottomLeft;
03189 else if( string == "LegendBottomLeftBottom" )
03190 return LegendBottomLeftBottom;
03191 else if( string == "LegendBottomLeftLeft" )
03192 return LegendBottomLeftLeft;
03193 else if( string == "LegendTopRight" )
03194 return LegendTopRight;
03195 else if( string == "LegendTopRightTop" )
03196 return LegendTopRightTop;
03197 else if( string == "LegendTopRightRight" )
03198 return LegendTopRightRight;
03199 else if( string == "LegendBottomRight" )
03200 return LegendBottomRight;
03201 else if( string == "LegendBottomRightBottom" )
03202 return LegendBottomRightBottom;
03203 else if( string == "LegendBottomRightRight" )
03204 return LegendBottomRightRight;
03205 else
03206 return LegendLeft;
03207 }
03208
03215 QString KDChartParams::legendSourceToString( LegendSource source ) {
03216 switch( source ) {
03217 case LegendManual:
03218 return "Manual";
03219 case LegendFirstColumn:
03220 return "FirstColumn";
03221 case LegendAutomatic:
03222 return "Automatic";
03223 default:
03224 qDebug( "Unknown legend source" );
03225 return "Automatic";
03226 }
03227 }
03228
03229
03236 KDChartParams::LegendSource KDChartParams::stringToLegendSource( const QString& string ) {
03237 if( string == "Manual" )
03238 return LegendManual;
03239 else if( string == "FirstColumn" )
03240 return LegendFirstColumn;
03241 else if( string == "Automatic" )
03242 return LegendAutomatic;
03243 else
03244 return LegendAutomatic;
03245 }
03246
03247
03254 QString KDChartParams::chartSourceModeToString( const SourceMode& mode )
03255 {
03256 switch( mode ){
03257 case UnknownMode:
03258 return "UnknownMode";
03259 case DontUse:
03260 return "DontUse";
03261 case DataEntry:
03262 return "DataEntry";
03263 case AxisLabel:
03264 return "AxisLabel";
03265 case LegendText:
03266 return "LegendText";
03267 case ExtraLinesAnchor:
03268 return "ExtraLinesAnchor";
03269 default:
03270 return "UnknownMode";
03271 }
03272 }
03273
03274
03281 KDChartParams::SourceMode KDChartParams::stringToChartSourceMode( const QString& string )
03282 {
03283 if( string.isEmpty() )
03284 return UnknownMode;
03285
03286 bool bOk;
03287 int mode = string.toInt( &bOk );
03288 if( bOk && mode >= 0 && mode <= Last_SourceMode )
03289 return (KDChartParams::SourceMode)mode;
03290
03291 if( string == "UnknownMode" )
03292 return UnknownMode;
03293 if( string == "DontUse" )
03294 return DontUse;
03295 if( string == "DataEntry" )
03296 return DataEntry;
03297 if( string == "AxisLabel" )
03298 return AxisLabel;
03299 if( string == "LegendText" )
03300 return LegendText;
03301 if( string == "ExtraLinesAnchor" )
03302 return ExtraLinesAnchor;
03303
03304 return UnknownMode;
03305 }
03306
03307
03315 QString KDChartParams::bWChartSubTypeToString( BWChartSubType type ) {
03316 switch( type ) {
03317 case BWSimple:
03318 return "BWSimple";
03319 default:
03320 qDebug( "Unknown BoxWhisker chart subtype" );
03321 return "BWNormal";
03322 }
03323 }
03324