WP3StylesListener.h

Go to the documentation of this file.
00001 /* libwpd
00002  * Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
00003  * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch)
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Library General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Library General Public
00016  * License along with this library; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
00018  *
00019  * For further information visit http://libwpd.sourceforge.net
00020  */
00021 
00022 /* "This product is not manufactured, approved, or supported by
00023  * Corel Corporation or Corel Corporation Limited."
00024  */
00025 
00026 #ifndef WP3STYLESLISTENER_H
00027 #define WP3STYLESLISTENER_H
00028 
00029 #include "WP3Listener.h"
00030 #include "WPXStylesListener.h"
00031 #include <vector>
00032 #include <set>
00033 #include "WPXPageSpan.h"
00034 #include "WPXTable.h"
00035 
00036 class WP3StylesListener : public WP3Listener, protected WPXStylesListener
00037 {
00038 public:
00039         WP3StylesListener(std::list<WPXPageSpan> &pageList, WPXTableList tableList, std::vector<WP3SubDocument *> &subDocuments);
00040 
00041         void startDocument() {}
00042         void startSubDocument() {}
00043         void insertCharacter(uint32_t /* character */) { if (!isUndoOn()) m_currentPageHasContent = true; }
00044         void insertTab() { if (!isUndoOn()) m_currentPageHasContent = true; }
00045         void insertTab(uint8_t /* tabType */, double /* tabPosition */) { if (!isUndoOn()) m_currentPageHasContent = true; }
00046         void insertEOL() { if (!isUndoOn()) m_currentPageHasContent = true; }
00047         void insertBreak(uint8_t breakType);
00048         void attributeChange(bool /* isOn */, uint8_t /* attribute */) {}
00049         void lineSpacingChange(double /* lineSpacing */) {}
00050         void justificationChange(uint8_t /* justification */) {}
00051         void pageMarginChange(uint8_t side, uint16_t margin);
00052         void pageFormChange(uint16_t length, uint16_t width, WPXFormOrientation orientation);
00053         void marginChange(uint8_t side, uint16_t margin);
00054         void indentFirstLineChange(int16_t /* offset */) {}
00055         void setTabs(bool /* isRelative */, const std::vector<WPXTabStop> /* tabStops */) {}
00056         void columnChange(WPXTextColumnType /* columnType */, uint8_t /* numColumns */,
00057                         const std::vector<double> & /* columnWidth */, const std::vector<bool> & /* isFixedWidth */) {}
00058         void endDocument();
00059         void endSubDocument();
00060 
00061         void defineTable(uint8_t /* position */, uint16_t /* leftOffset */) {}
00062         void addTableColumnDefinition(uint32_t /* width */, uint32_t /* leftGutter */, uint32_t /* rightGutter */,
00063                                         uint32_t /* attributes */, uint8_t /* alignment */) {}
00064         void startTable();
00065         void insertRow();
00066         void insertCell();
00067         void closeCell() {}
00068         void closeRow() {}
00069         void setTableCellSpan(uint16_t /* colSpan */, uint16_t /* rowSpan */) {}
00070         void setTableCellFillColor(const RGBSColor * /* cellFillColor */) {}
00071         void endTable() {}
00072         void undoChange(uint8_t undoType, uint16_t undoLevel);
00073         void setTextColor(const RGBSColor * /* fontColor */) {}
00074         void setTextFont(const WPXString& /* fontName */) {}
00075         void setFontSize(uint16_t /* fontSize */) {}
00076         void insertPageNumber(const WPXString & /* pageNumber */) {}
00077         void insertNoteReference(const WPXString & /* noteReference */) {}
00078         void insertNote(WPXNoteType /* noteType */, const WP3SubDocument * /* subDocument */) { if (!isUndoOn()) m_currentPageHasContent = true; }
00079         void headerFooterGroup(uint8_t headerFooterType, uint8_t occurenceBits, WP3SubDocument *subDocument);
00080         void suppressPage(uint16_t suppressCode);
00081         void backTab() { if (!isUndoOn()) m_currentPageHasContent = true; }
00082         void leftIndent() {}
00083         void leftIndent(double /* offset */) {}
00084         void leftRightIndent() {}
00085         void leftRightIndent(double /* offset */) {}
00086         void insertPicture(double /* height */, double /* width */, double /* verticalOffset */, double /* horizontalOffset */, uint8_t /* leftColumn */, uint8_t /* rightColumn */,
00087                         uint16_t /* figureFlags */, const WPXBinaryData & /* binaryData */) {}
00088         void insertTextBox(double /* height */, double /* width */, double /* verticalOffset */, double /* horizontalOffset */, uint8_t /* leftColumn */, uint8_t /* rightColumn */,
00089                         uint16_t /* figureFlags */, const WP3SubDocument * /* subDocument */, const WP3SubDocument * /* caption */) {}
00090         void insertWP51Table(double /* height */, double /* width */, double /* verticalOffset */, double /* horizontalOffset */, uint8_t /* leftColumn */, uint8_t /* rightColumn */,
00091                         uint16_t /* figureFlags */, const WP3SubDocument * /* subDocument */, const WP3SubDocument * /* caption */) {}
00092 
00093 protected:
00094         void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, int nextTableIndice = 0);
00095 
00096 private:
00097         WP3StylesListener(const WP3StylesListener&);
00098         WP3StylesListener& operator=(const WP3StylesListener&);
00099         WPXPageSpan m_currentPage;
00100 
00101         WPXTableList m_tableList;
00102         WPXTable *m_currentTable;
00103         double m_tempMarginLeft, m_tempMarginRight;
00104         bool m_currentPageHasContent;
00105         bool m_isSubDocument;
00106         std::vector<WP3SubDocument *> &m_subDocuments;
00107         std::list<WPXPageSpan>::iterator m_pageListHardPageMark;
00108 };
00109 
00110 #endif /* WP3STYLESLISTENER_H */