File indexing completed on 2024-05-12 16:29:11

0001 /*
0002  * This file is part of Office 2007 Filters for Calligra
0003  *
0004  * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
0005  *
0006  * Contact: Suresh Chande suresh.chande@nokia.com
0007  *
0008  * This library is free software; you can redistribute it and/or
0009  * modify it under the terms of the GNU Lesser General Public License
0010  * version 2.1 as published by the Free Software Foundation.
0011  *
0012  * This library is distributed in the hope that it will be useful, but
0013  * WITHOUT ANY WARRANTY; without even the implied warranty of
0014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0015  * Lesser General Public License for more details.
0016  *
0017  * You should have received a copy of the GNU Lesser General Public
0018  * License along with this library; if not, write to the Free Software
0019  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
0020  * 02110-1301 USA
0021  *
0022  */
0023 
0024 #include "MsooXmlThemesReader.h"
0025 #include "MsooXmlSchemas.h"
0026 #include "MsooXmlTheme.h"
0027 #include "MsooXmlUtils.h"
0028 #include "MsooXmlUnits.h"
0029 
0030 #include <KoOdfGraphicStyles.h>
0031 #include <MsooXmlRelationships.h>
0032 
0033 #define MSOOXML_CURRENT_NS "a"
0034 #define MSOOXML_CURRENT_CLASS MsooXmlThemesReader
0035 #define MSOOXML_THEMESREADER_CPP
0036 
0037 #include "MsooXmlReader_p.h"
0038 
0039 #include <QPalette>
0040 
0041 #include <memory>
0042 #include <math.h>
0043 
0044 #ifndef M_PI
0045 #define M_PI 3.1415926535897932384626
0046 #endif
0047 
0048 using namespace MSOOXML;
0049 
0050 DrawingMLGradientFill::DrawingMLGradientFill(const QVector<qreal> &shadeModifier, const QVector<qreal> &tintModifier, const QVector<qreal> &satModifier,
0051     const QVector<int> &alphaModifier, const QVector<int> &gradPositions, const QString &gradAngle)
0052     : m_shadeModifier(shadeModifier),m_tintModifier(tintModifier), m_satModifier(satModifier),
0053      m_alphaModifier(alphaModifier), m_gradPosition(gradPositions), m_gradAngle(gradAngle)
0054 {
0055 }
0056 
0057 void DrawingMLGradientFill::writeStyles(KoGenStyles& styles, KoGenStyle *graphicStyle, const QColor &color)
0058 {
0059     KoGenStyle gradientStyle = KoGenStyle(KoGenStyle::LinearGradientStyle);
0060 
0061     qreal angle = -m_gradAngle.toDouble() / 60000.0 / 180.0 * M_PI;
0062     gradientStyle.addAttribute("svg:x1", QString("%1%").arg(50 - 50 * cos(angle)));
0063     gradientStyle.addAttribute("svg:y1", QString("%1%").arg(50 + 50 * sin(angle)));
0064     gradientStyle.addAttribute("svg:x2", QString("%1%").arg(50 + 50 * cos(angle)));
0065     gradientStyle.addAttribute("svg:y2", QString("%1%").arg(50 - 50 * sin(angle)));
0066 
0067     int index = 0;
0068     while (index < m_alphaModifier.size()) {
0069         QColor gradColor = color;
0070         MSOOXML::Utils::modifyColor(gradColor, m_tintModifier.at(index), m_shadeModifier.at(index), m_satModifier.at(index));
0071         QString contents = QString("<svg:stop svg:offset=\"%1\" svg:stop-color=\"%2\" svg:stop-opacity=\"1\"/>").arg(m_gradPosition.at(index)/100.0).arg(gradColor.name());
0072         QString name = QString("%1").arg(index);
0073         gradientStyle.addChildElement(name, contents);
0074         ++index;
0075     }
0076 
0077     graphicStyle->addProperty("draw:fill", "gradient");
0078     const QString gradName = styles.insert(gradientStyle);
0079     graphicStyle->addProperty("draw:fill-gradient-name", gradName);
0080 }
0081 
0082 DrawingMLBlipFill::DrawingMLBlipFill(const QString &filePath) : m_filePath(filePath)
0083 {
0084 }
0085 
0086 void DrawingMLBlipFill::writeStyles(KoGenStyles& styles, KoGenStyle *graphicStyle, const QColor &color)
0087 {
0088     Q_UNUSED(color)
0089 
0090     KoGenStyle fillImageStyle(KoGenStyle::FillImageStyle);
0091     fillImageStyle.addAttribute("xlink:href", m_filePath);
0092     fillImageStyle.addAttribute("xlink:type", "simple");
0093     fillImageStyle.addAttribute("xlink:show", "embed");
0094     fillImageStyle.addAttribute("xlink:actuate", "onLoad");
0095     QString fillImageName = styles.insert(fillImageStyle);
0096 
0097     graphicStyle->addProperty("draw:fill", "bitmap");
0098     graphicStyle->addProperty("draw:fill-image-name", fillImageName);
0099 }
0100 
0101 void DrawingMLSolidFill::writeStyles(KoGenStyles& styles, KoGenStyle *graphicStyle, const QColor &color)
0102 {
0103     if (color.isValid()) {
0104         QBrush brush(color, Qt::SolidPattern);
0105         KoOdfGraphicStyles::saveOdfFillStyle(*graphicStyle, styles, brush);
0106     }
0107 }
0108 
0109 DrawingMLColorSchemeItem::DrawingMLColorSchemeItem()
0110 {
0111 }
0112 
0113 DrawingMLColorSchemeSystemItem::DrawingMLColorSchemeSystemItem()
0114 {
0115 }
0116 
0117 QColor DrawingMLColorSchemeSystemItem::value() const
0118 {
0119     // Prefer lastColor
0120     if (lastColor.isValid()) {
0121         return lastColor;
0122     }
0123 
0124     //TODO: use the style:use-window-font-color attribute
0125 
0126     //! 20.1.10.58 ST_SystemColorVal (System Color Value)
0127     if ( systemColor == QLatin1String("windowText") ||
0128          systemColor == QLatin1String("menuText"))
0129     {
0130         return QPalette().color(QPalette::Active, QPalette::WindowText);
0131     }
0132     else if ( systemColor == QLatin1String("window") ||
0133               systemColor == QLatin1String("menu") ||
0134               systemColor == QLatin1String("menuBar"))
0135     {
0136         return QPalette().color(QPalette::Active, QPalette::Window);
0137     }
0138     else if (systemColor == QLatin1String("highlightText")) {
0139         return QPalette().color(QPalette::Active, QPalette::HighlightedText);
0140     }
0141     else if (systemColor == QLatin1String("highlight")) {
0142         return QPalette().color(QPalette::Active, QPalette::Highlight);
0143     }
0144     else if (systemColor == QLatin1String("grayText")) {
0145         return QPalette().color(QPalette::Disabled, QPalette::WindowText);
0146     }
0147     else if (systemColor == QLatin1String("btnText")) {
0148         return QPalette().color(QPalette::Active, QPalette::ButtonText);
0149     }
0150     else if (systemColor == QLatin1String("btnFace")) {
0151         return QPalette().color(QPalette::Active, QPalette::Button);
0152     }
0153     else if (systemColor == QLatin1String("btnHighlight")) {
0154         return QPalette().color(QPalette::Active, QPalette::Light);
0155     }
0156     else if (systemColor == QLatin1String("btnShadow")) {
0157         return QPalette().color(QPalette::Active, QPalette::Dark);
0158     }
0159 
0160 //! @todo Use more of systemColor
0161     return QColor(Qt::black); // TODO; better default?
0162 }
0163 
0164 DrawingMLColorSchemeItemBase::DrawingMLColorSchemeItemBase()
0165 {
0166 }
0167 
0168 DrawingMLColorSchemeItemBase::~DrawingMLColorSchemeItemBase()
0169 {
0170 }
0171 
0172 DrawingMLColorSchemeItem* DrawingMLColorSchemeItemBase::toColorItem()
0173 {
0174     return dynamic_cast<DrawingMLColorSchemeItem*>(this);
0175 }
0176 
0177 DrawingMLColorSchemeSystemItem* DrawingMLColorSchemeItemBase::toSystemItem()
0178 {
0179     return dynamic_cast<DrawingMLColorSchemeSystemItem*>(this);
0180 }
0181 
0182 DrawingMLColorScheme::DrawingMLColorScheme()
0183 {
0184 }
0185 
0186 DrawingMLColorScheme::~DrawingMLColorScheme()
0187 {
0188     QSet<DrawingMLColorSchemeItemBase*> set(values().toSet()); // use set because values can be duplicated
0189     qDeleteAll(set);
0190 }
0191 
0192 DrawingMLColorScheme& DrawingMLColorScheme::operator=(const DrawingMLColorScheme& scheme)
0193 {
0194     QHashIterator<QString, DrawingMLColorSchemeItemBase*> i(scheme);
0195     while (i.hasNext()) {
0196         i.next();
0197         insert(i.key(), i.value()->clone());
0198     }
0199 
0200     return *this;
0201 }
0202 
0203 DrawingMLColorScheme::DrawingMLColorScheme(const DrawingMLColorScheme& scheme) : QHash<QString, DrawingMLColorSchemeItemBase*>()
0204 {
0205     QHashIterator<QString, DrawingMLColorSchemeItemBase*> i(scheme);
0206     while (i.hasNext()) {
0207         i.next();
0208         insert(i.key(), i.value()->clone());
0209     }
0210 }
0211 
0212 DrawingMLColorSchemeItemBase* DrawingMLColorScheme::value(int index) const
0213 {
0214     return DrawingMLColorSchemeItemHash::value( QString::number(index) );
0215 }
0216 
0217 DrawingMLFontScheme::DrawingMLFontScheme()
0218 {
0219 }
0220 
0221 DrawingMLFontSet::DrawingMLFontSet()
0222 {
0223 }
0224 
0225 DrawingMLFillBase::~DrawingMLFillBase()
0226 {
0227 }
0228 
0229 DrawingMLFormatScheme::~DrawingMLFormatScheme()
0230 {
0231     qDeleteAll(fillStyles);
0232 }
0233 
0234 DrawingMLFormatScheme::DrawingMLFormatScheme()
0235 {
0236 }
0237 
0238 DrawingMLFormatScheme::DrawingMLFormatScheme(const DrawingMLFormatScheme& format)
0239 {
0240     QMapIterator<int, DrawingMLFillBase*> i(format.fillStyles);
0241     while (i.hasNext()) {
0242         i.next();
0243         fillStyles.insert(i.key(), i.value()->clone());
0244     }
0245     lnStyleLst = format.lnStyleLst;
0246 }
0247 
0248 DrawingMLFormatScheme& DrawingMLFormatScheme::operator=(const DrawingMLFormatScheme& format)
0249 {
0250     QMapIterator<int, DrawingMLFillBase*> i(format.fillStyles);
0251     while (i.hasNext()) {
0252         i.next();
0253         fillStyles.insert(i.key(), i.value()->clone());
0254     }
0255     lnStyleLst = format.lnStyleLst;
0256 
0257     return *this;
0258 }
0259 
0260 DrawingMLTheme::DrawingMLTheme()
0261 {
0262 }
0263 
0264 // ---------------------------------------------------
0265 
0266 MsooXmlThemesReaderContext::MsooXmlThemesReaderContext(DrawingMLTheme& t, MSOOXML::MsooXmlRelationships* rel,
0267         MSOOXML::MsooXmlImport* imp, const QString &pathName, const QString &fileName)
0268         : MsooXmlReaderContext()
0269         , theme(&t), relationships(rel), import(imp), path(pathName), file(fileName)
0270 {
0271 }
0272 
0273 // ---------------------------------------------------
0274 
0275 MsooXmlThemesReader::MsooXmlThemesReader(KoOdfWriters *writers)
0276         : MsooXmlCommonReader(writers)
0277         , m_currentColor_local(0)
0278         , m_context(0)
0279 {
0280     init();
0281 }
0282 
0283 MsooXmlThemesReader::~MsooXmlThemesReader()
0284 {
0285 }
0286 
0287 void MsooXmlThemesReader::init()
0288 {
0289     m_clrScheme_initialized = false;
0290     m_color_initialized = false;
0291 }
0292 
0293 KoFilter::ConversionStatus MsooXmlThemesReader::read(MsooXmlReaderContext* context)
0294 {
0295     m_context = dynamic_cast<MsooXmlThemesReaderContext*>(context);
0296     Q_ASSERT(m_context);
0297     m_import = m_context->import;
0298     m_path = m_context->path;
0299     m_file = m_context->file;
0300     m_relationships = m_context->relationships;
0301     *m_context->theme = DrawingMLTheme(); //clear
0302     const KoFilter::ConversionStatus result = readInternal();
0303     m_context = 0;
0304     if (result == KoFilter::OK)
0305         return KoFilter::OK;
0306     *dynamic_cast<MsooXmlThemesReaderContext*>(context)->theme = DrawingMLTheme(); //clear
0307     return result;
0308 }
0309 
0310 KoFilter::ConversionStatus MsooXmlThemesReader::readInternal()
0311 {
0312     //debugMsooXml << "=============================";
0313     readNext();
0314     if (!isStartDocument()) {
0315         return KoFilter::WrongFormat;
0316     }
0317 
0318     readNext();
0319     //debugMsooXml << *this;
0320     if (isStartElement()) {
0321         TRY_READ_IF(theme)
0322         ELSE_WRONG_FORMAT
0323     } else {
0324         return KoFilter::WrongFormat;
0325     }
0326     //debugMsooXml << "===========finished============";
0327     return KoFilter::OK;
0328 }
0329 
0330 #undef CURRENT_EL
0331 #define CURRENT_EL theme
0332 //! theme (Theme)
0333 /*! ECMA-376, 20.1.6.9, p.3180.
0334  No parent elements.
0335  Child elements:
0336  - custClrLst (Custom Color List) §20.1.6.3
0337  - extLst (Extension List) §20.1.2.2.15
0338  - extraClrSchemeLst (Extra Color Scheme List) §20.1.6.5
0339  - objectDefaults (Object Defaults) §20.1.6.7
0340  - themeElements [done] (Theme Elements) §20.1.6.10
0341  CASE #850
0342 */
0343 KoFilter::ConversionStatus MsooXmlThemesReader::read_theme()
0344 {
0345     READ_PROLOGUE
0346     //debugMsooXml << namespaceUri();
0347 
0348     if (!expectNS(Schemas::drawingml::main)) {
0349         return KoFilter::WrongFormat;
0350     }
0351 
0352     const QXmlStreamAttributes attrs(attributes());
0353     READ_ATTR_WITHOUT_NS_INTO(name, m_context->theme->name)
0354     //debugMsooXml << "name:" << m_context->theme->name;
0355 
0356     QXmlStreamNamespaceDeclarations namespaces(namespaceDeclarations());
0357     //for (int i = 0; i < namespaces.count(); i++) {
0358         //debugMsooXml << "NS prefix:" << namespaces[i].prefix() << "uri:" << namespaces[i].namespaceUri();
0359     //}
0360 //! @todo find out whether the namespace returned by namespaceUri()
0361 //!       is exactly the same ref as the element of namespaceDeclarations()
0362     if (!namespaces.contains(QXmlStreamNamespaceDeclaration(MSOOXML_CURRENT_NS, Schemas::drawingml::main))) {
0363         raiseError(i18n("Namespace \"%1\" not found", QLatin1String(Schemas::drawingml::main)));
0364         return KoFilter::WrongFormat;
0365     }
0366 //! @todo expect other namespaces too...
0367 
0368     while (!atEnd()) {
0369         readNext();
0370         //debugMsooXml << *this;
0371         BREAK_IF_END_OF(CURRENT_EL)
0372         if (isStartElement()) {
0373             TRY_READ_IF(themeElements)
0374             ELSE_TRY_READ_IF(custClrLst)
0375             ELSE_TRY_READ_IF(extLst)
0376             ELSE_TRY_READ_IF(extraClrSchemeLst)
0377             ELSE_TRY_READ_IF(objectDefaults)
0378             ELSE_TRY_READ_IF(custClrLst)
0379             ELSE_WRONG_FORMAT
0380         }
0381     }
0382     READ_EPILOGUE
0383 }
0384 
0385 #undef CURRENT_EL
0386 #define CURRENT_EL themeElements
0387 //! themeElements (Theme Elements)
0388 /*! ECMA-376, 20.1.6.10, p.3181.
0389  Parent elements:
0390  - theme
0391  Child elements:
0392  - clrScheme (Color Scheme) §20.1.6.2
0393  - extLst (Extension List) §20.1.2.2.15
0394  - fmtScheme (Format Scheme) §20.1.4.1.14
0395  - fontScheme (Font Scheme) §20.1.4.1.18
0396  CASE #850
0397 */
0398 KoFilter::ConversionStatus MsooXmlThemesReader::read_themeElements()
0399 {
0400     READ_PROLOGUE
0401     while (!atEnd()) {
0402         readNext();
0403         //debugMsooXml << *this;
0404         BREAK_IF_END_OF(CURRENT_EL)
0405         if (isStartElement()) {
0406             TRY_READ_IF(clrScheme)
0407             ELSE_TRY_READ_IF(extLst)
0408             ELSE_TRY_READ_IF(fmtScheme)
0409             ELSE_TRY_READ_IF(fontScheme)
0410             ELSE_WRONG_FORMAT
0411         }
0412     }
0413     READ_EPILOGUE
0414 }
0415 
0416 #undef CURRENT_EL
0417 #define CURRENT_EL objectDefaults
0418 //! objectDefaults (Object Defaults)
0419 /*! ECMA-376, 20.1.6.7, p.3178.
0420 
0421  This element allows for the definition of default shape, line, and textbox formatting properties. An application
0422  can use this information to format a shape (or text) initially on insertion into a document.
0423 
0424  Parent elements:
0425  - [done] theme
0426  Child elements:
0427  - extLst (Extension List) §20.1.2.2.15
0428  - lnDef (Line Default) §20.1.4.1.20
0429  - spDef (Shape Default) §20.1.4.1.27
0430  - txDef (Text Default) §20.1.4.1.28
0431 
0432  @todo
0433 */
0434 KoFilter::ConversionStatus MsooXmlThemesReader::read_objectDefaults()
0435 {
0436     SKIP_EVERYTHING_AND_RETURN
0437 }
0438 
0439 #undef CURRENT_EL
0440 #define CURRENT_EL custClrLst
0441 //! custClrLst (Custom Color List))
0442 /*! ECMA-376, 20.1.6.3, p.3175.
0443 
0444  @todo
0445 */
0446 KoFilter::ConversionStatus MsooXmlThemesReader::read_custClrLst()
0447 {
0448     SKIP_EVERYTHING_AND_RETURN
0449 }
0450 
0451 //! @todo !!!!!!!!!!!!!MERGE with Document Reader!!!!!!!!!!!!!
0452 
0453 #undef CURRENT_EL
0454 #define CURRENT_EL clrMap
0455 KoFilter::ConversionStatus MsooXmlThemesReader::read_clrMap()
0456 {
0457     READ_PROLOGUE
0458     const QXmlStreamAttributes attrs(attributes());
0459 
0460     SKIP_EVERYTHING
0461 
0462     READ_EPILOGUE
0463 }
0464 
0465 //! @todo !!!!!!!!!!!!!MERGE with Document Reader!!!!!!!!!!!!!
0466 #undef CURRENT_EL
0467 #define CURRENT_EL extraClrSchemeLst
0468 //! extraClrSchemeLst (Extra Color Scheme List)
0469 /*! ECMA-376, 20.1.6.5, p.3177.
0470 
0471  @todo implement
0472 */
0473 KoFilter::ConversionStatus MsooXmlThemesReader::read_extraClrSchemeLst()
0474 {
0475    READ_PROLOGUE
0476 
0477    while (!atEnd()) {
0478         readNext();
0479         //debugMsooXml << *this;
0480         BREAK_IF_END_OF(CURRENT_EL)
0481         if (isStartElement()) {
0482             TRY_READ_IF(extraClrScheme)
0483         }
0484     }
0485     READ_EPILOGUE
0486 }
0487 
0488 #undef CURRENT_EL
0489 #define CURRENT_EL extraClrScheme
0490 //! extraClrScheme (Extra Color Scheme)
0491 /*!
0492 
0493  @todo implement
0494 */
0495 KoFilter::ConversionStatus MsooXmlThemesReader::read_extraClrScheme()
0496 {
0497    READ_PROLOGUE
0498 
0499    while (!atEnd()) {
0500         readNext();
0501         //debugMsooXml << *this;
0502         BREAK_IF_END_OF(CURRENT_EL)
0503         if (isStartElement()) {
0504         }
0505     }
0506     READ_EPILOGUE
0507 }
0508 
0509 #define INIT_COLOR_ITEM(name, index) \
0510     BIND_READ_METHOD(name, color) \
0511     m_colorSchemeIndices.insert(name, QLatin1String(STRINGIFY(index)));
0512 
0513 //! @todo !!!!!!!!!!!!!MERGE with Document Reader!!!!!!!!!!!!!
0514 #undef CURRENT_EL
0515 #define CURRENT_EL clrScheme
0516 //! clrScheme (Color Scheme)
0517 /*! ECMA-376, 20.1.6.2, p.3173.
0518  Parent elements:
0519  - extraClrScheme (§20.1.6.4)
0520  - [done] themeElements (§20.1.6.10)
0521  - themeOverride (§20.1.6.12)
0522  Child elements:
0523     - accent1 (Accent 1) §20.1.4.1.1
0524     - accent2 (Accent 2) §20.1.4.1.2
0525     - accent3 (Accent 3) §20.1.4.1.3
0526     - accent4 (Accent 4) §20.1.4.1.4
0527     - accent5 (Accent 5) §20.1.4.1.5
0528     - accent6 (Accent 6) §20.1.4.1.6
0529     - dk1 (Dark 1) §20.1.4.1.9
0530     - dk2 (Dark 2) §20.1.4.1.10
0531     - extLst (Extension List) §20.1.2.2.15
0532     - folHlink (Followed Hyperlink) §20.1.4.1.15
0533     - hlink (Hyperlink) §20.1.4.1.19
0534     - lt1 (Light 1) §20.1.4.1.22
0535     - lt2 (Light 2) §20.1.4.1.23
0536 */
0537 KoFilter::ConversionStatus MsooXmlThemesReader::read_clrScheme()
0538 {
0539     READ_PROLOGUE
0540 
0541     if (!m_clrScheme_initialized) {
0542         m_clrScheme_initialized = true;
0543         INIT_COLOR_ITEM("dk1", 0)
0544         INIT_COLOR_ITEM("lt1", 1)
0545         INIT_COLOR_ITEM("dk2", 2)
0546         INIT_COLOR_ITEM("lt2", 3)
0547         INIT_COLOR_ITEM("accent1", 4)
0548         INIT_COLOR_ITEM("accent2", 5)
0549         INIT_COLOR_ITEM("accent3", 6)
0550         INIT_COLOR_ITEM("accent4", 7)
0551         INIT_COLOR_ITEM("accent5", 8)
0552         INIT_COLOR_ITEM("accent6", 9)
0553         INIT_COLOR_ITEM("hlink", 10)
0554         INIT_COLOR_ITEM("folHlink", 11)
0555     }
0556 
0557     const QXmlStreamAttributes attrs(attributes());
0558     READ_ATTR_WITHOUT_NS_INTO(name, m_context->theme->colorScheme.name)
0559 
0560     while (!atEnd()) {
0561         readNext();
0562         //debugMsooXml << *this;
0563         BREAK_IF_END_OF(CURRENT_EL)
0564         if (isStartElement()) {
0565             ReadMethod readMethod = m_readMethods.value(this->name().toString());
0566             if (readMethod) {
0567                 Q_ASSERT(!m_currentColor_local);
0568                 RETURN_IF_ERROR( (this->*readMethod)() )
0569                 Q_ASSERT(m_currentColor_local);
0570                 if (!m_currentColor_local) {
0571                     return KoFilter::InternalError;
0572                 }
0573                 const QString colorName( this->name().toString() );
0574                 //debugMsooXml << "inserting color for" << colorName;
0575                 m_context->theme->colorScheme.insert(colorName, m_currentColor_local);
0576                 const QString colorIndex(m_colorSchemeIndices.value(colorName));
0577                 if (!colorIndex.isEmpty()) {
0578                     m_context->theme->colorScheme.insert(colorIndex, m_currentColor_local);
0579                 }
0580 
0581                 m_currentColor_local = 0;
0582             }
0583             ELSE_WRONG_FORMAT_DEBUG("!readMethod")
0584         }
0585     }
0586     READ_EPILOGUE
0587 }
0588 #undef INIT_COLOR_ITEM
0589 
0590 //! @todo !!!!!!!!!!!!!MERGE with Document Reader!!!!!!!!!!!!!
0591 #undef CURRENT_EL
0592 //! accent[1-6] (Accent [1-6]), dk1/2, lt1/2
0593 /*! ECMA-376, 20.1.4.1.1-6, p.3098, etc.
0594 
0595  Parent elements:
0596  - [done] clrScheme (§20.1.6.2)
0597 
0598  Child elements:
0599  - hslClr (Hue, Saturation, Luminance Color Model) §20.1.2.3.13
0600  - prstClr (Preset Color) §20.1.2.3.22
0601  - [unsupported by MSO] schemeClr (Scheme Color) §20.1.2.3.29
0602  - scrgbClr (RGB Color Model - Percentage Variant) §20.1.2.3.30
0603  - srgbClr (RGB Color Model - Hex Variant) §20.1.2.3.32
0604  - sysClr (System Color) §20.1.2.3.33
0605 */
0606 KoFilter::ConversionStatus MsooXmlThemesReader::read_color()
0607 {
0608     const QString qn(qualifiedName().toString());
0609 
0610     if (!m_color_initialized) {
0611         m_color_initialized = true;
0612 //! @todo remove _SKIP
0613         BIND_READ_SKIP(hslClr)
0614 //! @todo remove _SKIP
0615         BIND_READ_SKIP(prstClr)
0616 //! @todo remove _SKIP
0617         BIND_READ_SKIP(schemeClr)
0618 //! @todo remove _SKIP
0619         BIND_READ_SKIP(scrgbClr)
0620 
0621         BIND_READ(srgbClr_local)
0622         BIND_READ(sysClr_local)
0623     }
0624 
0625     while (!atEnd()) {
0626         readNext();
0627         //debugMsooXml << *this;
0628         BREAK_IF_END_OF_QSTRING(qn)
0629         if (isStartElement()) {
0630             QString name = this->name().toString();
0631 
0632             //using local versions at the moment
0633             if (name == "srgbClr") {
0634                 name = "srgbClr_local";
0635             } else if (name == "sysClr") {
0636                 name = "sysClr_local";
0637             }
0638 
0639             ReadMethod readMethod = m_readMethods.value(name);
0640             if (readMethod) {
0641                 RETURN_IF_ERROR( (this->*readMethod)() )
0642             }
0643             ELSE_WRONG_FORMAT_DEBUG("!readMethod")
0644         }
0645     }
0646 
0647     if (!expectElEnd(qn)) {
0648         return KoFilter::WrongFormat;
0649     }
0650     return KoFilter::OK;
0651 }
0652 
0653 
0654 //! @todo !!!!!!!!!!!!!MERGE with Document Reader!!!!!!!!!!!!!
0655 #undef CURRENT_EL
0656 #define CURRENT_EL srgbClr
0657 //! srgbClr (RGB Color Model - Hex Variant)
0658 //! ECMA-376 20.1.2.3.32, p. 3085.
0659 /*!
0660  Parent elements:
0661     [done] accent1 (§20.1.4.1.1); accent2 (§20.1.4.1.2); accent3 (§20.1.4.1.3); accent4 (§20.1.4.1.4);
0662     [done] accent5 (§20.1.4.1.5); accent6 (§20.1.4.1.6);
0663     [done] dk1 (§20.1.4.1.9); dk2 (§20.1.4.1.10);
0664     [done] lt1 (§20.1.4.1.22); lt2 (§20.1.4.1.23);
0665     [done] folHlink (§20.1.4.1.15); hlink (§20.1.4.1.19);
0666 
0667     TODO:
0668     alphaInv (§20.1.8.4);
0669     bgClr (§20.1.8.10);
0670     bgRef (§19.3.1.3);
0671     buClr (§21.1.2.4.4);
0672     clrFrom (§20.1.8.17);
0673     clrMru (§19.2.1.4);
0674     clrRepl (§20.1.8.18);
0675     clrTo (§20.1.8.19);
0676     clrVal (§19.5.27);
0677     contourClr (§20.1.5.6);
0678     custClr (§20.1.4.1.8);
0679     duotone (§20.1.8.23);
0680     effectClrLst (§21.4.4.7);
0681     effectRef (§20.1.4.2.8);
0682     extrusionClr (§20.1.5.7);
0683     fgClr (§20.1.8.27);
0684     fillClrLst (§21.4.4.8);
0685     fillRef (§20.1.4.2.10);
0686     fontRef (§20.1.4.1.17);
0687     from (§19.5.43);
0688     glow (§20.1.8.32);
0689     gs (§20.1.8.36);
0690     highlight (§21.1.2.3.4);
0691     innerShdw (§20.1.8.40);
0692     linClrLst (§21.4.4.9);
0693     lnRef (§20.1.4.2.19);
0694     outerShdw (§20.1.8.45);
0695     penClr (§19.2.1.23);
0696     prstShdw (§20.1.8.49);
0697     solidFill (§20.1.8.54);
0698     tcTxStyle (§20.1.4.2.30);
0699     to (§19.5.90);
0700     txEffectClrLst (§21.4.4.12);
0701     txFillClrLst (§21.4.4.13);
0702     txLinClrLst (§21.4.4.14)
0703 
0704  Child elements:
0705     alpha (Alpha) §20.1.2.3.1
0706     alphaMod (Alpha Modulation) §20.1.2.3.2
0707     alphaOff (Alpha Offset) §20.1.2.3.3
0708     blue (Blue) §20.1.2.3.4
0709     blueMod (Blue Modification) §20.1.2.3.5
0710     blueOff (Blue Offset) §20.1.2.3.6
0711     comp (Complement) §20.1.2.3.7
0712     gamma (Gamma) §20.1.2.3.8
0713     gray (Gray) §20.1.2.3.9
0714     green (Green) §20.1.2.3.10
0715     greenMod (Green Modification) §20.1.2.3.11
0716     greenOff (Green Offset) §20.1.2.3.12
0717     hue (Hue) §20.1.2.3.14
0718     hueMod (Hue Modulate) §20.1.2.3.15
0719     hueOff (Hue Offset) §20.1.2.3.16
0720     inv (Inverse) §20.1.2.3.17
0721     invGamma (Inverse Gamma) §20.1.2.3.18
0722     lum (Luminance) §20.1.2.3.19
0723     lumMod (Luminance Modulation) §20.1.2.3.20
0724     lumOff (Luminance Offset) §20.1.2.3.21
0725     red (Red) §20.1.2.3.23
0726     redMod (Red Modulation) §20.1.2.3.24
0727     redOff (Red Offset) §20.1.2.3.25
0728     sat (Saturation) §20.1.2.3.26
0729     satMod (Saturation Modulation) §20.1.2.3.27
0730     satOff (Saturation Offset) §20.1.2.3.28
0731     shade (Shade) §20.1.2.3.31
0732     tint (Tint) §20.1.2.3.34
0733 
0734     TODO: these child elements are common for all *Clr() methods, so
0735     create common function for parsing them
0736 */
0737 KoFilter::ConversionStatus MsooXmlThemesReader::read_srgbClr_local()
0738 {
0739     std::auto_ptr<DrawingMLColorSchemeItem> color(new DrawingMLColorSchemeItem);
0740     m_currentColor_local = 0;
0741     READ_PROLOGUE
0742     const QXmlStreamAttributes attrs(attributes());
0743 
0744     READ_ATTR_WITHOUT_NS(val)
0745     color.get()->color = Utils::ST_HexColorRGB_to_QColor(val);
0746     //debugMsooXml << color.get()->color;
0747 
0748     readNext();
0749     READ_EPILOGUE_WITHOUT_RETURN
0750     m_currentColor_local = color.release();
0751 
0752     return KoFilter::OK;
0753 }
0754 
0755 //! @todo !!!!!!!!!!!!!MERGE with Document Reader!!!!!!!!!!!!!
0756 #undef CURRENT_EL
0757 #define CURRENT_EL sysClr
0758 /*! ECMA-376
0759  - sysClr (System Color) §20.1.2.3.33
0760 
0761  Parent elements:
0762     [done] accent1 (§20.1.4.1.1);
0763     accent2 (§20.1.4.1.2);
0764     accent3 (§20.1.4.1.3);
0765     accent4 (§20.1.4.1.4);
0766     [done] accent5 (§20.1.4.1.5);
0767     accent6 (§20.1.4.1.6);
0768     [done] dk1 (§20.1.4.1.9);
0769     dk2 (§20.1.4.1.10);
0770     [done] lt1 (§20.1.4.1.22);
0771     lt2 (§20.1.4.1.23);
0772     [done] folHlink (§20.1.4.1.15);
0773     hlink (§20.1.4.1.19);
0774 
0775     TODO:
0776     alphaInv (§20.1.8.4);
0777     bgClr (§20.1.8.10);
0778     bgRef (§19.3.1.3);
0779     buClr (§21.1.2.4.4);
0780     clrFrom (§20.1.8.17);
0781     clrMru (§19.2.1.4);
0782     clrRepl (§20.1.8.18);
0783     clrTo (§20.1.8.19);
0784     clrVal (§19.5.27);
0785     contourClr (§20.1.5.6);
0786     custClr (§20.1.4.1.8);
0787     duotone (§20.1.8.23);
0788     effectClrLst (§21.4.4.7);
0789     effectRef (§20.1.4.2.8);
0790     extrusionClr (§20.1.5.7);
0791     fgClr (§20.1.8.27);
0792     fillClrLst (§21.4.4.8);
0793     fillRef (§20.1.4.2.10);
0794     fontRef (§20.1.4.1.17);
0795     from (§19.5.43);
0796     glow (§20.1.8.32);
0797     gs (§20.1.8.36);
0798     highlight (§21.1.2.3.4);
0799     innerShdw (§20.1.8.40);
0800     linClrLst (§21.4.4.9);
0801     lnRef (§20.1.4.2.19);
0802     outerShdw (§20.1.8.45);
0803     penClr (§19.2.1.23);
0804     prstShdw (§20.1.8.49);
0805     solidFill (§20.1.8.54);
0806     tcTxStyle (§20.1.4.2.30);
0807     to (§19.5.90);
0808     txEffectClrLst (§21.4.4.12);
0809     txFillClrLst (§21.4.4.13);
0810     xLinClrLst (§21.4.4.14)
0811 
0812  Child elements:
0813     alpha (Alpha) §20.1.2.3.1
0814     alphaMod (Alpha Modulation) §20.1.2.3.2
0815     alphaOff (Alpha Offset) §20.1.2.3.3
0816     blue (Blue) §20.1.2.3.4
0817     blueMod (Blue Modification) §20.1.2.3.5
0818     blueOff (Blue Offset) §20.1.2.3.6
0819     comp (Complement) §20.1.2.3.7
0820     gamma (Gamma) §20.1.2.3.8
0821     gray (Gray) §20.1.2.3.9
0822     green (Green) §20.1.2.3.10
0823     greenMod (Green Modification) §20.1.2.3.11
0824     greenOff (Green Offset) §20.1.2.3.12
0825     hue (Hue) §20.1.2.3.14
0826     hueMod (Hue Modulate) §20.1.2.3.15
0827     hueOff (Hue Offset) §20.1.2.3.16
0828     inv (Inverse) §20.1.2.3.17
0829     invGamma (Inverse Gamma) §20.1.2.3.18
0830     lum (Luminance) §20.1.2.3.19
0831     lumMod (Luminance Modulation) §20.1.2.3.20
0832     lumOff (Luminance Offset) §20.1.2.3.21
0833     red (Red) §20.1.2.3.23
0834     redMod (Red Modulation) §20.1.2.3.24
0835     redOff (Red Offset) §20.1.2.3.25
0836     sat (Saturation) §20.1.2.3.26
0837     satMod (Saturation Modulation) §20.1.2.3.27
0838     satOff (Saturation Offset) §20.1.2.3.28
0839     shade (Shade) §20.1.2.3.31
0840     tint (Tint) §20.1.2.3.34
0841 */
0842 KoFilter::ConversionStatus MsooXmlThemesReader::read_sysClr_local()
0843 {
0844     std::auto_ptr<DrawingMLColorSchemeSystemItem> color(new DrawingMLColorSchemeSystemItem);
0845     m_currentColor_local = 0;
0846     READ_PROLOGUE
0847     const QXmlStreamAttributes attrs(attributes());
0848 
0849     READ_ATTR_WITHOUT_NS(lastClr)
0850     color.get()->lastColor = Utils::ST_HexColorRGB_to_QColor(lastClr);
0851 //     debugMsooXml << "lastClr:" << color.get()->lastColor.name();
0852 
0853     // System color value. This color is based upon the value that this color
0854     // currently has within the system on which the document is being viewed.
0855     READ_ATTR_WITHOUT_NS_INTO(val, color.get()->systemColor)
0856 //     debugMsooXml << "val:" << color.get()->systemColor;
0857 
0858     readNext();
0859     READ_EPILOGUE_WITHOUT_RETURN
0860     m_currentColor_local = color.release();
0861 
0862     return KoFilter::OK;
0863 }
0864 
0865 //! @todo !!!!!!!!!!!!!MERGE with Document Reader!!!!!!!!!!!!!
0866 #undef CURRENT_EL
0867 #define CURRENT_EL fmtScheme
0868 //! fmtScheme (Format Scheme)
0869 /*! ECMA-376, 20.1.4.1.14, p.3110.
0870  Parent elements:
0871  - [done] themeElements (§20.1.6.10)
0872  - themeOverride (§20.1.6.12)
0873  Child elements:
0874  - [done] bgFillStyleLst (Background Fill Style List) §20.1.4.1.7
0875  - effectStyleLst (Effect Style List) §20.1.4.1.12
0876  - [done] fillStyleLst (Fill Style List) §20.1.4.1.13
0877  - [done] lnStyleLst (Line Style List) §20.1.4.1.21*/
0878 KoFilter::ConversionStatus MsooXmlThemesReader::read_fmtScheme()
0879 {
0880     READ_PROLOGUE
0881     while (!atEnd()) {
0882         readNext();
0883         BREAK_IF_END_OF(CURRENT_EL)
0884         if (isStartElement()) {
0885             TRY_READ_IF(bgFillStyleLst)
0886             ELSE_TRY_READ_IF(fillStyleLst)
0887             ELSE_TRY_READ_IF(lnStyleLst)
0888             SKIP_UNKNOWN
0889         }
0890     }
0891     READ_EPILOGUE
0892 }
0893 
0894 #undef CURRENT_EL
0895 #define CURRENT_EL lnStyleLst
0896 //! lnStyleLst (Line style list)
0897 //! ECMA-376, 20.1.4.1.21, p.3115
0898 /*!
0899   This element defines a list of three line styles for use within a
0900   theme. The three line styles are arranged in order from subtle to
0901   moderate to intense versions of lines. This list makes up part of
0902   the style matrix.
0903 
0904   Parent elements:
0905   - [done] fmtScheme (§20.1.4.1.14)
0906 
0907   Child elements:
0908   - [done] ln (Outline) (§20.1.2.2.24)
0909 */
0910 KoFilter::ConversionStatus MsooXmlThemesReader::read_lnStyleLst()
0911 {
0912     READ_PROLOGUE
0913 
0914     QList<KoGenStyle> *list = &m_context->theme->formatScheme.lnStyleLst;
0915 
0916     while (!atEnd()) {
0917         readNext();
0918         BREAK_IF_END_OF(CURRENT_EL)
0919         if (isStartElement()) {
0920             pushCurrentDrawStyle(new KoGenStyle(KoGenStyle::GraphicAutoStyle, "graphic"));
0921             TRY_READ_IF(ln)
0922             list->append(*m_currentDrawStyle);
0923             popCurrentDrawStyle();
0924         }
0925     }
0926 
0927     READ_EPILOGUE
0928 }
0929 
0930 KoFilter::ConversionStatus MsooXmlThemesReader::fillStyleReadHelper(int& index)
0931 {
0932     QXmlStreamAttributes attrs;
0933 
0934     if (isStartElement()) {
0935         QString element = qualifiedName().toString();
0936         if (element == "a:gradFill") {
0937             QVector<qreal> shadeModifiers;
0938             QVector<qreal> tintModifiers;
0939             QVector<qreal> satModifiers;
0940             QVector<int> alphaModifiers;
0941             QVector<int> gradPositions;
0942             QString gradAngle = "16200000"; // 270 degrees as the default, that is, from up to down
0943             while (!atEnd()) {
0944                 readNext();
0945                 if (isEndElement() && qualifiedName() == "a:gradFill") {
0946                     break;
0947                 }
0948                 else if (isStartElement() && qualifiedName() == "a:lin") {
0949                     attrs = attributes();
0950                     TRY_READ_ATTR_WITHOUT_NS(ang)
0951                     gradAngle = ang;
0952                 }
0953                 else if (isStartElement() && qualifiedName() == "a:gsLst") {
0954                     while (!atEnd()) {
0955                         readNext();
0956                         if (isEndElement() && qualifiedName() == "a:gsLst") {
0957                             break;
0958                         }
0959                         else if (isStartElement() && qualifiedName() == "a:gs") {
0960                             attrs = attributes();
0961                             TRY_READ_ATTR_WITHOUT_NS(pos)
0962                             int gradPosition = pos.toInt() / 1000;
0963                             qreal shadeModifier = 0;
0964                             qreal tintModifier = 0;
0965                             qreal satModifier = 0;
0966                             int alphaModifier = 0;
0967                             while (!atEnd()) {
0968                                 readNext();
0969                                 if (isEndElement() && qualifiedName() == "a:gs") {
0970                                     break;
0971                                 }
0972                                 else if (isStartElement() && qualifiedName() == "a:schemeClr") {
0973                                      while (!atEnd()) {
0974                                          readNext();
0975                                          if (isEndElement() && qualifiedName() == "a:schemeClr") {
0976                                              break;
0977                                          }
0978                                          else if (isStartElement()) {
0979                                              attrs = attributes();
0980                                              TRY_READ_ATTR_WITHOUT_NS(val)
0981                                              if (qualifiedName() == "a:tint") {
0982                                                  tintModifier = val.toInt()/100000.0;
0983                                              }
0984                                              else if (qualifiedName() == "a:shade") {
0985                                                  shadeModifier = val.toInt()/100000.0;
0986                                              }
0987                                              else if (qualifiedName() == "a:satMod") {
0988                                                  satModifier = val.toDouble()/100000.0;
0989                                              }
0990                                              else if (qualifiedName() == "a:alpha") {
0991                                                  alphaModifier = val.toInt()/1000;
0992                                              }
0993                                          }
0994                                      }
0995                                 }
0996                             }
0997                             gradPositions.push_back(gradPosition);
0998                             tintModifiers.push_back(tintModifier);
0999                             shadeModifiers.push_back(shadeModifier);
1000                             satModifiers.push_back(satModifier),
1001                             alphaModifiers.push_back(alphaModifier);
1002                         }
1003                     }
1004                 }
1005             }
1006             m_context->theme->formatScheme.fillStyles[index] = new DrawingMLGradientFill(shadeModifiers, tintModifiers,
1007                 satModifiers, alphaModifiers, gradPositions, gradAngle);
1008         }
1009         // Commented out for now, until there's a nice implementation for duotone effect
1010         /*else if (element == "a:blipFill") {
1011             readNext(); // Going to a:blip
1012             attrs = attributes();
1013             TRY_READ_ATTR_WITH_NS(r, embed)
1014             if (!r_embed.isEmpty()) {
1015                 const QString sourceName(m_relationships->target(m_path, m_file, r_embed));
1016                 QString destinationName = "Pictures/" + sourceName.mid(sourceName.lastIndexOf('/') + 1);
1017                 RETURN_IF_ERROR( m_import->copyFile(sourceName, destinationName, false) )
1018                 addManifestEntryForFile(destinationName);
1019                 addManifestEntryForPicturesDir();
1020                 m_context->theme->formatScheme.fillStyles[index] = new DrawingMLBlipFill(destinationName);
1021             }
1022             while (!atEnd()) {
1023                 readNext();
1024                 if (isEndElement() && qualifiedName() == element) {
1025                     break;
1026                 }
1027             }
1028         }*/
1029         else { //if (element == "a:solidFill") { //For now, let's have this as default
1030             m_context->theme->formatScheme.fillStyles[index] = new DrawingMLSolidFill;
1031             skipCurrentElement();
1032         } // todo, handle rest
1033         ++index;
1034     }
1035 
1036     return KoFilter::OK;
1037 }
1038 
1039 #undef CURRENT_EL
1040 #define CURRENT_EL fillStyleLst
1041 //! fillStyleLst (fill style list)
1042 KoFilter::ConversionStatus MsooXmlThemesReader::read_fillStyleLst()
1043 {
1044     READ_PROLOGUE
1045 
1046     int index = 1; // The first style goes to 1
1047 
1048     while (!atEnd()) {
1049         readNext();
1050         BREAK_IF_END_OF(CURRENT_EL)
1051         fillStyleReadHelper(index);
1052     }
1053     READ_EPILOGUE
1054 }
1055 
1056 #undef CURRENT_EL
1057 #define CURRENT_EL bgFillStyleLst
1058 //! bgFillStyleLst (background fill style list)
1059 KoFilter::ConversionStatus MsooXmlThemesReader::read_bgFillStyleLst()
1060 {
1061     READ_PROLOGUE
1062 
1063     int index = 1001; // The first style goes to 1001
1064 
1065     while (!atEnd()) {
1066         readNext();
1067         BREAK_IF_END_OF(CURRENT_EL)
1068         fillStyleReadHelper(index);
1069     }
1070     READ_EPILOGUE
1071 }
1072 
1073 //! @todo !!!!!!!!!!!!!MERGE with Document Reader!!!!!!!!!!!!!
1074 #undef CURRENT_EL
1075 #define CURRENT_EL fontScheme
1076 //! fontScheme (Font Scheme)
1077 /*! ECMA-376, 20.1.4.1.18, p.3114.
1078  Parent elements:
1079  - [done] themeElements (§20.1.6.10)
1080  - themeOverride (§20.1.6.12)
1081  Child elements:
1082  - extLst (Extension List) §20.1.2.2.15
1083  - [done] majorFont (Major Font) §20.1.4.1.24
1084  - [done] minorFont (Minor fonts) §20.1.4.1.25*/
1085 KoFilter::ConversionStatus MsooXmlThemesReader::read_fontScheme()
1086 {
1087     READ_PROLOGUE
1088     while (!atEnd()) {
1089         readNext();
1090         BREAK_IF_END_OF(CURRENT_EL)
1091         if (isStartElement()) {
1092             TRY_READ_IF(majorFont)
1093             ELSE_TRY_READ_IF(minorFont)
1094             SKIP_UNKNOWN
1095         }
1096     }
1097     READ_EPILOGUE
1098 }
1099 
1100 #undef CURRENT_EL
1101 #define CURRENT_EL majorFont
1102 //! majorFont (Major Font)
1103 KoFilter::ConversionStatus MsooXmlThemesReader::read_majorFont()
1104 {
1105     READ_PROLOGUE
1106     while (!atEnd()) {
1107         readNext();
1108         BREAK_IF_END_OF(CURRENT_EL)
1109         if (isStartElement()) {
1110             if (qualifiedName() == "a:latin") {
1111                 const QXmlStreamAttributes attrs(attributes());
1112                 TRY_READ_ATTR_WITHOUT_NS(typeface)
1113                 m_context->theme->fontScheme.majorFonts.latinTypeface = typeface;
1114             }
1115             else if (qualifiedName() == "a:ea") {
1116                 const QXmlStreamAttributes attrs(attributes());
1117                 TRY_READ_ATTR_WITHOUT_NS(typeface)
1118                 m_context->theme->fontScheme.minorFonts.eaTypeface = typeface;
1119             }
1120             else if (qualifiedName() == "a:cs") {
1121                 const QXmlStreamAttributes attrs(attributes());
1122                 TRY_READ_ATTR_WITHOUT_NS(typeface)
1123                 m_context->theme->fontScheme.minorFonts.csTypeface = typeface;
1124             }
1125             SKIP_UNKNOWN
1126         }
1127     }
1128     READ_EPILOGUE
1129 }
1130 
1131 #undef CURRENT_EL
1132 #define CURRENT_EL minorFont
1133 //! minorFont (Minor Font)
1134 KoFilter::ConversionStatus MsooXmlThemesReader::read_minorFont()
1135 {
1136     READ_PROLOGUE
1137     while (!atEnd()) {
1138         readNext();
1139         BREAK_IF_END_OF(CURRENT_EL)
1140         if (isStartElement()) {
1141             if (qualifiedName() == "a:latin") {
1142                 const QXmlStreamAttributes attrs(attributes());
1143                 TRY_READ_ATTR_WITHOUT_NS(typeface)
1144                 m_context->theme->fontScheme.minorFonts.latinTypeface = typeface;
1145             }
1146             else if (qualifiedName() == "a:ea") {
1147                 const QXmlStreamAttributes attrs(attributes());
1148                 TRY_READ_ATTR_WITHOUT_NS(typeface)
1149                 m_context->theme->fontScheme.minorFonts.eaTypeface = typeface;
1150             }
1151             else if (qualifiedName() == "a:cs") {
1152                 const QXmlStreamAttributes attrs(attributes());
1153                 TRY_READ_ATTR_WITHOUT_NS(typeface)
1154                 m_context->theme->fontScheme.minorFonts.csTypeface = typeface;
1155             }
1156             SKIP_UNKNOWN
1157         }
1158     }
1159     READ_EPILOGUE
1160 }
1161 
1162 KoFilter::ConversionStatus MsooXmlThemesReader::read_SKIP()
1163 {
1164     SKIP_EVERYTHING_AND_RETURN
1165 }
1166 
1167 #include "MsooXmlDrawingMLSharedImpl.h"