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  * Copyright (C) 2003 William Lachance (wrlach@gmail.com)
00004  * Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
00005  * Copyright (C) 2006-2007 Fridrich Strba (fridrich.strba@bluewin.ch)
00006  * Copyright (C) 2007 Novell, Inc. (http://www.novell.com)
00007  *
00008  * This library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Library General Public
00010  * License as published by the Free Software Foundation; either
00011  * version 2 of the License, or (at your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  * Library General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Library General Public
00019  * License along with this library; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
00021  *
00022  * For further information visit http://libwpd.sourceforge.net
00023  */
00024 
00025 /* "This product is not manufactured, approved, or supported by
00026  * Corel Corporation or Corel Corporation Limited."
00027  */
00028 
00029 #ifndef WP5STYLESLISTENER_H
00030 #define WP5STYLESLISTENER_H
00031 
00032 #include "WP5Listener.h"
00033 #include "WPXStylesListener.h"
00034 #include <vector>
00035 #include <list>
00036 #include "WPXPageSpan.h"
00037 #include "WPXTable.h"
00038 #include "WP5SubDocument.h"
00039 
00040 class WP5StylesListener : public WP5Listener, protected WPXStylesListener
00041 {
00042 public:
00043         WP5StylesListener(std::list<WPXPageSpan> &pageList, WPXTableList tableList, std::vector<WP5SubDocument *> &subDocuments);
00044 
00045         void startDocument() {}
00046         void startSubDocument() {}
00047         void setFont(const WPXString& /* fontName */, double /* fontSize */) {}
00048         void setTabs(const std::vector<WPXTabStop>& /* tabStops */, uint16_t /* tabOffset */) {}
00049         void insertCharacter(uint32_t /* character */)
00050         {
00051                 /*if (!isUndoOn())*/ m_currentPageHasContent = true;
00052         }
00053         void insertTab(uint8_t /* tabType */, double /* tabPosition */)
00054         {
00055                 /*if (!isUndoOn())*/ m_currentPageHasContent = true;
00056         }
00057         virtual void insertIndent(uint8_t /* indentType */, double /* indentPosition */)
00058         {
00059                 /*if (!isUndoOn())*/ m_currentPageHasContent = true;
00060         }
00061         void characterColorChange(uint8_t /* red */, uint8_t /* green */, uint8_t /* blue */) {};
00062         void insertEOL()
00063         {
00064                 /*if (!isUndoOn())*/ m_currentPageHasContent = true;
00065         }
00066         void insertBreak(uint8_t breakType);
00067         void attributeChange(bool /* isOn */, uint8_t /* attribute */) {}
00068         void lineSpacingChange(double /* lineSpacing */) {}
00069         void justificationChange(uint8_t /* justification */) {}
00070         void pageMarginChange(uint8_t side, uint16_t margin);
00071         void pageFormChange(uint16_t length, uint16_t width, WPXFormOrientation orientation);
00072         void marginChange(uint8_t side, uint16_t margin);
00073         void endDocument();
00074         void endSubDocument();
00075 
00076         void defineTable(uint8_t /* position */, uint16_t /* leftOffset */) {}
00077         void addTableColumnDefinition(uint32_t /* width */, uint32_t /* leftGutter */, uint32_t /* rightGutter */,
00078                                       uint32_t /* attributes */, uint8_t /* alignment */) {}
00079         void startTable();
00080         void insertRow(uint16_t rowHeight, bool isMinimumHeight, bool isHeaderRow);
00081         void insertCell(uint8_t colSpan, uint8_t rowSpan, uint8_t borderBits,
00082                         const RGBSColor *cellFgColor, const RGBSColor *cellBgColor,
00083                         const RGBSColor *cellBorderColor, WPXVerticalAlignment cellVerticalAlignment,
00084                         bool useCellAttributes, uint32_t cellAttributes);
00085         void endTable() {}
00086 
00087         void insertNoteReference(const WPXString& /* noteReference */) {};
00088         void insertNote(WPXNoteType /* noteType */, const WP5SubDocument * /* subDocument */) {};
00089         void headerFooterGroup(uint8_t headerFooterType, uint8_t occurenceBits, WP5SubDocument *subDocument);
00090         void suppressPageCharacteristics(uint8_t suppressCode);
00091 
00092         void boxOn(uint8_t /* positionAndType */, uint8_t /* alignment */, uint16_t /* width */, uint16_t /* height */, uint16_t /* x */, uint16_t /* y */) {};
00093         virtual void boxOff() {};
00094         virtual void insertGraphicsData(const WPXBinaryData * /* data */) {};
00095 
00096 protected:
00097         void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, int nextTableIndice = 0);
00098 
00099 private:
00100         WP5StylesListener(const WP5StylesListener &);
00101         WP5StylesListener &operator=(const WP5StylesListener &);
00102         WPXPageSpan m_currentPage, m_nextPage;
00103 
00104         WPXTableList m_tableList;
00105         WPXTable *m_currentTable;
00106         double m_tempMarginLeft, m_tempMarginRight;
00107         bool m_currentPageHasContent;
00108         bool m_isSubDocument;
00109         std::vector<WP5SubDocument *> &m_subDocuments;
00110         std::list<WPXPageSpan>::iterator m_pageListHardPageMark;
00111 };
00112 
00113 #endif /* WP5STYLESLISTENER_H */
00114 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */