~ubuntu-branches/ubuntu/oneiric/koffice/oneiric-updates

« back to all changes in this revision

Viewing changes to filters/kspread/xlsx/XlsxXmlStylesReader.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-10-27 17:52:57 UTC
  • mfrom: (0.12.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101027175257-s04zqqk5bs8ckm9o
Tags: 1:2.2.83-0ubuntu1
* Merge with Debian git remaining changes:
 - Add build-deps on librcps-dev, opengtl-dev, libqtgtl-dev, freetds-dev,
   create-resources, libspnav-dev
 - Remove needless build-dep on libwv2-dev
 - koffice-libs recommends create-resources
 - krita recommends pstoedit
 - Keep our patches
* New upstream release 2.3 beta 3
  - Remove debian/patches fixed by upstream
  - Update install files

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
#include "ColorConversions.h"
47
47
//! @todo only include for TINY target
48
48
 
49
 
const int HLSMAX = 255; //!< Used for computing tint
50
 
 
51
49
//! @return tinted value for @a color
52
50
//! Alpha value is left unchanged.
53
51
/*! @param color to be converted
56
54
*/
57
55
static QColor tintedColor(const QColor& color, qreal tint)
58
56
{
 
57
    const int HLSMAX = 255; // Used for computing tint
59
58
//kDebug() << "rgb:" << color.name() << "tint:" << tint;
60
59
    if (tint == 0.0 || !color.isValid()) {
61
60
        return color;
76
75
//kDebug() << "rgb:" << r << g << b << QColor(r, g, b, color.alpha()).name();
77
76
    return QColor(r, g, b, color.alpha());
78
77
}
 
78
#if 0
 
79
static QColor tintedColor( const QColor & color, qreal tintfactor )
 
80
{
 
81
    QColor retColor;
 
82
    const qreal  nonTindedPart = 1.0 - tintfactor;
 
83
    const int tintedColor = 255 * nonTindedPart;
 
84
    retColor.setRed( tintedColor + tintfactor * color.red() );
 
85
    retColor.setGreen( tintedColor + tintfactor * color.green() );
 
86
    retColor.setBlue( tintedColor + tintfactor * color.blue() );
 
87
    return retColor;
 
88
}
 
89
#endif
79
90
 
80
91
/*! @return color decoded from a "rgb" attribute of the current element
81
92
            or invalid QColor when reading was not possible.
107
118
 
108
119
//----------------------------------------------------------
109
120
 
 
121
// This is default array of colors from MS
 
122
const char* INDEXED_ARRAY[64] = {
 
123
    "000000", "FFFFFF", "FF0000", "00FF00", "0000FF",
 
124
    "FFFF00", "FF00FF", "00FFFF", "000000", "FFFFFF",
 
125
    "FF0000", "00FF00", "0000FF", "FFFF00", "FF00FF",
 
126
    "00FFFF", "800000", "008000", "000080", "808000",
 
127
    "800080", "008080", "C0C0C0", "808080", "9999FF",
 
128
    "993366", "FFFFCC", "CCFFFF", "660066", "FF8080",
 
129
    "0066CC", "CCCCFF", "000080", "FF00FF", "FFFF00",
 
130
    "00FFFF", "800080", "800000", "008080", "0000FF",
 
131
    "00CCFF", "CCFFFF", "CCFFCC", "FFFF99", "99CCFF",
 
132
    "FF99CC", "CC99FF", "FFCC99", "3366FF", "33CCCC",
 
133
    "99CC00", "FFCC00", "FF9900", "FF6600", "666699",
 
134
    "969696", "003366", "339966", "003300", "333300",
 
135
    "993300", "993366", "333399", "333333"
 
136
};
 
137
 
110
138
XlsxColorStyle::XlsxColorStyle()
111
139
{
112
140
    clear();
120
148
    theme = -1;
121
149
}
122
150
 
123
 
bool XlsxColorStyle::isValid(const QMap<QString, MSOOXML::DrawingMLTheme*> *themes) const
 
151
bool XlsxColorStyle::isValid(const /*QMap<QString, */MSOOXML::DrawingMLTheme/**>*/ *themes) const
124
152
{
125
153
kDebug() << "indexed:" << indexed << "rgb:" << rgb.name() << "tint:" << tint << "theme:" << theme;
126
154
    if (theme >= 0) {
130
158
    return rgb.isValid();
131
159
}
132
160
 
133
 
QColor XlsxColorStyle::themeColor(const QMap<QString, MSOOXML::DrawingMLTheme*> *themes) const
 
161
QColor XlsxColorStyle::themeColor(const/* QMap<QString,*/ MSOOXML::DrawingMLTheme*/*> **/themes) const
134
162
{
135
163
    Q_ASSERT(themes);
136
164
//! @todo find proper theme, not just any
137
 
    MSOOXML::DrawingMLTheme *themeObject = themes->constBegin().value();
 
165
    const MSOOXML::DrawingMLTheme *themeObject = themes;
138
166
kDebug() << themeObject;
139
167
    if (themeObject) {
140
168
        MSOOXML::DrawingMLColorSchemeItemBase *colorItemBase = themeObject->colorScheme.value(theme);
148
176
    return QColor();
149
177
}
150
178
 
151
 
QColor XlsxColorStyle::value(const QMap<QString, MSOOXML::DrawingMLTheme*> *themes) const
 
179
QColor XlsxColorStyle::value(const MSOOXML::DrawingMLTheme *themes) const
152
180
{
153
181
    QColor realColor;
154
182
kDebug() << "theme:" << theme;
161
189
kDebug() << "rgb found:" << realColor.name();
162
190
    }
163
191
 
164
 
    //themes->value(theme);
165
192
    return tintedColor(realColor, tint);
166
193
}
167
194
 
172
199
    QString indexedStr;
173
200
    TRY_READ_ATTR_WITHOUT_NS_INTO(indexed, indexedStr)
174
201
    STRING_TO_INT(indexedStr, indexed, QLatin1String(debugElement) + "@indexed")
175
 
//! @todo handle indexed
176
 
    rgb = readRgbAttribute(attrs);
 
202
    if (indexed >= 0 && indexed < 64) {
 
203
        rgb = QString("#%1").arg(INDEXED_ARRAY[indexed]);
 
204
    }
 
205
    else {
 
206
        rgb = readRgbAttribute(attrs);
 
207
    }
177
208
    tint = readTintAttribute(attrs, debugElement);
178
209
    QString themeStr;
179
210
    TRY_READ_ATTR_WITHOUT_NS_INTO(theme, themeStr)
209
240
{
210
241
}
211
242
 
212
 
QString XlsxBorderStyle::setupCellStyle(const QMap<QString, MSOOXML::DrawingMLTheme*> *themes) const
 
243
QString XlsxBorderStyle::setupCellStyle(const /*QMap<QString, */MSOOXML::DrawingMLTheme/**>*/ *themes) const
213
244
{
214
245
    QString styleString = this->style;
215
246
 
256
287
{
257
288
}
258
289
 
259
 
void XlsxBorderStyles::setupCellStyle(KoGenStyle* cellStyle, const QMap<QString, MSOOXML::DrawingMLTheme*> *themes) const
 
290
void XlsxBorderStyles::setupCellStyle(KoGenStyle* cellStyle, const /*QMap<QString,*/ MSOOXML::DrawingMLTheme/**>*/ *themes) const
260
291
{
261
292
//! @todo simplify if 2 or 4 sides are the same
262
293
    QString s;
283
314
    }
284
315
}
285
316
 
286
 
static QColor applyPatternDensity( const XlsxColorStyle& bg, const XlsxColorStyle& fg, qreal percent, const QMap<QString, MSOOXML::DrawingMLTheme*> *themes )
 
317
static QColor applyPatternDensity( const XlsxColorStyle& bg, const XlsxColorStyle& fg, qreal percent, const /*QMap<QString, */MSOOXML::DrawingMLTheme/**>*/ *themes )
287
318
{
288
319
    const QColor bgColor = bg.theme >= 0 ? bg.themeColor( themes ) : bg.rgb.isValid() ? bg.rgb : QColor( Qt::white );
289
320
    const QColor fgColor = fg.theme >= 0 ? fg.themeColor( themes ) : fg.rgb;//.isValid() ? fg.rgb : QColor( Qt::black );
290
 
    
 
321
 
291
322
    QColor result( Qt::white );
292
323
    if( bgColor.isValid() ) {
293
 
        result = QColor( bgColor.red() * percent, 
294
 
                         bgColor.green() * percent, 
295
 
                         bgColor.blue() * percent, 
 
324
        result = QColor( bgColor.red() * percent,
 
325
                         bgColor.green() * percent,
 
326
                         bgColor.blue() * percent,
296
327
                         bgColor.alpha() );
297
328
    }
298
329
    if( fgColor.isValid() ) {
299
 
        result = QColor( result.red()   + fgColor.red() * ( 1.0 - percent ), 
300
 
                         result.green() + fgColor.green() * ( 1.0 - percent ), 
 
330
        result = QColor( result.red()   + fgColor.red() * ( 1.0 - percent ),
 
331
                         result.green() + fgColor.green() * ( 1.0 - percent ),
301
332
                         result.blue()  + fgColor.blue() * ( 1.0 - percent ),
302
333
                         bgColor.isValid() ? bgColor.alpha() : fgColor.alpha() );
303
334
    }
304
335
    return result;
305
336
}
306
337
 
307
 
const XlsxColorStyle* XlsxFillStyle::realBackgroundColor( const QMap<QString, MSOOXML::DrawingMLTheme*> *themes) const
 
338
const XlsxColorStyle* XlsxFillStyle::realBackgroundColor( const /*QMap<QString,*/ MSOOXML::DrawingMLTheme/**>*/ *themes) const
308
339
{
309
340
    delete cachedRealBackgroundColor;
310
341
    cachedRealBackgroundColor = new XlsxColorStyle;
364
395
    return &bgColor;
365
396
}
366
397
 
367
 
void XlsxFillStyle::setupCellStyle(KoGenStyle* cellStyle, const QMap<QString, MSOOXML::DrawingMLTheme*> *themes) const
 
398
void XlsxFillStyle::setupCellStyle(KoGenStyle* cellStyle, const /*QMap<QString, */MSOOXML::DrawingMLTheme/**>*/ *themes) const
368
399
{
369
400
//! @todo implement more styling;
370
401
//!       use XlsxColorStyle::automatic, XlsxColorStyle::indexed, XlsxColorStyle::theme...
371
402
    const XlsxColorStyle* realBackgroundColor = this->realBackgroundColor( themes );
372
 
    if (realBackgroundColor) {
373
 
kDebug() << patternType << realBackgroundColor->value(themes).name()
374
 
         << realBackgroundColor->tint << realBackgroundColor->isValid(themes);
375
 
        if (realBackgroundColor->isValid(themes)) {
376
 
            cellStyle->addProperty("fo:background-color", realBackgroundColor->value(themes).name());
 
403
    if ( realBackgroundColor )
 
404
    {
 
405
        // This is necessary because excel switches the indexes of 0 - 1 and 2 - 3 for theme colorindexes
 
406
        // looks like it has a different internal indexing table
 
407
        // i found the info here : http://blogs.msdn.com/b/excel/archive/2007/11/16/chart-pattern-fills.aspx
 
408
        // and verified it
 
409
        XlsxColorStyle changedColor( *realBackgroundColor );
 
410
        if ( changedColor.theme == 0 )
 
411
            changedColor.theme = 1;
 
412
        else if ( changedColor.theme == 1 )
 
413
            changedColor.theme = 0;
 
414
        else if ( changedColor.theme == 2 )
 
415
            changedColor.theme = 3;
 
416
        else if ( changedColor.theme == 3 )
 
417
            changedColor.theme = 2;
 
418
        kDebug() << patternType << changedColor.value(themes).name()
 
419
                << changedColor.tint << changedColor.isValid(themes);
 
420
        if (changedColor.isValid(themes)) {
 
421
            cellStyle->addProperty("fo:background-color", changedColor.value(themes).name());
377
422
        }
378
423
    }
379
424
}
499
544
}
500
545
 
501
546
void XlsxFontStyle::setupCellTextStyle(
502
 
    const QMap<QString, MSOOXML::DrawingMLTheme*> *themes,
 
547
    const /*QMap<QString,*/ MSOOXML::DrawingMLTheme/**>*/ *themes,
503
548
    KoGenStyle* cellStyle) const
504
549
{
505
550
    if (!name.isEmpty()) {
509
554
//!@ todo reenable this        cellStyle->addProperty("style:font-name", name, KoGenStyle::TextType);
510
555
        cellStyle->addProperty("fo:font-family", name, KoGenStyle::TextType);
511
556
    }
512
 
    if (color.isValid(themes)) {
513
 
        const QColor c(color.value(themes));
 
557
    // This is necessary because excel switches the indexes of 0 - 1 and 2 - 3 for theme colorindexes
 
558
    // looks like it has a different internal indexing table
 
559
    // i found the info here : http://blogs.msdn.com/b/excel/archive/2007/11/16/chart-pattern-fills.aspx
 
560
    // and verified it
 
561
    XlsxColorStyle changedColor( color );
 
562
    if ( changedColor.theme == 0 )
 
563
        changedColor.theme = 1;
 
564
    else if ( changedColor.theme == 1 )
 
565
        changedColor.theme = 0;
 
566
    else if ( changedColor.theme == 2 )
 
567
        changedColor.theme = 3;
 
568
    else if ( changedColor.theme == 3 )
 
569
        changedColor.theme = 2;
 
570
    else if (changedColor.isValid(themes)) {
 
571
        const QColor c(changedColor.value(themes));
514
572
        cellStyle->addProperty("fo:color", c.name(), KoGenStyle::TextType);
515
573
    }
516
574
    //! @todo implement more styling
649
707
    if (verticalTtb)
650
708
        cellStyle->addProperty("style:direction", "ttb");
651
709
    else if (textRotation != 0) {
652
 
        //@todo map other cases (to style:text-rotate-angle? that one only allows 0, 90, 270)
 
710
        unsigned angle = textRotation;
 
711
        if (angle > 90) angle = 360 - (angle - 90);
 
712
        cellStyle->addProperty("style:rotation-angle", QString::number(angle));
653
713
    }
654
714
 
655
715
    if (shrinkToFit)
666
726
    case GeneralHorizontalAlignment: // ok?
667
727
        if (verticalTtb) // Excel centers vertical text by default, so mimic that
668
728
            cellStyle->addProperty("fo:text-align", "center", KoGenStyle::ParagraphType);
 
729
        if (textRotation > 90 && textRotation < 180) // Excel right aligns rotated text for some angles
 
730
            cellStyle->addProperty("fo:text-align", "end", KoGenStyle::ParagraphType);
669
731
        break;
670
732
    case LeftHorizontalAlignment:
671
733
        cellStyle->addProperty("fo:text-align", "start", KoGenStyle::ParagraphType);
675
737
        break;
676
738
    case JustifyHorizontalAlignment:
677
739
        cellStyle->addProperty("fo:text-align", "justify", KoGenStyle::ParagraphType);
 
740
        wrapOption = 1;
678
741
        break;
679
742
    case FillHorizontalAlignment:
680
743
    default:;
687
750
    case TopVerticalAlignment:
688
751
        cellStyle->addProperty("style:vertical-align", "top");
689
752
        break;
690
 
    case NoVerticalAlignment:
691
 
    case JustifyVerticalAlignment: // ok?        
 
753
    case JustifyVerticalAlignment: // ok?
692
754
    case DistributedVerticalAlignment:
693
755
        cellStyle->addProperty("style:vertical-align", "top");
694
756
        cellStyle->addProperty("koffice:vertical-distributed", "distributed");
695
757
        wrapOption = 1;
696
758
        break;
 
759
    case NoVerticalAlignment:
697
760
    case BottomVerticalAlignment:
 
761
        cellStyle->addProperty("style:vertical-align", "bottom");
 
762
        break;
698
763
    default:;
699
764
    }
700
765
 
705
770
//! See http://www.w3.org/TR/2001/REC-xsl-20011015/slice7.html#text-align
706
771
bool XlsxCellFormat::setupCellStyle(
707
772
    const XlsxStyles *styles,
708
 
    const QMap<QString, MSOOXML::DrawingMLTheme*> *themes,
 
773
    const /*QMap<QString, */MSOOXML::DrawingMLTheme/**>*/ *themes,
709
774
    KoGenStyle* cellStyle) const
710
775
{
711
776
    kDebug() << "fontId:" << fontId << "fillId:" << fillId << "borderId:" << borderId;
856
921
    while (!atEnd()) {
857
922
        readNext();
858
923
        kDebug() << *this;
 
924
        BREAK_IF_END_OF(CURRENT_EL);
859
925
        if (isStartElement()) {
860
926
            TRY_READ_IF(fonts)
861
927
            ELSE_TRY_READ_IF(fills)
864
930
            ELSE_TRY_READ_IF(borders)
865
931
//! @todo add ELSE_WRONG_FORMAT
866
932
        }
867
 
        BREAK_IF_END_OF(CURRENT_EL);
868
933
    }
869
934
    READ_EPILOGUE
870
935
}
896
961
    while (!atEnd()) {
897
962
        readNext();
898
963
        kDebug() << *this;
 
964
        BREAK_IF_END_OF(CURRENT_EL);
899
965
        if (isStartElement()) {
900
966
            TRY_READ_IF(font)
901
967
            ELSE_WRONG_FORMAT
902
968
        }
903
 
        BREAK_IF_END_OF(CURRENT_EL);
904
969
    }
905
970
    READ_EPILOGUE
906
971
}
929
994
    while( !atEnd() )
930
995
    {
931
996
        readNext();
 
997
        BREAK_IF_END_OF(CURRENT_EL);
932
998
        if( isStartElement() )
933
999
        {
934
1000
            TRY_READ_IF( numFmt )
935
1001
            ELSE_WRONG_FORMAT
936
1002
        }
937
 
        BREAK_IF_END_OF( CURRENT_EL )
938
1003
    }
939
1004
 
940
1005
    READ_EPILOGUE
948
1013
 the numeric value of a cell.
949
1014
 
950
1015
 No child elements.
951
 
 
 
1016
 
952
1017
 Parent elements:
953
1018
 - dxf (§18.8.14)
954
1019
 - ndxf (§18.11.1.4)
971
1036
 
972
1037
    while( true )
973
1038
    {
 
1039
        readNext();
974
1040
        BREAK_IF_END_OF( CURRENT_EL );
975
 
        readNext();
976
1041
    }
977
1042
 
978
1043
    READ_EPILOGUE
1024
1089
    while (!atEnd()) {
1025
1090
        readNext();
1026
1091
        kDebug() << *this;
 
1092
        BREAK_IF_END_OF(CURRENT_EL);
1027
1093
        if (isStartElement()) {
1028
1094
            TRY_READ_IF(sz)
1029
1095
            ELSE_TRY_READ_IF(name)
1039
1105
            ELSE_TRY_READ_IF(vertAlign)
1040
1106
//! @todo add ELSE_WRONG_FORMAT
1041
1107
        }
1042
 
        BREAK_IF_END_OF(CURRENT_EL);
1043
1108
    }
1044
1109
 
1045
1110
    READ_EPILOGUE_WITHOUT_RETURN
1080
1145
    }
1081
1146
 
1082
1147
    while (true) {
 
1148
        readNext();
1083
1149
        BREAK_IF_END_OF(CURRENT_EL);
1084
 
        readNext();
1085
1150
    }
1086
1151
    READ_EPILOGUE
1087
1152
}
1105
1170
    m_currentFontStyle->vertAlign = ST_VerticalAlignRun( val );
1106
1171
 
1107
1172
    while (true) {
 
1173
        readNext();
1108
1174
        BREAK_IF_END_OF(CURRENT_EL);
1109
 
        readNext();
1110
1175
    }
1111
1176
    READ_EPILOGUE
1112
1177
}
1129
1194
    TRY_READ_ATTR_WITHOUT_NS_INTO(val, m_currentFontStyle->name)
1130
1195
 
1131
1196
    while (true) {
 
1197
        readNext();
1132
1198
        BREAK_IF_END_OF(CURRENT_EL);
1133
 
        readNext();
1134
1199
    }
1135
1200
    READ_EPILOGUE
1136
1201
}
1155
1220
    m_currentFontStyle->bold = readBooleanAttr("val", true);
1156
1221
 
1157
1222
    while (true) {
 
1223
        readNext();
1158
1224
        BREAK_IF_END_OF(CURRENT_EL);
1159
 
        readNext();
1160
1225
    }
1161
1226
    READ_EPILOGUE
1162
1227
}
1181
1246
    m_currentFontStyle->italic = readBooleanAttr("val", true);
