summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/BuffDoc.h
Unidiff
Diffstat (limited to 'noncore/apps/opie-reader/BuffDoc.h') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-reader/BuffDoc.h58
1 files changed, 40 insertions, 18 deletions
diff --git a/noncore/apps/opie-reader/BuffDoc.h b/noncore/apps/opie-reader/BuffDoc.h
index 61531c0..a7dd7bf 100644
--- a/noncore/apps/opie-reader/BuffDoc.h
+++ b/noncore/apps/opie-reader/BuffDoc.h
@@ -2,12 +2,9 @@
2#define __BuffDoc_h 2#define __BuffDoc_h
3 3
4#include "useqpe.h" 4#include "useqpe.h"
5#include "ZText.h"
6#include "Aportis.h"
7#include "ztxt.h"
8#include "ppm_expander.h"
9#include "CDrawBuffer.h" 5#include "CDrawBuffer.h"
10#include "CFilter.h" 6#include "CFilter.h"
7#include "CExpander.h"
11#include <qfontmetrics.h> 8#include <qfontmetrics.h>
12#include <qmessagebox.h> 9#include <qmessagebox.h>
13 10
@@ -17,9 +14,19 @@ class BuffDoc
17 CSizeBuffer lastsizes, allsizes; 14 CSizeBuffer lastsizes, allsizes;
18 size_t laststartline; 15 size_t laststartline;
19 bool lastispara; 16 bool lastispara;
20 CExpander* exp; 17 CExpander_Interface* exp;
21 CFilterChain* filt; 18 CFilterChain* filt;
19 int m_hyphenthreshold;
20 // bool m_customhyphen;
22 public: 21 public:
22 QString about();
23 bool findanchor(const QString& nm)
24 {
25 return filt->findanchor(nm);
26 }
27 // void setCustomHyphen(bool _v) { m_customhyphen = _v; }
28 // bool getCustomHyphen() { return m_customhyphen; }
29 void setHyphenThreshold(int _v) { m_hyphenthreshold = _v; }
23 void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) 30 void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen)
24 { 31 {
25 if (exp == NULL) 32 if (exp == NULL)
@@ -56,7 +63,7 @@ class BuffDoc
56 exp = NULL; 63 exp = NULL;
57 filt = NULL; 64 filt = NULL;
58 lastword.empty(); 65 lastword.empty();
59 // odebug << "Buffdoc created" << oendl; 66 // // qDebug("Buffdoc created");
60 } 67 }
61 bool empty() { return (exp == NULL); } 68 bool empty() { return (exp == NULL); }
62 void setfilter(CFilterChain* _f) 69 void setfilter(CFilterChain* _f)
@@ -75,15 +82,16 @@ class BuffDoc
75 CStyle sty; 82 CStyle sty;
76 if (exp != NULL) 83 if (exp != NULL)
77 { 84 {
78 filt->getch(ch, sty); 85 unsigned long dummy;
86 filt->getch(ch, sty, dummy);
79 } 87 }
80 return ch; 88 return ch;
81 } 89 }
82 void getch(tchar& ch, CStyle& sty) 90 void getch(tchar& ch, CStyle& sty, unsigned long& pos)
83 { 91 {
84 if (exp != NULL) 92 if (exp != NULL)
85 { 93 {
86 filt->getch(ch, sty); 94 filt->getch(ch, sty, pos);
87 } 95 }
88 else 96 else
89 ch = UEOF; 97 ch = UEOF;
@@ -96,12 +104,22 @@ class BuffDoc
96 unsigned int explocate() { return (exp == NULL) ? 0 : exp->locate(); } 104 unsigned int explocate() { return (exp == NULL) ? 0 : exp->locate(); }
97 void setContinuous(bool _b) { if (exp != NULL) exp->setContinuous(_b); } 105 void setContinuous(bool _b) { if (exp != NULL) exp->setContinuous(_b); }
98 MarkupType PreferredMarkup() { return (exp == NULL) ? cTEXT : exp->PreferredMarkup(); } 106 MarkupType PreferredMarkup() { return (exp == NULL) ? cTEXT : exp->PreferredMarkup(); }
99 linkType hyperlink(unsigned int n, QString& wrd); 107 linkType hyperlink(unsigned int n, unsigned int noff, QString& wrd, QString& nm);
100 size_t getHome() { return ((exp != NULL) ? exp->getHome() : 0); } 108 size_t getHome() { return ((exp != NULL) ? exp->getHome() : 0); }
101 void locate(unsigned int n); 109 void locate(unsigned int n);
102 bool getline(CDrawBuffer* buff, int w, unsigned char _border); 110 bool getline(CDrawBuffer* buff, int w, unsigned short _lborder, unsigned short _rborder, bool hyphenate, int availht);
103 bool getline(CDrawBuffer* buff, int w, int cw, unsigned char _border); 111 bool getline(CDrawBuffer* buff, int w, int cw, unsigned short _lborder, unsigned short _rborder, int availht);
104 void sizes(unsigned long& fs, unsigned long& ts) { exp->sizes(fs,ts); } 112 void sizes(unsigned long& fs, unsigned long& ts)
113 {
114 if (exp != NULL)
115 {
116 exp->sizes(fs,ts);
117 }
118 else
119 {
120 fs = ts = 0;
121 }
122 }
105 int getpara(CBuffer& buff) 123 int getpara(CBuffer& buff)
106 { 124 {
107 tchar ch; 125 tchar ch;
@@ -112,11 +130,15 @@ class BuffDoc
112 laststartline = exp->locate(); 130 laststartline = exp->locate();
113 return i; 131 return i;
114 } 132 }
115 void saveposn(size_t posn) { exp->saveposn(posn); } 133 void saveposn(const QString& f, size_t posn) { filt->saveposn(f, posn); }
116 void writeposn(size_t posn) { exp->writeposn(posn); } 134 void writeposn(const QString& f, size_t posn) { filt->writeposn(f, posn); }
117 bool forward(size_t& loc) { return exp->forward(loc); } 135 linkType forward(QString& f, size_t& loc) { return filt->forward(f, loc); }
118 bool back(size_t& loc) { return exp->back(loc); } 136 linkType back(QString& f, size_t& loc) { return filt->back(f, loc); }
119 bool hasnavigation() { return exp->hasnavigation(); } 137 bool hasnavigation() { return filt->hasnavigation(); }
138 bool getFile(QString href)
139 {
140 return (exp == NULL) ? false : exp->getFile(href);
141 }
120}; 142};
121 143
122#endif 144#endif