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