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

« back to all changes in this revision

Viewing changes to src/lib/WP3Listener.cpp

  • 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
1
/* libwpd
2
 
 * Copyright (C) 2004 Marc Maurer (j.m.maurer@student.utwente.nl)
 
2
 * Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
3
3
 * Copyright (C) 2004-2005 Fridrich Strba (fridrich.strba@bluewin.ch)
4
4
 *
5
5
 * This library is free software; you can redistribute it and/or
24
24
 */
25
25
 
26
26
#include "WP3Listener.h"
27
 
#include "WP3FileStructure.h"
28
 
#include "WPXFileStructure.h"
29
 
#include "libwpd_internal.h"
30
 
#include "WP3SubDocument.h"
31
 
 
32
 
_WP3ParsingState::_WP3ParsingState():
33
 
        m_colSpan(1),
34
 
        m_rowSpan(1),
35
 
        m_cellFillColor(NULL)
36
 
{
37
 
        m_textBuffer.clear();
38
 
        m_noteReference.clear();
39
 
}
40
 
 
41
 
_WP3ParsingState::~_WP3ParsingState()
42
 
{
43
 
        m_textBuffer.clear();
44
 
        m_noteReference.clear();
45
 
        DELETEP(m_cellFillColor);
46
 
}
47
 
 
48
 
WP3Listener::WP3Listener(std::vector<WPXPageSpan *> *pageList, WPXHLListenerImpl *listenerImpl) :
49
 
        WPXListener(pageList, listenerImpl),
50
 
        m_parseState(new WP3ParsingState)
51
 
{
52
 
}
53
 
 
54
 
WP3Listener::~WP3Listener() 
55
 
{
56
 
        delete m_parseState;
57
 
}
58
 
 
59
 
 
60
 
/****************************************
61
 
 public 'HLListenerImpl' functions
62
 
*****************************************/
63
 
 
64
 
void WP3Listener::insertCharacter(const uint16_t character)
65
 
{
66
 
        if (!isUndoOn())
67
 
        {
68
 
                if (!m_ps->m_isSpanOpened)
69
 
                        _openSpan();
70
 
                appendUCS4(m_parseState->m_textBuffer, (uint32_t)character);
71
 
        }
72
 
}
73
 
 
74
 
void WP3Listener::insertTab(const uint8_t tabType, const float tabPosition)
75
 
{
76
 
        if (!isUndoOn())
77
 
        {
78
 
                if (!m_ps->m_isSpanOpened)
79
 
                        _openSpan();
80
 
                else
81
 
                        _flushText();
82
 
                m_listenerImpl->insertTab();
83
 
        }
84
 
}
85
 
 
86
 
void WP3Listener::insertEOL()
87
 
{
88
 
        if (!isUndoOn())
89
 
        {
90
 
                if (m_ps->m_isTableOpened)
91
 
                {
92
 
                        if (!m_ps->m_isTableRowOpened)
93
 
                                insertRow();
94
 
                        
95
 
                        if (!m_ps->m_isTableCellOpened)
96
 
                        {
97
 
                                insertCell();
98
 
                        }
99
 
                }
100
 
                        
101
 
                if (!m_ps->m_isParagraphOpened && !m_ps->m_isListElementOpened)
102
 
                        _openSpan();
103
 
                if (m_ps->m_isParagraphOpened)
104
 
                        _closeParagraph();
105
 
                if (m_ps->m_isListElementOpened)
106
 
                        _closeListElement();
107
 
        }
108
 
 
109
 
}
110
 
 
111
 
void WP3Listener::endDocument()
112
 
{
113
 
        _closeSpan();
114
 
        _closeParagraph();
115
 
        _closeSection();
116
 
        _closePageSpan();
117
 
        m_listenerImpl->endDocument();
118
 
}
119
 
 
120
 
void WP3Listener::defineTable(const uint8_t position, const uint16_t leftOffset)
121
 
{
122
 
        if (!isUndoOn())
123
 
        {
124
 
                switch (position & 0x07)
125
 
                {
126
 
                case 0:
127
 
                        m_ps->m_tableDefinition.m_positionBits = WPX_TABLE_POSITION_ALIGN_WITH_LEFT_MARGIN;
128
 
                        break;
129
 
                case 1:
130
 
                        m_ps->m_tableDefinition.m_positionBits = WPX_TABLE_POSITION_ALIGN_WITH_RIGHT_MARGIN;
131
 
                        break;
132
 
                case 2:
133
 
                        m_ps->m_tableDefinition.m_positionBits = WPX_TABLE_POSITION_CENTER_BETWEEN_MARGINS;
134
 
                        break;
135
 
                case 3:
136
 
                        m_ps->m_tableDefinition.m_positionBits = WPX_TABLE_POSITION_FULL;
137
 
                        break;
138
 
                case 4:
139
 
                        m_ps->m_tableDefinition.m_positionBits = WPX_TABLE_POSITION_ABSOLUTE_FROM_LEFT_MARGIN;
140
 
                        break;
141
 
                default:
142
 
                        // should not happen
143
 
                        break;
144
 
                }
145
 
                // Note: WordPerfect has an offset from the left edge of the page. We translate it to the offset from the left margin
146
 
                m_ps->m_tableDefinition.m_leftOffset = (float)((double)leftOffset / (double)WPX_NUM_WPUS_PER_INCH) - m_ps->m_paragraphMarginLeft;
147
 
 
148
 
                // remove all the old column information
149
 
                m_ps->m_tableDefinition.columns.clear();
150
 
                m_ps->m_tableDefinition.columnsProperties.clear();
151
 
                m_ps->m_numRowsToSkip.clear();
152
 
        }
153
 
}
154
 
 
155
 
void WP3Listener::addTableColumnDefinition(const uint32_t width, const uint32_t leftGutter, const uint32_t rightGutter, const uint32_t attributes, const uint8_t alignment)
156
 
{
157
 
        if (!isUndoOn())
158
 
        {
159
 
                // define the new column
160
 
                WPXColumnDefinition colDef;
161
 
                colDef.m_width = (float)((double)width / (double)WPX_NUM_WPUS_PER_INCH);
162
 
                colDef.m_leftGutter = (float)((double)width / (double)WPX_NUM_WPUS_PER_INCH);
163
 
                colDef.m_rightGutter = (float)((double)width / (double)WPX_NUM_WPUS_PER_INCH);
164
 
 
165
 
                // add the new column definition to our table definition
166
 
                m_ps->m_tableDefinition.columns.push_back(colDef);
167
 
                
168
 
                WPXColumnProperties colProp;
169
 
                colProp.m_attributes = attributes;
170
 
                colProp.m_alignment = alignment;
171
 
                
172
 
                m_ps->m_tableDefinition.columnsProperties.push_back(colProp);
173
 
                
174
 
                // initialize the variable that tells us how many columns to skip
175
 
                m_ps->m_numRowsToSkip.push_back(0);
176
 
        }
177
 
}
178
 
 
179
 
void WP3Listener::startTable()
180
 
{
181
 
        if (!isUndoOn())
182
 
        {
183
 
                // save the justification information. We will need it after the table ends.
184
 
                m_ps->m_paragraphJustificationBeforeTable = m_ps->m_paragraphJustification;
185
 
                if (m_ps->m_sectionAttributesChanged && !m_ps->m_isTableOpened)
186
 
                        _closeSection();
187
 
                m_ps->m_sectionAttributesChanged = false;
188
 
                if (!m_ps->m_isTableOpened && !m_ps->m_isSectionOpened)
189
 
                        _openSection();
190
 
                _openTable();
191
 
        }
192
 
}
193
 
 
194
 
void WP3Listener::insertRow()
195
 
{
196
 
        if (!isUndoOn())
197
 
                _openTableRow(0, true, false);
198
 
}
199
 
 
200
 
void WP3Listener::insertCell()
201
 
{
202
 
        if (!isUndoOn())
203
 
        {
204
 
                if (m_ps->m_currentTableRow < 0) // cell without a row, invalid
205
 
                        throw ParseException();
206
 
                
207
 
                RGBSColor tmpCellBorderColor(0x00, 0x00, 0x00, 0x64);
208
 
                _openTableCell((uint8_t)m_parseState->m_colSpan, (uint8_t)m_parseState->m_rowSpan, 0x00000000,       
209
 
                                 m_parseState->m_cellFillColor, NULL, &tmpCellBorderColor, TOP);
210
 
                DELETEP(m_parseState->m_cellFillColor);
211
 
 
212
 
                m_ps->m_isCellWithoutParagraph = true;
213
 
                m_ps->m_cellAttributeBits = 0x00000000;
214
 
        }
215
 
}
216
 
 
217
 
void WP3Listener::closeCell()
218
 
{
219
 
        if (!isUndoOn())
220
 
        {
221
 
                insertEOL();
222
 
                _closeTableCell();
223
 
                m_parseState->m_rowSpan = 1;
224
 
                m_parseState->m_colSpan = 1;
225
 
        }
226
 
}
227
 
 
228
 
void WP3Listener::closeRow()
229
 
{
230
 
        if (!isUndoOn())
231
 
        {
232
 
                closeCell();
233
 
 
234
 
                _closeTableRow();
235
 
        }
236
 
}
237
 
 
238
 
void WP3Listener::setTableCellSpan(const uint16_t colSpan, const uint16_t rowSpan)
239
 
{
240
 
        if (!isUndoOn())
241
 
        {
242
 
                m_parseState->m_colSpan=colSpan;
243
 
                m_parseState->m_rowSpan=rowSpan;
244
 
        }
245
 
}
246
 
 
247
 
void WP3Listener::setTableCellFillColor(const RGBSColor * cellFillColor)
248
 
{
249
 
        if (!isUndoOn())
250
 
        {
251
 
                if (m_parseState->m_cellFillColor)
252
 
                        DELETEP(m_parseState->m_cellFillColor);
253
 
                m_parseState->m_cellFillColor = new RGBSColor(*cellFillColor);
254
 
        }
255
 
}
256
 
 
257
 
void WP3Listener::endTable()
258
 
{
259
 
        if (!isUndoOn())
260
 
        {
261
 
                _flushText();
262
 
                _closeTable();
263
 
                // restore the justification that was there before the table.
264
 
                m_ps->m_paragraphJustification = m_ps->m_paragraphJustificationBeforeTable;
265
 
        }
266
 
}
267
 
 
268
 
 
269
 
/****************************************
270
 
 public 'parser' functions
271
 
*****************************************/
272
 
 
273
 
void WP3Listener::attributeChange(const bool isOn, const uint8_t attribute)
274
 
{
275
 
        if (!isUndoOn())
276
 
        {
277
 
                _closeSpan();
278
 
 
279
 
                uint32_t textAttributeBit = 0;
280
 
 
281
 
                // FIXME: handle all the possible attribute bits
282
 
                switch (attribute)
283
 
                {
284
 
                        case WP3_ATTRIBUTE_BOLD:
285
 
                                textAttributeBit = WPX_BOLD_BIT;
286
 
                                break;
287
 
                        case WP3_ATTRIBUTE_ITALICS:
288
 
                                textAttributeBit = WPX_ITALICS_BIT;
289
 
                                break;
290
 
                        case WP3_ATTRIBUTE_UNDERLINE:
291
 
                                textAttributeBit = WPX_UNDERLINE_BIT;
292
 
                                break;
293
 
                        case WP3_ATTRIBUTE_OUTLINE:
294
 
                                textAttributeBit = WPX_OUTLINE_BIT;
295
 
                                break;
296
 
                        case WP3_ATTRIBUTE_SHADOW:
297
 
                                textAttributeBit = WPX_SHADOW_BIT;
298
 
                                break;
299
 
                        case WP3_ATTRIBUTE_REDLINE:
300
 
                                textAttributeBit = WPX_REDLINE_BIT;
301
 
                                break;
302
 
                        case WP3_ATTRIBUTE_STRIKE_OUT:
303
 
                                textAttributeBit = WPX_STRIKEOUT_BIT;
304
 
                                break;
305
 
                        case WP3_ATTRIBUTE_SUBSCRIPT:
306
 
                                textAttributeBit = WPX_SUBSCRIPT_BIT;
307
 
                                break;
308
 
                        case WP3_ATTRIBUTE_SUPERSCRIPT:
309
 
                                textAttributeBit = WPX_SUPERSCRIPT_BIT;
310
 
                                break;
311
 
                        case WP3_ATTRIBUTE_DOUBLE_UNDERLINE:
312
 
                                textAttributeBit = WPX_DOUBLE_UNDERLINE_BIT;
313
 
                                break;
314
 
                        case WP3_ATTRIBUTE_EXTRA_LARGE:
315
 
                                textAttributeBit = WPX_EXTRA_LARGE_BIT;
316
 
                                break;
317
 
                        case WP3_ATTRIBUTE_VERY_LARGE:
318
 
                                textAttributeBit = WPX_VERY_LARGE_BIT;
319
 
                                break;
320
 
                        case WP3_ATTRIBUTE_LARGE:
321
 
                                textAttributeBit = WPX_LARGE_BIT;
322
 
                                break;
323
 
                        case WP3_ATTRIBUTE_SMALL_PRINT:
324
 
                                textAttributeBit = WPX_SMALL_PRINT_BIT;
325
 
                                break;
326
 
                        case WP3_ATTRIBUTE_FINE_PRINT:
327
 
                                textAttributeBit = WPX_FINE_PRINT_BIT;
328
 
                                break;          
329
 
                        case WP3_ATTRIBUTE_SMALL_CAPS:
330
 
                                textAttributeBit = WPX_SMALL_CAPS_BIT;
331
 
                                break;
332
 
                }
333
 
 
334
 
                if (isOn)
335
 
                        m_ps->m_textAttributeBits |= textAttributeBit;
336
 
                else
337
 
                        m_ps->m_textAttributeBits ^= textAttributeBit;
338
 
        }
339
 
}
340
 
 
341
 
