filters

ExportFilter.h

00001 /*
00002    This file is part of the KDE project
00003    Copyright 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 #include <qvaluelist.h>
00026 #include <qstringlist.h>
00027 
00028 #include <KWEFBaseWorker.h>
00029 
00030 class ListInfo
00031 {
00032 public:
00033     CounterData::Style m_typeList; 
00034     bool m_orderedList; 
00035 };
00036 
00037 class RTFWorker : public KWEFBaseWorker
00038 {
00039 public:
00040     RTFWorker(void);
00041     virtual ~RTFWorker(void) { delete m_streamOut; delete m_ioDevice; }
00042 public:
00043     virtual bool doOpenFile(const QString& filenameOut, const QString& to);
00044     virtual bool doCloseFile(void); 
00045     virtual bool doOpenDocument(void);
00046     virtual bool doCloseDocument(void);
00047     virtual bool doFullParagraph(const QString& paraText, const LayoutData& layout,
00048         const ValueListFormatData& paraFormatDataList);
00049     virtual bool doFullDocumentInfo(const KWEFDocumentInfo& docInfo);
00050     virtual bool doOpenTextFrameSet(void);
00051     virtual bool doCloseTextFrameSet(void);
00052     virtual bool doFullPaperFormat(const int format,
00053         const double width, const double height, const int orientation);
00054     virtual bool doFullPaperBorders (const double top, const double left,
00055         const double bottom, const double right);
00056     virtual bool doFullDefineStyle(LayoutData& layout);
00057     virtual bool doHeader(const HeaderData& header);
00058     virtual bool doFooter(const FooterData& footer);
00059     virtual bool doVariableSettings(const VariableSettingsData& vs);
00060 
00061 private:
00062     QString openSpan(const FormatData& formatOrigin, const FormatData& format);
00063     QString closeSpan(const FormatData& formatOrigin, const FormatData& format);
00070     QString escapeRtfText ( const QString& text ) const;
00071     QString ProcessParagraphData ( const QString &paraText,
00072         const LayoutData& layout, const ValueListFormatData &paraFormatDataList);
00073     QString formatTextParagraph(const QString& strText,
00074         const FormatData& formatOrigin, const FormatData& format);
00075     QString makeTable(const FrameAnchor& anchor);
00076     bool convertUnknownPicture(const QString& strName, const QString& extension, QByteArray& image);
00077     QString makeImage(const FrameAnchor& anchor);
00078     void writeFontData(void);
00079     void writeColorData(void);
00080     void writeStyleData(void);
00081     QString textFormatToRtf(const TextFormatting& formatOrigin,
00082         const TextFormatting& formatData, const bool force);
00083     QString layoutToRtf(const LayoutData& layoutOrigin,
00084         const LayoutData& layout, const bool force);
00085     QString lookupFont(const QString& markup, const QString& fontName);
00086     QString lookupColor(const QString& markup, const QColor& color);
00087     QString lookupStyle(const QString& styleName, LayoutData& returnLayout);
00088     QString writeRow(const QString& textCellHeader, const QString& rowText, const FrameData& frame);
00089     QString writeBorder(const char whichBorder, const int borderWidth, const QColor& color);
00090 protected:
00091     QIODevice* m_ioDevice;
00092     QTextStream* m_streamOut;
00093     QString m_eol;
00094     QString m_textDocInfo;
00095     QString m_textPage;
00096     QString m_textBody;
00097     QString m_fileName; 
00098     QValueStack<ListInfo> m_listStack; 
00099     QStringList m_fontList;
00100     QValueList<QColor> m_colorList;
00101     QValueList<LayoutData> m_styleList;
00102     bool m_inTable;
00103     bool m_paperOrientation;
00104     double m_paperWidth, m_paperHeight;
00105     double m_paperMarginTop, m_paperMarginLeft, m_paperMarginBottom, m_paperMarginRight;
00106     QString m_prefix;
00107     int m_startPageNumber;
00108 };
00109 
00110 #endif /* EXPORTFILTERFULLPOWER_H */
KDE Home | KDE Accessibility Home | Description of Access Keys