Diffstat (limited to 'noncore/apps/opie-reader/BuffDoc.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/BuffDoc.h | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/noncore/apps/opie-reader/BuffDoc.h b/noncore/apps/opie-reader/BuffDoc.h index 2b4fb57..d6bfd99 100644 --- a/noncore/apps/opie-reader/BuffDoc.h +++ b/noncore/apps/opie-reader/BuffDoc.h | |||
@@ -26,118 +26,133 @@ class BuffDoc | |||
26 | // void setCustomHyphen(bool _v) { m_customhyphen = _v; } | 26 | // void setCustomHyphen(bool _v) { m_customhyphen = _v; } |
27 | // bool getCustomHyphen() { return m_customhyphen; } | 27 | // bool getCustomHyphen() { return m_customhyphen; } |
28 | void setHyphenThreshold(int _v) { m_hyphenthreshold = _v; } | 28 | void setHyphenThreshold(int _v) { m_hyphenthreshold = _v; } |
29 | void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) | 29 | void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) |
30 | { | 30 | { |
31 | if (exp == NULL) | 31 | if (exp == NULL) |
32 | { | 32 | { |
33 | data = NULL; | 33 | data = NULL; |
34 | len = 0; | 34 | len = 0; |
35 | } | 35 | } |
36 | else | 36 | else |
37 | { | 37 | { |
38 | exp->setSaveData(data, len, src, srclen); | 38 | exp->setSaveData(data, len, src, srclen); |
39 | } | 39 | } |
40 | } | 40 | } |
41 | void putSaveData(unsigned char*& src, unsigned short& srclen) | 41 | void putSaveData(unsigned char*& src, unsigned short& srclen) |
42 | { | 42 | { |
43 | if (exp != NULL) | 43 | if (exp != NULL) |
44 | { | 44 | { |
45 | exp->putSaveData(src, srclen); | 45 | exp->putSaveData(src, srclen); |
46 | } | 46 | } |
47 | } | 47 | } |
48 | #ifdef USEQPE | 48 | #ifdef USEQPE |
49 | void suspend() { if (exp != NULL) exp->suspend(); } | 49 | void suspend() { if (exp != NULL) exp->suspend(); } |
50 | void unsuspend() { if (exp != NULL) exp->unsuspend(); } | ||
51 | #else | 50 | #else |
52 | void suspend() {} | 51 | void suspend() {} |
53 | void unsuspend() {} | ||
54 | #endif | 52 | #endif |
55 | ~BuffDoc() | 53 | ~BuffDoc() |
56 | { | 54 | { |
57 | delete filt; | 55 | delete filt; |
58 | delete exp; | 56 | delete exp; |
59 | } | 57 | } |
60 | BuffDoc() | 58 | BuffDoc() |
61 | { | 59 | { |
62 | exp = NULL; | 60 | exp = NULL; |
63 | filt = NULL; | 61 | filt = NULL; |
64 | lastword.empty(); | 62 | lastword.empty(); |
65 | // // qDebug("Buffdoc created"); | 63 | // // qDebug("Buffdoc created"); |
66 | } | 64 | } |
67 | bool empty() { return (exp == NULL); } | 65 | bool empty() { return (exp == NULL); } |
68 | void setfilter(CFilterChain* _f) | 66 | void setfilter(CFilterChain* _f) |
69 | { | 67 | { |
70 | if (filt != NULL) delete filt; | 68 | if (filt != NULL) delete filt; |
71 | filt = _f; | 69 | filt = _f; |
72 | filt->setsource(exp); | 70 | filt->setsource(exp); |
73 | } | 71 | } |
74 | CList<Bkmk>* getbkmklist() { return exp->getbkmklist(); } | 72 | CList<Bkmk>* getbkmklist() { return exp->getbkmklist(); } |
75 | bool hasrandomaccess() { return (exp == NULL) ? false : exp->hasrandomaccess(); } | 73 | bool hasrandomaccess() { return (exp == NULL) ? false : exp->hasrandomaccess(); } |
76 | bool iseol() { return (lastword[0] == '\0'); } | 74 | bool iseol() { return (lastword[0] == '\0'); } |
77 | int openfile(QWidget* _parent, const char *src); | 75 | int openfile(QWidget* _parent, const char *src); |
78 | tchar getch() | 76 | tchar getch() |
79 | { | 77 | { |
80 | tchar ch = UEOF; | 78 | tchar ch = UEOF; |
81 | CStyle sty; | 79 | CStyle sty; |
82 | if (exp != NULL) | 80 | if (exp != NULL) |
83 | { | 81 | { |
84 | unsigned long dummy; | 82 | unsigned long dummy; |
85 | filt->getch(ch, sty, dummy); | 83 | filt->getch(ch, sty, dummy); |
86 | } | 84 | } |
87 | return ch; | 85 | return ch; |
88 | } | 86 | } |
89 | void getch(tchar& ch, CStyle& sty, unsigned long& pos) | 87 | void getch(tchar& ch, CStyle& sty, unsigned long& pos) |
90 | { | 88 | { |
91 | if (exp != NULL) | 89 | if (exp != NULL) |
92 | { | 90 | { |
93 | filt->getch(ch, sty, pos); | 91 | filt->getch(ch, sty, pos); |
94 | } | 92 | } |
95 | else | 93 | else |
96 | ch = UEOF; | 94 | ch = UEOF; |
97 | } | 95 | } |
96 | /* | ||
97 | void rawgetch(tchar& ch, CStyle& sty, unsigned long& pos) | ||
98 | { | ||
99 | if (exp != NULL) | ||
100 | { | ||
101 | filt->rawgetch(ch, sty, pos); | ||
102 | } | ||
103 | else | ||
104 | ch = UEOF; | ||
105 | } | ||
106 | */ | ||
98 | void setwidth(int w) { if (exp != NULL) exp->setwidth(w); } | 107 | void setwidth(int w) { if (exp != NULL) exp->setwidth(w); } |
99 | QImage* getPicture(unsigned long tgt) { return (exp == NULL) ? NULL : exp->getPicture(tgt); } | 108 | QImage* getPicture(unsigned long tgt) { return (exp == NULL) ? NULL : exp->getPicture(tgt); } |
100 | unsigned int startSection() { return (exp == NULL) ? 0 : exp->startSection(); } | 109 | unsigned int startSection() { return (exp == NULL) ? 0 : exp->startSection(); } |
101 | unsigned int endSection() { return (exp == NULL) ? 0 : exp->endSection(); } | 110 | unsigned int endSection() { return (exp == NULL) ? 0 : exp->endSection(); } |
111 | void resetPos(); | ||
102 | unsigned int locate() { return (exp == NULL) ? 0 : laststartline; } | 112 | unsigned int locate() { return (exp == NULL) ? 0 : laststartline; } |
103 | unsigned int explocate() { return (exp == NULL) ? 0 : exp->locate(); } | 113 | unsigned int explocate() { return (exp == NULL) ? 0 : exp->locate(); } |
104 | void setContinuous(bool _b) { if (exp != NULL) exp->setContinuous(_b); } | 114 | void setContinuous(bool _b) { if (exp != NULL) exp->setContinuous(_b); } |
105 | MarkupType PreferredMarkup() { return (exp == NULL) ? cTEXT : exp->PreferredMarkup(); } | 115 | MarkupType PreferredMarkup() { return (exp == NULL) ? cTEXT : exp->PreferredMarkup(); } |
106 | linkType hyperlink(unsigned int n, unsigned int noff, QString& wrd, QString& nm); | 116 | linkType hyperlink(unsigned int n, unsigned int noff, QString& wrd, QString& nm); |
107 | size_t getHome() { return ((exp != NULL) ? exp->getHome() : 0); } | 117 | size_t getHome() { return ((exp != NULL) ? exp->getHome() : 0); } |
108 | void locate(unsigned int n); | 118 | void locate(unsigned int n); |
109 | bool getline(CDrawBuffer* buff, int w, unsigned short _lborder, unsigned short _rborder, bool hyphenate, int availht); | 119 | bool getline(CDrawBuffer* buff, int w, unsigned short _lborder, unsigned short _rborder, bool hyphenate, int availht); |
110 | bool getline(CDrawBuffer* buff, int w, int cw, unsigned short _lborder, unsigned short _rborder, int availht); | 120 | bool getline(CDrawBuffer* buff, int w, int cw, unsigned short _lborder, unsigned short _rborder, int availht); |
111 | void sizes(unsigned long& fs, unsigned long& ts) | 121 | void sizes(unsigned long& fs, unsigned long& ts) |
112 | { | 122 | { |
113 | if (exp != NULL) | 123 | if (exp != NULL) |
114 | { | 124 | { |
115 | exp->sizes(fs,ts); | 125 | exp->sizes(fs,ts); |
116 | } | 126 | } |
117 | else | 127 | else |
118 | { | 128 | { |
119 | fs = ts = 0; | 129 | fs = ts = 0; |
120 | } | 130 | } |
121 | } | 131 | } |
122 | int getpara(CBuffer& buff) | 132 | int getpara(CBuffer& buff) |
123 | { | 133 | { |
124 | tchar ch; | 134 | tchar ch; |
125 | int i = 0; | 135 | int i = 0; |
126 | while ((ch = getch()) != 10 && ch != UEOF) buff[i++] = ch; | 136 | while ((ch = getch()) != 10 && ch != UEOF) buff[i++] = ch; |
127 | buff[i] = '\0'; | 137 | buff[i] = '\0'; |
128 | if (i == 0 && ch == UEOF) i = -1; | 138 | if (i == 0 && ch == UEOF) i = -1; |
129 | laststartline = exp->locate(); | 139 | laststartline = exp->locate(); |
130 | return i; | 140 | return i; |
131 | } | 141 | } |
142 | int getsentence(CBuffer& buff); | ||
132 | void saveposn(const QString& f, size_t posn) { filt->saveposn(f, posn); } | 143 | void saveposn(const QString& f, size_t posn) { filt->saveposn(f, posn); } |
133 | void writeposn(const QString& f, size_t posn) { filt->writeposn(f, posn); } | 144 | void writeposn(const QString& f, size_t posn) { filt->writeposn(f, posn); } |
134 | linkType forward(QString& f, size_t& loc) { return filt->forward(f, loc); } | 145 | linkType forward(QString& f, size_t& loc) { return filt->forward(f, loc); } |
135 | linkType back(QString& f, size_t& loc) { return filt->back(f, loc); } | 146 | linkType back(QString& f, size_t& loc) { return filt->back(f, loc); } |
136 | bool hasnavigation() { return filt->hasnavigation(); } | 147 | bool hasnavigation() { return (exp == NULL) ? false : filt->hasnavigation(); } |
137 | bool getFile(QString href) | 148 | bool getFile(const QString& href, QString& nm) |
149 | { | ||
150 | return (exp == NULL) ? false : exp->getFile(href, nm); | ||
151 | } | ||
152 | QString getTableAsHtml(unsigned long loc) | ||
138 | { | 153 | { |
139 | return (exp == NULL) ? false : exp->getFile(href); | 154 | return (exp != NULL) ? filt->getTableAsHtml(loc) : QString(""); |
140 | } | 155 | } |
141 | }; | 156 | }; |
142 | 157 | ||
143 | #endif | 158 | #endif |