void WP3Listener::undoChange(const uint8_t undoType, const uint16_t undoLevel)
342
 
{
343
 
        if (undoType == 0x00) // begin invalid text
344
 
                m_isUndoOn = true;
345
 
        else if (undoType == 0x01) // end invalid text
346
 
                m_isUndoOn = false;
347
 
}
348
 
 
349
 
void WP3Listener::marginChange(const uint8_t side, const uint16_t margin)
350
 
{
351
 
        if (!isUndoOn())
352
 
        {
353
 
                float marginInch = (float)((double)margin/ (double)WPX_NUM_WPUS_PER_INCH);
354
 
 
355
 
                switch(side)
356
 
                {
357
 
                case WPX_LEFT:
358
 
                        m_ps->m_leftMarginByPageMarginChange = marginInch - m_ps->m_pageMarginLeft;
359
 
                        m_ps->m_paragraphMarginLeft = m_ps->m_leftMarginByPageMarginChange
360
 
                                                + m_ps->m_leftMarginByParagraphMarginChange
361
 
                                                + m_ps->m_leftMarginByTabs;
362
 
                        break;
363
 
                case WPX_RIGHT:
364
 
                        m_ps->m_rightMarginByPageMarginChange = marginInch - m_ps->m_pageMarginRight;
365
 
                        m_ps->m_paragraphMarginRight = m_ps->m_rightMarginByPageMarginChange
366
 
                                                + m_ps->m_rightMarginByParagraphMarginChange
367
 
                                                + m_ps->m_rightMarginByTabs;
368
 
                        break;
369
 
                }
370
 
                m_ps->m_listReferencePosition = m_ps->m_paragraphMarginLeft + m_ps->m_paragraphTextIndent;
371
 
        }
372
 
}
373
 
 
374
 
void WP3Listener::justificationChange(const uint8_t justification)
375
 
{
376
 
        if (!isUndoOn())
377
 
        {
378
 
                // could be done simply by:
379
 
                // m_ps->m_paragraphJustification = justification;
380
 
                switch (justification)
381
 
                {
382
 
                case 0x00:
383
 
                        m_ps->m_paragraphJustification = WPX_PARAGRAPH_JUSTIFICATION_LEFT;
384
 
                        break;
385
 
                case 0x01:
386
 
                        m_ps->m_paragraphJustification = WPX_PARAGRAPH_JUSTIFICATION_CENTER;
387
 
                        break;
388
 
                case 0x02:
389
 
                        m_ps->m_paragraphJustification = WPX_PARAGRAPH_JUSTIFICATION_RIGHT;
390
 
                        break;
391
 
                case 0x03:
392
 
                        m_ps->m_paragraphJustification = WPX_PARAGRAPH_JUSTIFICATION_FULL;
393
 
                        break;
394
 
                case 0x04:
395
 
                        m_ps->m_paragraphJustification = WPX_PARAGRAPH_JUSTIFICATION_FULL_ALL_LINES;
396
 
                        break;
397
 
                case 0x05:
398
 
                        m_ps->m_paragraphJustification = WPX_PARAGRAPH_JUSTIFICATION_DECIMAL_ALIGNED;
399
 
                        break;
400
 
                }
401
 
        }
402
 
}
403
 
 
404
 
void WP3Listener::indentFirstLineChange(const int16_t offset)
405
 
{
406
 
        if (!isUndoOn())
407
 
        {
408
 
                float offsetInch = (float)((double)offset / (double)WPX_NUM_WPUS_PER_INCH);
409
 
                m_ps->m_textIndentByParagraphIndentChange = offsetInch;
410
 
                // This is necessary in case we have Indent First Line and Hard Back Tab
411
 
                // in the same time. The Hard Back Tab applies to the current paragraph
412
 
                // only. Indent First Line applies untill an new Indent First Line code.
413
 
                m_ps->m_paragraphTextIndent = m_ps->m_textIndentByParagraphIndentChange
414
 
                                        + m_ps->m_textIndentByTabs;
415
 
                m_ps->m_listReferencePosition = m_ps->m_paragraphMarginLeft + m_ps->m_paragraphTextIndent;
416
 
        }
417
 
}
418
 
 
419
 
void WP3Listener::columnChange(const WPXTextColumnType columnType, const uint8_t numColumns, const std::vector<float> &columnWidth,
420
 
                const std::vector<bool> &isFixedWidth)
421
 
{
422
 
        if (!isUndoOn())
423
 
        {
424
 
                // In WP, the last column ends with a hard column break code.
425
 
                // In this case, we do not really want to insert any column break
426
 
                m_ps->m_isParagraphColumnBreak = false;
427
 
                m_ps->m_isTextColumnWithoutParagraph = false;
428
 
 
429
 
                float remainingSpace = m_ps->m_pageFormWidth - m_ps->m_pageMarginLeft - m_ps->m_pageMarginRight
430
 
                                                - m_ps->m_leftMarginByPageMarginChange - m_ps->m_rightMarginByPageMarginChange;
431
 
                // determine the space that is to be divided between columns whose width is expressed in percentage of remaining space
432
 
                std::vector<WPXColumnDefinition> tmpColumnDefinition;
433
 
                tmpColumnDefinition.clear();
434
 
                if (numColumns > 1)
435
 
                {
436
 
                        int i;
437
 
                        for (i=0; i<columnWidth.size(); i++)
438
 
                        {
439
 
                                if (isFixedWidth[i])
440
 
                                        remainingSpace -= columnWidth[i];
441
 
                        }
442
 
                        WPXColumnDefinition tmpColumn;
443
 
                        for (i=0; i<numColumns; i++)
444
 
                        {
445
 
                                if (i == 0)
446
 
                                        tmpColumn.m_leftGutter = 0.0f;
447
 
                                else if (isFixedWidth[2*i-1])
448
 
                                        tmpColumn.m_leftGutter = 0.5f * columnWidth[2*i-1];
449
 
                                else
450
 
                                        tmpColumn.m_leftGutter = 0.5f * remainingSpace * columnWidth[2*i-1];
451
 
                                
452
 
                                if (i >= (numColumns - 1))
453
 
                                        tmpColumn.m_rightGutter = 0.0f;
454
 
                                else if (isFixedWidth[2*i+1])
455
 
                                        tmpColumn.m_rightGutter = 0.5f * columnWidth[2*i+1];
456
 
                                else
457
 
                                        tmpColumn.m_rightGutter = 0.5f * remainingSpace * columnWidth[2*i+1];
458
 
 
459
 
                                if (isFixedWidth[2*i])
460
 
                                        tmpColumn.m_width = columnWidth[2*i];
461
 
                                else
462
 
                                        tmpColumn.m_width = remainingSpace * columnWidth[2*i];
463
 
                                
464
 
                                tmpColumn.m_width += tmpColumn.m_leftGutter + tmpColumn.m_rightGutter;
465
 
                                
466
 
                                tmpColumnDefinition.push_back(tmpColumn);
467
 
                        }
468
 
                }
469
 
 
470
 
                if (!m_ps->m_inSubDocument && !m_ps->m_isTableOpened)
471
 
                        _closeSection();
472
 
                else
473
 
                        m_ps->m_sectionAttributesChanged = true;
474
 
                m_ps->m_numColumns = numColumns;
475
 
                m_ps->m_textColumns = tmpColumnDefinition;
476
 
                m_ps->m_isTextColumnWithoutParagraph = true;
477
 
        }
478
 
}
479
 
 
480
 
 
481
 
void WP3Listener::setTextColor(const RGBSColor *fontColor)
482
 
{
483
 
        if (!isUndoOn())
484
 
        {
485
 
                _closeSpan();
486
 
                
487
 
                *(m_ps->m_fontColor) = *fontColor;
488
 
        }
489
 
}
490
 
 
491
 
void WP3Listener::setTextFont(const std::string fontName)
492
 
{
493
 
        if (!isUndoOn())
494
 
        {
495
 
                _closeSpan();
496
 
                
497
 
                m_ps->m_fontName->sprintf("%s", fontName.c_str());
498
 
        }
499
 
}
500
 
 
501
 
void WP3Listener::setFontSize(const uint16_t fontSize)
502
 
{
503
 
        if (!isUndoOn())
504
 
        {
505
 
                _closeSpan();
506
 
                
507
 
                m_ps->m_fontSize=float(fontSize);
508
 
        }
509
 
}
510
 
 
511
 
void WP3Listener::insertNoteReference(const std::string noteReference)
512
 
{
513
 
        if (!isUndoOn())
514
 
        {
515
 
                m_parseState->m_noteReference.sprintf("%s", noteReference.c_str());
516
 
        }
517
 
}
518
 
 
519
 
void WP3Listener::insertNote(const WPXNoteType noteType, const WP3SubDocument *subDocument)
520
 
{
521
 
        if (!isUndoOn())
522
 
        {
523
 
                _closeSpan();
524
 
                m_ps->m_isNote = true;
525
 
                WPXNumberingType numberingType = _extractWPXNumberingTypeFromBuf(m_parseState->m_noteReference, ARABIC);
526
 
                int number = _extractDisplayReferenceNumberFromBuf(m_parseState->m_noteReference, numberingType);
527
 
                m_parseState->m_noteReference.clear();
528
 
                
529
 
                WPXPropertyList propList;
530
 
                propList.insert("libwpd:number", number);
531
 
 
532
 
                if (noteType == FOOTNOTE)
533
 
                        m_listenerImpl->openFootnote(propList);
534
 
                else
535
 
                        m_listenerImpl->openEndnote(propList);
536
 
 
537
 
                handleSubDocument(subDocument, false, m_parseState->m_tableList, 0);
538
 
 
539
 
                if (noteType == FOOTNOTE)
540
 
                        m_listenerImpl->closeFootnote();
541
 
                else
542
 
                        m_listenerImpl->closeEndnote();
543
 
                m_ps->m_isNote = false;
544
 
        }
545
 
}
546
 
 
547
 
void WP3Listener::_handleSubDocument(const WPXSubDocument *subDocument, const bool isHeaderFooter, WPXTableList tableList, int nextTableIndice)
548
 
{
549
 
                // save our old parsing state on our "stack"
550
 
                WP3ParsingState *oldParseState = m_parseState;
551
 
        
552
 
                m_parseState = new WP3ParsingState();
553
 
 
554
 
                if (subDocument)
555
 
                        subDocument->parse(this);
556
 
                else
557
 
                        _openSpan();
558
 
                
559
 
                // Close the sub-document properly
560
 
                if (m_ps->m_isParagraphOpened)
561
 
                        _closeParagraph();
562
 
                if (m_ps->m_isListElementOpened)
563
 
                        _closeListElement();
564
 
 
565
 
                m_ps->m_currentListLevel = 0;
566
 
                _changeList();
567
 
 
568
 
#if 0
569
 
                _closeSection();
570
 
#endif
571
 
 
572
 
                // restore our old parsing state
573
 
                delete m_parseState;
574
 
                m_parseState = oldParseState;
575
 
}
576
 
        
577
 
void WP3Listener::_openParagraph()
578
 
{
579
 
 
580
 
        if (m_ps->m_isTableOpened)
581
 
        {
582
 
                if (!m_ps->m_isTableRowOpened)
583
 
                        insertRow();
584
 
                                        
585
 
                if (!m_ps->m_isTableCellOpened)
586
 
                {
587
 
                        insertCell();
588
 
                }
589
 
        }
590
 
 
591
 
        WPXListener::_openParagraph();
592
 
}
593
 
 
594
 
/****************************************
595
 
 private functions
596
 
*****************************************/
597
 
 
598
 
void WP3Listener::_flushText()
599
 
{
600
 
        if (m_parseState->m_textBuffer.len())
601
 
                m_listenerImpl->insertText(m_parseState->m_textBuffer);
602
 
        m_parseState->m_textBuffer.clear();
 
27
 
 
28
WP3Listener::WP3Listener(std::list<WPXPageSpan> &pageList, WPXHLListenerImpl *listenerImpl)
 
29
{
603
30
}