WP6StylesListener.h

Go to the documentation of this file.
00001 /* libwpd
00002  * Copyright (C) 2003 William Lachance (william.lachance@sympatico.ca)
00003  * Copyright (C) 2003 Marc Maurer (uwog@uwog.net)
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 // WP6StylesListener: creates an intermediate table representation, given a
00027 // sequence of messages passed to it by the parser.
00028 
00029 #ifndef WP6STYLESLISTENER_H
00030 #define WP6STYLESLISTENER_H
00031 
00032 #include "WP6Listener.h"
00033 #include "WPXStylesListener.h"
00034 #include <vector>
00035 #include <set>
00036 #include <list>
00037 #include "WPXPageSpan.h"
00038 #include "WPXTable.h"
00039 
00040 class WPXSubDocument;
00041 
00042 class WP6StylesListener : public WP6Listener, protected WPXStylesListener
00043 {
00044 public:
00045         WP6StylesListener(std::list<WPXPageSpan> &pageList, WPXTableList tableList);
00046 
00047         void setDate(const uint16_t year, const uint8_t month, const uint8_t day,
00048                 const uint8_t hour, const uint8_t minute, const uint8_t second,
00049                 const uint8_t dayOfWeek, const uint8_t timeZone, const uint8_t unused) {}
00050         void setExtendedInformation(const uint16_t type, const WPXString &data) {}
00051         void startDocument() {}
00052         void setAlignmentCharacter(const uint16_t character) {}
00053         void setLeaderCharacter(const uint16_t character, const uint8_t numberOfSpaces) {}
00054         void defineTabStops(const bool isRelative, const std::vector<WPXTabStop> &tabStops, 
00055                                     const std::vector<bool> &usePreWP9LeaderMethods) {}
00056         void insertCharacter(const uint16_t character) { if (!isUndoOn()) m_currentPageHasContent = true; }
00057         void insertTab(const uint8_t tabType, float tabPosition) { if (!isUndoOn()) m_currentPageHasContent = true; }
00058         void handleLineBreak()  { if (!isUndoOn()) m_currentPageHasContent = true; }
00059         void insertEOL() { if (!isUndoOn()) m_currentPageHasContent = true; }
00060         void insertBreak(const uint8_t breakType);
00061         void characterColorChange(const uint8_t red, const uint8_t green, const uint8_t blue) {}
00062         void characterShadingChange(const uint8_t shading) {}
00063         void highlightChange(const bool isOn, const RGBSColor color) {}
00064         void fontChange(const uint16_t matchedFontPointSize, const uint16_t fontPID) {}
00065         void attributeChange(const bool isOn, const uint8_t attribute) {}
00066         void lineSpacingChange(const float lineSpacing) {}
00067         void spacingAfterParagraphChange(const float spacingRelative, const float spacingAbsolute) {}
00068         void justificationChange(const uint8_t justification) {}
00069         void pageMarginChange(const uint8_t side, const uint16_t margin);
00070         void pageFormChange(const uint16_t length, const uint16_t width, const WPXFormOrientation orientation, const bool isPersistent);
00071         void marginChange(const uint8_t side, const uint16_t margin);
00072         void paragraphMarginChange(const uint8_t side, const int16_t margin) {}
00073         void indentFirstLineChange(const int16_t offset) {}
00074         void columnChange(const WPXTextColumnType columnType, const uint8_t numColumns, const std::vector<float> &columnWidth,
00075                                   const std::vector<bool> &isFixedWidth) {}
00076         void updateOutlineDefinition(const WP6OutlineLocation outlineLocation, const uint16_t outlineHash,
00077                                              const uint8_t *numberingMethods, const uint8_t tabBehaviourFlag) {}
00078 
00079         void paragraphNumberOn(const uint16_t outlineHash, const uint8_t level, const uint8_t flag) {}
00080         void paragraphNumberOff() { if (!isUndoOn()) m_currentPageHasContent = true; }
00081         void displayNumberReferenceGroupOn(const uint8_t subGroup, const uint8_t level) {}
00082         void displayNumberReferenceGroupOff(const uint8_t subGroup) { if (!isUndoOn()) m_currentPageHasContent = true; }
00083         void styleGroupOn(const uint8_t subGroup) {}
00084         void styleGroupOff(const uint8_t subGroup) {}
00085         void globalOn(const uint8_t systemStyle) {}
00086         void globalOff() {}
00087         void noteOn(const uint16_t textPID);
00088         void noteOff(const WPXNoteType noteType) {}
00089         void headerFooterGroup(const uint8_t headerFooterType, const uint8_t occurenceBits, const uint16_t textPID);
00090         void suppressPageCharacteristics(const uint8_t suppressCode);
00091         void endDocument();
00092 
00093         void defineTable(const uint8_t position, const uint16_t leftOffset);
00094         void addTableColumnDefinition(const uint32_t width, const uint32_t leftGutter, const uint32_t rightGutter,
00095                                 const uint32_t attributes, const uint8_t alignment) {}
00096         void startTable();
00097         void insertRow(const uint16_t rowHeight, const bool isMinimumHeight, const bool isHeaderRow);
00098         void insertCell(const uint8_t colSpan, const uint8_t rowSpan, const uint8_t borderBits, 
00099                                 const RGBSColor * cellFgColor, const RGBSColor * cellBgColor,
00100                                 const RGBSColor * cellBorderColor, const WPXVerticalAlignment cellVerticalAlignment, 
00101                                 const bool useCellAttributes, const uint32_t cellAttributes);
00102         void endTable();
00103 
00104         void undoChange(const uint8_t undoType, const uint16_t undoLevel);
00105 
00106 protected:
00107         void _handleSubDocument(const WPXSubDocument *subDocument, const bool isHeaderFooter, WPXTableList tableList, int nextTableIndice = 0);
00108 
00109         void _flushText() {}
00110         void _changeList() {}
00111 
00112 private:
00113         WPXPageSpan m_currentPage;
00114 
00115         WPXTableList m_tableList;
00116         WPXTable *m_currentTable;
00117         float m_tempMarginLeft, m_tempMarginRight;
00118         bool m_currentPageHasContent;
00119         bool m_isTableDefined;
00120         bool m_isSubDocument;
00121         std::set <const WPXSubDocument *> m_subDocuments;
00122         std::list<WPXPageSpan>::iterator m_pageListHardPageMark;
00123 };
00124 
00125 #endif /* WP6STYLESLISTENER_H */

Generated on Wed Mar 14 10:39:40 2007 for libwpd by doxygen 1.4.7