WP6StylesListener.h

Go to the documentation of this file.
00001 /* libwpd
00002  * Copyright (C) 2003 William Lachance (wrlach@gmail.com)
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 /* type */, const uint16_t /* year */, 
00048                      const uint8_t /* month */, const uint8_t /* day */, 
00049                      const uint8_t /* hour */, const uint8_t /* minute */, 
00050                      const uint8_t /* second */, const uint8_t /* dayOfWeek */, 
00051                      const uint8_t /* timeZone */, const uint8_t /* unused */) {}
00052         void setExtendedInformation(const uint16_t /* type */, const WPXString & /*data*/) {}
00053         void startDocument() {}
00054         void startSubDocument() {}
00055         void setAlignmentCharacter(const uint16_t /* character */) {}
00056         void setLeaderCharacter(const uint16_t /* character */, const uint8_t /* numberOfSpaces */) {}
00057         void defineTabStops(const bool /* isRelative */, const std::vector<WPXTabStop> & /* tabStops */, 
00058                                     const std::vector<bool> & /* usePreWP9LeaderMethods */) {}
00059         void insertCharacter(const uint16_t /* character */) { if (!isUndoOn()) m_currentPageHasContent = true; }
00060         void insertTab(const uint8_t /* tabType */, float /* tabPosition */) { if (!isUndoOn()) m_currentPageHasContent = true; }
00061         void handleLineBreak()  { if (!isUndoOn()) m_currentPageHasContent = true; }
00062         void insertEOL() { if (!isUndoOn()) m_currentPageHasContent = true; }
00063         void insertBreak(const uint8_t breakType);
00064         void characterColorChange(const uint8_t /* red */, const uint8_t /* green */, const uint8_t /* blue */) {}
00065         void characterShadingChange(const uint8_t /* shading */) {}
00066         void highlightChange(const bool /* isOn */, const RGBSColor /* color */) {}
00067         void fontChange(const uint16_t /* matchedFontPointSize */, const uint16_t /* fontPID */) {}
00068         void attributeChange(const bool /* isOn */, const uint8_t /* attribute */) {}
00069         void lineSpacingChange(const float /* lineSpacing */) {}
00070         void spacingAfterParagraphChange(const float /* spacingRelative */, const float /* spacingAbsolute */) {}
00071         void justificationChange(const uint8_t /* justification */) {}
00072         void pageMarginChange(const uint8_t side, const uint16_t margin);
00073         void pageFormChange(const uint16_t length, const uint16_t width, const WPXFormOrientation orientation);
00074         void marginChange(const uint8_t side, const uint16_t margin);
00075         void paragraphMarginChange(const uint8_t /* side */, const int16_t /* margin */) {}
00076         void indentFirstLineChange(const int16_t /* offset */) {}
00077         void columnChange(const WPXTextColumnType /* columnType */, const uint8_t /* numColumns */,
00078                                 const std::vector<float> & /* columnWidth */, const std::vector<bool> & /* isFixedWidth */) {}
00079         void updateOutlineDefinition(const WP6OutlineLocation /* outlineLocation */, const uint16_t /* outlineHash */,
00080                                              const uint8_t * /* numberingMethods */, const uint8_t /* tabBehaviourFlag */) {}
00081 
00082         void paragraphNumberOn(const uint16_t /* outlineHash */, const uint8_t /* level */, const uint8_t /* flag */) {}
00083         void paragraphNumberOff() { if (!isUndoOn()) m_currentPageHasContent = true; }
00084         void displayNumberReferenceGroupOn(const uint8_t /* subGroup */, const uint8_t /* level */) {}
00085         void displayNumberReferenceGroupOff(const uint8_t /* subGroup */) { if (!isUndoOn()) m_currentPageHasContent = true; }
00086         void styleGroupOn(const uint8_t /* subGroup */) {}
00087         void styleGroupOff(const uint8_t /* subGroup */) {}
00088         void globalOn(const uint8_t /* systemStyle */) {}
00089         void globalOff() {}
00090         void noteOn(const uint16_t textPID);
00091         void noteOff(const WPXNoteType /* noteType */) {}
00092         void headerFooterGroup(const uint8_t headerFooterType, const uint8_t occurenceBits, const uint16_t textPID);
00093         void suppressPageCharacteristics(const uint8_t suppressCode);
00094         void endDocument();
00095         void endSubDocument();
00096 
00097         void defineTable(const uint8_t position, const uint16_t leftOffset);
00098         void addTableColumnDefinition(const uint32_t /* width */, const uint32_t /* leftGutter */, const uint32_t /* rightGutter */,
00099                                 const uint32_t /* attributes */, const uint8_t /* alignment */) {}
00100         void startTable();
00101         void insertRow(const uint16_t rowHeight, const bool isMinimumHeight, const bool isHeaderRow);
00102         void insertCell(const uint8_t colSpan, const uint8_t rowSpan, const uint8_t borderBits, 
00103                                 const RGBSColor * cellFgColor, const RGBSColor * cellBgColor,
00104                                 const RGBSColor * cellBorderColor, const WPXVerticalAlignment cellVerticalAlignment, 
00105                                 const bool useCellAttributes, const uint32_t cellAttributes);
00106         void endTable();
00107         void boxOn(const uint8_t /* anchoringType */, const uint8_t /* generalPositioningFlags */, const uint8_t /* horizontalPositioningFlags */,
00108                 const int16_t /* horizontalOffset */, const uint8_t /* leftColumn */, const uint8_t /* rightColumn */,
00109                 const uint8_t /* verticalPositioningFlags */, const int16_t /* verticalOffset */, const uint8_t /* widthFlags */,
00110                 const uint16_t /* width */, const uint8_t /* heightFlags */, const uint16_t /* height */, const uint8_t /* boxContentType */,
00111                 const uint16_t /* nativeWidth */, const uint16_t /* nativeHeight */) {}
00112         void boxOff() {}
00113         void insertGraphicsData(const uint16_t /* packetId */) {}
00114         void insertTextBox(const WP6SubDocument *subDocument);
00115         void commentAnnotation(const uint16_t textPID);
00116 
00117         void undoChange(const uint8_t undoType, const uint16_t undoLevel);
00118 
00119 protected:
00120         void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, int nextTableIndice = 0);
00121 
00122         void _flushText() {}
00123         void _changeList() {}
00124 
00125 private:
00126         WP6StylesListener(const WP6StylesListener&);
00127         WP6StylesListener& operator=(const WP6StylesListener&);
00128         WPXPageSpan m_currentPage;
00129 
00130         WPXTableList m_tableList;
00131         WPXTable * m_currentTable;
00132         float m_tempMarginLeft, m_tempMarginRight;
00133         bool m_currentPageHasContent;
00134         bool m_isTableDefined;
00135         bool m_isSubDocument;
00136         std::set <const WPXSubDocument *> m_subDocuments;
00137         std::list<WPXPageSpan>::iterator m_pageListHardPageMark;
00138 };
00139 
00140 #endif /* WP6STYLESLISTENER_H */

Generated on Mon Nov 15 19:50:26 2010 for libwpd by doxygen 1.5.4