summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/BuffDoc.h
Unidiff
Diffstat (limited to 'noncore/apps/opie-reader/BuffDoc.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/BuffDoc.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/noncore/apps/opie-reader/BuffDoc.h b/noncore/apps/opie-reader/BuffDoc.h
index 1aac817..78d8457 100644
--- a/noncore/apps/opie-reader/BuffDoc.h
+++ b/noncore/apps/opie-reader/BuffDoc.h
@@ -1,84 +1,114 @@
1#ifndef __BuffDoc_h 1#ifndef __BuffDoc_h
2#define __BuffDoc_h 2#define __BuffDoc_h
3 3
4#include "ZText.h" 4#include "ZText.h"
5#include "Aportis.h" 5#include "Aportis.h"
6#include "ztxt.h" 6#include "ztxt.h"
7#include "ppm_expander.h" 7#include "ppm_expander.h"
8#include "CDrawBuffer.h" 8#include "CDrawBuffer.h"
9#include "CFilter.h" 9#include "CFilter.h"
10#include <qfontmetrics.h> 10#include <qfontmetrics.h>
11#include <qmessagebox.h> 11#include <qmessagebox.h>
12 12
13class BuffDoc 13class BuffDoc
14{ 14{
15 CDrawBuffer lastword; 15 CDrawBuffer lastword;
16 CSizeBuffer lastsizes, allsizes; 16 CSizeBuffer lastsizes, allsizes;
17 size_t laststartline; 17 size_t laststartline;
18 bool lastispara; 18 bool lastispara;
19 CExpander* exp; 19 CExpander* exp;
20 CFilterChain* filt; 20 CFilterChain* filt;
21 public: 21 public:
22 void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen)
23 {
24 if (exp == NULL)
25 {
26 data = NULL;
27 len = 0;
28 }
29 else
30 {
31 exp->setSaveData(data, len, src, srclen);
32 }
33 }
34 void putSaveData(unsigned char*& src, unsigned short& srclen)
35 {
36 if (exp != NULL)
37 {
38 exp->putSaveData(src, srclen);
39 }
40 }
41 void suspend() { if (exp != NULL) exp->suspend(); }
42 void unsuspend() { if (exp != NULL) exp->unsuspend(); }
22 ~BuffDoc() 43 ~BuffDoc()
23 { 44 {
24 delete filt; 45 delete filt;
25 delete exp; 46 delete exp;
26 } 47 }
27 BuffDoc() 48 BuffDoc()
28 { 49 {
29 exp = NULL; 50 exp = NULL;
30 filt = NULL; 51 filt = NULL;
31 lastword.empty(); 52 lastword.empty();
32 // qDebug("Buffdoc created"); 53 // qDebug("Buffdoc created");
33 } 54 }
34 bool empty() { return (exp == NULL); } 55 bool empty() { return (exp == NULL); }
35 void setfilter(CFilterChain* _f) 56 void setfilter(CFilterChain* _f)
36 { 57 {
37 if (filt != NULL) delete filt; 58 if (filt != NULL) delete filt;
38 filt = _f; 59 filt = _f;
39 filt->setsource(exp); 60 filt->setsource(exp);
40 } 61 }
41 CList<Bkmk>* getbkmklist() { return exp->getbkmklist(); } 62 CList<Bkmk>* getbkmklist() { return exp->getbkmklist(); }
42 bool hasrandomaccess() { return (exp == NULL) ? false : exp->hasrandomaccess(); } 63 bool hasrandomaccess() { return (exp == NULL) ? false : exp->hasrandomaccess(); }
43 bool iseol() { return (lastword[0] == '\0'); } 64 bool iseol() { return (lastword[0] == '\0'); }
44 int openfile(QWidget* _parent, const char *src); 65 int openfile(QWidget* _parent, const char *src);
45 tchar getch() 66 tchar getch()
46 { 67 {
47 tchar ch = UEOF; 68 tchar ch = UEOF;
48 CStyle sty; 69 CStyle sty;
49 if (exp != NULL) 70 if (exp != NULL)
50 { 71 {
51 filt->getch(ch, sty); 72 filt->getch(ch, sty);
52 } 73 }
53 return ch; 74 return ch;
54 } 75 }
55 void getch(tchar& ch, CStyle& sty) 76 void getch(tchar& ch, CStyle& sty)
56 { 77 {
57 if (exp != NULL) 78 if (exp != NULL)
58 { 79 {
59 filt->getch(ch, sty); 80 filt->getch(ch, sty);
60 } 81 }
61 else 82 else
62 ch = UEOF; 83 ch = UEOF;
63 } 84 }
85 QPixmap* getPicture(unsigned long tgt) { return (exp == NULL) ? NULL : exp->getPicture(tgt); }
86 unsigned int startSection() { return (exp == NULL) ? 0 : exp->startSection(); }
87 unsigned int endSection() { return (exp == NULL) ? 0 : exp->endSection(); }
64 unsigned int locate() { return (exp == NULL) ? 0 : laststartline; } 88 unsigned int locate() { return (exp == NULL) ? 0 : laststartline; }
65 unsigned int explocate() { return (exp == NULL) ? 0 : exp->locate(); } 89 unsigned int explocate() { return (exp == NULL) ? 0 : exp->locate(); }
90 void setContinuous(bool _b) { if (exp != NULL) exp->setContinuous(_b); }
66 MarkupType PreferredMarkup() { return (exp == NULL) ? cTEXT : exp->PreferredMarkup(); } 91 MarkupType PreferredMarkup() { return (exp == NULL) ? cTEXT : exp->PreferredMarkup(); }
67 bool hyperlink(unsigned int n); 92 bool hyperlink(unsigned int n);
93 size_t getHome() { return ((exp != NULL) ? exp->getHome() : 0); }
68 void locate(unsigned int n); 94 void locate(unsigned int n);
69 bool getline(CDrawBuffer* buff, int w); 95 bool getline(CDrawBuffer* buff, int w);
70 bool getline(CDrawBuffer* buff, int w, int cw); 96 bool getline(CDrawBuffer* buff, int w, int cw);
71 void sizes(unsigned long& fs, unsigned long& ts) { exp->sizes(fs,ts); } 97 void sizes(unsigned long& fs, unsigned long& ts) { exp->sizes(fs,ts); }
72 int getpara(CBuffer& buff) 98 int getpara(CBuffer& buff)
73 { 99 {
74 tchar ch; 100 tchar ch;
75 int i = 0; 101 int i = 0;
76 while ((ch = getch()) != 10 && ch != UEOF) buff[i++] = ch; 102 while ((ch = getch()) != 10 && ch != UEOF) buff[i++] = ch;
77 buff[i] = '\0'; 103 buff[i] = '\0';
78 if (i == 0 && ch == UEOF) i = -1; 104 if (i == 0 && ch == UEOF) i = -1;
79 laststartline = exp->locate(); 105 laststartline = exp->locate();
80 return i; 106 return i;
81 } 107 }
108 void saveposn(size_t posn) { exp->saveposn(posn); }
109 bool forward(size_t& loc) { return exp->forward(loc); }
110 bool back(size_t& loc) { return exp->back(loc); }
111 bool hasnavigation() { return exp->hasnavigation(); }
82}; 112};
83 113
84#endif 114#endif