author | pohly <pohly> | 2005-05-05 14:39:33 (UTC) |
---|---|---|
committer | pohly <pohly> | 2005-05-05 14:39:33 (UTC) |
commit | 39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91 (patch) (unidiff) | |
tree | 96e66fdc18dca4d4ab8611133e072f57dea224b9 /noncore/apps/opie-reader/CFilter.h | |
parent | 279fc4fd1986074acbadd3a8e86fcf3968a8dd5c (diff) | |
download | opie-39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91.zip opie-39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91.tar.gz opie-39fbfd5eb7e45d73d38e8a2ce9437a3d7e1b8e91.tar.bz2 |
new opie-reader sources with support for ArriereGo, Reb input and flite output plugins
Diffstat (limited to 'noncore/apps/opie-reader/CFilter.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/CFilter.h | 55 |
1 files changed, 52 insertions, 3 deletions
diff --git a/noncore/apps/opie-reader/CFilter.h b/noncore/apps/opie-reader/CFilter.h index 174e6b4..594b606 100644 --- a/noncore/apps/opie-reader/CFilter.h +++ b/noncore/apps/opie-reader/CFilter.h | |||
@@ -16,19 +16,25 @@ class CFilter_IFace : public CCharacterSource | |||
16 | virtual void writeposn(const QString& f, size_t posn) = 0; | 16 | virtual void writeposn(const QString& f, size_t posn) = 0; |
17 | virtual linkType forward(QString& f, size_t& loc) = 0; | 17 | virtual linkType forward(QString& f, size_t& loc) = 0; |
18 | virtual linkType back(QString& f, size_t& loc) = 0; | 18 | virtual linkType back(QString& f, size_t& loc) = 0; |
19 | virtual bool hasnavigation() = 0; | 19 | virtual bool hasnavigation() = 0; |
20 | virtual int getwidth() = 0; | 20 | virtual int getwidth() = 0; |
21 | virtual CCharacterSource* getparent() = 0; | 21 | virtual CCharacterSource* getparent() = 0; |
22 | virtual unsigned long startSection() = 0; | ||
22 | }; | 23 | }; |
23 | 24 | ||
24 | class CFilter : public CFilter_IFace | 25 | class CFilter : public CFilter_IFace |
25 | { | 26 | { |
26 | protected: | 27 | protected: |
27 | CCharacterSource* parent; | 28 | CCharacterSource* parent; |
28 | public: | 29 | public: |
30 | virtual QString getTableAsHtml(unsigned long loc) | ||
31 | { | ||
32 | qDebug("CFilter::getTableAsHtml()"); | ||
33 | return parent->getTableAsHtml(loc); | ||
34 | } | ||
29 | virtual linkType hyperlink(unsigned int n, unsigned int noff, QString& w, QString& nm) | 35 | virtual linkType hyperlink(unsigned int n, unsigned int noff, QString& w, QString& nm) |
30 | { | 36 | { |
31 | return parent->hyperlink(n,noff,w,nm); | 37 | return parent->hyperlink(n,noff,w,nm); |
32 | } | 38 | } |
33 | CFilter() : parent(NULL) {} | 39 | CFilter() : parent(NULL) {} |
34 | void setparent(CCharacterSource* p) { parent = p; } | 40 | void setparent(CCharacterSource* p) { parent = p; } |
@@ -47,13 +53,14 @@ class CFilter : public CFilter_IFace | |||
47 | virtual linkType forward(QString& f, size_t& loc) { return parent->forward(f, loc); } | 53 | virtual linkType forward(QString& f, size_t& loc) { return parent->forward(f, loc); } |
48 | virtual linkType back(QString& f, size_t& loc) { return parent->back(f, loc); } | 54 | virtual linkType back(QString& f, size_t& loc) { return parent->back(f, loc); } |
49 | virtual bool hasnavigation() { return parent->hasnavigation(); } | 55 | virtual bool hasnavigation() { return parent->hasnavigation(); } |
50 | virtual int getwidth() { return parent->getwidth(); } | 56 | virtual int getwidth() { return parent->getwidth(); } |
51 | QImage* getPicture(unsigned long tgt) { return parent->getPicture(tgt); } | 57 | QImage* getPicture(unsigned long tgt) { return parent->getPicture(tgt); } |
52 | QImage* getPicture(const QString& href) { return parent->getPicture(href); } | 58 | QImage* getPicture(const QString& href) { return parent->getPicture(href); } |
53 | bool getFile(const QString& href) { return parent->getFile(href); } | 59 | bool getFile(const QString& href, const QString& nm) { return parent->getFile(href, nm); } |
60 | virtual unsigned long startSection() { return parent->startSection(); } | ||
54 | }; | 61 | }; |
55 | 62 | ||
56 | class CFilterChain | 63 | class CFilterChain |
57 | { | 64 | { |
58 | CExpander_Interface* expander; | 65 | CExpander_Interface* expander; |
59 | CEncoding* encoder; | 66 | CEncoding* encoder; |
@@ -73,20 +80,30 @@ class CFilterChain | |||
73 | delete encoder; | 80 | delete encoder; |
74 | } | 81 | } |
75 | linkType hyperlink(unsigned int n, unsigned int noff, QString& wrd, QString& nm) | 82 | linkType hyperlink(unsigned int n, unsigned int noff, QString& wrd, QString& nm) |
76 | { | 83 | { |
77 | return front->hyperlink(n, noff, wrd, nm); | 84 | return front->hyperlink(n, noff, wrd, nm); |
78 | } | 85 | } |
86 | QString getTableAsHtml(unsigned long loc) | ||
87 | { | ||
88 | return front->getTableAsHtml(loc); | ||
89 | } | ||
79 | void locate(unsigned int n) | 90 | void locate(unsigned int n) |
80 | { | 91 | { |
81 | front->locate(n); | 92 | front->locate(n); |
82 | } | 93 | } |
83 | void getch(tchar& ch, CStyle& sty, unsigned long& pos) | 94 | void getch(tchar& ch, CStyle& sty, unsigned long& pos) |
84 | { | 95 | { |
85 | front->getch(ch, sty, pos); | 96 | front->getch(ch, sty, pos); |
86 | } | 97 | } |
98 | /* | ||
99 | void rawgetch(tchar& ch, CStyle& sty, unsigned long& pos) | ||
100 | { | ||
101 | encoder->getch(ch, sty, pos); | ||
102 | } | ||
103 | */ | ||
87 | void addfilter(CFilter_IFace* p) | 104 | void addfilter(CFilter_IFace* p) |
88 | { | 105 | { |
89 | if (first == NULL) | 106 | if (first == NULL) |
90 | { | 107 | { |
91 | front = first = p; | 108 | front = first = p; |
92 | p->setparent(encoder); | 109 | p->setparent(encoder); |
@@ -400,34 +417,43 @@ class ExternFilter : public CFilter_IFace | |||
400 | void *handle; | 417 | void *handle; |
401 | public: | 418 | public: |
402 | linkType hyperlink(unsigned int n, unsigned int noff, QString& w, QString& nm) | 419 | linkType hyperlink(unsigned int n, unsigned int noff, QString& w, QString& nm) |
403 | { | 420 | { |
404 | return filt->hyperlink(n, noff, w, nm); | 421 | return filt->hyperlink(n, noff, w, nm); |
405 | } | 422 | } |
423 | QString getTableAsHtml(unsigned long loc) | ||
424 | { | ||
425 | qDebug("ExternFilter::getTableAsHtml()"); | ||
426 | return filt->getTableAsHtml(loc); | ||
427 | } | ||
406 | void setparent(CCharacterSource* p) { filt->setparent(p); } | 428 | void setparent(CCharacterSource* p) { filt->setparent(p); } |
407 | ExternFilter(const QString& nm, const QString& optional); | 429 | ExternFilter(const QString& nm, const QString& optional); |
408 | ~ExternFilter() | 430 | ~ExternFilter() |
409 | { | 431 | { |
410 | if (filt != NULL) delete filt; | 432 | if (filt != NULL) delete filt; |
411 | if (handle != NULL) dlclose(handle); | 433 | if (handle != NULL) dlclose(handle); |
412 | } | 434 | } |
413 | void locate(unsigned int n) { filt->locate(n); } | 435 | void locate(unsigned int n) { filt->locate(n); } |
414 | bool findanchor(const QString& nm) { return filt->findanchor(nm); } | 436 | bool findanchor(const QString& nm) |
437 | { | ||
438 | return filt->findanchor(nm); | ||
439 | } | ||
415 | void saveposn(const QString& f, size_t posn) { filt->saveposn(f, posn); } | 440 | void saveposn(const QString& f, size_t posn) { filt->saveposn(f, posn); } |
416 | void writeposn(const QString& f, size_t posn) { filt->writeposn(f, posn); } | 441 | void writeposn(const QString& f, size_t posn) { filt->writeposn(f, posn); } |
417 | linkType forward(QString& f, size_t& loc) { return filt->forward(f, loc); } | 442 | linkType forward(QString& f, size_t& loc) { return filt->forward(f, loc); } |
418 | linkType back(QString& f, size_t& loc) { return filt->back(f, loc); } | 443 | linkType back(QString& f, size_t& loc) { return filt->back(f, loc); } |
419 | bool hasnavigation() { return filt->hasnavigation(); } | 444 | bool hasnavigation() { return filt->hasnavigation(); } |
420 | int getwidth() { return filt->getwidth(); } | 445 | int getwidth() { return filt->getwidth(); } |
421 | CCharacterSource* getparent() { return filt->getparent(); } | 446 | CCharacterSource* getparent() { return filt->getparent(); } |
422 | void getch(tchar& c, CStyle& s, unsigned long& l) { filt->getch(c, s, l); } | 447 | void getch(tchar& c, CStyle& s, unsigned long& l) { filt->getch(c, s, l); } |
423 | QImage* getPicture(unsigned long tgt) { return filt->getPicture(tgt); } | 448 | QImage* getPicture(unsigned long tgt) { return filt->getPicture(tgt); } |
424 | CFilter* filter() { return filt; } | 449 | CFilter* filter() { return filt; } |
425 | QImage* getPicture(const QString& href) { return filt->getPicture(href); } | 450 | QImage* getPicture(const QString& href) { return filt->getPicture(href); } |
426 | bool getFile(const QString& href) { return filt->getFile(href); } | 451 | bool getFile(const QString& href, const QString& nm) { return filt->getFile(href, nm); } |
427 | QString about() { return QString("Filter plug-in (c) Tim Wentford\n")+filt->about(); } | 452 | QString about() { return QString("Filter plug-in (c) Tim Wentford\n")+filt->about(); } |
453 | unsigned long startSection() { return filt->startSection(); } | ||
428 | }; | 454 | }; |
429 | #endif | 455 | #endif |
430 | 456 | ||
431 | class kern : public CFilter | 457 | class kern : public CFilter |
432 | { | 458 | { |
433 | tchar lastchar; | 459 | tchar lastchar; |
@@ -468,7 +494,30 @@ class setfg : public CFilter | |||
468 | public: | 494 | public: |
469 | setfg(int _r, int _g, int _b) : m_r(_r), m_g(_g), m_b(_b) {} | 495 | setfg(int _r, int _g, int _b) : m_r(_r), m_g(_g), m_b(_b) {} |
470 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); | 496 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); |
471 | QString about() { return QString("Foreground colour filter (c) Tim Wentford\n")+parent->about(); } | 497 | QString about() { return QString("Foreground colour filter (c) Tim Wentford\n")+parent->about(); } |
472 | }; | 498 | }; |
473 | 499 | ||
500 | class tableLink : public CFilter | ||
501 | { | ||
502 | QString text; | ||
503 | int offset; | ||
504 | int m_r, m_g, m_b; | ||
505 | public: | ||
506 | tableLink() : text( "See Table" ), offset(-1) | ||
507 | { | ||
508 | } | ||
509 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); | ||
510 | QString about() { return QString("Table link filter (c) Tim Wentford\n")+parent->about(); } | ||
511 | }; | ||
512 | |||
513 | class underlineLink : public CFilter | ||
514 | { | ||
515 | bool isLink; | ||
516 | public: | ||
517 | underlineLink() : isLink(false) {} | ||
518 | ~underlineLink() {} | ||
519 | void getch(tchar& ch, CStyle& sty, unsigned long& pos); | ||
520 | QString about() { return QString("Link underlining filter (c) Tim Wentford\n")+parent->about(); } | ||
521 | }; | ||
522 | |||
474 | #endif | 523 | #endif |