summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/CFilter.h
Unidiff
Diffstat (limited to 'noncore/apps/opie-reader/CFilter.h') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-reader/CFilter.h93
1 files changed, 67 insertions, 26 deletions
diff --git a/noncore/apps/opie-reader/CFilter.h b/noncore/apps/opie-reader/CFilter.h
index 2d0c30f..0a03b3e 100644
--- a/noncore/apps/opie-reader/CFilter.h
+++ b/noncore/apps/opie-reader/CFilter.h
@@ -6,12 +6,16 @@
6 6
7class CFilter : public CCharacterSource 7class CFilter : public CCharacterSource
8{ 8{
9 friend class CFilterChain; 9 friend class CFilterChain;
10 protected: 10 protected:
11 CCharacterSource* parent; 11 CCharacterSource* parent;
12 linkType hyperlink(unsigned int n, QString& w)
13 {
14 return parent->hyperlink(n,w);
15 }
12 public: 16 public:
13 CFilter() : parent(NULL) {} 17 CFilter() : parent(NULL) {}
14 void setparent(CCharacterSource* p) { parent = p; } 18 void setparent(CCharacterSource* p) { parent = p; }
15 virtual ~CFilter() {}; 19 virtual ~CFilter() {};
16}; 20};
17 21
@@ -66,14 +70,14 @@ class CFilterChain
66}; 70};
67 71
68class stripcr : public CFilter 72class stripcr : public CFilter
69{ 73{
70 public: 74 public:
71 stripcr() {} 75 stripcr() {}
72 virtual ~stripcr() {} 76 ~stripcr() {}
73 virtual void getch(tchar& ch, CStyle& sty) 77 void getch(tchar& ch, CStyle& sty)
74 { 78 {
75 do 79 do
76 { 80 {
77 parent->getch(ch, sty); 81 parent->getch(ch, sty);
78 } 82 }
79 while (ch == 13); 83 while (ch == 13);
@@ -84,14 +88,14 @@ class dehyphen : public CFilter
84{ 88{
85 bool m_bCharWaiting; 89 bool m_bCharWaiting;
86 tchar m_nextChar; 90 tchar m_nextChar;
87 CStyle m_nextSty; 91 CStyle m_nextSty;
88 public: 92 public:
89 dehyphen() : m_bCharWaiting(false) {} 93 dehyphen() : m_bCharWaiting(false) {}
90 virtual ~dehyphen() {} 94 ~dehyphen() {}
91 virtual void getch(tchar& ch, CStyle& sty) 95 void getch(tchar& ch, CStyle& sty)
92 { 96 {
93 if (m_bCharWaiting) 97 if (m_bCharWaiting)
94 { 98 {
95 m_bCharWaiting = false; 99 m_bCharWaiting = false;
96 ch = m_nextChar; 100 ch = m_nextChar;
97 sty = m_nextSty; 101 sty = m_nextSty;
@@ -116,23 +120,23 @@ class striphtml : public CFilter
116 unsigned short skip_ws(); 120 unsigned short skip_ws();
117 unsigned short skip_ws_end(); 121 unsigned short skip_ws_end();
118 unsigned short parse_m(); 122 unsigned short parse_m();
119 void mygetch(tchar& ch, CStyle& sty); 123 void mygetch(tchar& ch, CStyle& sty);
120 public: 124 public:
121 striphtml() {} 125 striphtml() {}
122 virtual ~striphtml() {} 126 ~striphtml() {}
123 virtual void getch(tchar& ch, CStyle& sty); 127 void getch(tchar& ch, CStyle& sty);
124}; 128};
125 129
126class unindent : public CFilter 130class unindent : public CFilter
127{ 131{
128 tchar lc; 132 tchar lc;
129 public: 133 public:
130 unindent() : lc(0) {} 134 unindent() : lc(0) {}
131 virtual ~unindent() {} 135 ~unindent() {}
132 virtual void getch(tchar& ch, CStyle& sty) 136 void getch(tchar& ch, CStyle& sty)
133 { 137 {
134 if (lc == 10) 138 if (lc == 10)
135 { 139 {
136 do 140 do
137 { 141 {
138 parent->getch(ch, sty); 142 parent->getch(ch, sty);
@@ -147,14 +151,14 @@ class unindent : public CFilter
147 151
148class repara : public CFilter 152class repara : public CFilter
149{ 153{
150 tchar tch; 154 tchar tch;
151 public: 155 public:
152 repara() : tch(0) {} 156 repara() : tch(0) {}
153 virtual ~repara() {} 157 ~repara() {}
154 virtual void getch(tchar& ch, CStyle& sty) 158 void getch(tchar& ch, CStyle& sty)
155 { 159 {
156 parent->getch(ch, sty); 160 parent->getch(ch, sty);
157 if (ch == 10) 161 if (ch == 10)
158 { 162 {
159 if (tch == 10) 163 if (tch == 10)
160 { 164 {
@@ -176,14 +180,14 @@ class indenter : public CFilter
176{ 180{
177 int amnt; 181 int amnt;
178 int indent; 182 int indent;
179 CStyle lsty; 183 CStyle lsty;
180 public: 184 public:
181 indenter(int _a=5) : amnt(_a), indent(0) {} 185 indenter(int _a=5) : amnt(_a), indent(0) {}
182 virtual ~indenter() {} 186 ~indenter() {}
183 virtual void getch(tchar& ch, CStyle& sty) 187 void getch(tchar& ch, CStyle& sty)
184 { 188 {
185 if (indent > 0) 189 if (indent > 0)
186 { 190 {
187 indent--; 191 indent--;
188 ch = ' '; 192 ch = ' ';
189 sty = lsty; 193 sty = lsty;
@@ -202,14 +206,14 @@ class indenter : public CFilter
202class dblspce : public CFilter 206class dblspce : public CFilter
203{ 207{
204 bool lastlf; 208 bool lastlf;
205 CStyle lsty; 209 CStyle lsty;
206 public: 210 public:
207 dblspce() : lastlf(false) {} 211 dblspce() : lastlf(false) {}
208 virtual ~dblspce() {} 212 ~dblspce() {}
209 virtual void getch(tchar& ch, CStyle& sty) 213 void getch(tchar& ch, CStyle& sty)
210 { 214 {
211 if (lastlf) 215 if (lastlf)
212 { 216 {
213 lastlf = false; 217 lastlf = false;
214 ch = 10; 218 ch = 10;
215 sty = lsty; 219 sty = lsty;
@@ -229,22 +233,22 @@ class textfmt : public CFilter
229 CStyle currentstyle; 233 CStyle currentstyle;
230 tchar lastchar; 234 tchar lastchar;
231 bool uselast; 235 bool uselast;
232 void mygetch(tchar&, CStyle&); 236 void mygetch(tchar&, CStyle&);
233 public: 237 public:
234 textfmt() : lastchar(0), uselast(false) {} 238 textfmt() : lastchar(0), uselast(false) {}
235 virtual ~textfmt() {} 239 ~textfmt() {}
236 virtual void getch(tchar& ch, CStyle& sty); 240 void getch(tchar& ch, CStyle& sty);
237}; 241};
238 242
239class embolden : public CFilter 243class embolden : public CFilter
240{ 244{
241 public: 245 public:
242 embolden() {} 246 embolden() {}
243 virtual ~embolden() {} 247 ~embolden() {}
244 virtual void getch(tchar& ch, CStyle& sty) 248 void getch(tchar& ch, CStyle& sty)
245 { 249 {
246 parent->getch(ch, sty); 250 parent->getch(ch, sty);
247 sty.setBold(); 251 sty.setBold();
248 } 252 }
249}; 253};
250 254
@@ -252,36 +256,73 @@ class remap : public CFilter
252{ 256{
253 tchar q[3]; 257 tchar q[3];
254 int offset; 258 int offset;
255 CStyle currentstyle; 259 CStyle currentstyle;
256 public: 260 public:
257 remap() : offset(0) { q[0] = 0; } 261 remap() : offset(0) { q[0] = 0; }
258 virtual ~remap() {} 262 ~remap() {}
259 virtual void getch(tchar& ch, CStyle& sty); 263 void getch(tchar& ch, CStyle& sty);
260}; 264};
261 265
262class PeanutFormatter : public CFilter 266class PeanutFormatter : public CFilter
263{ 267{
264 CStyle currentstyle; 268 CStyle currentstyle;
265 public: 269 public:
266 virtual ~PeanutFormatter() {} 270 ~PeanutFormatter() {}
267 virtual void getch(tchar& ch, CStyle& sty); 271 void getch(tchar& ch, CStyle& sty);
268}; 272};
269 273
270class OnePara : public CFilter 274class OnePara : public CFilter
271{ 275{
272 tchar m_lastchar; 276 tchar m_lastchar;
273 public: 277 public:
274 OnePara() : m_lastchar(0) {} 278 OnePara() : m_lastchar(0) {}
275 virtual ~OnePara() {} 279 ~OnePara() {}
276 virtual void getch(tchar& ch, CStyle& sty); 280 void getch(tchar& ch, CStyle& sty);
281};
282
283class DePluck : public CFilter
284{
285 tchar* nextpart;
286 tchar m_buffer;
287 int m_buffed;
288 int m_current;
289 bool m_debuff;
290 CStyle m_laststyle;
291 public:
292 DePluck(tchar* t) : nextpart(t), m_buffer(0), m_buffed(0), m_current(0), m_debuff(false) {}
293 ~DePluck() {}
294 void getch(tchar& ch, CStyle& sty);
277}; 295};
278 296
279#ifdef REPALM 297#ifdef REPALM
280class repalm : public CFilter 298class repalm : public CFilter
281{ 299{
282 public: 300 public:
283 virtual ~repalm() {} 301 ~repalm() {}
284 virtual void getch(tchar& ch, CStyle& sty); 302 void getch(tchar& ch, CStyle& sty);
285}; 303};
286#endif 304#endif
305
306class FullJust : public CFilter
307{
308 public:
309 void getch(tchar& ch, CStyle& sty)
310 {
311 parent->getch(ch, sty);
312 if (sty.getJustify() == m_AlignLeft) sty.setFullJustify();
313 }
314};
315/*
316class AddSpace : public CFilter
317{
318 unsigned char m_espc;
319 public:
320 AddSpace(unsigned char s) : m_espc(s) {}
321 void getch(tchar& ch, CStyle& sty)
322 {
323 parent->getch(ch, sty);
324 sty.setExtraSpace(m_espc);
325 }
326};
327*/
287#endif 328#endif