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  * Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
00004  * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch)
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
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(uint32_t /* character */)
00045         {
00046                 if (!isUndoOn()) m_currentPageHasContent = true;
00047         }
00048         void insertTab()
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         void insertEOL()
00057         {
00058                 if (!isUndoOn()) m_currentPageHasContent = true;
00059         }
00060         void insertBreak(uint8_t breakType);
00061         void attributeChange(bool /* isOn */, uint8_t /* attribute */) {}
00062         void lineSpacingChange(double /* lineSpacing */) {}
00063         void justificationChange(uint8_t /* justification */) {}
00064         void pageMarginChange(uint8_t side, uint16_t margin);
00065         void pageFormChange(uint16_t length, uint16_t width, WPXFormOrientation orientation);
00066         void marginChange(uint8_t side, uint16_t margin);
00067         void indentFirstLineChange(int16_t /* offset */) {}
00068         void setTabs(bool /* isRelative */, const std::vector<WPXTabStop> /* tabStops */) {}
00069         void columnChange(WPXTextColumnType /* columnType */, uint8_t /* numColumns */,
00070                           const std::vector<double> & /* columnWidth */, const std::vector<bool> & /* isFixedWidth */) {}
00071         void endDocument();
00072         void endSubDocument();
00073 
00074         void defineTable(uint8_t /* position */, uint16_t /* leftOffset */) {}
00075         void addTableColumnDefinition(uint32_t /* width */, uint32_t /* leftGutter */, uint32_t /* rightGutter */,
00076                                       uint32_t /* attributes */, uint8_t /* alignment */) {}
00077         void startTable();
00078         void insertRow();
00079         void insertCell();
00080         void closeCell() {}
00081         void closeRow() {}
00082         void setTableCellSpan(uint16_t /* colSpan */, uint16_t /* rowSpan */) {}
00083         void setTableCellFillColor(const RGBSColor * /* cellFillColor */) {}
00084         void endTable() {}
00085         void undoChange(uint8_t undoType, uint16_t undoLevel);
00086         void setTextColor(const RGBSColor * /* fontColor */) {}
00087         void setTextFont(const WPXString& /* fontName */) {}
00088         void setFontSize(uint16_t /* fontSize */) {}
00089         void insertPageNumber(const WPXString & /* pageNumber */) {}
00090         void insertNoteReference(const WPXString & /* noteReference */) {}
00091         void insertNote(WPXNoteType /* noteType */, const WP3SubDocument * /* subDocument */)
00092         {
00093                 if (!isUndoOn()) m_currentPageHasContent = true;
00094         }
00095         void headerFooterGroup(uint8_t headerFooterType, uint8_t occurenceBits, WP3SubDocument *subDocument);
00096         void suppressPage(uint16_t suppressCode);
00097         void backTab()
00098         {
00099                 if (!isUndoOn()) m_currentPageHasContent = true;
00100         }
00101         void leftIndent() {}
00102         void leftIndent(double /* offset */) {}
00103         void leftRightIndent() {}
00104         void leftRightIndent(double /* offset */) {}
00105         void insertPicture(double /* height */, double /* width */, double /* verticalOffset */, double /* horizontalOffset */, uint8_t /* leftColumn */, uint8_t /* rightColumn */,
00106                            uint16_t /* figureFlags */, const WPXBinaryData & /* binaryData */) {}
00107         void insertTextBox(double /* height */, double /* width */, double /* verticalOffset */, double /* horizontalOffset */, uint8_t /* leftColumn */, uint8_t /* rightColumn */,
00108                            uint16_t /* figureFlags */, const WP3SubDocument * /* subDocument */, const WP3SubDocument * /* caption */) {}
00109         void insertWP51Table(double /* height */, double /* width */, double /* verticalOffset */, double /* horizontalOffset */, uint8_t /* leftColumn */, uint8_t /* rightColumn */,
00110                              uint16_t /* figureFlags */, const WP3SubDocument * /* subDocument */, const WP3SubDocument * /* caption */) {}
00111 
00112 protected:
00113         void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, int nextTableIndice = 0);
00114 
00115 private:
00116         WP3StylesListener(const WP3StylesListener &);
00117         WP3StylesListener &operator=(const WP3StylesListener &);
00118         WPXPageSpan m_currentPage;
00119 
00120         WPXTableList m_tableList;
00121         WPXTable *m_currentTable;
00122         double m_tempMarginLeft, m_tempMarginRight;
00123         bool m_currentPageHasContent;
00124         bool m_isSubDocument;
00125         std::vector<WP3SubDocument *> &m_subDocuments;
00126         std::list<WPXPageSpan>::iterator m_pageListHardPageMark;
00127 };
00128 
00129 #endif /* WP3STYLESLISTENER_H */
00130 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */