Diffstat (limited to 'noncore/apps/opie-reader/plucker.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/plucker.cpp | 98 |
1 files changed, 89 insertions, 9 deletions
diff --git a/noncore/apps/opie-reader/plucker.cpp b/noncore/apps/opie-reader/plucker.cpp index a8e688f..d1ccd6f 100644 --- a/noncore/apps/opie-reader/plucker.cpp +++ b/noncore/apps/opie-reader/plucker.cpp | |||
@@ -1,3 +1,6 @@ | |||
1 | #include "useqpe.h" | ||
1 | #include <stdio.h> | 2 | #include <stdio.h> |
2 | #include <string.h> | 3 | #include <string.h> |
4 | #include <qmessagebox.h> | ||
5 | #include <qpixmap.h> | ||
3 | #ifdef USEQPE | 6 | #ifdef USEQPE |
@@ -14,5 +17,8 @@ | |||
14 | #endif | 17 | #endif |
18 | #include <qclipboard.h> | ||
15 | 19 | ||
16 | #include "plucker.h" | 20 | #include "plucker.h" |
21 | #include "Aportis.h" | ||
17 | #include "Palm2QImage.h" | 22 | #include "Palm2QImage.h" |
23 | #include "static.h" | ||
18 | 24 | ||
@@ -45,3 +51,5 @@ void CPlucker::GetHeader(UInt16& uid, UInt16& nParagraphs, UInt32& size, UInt8& | |||
45 | CPlucker::CPlucker() | 51 | CPlucker::CPlucker() |
46 | { /*printf("constructing:%x\n",fin);*/ } | 52 | { /*printf("constructing:%x\n",fin);*/ |
53 | EOPPhase = 0; | ||
54 | } | ||
47 | 55 | ||
@@ -57,6 +65,14 @@ int CPlucker::bgetch() | |||
57 | { | 65 | { |
66 | if (isEndOfSection(bufferrec)) | ||
67 | { | ||
58 | if (!m_continuous) return EOF; | 68 | if (!m_continuous) return EOF; |
59 | if (bufferrec >= ntohs(head.recordList.numRecords) - 1) return EOF; | 69 | } |
60 | ////odebug << "Passing through " << currentpos << "" << oendl; | 70 | if (bufferrec >= ntohs(head.recordList.numRecords) - 1) |
61 | if (!expand(bufferrec+1)) return EOF; | 71 | { |
72 | return EOF; | ||
73 | } | ||
74 | if (!expand(bufferrec+1)) | ||
75 | { | ||
76 | return EOF; | ||
77 | } | ||
62 | mystyle.unset(); | 78 | mystyle.unset(); |
@@ -66,3 +82,3 @@ int CPlucker::bgetch() | |||
66 | { | 82 | { |
67 | // odebug << "Skipping extraspace:" << m_ParaAttrs[m_nextParaIndex]&7 << "" << oendl; | 83 | // qDebug("Skipping extraspace:%d", m_ParaAttrs[m_nextParaIndex]&7); |
68 | m_nextParaIndex++; | 84 | m_nextParaIndex++; |
@@ -71,5 +87,5 @@ int CPlucker::bgetch() | |||
71 | mystyle.setExtraSpace((m_ParaAttrs[m_nextParaIndex]&7)*2); | 87 | mystyle.setExtraSpace((m_ParaAttrs[m_nextParaIndex]&7)*2); |
72 | //odebug << "Using extraspace:" << m_ParaAttrs[m_nextParaIndex]&7 << "" << oendl; | 88 | //qDebug("Using extraspace:%d", m_ParaAttrs[m_nextParaIndex]&7); |
73 | ch = 10; | 89 | ch = 10; |
74 | EOPPhase = 4; | 90 | if (m_continuous) EOPPhase = 4; |
75 | } | 91 | } |
@@ -81,3 +97,3 @@ int CPlucker::bgetch() | |||
81 | m_nextParaIndex++; | 97 | m_nextParaIndex++; |
82 | // odebug << "Skipping extraspace:" << m_ParaAttrs[m_nextParaIndex]&7 << "" << oendl; | 98 | // qDebug("Skipping extraspace:%d", m_ParaAttrs[m_nextParaIndex]&7); |
83 | if (m_nextParaIndex == m_nParas) | 99 | if (m_nextParaIndex == m_nParas) |
@@ -93,3 +109,3 @@ int CPlucker::bgetch() | |||
93 | mystyle.setExtraSpace((m_ParaAttrs[m_nextParaIndex]&7)*2); | 109 | mystyle.setExtraSpace((m_ParaAttrs[m_nextParaIndex]&7)*2); |
94 | //odebug << "Using extraspace:" << m_ParaAttrs[m_nextParaIndex]&7 << "" << oendl; | 110 | //qDebug("Using extraspace:%d", m_ParaAttrs[m_nextParaIndex]&7); |
95 | if (m_lastBreak == locate()) | 111 | if (m_lastBreak == locate()) |
@@ -151 +167,65 @@ QImage* CPlucker::imagefromdata(UInt8* imgbuffer, UInt32 imgsize) | |||
151 | } | 167 | } |
168 | |||
169 | void CPlucker::start2endSection() // to plucker base | ||
170 | { | ||
171 | m_currentstart = NEFstartSection(); | ||
172 | m_currentend = NEFendSection(); | ||
173 | } | ||
174 | |||
175 | unsigned long CPlucker::NEFstartSection() // virtual in plucker base - differs only in obsoleted nef so move implementation | ||
176 | { | ||
177 | //inefficient - Should calc start/end of section on entry to section? | ||
178 | UInt16 thishdr_uid, thishdr_nParagraphs; | ||
179 | UInt32 thishdr_size; | ||
180 | UInt8 thishdr_type, thishdr_reserved; | ||
181 | unsigned long textlength = currentpos-bufferpos; | ||
182 | for (UInt16 recptr = bufferrec-1; recptr >= 1; recptr--) | ||
183 | { | ||
184 | gotorecordnumber(recptr); | ||
185 | //qDebug("recptr:%u", recptr); | ||
186 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | ||
187 | if (thishdr_type < 2) | ||
188 | { | ||
189 | if ((thishdr_reserved && continuation_bit) == 0) break; | ||
190 | textlength -= thishdr_size; | ||
191 | //qDebug("Textlength:%u, reserved:%u, recptr:%u", textlength, thishdr_reserved, recptr); | ||
192 | } | ||
193 | } | ||
194 | return textlength; | ||
195 | } | ||
196 | |||
197 | unsigned long CPlucker::NEFendSection() // virtual in plucker base - differs only in obsoleted nef so move implementation | ||
198 | { | ||
199 | //inefficient - Should calc start/end of section on entry to section? | ||
200 | unsigned long textlength = currentpos-bufferpos+buffercontent; | ||
201 | gotorecordnumber(bufferrec); | ||
202 | UInt16 thishdr_uid, thishdr_nParagraphs; | ||
203 | UInt32 thishdr_size; | ||
204 | UInt8 thishdr_type, thishdr_reserved; | ||
205 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | ||
206 | if ((thishdr_reserved && continuation_bit) != 0) | ||
207 | { | ||
208 | for (UInt16 recptr = bufferrec+1; recptr < ntohs(head.recordList.numRecords); recptr++) | ||
209 | { | ||
210 | gotorecordnumber(recptr); | ||
211 | UInt16 thishdr_uid, thishdr_nParagraphs; | ||
212 | UInt32 thishdr_size; | ||
213 | UInt8 thishdr_type, thishdr_reserved; | ||
214 | GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); | ||
215 | //qDebug("recptr %u bufferrec %u type %u m_reserved %u", recptr, bufferrec, typ | ||
216 | if (thishdr_type < 2) | ||
217 | { | ||
218 | textlength += thishdr_size; | ||
219 | if ((thishdr_reserved && continuation_bit) == 0) break; | ||
220 | } | ||
221 | } | ||
222 | } | ||
223 | return textlength; | ||
224 | } | ||
225 | |||
226 | #ifndef __STATIC | ||
227 | extern "C" | ||
228 | { | ||
229 | CExpander* newcodec() { return new CPlucker; } | ||
230 | } | ||
231 | #endif | ||