WP6StylesListener.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) 2003 William Lachance (wrlach@gmail.com)
00004  * Copyright (C) 2003 Marc Maurer (uwog@uwog.net)
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 // WP6StylesListener: creates an intermediate table representation, given a
00028 // sequence of messages passed to it by the parser.
00029 
00030 #ifndef WP6STYLESLISTENER_H
00031 #define WP6STYLESLISTENER_H
00032 
00033 #include "WP6Listener.h"
00034 #include "WPXStylesListener.h"
00035 #include <vector>
00036 #include <set>
00037 #include <list>
00038 #include "WPXPageSpan.h"
00039 #include "WPXTable.h"
00040 
00041 class WPXSubDocument;
00042 
00043 class WP6StylesListener : public WP6Listener, protected WPXStylesListener
00044 {
00045 public:
00046         WP6StylesListener(std::list<WPXPageSpan> &pageList, WPXTableList tableList);
00047 
00048         void setDate(const uint16_t /* type */, const uint16_t /* year */,
00049                      const uint8_t /* month */, const uint8_t /* day */,
00050                      const uint8_t /* hour */, const uint8_t /* minute */,
00051                      const uint8_t /* second */, const uint8_t /* dayOfWeek */,
00052                      const uint8_t /* timeZone */, const uint8_t /* unused */) {}
00053         void setExtendedInformation(const uint16_t /* type */, const WPXString & /*data*/) {}
00054         void startDocument() {}
00055         void startSubDocument() {}
00056         void setAlignmentCharacter(const uint16_t /* character */) {}
00057         void setLeaderCharacter(const uint16_t /* character */, const uint8_t /* numberOfSpaces */) {}
00058         void defineTabStops(const bool /* isRelative */, const std::vector<WPXTabStop> & /* tabStops */,
00059                             const std::vector<bool> & /* usePreWP9LeaderMethods */) {}
00060         void insertCharacter(uint32_t /* character */)
00061         {
00062                 if (!isUndoOn()) m_currentPageHasContent = true;
00063         }
00064         void insertTab(const uint8_t /* tabType */, double /* tabPosition */)
00065         {
00066                 if (!isUndoOn()) m_currentPageHasContent = true;
00067         }
00068         void handleLineBreak()
00069         {
00070                 if (!isUndoOn()) m_currentPageHasContent = true;
00071         }
00072         void insertEOL()
00073         {
00074                 if (!isUndoOn()) m_currentPageHasContent = true;
00075         }
00076         void insertBreak(const uint8_t breakType);
00077         void characterColorChange(const uint8_t /* red */, const uint8_t /* green */, const uint8_t /* blue */) {}
00078         void characterShadingChange(const uint8_t /* shading */) {}
00079         void highlightChange(const bool /* isOn */, const RGBSColor /* color */) {}
00080         void fontChange(const uint16_t /* matchedFontPointSize */, const uint16_t /* fontPID */, const WPXString & /* fontName */) {}
00081         void attributeChange(const bool /* isOn */, const uint8_t /* attribute */) {}
00082         void lineSpacingChange(const double /* lineSpacing */) {}
00083         void spacingAfterParagraphChange(const double /* spacingRelative */, const double /* spacingAbsolute */) {}
00084         void justificationChange(const uint8_t /* justification */) {}
00085         void pageNumberingChange(const WPXPageNumberPosition /* page numbering position */, const uint16_t /* matchedFontPointSize */, const uint16_t /* fontPID */);
00086         void pageMarginChange(const uint8_t side, const uint16_t margin);
00087         void pageFormChange(const uint16_t length, const uint16_t width, const WPXFormOrientation orientation);
00088         void marginChange(const uint8_t side, const uint16_t margin);
00089         void paragraphMarginChange(const uint8_t /* side */, const int16_t /* margin */) {}
00090         void indentFirstLineChange(const int16_t /* offset */) {}
00091         void columnChange(const WPXTextColumnType /* columnType */, const uint8_t /* numColumns */,
00092                           const std::vector<double> & /* columnWidth */, const std::vector<bool> & /* isFixedWidth */) {}
00093         void updateOutlineDefinition(const WP6OutlineLocation /* outlineLocation */, const uint16_t /* outlineHash */,
00094                                      const uint8_t * /* numberingMethods */, const uint8_t /* tabBehaviourFlag */) {}
00095 
00096         void paragraphNumberOn(const uint16_t /* outlineHash */, const uint8_t /* level */, const uint8_t /* flag */) {}
00097         void paragraphNumberOff()
00098         {
00099                 if (!isUndoOn()) m_currentPageHasContent = true;
00100         }
00101         void displayNumberReferenceGroupOn(const uint8_t /* subGroup */, const uint8_t /* level */) {}
00102         void displayNumberReferenceGroupOff(const uint8_t /* subGroup */)
00103         {
00104                 if (!isUndoOn()) m_currentPageHasContent = true;
00105         }
00106         void styleGroupOn(const uint8_t /* subGroup */) {}
00107         void styleGroupOff(const uint8_t /* subGroup */) {}
00108         void globalOn(const uint8_t /* systemStyle */) {}
00109         void globalOff() {}
00110         void noteOn(const uint16_t textPID);
00111         void noteOff(const WPXNoteType /* noteType */) {}
00112         void headerFooterGroup(const uint8_t headerFooterType, const uint8_t occurenceBits, const uint16_t textPID);
00113         void suppressPageCharacteristics(const uint8_t suppressCode);
00114         void setPageNumber(const uint16_t pageNumber);
00115         void setPageNumberingType(const WPXNumberingType pageNumberingType);
00116 
00117         void endDocument();
00118         void endSubDocument();
00119 
00120         void defineTable(const uint8_t position, const uint16_t leftOffset);
00121         void addTableColumnDefinition(const uint32_t /* width */, const uint32_t /* leftGutter */, const uint32_t /* rightGutter */,
00122                                       const uint32_t /* attributes */, const uint8_t /* alignment */) {}
00123         void startTable();
00124         void insertRow(const uint16_t rowHeight, const bool isMinimumHeight, const bool isHeaderRow);
00125         void insertCell(const uint8_t colSpan, const uint8_t rowSpan, const uint8_t borderBits,
00126                         const RGBSColor *cellFgColor, const RGBSColor *cellBgColor,
00127                         const RGBSColor *cellBorderColor, const WPXVerticalAlignment cellVerticalAlignment,
00128                         const bool useCellAttributes, const uint32_t cellAttributes);
00129         void endTable();
00130         void boxOn(const uint8_t /* anchoringType */, const uint8_t /* generalPositioningFlags */, const uint8_t /* horizontalPositioningFlags */,
00131                    const int16_t /* horizontalOffset */, const uint8_t /* leftColumn */, const uint8_t /* rightColumn */,
00132                    const uint8_t /* verticalPositioningFlags */, const int16_t /* verticalOffset */, const uint8_t /* widthFlags */,
00133                    const uint16_t /* width */, const uint8_t /* heightFlags */, const uint16_t /* height */, const uint8_t /* boxContentType */,
00134                    const uint16_t /* nativeWidth */, const uint16_t /* nativeHeight */) {}
00135         void boxOff() {}
00136         void insertGraphicsData(const uint16_t /* packetId */) {}
00137         void insertTextBox(const WP6SubDocument *subDocument);
00138         void commentAnnotation(const uint16_t textPID);
00139 
00140         void undoChange(const uint8_t undoType, const uint16_t undoLevel);
00141 
00142 protected:
00143         void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, int nextTableIndice = 0);
00144 
00145         void _flushText() {}
00146         void _changeList() {}
00147 
00148 private:
00149         WP6StylesListener(const WP6StylesListener &);
00150         WP6StylesListener &operator=(const WP6StylesListener &);
00151         WPXPageSpan m_currentPage;
00152 
00153         WPXTableList m_tableList;
00154         WPXTable *m_currentTable;
00155         double m_tempMarginLeft, m_tempMarginRight;
00156         bool m_currentPageHasContent;
00157         bool m_isTableDefined;
00158         bool m_isSubDocument;
00159         std::set <const WPXSubDocument *> m_subDocuments;
00160         std::list<WPXPageSpan>::iterator m_pageListHardPageMark;
00161 };
00162 
00163 #endif /* WP6STYLESLISTENER_H */
00164 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */