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