1182
1247
 
1183
1248
    while (true) {
 
1249
        readNext();
1184
1250
        BREAK_IF_END_OF(CURRENT_EL);
1185
 
        readNext();
1186
1251
    }
1187
1252
    READ_EPILOGUE
1188
1253
}
1207
1272
    m_currentFontStyle->strike = readBooleanAttr("val", true);
1208
1273
 
1209
1274
    while (true) {
 
1275
        readNext();
1210
1276
        BREAK_IF_END_OF(CURRENT_EL);
1211
 
        readNext();
1212
1277
    }
1213
1278
    READ_EPILOGUE
1214
1279
}
1233
1298
    m_currentFontStyle->setUnderline(attrs.value("val").toString());
1234
1299
 
1235
1300
    while (true) {
 
1301
        readNext();
1236
1302
        BREAK_IF_END_OF(CURRENT_EL);
1237
 
        readNext();
1238
1303
    }
1239
1304
    READ_EPILOGUE
1240
1305
}
1276
1341
    RETURN_IF_ERROR( m_currentColorStyle->readAttributes(attrs, "color") )
1277
1342
 
1278
1343
    while (true) {
 
1344
        readNext();
1279
1345
        BREAK_IF_END_OF(CURRENT_EL);
1280
 
        readNext();
1281
1346
    }
