WP3StylesListener.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) 2004 Marc Maurer (uwog@uwog.net)
00011  * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch)
00012  *
00013  * For minor contributions see the git repository.
00014  *
00015  * Alternatively, the contents of this file may be used under the terms
00016  * of the GNU Lesser General Public License Version 2.1 or later
00017  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
00018  * applicable instead of those above.
00019  *
00020  * For further information visit http://libwpd.sourceforge.net
00021  */
00022 
00023 /* "This product is not manufactured, approved, or supported by
00024  * Corel Corporation or Corel Corporation Limited."
00025  */
00026 
00027 #ifndef WP3STYLESLISTENER_H
00028 #define WP3STYLESLISTENER_H
00029 
00030 #include "WP3Listener.h"
00031 #include "WPXStylesListener.h"
00032 #include <vector>
00033 #include <set>
00034 #include "WPXPageSpan.h"
00035 #include "WPXTable.h"
00036 
00037 class WP3StylesListener : public WP3Listener, protected WPXStylesListener
00038 {
00039 public:
00040         WP3StylesListener(std::list<WPXPageSpan> &pageList, WPXTableList tableList, std::vector<WP3SubDocument *> &subDocuments);
00041 
00042         void startDocument() {}
00043         void startSubDocument() {}
00044         void insertCharacter(unsigned /* character */)
00045         {
00046                 if (!isUndoOn()) m_currentPageHasContent = true;
00047         }
00048         void insertTab()
00049         {
00050                 if (!isUndoOn()) m_currentPageHasContent = true;
00051         }
00052         void insertTab(unsigned char /* tabType */, double /* tabPosition */)
00053         {
00054                 if (!isUndoOn()) m_currentPageHasContent = true;
00055         }
00056         void insertEOL()
00057         {
00058                 if (!isUndoOn()) m_currentPageHasContent = true;
00059         }
00060         void insertBreak(unsigned char breakType);
00061         void attributeChange(bool /* isOn */, unsigned char /* attribute */) {}
00062         void lineSpacingChange(double /* lineSpacing */) {}
00063         void justificationChange(unsigned char /* justification */) {}
00064         void pageMarginChange(unsigned char side, unsigned short margin);
00065         void pageFormChange(unsigned short length, unsigned short width, WPXFormOrientation orientation);
00066         void marginChange(unsigned char side, unsigned short margin);
00067         void indentFirstLineChange(double /* offset */) {}
00068         void setTabs(bool /* isRelative */, const std::vector<WPXTabStop> /* tabStops */) {}
00069         void columnChange(WPXTextColumnType /* columnType */, unsigned char /* numColumns */,
00070                           const std::vector<double> & /* columnWidth */, const std::vector<bool> & /* isFixedWidth */) {}
00071         void endDocument();
00072         void endSubDocument();
00073 
00074         void defineTable(unsigned char /* position */, unsigned short /* leftOffset */) {}
00075         void addTableColumnDefinition(unsigned /* width */, unsigned /* leftGutter */, unsigned /* rightGutter */,
00076                                       unsigned /* attributes */, unsigned char /* alignment */) {}
00077         void startTable();
00078         void closeCell() {}
00079         void closeRow() {}
00080         void setTableCellSpan(unsigned short /* colSpan */, unsigned short /* rowSpan */) {}
00081         void setTableCellFillColor(const RGBSColor * /* cellFillColor */) {}
00082         void endTable() {}
00083         void undoChange(unsigned char undoType, unsigned short undoLevel);
00084         void setTextColor(const RGBSColor * /* fontColor */) {}
00085         void setTextFont(const librevenge::RVNGString & /* fontName */) {}
00086         void setFontSize(unsigned short /* fontSize */) {}
00087         void insertPageNumber(const librevenge::RVNGString & /* pageNumber */) {}
00088         void insertNoteReference(const librevenge::RVNGString & /* noteReference */) {}
00089         void insertNote(WPXNoteType /* noteType */, const WP3SubDocument * /* subDocument */)
00090         {
00091                 if (!isUndoOn()) m_currentPageHasContent = true;
00092         }
00093         void headerFooterGroup(unsigned char headerFooterType, unsigned char occurrenceBits, WP3SubDocument *subDocument);
00094         void suppressPage(unsigned short suppressCode);
00095         void backTab()
00096         {
00097                 if (!isUndoOn()) m_currentPageHasContent = true;
00098         }
00099         void leftIndent() {}
00100         void leftIndent(double /* offset */) {}
00101         void leftRightIndent() {}
00102         void leftRightIndent(double /* offset */) {}
00103         void insertPicture(double /* height */, double /* width */, double /* verticalOffset */, double /* horizontalOffset */, unsigned char /* leftColumn */, unsigned char /* rightColumn */,
00104                            unsigned short /* figureFlags */, const librevenge::RVNGBinaryData & /* binaryData */) {}
00105         void insertTextBox(double /* height */, double /* width */, double /* verticalOffset */, double /* horizontalOffset */, unsigned char /* leftColumn */, unsigned char /* rightColumn */,
00106                            unsigned short /* figureFlags */, const WP3SubDocument * /* subDocument */, const WP3SubDocument * /* caption */) {}
00107         void insertWP51Table(double /* height */, double /* width */, double /* verticalOffset */, double /* horizontalOffset */, unsigned char /* leftColumn */, unsigned char /* rightColumn */,
00108                              unsigned short /* figureFlags */, const WP3SubDocument * /* subDocument */, const WP3SubDocument * /* caption */) {}
00109 
00110 protected:
00111         void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, int nextTableIndice = 0);
00112 
00113 private:
00114         WP3StylesListener(const WP3StylesListener &);
00115         WP3StylesListener &operator=(const WP3StylesListener &);
00116         WPXPageSpan m_currentPage;
00117 
00118         WPXTableList m_tableList;
00119         WPXTable *m_currentTable;
00120         double m_tempMarginLeft, m_tempMarginRight;
00121         bool m_currentPageHasContent;
00122         bool m_isSubDocument;
00123         std::vector<WP3SubDocument *> &m_subDocuments;
00124         std::list<WPXPageSpan>::iterator m_pageListHardPageMark;
00125 };
00126 
00127 #endif /* WP3STYLESLISTENER_H */
00128 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */