Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef WP5CONTENTLISTENER_H
00029 #define WP5CONTENTLISTENER_H
00030
00031 #include "WP5Listener.h"
00032 #include "WPXContentListener.h"
00033 #include "WP5SubDocument.h"
00034 #include "libwpd_internal.h"
00035 #include <vector>
00036
00037 typedef struct _WP5ContentParsingState WP5ContentParsingState;
00038 struct _WP5ContentParsingState
00039 {
00040 _WP5ContentParsingState();
00041 ~_WP5ContentParsingState();
00042 librevenge::RVNGString m_textBuffer;
00043 librevenge::RVNGString m_noteReference;
00044
00045 WPXTableList m_tableList;
00046
00047 bool m_isFrameOpened;
00048 };
00049
00050 class WP5ContentListener : public WP5Listener, protected WPXContentListener
00051 {
00052 public:
00053 WP5ContentListener(std::list<WPXPageSpan> &pageList, std::vector<WP5SubDocument *> &subDocuments, librevenge::RVNGTextInterface *documentInterface);
00054 ~WP5ContentListener();
00055
00056 void startDocument()
00057 {
00058 WPXContentListener::startDocument();
00059 }
00060 void startSubDocument()
00061 {
00062 WPXContentListener::startSubDocument();
00063 }
00064 void setFont(const librevenge::RVNGString &fontName, double fontSize);
00065 void setTabs(const std::vector<WPXTabStop> &tabStops, unsigned short tabOffset);
00066 void insertCharacter(unsigned character);
00067 void insertTab(unsigned char tabType, double tabPosition);
00068 void insertIndent(unsigned char indentType, double indentPosition);
00069 void insertEOL();
00070 void insertBreak(unsigned char breakType)
00071 {
00072 WPXContentListener::insertBreak(breakType);
00073 }
00074 void lineSpacingChange(double lineSpacing)
00075 {
00076 WPXContentListener::lineSpacingChange(lineSpacing);
00077 }
00078 void justificationChange(unsigned char justification)
00079 {
00080 WPXContentListener::justificationChange(justification);
00081 }
00082 void characterColorChange(unsigned char red, unsigned char green, unsigned char blue);
00083 void attributeChange(bool isOn, unsigned char attribute);
00084 void pageMarginChange(unsigned char , unsigned short ) {}
00085 void pageFormChange(unsigned short , unsigned short , WPXFormOrientation ) {}
00086 void marginChange(unsigned char side, unsigned short margin);
00087 void paragraphMarginChange(unsigned char , signed short ) {}
00088 void endDocument()
00089 {
00090 WPXContentListener::endDocument();
00091 }
00092 void endSubDocument()
00093 {
00094 WPXContentListener::endSubDocument();
00095 }
00096
00097 void defineTable(unsigned char position, unsigned short leftOffset);
00098 void addTableColumnDefinition(unsigned width, unsigned leftGutter, unsigned rightGutter,
00099 unsigned attributes, unsigned char alignment);
00100 void startTable();
00101 void insertRow(unsigned short rowHeight, bool isMinimumHeight, bool isHeaderRow);
00102 void insertCell(unsigned char colSpan, unsigned char rowSpan, unsigned char borderBits,
00103 const RGBSColor *cellFgColor, const RGBSColor *cellBgColor,
00104 const RGBSColor *cellBorderColor, WPXVerticalAlignment cellVerticalAlignment,
00105 bool useCellAttributes, unsigned cellAttributes);
00106 void endTable();
00107
00108 void insertNoteReference(const librevenge::RVNGString ¬eReference);
00109 void insertNote(WPXNoteType noteType, const WP5SubDocument *subDocument);
00110 void headerFooterGroup(unsigned char headerFooterType, unsigned char occurrenceBits, WP5SubDocument *subDocument);
00111 void suppressPageCharacteristics(unsigned char ) {}
00112
00113 void setDefaultFont(const librevenge::RVNGString &fontName, double fontSize);
00114
00115 void boxOn(unsigned char positionAndType, unsigned char alignment, unsigned short width, unsigned short height, unsigned short x, unsigned short y);
00116 virtual void boxOff();
00117 virtual void insertGraphicsData(const librevenge::RVNGBinaryData *data);
00118
00119 protected:
00120 void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice = 0);
00121
00122 void _flushText();
00123 void _changeList() {}
00124
00125 private:
00126 WP5ContentListener(const WP5ContentListener &);
00127 WP5ContentListener &operator=(const WP5ContentListener &);
00128 WP5ContentParsingState *m_parseState;
00129 std::vector<WP5SubDocument *> &m_subDocuments;
00130 double m_defaultFontSize;
00131 librevenge::RVNGString m_defaultFontName;
00132 };
00133
00134 #endif
00135