Diffstat (limited to 'noncore/apps/opie-reader/BuffDoc.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/BuffDoc.h | 58 |
1 files changed, 40 insertions, 18 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 | |||
@@ -1,28 +1,35 @@ | |||
1 | #ifndef __BuffDoc_h | 1 | #ifndef __BuffDoc_h |
2 | #define __BuffDoc_h | 2 | #define __BuffDoc_h |
3 | 3 | ||
4 | #include "useqpe.h" | 4 | #include "useqpe.h" |
5 | #include "ZText.h" | ||
6 | #include "Aportis.h" | ||
7 | #include "ztxt.h" | ||
8 | #include "ppm_expander.h" | ||
9 | #include "CDrawBuffer.h" | 5 | #include "CDrawBuffer.h" |
10 | #include "CFilter.h" | 6 | #include "CFilter.h" |
7 | #include "CExpander.h" | ||
11 | #include <qfontmetrics.h> | 8 | #include <qfontmetrics.h> |
12 | #include <qmessagebox.h> | 9 | #include <qmessagebox.h> |
13 | 10 | ||
14 | class BuffDoc | 11 | class BuffDoc |
15 | { | 12 | { |
16 | CDrawBuffer lastword; | 13 | CDrawBuffer lastword; |
17 | CSizeBuffer lastsizes, allsizes; | 14 | CSizeBuffer lastsizes, allsizes; |
18 | size_t laststartline; | 15 | size_t laststartline; |
19 | bool lastispara; | 16 | bool lastispara; |
20 | CExpander* exp; | 17 | CExpander_Interface* exp; |
21 | CFilterChain* filt; | 18 | CFilterChain* filt; |
19 | int m_hyphenthreshold; | ||
20 | // bool m_customhyphen; | ||
22 | public: | 21 | public: |
22 | QString about(); | ||
23 | bool findanchor(const QString& nm) | ||
24 | { | ||
25 | return filt->findanchor(nm); | ||
26 | } | ||
27 | // void setCustomHyphen(bool _v) { m_customhyphen = _v; } | ||
28 | // bool getCustomHyphen() { return m_customhyphen; } | ||
29 | void setHyphenThreshold(int _v) { m_hyphenthreshold = _v; } | ||
23 | void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) | 30 | void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) |
24 | { | 31 | { |
25 | if (exp == NULL) | 32 | if (exp == NULL) |
26 | { | 33 | { |
27 | data = NULL; | 34 | data = NULL; |
28 | len = 0; | 35 | len = 0; |
@@ -53,13 +60,13 @@ class BuffDoc | |||
53 | } | 60 | } |
54 | BuffDoc() | 61 | BuffDoc() |
55 | { | 62 | { |
56 | exp = NULL; | 63 | exp = NULL; |
57 | filt = NULL; | 64 | filt = NULL; |
58 | lastword.empty(); | 65 | lastword.empty(); |
59 | // odebug << "Buffdoc created" << oendl; | 66 | // // qDebug("Buffdoc created"); |
60 | } | 67 | } |
61 | bool empty() { return (exp == NULL); } | 68 | bool empty() { return (exp == NULL); } |
62 | void setfilter(CFilterChain* _f) | 69 | void setfilter(CFilterChain* _f) |
63 | { | 70 | { |
64 | if (filt != NULL) delete filt; | 71 | if (filt != NULL) delete filt; |
65 | filt = _f; | 72 | filt = _f; |
@@ -72,51 +79,66 @@ class BuffDoc | |||
72 | tchar getch() | 79 | tchar getch() |
73 | { | 80 | { |
74 | tchar ch = UEOF; | 81 | tchar ch = UEOF; |
75 | CStyle sty; | 82 | CStyle sty; |
76 | if (exp != NULL) | 83 | if (exp != NULL) |
77 | { | 84 | { |
78 | filt->getch(ch, sty); | 85 | unsigned long dummy; |
86 | filt->getch(ch, sty, dummy); | ||
79 | } | 87 | } |
80 | return ch; | 88 | return ch; |
81 | } | 89 | } |
82 | void getch(tchar& ch, CStyle& sty) | 90 | void getch(tchar& ch, CStyle& sty, unsigned long& pos) |
83 | { | 91 | { |
84 | if (exp != NULL) | 92 | if (exp != NULL) |
85 | { | 93 | { |
86 | filt->getch(ch, sty); | 94 | filt->getch(ch, sty, pos); |
87 | } | 95 | } |
88 | else | 96 | else |
89 | ch = UEOF; | 97 | ch = UEOF; |
90 | } | 98 | } |
91 | void setwidth(int w) { if (exp != NULL) exp->setwidth(w); } | 99 | void setwidth(int w) { if (exp != NULL) exp->setwidth(w); } |
92 | QImage* getPicture(unsigned long tgt) { return (exp == NULL) ? NULL : exp->getPicture(tgt); } | 100 | QImage* getPicture(unsigned long tgt) { return (exp == NULL) ? NULL : exp->getPicture(tgt); } |
93 | unsigned int startSection() { return (exp == NULL) ? 0 : exp->startSection(); } | 101 | unsigned int startSection() { return (exp == NULL) ? 0 : exp->startSection(); } |
94 | unsigned int endSection() { return (exp == NULL) ? 0 : exp->endSection(); } | 102 | unsigned int endSection() { return (exp == NULL) ? 0 : exp->endSection(); } |
95 | unsigned int locate() { return (exp == NULL) ? 0 : laststartline; } | 103 | unsigned int locate() { return (exp == NULL) ? 0 : laststartline; } |
96 | unsigned int explocate() { return (exp == NULL) ? 0 : exp->locate(); } | 104 | unsigned int explocate() { return (exp == NULL) ? 0 : exp->locate(); } |
97 | void setContinuous(bool _b) { if (exp != NULL) exp->setContinuous(_b); } | 105 | void setContinuous(bool _b) { if (exp != NULL) exp->setContinuous(_b); } |
98 | MarkupType PreferredMarkup() { return (exp == NULL) ? cTEXT : exp->PreferredMarkup(); } | 106 | MarkupType PreferredMarkup() { return (exp == NULL) ? cTEXT : exp->PreferredMarkup(); } |
99 | linkType hyperlink(unsigned int n, QString& wrd); | 107 | linkType hyperlink(unsigned int n, unsigned int noff, QString& wrd, QString& nm); |
100 | size_t getHome() { return ((exp != NULL) ? exp->getHome() : 0); } | 108 | size_t getHome() { return ((exp != NULL) ? exp->getHome() : 0); } |
101 | void locate(unsigned int n); | 109 | void locate(unsigned int n); |
102 | bool getline(CDrawBuffer* buff, int w, unsigned char _border); | 110 | bool getline(CDrawBuffer* buff, int w, unsigned short _lborder, unsigned short _rborder, bool hyphenate, int availht); |
103 | bool getline(CDrawBuffer* buff, int w, int cw, unsigned char _border); | 111 | bool getline(CDrawBuffer* buff, int w, int cw, unsigned short _lborder, unsigned short _rborder, int availht); |
104 | void sizes(unsigned long& fs, unsigned long& ts) { exp->sizes(fs,ts); } | 112 | void sizes(unsigned long& fs, unsigned long& ts) |
113 | { | ||
114 | if (exp != NULL) | ||
115 | { | ||
116 | exp->sizes(fs,ts); | ||
117 | } | ||
118 | else | ||
119 | { | ||
120 | fs = ts = 0; | ||
121 | } | ||
122 | } | ||
105 | int getpara(CBuffer& buff) | 123 | int getpara(CBuffer& buff) |
106 | { | 124 | { |
107 | tchar ch; | 125 | tchar ch; |
108 | int i = 0; | 126 | int i = 0; |
109 | while ((ch = getch()) != 10 && ch != UEOF) buff[i++] = ch; | 127 | while ((ch = getch()) != 10 && ch != UEOF) buff[i++] = ch; |
110 | buff[i] = '\0'; | 128 | buff[i] = '\0'; |
111 | if (i == 0 && ch == UEOF) i = -1; | 129 | if (i == 0 && ch == UEOF) i = -1; |
112 | laststartline = exp->locate(); | 130 | laststartline = exp->locate(); |
113 | return i; | 131 | return i; |
114 | } | 132 | } |
115 | void saveposn(size_t posn) { exp->saveposn(posn); } | 133 | void saveposn(const QString& f, size_t posn) { filt->saveposn(f, posn); } |
116 | void writeposn(size_t posn) { exp->writeposn(posn); } | 134 | void writeposn(const QString& f, size_t posn) { filt->writeposn(f, posn); } |
117 | bool forward(size_t& loc) { return exp->forward(loc); } | 135 | linkType forward(QString& f, size_t& loc) { return filt->forward(f, loc); } |
118 | bool back(size_t& loc) { return exp->back(loc); } | 136 | linkType back(QString& f, size_t& loc) { return filt->back(f, loc); } |
119 | bool hasnavigation() { return exp->hasnavigation(); } | 137 | bool hasnavigation() { return filt->hasnavigation(); } |
138 | bool getFile(QString href) | ||
139 | { | ||
140 | return (exp == NULL) ? false : exp->getFile(href); | ||
141 | } | ||
120 | }; | 142 | }; |
121 | 143 | ||
122 | #endif | 144 | #endif |