Diffstat (limited to 'noncore/apps/opie-reader/CExpander.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/CExpander.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/noncore/apps/opie-reader/CExpander.h b/noncore/apps/opie-reader/CExpander.h index 7fa84f9..24c317d 100644 --- a/noncore/apps/opie-reader/CExpander.h +++ b/noncore/apps/opie-reader/CExpander.h | |||
@@ -1,148 +1,156 @@ | |||
1 | #ifndef __CExpander_h | 1 | #ifndef __CExpander_h |
2 | #define __CExpander_h | 2 | #define __CExpander_h |
3 | 3 | ||
4 | #ifndef _WINDOWS | 4 | #ifndef _WINDOWS |
5 | #include <unistd.h> | 5 | #include <unistd.h> |
6 | #endif | 6 | #endif |
7 | #include <stdio.h> | 7 | #include <stdio.h> |
8 | #include <time.h> | 8 | #include <time.h> |
9 | #include <sys/stat.h> | 9 | #include <sys/stat.h> |
10 | #include <qmessagebox.h> | 10 | #include <qmessagebox.h> |
11 | #include "config.h" | 11 | #include "config.h" |
12 | #include "StyleConsts.h" | 12 | #include "StyleConsts.h" |
13 | #include "Markups.h" | 13 | #include "Markups.h" |
14 | #include "names.h" | 14 | #include "names.h" |
15 | #include "linktype.h" | 15 | #include "linktype.h" |
16 | 16 | ||
17 | class QImage; | 17 | class QImage; |
18 | class Bkmk; | 18 | class Bkmk; |
19 | class QString; | 19 | class QString; |
20 | 20 | ||
21 | template<class T> | 21 | template<class T> |
22 | class CList; | 22 | class CList; |
23 | 23 | ||
24 | class CCharacterSource | 24 | class CCharacterSource |
25 | { | 25 | { |
26 | public: | 26 | public: |
27 | virtual QString getTableAsHtml(unsigned long loc) = 0; | ||
27 | virtual void getch(tchar&, CStyle&, unsigned long&) = 0; | 28 | virtual void getch(tchar&, CStyle&, unsigned long&) = 0; |
28 | virtual linkType hyperlink(unsigned int n, unsigned int noff, QString&, QString& nm) = 0; | 29 | virtual linkType hyperlink(unsigned int n, unsigned int noff, QString&, QString& nm) = 0; |
29 | virtual void locate(unsigned int n) = 0; | 30 | virtual void locate(unsigned int n) = 0; |
30 | virtual bool findanchor(const QString& nm) = 0; | 31 | virtual bool findanchor(const QString& nm) = 0; |
31 | virtual void saveposn(const QString& f, size_t posn) = 0; | 32 | virtual void saveposn(const QString& f, size_t posn) = 0; |
32 | virtual void writeposn(const QString& f, size_t posn) = 0; | 33 | virtual void writeposn(const QString& f, size_t posn) = 0; |
33 | virtual linkType forward(QString& f, size_t& loc) = 0; | 34 | virtual linkType forward(QString& f, size_t& loc) = 0; |
34 | virtual linkType back(QString& f, size_t& loc) = 0; | 35 | virtual linkType back(QString& f, size_t& loc) = 0; |
35 | virtual bool hasnavigation() = 0; | 36 | virtual bool hasnavigation() = 0; |
36 | virtual int getwidth() = 0; | 37 | virtual int getwidth() = 0; |
37 | virtual QImage* getPicture(unsigned long) = 0; | 38 | virtual QImage* getPicture(unsigned long) = 0; |
38 | virtual QImage* getPicture(const QString& href) = 0; | 39 | virtual QImage* getPicture(const QString& href) = 0; |
39 | virtual bool getFile(const QString& href) = 0; | 40 | virtual bool getFile(const QString& href, const QString& nm) = 0; |
40 | virtual QString about() = 0; | 41 | virtual QString about() = 0; |
42 | virtual unsigned long startSection() = 0; | ||
41 | }; | 43 | }; |
42 | 44 | ||
43 | class CExpander_Interface | 45 | class CExpander_Interface |
44 | { | 46 | { |
45 | public: | 47 | public: |
46 | #ifdef USEQPE | 48 | #ifdef USEQPE |
47 | virtual void suspend() = 0; | 49 | virtual void suspend() = 0; |
48 | virtual void unsuspend() = 0; | 50 | virtual void unsuspend() = 0; |
49 | #endif | 51 | #endif |
50 | virtual QString about() = 0; | 52 | virtual QString about() = 0; |
51 | virtual size_t getHome() = 0; | 53 | virtual size_t getHome() = 0; |
52 | //CExpander_Interface(); | 54 | //CExpander_Interface(); |
53 | //virtual ~CExpander_Interface(); | 55 | //virtual ~CExpander_Interface(); |
54 | virtual int openfile(const char *src) = 0; | 56 | virtual int openfile(const char *src) = 0; |
55 | //virtual int OpenFile(const char *src) = 0; | 57 | //virtual int OpenFile(const char *src) = 0; |
56 | virtual unsigned int locate() = 0; | 58 | virtual unsigned int locate() = 0; |
57 | virtual void locate(unsigned int n) = 0; | 59 | virtual void locate(unsigned int n) = 0; |
58 | virtual bool hasrandomaccess() = 0; | 60 | virtual bool hasrandomaccess() = 0; |
59 | virtual void sizes(unsigned long& file, unsigned long& text) = 0; | 61 | virtual void sizes(unsigned long& file, unsigned long& text) = 0; |
60 | virtual CList<Bkmk>* getbkmklist() { return NULL; } | 62 | virtual CList<Bkmk>* getbkmklist() { return NULL; } |
61 | virtual void getch(tchar& ch, CStyle& sty, unsigned long& pos) = 0; | 63 | virtual void getch(tchar& ch, CStyle& sty, unsigned long& pos) = 0; |
62 | virtual int getch() = 0; | 64 | virtual int getch() = 0; |
63 | virtual linkType hyperlink(unsigned int n, unsigned int noff, QString& wrd, QString& nm) = 0; | 65 | virtual linkType hyperlink(unsigned int n, unsigned int noff, QString& wrd, QString& nm) = 0; |
64 | virtual MarkupType PreferredMarkup() = 0; | 66 | virtual MarkupType PreferredMarkup() = 0; |
65 | virtual void saveposn(size_t posn) {} | 67 | virtual void saveposn(size_t posn) {} |
66 | virtual void writeposn(size_t posn) {} | 68 | virtual void writeposn(size_t posn) {} |
67 | virtual linkType forward(size_t& loc) { return eNone; } | 69 | virtual linkType forward(size_t& loc) { return eNone; } |
68 | virtual linkType back(size_t& loc) { return eNone; } | 70 | virtual linkType back(size_t& loc) { return eNone; } |
69 | virtual bool hasnavigation() { return false; } | 71 | virtual bool hasnavigation() { return false; } |
70 | virtual unsigned long startSection() = 0; | 72 | virtual unsigned long startSection() = 0; |
71 | virtual unsigned long endSection() = 0; | 73 | virtual unsigned long endSection() = 0; |
72 | virtual void start2endSection() = 0; | 74 | virtual void start2endSection() = 0; |
73 | virtual QImage* getPicture(unsigned long tgt) { return NULL; } | 75 | virtual QImage* getPicture(unsigned long tgt) { return NULL; } |
74 | virtual void setContinuous(bool _b) = 0; | 76 | virtual void setContinuous(bool _b) = 0; |
75 | #ifdef USEQPE | 77 | #ifdef USEQPE |
76 | virtual void suspend(FILE*& fin) = 0; | 78 | virtual void suspend(FILE*& fin) = 0; |
77 | virtual void unsuspend(FILE*& fin) = 0; | 79 | virtual void unsuspend(FILE*& fin) = 0; |
78 | #endif | 80 | #endif |
79 | virtual void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) = 0; | 81 | virtual void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) = 0; |
80 | virtual void putSaveData(unsigned char*& src, unsigned short& srclen) = 0; | 82 | virtual void putSaveData(unsigned char*& src, unsigned short& srclen) = 0; |
81 | virtual void setwidth(int w) = 0; | 83 | virtual void setwidth(int w) = 0; |
82 | // bool findstring(const QString& info); | 84 | // bool findstring(const QString& info); |
83 | // int getpara(CBuffer& buff); | 85 | // int getpara(CBuffer& buff); |
84 | virtual int getwidth() = 0; | 86 | virtual int getwidth() = 0; |
85 | virtual QImage* getPicture(const QString& href) = 0; | 87 | virtual QImage* getPicture(const QString& href) = 0; |
86 | virtual bool getFile(const QString& href) = 0; | 88 | virtual bool getFile(const QString& href, const QString& nm) = 0; |
89 | virtual bool findanchor(const QString& nm) = 0; | ||
90 | virtual QString getTableAsHtml(unsigned long loc) { return QString(""); } | ||
87 | }; | 91 | }; |
88 | 92 | ||
89 | class CExpander : public CExpander_Interface | 93 | class CExpander : public CExpander_Interface |
90 | { | 94 | { |
91 | protected: | 95 | protected: |
92 | size_t m_homepos; | 96 | size_t m_homepos; |
93 | bool m_continuous; | 97 | bool m_continuous; |
94 | char* fname; | 98 | char* fname; |
95 | bool bSuspended; | 99 | bool bSuspended; |
96 | size_t suspos; | 100 | size_t suspos; |
97 | time_t sustime; | 101 | time_t sustime; |
98 | int m_scrWidth; | 102 | int m_scrWidth; |
99 | unsigned long m_currentstart, m_currentend; | 103 | unsigned long m_currentstart, m_currentend; |
100 | public: | 104 | public: |
101 | #ifdef USEQPE | 105 | #ifdef USEQPE |
102 | virtual void suspend() = 0; | 106 | virtual void suspend() = 0; |
103 | virtual void unsuspend() = 0; | 107 | virtual void unsuspend() = 0; |
104 | #endif | 108 | #endif |
105 | size_t getHome(); | 109 | size_t getHome(); |
106 | CExpander(); | 110 | CExpander(); |
107 | virtual ~CExpander(); | 111 | virtual ~CExpander(); |
108 | int openfile(const char *src); | 112 | int openfile(const char *src); |
109 | virtual int OpenFile(const char *src) = 0; | 113 | virtual int OpenFile(const char *src) = 0; |
110 | virtual unsigned int locate() = 0; | 114 | virtual unsigned int locate() = 0; |
111 | virtual void locate(unsigned int n) = 0; | 115 | virtual void locate(unsigned int n) = 0; |
112 | virtual bool hasrandomaccess() = 0; | 116 | virtual bool hasrandomaccess() = 0; |
113 | virtual void sizes(unsigned long& file, unsigned long& text) = 0; | 117 | virtual void sizes(unsigned long& file, unsigned long& text) = 0; |
114 | virtual CList<Bkmk>* getbkmklist() { return NULL; } | 118 | virtual CList<Bkmk>* getbkmklist() { return NULL; } |
115 | virtual void getch(tchar& ch, CStyle& sty, unsigned long& pos); | 119 | virtual void getch(tchar& ch, CStyle& sty, unsigned long& pos); |
116 | virtual int getch() = 0; | 120 | virtual int getch() = 0; |
117 | virtual linkType hyperlink(unsigned int n, unsigned int noff, QString& wrd, QString& nm); | 121 | virtual linkType hyperlink(unsigned int n, unsigned int noff, QString& wrd, QString& nm); |
118 | virtual MarkupType PreferredMarkup() = 0; | 122 | virtual MarkupType PreferredMarkup() = 0; |
119 | virtual void saveposn(size_t posn) {} | 123 | virtual void saveposn(size_t posn) {} |
120 | virtual void writeposn(size_t posn) {} | 124 | virtual void writeposn(size_t posn) {} |
121 | virtual linkType forward(size_t& loc) { return eNone; } | 125 | virtual linkType forward(size_t& loc) { return eNone; } |
122 | virtual linkType back(size_t& loc) { return eNone; } | 126 | virtual linkType back(size_t& loc) { return eNone; } |
123 | virtual bool hasnavigation() { return false; } | 127 | virtual bool hasnavigation() { return false; } |
124 | unsigned long startSection(); | 128 | unsigned long startSection(); |
125 | unsigned long endSection(); | 129 | unsigned long endSection(); |
126 | virtual void start2endSection(); | 130 | virtual void start2endSection(); |
127 | virtual QImage* getPicture(unsigned long tgt) { return NULL; } | 131 | virtual QImage* getPicture(unsigned long tgt) { return NULL; } |
128 | void setContinuous(bool _b) { m_continuous = _b; } | 132 | void setContinuous(bool _b) { m_continuous = _b; } |
129 | #ifdef USEQPE | 133 | #ifdef USEQPE |
130 | virtual void suspend(FILE*& fin); | 134 | virtual void suspend(FILE*& fin); |
131 | virtual void unsuspend(FILE*& fin); | 135 | virtual void unsuspend(FILE*& fin); |
132 | #endif | 136 | #endif |
133 | virtual void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen); | 137 | virtual void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen); |
134 | virtual void putSaveData(unsigned char*& src, unsigned short& srclen); | 138 | virtual void putSaveData(unsigned char*& src, unsigned short& srclen); |
135 | void setwidth(int w) | 139 | void setwidth(int w) |
136 | { | 140 | { |
137 | m_scrWidth = w; | 141 | m_scrWidth = w; |
138 | } | 142 | } |
139 | int getwidth() | 143 | int getwidth() |
140 | { | 144 | { |
141 | return m_scrWidth; | 145 | return m_scrWidth; |
142 | } | 146 | } |
143 | // bool findstring(const QString& info); | 147 | // bool findstring(const QString& info); |
144 | // int getpara(CBuffer& buff); | 148 | // int getpara(CBuffer& buff); |
145 | virtual QImage* getPicture(const QString& href) { return NULL; } | 149 | virtual QImage* getPicture(const QString& href) { return NULL; } |
146 | virtual bool getFile(const QString& href) { return false; } | 150 | virtual bool getFile(const QString& href, const QString& nm) { return false; } |
151 | virtual bool findanchor(const QString& nm) | ||
152 | { | ||
153 | return false; | ||
154 | } | ||
147 | }; | 155 | }; |
148 | #endif | 156 | #endif |