30
30
typedef KGenericFactory<KprKword> KprKwordFactory;
31
K_EXPORT_COMPONENT_FACTORY( libkprkword, KprKwordFactory( "kofficefilters" ) )
31
K_EXPORT_COMPONENT_FACTORY(libkprkword, KprKwordFactory("kofficefilters"))
33
KprKword::KprKword(QObject *parent,const QStringList&) :
33
KprKword::KprKword(QObject *parent, const QStringList&) :
39
39
// This filter can act as an import filter for KWord and as an export
40
40
// filter for KPresenter (isn't our architecture really nice ? :)
41
41
// This is why we use the file-to-file method, not a QDomDoc one.
42
KoFilter::ConversionStatus KprKword::convert( const QByteArray& from, const QByteArray& to )
42
KoFilter::ConversionStatus KprKword::convert(const QByteArray& from, const QByteArray& to)
44
if(to!="application/x-kword" || from!="application/x-kpresenter")
44
if (to != "application/x-kword" || from != "application/x-kpresenter")
45
45
return KoFilter::NotImplemented;
47
KoStoreDevice* inpdev = m_chain->storageFile( "root", KoStore::Read );
47
KoStoreDevice* inpdev = m_chain->storageFile("root", KoStore::Read);
50
49
kError(30502) << "Unable to open input stream" << endl;
51
50
return KoFilter::StorageCreationError;
54
inpdoc.setContent( inpdev );
57
outdoc.appendChild( outdoc.createProcessingInstruction( "xml", "version=\"1.0\" encoding=\"UTF-8\"" ) );
58
QDomElement kwdoc = outdoc.createElement( "DOC" );
59
kwdoc.setAttribute( "editor", "KprKword converter" );
60
kwdoc.setAttribute( "mime", "application/x-kword" );
61
kwdoc.setAttribute( "syntaxVersion", 1 );
62
outdoc.appendChild( kwdoc );
64
QDomElement paper = outdoc.createElement( "PAPER" );
65
kwdoc.appendChild( paper );
66
paper.setAttribute( "format", 1 ); // A4. How on earth could I know what the user really wants ? :)
67
paper.setAttribute( "width", 595 );
68
paper.setAttribute( "height", 841 );
69
QDomElement borders = outdoc.createElement( "PAPERBORDERS" );
70
paper.appendChild( borders );
71
borders.setAttribute( "left", 28 );
72
borders.setAttribute( "top", 42 );
73
borders.setAttribute( "right", 28 );
74
borders.setAttribute( "bottom", 42 );
76
QDomElement framesets = outdoc.createElement( "FRAMESETS" );
77
kwdoc.appendChild( framesets );
79
frameset = outdoc.createElement( "FRAMESET" );
80
framesets.appendChild( frameset );
81
frameset.setAttribute( "frameType", 1 ); // text
82
frameset.setAttribute( "frameInfo", 0 ); // body
83
QDomElement frame = outdoc.createElement( "FRAME" );
84
frameset.appendChild( frame );
85
frame.setAttribute( "left", 28 );
86
frame.setAttribute( "top", 42 );
87
frame.setAttribute( "right", 566 );
88
frame.setAttribute( "bottom", 798 );
89
frame.setAttribute( "autoCreateNewFrame", 1 );
90
frame.setAttribute( "newFrameBehaviour", 0 );
53
inpdoc.setContent(inpdev);
56
outdoc.appendChild(outdoc.createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\""));
57
QDomElement kwdoc = outdoc.createElement("DOC");
58
kwdoc.setAttribute("editor", "KprKword converter");
59
kwdoc.setAttribute("mime", "application/x-kword");
60
kwdoc.setAttribute("syntaxVersion", 1);
61
outdoc.appendChild(kwdoc);
63
QDomElement paper = outdoc.createElement("PAPER");
64
kwdoc.appendChild(paper);
65
paper.setAttribute("format", 1); // A4. How on earth could I know what the user really wants ? :)
66
paper.setAttribute("width", 595);
67
paper.setAttribute("height", 841);
68
QDomElement borders = outdoc.createElement("PAPERBORDERS");
69
paper.appendChild(borders);
70
borders.setAttribute("left", 28);
71
borders.setAttribute("top", 42);
72
borders.setAttribute("right", 28);
73
borders.setAttribute("bottom", 42);
75
QDomElement framesets = outdoc.createElement("FRAMESETS");
76
kwdoc.appendChild(framesets);
78
frameset = outdoc.createElement("FRAMESET");
79
framesets.appendChild(frameset);
80
frameset.setAttribute("frameType", 1); // text
81
frameset.setAttribute("frameInfo", 0); // body
82
QDomElement frame = outdoc.createElement("FRAME");
83
frameset.appendChild(frame);
84
frame.setAttribute("left", 28);
85
frame.setAttribute("top", 42);
86
frame.setAttribute("right", 566);
87
frame.setAttribute("bottom", 798);
88
frame.setAttribute("autoCreateNewFrame", 1);
89
frame.setAttribute("newFrameBehaviour", 0);
92
91
titleStyleName = i18n("Slide Title");
98
97
// Create a style for the slide titles
100
QDomElement styles = outdoc.createElement( "STYLES" );
101
kwdoc.appendChild( styles );
103
QDomElement style = outdoc.createElement( "STYLE" );
104
styles.appendChild( style );
105
QDomElement elem = outdoc.createElement( "NAME" );
106
style.appendChild( elem );
107
elem.setAttribute( "value", titleStyleName );
108
elem = outdoc.createElement( "FOLLOWING" );
109
style.appendChild( elem );
110
elem.setAttribute( "name", "Standard" ); // no i18n here!
112
QDomElement counter = outdoc.createElement( "COUNTER" );
113
style.appendChild( counter );
114
counter.setAttribute( "type", 1 ); // numbered
115
counter.setAttribute( "depth", 0 );
116
counter.setAttribute( "start", 1 );
117
counter.setAttribute( "numberingtype", 1 ); // chapter
118
counter.setAttribute( "righttext", "." );
120
QDomElement format = outdoc.createElement( "FORMAT" );
121
style.appendChild( format );
122
QDomElement font = outdoc.createElement( "FONT" );
123
format.appendChild( font );
124
font.setAttribute( "name", titleFont ); // found when reading the first title
125
QDomElement size = outdoc.createElement( "SIZE" );
126
format.appendChild( size );
127
size.setAttribute( "value", 24 );
128
QDomElement bold = outdoc.createElement( "WEIGHT" );
129
format.appendChild( bold );
130
bold.setAttribute( "value", 75 );
99
QDomElement styles = outdoc.createElement("STYLES");
100
kwdoc.appendChild(styles);
102
QDomElement style = outdoc.createElement("STYLE");
103
styles.appendChild(style);
104
QDomElement elem = outdoc.createElement("NAME");
105
style.appendChild(elem);
106
elem.setAttribute("value", titleStyleName);
107
elem = outdoc.createElement("FOLLOWING");
108
style.appendChild(elem);
109
elem.setAttribute("name", "Standard"); // no i18n here!
111
QDomElement counter = outdoc.createElement("COUNTER");
112
style.appendChild(counter);
113
counter.setAttribute("type", 1); // numbered
114
counter.setAttribute("depth", 0);
115
counter.setAttribute("start", 1);
116
counter.setAttribute("numberingtype", 1); // chapter
117
counter.setAttribute("righttext", ".");
119
QDomElement format = outdoc.createElement("FORMAT");
120
style.appendChild(format);
121
QDomElement font = outdoc.createElement("FONT");
122
format.appendChild(font);
123
font.setAttribute("name", titleFont); // found when reading the first title
124
QDomElement size = outdoc.createElement("SIZE");
125
format.appendChild(size);
126
size.setAttribute("value", 24);
127
QDomElement bold = outdoc.createElement("WEIGHT");
128
format.appendChild(bold);
129
bold.setAttribute("value", 75);
132
131
// Create the standard style
133
style = outdoc.createElement( "STYLE" );
134
styles.appendChild( style );
135
elem = outdoc.createElement( "NAME" );
136
style.appendChild( elem );
137
elem.setAttribute( "value", "Standard" ); // no i18n here!
138
format = outdoc.createElement( "FORMAT" );
139
style.appendChild( format ); // empty format == use defaults
132
style = outdoc.createElement("STYLE");
133
styles.appendChild(style);
134
elem = outdoc.createElement("NAME");
135
style.appendChild(elem);
136
elem.setAttribute("value", "Standard"); // no i18n here!
137
format = outdoc.createElement("FORMAT");
138
style.appendChild(format); // empty format == use defaults
141
140
// Write output file
143
KoStoreDevice* out = m_chain->storageFile( "root", KoStore::Write );
142
KoStoreDevice* out = m_chain->storageFile("root", KoStore::Write);
145
144
kError(30502) << "Unable to open output file!" << endl;
146
145
return KoFilter::StorageCreationError;
148
147
QByteArray cstring = outdoc.toByteArray(); // utf-8 already
149
out->write( cstring.data(), cstring.length() );
148
out->write(cstring.data(), cstring.length());
151
150
return KoFilter::OK;
154
153
// This class is used to sort the objects by y position
158
158
QDomElement elem;
159
bool operator < ( const KprObject & c ) const
159
bool operator < (const KprObject & c) const {
163
bool operator == ( const KprObject & c ) const
162
bool operator == (const KprObject & c) const {
199
194
int curPage = -1;
200
195
//kDebug() <<"found" << objList.count() <<" objects";
201
196
foreach(KprObject* it, objList) {
203
198
QDomElement elem = it->elem;
204
199
// Detect the first object of each page
205
int page = int( it->y / ptPageHeight );
206
bool isTitle = ( page > curPage );
200
int page = int(it->y / ptPageHeight);
201
bool isTitle = (page > curPage);
207
202
//kDebug() <<"KprKword::convert y=" << it->y <<" ptPageHeight=" << ptPageHeight
208
203
// << " isTitle=" << isTitle << endl;
211
QDomElement textObj = elem.namedItem( "TEXTOBJ" ).toElement();
206
QDomElement textObj = elem.namedItem("TEXTOBJ").toElement();
212
207
if (textObj.isNull())
214
209
// For each paragraph in this text object...
215
QDomNodeList lst = textObj.elementsByTagName( "P" );
210
QDomNodeList lst = textObj.elementsByTagName("P");
216
211
uint lstcount = lst.count();
217
for ( uint item = 0; item < lstcount ; ++item )
219
QDomElement p = lst.item( item ).toElement();
212
for (uint item = 0; item < lstcount ; ++item) {
213
QDomElement p = lst.item(item).toElement();
221
215
// Create paragraph in KWord doc
222
QDomElement parag = outdoc.createElement( "PARAGRAPH" );
223
frameset.appendChild( parag );
216
QDomElement parag = outdoc.createElement("PARAGRAPH");
217
frameset.appendChild(parag);
225
QDomElement outFormatsElem = outdoc.createElement( "FORMATS" );
219
QDomElement outFormatsElem = outdoc.createElement("FORMATS");
228
222
// For each text element in the paragraph...
229
223
QDomElement textElem = p.firstChild().toElement();
231
QDomElement counter = p.namedItem( "COUNTER" ).toElement();
232
QDomElement indent=p.namedItem("INDENTS").toElement();
233
QDomElement lineSpacing=p.namedItem( "LINESPACING" ).toElement();
234
QDomElement offset=p.namedItem("OFFSETS").toElement();
235
QDomElement leftBorder = p.namedItem( "LEFTBORDER" ).toElement();
236
QDomElement rightBorder = p.namedItem( "RIGHTBORDER" ).toElement();
237
QDomElement topBorder = p.namedItem( "TOPBORDER" ).toElement();
238
QDomElement bottomBorder = p.namedItem( "BOTTOMBORDER" ).toElement();
240
QDomElement shadow=p.namedItem("SHADOW").toElement();
242
for ( ; !textElem.isNull() ; textElem = textElem.nextSibling().toElement() )
225
QDomElement counter = p.namedItem("COUNTER").toElement();
226
QDomElement indent = p.namedItem("INDENTS").toElement();
227
QDomElement lineSpacing = p.namedItem("LINESPACING").toElement();
228
QDomElement offset = p.namedItem("OFFSETS").toElement();
229
QDomElement leftBorder = p.namedItem("LEFTBORDER").toElement();
230
QDomElement rightBorder = p.namedItem("RIGHTBORDER").toElement();
231
QDomElement topBorder = p.namedItem("TOPBORDER").toElement();
232
QDomElement bottomBorder = p.namedItem("BOTTOMBORDER").toElement();
234
QDomElement shadow = p.namedItem("SHADOW").toElement();
236
for (; !textElem.isNull() ; textElem = textElem.nextSibling().toElement()) {
244
237
int oldLen = text.length();
245
238
text += textElem.text();
246
239
//kDebug() <<"KprKword::convert text now" << text;
247
QDomElement outFormatElem = outdoc.createElement( "FORMAT" );
240
QDomElement outFormatElem = outdoc.createElement("FORMAT");
249
if ( textElem.attribute( "italic" ).toInt() )
242
if (textElem.attribute("italic").toInt()) {
251
243
QDomElement e = outdoc.createElement("ITALIC");
252
e.setAttribute( "value", 1 );
253
outFormatElem.appendChild( e );
244
e.setAttribute("value", 1);
245
outFormatElem.appendChild(e);
255
247
QColor underlineColor;
256
if ( textElem.hasAttribute("underlinecolor" ))
258
underlineColor =QColor(textElem.attribute("underlinecolor" ));
248
if (textElem.hasAttribute("underlinecolor")) {
249
underlineColor = QColor(textElem.attribute("underlinecolor"));
260
251
QString underlineStyleLine;
261
if ( textElem.hasAttribute("underlinestyleline"))
252
if (textElem.hasAttribute("underlinestyleline")) {
263
253
underlineStyleLine = textElem.attribute("underlinestyleline");
265
if ( textElem.hasAttribute("underline" ))
255
if (textElem.hasAttribute("underline")) {
267
256
QDomElement e = outdoc.createElement("UNDERLINE");
268
QString value = textElem.attribute( "underline" );
269
if ( value == "double" )
271
e.setAttribute( "value", "double" );
273
else if ( value == "single" )
275
e.setAttribute( "value", "double" );
279
e.setAttribute( "value", (bool)value.toInt() ? "1" :"0" );
281
if ( underlineColor.isValid())
283
e.setAttribute("underlinecolor", underlineColor.name());
285
if ( !underlineStyleLine.isEmpty() )
286
e.setAttribute("styleline", underlineStyleLine);
287
outFormatElem.appendChild( e );
257
QString value = textElem.attribute("underline");
258
if (value == "double") {
259
e.setAttribute("value", "double");
260
} else if (value == "single") {
261
e.setAttribute("value", "double");
263
e.setAttribute("value", (bool)value.toInt() ? "1" : "0");
265
if (underlineColor.isValid()) {
266
e.setAttribute("underlinecolor", underlineColor.name());
268
if (!underlineStyleLine.isEmpty())
269
e.setAttribute("styleline", underlineStyleLine);
270
outFormatElem.appendChild(e);
291
274
QString strikeOutStyleLine;
292
if ( textElem.hasAttribute("strikeoutstyleline"))
275
if (textElem.hasAttribute("strikeoutstyleline")) {
294
276
strikeOutStyleLine = textElem.attribute("strikeoutstyleline");
296
278
QString strikeOutValue;
297
if ( textElem.hasAttribute("strikeOut"))
279
if (textElem.hasAttribute("strikeOut")) {
299
280
strikeOutValue = textElem.attribute("strikeOut");
302
if( !strikeOutValue.isEmpty())
283
if (!strikeOutValue.isEmpty()) {
304
284
QDomElement e = outdoc.createElement("STRIKEOUT");
305
e.setAttribute( "value", strikeOutValue );
306
if ( !strikeOutStyleLine.isEmpty())
285
e.setAttribute("value", strikeOutValue);
286
if (!strikeOutStyleLine.isEmpty())
307
287
e.setAttribute("styleline", strikeOutStyleLine);
308
outFormatElem.appendChild( e );
288
outFormatElem.appendChild(e);
310
290
/*if ( textElem.attribute( "bold" ).toInt() )
313
293
e.setAttribute( "value", 75 );
314
294
outFormatElem.appendChild( e );
315
295
}*/ // doesn't look good
316
if ( titleFont.isEmpty() && isTitle )
317
titleFont = textElem.attribute( "family" );
296
if (titleFont.isEmpty() && isTitle)
297
titleFont = textElem.attribute("family");
319
299
// Family and point size are voluntarily NOT passed over.
320
if ( !textElem.attribute( "color" ).isEmpty())
300
if (!textElem.attribute("color").isEmpty()) {
323
col.setNamedColor(textElem.attribute( "color" ));
302
col.setNamedColor(textElem.attribute("color"));
324
303
QDomElement e = outdoc.createElement("COLOR");
325
e.setAttribute( "red", col.red() );
326
e.setAttribute( "green", col.green() );
327
e.setAttribute( "blue", col.blue() );
328
outFormatElem.appendChild( e );
304
e.setAttribute("red", col.red());
305
e.setAttribute("green", col.green());
306
e.setAttribute("blue", col.blue());
307
outFormatElem.appendChild(e);
330
if ( !textElem.attribute("textbackcolor").isEmpty())
309
if (!textElem.attribute("textbackcolor").isEmpty()) {
333
col.setNamedColor(textElem.attribute( "textbackcolor" ));
311
col.setNamedColor(textElem.attribute("textbackcolor"));
334
312
QDomElement e = outdoc.createElement("TEXTBACKGROUNDCOLOR");
335
e.setAttribute( "red", col.red() );
336
e.setAttribute( "green", col.green() );
337
e.setAttribute( "blue", col.blue() );
338
outFormatElem.appendChild( e );
313
e.setAttribute("red", col.red());
314
e.setAttribute("green", col.green());
315
e.setAttribute("blue", col.blue());
316
outFormatElem.appendChild(e);
341
319
//before VERTICAL align
342
320
double relative = 0;
343
if( textElem.attribute("relativetextsize").toDouble())
321
if (textElem.attribute("relativetextsize").toDouble()) {
345
322
relative = textElem.attribute("relativetextsize").toDouble();
349
if( textElem.attribute("VERTALIGN").toInt())
326
if (textElem.attribute("VERTALIGN").toInt()) {
351
327
QDomElement e = outdoc.createElement("VERTALIGN");
352
e.setAttribute( "value", textElem.attribute("VERTALIGN").toInt() );
354
e.setAttribute( "relativetextsize", relative );
355
outFormatElem.appendChild( e );
328
e.setAttribute("value", textElem.attribute("VERTALIGN").toInt());
330
e.setAttribute("relativetextsize", relative);
331
outFormatElem.appendChild(e);
358
if( textElem.hasAttribute("shadowtext"))
334
if (textElem.hasAttribute("shadowtext")) {
360
335
QDomElement e = outdoc.createElement("SHADOWTEXT");
361
e.setAttribute( "value", textElem.attribute("shadowtext").toInt() );
362
outFormatElem.appendChild( e );
336
e.setAttribute("value", textElem.attribute("shadowtext").toInt());
337
outFormatElem.appendChild(e);
365
if( textElem.hasAttribute("offsetfrombaseline"))
340
if (textElem.hasAttribute("offsetfrombaseline")) {
367
341
QDomElement e = outdoc.createElement("OFFSETFROMBASELINE");
368
e.setAttribute( "value", textElem.attribute("offsetfrombaseline").toInt() );
369
outFormatElem.appendChild( e );
342
e.setAttribute("value", textElem.attribute("offsetfrombaseline").toInt());
343
outFormatElem.appendChild(e);
372
if( textElem.hasAttribute("wordbyword"))
346
if (textElem.hasAttribute("wordbyword")) {
374
347
QDomElement e = outdoc.createElement("WORDBYWORD");
375
e.setAttribute( "value", textElem.attribute("wordbyword").toInt() );
376
outFormatElem.appendChild( e );
348
e.setAttribute("value", textElem.attribute("wordbyword").toInt());
349
outFormatElem.appendChild(e);
379
if( textElem.hasAttribute("fontattribute"))
352
if (textElem.hasAttribute("fontattribute")) {
381
353
QDomElement e = outdoc.createElement("FONTATTRIBUTE");
382
e.setAttribute( "value", textElem.attribute("fontattribute") );
383
outFormatElem.appendChild( e );
354
e.setAttribute("value", textElem.attribute("fontattribute"));
355
outFormatElem.appendChild(e);
385
if( textElem.hasAttribute("language"))
357
if (textElem.hasAttribute("language")) {
387
358
QDomElement e = outdoc.createElement("LANGUAGE");
388
e.setAttribute( "value", textElem.attribute("language") );
389
outFormatElem.appendChild( e );
359
e.setAttribute("value", textElem.attribute("language"));
360
outFormatElem.appendChild(e);
391
if ( !outFormatElem.firstChild().isNull() )
393
outFormatElem.setAttribute( "id", 1 ); // normal exte
394
outFormatElem.setAttribute( "pos", oldLen );
395
outFormatElem.setAttribute( "len", text.length() - oldLen );
396
outFormatsElem.appendChild( outFormatElem );
362
if (!outFormatElem.firstChild().isNull()) {
363
outFormatElem.setAttribute("id", 1); // normal exte
364
outFormatElem.setAttribute("pos", oldLen);
365
outFormatElem.setAttribute("len", text.length() - oldLen);
366
outFormatsElem.appendChild(outFormatElem);
399
369
} // end "for each text element"
401
371
// KPresenter seems to save a trailing space (bug!)
402
372
int len = text.length();
403
if ( len > 0 && text[ len - 1 ] == ' ' )
404
text.truncate( len - 1 );
406
QDomElement outTextElem = outdoc.createElement( "TEXT" );
407
parag.appendChild( outTextElem );
408
outTextElem.appendChild( outdoc.createTextNode( text ) );
410
if ( !outFormatsElem.firstChild().isNull() ) // Do we have formats to save ?
411
parag.appendChild( outFormatsElem );
413
QDomElement layoutElem = outdoc.createElement( "LAYOUT" );
414
parag.appendChild( layoutElem );
415
QDomElement nameElem = outdoc.createElement( "NAME" );
416
layoutElem.appendChild( nameElem );
417
nameElem.setAttribute( "value", isTitle ? titleStyleName : QString("Standard") );
418
QDomElement align=outdoc.createElement("FLOW");
419
if(p.hasAttribute("align"))
421
switch(p.attribute( "align" ).toInt())
373
if (len > 0 && text[ len - 1 ] == ' ')
374
text.truncate(len - 1);
376
QDomElement outTextElem = outdoc.createElement("TEXT");
377
parag.appendChild(outTextElem);
378
outTextElem.appendChild(outdoc.createTextNode(text));
380
if (!outFormatsElem.firstChild().isNull()) // Do we have formats to save ?
381
parag.appendChild(outFormatsElem);
383
QDomElement layoutElem = outdoc.createElement("LAYOUT");
384
parag.appendChild(layoutElem);
385
QDomElement nameElem = outdoc.createElement("NAME");
386
layoutElem.appendChild(nameElem);
387
nameElem.setAttribute("value", isTitle ? titleStyleName : QString("Standard"));
388
QDomElement align = outdoc.createElement("FLOW");
389
if (p.hasAttribute("align")) {
390
switch (p.attribute("align").toInt()) {
424
align.setAttribute( "align","left");
392
align.setAttribute("align", "left");
427
align.setAttribute( "align","right");
395
align.setAttribute("align", "right");
430
align.setAttribute( "align","center");
398
align.setAttribute("align", "center");
433
align.setAttribute( "align","justify");
401
align.setAttribute("align", "justify");
437
if(!counter.isNull() )
438
layoutElem.appendChild( counter );
440
layoutElem.appendChild( indent );
441
if(!lineSpacing.isNull())
442
layoutElem.appendChild( lineSpacing );
444
layoutElem.appendChild( offset);
445
if(!leftBorder.isNull())
405
if (!counter.isNull())
406
layoutElem.appendChild(counter);
407
if (!indent.isNull())
408
layoutElem.appendChild(indent);
409
if (!lineSpacing.isNull())
410
layoutElem.appendChild(lineSpacing);
411
if (!offset.isNull())
412
layoutElem.appendChild(offset);
413
if (!leftBorder.isNull())
446
414
layoutElem.appendChild(leftBorder);
447
if(!rightBorder.isNull())
415
if (!rightBorder.isNull())
448
416
layoutElem.appendChild(rightBorder);
449
if(!topBorder.isNull())
417
if (!topBorder.isNull())
450
418
layoutElem.appendChild(topBorder);
451
if(!bottomBorder.isNull())
419
if (!bottomBorder.isNull())
452
420
layoutElem.appendChild(bottomBorder);
454
422
layoutElem.appendChild(align);
423
if (!shadow.isNull())
456
424
layoutElem.appendChild(shadow);
457
425
// Only the first parag of the top text object is set to the 'title' style