1282
1347
    READ_EPILOGUE
1283
1348
}
1315
1380
    while (!atEnd()) {
1316
1381
        readNext();
1317
1382
        kDebug() << *this;
 
1383
        BREAK_IF_END_OF(CURRENT_EL);
1318
1384
        if (isStartElement()) {
1319
1385
            TRY_READ_IF(xf)
1320
1386
            ELSE_WRONG_FORMAT
1321
1387
        }
1322
 
        BREAK_IF_END_OF(CURRENT_EL);
1323
1388
    }
1324
1389
    READ_EPILOGUE
1325
1390
}
1398
1463
    while (!atEnd()) {
1399
1464
        readNext();
1400
1465
        kDebug() << *this;
 
1466
        BREAK_IF_END_OF(CURRENT_EL);
1401
1467
        if (isStartElement()) {
1402
1468
            TRY_READ_IF(alignment)
1403
1469
//! @todo add ELSE_WRONG_FORMAT
1404
1470
        }
1405
 
        BREAK_IF_END_OF(CURRENT_EL);
1406
1471
    }
1407
1472
 
1408
1473
    READ_EPILOGUE_WITHOUT_RETURN
1448
1513
//! @todo more attributes
1449
1514
 
1450
1515
    while (true) {
 
1516
        readNext();
1451
1517
        BREAK_IF_END_OF(CURRENT_EL);
1452
 
        readNext();
1453
1518
    }
