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 #ifndef WP1CONTENTLISTENER_H
00028 #define WP1CONTENTLISTENER_H
00029
00030 #include "WP1Listener.h"
00031 #include "WPXContentListener.h"
00032
00033 class WP1SubDocument;
00034
00035 typedef struct _WP1ContentParsingState WP1ContentParsingState;
00036 struct _WP1ContentParsingState
00037 {
00038 _WP1ContentParsingState();
00039 ~_WP1ContentParsingState();
00040 WPXString m_textBuffer;
00041 int m_numDeferredTabs;
00042 int m_footNoteNumber, m_endNoteNumber;
00043 private:
00044 _WP1ContentParsingState(const _WP1ContentParsingState&);
00045 _WP1ContentParsingState& operator=(const _WP1ContentParsingState&);
00046 };
00047
00048 class WP1ContentListener : public WP1Listener, protected WPXContentListener
00049 {
00050 public:
00051 WP1ContentListener(std::list<WPXPageSpan> &pageList, std::vector<WP1SubDocument *> &subDocuments, WPXHLListenerImpl *listenerImpl);
00052 ~WP1ContentListener();
00053
00054 void startDocument() { WPXContentListener::startDocument(); }
00055 void insertCharacter(const uint16_t character);
00056 void insertExtendedCharacter(const uint8_t extendedCharacter);
00057 void insertTab();
00058 void insertBreak(const uint8_t breakType) { WPXContentListener::insertBreak(breakType); }
00059 void insertEOL();
00060 void insertNote(const WPXNoteType noteType, WP1SubDocument *subDocument);
00061 void attributeChange(const bool isOn, const uint8_t attribute);
00062 void fontPointSize(const uint8_t pointSize);
00063 void fontId(const uint16_t id);
00064 void marginReset(const uint16_t leftMargin, const uint16_t rightMargin);
00065 void topMarginSet(const uint16_t ) {}
00066 void bottomMarginSet(const uint16_t ) {}
00067 void leftIndent(const uint16_t leftMarginOffset);
00068 void leftRightIndent(const uint16_t leftRightMarginOffset);
00069 void leftMarginRelease(const uint16_t release);
00070 void setTabs(const std::vector<WPXTabStop> tabStops);
00071 void headerFooterGroup(const uint8_t headerFooterDefinition, WP1SubDocument *subDocument);
00072 void suppressPageCharacteristics(const uint8_t ) {}
00073 void justificationChange(const uint8_t justification);
00074 void lineSpacingChange(const uint8_t spacing) { WPXContentListener::lineSpacingChange((float)((double)spacing/2.0f)); }
00075 void flushRightOn();
00076 void flushRightOff() {}
00077 void centerOn();
00078 void centerOff() {}
00079 void endDocument() { WPXContentListener::endDocument(); };
00080
00081 protected:
00082 using WPXContentListener::lineSpacingChange;
00083 void _handleSubDocument(const WPXSubDocument *subDocument, const bool isHeaderFooter, WPXTableList tableList, int nextTableIndice = 0);
00084
00085 void _flushText();
00086 void _changeList() {};
00087
00088 private:
00089 WP1ContentParsingState *m_parseState;
00090 std::vector<WP1SubDocument *> &m_subDocuments;
00091 WP1ContentListener(const WP1ContentListener&);
00092 WP1ContentListener& operator=(WP1ContentListener&);
00093 };
00094
00095 #endif