Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

WP5ContentListener.h

Go to the documentation of this file.
00001 /* libwpd
00002  * Copyright (C) 2003 William Lachance (wrlach@gmail.com)
00003  * Copyright (C) 2003 Marc Maurer (uwog@uwog.net)
00004  * Copyright (C) 2005-2007 Fridrich Strba (fridrich.strba@bluewin.ch)
00005  * Copyright (C) 2007 Novell, Inc. (http://www.novell.com)
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Library General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Library General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Library General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
00020  *
00021  * For further information visit http://libwpd.sourceforge.net
00022  */
00023 
00024 /* "This product is not manufactured, approved, or supported by
00025  * Corel Corporation or Corel Corporation Limited."
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 "WPXString.h"
00035 #include "libwpd_internal.h"
00036 #include "WPXHLListenerImpl.h"
00037 #include <vector>
00038 
00039 typedef struct _WP5ContentParsingState WP5ContentParsingState;
00040 struct _WP5ContentParsingState
00041 {
00042         _WP5ContentParsingState();
00043         ~_WP5ContentParsingState();
00044         WPXString m_textBuffer;
00045         WPXString m_noteReference;
00046 
00047         WPXTableList m_tableList;
00048 };
00049 
00050 class WP5ContentListener : public WP5Listener, protected WPXContentListener
00051 {
00052 public:
00053         WP5ContentListener(std::list<WPXPageSpan> &pageList, std::vector<WP5SubDocument *> &subDocuments, WPXHLListenerImpl *listenerImpl);
00054         ~WP5ContentListener();
00055 
00056         void startDocument() { WPXContentListener::startDocument(); };
00057         void setFont(const WPXString &fontName, const float fontSize);
00058         void setTabs(const std::vector<WPXTabStop> &tabStops, const uint16_t tabOffset);
00059         void insertCharacter(const uint16_t character);
00060         void insertTab(const uint8_t tabType, const float tabPosition);
00061         void insertIndent(const uint8_t indentType, const float indentPosition);
00062         void insertEOL();
00063         void insertBreak(const uint8_t breakType) { WPXContentListener::insertBreak(breakType); };
00064         void lineSpacingChange(const float lineSpacing) { WPXContentListener::lineSpacingChange(lineSpacing); };
00065         void justificationChange(const uint8_t justification) { WPXContentListener::justificationChange(justification); };
00066         void characterColorChange(const uint8_t red, const uint8_t green, const uint8_t blue);
00067         void attributeChange(const bool isOn, const uint8_t attribute);
00068         void pageMarginChange(const uint8_t /* side */, const uint16_t /* margin */) {};
00069         void pageFormChange(const uint16_t /* length */, const uint16_t /* width */, const WPXFormOrientation /* orientation */) {};
00070         void marginChange(const uint8_t side, const uint16_t margin);
00071         void paragraphMarginChange(const uint8_t /* side */, const int16_t /* margin */) {};
00072         void endDocument() { WPXContentListener::endDocument(); };
00073 
00074         void defineTable(const uint8_t position, const uint16_t leftOffset);
00075         void addTableColumnDefinition(const uint32_t width, const uint32_t leftGutter, const uint32_t rightGutter,
00076                                 const uint32_t attributes, const uint8_t alignment);
00077         void startTable();
00078         void insertRow(const uint16_t rowHeight, const bool isMinimumHeight, const bool isHeaderRow);
00079         void insertCell(const uint8_t colSpan, const uint8_t rowSpan, const uint8_t borderBits,
00080                                 const RGBSColor * cellFgColor, const RGBSColor * cellBgColor, 
00081                                 const RGBSColor * cellBorderColor, const WPXVerticalAlignment cellVerticalAlignment, 
00082                                 const bool useCellAttributes, const uint32_t cellAttributes);
00083         void endTable();
00084 
00085         void insertNoteReference(const WPXString &noteReference);
00086         void insertNote(const WPXNoteType noteType, const WP5SubDocument *subDocument);
00087         void headerFooterGroup(const uint8_t headerFooterType, const uint8_t occurenceBits, WP5SubDocument *subDocument);
00088         void suppressPageCharacteristics(const uint8_t /* suppressCode */) {};
00089         
00090         void setDefaultFont(const WPXString &fontName, const float fontSize);
00091         
00092 protected:
00093         void _handleSubDocument(const WPXSubDocument *subDocument, const bool isHeaderFooter, WPXTableList tableList, int nextTableIndice = 0);
00094 
00095         void _flushText();
00096         void _changeList() {};
00097 
00098 private:
00099         WP5ContentListener(const WP5ContentListener&);
00100         WP5ContentListener& operator=(const WP5ContentListener&);
00101         WP5ContentParsingState *m_parseState;
00102         std::vector<WP5SubDocument *> &m_subDocuments;
00103         float m_defaultFontSize;
00104         WPXString m_defaultFontName;
00105 };
00106 
00107 #endif /* WP5CONTENTLISTENER_H */

Generated on Sat Aug 20 05:20:56 2022 for libwpd by doxygen 1.3.5