1454
1519
    READ_EPILOGUE
1455
1520
}
1482
1547
    while (!atEnd()) {
1483
1548
        readNext();
1484
1549
        kDebug() << *this;
 
1550
        BREAK_IF_END_OF(CURRENT_EL);
1485
1551
        if (isStartElement()) {
1486
1552
            TRY_READ_IF(fill)
1487
1553
            ELSE_WRONG_FORMAT
1488
1554
        }
1489
 
        BREAK_IF_END_OF(CURRENT_EL);
1490
1555
    }
1491
1556
    READ_EPILOGUE
1492
1557
}
1521
1586
 
1522
1587
    while (!atEnd()) {
1523
1588
        readNext();
 
1589
        BREAK_IF_END_OF(CURRENT_EL);
1524
1590
        if (isStartElement()) {
1525
1591
            TRY_READ_IF(gradientFill)
1526
1592
            ELSE_TRY_READ_IF(patternFill)
1527
1593
            ELSE_WRONG_FORMAT
1528
1594
        }
1529
 
        BREAK_IF_END_OF(CURRENT_EL);
1530
1595
    }
1531
1596
    READ_EPILOGUE_WITHOUT_RETURN
1532
1597
 
1636
1701
 
1637
1702
    while (!atEnd()) {
1638
1703
        readNext();
 
1704
        BREAK_IF_END_OF(CURRENT_EL);
1639
1705
        if (isStartElement()) {
1640
1706
            TRY_READ_IF(bgColor)
1641
1707
            ELSE_TRY_READ_IF(fgColor)
1642
1708
            ELSE_WRONG_FORMAT
1643
1709
        }
1644
 
        BREAK_IF_END_OF(CURRENT_EL);
1645
1710
    }
1646
1711
    READ_EPILOGUE
1647
1712
}
1667
1732
    const QXmlStreamAttributes attrs(attributes());
1668
1733
    RETURN_IF_ERROR( m_currentFillStyle->bgColor.readAttributes(attrs, "bgColor") )
1669
1734
 
1670
 
    while (true) {
1671
 
        BREAK_IF_END_OF(CURRENT_EL);
1672
 
        readNext();
1673
 
    }
 
1735
    readNext();
1674
1736
    READ_EPILOGUE
1675
1737
}
1676
1738
 
1695
1757
    const QXmlStreamAttributes attrs(attributes());
1696
1758
    RETURN_IF_ERROR( m_currentFillStyle->fgColor.readAttributes(attrs, "fgColor") )
1697
1759
 
1698
 
    while (true) {
1699
 
        BREAK_IF_END_OF(CURRENT_EL);
1700
 
        readNext();
1701
 
    }
 
1760
    readNext();
1702
1761
    READ_EPILOGUE
1703
1762
}
1704
1763
 
1725
1784
 
1726
1785
    while (!atEnd()) {
1727
1786
        readNext();
 
1787
        BREAK_IF_END_OF(CURRENT_EL);
1728
1788
        if (isStartElement()) {
1729
1789
//! @todo            TRY_READ_IF(stop)
1730
1790
//todo            ELSE_WRONG_FORMAT
1731
1791
        }
1732
 
        BREAK_IF_END_OF(CURRENT_EL);
1733
1792
    }
1734
1793
    READ_EPILOGUE
1735
1794
}
1753
1812
 
1754
1813
    while (!atEnd()) {
1755
1814
        readNext();
 
1815
        BREAK_IF_END_OF(CURRENT_EL);
1756
1816
        if (isStartElement()) {
1757
1817
            TRY_READ_IF(border)
1758
1818
//todo            ELSE_WRONG_FORMAT
1759
1819
        }
1760
 
        BREAK_IF_END_OF(CURRENT_EL);
1761
1820
    }
1762
1821
    READ_EPILOGUE
1763
1822
}
1787
1846
 
1788
1847
    while (!atEnd()) {
1789
1848
        readNext();
 
1849
        BREAK_IF_END_OF(CURRENT_EL);
1790
1850
        if (isStartElement()) {
1791
1851
            TRY_READ_IF(bottom)
1792
1852
            ELSE_TRY_READ_IF(diagonal)
1799
1859
//! @todo (dxf only)            ELSE_TRY_READ_IF(vertical)
1800
1860
//todo            ELSE_WRONG_FORMAT
1801
1861
        }
1802
 
        BREAK_IF_END_OF(CURRENT_EL);
1803
1862
    }
1804
1863
 
1805
1864
    currentBorderStyleSetter.release();
1822
1881
 
