Warning, file /office/calligra/filters/libmsooxml/MsooXmlThemesReader.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 MSOOXMLTHEMESREADER_H
0025 #define MSOOXMLTHEMESREADER_H
0026 
0027 #include <QHash>
0028 #include <QColor>
0029 #include <QMap>
0030 
0031 #include <KoGenStyles.h>
0032 
0033 #include "MsooXmlCommonReader.h"
0034 #include "MsooXmlImport.h"
0035 #include "MsooXmlTheme.h"
0036 
0037 namespace MSOOXML
0038 {
0039 
0040 //! Context for MsooXmlThemesReader::read()
0041 class KOMSOOXML_EXPORT MsooXmlThemesReaderContext : public MsooXmlReaderContext
0042 {
0043 public:
0044     MsooXmlThemesReaderContext(DrawingMLTheme& t, MSOOXML::MsooXmlRelationships* rel,
0045                    MSOOXML::MsooXmlImport* imp,
0046                    const QString &pathName, const QString &fileName);
0047     DrawingMLTheme * const theme;
0048     MSOOXML::MsooXmlRelationships *relationships;
0049     MSOOXML::MsooXmlImport        *import;
0050     QString path;
0051     QString file;
0052 };
0053 
0054 //! A class reading MSOOXML themes markup - theme/theme1.xml.
0055 /*! @todo generalize for other MSOOXML subformats.
0056  */
0057 class KOMSOOXML_EXPORT MsooXmlThemesReader : public MSOOXML::MsooXmlCommonReader
0058 {
0059 public:
0060     //! Creates MsooXmlThemesReader object.
0061     //! On successful reading, @a theme will be written with theme definition.
0062     explicit MsooXmlThemesReader(KoOdfWriters *writers);
0063 
0064     ~MsooXmlThemesReader() override;
0065 
0066     //! Reads/parses the file. The output goes mainly to KoGenStyles* KoOdfWriters::mainStyles
0067     KoFilter::ConversionStatus read(MsooXmlReaderContext* context = 0) override;
0068 
0069 protected:
0070     KoFilter::ConversionStatus readInternal();
0071     KoFilter::ConversionStatus read_theme();
0072     KoFilter::ConversionStatus read_themeElements();
0073     //! @todo no CASE
0074     KoFilter::ConversionStatus read_objectDefaults();
0075     KoFilter::ConversionStatus read_custClrLst();
0076     KoFilter::ConversionStatus read_extraClrSchemeLst();
0077     KoFilter::ConversionStatus read_extraClrScheme();
0078 
0079     KoFilter::ConversionStatus read_clrScheme();
0080     KoFilter::ConversionStatus read_color(); //!< helper
0081     DrawingMLColorSchemeItemBase* m_currentColor_local; //!< used by *Clr()
0082 
0083     KoFilter::ConversionStatus read_fmtScheme();
0084     KoFilter::ConversionStatus read_fontScheme();
0085     KoFilter::ConversionStatus read_clrMap();
0086 
0087     KoFilter::ConversionStatus fillStyleReadHelper(int& index);
0088     KoFilter::ConversionStatus read_bgFillStyleLst();
0089     KoFilter::ConversionStatus read_fillStyleLst();
0090     KoFilter::ConversionStatus read_majorFont();
0091     KoFilter::ConversionStatus read_minorFont();
0092     KoFilter::ConversionStatus read_lnStyleLst();
0093 
0094     //! Used for skipping a subtree - just reads and shows each element.
0095     //! called by BIND_READ_SKIP() macro.
0096     KoFilter::ConversionStatus read_SKIP();
0097 
0098 #include "MsooXmlDrawingMLShared.h"
0099 
0100     KoFilter::ConversionStatus read_srgbClr_local();
0101     KoFilter::ConversionStatus read_sysClr_local();
0102 
0103 private:
0104     void init();
0105 
0106     MsooXmlThemesReaderContext* m_context;
0107 
0108     typedef KoFilter::ConversionStatus(MsooXmlThemesReader::*ReadMethod)();
0109     QHash<QString, ReadMethod> m_readMethods;
0110     QHash<QString, QString> m_colorSchemeIndices;
0111     bool m_clrScheme_initialized;
0112     bool m_color_initialized;
0113 
0114     MSOOXML::MsooXmlRelationships* m_relationships;
0115     MSOOXML::MsooXmlImport* m_import;
0116     QString m_path;
0117     QString m_file;
0118 };
0119 
0120 } // namespace MSOOXML
0121 
0122 #endif //MSOOXMLTHEMESREADER_H