author | pohly <pohly> | 2004-08-24 20:52:45 (UTC) |
---|---|---|
committer | pohly <pohly> | 2004-08-24 20:52:45 (UTC) |
commit | 73253e93327cf4ef0932de1b4afb56af22a0f37e (patch) (side-by-side diff) | |
tree | 1c9a7a6dd3341e036a894d348a3372525d29acec /noncore/apps/opie-reader/striphtml.h | |
parent | e90847c784c48bd21bf8768cb38edb853b832697 (diff) | |
download | opie-73253e93327cf4ef0932de1b4afb56af22a0f37e.zip opie-73253e93327cf4ef0932de1b4afb56af22a0f37e.tar.gz opie-73253e93327cf4ef0932de1b4afb56af22a0f37e.tar.bz2 |
updated source to opie-reader 0.7g
Diffstat (limited to 'noncore/apps/opie-reader/striphtml.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/striphtml.h | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/noncore/apps/opie-reader/striphtml.h b/noncore/apps/opie-reader/striphtml.h new file mode 100644 index 0000000..42e2b7e --- a/dev/null +++ b/noncore/apps/opie-reader/striphtml.h @@ -0,0 +1,93 @@ +#ifndef __STRIPHTML_H +#define __STRIPHTML_H + +#include "CFilter.h" +#include "Navigation.h" +#include "CBuffer.h" +#include "CExpander.h" +#include "my_list.h" + +class striphtml : public CFilter +{ + bool ignorespace; + bool m_bchm; + CList<CStyle> stylestack; + static CNavigation_base<htmlmark> m_nav; + QMap<QString, tchar>* entmap; + CStyle currentstyle; + bool isPre; + unsigned short skip_ws(); + unsigned short skip_ws_end(); + unsigned short skip_ws_end(unsigned long&); + unsigned short parse_m(); + QMap<QString, unsigned long>* href2filepos; + QMap<unsigned long, QString>* id2href; + unsigned long currentid; + tchar lastch; + QString currentfile; + QString q; + bool forcecentre, m_inblock; + QString text_q; + int indent; + int m_listtype[m_cmaxdepth]; + int m_ctr[m_cmaxdepth]; + void mygetch(tchar& ch, CStyle& sty, unsigned long& pos); + void initentmap(); + QString getname(tchar& ch, const QString& nd); + void skipblock(const QString&); + QString getattr(tchar&); + QString dehtml(const QString& _info); + void parse_paragraph(CStyle& currentstyle, tchar& ch, unsigned long); + int getpara(CBuffer&, unsigned long&); + public: + QString about() { return QString("HTML filter (c) Tim Wentford\n")+parent->about(); } + striphtml(const QString&); + ~striphtml(); + void getch(tchar& ch, CStyle& sty, unsigned long& pos); + virtual linkType hyperlink(unsigned int n, unsigned int noff, QString& w, QString& nm); + bool findanchor(const QString&); + + + void saveposn(const QString& f, size_t posn) { m_nav.saveposn(htmlmark(f, posn)); } + void writeposn(const QString& f, size_t posn) { m_nav.writeposn(htmlmark(f, posn)); } + linkType forward(QString& f, size_t& loc) + { + htmlmark m(f, loc); + linkType ret = (m_nav.forward(m)) ? eFile : eNone; + if (f == m.filename()) + { + if (ret == eFile) + { + ret = eLink; + } + } + else + { + f = m.filename(); + } + loc = m.posn(); + return ret; + } + linkType back(QString& f, size_t& loc) + { + htmlmark m(f, loc); + linkType ret = (m_nav.back(m)) ? eFile : eNone; + if (f == m.filename()) + { + if (ret == eFile) + { + ret = eLink; + } + } + else + { + f = m.filename(); + } + loc = m.posn(); + return ret; + } + bool hasnavigation() { return true; } + virtual void locate(unsigned int n); + void setchm(bool _b) { m_bchm = _b; } +}; +#endif |