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

« back to all changes in this revision

Viewing changes to src/lib/WPXHLListener.h

  • Committer: Bazaar Package Importer
  • Author(s): Masayuki Hatta (mhatta)
  • Date: 2004-06-20 02:41:29 UTC
  • Revision ID: james.westby@ubuntu.com-20040620024129-h103i0nsx8qvxpg6
Tags: upstream-0.7.1
ImportĀ upstreamĀ versionĀ 0.7.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* libwpd
 
2
 * Copyright (C) 2002 William Lachance (william.lachance@sympatico.ca)
 
3
 * Copyright (C) 2002 Marc Maurer (j.m.maurer@student.utwente.nl)
 
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307 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 WPXHLLISTENER_H
 
27
#define WPXHLLISTENER_H
 
28
 
 
29
#include "WPXLLListener.h"
 
30
#include "WPXHLListenerImpl.h"
 
31
 
 
32
class WPXPageSpan;
 
33
 
 
34
typedef struct _WPXDocumentMetaData WPXDocumentMetaData;
 
35
struct _WPXDocumentMetaData
 
36
{
 
37
        UCSString m_author;
 
38
        UCSString m_subject;
 
39
        UCSString m_publisher; 
 
40
        UCSString m_category;
 
41
        UCSString m_keywords; 
 
42
        UCSString m_language;
 
43
        UCSString m_abstract; 
 
44
        UCSString m_descriptiveName;
 
45
        UCSString m_descriptiveType;
 
46
};
 
47
 
 
48
typedef struct _WPXParsingState WPXParsingState;
 
49
struct _WPXParsingState
 
50
{
 
51
        _WPXParsingState(bool sectionAttributesChanged=true);
 
52
        ~_WPXParsingState() {}
 
53
        
 
54
/*
 
55
        UCSString m_bodyText;
 
56
        UCSString m_textBeforeNumber;
 
57
        UCSString m_textBeforeDisplayReference;
 
58
        UCSString m_numberText;
 
59
        UCSString m_textAfterDisplayReference;
 
60
        UCSString m_textAfterNumber;
 
61
*/
 
62
        guint32 m_textAttributeBits;
 
63
        bool m_textAttributesChanged;
 
64
        float m_fontSize;
 
65
        GString * m_fontName;
 
66
 
 
67
        bool m_isParagraphColumnBreak;
 
68
        bool m_isParagraphPageBreak;
 
69
/*      guint8 m_paragraphJustification;
 
70
        guint8 m_tempParagraphJustification;
 
71
        float m_paragraphLineSpacing;
 
72
*/
 
73
        bool m_isSectionOpened;
 
74
 
 
75
        bool m_isParagraphOpened;
 
76
        bool m_isParagraphClosed;
 
77
        bool m_isSpanOpened;
 
78
        guint m_numDeferredParagraphBreaks;
 
79
/*      guint m_numRemovedParagraphBreaks;
 
80
 
 
81
        WPXTable *m_currentTable;
 
82
        int m_nextTableIndice;
 
83
        int m_currentTableCol;
 
84
        int m_currentTableRow;
 
85
        bool m_isTableOpened;
 
86
        bool m_isTableRowOpened;
 
87
        bool m_isTableColumnOpened;
 
88
        bool m_isTableCellOpened;
 
89
*/
 
90
        bool m_isPageSpanOpened;
 
91
        int m_nextPageSpanIndice;
 
92
        int m_numPagesRemainingInSpan;
 
93
 
 
94
        bool m_sectionAttributesChanged;
 
95
        guint m_numColumns;
 
96
        
 
97
        float m_pageMarginLeft;
 
98
        float m_pageMarginRight;
 
99
        float m_paragraphMarginLeft;
 
100
        float m_paragraphMarginRight;
 
101
        
 
102
        /*gint32 m_currentRow;
 
103
        gint32 m_currentColumn;
 
104
 
 
105
        stack<int> m_listLevelStack;
 
106
        guint16 m_currentOutlineHash; // probably should replace Hash with Key in these sorts of cases
 
107
        guint8 m_oldListLevel;
 
108
        guint8 m_currentListLevel;
 
109
        WP6StyleStateSequence m_styleStateSequence;
 
110
        bool m_putativeListElementHasParagraphNumber;
 
111
        bool m_putativeListElementHasDisplayReferenceNumber;
 
112
 
 
113
        int m_noteTextPID;
 
114
        
 
115
        */      
 
116
 
 
117
};
 
118
 
 
119
class WPXHLListener : public WPXLLListener
 
120
{
 
121
public:
 
122
        WPXHLListener(vector<WPXPageSpan *> *pageList, WPXHLListenerImpl *listenerImpl);        
 
123
        WPXHLListener::~WPXHLListener();
 
124
 
 
125
        void startDocument();
 
126
        void handleSubDocument(guint16 textPID);
 
127
 
 
128
        WPXParsingState *m_ps; // parse state
 
129
        WPXHLListenerImpl * m_listenerImpl;
 
130
        WPXDocumentMetaData m_metaData;
 
131
        vector <WPXPageSpan *> *m_pageList;
 
132
 
 
133
protected:
 
134
        virtual void _handleSubDocument(guint16 textPID) = 0;
 
135
 
 
136
        void _openSection();
 
137
        void _closeSection();
 
138
 
 
139
        void _openPageSpan();
 
140
        void _closePageSpan();
 
141
 
 
142
        // void _openParagraph();
 
143
        void _closeParagraph();
 
144
 
 
145
        void _openSpan();
 
146
        void _closeSpan();
 
147
};
 
148
 
 
149
#endif /* WPXHLLISTENER_H */