Warning, file /office/calligra/filters/libmsooxml/MsooXmlTheme.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
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 #ifndef MSOOXMLTHEME_H 0025 #define MSOOXMLTHEME_H 0026 0027 #include <QHash> 0028 #include <QVector> 0029 #include <QColor> 0030 #include <QMap> 0031 0032 #include <KoGenStyles.h> 0033 0034 #include "komsooxml_export.h" 0035 0036 0037 namespace MSOOXML 0038 { 0039 0040 class DrawingMLColorSchemeItem; 0041 class DrawingMLColorSchemeSystemItem; 0042 0043 //! @todo add other classes inheriting DrawingMLColorSchemeItemBase 0044 class KOMSOOXML_EXPORT DrawingMLColorSchemeItemBase 0045 { 0046 public: 0047 DrawingMLColorSchemeItemBase(); 0048 virtual ~DrawingMLColorSchemeItemBase(); 0049 DrawingMLColorSchemeItem* toColorItem(); 0050 DrawingMLColorSchemeSystemItem* toSystemItem(); 0051 virtual QColor value() const = 0; 0052 virtual DrawingMLColorSchemeItemBase* clone() const = 0; 0053 }; 0054 0055 class KOMSOOXML_EXPORT DrawingMLColorSchemeItem : public DrawingMLColorSchemeItemBase 0056 { 0057 public: 0058 DrawingMLColorSchemeItem(); 0059 QColor value() const override { return color; } 0060 QColor color; 0061 DrawingMLColorSchemeItem* clone() const override { return new DrawingMLColorSchemeItem(*this); } 0062 }; 0063 0064 class KOMSOOXML_EXPORT DrawingMLColorSchemeSystemItem : public DrawingMLColorSchemeItemBase 0065 { 0066 public: 0067 DrawingMLColorSchemeSystemItem(); 0068 QColor value() const override; 0069 0070 QColor lastColor; 0071 QString systemColor; //!< ST_SystemColorVal (§20.1.10.58).; 0072 DrawingMLColorSchemeSystemItem* clone() const override { return new DrawingMLColorSchemeSystemItem(*this); } 0073 }; 0074 0075 typedef QHash<QString, DrawingMLColorSchemeItemBase*> DrawingMLColorSchemeItemHash; 0076 0077 //! Implements color scheme, based on hash. All items are owned by this object. 0078 class KOMSOOXML_EXPORT DrawingMLColorScheme : public DrawingMLColorSchemeItemHash 0079 { 0080 public: 0081 DrawingMLColorScheme(); 0082 ~DrawingMLColorScheme(); 0083 0084 DrawingMLColorSchemeItemBase* value(const QString& name) const { 0085 return DrawingMLColorSchemeItemHash::value(name); 0086 } 0087 0088 /*! @return color value for index. Needed because while PPTX uses lookup by 0089 name: value(QString&), XLSX uses lookup by index. When index is 0090 invalid, 0 is returned. */ 0091 DrawingMLColorSchemeItemBase* value(int index) const; 0092 0093 DrawingMLColorScheme(const DrawingMLColorScheme& scheme); 0094 DrawingMLColorScheme& operator=(const DrawingMLColorScheme& scheme); 0095 //! Name of the color scheme 0096 QString name; 0097 }; 0098 0099 //! Font set for majorFont and minorFont. 0100 //! @todo add more support for latin, ea and cs: charser, panose, pitchfamily attributes (21.1.2.3.3) 0101 class KOMSOOXML_EXPORT DrawingMLFontSet 0102 { 0103 public: 0104 DrawingMLFontSet(); 0105 //! A (script->typeface) hash with font definitions (20.1.4.1.16.) 0106 QHash<QString, QString> typefacesForScripts; 0107 0108 //! Specifies that a Latin font be used for a specific run of text. 0109 QString latinTypeface; 0110 0111 //! The possible values for this attribute are defined by the ST_TextTypeface simple type 0112 //! (§20.1.10.81). 0113 QString eaTypeface; 0114 //! The possible values for this attribute are defined by the ST_TextTypeface simple type 0115 //! (§20.1.10.81). 0116 QString csTypeface; 0117 }; 0118 0119 //! Defines the font scheme within the theme 0120 //! The font scheme consists of a pair of major and minor fonts for which to use in a document.s 0121 class KOMSOOXML_EXPORT DrawingMLFontScheme 0122 { 0123 public: 0124 DrawingMLFontScheme(); 0125 DrawingMLFontSet majorFonts; 0126 DrawingMLFontSet minorFonts; 0127 QString name; 0128 }; 0129 0130 0131 class KOMSOOXML_EXPORT DrawingMLFillBase 0132 { 0133 public: 0134 virtual ~DrawingMLFillBase(); 0135 // This function will create the fill style and fill the appropriate styles 0136 // and filePath if needed. 0137 // Number is used to index to correct style, color is the color which should be used when making the styles 0138 virtual void writeStyles(KoGenStyles& styles, KoGenStyle *graphicStyle, const QColor &color) = 0; 0139 0140 virtual DrawingMLFillBase* clone() const = 0; 0141 }; 0142 0143 class KOMSOOXML_EXPORT DrawingMLSolidFill : public DrawingMLFillBase 0144 { 0145 public: 0146 void writeStyles(KoGenStyles& styles, KoGenStyle *graphicStyle, const QColor &color) override; 0147 0148 DrawingMLSolidFill* clone() const override { return new DrawingMLSolidFill(*this); } 0149 }; 0150 0151 class KOMSOOXML_EXPORT DrawingMLBlipFill : public DrawingMLFillBase 0152 { 0153 public: 0154 explicit DrawingMLBlipFill(const QString &filePath); 0155 void writeStyles(KoGenStyles& styles, KoGenStyle *graphicStyle, const QColor &color) override; 0156 0157 DrawingMLBlipFill* clone() const override { return new DrawingMLBlipFill(*this); } 0158 0159 private: 0160 QString m_filePath; 0161 }; 0162 0163 class KOMSOOXML_EXPORT DrawingMLGradientFill : public DrawingMLFillBase 0164 { 0165 public: 0166 // Simplified gradient constructor 0167 DrawingMLGradientFill(const QVector<qreal> &shadeModifier, const QVector<qreal> &tintModifier, const QVector<qreal> &satModifier, 0168 const QVector<int> &alphaModifier, const QVector<int> &gradPositions, const QString &gradAngle); 0169 void writeStyles(KoGenStyles& styles, KoGenStyle *graphicStyle, const QColor &color) override; 0170 0171 DrawingMLGradientFill* clone() const override { return new DrawingMLGradientFill(*this); } 0172 0173 private: 0174 QVector<qreal> m_shadeModifier; 0175 QVector<qreal> m_tintModifier; 0176 QVector<qreal> m_satModifier; 0177 QVector<int> m_alphaModifier; 0178 QVector<int> m_gradPosition; 0179 QString m_gradAngle; 0180 }; 0181 0182 class KOMSOOXML_EXPORT DrawingMLFormatScheme 0183 { 0184 public: 0185 0186 DrawingMLFormatScheme(); 0187 ~DrawingMLFormatScheme(); 0188 QString name; 0189 0190 DrawingMLFormatScheme(const DrawingMLFormatScheme& format); 0191 DrawingMLFormatScheme& operator=(const DrawingMLFormatScheme& format); 0192 0193 QMap<int, DrawingMLFillBase*> fillStyles; 0194 0195 //! Stores the three line styles for use within a theme. 0196 QList<KoGenStyle> lnStyleLst; 0197 }; 0198 0199 //! Defines a single DrawingML theme. 0200 //! @todo support objectDefaults and extraClrSchemeLst 0201 class KOMSOOXML_EXPORT DrawingMLTheme 0202 { 0203 public: 0204 DrawingMLTheme(); 0205 QString name; 0206 DrawingMLColorScheme colorScheme; 0207 DrawingMLFontScheme fontScheme; 0208 DrawingMLFormatScheme formatScheme; 0209 }; 0210 0211 0212 } // namespace MSOOXML 0213 0214 #endif //MSOOXMLTHEME_H