66
67
if (readVal < (uint8_t)0x20)
68
WPD_DEBUG_MSG(("Offset: %i, Handling Control Character 0x%2x\n", (unsigned int)input->tell(), readVal));
69
WPD_DEBUG_MSG(("Offset: %i, Handling Control Character 0x%2x\n", (unsigned int)input->tell(), readVal));
73
listener->insertTab(0, 0.0);
75
case 0x0A: // hard new line
76
listener->insertEOL();
78
case 0x0B: // soft new page
79
listener->insertBreak(WPX_SOFT_PAGE_BREAK);
81
case 0x0C: // hard new page
82
listener->insertBreak(WPX_PAGE_BREAK);
84
case 0x0D: // soft new line
85
listener->insertCharacter(' ');
88
// unsupported or undocumented token, ignore
74
listener->insertTab(0, 0.0);
76
case 0x0A: // hard new line
77
listener->insertEOL();
79
case 0x0B: // soft new page
80
listener->insertBreak(WPX_SOFT_PAGE_BREAK);
82
case 0x0C: // hard new page
83
listener->insertBreak(WPX_PAGE_BREAK);
85
case 0x0D: // soft new line
86
listener->insertCharacter(' ');
89
// unsupported or undocumented token, ignore
92
93
else if (readVal >= (uint8_t)0x20 && readVal <= (uint8_t)0x7F)
94
WPD_DEBUG_MSG(("Offset: %i, Handling Ascii Character 0x%2x\n", (unsigned int)input->tell(), readVal));
95
WPD_DEBUG_MSG(("Offset: %i, Handling Ascii Character 0x%2x\n", (unsigned int)input->tell(), readVal));
96
97
// normal ASCII characters
97
98
listener->insertCharacter( readVal );
99
100
else if (readVal >= (uint8_t)0x80 && readVal <= (uint8_t)0xBF)
101
WPD_DEBUG_MSG(("Offset: %i, Handling Single Character Function 0x%2x\n", (unsigned int)input->tell(), readVal));
102
WPD_DEBUG_MSG(("Offset: %i, Handling Single Character Function 0x%2x\n", (unsigned int)input->tell(), readVal));
103
104
// single character function codes
107
listener->attributeChange(true, WP42_ATTRIBUTE_STRIKE_OUT);
110
listener->attributeChange(false, WP42_ATTRIBUTE_STRIKE_OUT);
113
listener->attributeChange(true, WP42_ATTRIBUTE_UNDERLINE);
116
listener->attributeChange(false, WP42_ATTRIBUTE_UNDERLINE);
120
listener->attributeChange(true, WP42_ATTRIBUTE_REDLINE);
123
listener->attributeChange(false, WP42_ATTRIBUTE_REDLINE);
127
listener->attributeChange(false, WP42_ATTRIBUTE_BOLD);
130
listener->attributeChange(true, WP42_ATTRIBUTE_BOLD);
134
listener->attributeChange(true, WP42_ATTRIBUTE_ITALICS);
137
listener->attributeChange(false, WP42_ATTRIBUTE_ITALICS);
140
listener->attributeChange(true, WP42_ATTRIBUTE_SHADOW);
143
listener->attributeChange(false, WP42_ATTRIBUTE_SHADOW);
147
// unsupported or undocumented token, ignore
108
listener->attributeChange(true, WP42_ATTRIBUTE_STRIKE_OUT);
111
listener->attributeChange(false, WP42_ATTRIBUTE_STRIKE_OUT);
114
listener->attributeChange(true, WP42_ATTRIBUTE_UNDERLINE);
117
listener->attributeChange(false, WP42_ATTRIBUTE_UNDERLINE);
121
listener->attributeChange(true, WP42_ATTRIBUTE_REDLINE);
124
listener->attributeChange(false, WP42_ATTRIBUTE_REDLINE);
128
listener->attributeChange(false, WP42_ATTRIBUTE_BOLD);
131
listener->attributeChange(true, WP42_ATTRIBUTE_BOLD);
135
listener->attributeChange(true, WP42_ATTRIBUTE_ITALICS);
138
listener->attributeChange(false, WP42_ATTRIBUTE_ITALICS);
141
listener->attributeChange(true, WP42_ATTRIBUTE_SHADOW);
144
listener->attributeChange(false, WP42_ATTRIBUTE_SHADOW);
148
// unsupported or undocumented token, ignore
151
152
else if (readVal >= (uint8_t)0xC0 && readVal <= (uint8_t)0xFE)
222
223
void WP42Parser::parseSubDocument(WPXDocumentInterface *documentInterface)
224
225
std::list<WPXPageSpan> pageList;
225
std::vector<WP42SubDocument *> subDocuments;
226
std::vector<WP42SubDocument *> subDocuments;
227
228
WPXInputStream *input = getInput();
231
232
WP42StylesListener stylesListener(pageList, subDocuments);
232
233
stylesListener.startSubDocument();
233
234
parseDocument(input, 0, &stylesListener);
234
235
stylesListener.endSubDocument();
236
237
WP42ContentListener listener(pageList, subDocuments, documentInterface);
237
238
listener.startSubDocument();
238
239
parseDocument(input, 0, &listener);