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