You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
104 lines
3.1 KiB
104 lines
3.1 KiB
15 years ago
|
/***************************************************************************
|
||
12 years ago
|
tdehtmlreader.h - description
|
||
15 years ago
|
-------------------
|
||
|
begin : Sun Sep 9 2001
|
||
|
copyright : (C) 2001 by Frank Dekervel
|
||
|
email : Frank.Dekervel@student.kuleuven.ac.be
|
||
|
***************************************************************************/
|
||
|
|
||
|
/***************************************************************************
|
||
|
* *
|
||
|
* This program is free software; you can redistribute it and/or modify *
|
||
|
* it under the terms of the GNU Lesser General Public License as *
|
||
|
* published by *
|
||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||
|
* (at your option) any later version. *
|
||
|
* *
|
||
|
***************************************************************************/
|
||
|
|
||
|
#ifndef KHTMLREADER_H
|
||
|
#define KHTMLREADER_H
|
||
|
|
||
12 years ago
|
#include <tdehtml_part.h> // fixme speedup compile time by moving these into the cpp file.
|
||
13 years ago
|
#include <tqdom.h>
|
||
|
#include <tqptrstack.h>
|
||
15 years ago
|
#include <kwdwriter.h>
|
||
|
|
||
13 years ago
|
//#include <tqstack.h>
|
||
15 years ago
|
|
||
|
/**
|
||
|
*@author Frank Dekervel
|
||
|
*/
|
||
|
|
||
|
namespace DOM {
|
||
|
class Node;
|
||
|
class Element;
|
||
|
}
|
||
|
|
||
|
struct HTMLReader_state {
|
||
13 years ago
|
TQDomElement format;
|
||
|
TQDomElement frameset;
|
||
|
TQDomElement paragraph;
|
||
13 years ago
|
TQDomElement layout;
|
||
15 years ago
|
bool in_pre_mode; // keep formatting as is.
|
||
|
};
|
||
|
|
||
13 years ago
|
class KHTMLReader: public TQObject {
|
||
15 years ago
|
|
||
|
Q_OBJECT
|
||
13 years ago
|
|
||
15 years ago
|
|
||
|
public:
|
||
|
KHTMLReader(KWDWriter *writer);
|
||
|
~KHTMLReader();
|
||
|
|
||
|
bool filter(KURL url);
|
||
|
|
||
|
private slots:
|
||
|
void completed();
|
||
|
|
||
|
private:
|
||
|
void parseNode(DOM::Node n);
|
||
|
bool parseTag(DOM::Element e);
|
||
|
void parseStyle(DOM::Element e);
|
||
|
void parse_head(DOM::Element e);
|
||
|
HTMLReader_state *state();
|
||
|
HTMLReader_state *pushNewState();
|
||
|
void popState();
|
||
|
|
||
|
|
||
13 years ago
|
/* void stateSetFormat(TQDomElement f);
|
||
|
void stateSetFrameset(TQDomElement f);
|
||
|
void stateSetLayout(TQDomElement l);
|
||
|
void stateSetParagraph(TQDomElement p);*/
|
||
15 years ago
|
|
||
13 years ago
|
TQPtrStack<HTMLReader_state> _state;
|
||
15 years ago
|
KHTMLPart *_html;
|
||
|
KWDWriter *_writer;
|
||
|
|
||
|
void startNewLayout(bool startNewFormat=false);
|
||
13 years ago
|
void startNewLayout(bool startNewFormat, TQDomElement layout);
|
||
|
void startNewParagraph(bool startnewformat=true, bool startnewlayout=true);
|
||
15 years ago
|
bool _it_worked;
|
||
|
// -----------------------------------------------------
|
||
|
int _list_depth;
|
||
|
// -----------------------------------------------------
|
||
|
bool parse_CommonAttributes(DOM::Element e);
|
||
|
bool parse_a(DOM::Element e);
|
||
|
bool parse_p(DOM::Element e);
|
||
|
bool parse_br(DOM::Element e);
|
||
|
bool parse_table(DOM::Element e);
|
||
|
bool parse_pre(DOM::Element e);
|
||
|
bool parse_font(DOM::Element e);
|
||
|
bool parse_ol(DOM::Element e);
|
||
|
bool parse_ul(DOM::Element e);
|
||
|
bool parse_hr(DOM::Element e);
|
||
|
bool parse_img(DOM::Element e);
|
||
|
|
||
|
|
||
|
// -------------------------------------------------------
|
||
|
|
||
|
};
|
||
|
|
||
|
#endif
|