filters

tdehtmlreader.h
1/***************************************************************************
2 tdehtmlreader.h - 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#ifndef TDEHTMLREADER_H
20#define TDEHTMLREADER_H
21
22#include <tdehtml_part.h> // fixme speedup compile time by moving these into the cpp file.
23#include <tqdom.h>
24#include <tqptrstack.h>
25#include <kwdwriter.h>
26
30
31namespace DOM {
32 class Node;
33 class Element;
34}
35
36struct HTMLReader_state {
37 TQDomElement format;
38 TQDomElement frameset;
39 TQDomElement paragraph;
40 TQDomElement layout;
41 bool in_pre_mode; // keep formatting as is.
42};
43
44class TDEHTMLReader: public TQObject {
45
46TQ_OBJECT
47
48
49public:
50 TDEHTMLReader(KWDWriter *writer);
51 ~TDEHTMLReader();
52
53 bool filter(KURL url);
54
55private slots:
56 void completed();
57
58private:
59 void parseNode(DOM::Node n);
60 bool parseTag(DOM::Element e);
61 void parseStyle(DOM::Element e);
62 void parse_head(DOM::Element e);
63 HTMLReader_state *state();
64 HTMLReader_state *pushNewState();
65 void popState();
66
67
68 /* void stateSetFormat(TQDomElement f);
69 void stateSetFrameset(TQDomElement f);
70 void stateSetLayout(TQDomElement l);
71 void stateSetParagraph(TQDomElement p);*/
72
73 TQPtrStack<HTMLReader_state> _state;
74 TDEHTMLPart *_html;
75 KWDWriter *_writer;
76
77 void startNewLayout(bool startNewFormat=false);
78 void startNewLayout(bool startNewFormat, TQDomElement layout);
79 void startNewParagraph(bool startnewformat=true, bool startnewlayout=true);
80 bool _it_worked;
81// -----------------------------------------------------
82 int _list_depth;
83// -----------------------------------------------------
84 bool parse_CommonAttributes(DOM::Element e);
85 bool parse_a(DOM::Element e);
86 bool parse_p(DOM::Element e);
87 bool parse_br(DOM::Element e);
88 bool parse_table(DOM::Element e);
89 bool parse_pre(DOM::Element e);
90 bool parse_font(DOM::Element e);
91 bool parse_ol(DOM::Element e);
92 bool parse_ul(DOM::Element e);
93 bool parse_hr(DOM::Element e);
94 bool parse_img(DOM::Element e);
95
96
97// -------------------------------------------------------
98
99};
100
101#endif
This class is a element.