~ubuntu-branches/ubuntu/trusty/libwpd/trusty

« back to all changes in this revision

Viewing changes to src/lib/WP3ContentListener.h

  • Committer: Bazaar Package Importer
  • Author(s): Rene Engelhard
  • Date: 2006-06-11 23:56:17 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060611235617-ce504k38fuqe8twa
Tags: 0.8.5-2
* dpatch'ize 
* add patch from upstream fixing WP5 font handling regression

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* libwpd
 
2
 * Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
 
3
 * Copyright (C) 2005-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
 
4
 *
 
5
 * This library is free software; you can redistribute it and/or
 
6
 * modify it under the terms of the GNU Library General Public
 
7
 * License as published by the Free Software Foundation; either
 
8
 * version 2 of the License, or (at your option) any later version.
 
9
 *
 
10
 * This library is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
 * Library General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU Library General Public
 
16
 * License along with this library; if not, write to the Free Software
 
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 
18
 *
 
19
 * For further information visit http://libwpd.sourceforge.net
 
20
 */
 
21
 
 
22
/* "This product is not manufactured, approved, or supported by
 
23
 * Corel Corporation or Corel Corporation Limited."
 
24
 */
 
25
 
 
26
#ifndef WP3CONTENTLISTENER_H
 
27
#define WP3CONTENTLISTENER_H
 
28
 
 
29
#include "WP3Listener.h"
 
30
#include "WPXHLListenerImpl.h"
 
31
#include "WPXContentListener.h"
 
32
#include "libwpd_internal.h"
 
33
#include "WP3SubDocument.h"
 
34
 
 
35
typedef struct _WP3ContentParsingState WP3ContentParsingState;
 
36
struct _WP3ContentParsingState
 
37
{
 
38
        _WP3ContentParsingState();
 
39
        ~_WP3ContentParsingState();
 
40
        uint16_t m_colSpan;
 
41
        uint16_t m_rowSpan;
 
42
        WPXString m_textBuffer;
 
43
        RGBSColor * m_cellFillColor;
 
44
        WPXString m_noteReference;
 
45
 
 
46
        WPXTableList m_tableList;
 
47
};
 
48
 
 
49
class WP3ContentListener : public WP3Listener, public WPXContentListener
 
50
{
 
51
public:
 
52
        WP3ContentListener(std::list<WPXPageSpan> &pageList, std::vector<WP3SubDocument *> &subDocuments, WPXHLListenerImpl *listenerImpl);
 
53
        ~WP3ContentListener();
 
54
 
 
55
        void startDocument() { WPXContentListener::startDocument(); };
 
56
        void setAlignmentCharacter(const uint16_t character) {};
 
57
        void setLeaderCharacter(const uint16_t character, const uint8_t numberOfSpaces) {};
 
58
        void defineTabStops(const bool isRelative, const std::vector<WPXTabStop> &tabStops, 
 
59
                                    const std::vector<bool> &usePreWP9LeaderMethods) {};
 
60
        void insertCharacter(const uint16_t character);
 
61
        void insertTab(const uint8_t tabType, float tabPosition);
 
62
        void insertBreak(const uint8_t breakType) { WPXContentListener::insertBreak(breakType); };
 
63
        void handleLineBreak() {};
 
64
        void insertEOL();
 
65
        void attributeChange(const bool isOn, const uint8_t attribute);
 
66
        void lineSpacingChange(const float lineSpacing) { WPXContentListener::lineSpacingChange(lineSpacing); };
 
67
        void spacingAfterParagraphChange(const float spacingRelative, const float spacingAbsolute) {};
 
68
        void pageMarginChange(const uint8_t side, const uint16_t margin) {};
 
69
        void pageFormChange(const uint16_t length, const uint16_t width, const WPXFormOrientation orientation, const bool isPersistent) {};
 
70
        void marginChange(const uint8_t side, const uint16_t margin);
 
71
        void paragraphMarginChange(const uint8_t side, const int16_t margin) {};
 
72
        void indentFirstLineChange(const int16_t offset);
 
73
        void columnChange(const WPXTextColumnType columnType, const uint8_t numColumns, const std::vector<float> &columnWidth,
 
74
                                        const std::vector<bool> &isFixedWidth);
 
75
        void endDocument();
 
76
 
 
77
        void defineTable(const uint8_t position, const uint16_t leftOffset);
 
78
        void addTableColumnDefinition(const uint32_t width, const uint32_t leftGutter, const uint32_t rightGutter,
 
79
                                        const uint32_t attributes, const uint8_t alignment);
 
80
        void startTable();
 
81
        void insertRow();
 
82
        void insertCell();
 
83
        void closeCell();
 
84
        void closeRow();
 
85
        void setTableCellSpan(const uint16_t colSpan, const uint16_t rowSpan);
 
86
        void setTableCellFillColor(const RGBSColor * cellFillColor);
 
87
        void endTable();
 
88
        void undoChange(const uint8_t undoType, const uint16_t undoLevel);
 
89
        void justificationChange(const uint8_t justification);
 
90
        void setTextColor(const RGBSColor * fontColor);
 
91
        void setTextFont(const WPXString fontName);
 
92
        void setFontSize(const uint16_t fontSize);
 
93
        void insertPageNumber(const WPXString &pageNumber);
 
94
        void insertNoteReference(const WPXString &noteReference);
 
95
        void insertNote(const WPXNoteType noteType, WP3SubDocument *subDocument);
 
96
        void headerFooterGroup(const uint8_t headerFooterType, const uint8_t occurenceBits, WP3SubDocument *subDocument);
 
97
        void suppressPage(const uint16_t suppressCode) {};
 
98
        
 
99
protected:
 
100
        void _handleSubDocument(const WPXSubDocument *subDocument, const bool isHeaderFooter, WPXTableList tableList, int nextTableIndice = 0);
 
101
        void _openParagraph();
 
102
 
 
103
private:
 
104
        void _flushText();
 
105
        void _changeList() {};
 
106
 
 
107
        WP3ContentParsingState *m_parseState;
 
108
        std::vector<WP3SubDocument *> &m_subDocuments;
 
109
};
 
110
 
 
111
#endif /* WP3CONTENTLISTENER_H */