1823
1882
    while (!atEnd()) {
1824
1883
        readNext();
 
1884
        BREAK_IF_END_OF(CURRENT_EL);
1825
1885
        if (isStartElement()) {
1826
1886
            if (QUALIFIED_NAME_IS(color)) {
1827
1887
                m_currentColorStyle = &m_currentBorderStyle->bottom.color;
1830
1890
            }
1831
1891
            ELSE_WRONG_FORMAT
1832
1892
        }
1833
 
        BREAK_IF_END_OF(CURRENT_EL);
1834
1893
    }
1835
1894
    READ_EPILOGUE
1836
1895
}
1847
1906
 
1848
1907
    while (!atEnd()) {
1849
1908
        readNext();
 
1909
        BREAK_IF_END_OF(CURRENT_EL);
1850
1910
        if (isStartElement()) {
1851
1911
            if (QUALIFIED_NAME_IS(color)) {
1852
1912
                m_currentColorStyle = &m_currentBorderStyle->top.color;
1855
1915
            }
1856
1916
            ELSE_WRONG_FORMAT
1857
1917
        }
1858
 
        BREAK_IF_END_OF(CURRENT_EL);
1859
1918
    }
1860
1919
    READ_EPILOGUE
1861
1920
}
1871
1930
 
1872
1931
    while (!atEnd()) {
1873
1932
        readNext();
 
1933
        BREAK_IF_END_OF(CURRENT_EL);
1874
1934
        if (isStartElement()) {
1875
1935
            if (QUALIFIED_NAME_IS(color)) {
1876
1936
                m_currentColorStyle = &m_currentBorderStyle->left.color;
1879
1939
            }
1880
1940
            ELSE_WRONG_FORMAT
1881
1941
        }
1882
 
        BREAK_IF_END_OF(CURRENT_EL);
1883
1942
    }
