Diffstat (limited to 'noncore/apps/opie-reader/plucker_base.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/plucker_base.h | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/noncore/apps/opie-reader/plucker_base.h b/noncore/apps/opie-reader/plucker_base.h new file mode 100644 index 0000000..131b999 --- a/dev/null +++ b/noncore/apps/opie-reader/plucker_base.h | |||
@@ -0,0 +1,119 @@ | |||
1 | #ifndef __PLUCKER_BASE_H | ||
2 | #define __PLUCKER_BASE_H | ||
3 | |||
4 | #include "useqpe.h" | ||
5 | #include "CExpander.h" | ||
6 | #include <zlib.h> | ||
7 | #include "ztxt.h" | ||
8 | #include "pdb.h" | ||
9 | #include "CBuffer.h" | ||
10 | #include "my_list.h" | ||
11 | #include "Navigation.h" | ||
12 | |||
13 | struct CPlucker_record0 | ||
14 | { | ||
15 | UInt16 uid; | ||
16 | UInt16 version; | ||
17 | UInt16 nRecords; | ||
18 | }; | ||
19 | |||
20 | struct CPluckerbkmk | ||
21 | { | ||
22 | UInt32 offset; | ||
23 | tchar title[MAX_BMRK_LENGTH]; | ||
24 | }; | ||
25 | |||
26 | #ifdef LOCALPICTURES | ||
27 | class QScrollView; | ||
28 | class QWidget; | ||
29 | #endif | ||
30 | |||
31 | class CPlucker_base : public CExpander, public Cpdb | ||
32 | { | ||
33 | protected: | ||
34 | virtual void setbuffersize() = 0; | ||
35 | virtual void GetHeader(UInt16&, UInt16&, UInt32&, UInt8&, UInt8&) = 0; | ||
36 | virtual int HeaderSize() = 0; | ||
37 | unsigned short finduid(unsigned short); | ||
38 | char* geturl(UInt16); | ||
39 | void Expand(UInt32, UInt8, UInt8*, UInt32); | ||
40 | CList<unsigned long> visited; | ||
41 | bool m_lastIsBreak; | ||
42 | #ifdef LOCALPICTURES | ||
43 | QScrollView* m_viewer; | ||
44 | QWidget* m_picture; | ||
45 | #endif | ||
46 | size_t textlength, m_lastBreak; | ||
47 | UInt16 uid; | ||
48 | int m_nextPara, m_nextParaIndex; | ||
49 | CBufferFace<UInt16> m_ParaOffsets; | ||
50 | CBufferFace<UInt16> m_ParaAttrs; | ||
51 | UInt16 m_nParas; | ||
52 | CStyle mystyle; | ||
53 | // bool bInit; | ||
54 | UInt32 buffersize; | ||
55 | UInt32 compressedbuffersize; | ||
56 | UInt32 buffercontent; | ||
57 | UInt8* expandedtextbuffer; | ||
58 | UInt8* compressedtextbuffer; | ||
59 | // char* urls; | ||
60 | // size_t urlsize; | ||
61 | size_t bufferpos; | ||
62 | UInt16 bufferrec; | ||
63 | CPlucker_record0 hdr0; | ||
64 | bool m_bufferisreserved; | ||
65 | size_t currentpos; | ||
66 | bool expand(int); | ||
67 | void UnZip(UInt8*, size_t, UInt8*, size_t); | ||
68 | void UnDoc(UInt8*, size_t, UInt8*, size_t); | ||
69 | #ifdef LOCALPICTURES | ||
70 | void showimg(UInt16 tgt); | ||
71 | #endif | ||
72 | QImage* getimg(UInt16 tgt); | ||
73 | QImage* expandimg(UInt16 tgt, bool border=false); | ||
74 | void home(); | ||
75 | virtual int bgetch() = 0; | ||
76 | CNavigation m_nav; | ||
77 | public: | ||
78 | #ifdef USEQPE | ||
79 | void suspend() | ||
80 | { | ||
81 | CExpander::suspend(fin); | ||
82 | } | ||
83 | void unsuspend() | ||
84 | { | ||
85 | CExpander::unsuspend(fin); | ||
86 | } | ||
87 | #endif | ||
88 | QImage* getPicture(unsigned long tgt); | ||
89 | void sizes(unsigned long& _file, unsigned long& _text); | ||
90 | bool hasrandomaccess() { return true; } | ||
91 | virtual ~CPlucker_base(); | ||
92 | CPlucker_base(); | ||
93 | int OpenFile(const char *src); | ||
94 | virtual tchar getch(bool) = 0; | ||
95 | tchar getch_base(bool); | ||
96 | int getch(); | ||
97 | void getch(tchar&, CStyle&); | ||
98 | unsigned int locate(); | ||
99 | void locate(unsigned int n); | ||
100 | CList<Bkmk>* getbkmklist(); | ||
101 | linkType hyperlink(unsigned int n, QString&); | ||
102 | MarkupType PreferredMarkup() | ||
103 | { | ||
104 | return cNONE; | ||
105 | } | ||
106 | void saveposn(size_t posn) { m_nav.saveposn(posn); } | ||
107 | void writeposn(size_t posn) { m_nav.writeposn(posn); } | ||
108 | bool forward(size_t& loc) { return m_nav.forward(loc); } | ||
109 | bool back(size_t& loc) { return m_nav.back(loc); } | ||
110 | bool hasnavigation() { return true; } | ||
111 | void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen); | ||
112 | void putSaveData(unsigned char*& src, unsigned short& srclen); | ||
113 | |||
114 | virtual bool CorrectDecoder() = 0; | ||
115 | // virtual void setlink(QString&, const QString&) = 0; | ||
116 | virtual QImage* imagefromdata(UInt8*, UInt32) = 0; | ||
117 | }; | ||
118 | |||
119 | #endif | ||