~ubuntu-branches/ubuntu/breezy/koffice/breezy

« back to all changes in this revision

Viewing changes to filters/kword/html/import/khtmlreader.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Ben Burton
  • Date: 2004-05-09 11:33:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040509113300-vfrdadqsvjfuhn3b
Tags: 1:1.3.1-1
* New upstream bugfix release.
* Built against newer imagemagick (closes: #246623).
* Made koffice-libs/kformula recommend/depend on latex-xft-fonts, which
  provides mathematical fonts that the formula editor can use.  Also
  patched the kformula part to make these fonts the default.
* Changed kword menu hint from "WordProcessors" to "Word processors"
  (closes: #246209).
* Spellchecker configuration is now fixed (closes: #221256, #227568).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
                          khtmlreader.cpp  -  description
 
3
                             -------------------
 
4
    begin                : Sun Sep 9 2001
 
5
    copyright            : (C) 2001 by Frank Dekervel
 
6
    email                : Frank.Dekervel@student.kuleuven.ac.be
 
7
 ***************************************************************************/
 
8
 
 
9
/***************************************************************************
 
10
 *                                                                         *
 
11
 *   This program is free software; you can redistribute it and/or modify  *
 
12
 *   it under the terms of the GNU lesser General Public License as        *
 
13
 *   published by                                                          *
 
14
 *   the Free Software Foundation; either version 2 of the License, or     *
 
15
 *   (at your option) any later version.                                   *
 
16
 *                                                                         *
 
17
 ***************************************************************************/
 
18
 
 
19
#include "khtmlreader.h"
 
20
 
 
21
#include "khtmlreader.moc"
 
22
#include <kdebug.h>
 
23
#include <dom/dom_text.h>
 
24
#include <dom/dom2_views.h>
 
25
#include <dom/dom_doc.h>
 
26
#include <qcolor.h>
 
27
#include <dom/dom_element.h>
 
28
#include <dom/html_table.h>
 
29
#include <khtmlview.h>
 
30
#include <qwidget.h>
 
31
#include <kapplication.h>
 
32
#include <dom/html_misc.h>
 
33
 
 
34
 
 
35
KHTMLReader::KHTMLReader(KWDWriter *w){
 
36
        _html=new KHTMLPart();
 
37
        _writer=w;
 
38
        _it_worked=false;
 
39
}
 
40
 
 
41
// if a troll ever sees this, he can't kill me anyway. (and he should kill dfaure first)
 
42
void qt_enter_modal( QWidget *widget );
 
43
void qt_leave_modal( QWidget *widget );
 
44
 
 
45
 
 
46
bool KHTMLReader::filter(KURL url) {
 
47
        kdDebug() << "KHTMLReader::filter" << endl;
 
48
        QObject::connect(_html,SIGNAL(completed()),this,SLOT(completed()));
 
49
 
 
50
        _state.clear();
 
51
        _list_depth=0;
 
52
 
 
53
        _html->view()->resize(600,530);
 
54
        _html->setAutoloadImages(false);
 
55
        _html->setJScriptEnabled(false);
 
56
        _html->setPluginsEnabled(false);
 
57
        _html->setJavaEnabled(false);
 
58
        if (_html->openURL(url) == false) {
 
59
                kdWarning() << "openURL returned false" << endl;
 
60
                return false;
 
61
        }
 
62
 
 
63
        //FIXME use synchronous IO instead of this hack if possible.
 
64
        QWidget dummy(0,0,WType_Dialog | WShowModal);
 
65
        qt_enter_modal(&dummy);
 
66
        qApp->enter_loop();
 
67
        qt_leave_modal(&dummy);
 
68
        return _it_worked;
 
69
}
 
70
 
 
71
HTMLReader_state *KHTMLReader::state() {
 
72
        if (_state.count() == 0) {
 
73
                HTMLReader_state *s=new HTMLReader_state;
 
74
                s->frameset=_writer->mainFrameset();
 
75
                s->paragraph = _writer->addParagraph(s->frameset);
 
76
                s->format=_writer->currentFormat(s->paragraph,true);
 
77
                s->layout=_writer->currentLayout(s->paragraph);
 
78
                _state.push(s);
 
79
        }
 
80
        return _state.top();
 
81
}
 
82
 
 
83
HTMLReader_state *KHTMLReader::pushNewState() {
 
84
        HTMLReader_state *s=new HTMLReader_state;
 
85
        s->frameset=state()->frameset;
 
86
        s->paragraph=state()->paragraph;
 
87
        s->format=state()->format;
 
88
        s->layout=state()->layout;
 
89
        _writer->cleanUpParagraph(s->paragraph);
 
90
        _state.push(s);
 
91
        return s;
 
92
}
 
93
 
 
94
 
 
95
void KHTMLReader::popState() {
 
96
 
 
97
        HTMLReader_state *s=_state.pop();
 
98
 
 
99
        /**
 
100
           the recursion trough html is somewhat clumsy still, i'm working on a better method.
 
101
           popState gets called when a tag is closed, but since a closed tag doesn't mean the end
 
102
           of a (kword) "tag" we have to copy some things over from the closed tag:
 
103
                - the paragraph (after a </B>, we still are in the same paragraph, but
 
104
                        inside the <B></B> , there might have been a <BR>)
 
105
           if we go back into another frameset, we start a new paragraph.
 
106
         **/
 
107
        if (s->frameset == state()->frameset)
 
108
                {
 
109
                        state()->paragraph=s->paragraph;
 
110
                        if ((state()->layout != s->layout)) {
 
111
                                startNewLayout(false,state()->layout);
 
112
                        }
 
113
                state()->format=_writer->startFormat(state()->paragraph, state()->format);
 
114
        }
 
115
        delete(s);
 
116
}
 
117
 
 
118
void KHTMLReader::startNewLayout(bool startNewFormat) {
 
119
        QDomElement layout;
 
120
        startNewLayout(startNewFormat,layout);
 
121
}
 
122
 
 
123
void KHTMLReader::startNewLayout(bool startNewFormat, QDomElement layout) {
 
124
        if (!(_writer->getText(state()->paragraph).isEmpty())) {
 
125
                startNewParagraph(startNewFormat,true);
 
126
        }
 
127
        state()->layout=_writer->setLayout(state()->paragraph,layout);
 
128
}
 
129
 
 
130
 
 
131
void KHTMLReader::completed() {
 
132
        kdDebug() << "KHTMLReader::completed" << endl;
 
133
        qApp->exit_loop();
 
134
        DOM::Document doc=_html->document(); // FIXME parse <HEAD> too
 
135
        DOM::NodeList list=doc.getElementsByTagName("body");
 
136
        DOM::Node docbody=list.item(0);
 
137
 
 
138
        if (docbody.isNull()) {
 
139
                kdWarning() << "no <BODY>, giving up" << endl;
 
140
                _it_worked=false;
 
141
                return;
 
142
        }
 
143
 
 
144
 
 
145
        parseNode(docbody);
 
146
 
 
147
        list = doc.getElementsByTagName("head");
 
148
        DOM::Node dochead=list.item(0);
 
149
        if (!dochead.isNull())
 
150
                parse_head(dochead);
 
151
        else
 
152
                kdWarning() << "WARNING: no html <HEAD> section" << endl;
 
153
 
 
154
        _writer->cleanUpParagraph(state()->paragraph);
 
155
        _it_worked=_writer->writeDoc();
 
156
}
 
157
 
 
158
 
 
159
void KHTMLReader::parseNode(DOM::Node node) {
 
160
 
 
161
        // check if this is a text node.
 
162
        DOM::Text t=node;
 
163
        if (!t.isNull()) {
 
164
           _writer->addText(state()->paragraph,t.data().string());
 
165
           return; // no children anymore...
 
166
        }
 
167
 
 
168
        // is this really needed ? it can't do harm anyway.
 
169
        state()->format=_writer->currentFormat(state()->paragraph,true);
 
170
        state()->layout=_writer->currentLayout(state()->paragraph);
 
171
        pushNewState();
 
172
 
 
173
        DOM::Element e=node;
 
174
 
 
175
        bool go_recursive=true;
 
176
 
 
177
        if (!e.isNull()) {
 
178
                // get the CSS information
 
179
                parseStyle(e);
 
180
                // get the tag information
 
181
                go_recursive=parseTag(e);
 
182
        }
 
183
        if (go_recursive) {
 
184
                for (DOM::Node q=node.firstChild(); !q.isNull(); q=q.nextSibling()) {
 
185
                        parseNode(q);
 
186
                }
 
187
        } 
 
188
        popState();
 
189
 
 
190
 
 
191
}
 
192
 
 
193
void KHTMLReader::parse_head(DOM::Element e) {
 
194
        for (DOM::Element items=e.firstChild();!items.isNull();items=items.nextSibling()) {
 
195
                if (items.tagName().string().lower() == "title") {
 
196
                        DOM::Text t=items.firstChild();
 
197
                        if (!t.isNull()) {
 
198
                                _writer->createDocInfo("HTML import filter",t.data().string());
 
199
                        }
 
200
                }
 
201
        }
 
202
}
 
203
 
 
204
#define _PP(x) { \
 
205
        if (e.tagName().lower() == #x) \
 
206
                return parse_##x(e); \
 
207
        }
 
208
 
 
209
#define _PF(x,a,b,c) { \
 
210
        if (e.tagName().lower() == #x) \
 
211
                { \
 
212
                         _writer->formatAttribute(state()->paragraph, #a,#b,#c); \
 
213
                         return true; \
 
214
                } \
 
215
        }
 
216
 
 
217
// the state->layout=_writer->setLayout is meant to tell popState something changed in the layout, and a new
 
218
// layout should probably be started after closing.
 
219
 
 
220
#define _PL(x,a,b,c) { \
 
221
                if (e.tagName().lower() == #x) \
 
222
                        { \
 
223
                                state()->layout=_writer->setLayout(state()->paragraph,state()->layout);\
 
224
                                if (!(_writer->getText(state()->paragraph).isEmpty())) \
 
225
                                        startNewParagraph(false,false); \
 
226
                                _writer->layoutAttribute(state()->paragraph, #a,#b,#c); \
 
227
                                return true; \
 
228
                        } \
 
229
                }
 
230
 
 
231
 
 
232
bool KHTMLReader::parseTag(DOM::Element e) {
 
233
        _PP(p);
 
234
        _PP(br);
 
235
        // _PP(table); <- disabled for beta.
 
236
        _PP(pre);
 
237
        _PP(ul);
 
238
        _PP(ol);
 
239
        _PP(font);
 
240
        _PP(hr);
 
241
 
 
242
        // FIXME we can get rid of these, make things tons more simple
 
243
        // when khtml finally implements getComputedStyle
 
244
        _PF(b,WEIGHT,value,75);
 
245
        _PF(strong,WEIGHT,value,75);
 
246
        _PF(u,UNDERLINE,value,1);
 
247
        _PF(i,ITALIC,value,1);
 
248
 
 
249
        _PL(center,FLOW,align,center);
 
250
        _PL(right,FLOW,align,right);
 
251
        _PL(left,FLOW,align,left);
 
252
 
 
253
        _PL(h1,NAME,value,h1);
 
254
        _PL(h2,NAME,value,h2);
 
255
        _PL(h3,NAME,value,h3);
 
256
        _PL(h4,NAME,value,h4);
 
257
        _PL(h5,NAME,value,h5);
 
258
        _PL(h6,NAME,value,h6);
 
259
        return true;
 
260
}
 
261
 
 
262
 
 
263
 
 
264
void KHTMLReader::parseStyle(DOM::Element e) {
 
265
#if 0  // styles are broken broken broken broken broken broken.
 
266
     DOM::CSSStyleDeclaration s1=e.style();
 
267
     DOM::Document doc=_html->document();
 
268
     DOM::CSSStyleDeclaration s2=doc.defaultView().getComputedStyle(e,"");
 
269
                                //FIXME: wait until getComputedStyle is more than
 
270
                                // 'return 0' in khtml
 
271
 
 
272
     if (PROPV("font-weight") == "bolder")
 
273
        _writer->formatAttribute(state()->paragraph,"WEIGHT","value","75");
 
274
 
 
275
     // debugging code.
 
276
     kdDebug() << "e.style()" << endl;
 
277
     for (unsigned int i=0;i<s1.length();i++) {
 
278
        kdDebug() << QString("%1: %2").arg(s1.item(i).string()).arg(s1.getPropertyValue(s1.item(i)).string()) << endl;
 
279
     }
 
280
     kdDebug() << "override style" << endl;
 
281
     for (unsigned int i=0;i<s2.length();i++) {
 
282
        kdDebug() << QString("%1: %2").arg(s2.item(i).string()).arg(s2.getPropertyValue(s2.item(i)).string()) << endl;
 
283
     }
 
284
#endif
 
285
}
 
286
 
 
287
void KHTMLReader::startNewParagraph(bool startnewformat, bool startnewlayout) {
 
288
 
 
289
        QDomElement qf=state()->format;
 
290
        QDomElement ql=state()->layout;
 
291
 
 
292
        _writer->cleanUpParagraph(state()->paragraph);
 
293
 
 
294
        if ((startnewlayout==true) || ql.isNull())
 
295
                {state()->paragraph=_writer->addParagraph(state()->frameset);}
 
296
        else
 
297
                {state()->paragraph=
 
298
                        _writer->addParagraph(state()->frameset,state()->layout);}
 
299
 
 
300
 
 
301
 
 
302
        if (qf.isNull() || (startnewformat==true)) {
 
303
                state()->format=_writer->startFormat(state()->paragraph/*,state()->format*/);
 
304
        }  else {
 
305
                state()->format=_writer->startFormat(state()->paragraph,qf);
 
306
        }
 
307
 
 
308
        /**
 
309
          support lists: if we are in a list, and we start a new paragraph,
 
310
          we don't want to start a new item, but we want to retain the list state.
 
311
          we do this by incrementing the 'environment depth' and changing the numbering type to 'no numbering'
 
312
         **/
 
313
        QString ct=_writer->getLayoutAttribute(state()->paragraph,"COUNTER","type");
 
314
        if ((!ct.isNull()) && (ct != "0")) {
 
315
                _writer->layoutAttribute(state()->paragraph,"COUNTER","type","0");
 
316
                _writer->layoutAttribute(state()->paragraph,"COUNTER","numberingtype","0");
 
317
                _writer->layoutAttribute(state()->paragraph,"COUNTER","righttext","");
 
318
                int currdepth=(_writer->getLayoutAttribute(state()->paragraph,"COUNTER","depth")).toInt();
 
319
                _writer->layoutAttribute(state()->paragraph,"COUNTER","depth",QString("%1").arg(currdepth+1));
 
320
        }
 
321
}
 
322
 
 
323
KHTMLReader::~KHTMLReader(){
 
324
}
 
325
 
 
326
 
 
327
 
 
328
 
 
329
 
 
330
 
 
331
//==============================================================
 
332
//                          tag parsing
 
333
//==============================================================
 
334
 
 
335
 
 
336
bool KHTMLReader::parse_CommonAttributes(DOM::Element e) {
 
337
        QString s=e.getAttribute("align").string();
 
338
        if (!s.isEmpty()) {
 
339
              _writer->formatAttribute(state()->paragraph,"FLOW","align",s);
 
340
        }
 
341
        return true;
 
342
}
 
343
 
 
344
 
 
345
 
 
346
bool KHTMLReader::parse_p(DOM::Element e) {
 
347
        startNewParagraph();
 
348
        parse_CommonAttributes(e);
 
349
 
 
350
        return true;
 
351
}
 
352
 
 
353
bool KHTMLReader::parse_hr(DOM::Element e) {
 
354
        startNewParagraph();
 
355
        _writer->createHR(state()->paragraph);
 
356
        startNewParagraph();
 
357
        return true;
 
358
}
 
359
 
 
360
bool KHTMLReader::parse_br(DOM::Element e) {
 
361
        startNewParagraph(false,false); //keep the current format and layout
 
362
        return false; // a BR tag has no childs.
 
363
}
 
364
 
 
365
QColor parsecolor(QString colorstring) {
 
366
      QColor color;
 
367
      if (colorstring[0]=='#') {
 
368
            color.setRgb(
 
369
            colorstring.mid(1,2).toInt(0,16),
 
370
            colorstring.mid(3,2).toInt(0,16),
 
371
            colorstring.mid(5,2).toInt(0,16)
 
372
            );
 
373
      } else {
 
374
            QString colorlower=colorstring.lower();
 
375
            // Grays
 
376
            if (colorlower=="black")
 
377
                  color.setRgb(0,0,0);
 
378
            else if (colorlower=="white")
 
379
                  color.setRgb(255,255,255);
 
380
            else if (colorlower=="silver")
 
381
                  color.setRgb(0xc0,0xc0,0xc0);
 
382
            else if (colorlower=="gray")
 
383
                  color.setRgb(128,128,128);
 
384
            // "full" colors
 
385
            else if (colorlower=="red")
 
386
                  color.setRgb(255,0,0);
 
387
            else if (colorlower=="lime")
 
388
                  color.setRgb(0,255,0);
 
389
            else if (colorlower=="blue")
 
390
                  color.setRgb(0,0,255);
 
391
            else if (colorlower=="yellow")
 
392
                  color.setRgb(255,255,0);
 
393
            else if (colorlower=="fuchsia")
 
394
                  color.setRgb(255,0,255);
 
395
            else if (colorlower=="aqua")
 
396
                  color.setRgb(0,255,255);
 
397
            // "half" colors
 
398
            else if (colorlower=="maroon")
 
399
                  color.setRgb(128,0,0);
 
400
            else if (colorlower=="green")
 
401
                  color.setRgb(0,128,0);
 
402
            else if (colorlower=="navy")
 
403
                  color.setRgb(0,0,128);
 
404
            else if (colorlower=="olive")
 
405
                  color.setRgb(128,128,0);
 
406
            else if (colorlower=="purple")
 
407
                  color.setRgb(128,0,128);
 
408
            else if (colorlower=="teal")
 
409
                  color.setRgb(0,128,128);
 
410
            else {
 
411
                  // H'm, we have still not found the color!
 
412
                  // Let us see if QT can do better!
 
413
                  color.setNamedColor(colorstring);
 
414
            }
 
415
      }
 
416
      return colorstring;
 
417
}
 
418
 
 
419
 
 
420
bool KHTMLReader::parse_table(DOM::Element e) {
 
421
        int tableno=_writer->createTable();
 
422
        int nrow=0;
 
423
        int ncol=0;
 
424
        int has_borders=false;
 
425
        QColor bgcolor=parsecolor("#FFFFFF");
 
426
        DOM::Element table_body=e.firstChild();
 
427
        if (!table_body.getAttribute("bgcolor").string().isEmpty())
 
428
               bgcolor=parsecolor(table_body.getAttribute("bgcolor").string());
 
429
        if ((e.getAttribute("border").string().toInt() > 0))
 
430
                has_borders=true;
 
431
 
 
432
        // fixme rewrite this proper
 
433
        //(maybe using computed sizes from khtml if thats once exported)
 
434
        for (DOM::Element rows=table_body.firstChild();!rows.isNull();rows=rows.nextSibling()) {
 
435
        if (rows.tagName().string().lower() == "tr") {
 
436
 
 
437
            QColor obgcolor=bgcolor;
 
438
            if (!rows.getAttribute("bgcolor").string().isEmpty())
 
439
                bgcolor=parsecolor(rows.getAttribute("bgcolor").string());
 
440
 
 
441
                ncol=0;
 
442
                for (DOM::Element cols=rows.firstChild();!cols.isNull();cols=cols.nextSibling()) {
 
443
                        if (cols.tagName().string().lower() == "td") {
 
444
                             QColor bbgcolor=bgcolor;
 
445
                            if (!cols.getAttribute("bgcolor").string().isEmpty())
 
446
                                bgcolor=parsecolor(cols.getAttribute("bgcolor").string());
 
447
 
 
448
                                pushNewState();
 
449
                                QRect colrect=cols.getRect();
 
450
                                state()->frameset=_writer->createTableCell(tableno,nrow,ncol,1,colrect);
 
451
                                state()->frameset.firstChild().toElement().setAttribute("bkRed",bgcolor.red());
 
452
                                state()->frameset.firstChild().toElement().setAttribute("bkGreen",bgcolor.green());
 
453
                                state()->frameset.firstChild().toElement().setAttribute("bkBlue",bgcolor.blue());
 
454
                                if (has_borders) {
 
455
                                    state()->frameset.firstChild().toElement().setAttribute("lWidth",1);
 
456
                                    state()->frameset.firstChild().toElement().setAttribute("rWidth",1);
 
457
                                    state()->frameset.firstChild().toElement().setAttribute("bWidth",1);
 
458
                                    state()->frameset.firstChild().toElement().setAttribute("tWidth",1);
 
459
                                }
 
460
 
 
461
                                // fixme don't guess. get it right.
 
462
                                state()->paragraph=_writer->addParagraph(state()->frameset);
 
463
                                parseNode(cols);
 
464
                                _writer->cleanUpParagraph(state()->paragraph);
 
465
                                popState();
 
466
                                ncol++;
 
467
                                bgcolor=bbgcolor;
 
468
                        }
 
469
                }
 
470
                nrow++;
 
471
                bgcolor=obgcolor;
 
472
          }
 
473
        }
 
474
        _writer->finishTable(tableno/*,0,0,r.right()-r.left(),r.bottom()-r.top()*/); // FIXME find something better.
 
475
        startNewParagraph(false,false);
 
476
        _writer->createInline(state()->paragraph,_writer->fetchTableCell(tableno,0,0));
 
477
        startNewParagraph(false,false);
 
478
        return false; // we do our own recursion
 
479
}
 
480
 
 
481
bool KHTMLReader::parse_img(DOM::Element e) {
 
482
        //QRect e=e.getRect();
 
483
    return true;
 
484
}
 
485
 
 
486
 
 
487
bool KHTMLReader::parse_pre(DOM::Element e) {
 
488
        DOM::Text prething=e.firstChild();
 
489
        if (prething.isNull()) return false;
 
490
 
 
491
        QStringList k=QStringList::split("\n",prething.data().string());
 
492
 
 
493
        startNewParagraph();
 
494
 
 
495
        for (QStringList::Iterator b=k.begin();b!=k.end();++b) {
 
496
                _writer->addText(state()->paragraph,*b);
 
497
                startNewParagraph();
 
498
        }
 
499
        return false; // FIXME no support for tags in <PRE> sections ATM.
 
500
}
 
501
 
 
502
bool KHTMLReader::parse_ol(DOM::Element e) {
 
503
        return parse_ul(e);
 
504
}
 
505
 
 
506
bool KHTMLReader::parse_font(DOM::Element e) {
 
507
        // fixme don't hardcode 12 font size ...
 
508
        QString face=e.getAttribute("face").string();
 
509
        QColor color=parsecolor("#000000");
 
510
        if (!e.getAttribute("color").string().isEmpty())
 
511
                color=parsecolor(e.getAttribute("color").string());
 
512
        QString size=e.getAttribute("size").string();
 
513
        int isize=-1;
 
514
        if (size.startsWith("+"))
 
515
                isize=12+size.right(size.length()-1).toInt();
 
516
        else if (size.startsWith("-"))
 
517
                isize=12-size.right(size.length()-1).toInt();
 
518
        else
 
519
                isize=12+size.toInt();
 
520
 
 
521
        _writer->formatAttribute(state()->paragraph,"FONT","name",face);
 
522
        if ((isize>=0) && (isize != 12))
 
523
                _writer->formatAttribute(state()->paragraph,"SIZE","value",QString("%1").arg(isize));
 
524
 
 
525
        _writer->formatAttribute(state()->paragraph,"COLOR","red",QString("%1").arg(color.red()));
 
526
        _writer->formatAttribute(state()->paragraph,"COLOR","green",QString("%1").arg(color.green()));
 
527
        _writer->formatAttribute(state()->paragraph,"COLOR","blue",QString("%1").arg(color.blue()));
 
528
        return true;
 
529
}
 
530
 
 
531
bool KHTMLReader::parse_ul(DOM::Element e) {
 
532
        _list_depth++;
 
533
        for (DOM::Element items=e.firstChild();!items.isNull();items=items.nextSibling()) {
 
534
                  if (items.tagName().string().lower() == "li") {
 
535
                        pushNewState();
 
536
                                startNewLayout();
 
537
                                _writer->layoutAttribute(state()->paragraph,"COUNTER","numberingtype","1");
 
538
                                _writer->layoutAttribute(state()->paragraph,"COUNTER","righttext",".");
 
539
                                if (e.tagName().string().lower() == "ol")
 
540
                                        {
 
541
                                        _writer->layoutAttribute(state()->paragraph,"COUNTER","type","1");
 
542
                                        _writer->layoutAttribute(state()->paragraph,"COUNTER","numberingtype","1");
 
543
                                        _writer->layoutAttribute(state()->paragraph,"COUNTER","righttext",".");
 
544
                                        }
 
545
                                else
 
546
                                        {
 
547
                                        _writer->layoutAttribute(state()->paragraph,"COUNTER","type","10");
 
548
                                        _writer->layoutAttribute(state()->paragraph,"COUNTER","numberingtype","");
 
549
                                        _writer->layoutAttribute(state()->paragraph,"COUNTER","righttext","");
 
550
                                        }
 
551
                                _writer->layoutAttribute(state()->paragraph,"COUNTER","depth",QString("%1").arg(_list_depth-1));
 
552
                                parseNode(items);
 
553
                        popState();
 
554
 
 
555
                  }
 
556
        }
 
557
        _list_depth--;
 
558
        return false;
 
559
}
 
560