WP1StylesListener.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 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 WP1STYLESLISTENER_H
00029 #define WP1STYLESLISTENER_H
00030 
00031 #include "WP1Listener.h"
00032 #include "WP1SubDocument.h"
00033 #include "WPXStylesListener.h"
00034 #include <vector>
00035 #include "WPXPageSpan.h"
00036 #include "WPXTable.h"
00037 
00038 class WP1StylesListener : public WP1Listener, protected WPXStylesListener
00039 {
00040 public:
00041         WP1StylesListener(std::list<WPXPageSpan> &pageList, std::vector<WP1SubDocument *> &subDocuments);
00042         ~WP1StylesListener() {}
00043 
00044         void startDocument() {}
00045         void startSubDocument() {}
00046         void insertCharacter(unsigned /* character */)
00047         {
00048                 if (!isUndoOn()) m_currentPageHasContent = true;
00049         }
00050         void insertExtendedCharacter(unsigned char /* extendedCharacter */)
00051         {
00052                 if (!isUndoOn()) m_currentPageHasContent = true;
00053         }
00054         void insertTab()
00055         {
00056                 if (!isUndoOn()) m_currentPageHasContent = true;
00057         }
00058         void insertEOL()
00059         {
00060                 if (!isUndoOn()) m_currentPageHasContent = true;
00061         }
00062         void insertBreak(unsigned char breakType);
00063         void insertNote(WPXNoteType /* noteType */, WP1SubDocument * /* subDocument */) {}
00064         void attributeChange(bool /* isOn */, unsigned char /* attribute */) {}
00065         void fontPointSize(unsigned char /* pointSize */) {}
00066         void fontId(unsigned short /* id */) {}
00067         void marginReset(unsigned short leftMargin, unsigned short rightMargin);
00068         void topMarginSet(unsigned short topMargin);
00069         void bottomMarginSet(unsigned short bottomMargin);
00070         void leftIndent(unsigned short /* leftMarginOffset */)
00071         {
00072                 if (!isUndoOn()) m_currentPageHasContent = true;
00073         }
00074         void leftRightIndent(unsigned short /* leftRightMarginOffset */)
00075         {
00076                 if (!isUndoOn()) m_currentPageHasContent = true;
00077         }
00078         void leftMarginRelease(unsigned short /* release */) {}
00079         void setTabs(const std::vector<WPXTabStop> & /* tabStops */) {}
00080         void headerFooterGroup(unsigned char headerFooterDefinition, WP1SubDocument *subDocument);
00081         void suppressPageCharacteristics(unsigned char suppressCode);
00082         void justificationChange(unsigned char /* justification */) {}
00083         void lineSpacingChange(unsigned char /* spacing */) {}
00084         void flushRightOn() {}
00085         void flushRightOff() {}
00086         void centerOn() {}
00087         void centerOff() {}
00088         void endDocument();
00089         void endSubDocument();
00090         void insertPicture(unsigned short /* width */, unsigned short /* height */, const librevenge::RVNGBinaryData & /* binaryData */) {}
00091 
00092 protected:
00093         void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, int nextTableIndice = 0);
00094 
00095 private:
00096         WPXPageSpan m_currentPage, m_nextPage;
00097         std::vector<WP1SubDocument *> &m_subDocuments;
00098         double m_tempMarginLeft, m_tempMarginRight;
00099         bool m_currentPageHasContent;
00100         bool m_isSubDocument;
00101         std::list<WPXPageSpan>::iterator m_pageListHardPageMark;
00102 };
00103 
00104 #endif /* WP1STYLESLISTENER_H */
00105 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */