filters

ExportFilter.h

00001 /*
00002    This file is part of the KDE project
00003    Copyright (C) 2001, 2002 Nicolas GOUTTE <goutte@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef EXPORTFILTERFULLPOWER_H
00022 #define EXPORTFILTERFULLPOWER_H
00023 
00024 #include <qvaluestack.h>
00025 
00026 #include <KWEFBaseWorker.h>
00027 
00028 class ListInfo
00029 {
00030 public:
00031     CounterData::Style m_typeList; 
00032     bool m_orderedList; 
00033 };
00034 
00035 class HtmlWorker : public KWEFBaseWorker
00036 {
00037 public:
00038     HtmlWorker(void) : m_ioDevice(NULL), m_streamOut(NULL) { }
00039     virtual ~HtmlWorker(void) { delete m_streamOut; delete m_ioDevice; }
00040 public:
00041     virtual bool doOpenFile(const QString& filenameOut, const QString& to);
00042     virtual bool doCloseFile(void); // Close file in normal conditions
00043     virtual bool doOpenDocument(void);
00044     virtual bool doCloseDocument(void);
00045     virtual bool doFullParagraph(const QString& paraText, const LayoutData& layout,
00046         const ValueListFormatData& paraFormatDataList);
00047     virtual bool doFullDocumentInfo(const KWEFDocumentInfo& docInfo);
00048     virtual bool doOpenTextFrameSet(void);
00049     virtual bool doCloseTextFrameSet(void);
00050     virtual bool doOpenHead(void); 
00051     virtual bool doCloseHead(void); 
00052     virtual bool doOpenBody(void); 
00053     virtual bool doCloseBody(void); 
00054 protected:
00055     virtual QString getStartOfListOpeningTag(const CounterData::Style typeList, bool& ordered)=0;
00060     virtual void openParagraph(const QString& strTag,
00061         const LayoutData& layout, QChar::Direction direction=QChar::DirL)=0;
00062     virtual void closeParagraph(const QString& strTag,
00063         const LayoutData& layout)=0;
00064     virtual void openSpan(const FormatData& formatOrigin, const FormatData& format)=0;
00065     virtual void closeSpan(const FormatData& formatOrigin, const FormatData& format)=0;
00066     virtual void writeDocType(void);
00067 
00068     virtual QString customCSSURL(void) const { return QString::null; }
00069 public:
00070     inline bool isXML  (void) const { return m_xml; }
00071     inline void setXML (const bool flag ) { m_xml=flag; }
00072     inline QTextCodec* getCodec(void) const { return m_codec; }
00073     inline void setCodec(QTextCodec* codec) { m_codec=codec; }
00074 protected:
00075     QString escapeHtmlText(const QString& strText) const;
00084     QString getAdditionalFileName(const QString& additionalName);
00085 private:
00086     void ProcessParagraphData ( const QString& strTag, const QString &paraText,
00087         const LayoutData& layout, const ValueListFormatData &paraFormatDataList);
00088     void formatTextParagraph(const QString& strText,
00089         const FormatData& formatOrigin, const FormatData& format);
00090     bool makeTable(const FrameAnchor& anchor);
00091     bool makeImage(const FrameAnchor& anchor);
00092 protected:
00093     QIODevice* m_ioDevice;
00094     QTextStream* m_streamOut;
00095     QTextCodec* m_codec; 
00096     QString m_strTitle;
00097     QString m_fileName; 
00098     QString m_strFileDir; 
00099     QString m_strSubDirectoryName; 
00100     QValueStack<ListInfo> m_listStack; 
00101     bool m_xml;
00102 };
00103 
00104 #endif /* EXPORTFILTERFULLPOWER_H */
KDE Home | KDE Accessibility Home | Description of Access Keys