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/BuffDoc.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/BuffDoc.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/BuffDoc.h | 168 |
1 files changed, 95 insertions, 73 deletions
diff --git a/noncore/apps/opie-reader/BuffDoc.h b/noncore/apps/opie-reader/BuffDoc.h index 61531c0..a7dd7bf 100644 --- a/noncore/apps/opie-reader/BuffDoc.h +++ b/noncore/apps/opie-reader/BuffDoc.h @@ -4,8 +4,5 @@ #include "useqpe.h" -#include "ZText.h" -#include "Aportis.h" -#include "ztxt.h" -#include "ppm_expander.h" #include "CDrawBuffer.h" #include "CFilter.h" +#include "CExpander.h" #include <qfontmetrics.h> @@ -19,24 +16,34 @@ class BuffDoc bool lastispara; - CExpander* exp; + CExpander_Interface* exp; CFilterChain* filt; + int m_hyphenthreshold; + // bool m_customhyphen; public: + QString about(); + bool findanchor(const QString& nm) + { + return filt->findanchor(nm); + } + // void setCustomHyphen(bool _v) { m_customhyphen = _v; } + // bool getCustomHyphen() { return m_customhyphen; } + void setHyphenThreshold(int _v) { m_hyphenthreshold = _v; } void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) - { - if (exp == NULL) - { - data = NULL; - len = 0; - } - else - { - exp->setSaveData(data, len, src, srclen); - } - } + { + if (exp == NULL) + { + data = NULL; + len = 0; + } + else + { + exp->setSaveData(data, len, src, srclen); + } + } void putSaveData(unsigned char*& src, unsigned short& srclen) - { - if (exp != NULL) - { - exp->putSaveData(src, srclen); - } - } + { + if (exp != NULL) + { + exp->putSaveData(src, srclen); + } + } #ifdef USEQPE @@ -49,20 +56,20 @@ class BuffDoc ~BuffDoc() - { - delete filt; - delete exp; - } + { + delete filt; + delete exp; + } BuffDoc() - { - exp = NULL; - filt = NULL; - lastword.empty(); - // odebug << "Buffdoc created" << oendl; - } + { + exp = NULL; + filt = NULL; + lastword.empty(); +// // qDebug("Buffdoc created"); + } bool empty() { return (exp == NULL); } void setfilter(CFilterChain* _f) - { - if (filt != NULL) delete filt; - filt = _f; - filt->setsource(exp); - } + { + if (filt != NULL) delete filt; + filt = _f; + filt->setsource(exp); + } CList<Bkmk>* getbkmklist() { return exp->getbkmklist(); } @@ -72,20 +79,21 @@ class BuffDoc tchar getch() - { - tchar ch = UEOF; - CStyle sty; - if (exp != NULL) - { - filt->getch(ch, sty); - } - return ch; - } - void getch(tchar& ch, CStyle& sty) - { - if (exp != NULL) - { - filt->getch(ch, sty); - } - else - ch = UEOF; - } + { + tchar ch = UEOF; + CStyle sty; + if (exp != NULL) + { + unsigned long dummy; + filt->getch(ch, sty, dummy); + } + return ch; + } + void getch(tchar& ch, CStyle& sty, unsigned long& pos) + { + if (exp != NULL) + { + filt->getch(ch, sty, pos); + } + else + ch = UEOF; + } void setwidth(int w) { if (exp != NULL) exp->setwidth(w); } @@ -98,23 +106,37 @@ class BuffDoc MarkupType PreferredMarkup() { return (exp == NULL) ? cTEXT : exp->PreferredMarkup(); } - linkType hyperlink(unsigned int n, QString& wrd); + linkType hyperlink(unsigned int n, unsigned int noff, QString& wrd, QString& nm); size_t getHome() { return ((exp != NULL) ? exp->getHome() : 0); } void locate(unsigned int n); - bool getline(CDrawBuffer* buff, int w, unsigned char _border); - bool getline(CDrawBuffer* buff, int w, int cw, unsigned char _border); - void sizes(unsigned long& fs, unsigned long& ts) { exp->sizes(fs,ts); } + bool getline(CDrawBuffer* buff, int w, unsigned short _lborder, unsigned short _rborder, bool hyphenate, int availht); + bool getline(CDrawBuffer* buff, int w, int cw, unsigned short _lborder, unsigned short _rborder, int availht); + void sizes(unsigned long& fs, unsigned long& ts) + { + if (exp != NULL) + { + exp->sizes(fs,ts); + } + else + { + fs = ts = 0; + } + } int getpara(CBuffer& buff) - { - tchar ch; - int i = 0; - while ((ch = getch()) != 10 && ch != UEOF) buff[i++] = ch; - buff[i] = '\0'; - if (i == 0 && ch == UEOF) i = -1; - laststartline = exp->locate(); - return i; - } - void saveposn(size_t posn) { exp->saveposn(posn); } - void writeposn(size_t posn) { exp->writeposn(posn); } - bool forward(size_t& loc) { return exp->forward(loc); } - bool back(size_t& loc) { return exp->back(loc); } - bool hasnavigation() { return exp->hasnavigation(); } + { + tchar ch; + int i = 0; + while ((ch = getch()) != 10 && ch != UEOF) buff[i++] = ch; + buff[i] = '\0'; + if (i == 0 && ch == UEOF) i = -1; + laststartline = exp->locate(); + return i; + } + void saveposn(const QString& f, size_t posn) { filt->saveposn(f, posn); } + void writeposn(const QString& f, size_t posn) { filt->writeposn(f, posn); } + linkType forward(QString& f, size_t& loc) { return filt->forward(f, loc); } + linkType back(QString& f, size_t& loc) { return filt->back(f, loc); } + bool hasnavigation() { return filt->hasnavigation(); } + bool getFile(QString href) + { + return (exp == NULL) ? false : exp->getFile(href); + } }; |