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  * Version: MPL 2.0 / LGPLv2.1+
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  *
00009  * Major Contributor(s):
00010  * Copyright (C) 2003 William Lachance (wrlach@gmail.com)
00011  * Copyright (C) 2003 Marc Maurer (uwog@uwog.net)
00012  *
00013  * For minor contributions see the git repository.
00014  *
00015  * Alternatively, the contents of this file may be used under the terms
00016  * of the GNU Lesser General Public License Version 2.1 or later
00017  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
00018  * applicable instead of those above.
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 unsigned short /* type */, const unsigned short /* year */,
00049                      const unsigned char /* month */, const unsigned char /* day */,
00050                      const unsigned char /* hour */, const unsigned char /* minute */,
00051                      const unsigned char /* second */, const unsigned char /* dayOfWeek */,
00052                      const unsigned char /* timeZone */, const unsigned char /* unused */) {}
00053         void setExtendedInformation(const unsigned short /* type */, const librevenge::RVNGString & /*data*/) {}
00054         void startDocument() {}
00055         void startSubDocument() {}
00056         void setAlignmentCharacter(const unsigned /* character */) {}
00057         void setLeaderCharacter(const unsigned /* character */, const unsigned char /* numberOfSpaces */) {}
00058         void defineTabStops(const bool /* isRelative */, const std::vector<WPXTabStop> & /* tabStops */,
00059                             const std::vector<bool> & /* usePreWP9LeaderMethods */) {}
00060         void insertCharacter(unsigned /* character */)
00061         {
00062                 if (!isUndoOn()) m_currentPageHasContent = true;
00063         }
00064         void insertTab(const unsigned char /* 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 unsigned char breakType);
00077         void characterColorChange(const unsigned char /* red */, const unsigned char /* green */, const unsigned char /* blue */) {}
00078         void characterShadingChange(const unsigned char /* shading */) {}
00079         void highlightChange(const bool /* isOn */, const RGBSColor & /* color */) {}
00080         void fontChange(const unsigned short /* matchedFontPointSize */, const unsigned short /* fontPID */, const librevenge::RVNGString & /* fontName */) {}
00081         void attributeChange(const bool /* isOn */, const unsigned char /* attribute */) {}
00082         void lineSpacingChange(const double /* lineSpacing */) {}
00083         void spacingAfterParagraphChange(const double /* spacingRelative */, const double /* spacingAbsolute */) {}
00084         void justificationChange(const unsigned char /* justification */) {}
00085         void pageNumberingChange(const WPXPageNumberPosition /* page numbering position */, const unsigned short /* matchedFontPointSize */, const unsigned short /* fontPID */);
00086         void pageMarginChange(const unsigned char side, const unsigned short margin);
00087         void pageFormChange(const unsigned short length, const unsigned short width, const WPXFormOrientation orientation);
00088         void marginChange(const unsigned char side, const unsigned short margin);
00089         void paragraphMarginChange(const unsigned char /* side */, const signed short /* margin */) {}
00090         void indentFirstLineChange(const signed short /* offset */) {}
00091         void columnChange(const WPXTextColumnType /* columnType */, const unsigned char /* numColumns */,
00092                           const std::vector<double> & /* columnWidth */, const std::vector<bool> & /* isFixedWidth */) {}
00093         void updateOutlineDefinition(const unsigned short /* outlineHash */, const unsigned char * /* numberingMethods */, const unsigned char /* tabBehaviourFlag */) {}
00094 
00095         void paragraphNumberOn(const unsigned short /* outlineHash */, const unsigned char /* level */, const unsigned char /* flag */) {}
00096         void paragraphNumberOff()
00097         {
00098                 if (!isUndoOn()) m_currentPageHasContent = true;
00099         }
00100         void displayNumberReferenceGroupOn(const unsigned char /* subGroup */, const unsigned char /* level */) {}
00101         void displayNumberReferenceGroupOff(const unsigned char /* subGroup */)
00102         {
00103                 if (!isUndoOn()) m_currentPageHasContent = true;
00104         }
00105         void styleGroupOn(const unsigned char /* subGroup */) {}
00106         void styleGroupOff(const unsigned char /* subGroup */) {}
00107         void globalOn(const unsigned char /* systemStyle */) {}
00108         void globalOff() {}
00109         void noteOn(const unsigned short textPID);
00110         void noteOff(const WPXNoteType /* noteType */) {}
00111         void headerFooterGroup(const unsigned char headerFooterType, const unsigned char occurrenceBits, const unsigned short textPID);
00112         void suppressPageCharacteristics(const unsigned char suppressCode);
00113         void setPageNumber(const unsigned short pageNumber);
00114         void setPageNumberingType(const WPXNumberingType pageNumberingType);
00115 
00116         void endDocument();
00117         void endSubDocument();
00118 
00119         void defineTable(const unsigned char position, const unsigned short leftOffset);
00120         void addTableColumnDefinition(const unsigned /* width */, const unsigned /* leftGutter */, const unsigned /* rightGutter */,
00121                                       const unsigned /* attributes */, const unsigned char /* alignment */) {}
00122         void startTable();
00123         void insertRow(const unsigned short rowHeight, const bool isMinimumHeight, const bool isHeaderRow);
00124         void insertCell(const unsigned char colSpan, const unsigned char rowSpan, const unsigned char borderBits,
00125                         const RGBSColor *cellFgColor, const RGBSColor *cellBgColor,
00126                         const RGBSColor *cellBorderColor, const WPXVerticalAlignment cellVerticalAlignment,
00127                         const bool useCellAttributes, const unsigned cellAttributes);
00128         void endTable();
00129         void boxOn(const unsigned char /* anchoringType */, const unsigned char /* generalPositioningFlags */, const unsigned char /* horizontalPositioningFlags */,
00130                    const signed short /* horizontalOffset */, const unsigned char /* leftColumn */, const unsigned char /* rightColumn */,
00131                    const unsigned char /* verticalPositioningFlags */, const signed short /* verticalOffset */, const unsigned char /* widthFlags */,
00132                    const unsigned short /* width */, const unsigned char /* heightFlags */, const unsigned short /* height */, const unsigned char /* boxContentType */,
00133                    const unsigned short /* nativeWidth */, const unsigned short /* nativeHeight */) {}
00134         void boxOff() {}
00135         void insertGraphicsData(const unsigned short /* packetId */) {}
00136         void insertTextBox(const WP6SubDocument *subDocument);
00137         void commentAnnotation(const unsigned short textPID);
00138 
00139         void undoChange(const unsigned char undoType, const unsigned short undoLevel);
00140 
00141 protected:
00142         void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, int nextTableIndice = 0);
00143 
00144         void _flushText() {}
00145         void _changeList() {}
00146 
00147 private:
00148         WP6StylesListener(const WP6StylesListener &);
00149         WP6StylesListener &operator=(const WP6StylesListener &);
00150         WPXPageSpan m_currentPage;
00151 
00152         WPXTableList m_tableList;
00153         WPXTable *m_currentTable;
00154         double m_tempMarginLeft, m_tempMarginRight;
00155         bool m_currentPageHasContent;
00156         bool m_isTableDefined;
00157         bool m_isSubDocument;
00158         std::set <const WPXSubDocument *> m_subDocuments;
00159         std::list<WPXPageSpan>::iterator m_pageListHardPageMark;
00160 };
00161 
00162 #endif /* WP6STYLESLISTENER_H */
00163 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */