69
96
const UCSString &abstract, const UCSString &descriptiveName,
70
97
const UCSString &descriptiveType)
99
UTF8String authorUTF8(author);
100
UTF8String subjectUTF8(subject);
101
UTF8String publisherUTF8(publisher);
102
UTF8String categoryUTF8(category);
103
UTF8String keywordsUTF8(keywords);
104
UTF8String languageUTF8(language);
105
UTF8String abstractUTF8(abstract);
106
UTF8String descriptiveNameUTF8(descriptiveName);
107
UTF8String descriptiveTypeUTF8(descriptiveType);
108
__iprintf("setDocumentMetaData(author: %s, subject: %s, publisher: %s, category: %s, keywords: %s, language: %s, abstract: %s, descriptiveName: %s, descriptiveType: %s)\n",
109
authorUTF8.getUTF8(), subjectUTF8.getUTF8(),
110
publisherUTF8.getUTF8(), categoryUTF8.getUTF8(),
111
keywordsUTF8.getUTF8(), languageUTF8.getUTF8(),
112
abstractUTF8.getUTF8(), descriptiveNameUTF8.getUTF8(),
113
descriptiveTypeUTF8.getUTF8()
74
117
void RawListenerImpl::startDocument()
76
__iuprintf("startDocument()\n");
119
_U(("startDocument()\n"), LC_START_DOCUMENT);
79
122
void RawListenerImpl::endDocument()
81
__idprintf("endDocument()\n");
124
_D(("endDocument()\n"),
84
128
void RawListenerImpl::openPageSpan(const int span, const bool isLastPageSpan,
85
129
const float marginLeft, const float marginRight,
86
130
const float marginTop, const float marginBottom)
88
__iuprintf("openPageSpan(TODO: add args)\n");
132
_U(("openPageSpan(span: %d, isLastPageSpan: %s, marginLeft: %.4f, marginRight: %.4f, marginTop: %.4f, marginBottom: %.4f\n",
133
span, (isLastPageSpan ? "true" : "false"), marginLeft, marginRight, marginTop, marginBottom),
91
137
void RawListenerImpl::closePageSpan()
93
__idprintf("closePageSpan()\n");
139
_D(("closePageSpan()\n"),
96
143
void RawListenerImpl::openHeaderFooter(const WPXHeaderFooterType headerFooterType, const WPXHeaderFooterOccurence headerFooterOccurence)
98
__iuprintf("openHeaderFooter(TODO: add args)\n");
145
_U(("openHeaderFooter(headerFooterType: %d, headerFooterOccurence: %d)\n",
146
headerFooterType, headerFooterOccurence),
147
LC_OPEN_HEADER_FOOTER);
101
150
void RawListenerImpl::closeHeaderFooter(const WPXHeaderFooterType headerFooterType, const WPXHeaderFooterOccurence headerFooterOccurence)
103
__idprintf("closeHeaderFooter(TODO: add args)\n");
152
_D(("closeHeaderFooter(headerFooterType: %d, headerFooterOccurence: %d)\n",
153
headerFooterType, headerFooterOccurence),
154
LC_OPEN_HEADER_FOOTER);
106
157
void RawListenerImpl::openParagraph(const guint8 paragraphJustification, const guint32 textAttributeBits,
107
const float marginLeftOffset, const float marginRightOffset,
108
const gchar *fontName, const float fontSize,
109
const float lineSpacing,
110
const bool isColumnBreak, const bool isPageBreak)
158
const float marginLeftOffset, const float marginRightOffset,
159
const gchar *fontName, const float fontSize,
160
const float lineSpacing,
161
const bool isColumnBreak, const bool isPageBreak)
112
__iuprintf("openParagraph(TODO: add args)\n");
163
_U(("openParagraph(paragraphJustification: %d, textAttributeBits: %d, marginLeftOffset: %.4f, marginRightOffset: %.4f, fontName: %s, fontSize: %.4f, lineSpacing: %.4f, isColumnBreak: %s, isPageBreak: %s)\n",
164
paragraphJustification, textAttributeBits,
165
marginLeftOffset, marginRightOffset,
167
lineSpacing, (isColumnBreak ? "true" : "false"), (isPageBreak ? "true" : "false")),
115
171
void RawListenerImpl::closeParagraph()
117
__idprintf("closeParagraph()\n");
173
_D(("closeParagraph()\n"),
120
177
void RawListenerImpl::openSpan(const guint32 textAttributeBits, const gchar *fontName, const float fontSize)
122
__iuprintf("openSpan(textAttributeBits: %u, fontName: %s, fontSize: %.4f)\n", textAttributeBits, fontName, fontSize);
179
_U(("openSpan(textAttributeBits: %u, fontName: %s, fontSize: %.4f\n",
180
textAttributeBits, fontName, fontSize), LC_OPEN_SPAN);
125
183
void RawListenerImpl::closeSpan()
127
__idprintf("closeSpan()\n");
185
_D(("closeSpan()\n"),
130
189
void RawListenerImpl::openSection(const unsigned int numColumns, const float spaceAfter)
132
__iuprintf("openSection(numColumns: %u, spaceAfter: %.4f)\n", numColumns, spaceAfter);
191
_U(("openSection(numColumns: %u, spaceAfter: %.4f)\n", numColumns, spaceAfter),
135
195
void RawListenerImpl::closeSection()
137
__idprintf("closeSection()\n");
197
_D(("closeSection()\n"),
140
201
void RawListenerImpl::insertTab()
145
206
void RawListenerImpl::insertText(const UCSString &text)
208
UTF8String textUTF8(text);
209
__iprintf("insertText(text: %s)\n", textUTF8.getUTF8());
149
212
void RawListenerImpl::insertLineBreak()
151
214
__iprintf("insertLineBreak()\n");
154
void RawListenerImpl::defineOrderedListLevel(const int listID, const guint16 listLevel, const WPXNumberingType listType,
217
void RawListenerImpl::defineOrderedListLevel(const int listID, const guint16 listLevel, const WPXNumberingType listType,
155
218
const UCSString &textBeforeNumber, const UCSString &textAfterNumber,
156
219
const int startingNumber)
221
UTF8String textBeforeNumberUTF8(textBeforeNumber);
222
UTF8String textAfterNumberUTF8(textAfterNumber);
223
__iprintf("defineOrderedListLevel(listID: %d, listLevel: %d, listType: %d, textBeforeNumber: %s, textAfterNumber: %s, startingNumber: %d)\n",
224
listID, listLevel, listType,
225
textBeforeNumberUTF8.getUTF8(), textAfterNumberUTF8.getUTF8(),
160
229
void RawListenerImpl::defineUnorderedListLevel(const int listID, const guint16 listLevel, const UCSString &bullet)
231
UTF8String bulletUTF8(bullet);
232
__iprintf("defineUnorderedListLevel(listID: %d, listLevel: %d, bullet: %s)\n", listID, listLevel, bulletUTF8.getUTF8());
164
235
void RawListenerImpl::openOrderedListLevel(const int listID)
237
_U(("openOrderedListLevel(listID: %d)\n", listID),
238
LC_OPEN_ORDERED_LIST_LEVEL);
168
241
void RawListenerImpl::openUnorderedListLevel(const int listID)
243
_U(("openUnorderedListLevel(listID: %d)\n", listID),
244
LC_OPEN_UNORDERED_LIST_LEVEL);
172
247
void RawListenerImpl::closeOrderedListLevel()
249
_D(("closeOrderedListLevel()\n"),
250
LC_OPEN_ORDERED_LIST_LEVEL);
176
253
void RawListenerImpl::closeUnorderedListLevel()
255
_D(("closeUnorderedListLevel()\n"),
256
LC_OPEN_UNORDERED_LIST_LEVEL);
180
259
void RawListenerImpl::openListElement(const guint8 paragraphJustification, const guint32 textAttributeBits,
182
261
const gchar *fontName, const float fontSize,
183
262
const float lineSpacing)
264
_U(("openListElement(paragraphJustification: %d, textAttributeBits: %d, marginLeftOffset: %.4f, marginRightOffset: %.4f, fontName: %s, fontSize: %.4f, lineSpacing: %.4f)\n",
265
paragraphJustification, textAttributeBits,
266
marginLeftOffset, marginRightOffset,
269
LC_OPEN_LIST_ELEMENT);
187
272
void RawListenerImpl::closeListElement()
274
_D(("closeListElement()\n"),
275
LC_OPEN_LIST_ELEMENT);
191
278
void RawListenerImpl::openFootnote(int number)
193
__iuprintf("openFootnote(number: %d)\n", number);
280
_U(("openFootnote(number: %d)\n", number),
196
284
void RawListenerImpl::closeFootnote()
198
__idprintf("closeFootnote()\n");
286
_D(("closeFootnote()\n"),
201
290
void RawListenerImpl::openEndnote(int number)
203
__iuprintf("openEndnote(number: %d)\n", number);
292
_U(("openEndnote(number: %d)\n", number),
206
296
void RawListenerImpl::closeEndnote()
208
__idprintf("closeEndnote()\n");
298
_D(("closeEndnote()\n"),
211
void RawListenerImpl::openTable(const guint8 tablePositionBits,
302
void RawListenerImpl::openTable(const guint8 tablePositionBits,
212
303
const float marginLeftOffset, const float marginRightOffset,
213
304
const float leftOffset, const vector < WPXColumnDefinition > &columns)
306
_U(("openTable(tablePositionBits: %d, marginLeftOffset: %.4f, marginRightOffset: %.4f, leftOffset: %.4f, TODO: columns defs.)\n",
307
tablePositionBits, marginLeftOffset, marginRightOffset, leftOffset),
217
311
void RawListenerImpl::openTableRow()
313
_U(("openTableRow()\n"),
221
317
void RawListenerImpl::closeTableRow()
319
_D(("closeTableRow()\n"),
225
void RawListenerImpl::openTableCell(const guint32 col, const guint32 row, const guint32 colSpan, const guint32 rowSpan,
226
const guint8 borderBits,
323
void RawListenerImpl::openTableCell(const guint32 col, const guint32 row, const guint32 colSpan, const guint32 rowSpan,
324
const guint8 borderBits,
227
325
const RGBSColor * cellFgColor, const RGBSColor * cellBgColor)
327
_U(("openTableCell(col: %d, row: %d, colSpan: %d, rowSpan: %d, borderBits: %d, cellFgColor: #%02x%02x%02x s:%02x, cellBgColor: #%02x%02x%02x s:%02x)\n",
328
col, row, colSpan, rowSpan,
330
// The saturation cannot ever be more that 0x64. It it is, cellFgColor or cellBgColor is NULL
331
(cellFgColor?cellFgColor->m_r:0xff), (cellFgColor?cellFgColor->m_g:0xff), (cellFgColor?cellFgColor->m_b:0xff), (cellFgColor?cellFgColor->m_s:0xff),
332
(cellBgColor?cellBgColor->m_r:0xff), (cellBgColor?cellBgColor->m_g:0xff), (cellBgColor?cellBgColor->m_b:0xff), (cellBgColor?cellBgColor->m_s:0xff)),
231
336
void RawListenerImpl::closeTableCell()
338
_D(("closeTableCell()\n"),
235
342
void RawListenerImpl::insertCoveredTableCell(const guint32 col, const guint32 row)
344
__iprintf("insertCoveredTableCell(col: %d, row: %d)\n", col, row);
239
347
void RawListenerImpl::closeTable()
244
void RawListener::insertCharacter(const guint16 character)
247
// first convert from ucs2 to ucs4
248
gunichar characterUCS4 = (gunichar) character;
250
// then convert from ucs4 to utf8 and write it
251
gchar *characterUTF8 = g_ucs4_to_utf8(&characterUCS4, 1, NULL, NULL, NULL); // TODO: handle errors
252
printf("%s", characterUTF8);
255
g_free(characterUTF8);
259
void RawListener::undoChange(const guint8 undoType, const guint16 undoLevel)
261
if (undoType == WP6_UNDO_GROUP_INVALID_TEXT_START) {
262
//printf("<UNDO ON>");
265
else if (undoType == WP6_UNDO_GROUP_INVALID_TEXT_END) {
266
//printf("<UNDO OFF>");
271
void RawListener::lineSpacingChange(const float lineSpacing)
273
printf("<line-spacing:%i>", lineSpacing);
277
void RawListener::justificationChange(const guint8 justification)
279
printf("<justification:%i>", justification);
283
void RawListener::insertTab(const guint8 tabType)
286
printf("<TAB: %i>", tabType);
290
void RawListener::insertEOL()
297
void RawListener::insertBreak(const guint8 breakType)
302
printf("\n<HARD PAGE BREAK>\n");
304
case WPX_SOFT_PAGE_BREAK:
305
printf("\n<SOFT PAGE BREAK>\n");
307
case WPX_COLUMN_BREAK:
308
printf("\n<COLUMN BREAK>\n");
313
void RawListener::setDate(const guint16 year, const guint8 month, const guint8 day,
314
const guint8 hour, const guint8 minute, const guint8 second,
315
const guint8 dayOfWeek, const guint8 timeZone, const guint8 unused)
317
printf("<DATE SET year: %i month: %i day: %i hour: %i minute: %i second: %i dayOfWeek: %i timeZone: %i unused: %i>\n");
319
void RawListener::setExtendedInformation(const guint16 type, const UCSString &data)
321
UTF8String tempUTF8(data);
322
printf("<EXTENDED INFO type: %i data: %s>\n", type, tempUTF8.getUTF8());
325
void RawListener::updateOutlineDefinition(const WP6OutlineLocation outlineLocation, const guint16 outlineHash,
326
const guint8 *numberingMethods, const guint8 tabBehaviourFlag)
329
printf("<UPDATE OUTLINE DEFINITION (outlineHash:%i, numbering-methods:.., tab-behaviour-flag:%i)>\n",
330
outlineHash, tabBehaviourFlag);
334
void RawListener::paragraphNumberOn(const guint16 outlineHash, const guint8 level, const guint8 flag)
337
printf("<PARAGRAPH NUMBER ON (outlineHash:%i, level:%i, flag:%i)>",
338
outlineHash, level, flag);
342
void RawListener::paragraphNumberOff()
345
printf("<PARAGRAPH NUMBER OFF>");
349
void RawListener::displayNumberReferenceGroupOn(const guint8 subGroup, const guint8 level)
352
printf("<DISPLAY NUMBER REF ON (subgroup:%i, level:%i)>", subGroup, level);
356
void RawListener::displayNumberReferenceGroupOff(const guint8 subGroup)
359
printf("<DISPLAY NUMBER REF OFF (subgroup:%i)>", subGroup);
363
void RawListener::styleGroupOn(const guint8 subGroup)
366
printf("<STYLE GROUP ON (subgroup:%i)>", subGroup);
370
void RawListener::styleGroupOff(const guint8 subGroup)
373
printf("<STYLE GROUP OFF (subgroup:%i)>", subGroup);
377
void RawListener::suppressPageCharacteristics(const guint8 suppressCode)
380
printf("<SUPPRESS PAGE CHARACTERISTICS (suppressCode: %i)>", suppressCode);
384
void RawListener::insertCell(const guint8 colSpan, const guint8 rowSpan, const bool boundFromLeft, const bool boundFromAbove,
385
const guint8 borderBits, const RGBSColor * cellFgColor, const RGBSColor * cellBgColor)
388
printf("<INSERT CELL (colSpan: %i, rowSpan: %i, borderBits: %x)>", colSpan, rowSpan, borderBits);
349
_D(("closeTable()\n"),