WP5StylesListener.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
00002 /* libwpd
00003  * Version: MPL 2.0 / LGPLv2.1+
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  *
00009  * Major Contributor(s):
00010  * Copyright (C) 2003 William Lachance (wrlach@gmail.com)
00011  * Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
00012  * Copyright (C) 2006-2007 Fridrich Strba (fridrich.strba@bluewin.ch)
00013  *
00014  * For minor contributions see the git repository.
00015  *
00016  * Alternatively, the contents of this file may be used under the terms
00017  * of the GNU Lesser General Public License Version 2.1 or later
00018  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
00019  * applicable instead of those above.
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 WP5STYLESLISTENER_H
00029 #define WP5STYLESLISTENER_H
00030 
00031 #include "WP5Listener.h"
00032 #include "WPXStylesListener.h"
00033 #include <vector>
00034 #include <list>
00035 #include "WPXPageSpan.h"
00036 #include "WPXTable.h"
00037 #include "WP5SubDocument.h"
00038 
00039 class WP5StylesListener : public WP5Listener, protected WPXStylesListener
00040 {
00041 public:
00042         WP5StylesListener(std::list<WPXPageSpan> &pageList, WPXTableList tableList, std::vector<WP5SubDocument *> &subDocuments);
00043 
00044         void startDocument() {}
00045         void startSubDocument() {}
00046         void setFont(const WPXString & /* fontName */, double /* fontSize */) {}
00047         void setTabs(const std::vector<WPXTabStop> & /* tabStops */, uint16_t /* tabOffset */) {}
00048         void insertCharacter(uint32_t /* character */)
00049         {
00050                 /*if (!isUndoOn())*/ m_currentPageHasContent = true;
00051         }
00052         void insertTab(uint8_t /* tabType */, double /* tabPosition */)
00053         {
00054                 /*if (!isUndoOn())*/ m_currentPageHasContent = true;
00055         }
00056         virtual void insertIndent(uint8_t /* indentType */, double /* indentPosition */)
00057         {
00058                 /*if (!isUndoOn())*/ m_currentPageHasContent = true;
00059         }
00060         void characterColorChange(uint8_t /* red */, uint8_t /* green */, uint8_t /* blue */) {}
00061         void insertEOL()
00062         {
00063                 /*if (!isUndoOn())*/ m_currentPageHasContent = true;
00064         }
00065         void insertBreak(uint8_t breakType);
00066         void attributeChange(bool /* isOn */, uint8_t /* attribute */) {}
00067         void lineSpacingChange(double /* lineSpacing */) {}
00068         void justificationChange(uint8_t /* justification */) {}
00069         void pageMarginChange(uint8_t side, uint16_t margin);
00070         void pageFormChange(uint16_t length, uint16_t width, WPXFormOrientation orientation);
00071         void marginChange(uint8_t side, uint16_t margin);
00072         void endDocument();
00073         void endSubDocument();
00074 
00075         void defineTable(uint8_t /* position */, uint16_t /* leftOffset */) {}
00076         void addTableColumnDefinition(uint32_t /* width */, uint32_t /* leftGutter */, uint32_t /* rightGutter */,
00077                                       uint32_t /* attributes */, uint8_t /* alignment */) {}
00078         void startTable();
00079         void insertRow(uint16_t rowHeight, bool isMinimumHeight, bool isHeaderRow);
00080         void insertCell(uint8_t colSpan, uint8_t rowSpan, uint8_t borderBits,
00081                         const RGBSColor *cellFgColor, const RGBSColor *cellBgColor,
00082                         const RGBSColor *cellBorderColor, WPXVerticalAlignment cellVerticalAlignment,
00083                         bool useCellAttributes, uint32_t cellAttributes);
00084         void endTable() {}
00085 
00086         void insertNoteReference(const WPXString & /* noteReference */) {}
00087         void insertNote(WPXNoteType /* noteType */, const WP5SubDocument * /* subDocument */) {}
00088         void headerFooterGroup(uint8_t headerFooterType, uint8_t occurenceBits, WP5SubDocument *subDocument);
00089         void suppressPageCharacteristics(uint8_t suppressCode);
00090 
00091         void boxOn(uint8_t /* positionAndType */, uint8_t /* alignment */, uint16_t /* width */, uint16_t /* height */, uint16_t /* x */, uint16_t /* y */) {}
00092         virtual void boxOff() {}
00093         virtual void insertGraphicsData(const WPXBinaryData * /* data */) {}
00094 
00095 protected:
00096         void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, int nextTableIndice = 0);
00097 
00098 private:
00099         WP5StylesListener(const WP5StylesListener &);
00100         WP5StylesListener &operator=(const WP5StylesListener &);
00101         WPXPageSpan m_currentPage, m_nextPage;
00102 
00103         WPXTableList m_tableList;
00104         WPXTable *m_currentTable;
00105         double m_tempMarginLeft, m_tempMarginRight;
00106         bool m_currentPageHasContent;
00107         bool m_isSubDocument;
00108         std::vector<WP5SubDocument *> &m_subDocuments;
00109         std::list<WPXPageSpan>::iterator m_pageListHardPageMark;
00110 };
00111 
00112 #endif /* WP5STYLESLISTENER_H */
00113 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */