1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
/*
* This file is part of Office 2007 Filters for Calligra
*
* Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
*
* Contact: Suresh Chande suresh.chande@nokia.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef MSOOXMLCOMMONREADER_H
#define MSOOXMLCOMMONREADER_H
#include <KoGenStyle.h>
#include <styles/KoCharacterStyle.h>
#include <styles/KoListLevelProperties.h>
#include "MsooXmlReader.h"
#include "MsooXmlUtils.h"
namespace MSOOXML
{
//! A class reading generic parts of MSOOXML main document's markup.
class KOMSOOXML_EXPORT MsooXmlCommonReader : public MsooXmlReader
{
protected:
explicit MsooXmlCommonReader(KoOdfWriters *writers);
MsooXmlCommonReader(QIODevice* io, KoOdfWriters *writers);
virtual ~MsooXmlCommonReader();
// -- for read_p()
enum read_p_arg {
read_p_Skip
};
Q_DECLARE_FLAGS(read_p_args, read_p_arg)
read_p_args m_read_p_args;
KoGenStyle* m_currentDrawStyle; //! used by all classes that need a graphics style.
QList<KoGenStyle*> m_drawStyleStack;
KoGenStyle m_currentGradientStyle;
void pushCurrentDrawStyle(KoGenStyle *newStyle);
void popCurrentDrawStyle();
//! Used for creating style in w:pPr (style:style/@style:name attr)
KoGenStyle m_currentParagraphStyle;
void setupParagraphStyle();
KoGenStyle m_currentTextStyle;
KoCharacterStyle* m_currentTextStyleProperties;
KoGenStyle m_currentListStyle;
MSOOXML::Utils::ParagraphBulletProperties m_currentBulletProperties;
// Properties for potentially all 9 lvls which are possible
QMap<int, MSOOXML::Utils::ParagraphBulletProperties> m_currentCombinedBulletProperties;
QMap<int, KoGenStyle> m_currentCombinedParagraphStyles;
QMap<int, KoGenStyle> m_currentCombinedTextStyles;
//! Style (from styles.xml) to apply to the current paragraph or similar element, set by read_pStyle()
QString m_currentStyleName;
bool isDefaultTocStyle(const QString& name) const;
//! Adds reference to a file in the ODF document to manifest.xml
//! The media-type attribute is based on the extension of @a path.
void addManifestEntryForFile(const QString& path);
//! Adds manifest entry for "Pictures/"
void addManifestEntryForPicturesDir();
//! value of recent pPr@lvl attribute; set by read_pPr()
uint m_pPr_lvl;
bool m_paragraphStyleNameWritten; //!< set by setupParagraphStyle()
bool m_addManifestEntryForPicturesDirExecuted;
bool m_moveToStylesXml;
QSize m_imageSize;
QSet<QString> m_copiedFiles; //!< collects source names to avoid multiple copying of media files
// //! Used for creating style names (style:style/@style:name attr)
// //! To achieve this, in XSLT it generate-id(.) for w:p is used.
// ////! Starts with 1. Updated in read_p();
// uint m_currentParagraphStyleNumber;
// QString currentParagraphStyleName() const;
private:
Q_DISABLE_COPY(MsooXmlCommonReader)
void init();
};
}
#endif
|