1884
1943
    READ_EPILOGUE
1885
1944
}
1895
1954
 
1896
1955
    while (!atEnd()) {
1897
1956
        readNext();
 
1957
        BREAK_IF_END_OF(CURRENT_EL);
1898
1958
        if (isStartElement()) {
1899
1959
            if (QUALIFIED_NAME_IS(color)) {
1900
1960
                m_currentColorStyle = &m_currentBorderStyle->right.color;
1903
1963
            }
1904
1964
            ELSE_WRONG_FORMAT
1905
1965
        }
1906
 
        BREAK_IF_END_OF(CURRENT_EL);
1907
1966
    }
1908
1967
    READ_EPILOGUE
1909
1968
}
1919
1978
 
1920
1979
    while (!atEnd()) {
1921
1980
        readNext();
 
1981
        BREAK_IF_END_OF(CURRENT_EL);
1922
1982
        if (isStartElement()) {
1923
1983
            if (QUALIFIED_NAME_IS(color)) {
1924
1984
                m_currentColorStyle = &m_currentBorderStyle->diagonal.color;
1927
1987
            }
1928
1988
            ELSE_WRONG_FORMAT
1929
1989
        }
1930
 
        BREAK_IF_END_OF(CURRENT_EL);
1931
1990
    }
1932
1991
    READ_EPILOGUE
1933
1992
}