Warning, file /office/calligra/filters/libmsooxml/MsooXmlDrawingTableStyleReader.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2010 Carlos Licea <carlos@kdab.com>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Library General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2 of the License, or (at your option) any later version.
0008  *
0009  * This library is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  * Library General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Library General Public License
0015  * along with this library; see the file COPYING.LIB.  If not, write to
0016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018  */
0019 
0020 #include "MsooXmlDrawingTableStyleReader.h"
0021 #include "MsooXmlTheme.h"
0022 
0023 
0024 #include <KoGenStyles.h>
0025 #include <KoGenStyle.h>
0026 #include <KoOdfGraphicStyles.h>
0027 
0028 #define MSOOXML_CURRENT_NS "a"
0029 #define MSOOXML_CURRENT_CLASS MsooXmlDrawingTableStyleReader
0030 
0031 #include <MsooXmlReader_p.h>
0032 #include <MsooXmlUtils.h>
0033 #include <MsooXmlRelationships.h>
0034 #include <MsooXmlImport.h>
0035 #include <MsooXmlUnits.h>
0036 
0037 #include <QString>
0038 
0039 using namespace MSOOXML;
0040 
0041 MsooXmlDrawingTableStyleReader::MsooXmlDrawingTableStyleReader(KoOdfWriters* writers)
0042 : MsooXmlCommonReader(writers)
0043 , m_context(0)
0044 , m_currentStyle(0)
0045 , m_currentTableStyleProperties()
0046 {
0047 }
0048 
0049 MsooXmlDrawingTableStyleReader::~MsooXmlDrawingTableStyleReader()
0050 {
0051 }
0052 
0053 MsooXmlDrawingTableStyleContext::MsooXmlDrawingTableStyleContext(MsooXmlImport* _import, const QString& _path, const QString& _file, DrawingMLTheme* _themes, QMap< QString, DrawingTableStyle* >* _styleList, QMap< QString, QString > _colorMap)
0054 : styleList(_styleList)
0055 , import(_import)
0056 , path(_path)
0057 , file(_file)
0058 , themes(_themes)
0059 , colorMap(_colorMap)
0060 {
0061 }
0062 
0063 MsooXmlDrawingTableStyleContext::~MsooXmlDrawingTableStyleContext()
0064 {
0065 }
0066 
0067 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read(MsooXmlReaderContext* context)
0068 {
0069     m_context = dynamic_cast<MsooXmlDrawingTableStyleContext*>(context);
0070     Q_ASSERT(m_context);
0071 
0072     readNext();
0073     if (!isStartDocument()) {
0074         return KoFilter::WrongFormat;
0075     }
0076 
0077     readNext();
0078     KoFilter::ConversionStatus result = read_tblStyleLst();
0079     Q_ASSERT(result == KoFilter::OK);
0080 
0081     return result;
0082 }
0083 
0084 #undef CURRENT_EL
0085 #define CURRENT_EL tblStyleLst
0086 /*
0087  Parent elements:
0088  - [done] root
0089 
0090  Child elements:
0091  - [done] tblStyle (Table Style) §20.1.4.2.26
0092 
0093 */
0094 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_tblStyleLst()
0095 {
0096     READ_PROLOGUE
0097 
0098     while (!atEnd()) {
0099         readNext();
0100         BREAK_IF_END_OF(CURRENT_EL)
0101         if (isStartElement()) {
0102             TRY_READ_IF(tblStyle)
0103             ELSE_WRONG_FORMAT
0104         }
0105     }
0106 
0107     READ_EPILOGUE
0108 }
0109 
0110 #undef CURRENT_EL
0111 #define CURRENT_EL tblStyle
0112 /*
0113  Parent elements:
0114  - [done] tblStyleLst (§20.1.4.2.27)
0115 
0116  Child elements:
0117  - [done] band1H (Band 1 Horizontal) §20.1.4.2.1
0118  - [done] band1V (Band 1 Vertical) §20.1.4.2.2
0119  - [done] band2H (Band 2 Horizontal) §20.1.4.2.3
0120  - [done] band2V (Band 2 Vertical) §20.1.4.2.4
0121  - extLst (Extension List) §20.1.2.2.15
0122  - [done] firstCol (First Column) §20.1.4.2.11
0123  - [done] firstRow (First Row) §20.1.4.2.12
0124  - [done] lastCol (Last Column) §20.1.4.2.16
0125  - [done] lastRow (Last Row) §20.1.4.2.17
0126  - [done] neCell (Northeast Cell) §20.1.4.2.20
0127  - [done] nwCell (Northwest Cell) §20.1.4.2.21
0128  - [done] seCell (Southeast Cell) §20.1.4.2.23
0129  - [done] swCell (Southwest Cell) §20.1.4.2.24
0130  - [done] tblBg (Table Background) §20.1.4.2.25
0131  - [done] wholeTbl (Whole Table) §20.1.4.2.34
0132 */
0133 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_tblStyle()
0134 {
0135     READ_PROLOGUE
0136     m_currentStyle = new DrawingTableStyle;
0137 
0138     QXmlStreamAttributes attrs(attributes());
0139     READ_ATTR_WITHOUT_NS(styleId)
0140     while(!atEnd()) {
0141         readNext();
0142         BREAK_IF_END_OF(CURRENT_EL)
0143         if(isStartElement()) {
0144             TRY_READ_IF(band1H)
0145             ELSE_TRY_READ_IF(band1V)
0146             ELSE_TRY_READ_IF(band2H)
0147             ELSE_TRY_READ_IF(band2V)
0148 //             ELSE_TRY_READ_IF(extLst)
0149             ELSE_TRY_READ_IF(firstCol)
0150             ELSE_TRY_READ_IF(firstRow)
0151             ELSE_TRY_READ_IF(lastCol)
0152             ELSE_TRY_READ_IF(lastRow)
0153             ELSE_TRY_READ_IF(neCell)
0154             ELSE_TRY_READ_IF(nwCell)
0155             ELSE_TRY_READ_IF(seCell)
0156             ELSE_TRY_READ_IF(swCell)
0157             ELSE_TRY_READ_IF(tblBg)
0158             ELSE_TRY_READ_IF(wholeTbl)
0159             SKIP_UNKNOWN
0160 //             ELSE_WRONG_FORMAT
0161         }
0162     }
0163 
0164     m_context->styleList->insert(styleId, m_currentStyle);
0165 
0166     READ_EPILOGUE
0167 }
0168 
0169 #undef CURRENT_EL
0170 #define CURRENT_EL tblBg
0171 /*
0172  Parent elements:
0173  - tableStyle (§21.1.3.11);
0174  - [done] tblStyle (§20.1.4.2.26)
0175 
0176  Child elements:
0177  - effect (Effect) §20.1.4.2.7
0178  - effectRef (Effect Reference) §20.1.4.2.8
0179  - [done] fill (Fill) §20.1.4.2.9
0180  - [done] fillRef (Fill Reference) §20.1.4.2.10
0181 
0182 */
0183 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_tblBg()
0184 {
0185     READ_PROLOGUE
0186 
0187     m_currentTableStyleProperties = m_currentStyle->properties(DrawingTableStyle::WholeTbl);
0188     if (m_currentTableStyleProperties == 0) {
0189         m_currentTableStyleProperties = new TableStyleProperties;
0190     }
0191 
0192     pushCurrentDrawStyle(new KoGenStyle(KoGenStyle::GraphicAutoStyle, "graphic"));
0193 
0194     while(!atEnd()) {
0195         readNext();
0196         BREAK_IF_END_OF(CURRENT_EL)
0197         if(isStartElement()) {
0198             TRY_READ_IF(fill)
0199             else if (name() == "fillRef") {
0200                 // NOTE: This is a heavy simplification for the moment
0201                 // In reality we should use graphic properties in the cell-style
0202                 // but it is not supported atm.
0203                 TRY_READ(fillRef)
0204                 if (m_currentColor.isValid()) {
0205                     m_currentTableStyleProperties->backgroundColor = m_currentColor;
0206                     m_currentTableStyleProperties->setProperties |= TableStyleProperties::BackgroundColor;
0207                 }
0208             }
0209             SKIP_UNKNOWN
0210         }
0211     }
0212 
0213     // What should happen if tblBg defines a picture, is it meant for call cells separately or one picture
0214     // divided between the cells?
0215     m_currentStyle->addProperties(DrawingTableStyle::WholeTbl, m_currentTableStyleProperties);
0216 
0217     popCurrentDrawStyle();
0218 
0219     READ_EPILOGUE
0220 }
0221 
0222 #undef CURRENT_EL
0223 #define CURRENT_EL band1H
0224 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_band1H()
0225 {
0226     READ_PROLOGUE
0227 
0228     m_currentTableStyleProperties = new TableStyleProperties;
0229 
0230     while(!atEnd()) {
0231         readNext();
0232         BREAK_IF_END_OF(CURRENT_EL)
0233         if(isStartElement()) {
0234             TRY_READ_IF(tcStyle)
0235             ELSE_TRY_READ_IF(tcTxStyle)
0236             ELSE_WRONG_FORMAT
0237         }
0238     }
0239 
0240     m_currentStyle->addProperties(DrawingTableStyle::Band1Horizontal, m_currentTableStyleProperties);
0241 
0242     READ_EPILOGUE
0243 }
0244 
0245 #undef CURRENT_EL
0246 #define CURRENT_EL band1V
0247 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_band1V()
0248 {
0249     READ_PROLOGUE
0250 
0251     m_currentTableStyleProperties = new TableStyleProperties;
0252 
0253     while(!atEnd()) {
0254         readNext();
0255         BREAK_IF_END_OF(CURRENT_EL)
0256         if(isStartElement()) {
0257             TRY_READ_IF(tcStyle)
0258             ELSE_TRY_READ_IF(tcTxStyle)
0259             ELSE_WRONG_FORMAT
0260         }
0261     }
0262 
0263     m_currentStyle->addProperties(DrawingTableStyle::Band1Vertical, m_currentTableStyleProperties);
0264 
0265     READ_EPILOGUE
0266 
0267 }
0268 
0269 #undef CURRENT_EL
0270 #define CURRENT_EL band2H
0271 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_band2H()
0272 {
0273     READ_PROLOGUE
0274 
0275     m_currentTableStyleProperties = new TableStyleProperties;
0276 
0277     while(!atEnd()) {
0278         readNext();
0279         BREAK_IF_END_OF(CURRENT_EL)
0280         if(isStartElement()) {
0281             TRY_READ_IF(tcStyle)
0282             ELSE_TRY_READ_IF(tcTxStyle)
0283             ELSE_WRONG_FORMAT
0284         }
0285     }
0286 
0287     m_currentStyle->addProperties(DrawingTableStyle::Band2Horizontal, m_currentTableStyleProperties);
0288 
0289     READ_EPILOGUE
0290 }
0291 
0292 #undef CURRENT_EL
0293 #define CURRENT_EL band2V
0294 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_band2V()
0295 {
0296     READ_PROLOGUE
0297 
0298     m_currentTableStyleProperties = new TableStyleProperties;
0299 
0300     while(!atEnd()) {
0301         readNext();
0302         BREAK_IF_END_OF(CURRENT_EL)
0303         if(isStartElement()) {
0304             TRY_READ_IF(tcStyle)
0305             ELSE_TRY_READ_IF(tcTxStyle)
0306             ELSE_WRONG_FORMAT
0307         }
0308     }
0309 
0310     m_currentStyle->addProperties(DrawingTableStyle::Band2Horizontal, m_currentTableStyleProperties);
0311 
0312     READ_EPILOGUE
0313 }
0314 
0315 #undef CURRENT_EL
0316 #define CURRENT_EL firstCol
0317 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_firstCol()
0318 {
0319     READ_PROLOGUE
0320 
0321     m_currentTableStyleProperties = new TableStyleProperties;
0322 
0323     while(!atEnd()) {
0324         readNext();
0325         BREAK_IF_END_OF(CURRENT_EL)
0326         if(isStartElement()) {
0327             TRY_READ_IF(tcStyle)
0328             ELSE_TRY_READ_IF(tcTxStyle)
0329             ELSE_WRONG_FORMAT
0330         }
0331     }
0332 
0333     m_currentStyle->addProperties(DrawingTableStyle::FirstCol, m_currentTableStyleProperties);
0334 
0335     READ_EPILOGUE
0336 }
0337 
0338 #undef CURRENT_EL
0339 #define CURRENT_EL firstRow
0340 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_firstRow()
0341 {
0342     READ_PROLOGUE
0343 
0344     m_currentTableStyleProperties = new TableStyleProperties;
0345 
0346     while(!atEnd()) {
0347         readNext();
0348         BREAK_IF_END_OF(CURRENT_EL)
0349         if(isStartElement()) {
0350             TRY_READ_IF(tcStyle)
0351             ELSE_TRY_READ_IF(tcTxStyle)
0352             ELSE_WRONG_FORMAT
0353         }
0354     }
0355 
0356     m_currentStyle->addProperties(DrawingTableStyle::FirstRow, m_currentTableStyleProperties);
0357 
0358     READ_EPILOGUE
0359 }
0360 
0361 #undef CURRENT_EL
0362 #define CURRENT_EL lastCol
0363 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_lastCol()
0364 {
0365     READ_PROLOGUE
0366 
0367     m_currentTableStyleProperties = new TableStyleProperties;
0368 
0369     while(!atEnd()) {
0370         readNext();
0371         BREAK_IF_END_OF(CURRENT_EL)
0372         if(isStartElement()) {
0373             TRY_READ_IF(tcStyle)
0374             ELSE_TRY_READ_IF(tcTxStyle)
0375             ELSE_WRONG_FORMAT
0376         }
0377     }
0378 
0379     m_currentStyle->addProperties(DrawingTableStyle::LastCol, m_currentTableStyleProperties);
0380 
0381     READ_EPILOGUE
0382 }
0383 
0384 #undef CURRENT_EL
0385 #define CURRENT_EL lastRow
0386 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_lastRow()
0387 {
0388     READ_PROLOGUE
0389 
0390     m_currentTableStyleProperties = new TableStyleProperties;
0391 
0392     while(!atEnd()) {
0393         readNext();
0394         BREAK_IF_END_OF(CURRENT_EL)
0395         if(isStartElement()) {
0396             TRY_READ_IF(tcStyle)
0397             ELSE_TRY_READ_IF(tcTxStyle)
0398             ELSE_WRONG_FORMAT
0399         }
0400     }
0401 
0402     m_currentStyle->addProperties(DrawingTableStyle::LastRow, m_currentTableStyleProperties);
0403 
0404     READ_EPILOGUE
0405 }
0406 
0407 #undef CURRENT_EL
0408 #define CURRENT_EL neCell
0409 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_neCell()
0410 {
0411     READ_PROLOGUE
0412 
0413     m_currentTableStyleProperties = new TableStyleProperties;
0414 
0415     while(!atEnd()) {
0416         readNext();
0417         BREAK_IF_END_OF(CURRENT_EL)
0418         if(isStartElement()) {
0419             TRY_READ_IF(tcStyle)
0420             ELSE_TRY_READ_IF(tcTxStyle)
0421             ELSE_WRONG_FORMAT
0422         }
0423     }
0424 
0425     m_currentStyle->addProperties(DrawingTableStyle::NeCell, m_currentTableStyleProperties);
0426 
0427     READ_EPILOGUE
0428 }
0429 
0430 #undef CURRENT_EL
0431 #define CURRENT_EL nwCell
0432 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_nwCell()
0433 {
0434     READ_PROLOGUE
0435 
0436     m_currentTableStyleProperties = new TableStyleProperties;
0437 
0438     while(!atEnd()) {
0439         readNext();
0440         BREAK_IF_END_OF(CURRENT_EL)
0441         if(isStartElement()) {
0442             TRY_READ_IF(tcStyle)
0443             ELSE_TRY_READ_IF(tcTxStyle)
0444             ELSE_WRONG_FORMAT
0445         }
0446     }
0447 
0448     m_currentStyle->addProperties(DrawingTableStyle::NwCell, m_currentTableStyleProperties);
0449 
0450     READ_EPILOGUE
0451 }
0452 
0453 #undef CURRENT_EL
0454 #define CURRENT_EL seCell
0455 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_seCell()
0456 {
0457     READ_PROLOGUE
0458 
0459     m_currentTableStyleProperties = new TableStyleProperties;
0460 
0461     while(!atEnd()) {
0462         readNext();
0463         BREAK_IF_END_OF(CURRENT_EL)
0464         if(isStartElement()) {
0465             TRY_READ_IF(tcStyle)
0466             ELSE_TRY_READ_IF(tcTxStyle)
0467             ELSE_WRONG_FORMAT
0468         }
0469     }
0470 
0471     m_currentStyle->addProperties(DrawingTableStyle::SeCell, m_currentTableStyleProperties);
0472 
0473     READ_EPILOGUE
0474 }
0475 
0476 #undef CURRENT_EL
0477 #define CURRENT_EL swCell
0478 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_swCell()
0479 {
0480     READ_PROLOGUE
0481 
0482     m_currentTableStyleProperties = new TableStyleProperties;
0483 
0484     while(!atEnd()) {
0485         readNext();
0486         BREAK_IF_END_OF(CURRENT_EL)
0487         if(isStartElement()) {
0488             TRY_READ_IF(tcStyle)
0489             ELSE_TRY_READ_IF(tcTxStyle)
0490             ELSE_WRONG_FORMAT
0491         }
0492     }
0493 
0494     m_currentStyle->addProperties(DrawingTableStyle::SwCell, m_currentTableStyleProperties);
0495 
0496     READ_EPILOGUE
0497 }
0498 
0499 #undef CURRENT_EL
0500 #define CURRENT_EL wholeTbl
0501 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_wholeTbl()
0502 {
0503     READ_PROLOGUE
0504 
0505     m_currentTableStyleProperties = m_currentStyle->properties(DrawingTableStyle::WholeTbl);
0506     if (m_currentTableStyleProperties == 0) {
0507         m_currentTableStyleProperties = new TableStyleProperties;
0508     }
0509 
0510     while(!atEnd()) {
0511         readNext();
0512         BREAK_IF_END_OF(CURRENT_EL)
0513         if(isStartElement()) {
0514             TRY_READ_IF(tcStyle)
0515             ELSE_TRY_READ_IF(tcTxStyle)
0516             ELSE_WRONG_FORMAT
0517         }
0518     }
0519 
0520     m_currentStyle->addProperties(DrawingTableStyle::WholeTbl, m_currentTableStyleProperties);
0521 
0522     READ_EPILOGUE
0523 }
0524 
0525 #undef CURRENT_EL
0526 #define CURRENT_EL tcStyle
0527 /*
0528  Parent elements:
0529  - [done] band1H (§20.1.4.2.1);
0530  - [done] band1V (§20.1.4.2.2);
0531  - [done] band2H (§20.1.4.2.3);
0532  - [done] band2V (§20.1.4.2.4);
0533  - [done] firstCol (§20.1.4.2.11);
0534  - [done] firstRow (§20.1.4.2.12);
0535  - [done] lastCol (§20.1.4.2.16);
0536  - [done] lastRow (§20.1.4.2.17);
0537  - [done] neCell (§20.1.4.2.20);
0538  - [done] nwCell (§20.1.4.2.21);
0539  - [done] seCell (§20.1.4.2.23);
0540  - [done] swCell (§20.1.4.2.24);
0541  - [done] wholeTbl (§20.1.4.2.34)
0542 
0543  Child elements:
0544  - cell3D (Cell 3-D) §21.1.3.1
0545  - [done] fill (Fill) §20.1.4.2.9
0546  - [done] fillRef (Fill Reference) §20.1.4.2.10
0547  - [done] tcBdr (Table Cell Borders) §20.1.4.2.28
0548 
0549 */
0550 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_tcStyle()
0551 {
0552     READ_PROLOGUE
0553 
0554     pushCurrentDrawStyle(new KoGenStyle(KoGenStyle::GraphicAutoStyle, "graphic"));
0555 
0556     while(!atEnd()) {
0557         readNext();
0558         BREAK_IF_END_OF(CURRENT_EL)
0559         if(isStartElement()) {
0560 //             TRY_READ_IF(cell3D)
0561             TRY_READ_IF(fill)
0562             else if (name() == "fillRef") {
0563                 // NOTE: This is a heavy simplification for the moment
0564                 // In reality we should use graphic properties in the cell-style
0565                 // but it is not supported atm.
0566                 TRY_READ(fillRef)
0567                 if (m_currentColor.isValid()) {
0568                     m_currentTableStyleProperties->backgroundColor = m_currentColor;
0569                     m_currentTableStyleProperties->setProperties |= TableStyleProperties::BackgroundColor;
0570                 }
0571             }
0572             ELSE_TRY_READ_IF(tcBdr)
0573             SKIP_UNKNOWN
0574 //             ELSE_WRONG_FORMAT
0575         }
0576     }
0577 
0578     popCurrentDrawStyle();
0579 
0580     READ_EPILOGUE
0581 }
0582 
0583 #undef CURRENT_EL
0584 #define CURRENT_EL tcTxStyle
0585 /*
0586  Parent elements:
0587  - [done] band1H (§20.1.4.2.1);
0588  - [done] band1V (§20.1.4.2.2);
0589  - [done] band2H (§20.1.4.2.3);
0590  - [done] band2V (§20.1.4.2.4);
0591  - [done] firstCol (§20.1.4.2.11);
0592  - [done] firstRow (§20.1.4.2.12);
0593  - [done] lastCol (§20.1.4.2.16);
0594  - [done] lastRow (§20.1.4.2.17);
0595  - [done] neCell (§20.1.4.2.20);
0596  - [done] nwCell (§20.1.4.2.21);
0597  - [done] seCell (§20.1.4.2.23);
0598  - [done] swCell (§20.1.4.2.24);
0599  - [done] wholeTbl (§20.1.4.2.34)
0600 
0601  Child elements:
0602  - extLst (Extension List) §20.1.2.2.15
0603  - font (Font) §20.1.4.2.13
0604  - [done] fontRef (Font Reference) §20.1.4.1.17
0605  - hslClr (Hue, Saturation, Luminance Color Model) §20.1.2.3.13
0606  - [done] prstClr (Preset Color) §20.1.2.3.22
0607  - [done] schemeClr (Scheme Color) §20.1.2.3.29
0608  - [done] scrgbClr (RGB Color Model - Percentage Variant) §20.1.2.3.30
0609  - [done] srgbClr (RGB Color Model - Hex Variant) §20.1.2.3.32
0610  - [done] sysClr (System Color) §20.1.2.3.33
0611 
0612 */
0613 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_tcTxStyle()
0614 {
0615     READ_PROLOGUE
0616 
0617     const QXmlStreamAttributes attrs(attributes());
0618 
0619     m_currentColor = QColor();
0620     m_referredFontName.clear();
0621     m_currentTextStyle = KoGenStyle(KoGenStyle::TextAutoStyle, "text");
0622 
0623     while (!atEnd()) {
0624         readNext();
0625         BREAK_IF_END_OF(CURRENT_EL)
0626         if (isStartElement()) {
0627             TRY_READ_IF(schemeClr)
0628             ELSE_TRY_READ_IF(scrgbClr)
0629             //TODO hslClr hue, saturation, luminecence color
0630             ELSE_TRY_READ_IF(srgbClr)
0631             ELSE_TRY_READ_IF(sysClr)
0632             ELSE_TRY_READ_IF(prstClr)
0633             ELSE_TRY_READ_IF(fontRef)
0634             SKIP_UNKNOWN
0635         }
0636     }
0637 
0638     TRY_READ_ATTR_WITHOUT_NS(b)
0639     TRY_READ_ATTR_WITHOUT_NS(i)
0640     if (b == "on") {
0641         m_currentTextStyle.addProperty("fo:font-weight", "bold");
0642     }
0643     if (i == "on") {
0644         m_currentTextStyle.addProperty("fo:font-style", "italic");
0645     }
0646     if (m_currentColor.isValid()) {
0647         m_currentTextStyle.addProperty("fo:color", m_currentColor.name());
0648         m_currentColor = QColor();
0649     }
0650     if (!m_referredFontName.isEmpty()) {
0651         m_currentTextStyle.addProperty("fo:font-family", m_referredFontName);
0652     }
0653 
0654     m_currentTableStyleProperties->textStyle = m_currentTextStyle;
0655 
0656     READ_EPILOGUE
0657 }
0658 
0659 #undef CURRENT_EL
0660 #define CURRENT_EL tcBdr
0661 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_tcBdr()
0662 {
0663     READ_PROLOGUE
0664 
0665     while(!atEnd()) {
0666         readNext();
0667         BREAK_IF_END_OF(CURRENT_EL)
0668         if(isStartElement()) {
0669             TRY_READ_IF(bottom)
0670 //             ELSE_TRY_READ_IF(extLst)
0671             ELSE_TRY_READ_IF(insideH)
0672             ELSE_TRY_READ_IF(insideV)
0673             ELSE_TRY_READ_IF(left)
0674             ELSE_TRY_READ_IF(right)
0675             ELSE_TRY_READ_IF(tl2br)
0676             ELSE_TRY_READ_IF(top)
0677             ELSE_TRY_READ_IF(tr2bl)
0678             SKIP_UNKNOWN
0679 //             ELSE_WRONG_FORMAT
0680         }
0681     }
0682 
0683     READ_EPILOGUE
0684 }
0685 
0686 #undef CURRENT_EL
0687 #define CURRENT_EL bottom
0688 KoFilter::ConversionStatus MSOOXML::MsooXmlDrawingTableStyleReader::read_bottom()
0689 {
0690     READ_PROLOGUE
0691 
0692     while(!atEnd()) {
0693         readNext();
0694         BREAK_IF_END_OF(CURRENT_EL)
0695         if(isStartElement()) {
0696             if(QUALIFIED_NAME_IS(ln)) {
0697                 TRY_READ(Table_ln)
0698                 m_currentTableStyleProperties->bottom = m_currentBorder;
0699                 m_currentTableStyleProperties->setProperties |= TableStyleProperties::BottomBorder;
0700             }
0701 //             ELSE_TRY_READ_IF(lnRef)
0702 //             ELSE_WRONG_FORMAT
0703         }
0704     }
0705 
0706     READ_EPILOGUE
0707 }
0708 
0709 #undef CURRENT_EL
0710 #define CURRENT_EL top
0711 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_top()
0712 {
0713     READ_PROLOGUE
0714 
0715     while(!atEnd()) {
0716         readNext();
0717         BREAK_IF_END_OF(CURRENT_EL)
0718         if(isStartElement()) {
0719             if(QUALIFIED_NAME_IS(ln)) {
0720                 TRY_READ(Table_ln)
0721                 m_currentTableStyleProperties->top = m_currentBorder;
0722                 m_currentTableStyleProperties->setProperties |= TableStyleProperties::TopBorder;
0723             }
0724 //             ELSE_TRY_READ_IF(lnRef)
0725 //             ELSE_WRONG_FORMAT
0726         }
0727     }
0728 
0729     READ_EPILOGUE
0730 }
0731 
0732 #undef CURRENT_EL
0733 #define CURRENT_EL left
0734 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_left()
0735 {
0736     READ_PROLOGUE
0737 
0738     while(!atEnd()) {
0739         readNext();
0740         BREAK_IF_END_OF(CURRENT_EL)
0741         if(isStartElement()) {
0742             if(QUALIFIED_NAME_IS(ln)) {
0743                 TRY_READ(Table_ln)
0744                 m_currentTableStyleProperties->left = m_currentBorder;
0745                 m_currentTableStyleProperties->setProperties |= TableStyleProperties::LeftBorder;
0746             }
0747 //             ELSE_TRY_READ_IF(lnRef)
0748 //             ELSE_WRONG_FORMAT
0749         }
0750     }
0751 
0752     READ_EPILOGUE
0753 }
0754 
0755 #undef CURRENT_EL
0756 #define CURRENT_EL right
0757 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_right()
0758 {
0759     READ_PROLOGUE
0760 
0761     while(!atEnd()) {
0762         readNext();
0763         BREAK_IF_END_OF(CURRENT_EL)
0764         if(isStartElement()) {
0765             if(QUALIFIED_NAME_IS(ln)) {
0766                 TRY_READ(Table_ln)
0767                 m_currentTableStyleProperties->right = m_currentBorder;
0768                 m_currentTableStyleProperties->setProperties |= TableStyleProperties::RightBorder;
0769             }
0770 //             ELSE_TRY_READ_IF(lnRef)
0771 //             ELSE_WRONG_FORMAT
0772         }
0773     }
0774 
0775     READ_EPILOGUE
0776 }
0777 
0778 #undef CURRENT_EL
0779 #define CURRENT_EL tl2br
0780 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_tl2br()
0781 {
0782     READ_PROLOGUE
0783 
0784     while(!atEnd()) {
0785         if(isStartElement()) {
0786             if(QUALIFIED_NAME_IS(ln)) {
0787                 TRY_READ(Table_ln)
0788                 m_currentTableStyleProperties->tl2br = m_currentBorder;
0789                 m_currentTableStyleProperties->setProperties |= TableStyleProperties::Tl2brBorder;
0790             }
0791 //             ELSE_TRY_READ_IF(lnRef)
0792 //             ELSE_WRONG_FORMAT
0793         }
0794         BREAK_IF_END_OF(CURRENT_EL)
0795     }
0796 
0797     READ_EPILOGUE
0798 }
0799 
0800 #undef CURRENT_EL
0801 #define CURRENT_EL tr2bl
0802 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_tr2bl()
0803 {
0804     READ_PROLOGUE
0805 
0806     while(!atEnd()) {
0807         if(isStartElement()) {
0808             if(QUALIFIED_NAME_IS(ln)) {
0809                 TRY_READ(Table_ln)
0810                 m_currentTableStyleProperties->tr2bl = m_currentBorder;
0811                 m_currentTableStyleProperties->setProperties |= TableStyleProperties::Tr2blBorder;
0812             }
0813 //             ELSE_TRY_READ_IF(lnRef)
0814 //             ELSE_WRONG_FORMAT
0815         }
0816         BREAK_IF_END_OF(CURRENT_EL)
0817     }
0818 
0819     READ_EPILOGUE
0820 }
0821 
0822 #undef CURRENT_EL
0823 #define CURRENT_EL insideV
0824 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_insideV()
0825 {
0826     READ_PROLOGUE
0827 
0828     while(!atEnd()) {
0829         readNext();
0830         BREAK_IF_END_OF(CURRENT_EL)
0831         if(isStartElement()) {
0832             if(QUALIFIED_NAME_IS(ln)) {
0833                 TRY_READ(Table_ln)
0834                 m_currentTableStyleProperties->insideV = m_currentBorder;
0835                 m_currentTableStyleProperties->setProperties |= TableStyleProperties::InsideVBorder;
0836             }
0837 //             ELSE_TRY_READ_IF(lnRef)
0838 //             ELSE_WRONG_FORMAT
0839         }
0840     }
0841 
0842     READ_EPILOGUE
0843 }
0844 
0845 #undef CURRENT_EL
0846 #define CURRENT_EL insideH
0847 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_insideH()
0848 {
0849     READ_PROLOGUE
0850 
0851     while(!atEnd()) {
0852         readNext();
0853         BREAK_IF_END_OF(CURRENT_EL)
0854         if(isStartElement()) {
0855             if(QUALIFIED_NAME_IS(ln)) {
0856                 TRY_READ(Table_ln)
0857                 m_currentTableStyleProperties->insideH = m_currentBorder;
0858                 m_currentTableStyleProperties->setProperties |= TableStyleProperties::InsideHBorder;
0859             }
0860 //             ELSE_TRY_READ_IF(lnRef)
0861 //             ELSE_WRONG_FORMAT
0862         }
0863     }
0864 
0865     READ_EPILOGUE
0866 }
0867 
0868 #undef CURRENT_EL
0869 #define CURRENT_EL fill
0870 /*
0871  Parent elements:
0872  - tblBg (§20.1.4.2.25);
0873  - [done] tcStyle (§20.1.4.2.29)
0874 
0875  Child elements:
0876  - blipFill (Picture Fill) §20.1.8.14
0877  - gradFill (Gradient Fill) §20.1.8.33
0878  - grpFill (Group Fill) §20.1.8.35
0879  - [done] noFill (No Fill) §20.1.8.44
0880  - pattFill (Pattern Fill) §20.1.8.47
0881  - [done] solidFill (Solid Fill) §20.1.8.54
0882 
0883 */
0884 KoFilter::ConversionStatus MsooXmlDrawingTableStyleReader::read_fill()
0885 {
0886     READ_PROLOGUE
0887     while(!atEnd()) {
0888         readNext();
0889         BREAK_IF_END_OF(CURRENT_EL)
0890         if(isStartElement()) {
0891 //             TRY_READ_IF(blipFill)
0892 //             ELSE_TRY_READ_IF(grandFill)
0893 //             ELSE_TRY_READ_IF(grpFill)
0894             if (QUALIFIED_NAME_IS(noFill)) {
0895                 SKIP_EVERYTHING_AND_RETURN
0896             }
0897 //             ELSE_TRY_READ_IF(pattFill)
0898             else if(QUALIFIED_NAME_IS(solidFill)) {
0899                 TRY_READ(solidFill)
0900                 m_currentTableStyleProperties->backgroundColor = m_currentColor;
0901                 m_currentTableStyleProperties->setProperties |= TableStyleProperties::BackgroundColor;
0902                 if (m_currentAlpha > 0) {
0903                     m_currentTableStyleProperties->backgroundOpacity = m_currentAlpha;
0904                     m_currentTableStyleProperties->setProperties |= MSOOXML::TableStyleProperties::BackgroundOpacity;
0905                 }
0906             }
0907             SKIP_UNKNOWN
0908 //             ELSE_WRONG_FORMAT
0909         }
0910     }
0911 
0912     READ_EPILOGUE
0913 }
0914 
0915 #include "MsooXmlDrawingMLSharedImpl.h"
0916