author | pohly <pohly> | 2004-08-24 20:52:45 (UTC) |
---|---|---|
committer | pohly <pohly> | 2004-08-24 20:52:45 (UTC) |
commit | 73253e93327cf4ef0932de1b4afb56af22a0f37e (patch) (side-by-side diff) | |
tree | 1c9a7a6dd3341e036a894d348a3372525d29acec /noncore/apps/opie-reader/plucker.cpp | |
parent | e90847c784c48bd21bf8768cb38edb853b832697 (diff) | |
download | opie-73253e93327cf4ef0932de1b4afb56af22a0f37e.zip opie-73253e93327cf4ef0932de1b4afb56af22a0f37e.tar.gz opie-73253e93327cf4ef0932de1b4afb56af22a0f37e.tar.bz2 |
updated source to opie-reader 0.7g
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,4 +1,7 @@ +#include "useqpe.h" #include <stdio.h> #include <string.h> +#include <qmessagebox.h> +#include <qpixmap.h> #ifdef USEQPE #include <qpe/qcopenvelope_qws.h> @@ -13,7 +16,10 @@ #include <qapplication.h> #endif +#include <qclipboard.h> #include "plucker.h" +#include "Aportis.h" #include "Palm2QImage.h" +#include "static.h" @@ -44,5 +50,7 @@ void CPlucker::GetHeader(UInt16& uid, UInt16& nParagraphs, UInt32& size, UInt8& CPlucker::CPlucker() - { /*printf("constructing:%x\n",fin);*/ } + { /*printf("constructing:%x\n",fin);*/ + EOPPhase = 0; + } bool CPlucker::CorrectDecoder() @@ -56,8 +64,16 @@ int CPlucker::bgetch() if (bufferpos >= buffercontent) { + if (isEndOfSection(bufferrec)) + { if (!m_continuous) return EOF; - if (bufferrec >= ntohs(head.recordList.numRecords) - 1) return EOF; -//// odebug << "Passing through " << currentpos << "" << oendl; - if (!expand(bufferrec+1)) return EOF; + } + if (bufferrec >= ntohs(head.recordList.numRecords) - 1) + { + return EOF; + } + if (!expand(bufferrec+1)) + { + return EOF; + } mystyle.unset(); if (m_ParaOffsets[m_nextParaIndex] == 0) @@ -65,12 +81,12 @@ int CPlucker::bgetch() while (m_ParaOffsets[m_nextParaIndex+1] == 0) { -// odebug << "Skipping extraspace:" << m_ParaAttrs[m_nextParaIndex]&7 << "" << oendl; +// qDebug("Skipping extraspace:%d", m_ParaAttrs[m_nextParaIndex]&7); m_nextParaIndex++; } } mystyle.setExtraSpace((m_ParaAttrs[m_nextParaIndex]&7)*2); -// odebug << "Using extraspace:" << m_ParaAttrs[m_nextParaIndex]&7 << "" << oendl; +// qDebug("Using extraspace:%d", m_ParaAttrs[m_nextParaIndex]&7); ch = 10; - EOPPhase = 4; + if (m_continuous) EOPPhase = 4; } else if (bufferpos == m_nextPara) @@ -80,5 +96,5 @@ int CPlucker::bgetch() UInt16 attr = m_ParaAttrs[m_nextParaIndex]; m_nextParaIndex++; -// odebug << "Skipping extraspace:" << m_ParaAttrs[m_nextParaIndex]&7 << "" << oendl; +// qDebug("Skipping extraspace:%d", m_ParaAttrs[m_nextParaIndex]&7); if (m_nextParaIndex == m_nParas) { @@ -92,5 +108,5 @@ int CPlucker::bgetch() mystyle.unset(); mystyle.setExtraSpace((m_ParaAttrs[m_nextParaIndex]&7)*2); -// odebug << "Using extraspace:" << m_ParaAttrs[m_nextParaIndex]&7 << "" << oendl; +// qDebug("Using extraspace:%d", m_ParaAttrs[m_nextParaIndex]&7); if (m_lastBreak == locate()) { @@ -150,2 +166,66 @@ QImage* CPlucker::imagefromdata(UInt8* imgbuffer, UInt32 imgsize) return qimage; } + +void CPlucker::start2endSection() // to plucker base +{ + m_currentstart = NEFstartSection(); + m_currentend = NEFendSection(); +} + +unsigned long CPlucker::NEFstartSection() // virtual in plucker base - differs only in obsoleted nef so move implementation +{ +//inefficient - Should calc start/end of section on entry to section? + UInt16 thishdr_uid, thishdr_nParagraphs; + UInt32 thishdr_size; + UInt8 thishdr_type, thishdr_reserved; + unsigned long textlength = currentpos-bufferpos; + for (UInt16 recptr = bufferrec-1; recptr >= 1; recptr--) + { + gotorecordnumber(recptr); + //qDebug("recptr:%u", recptr); + GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); + if (thishdr_type < 2) + { + if ((thishdr_reserved && continuation_bit) == 0) break; + textlength -= thishdr_size; + //qDebug("Textlength:%u, reserved:%u, recptr:%u", textlength, thishdr_reserved, recptr); + } + } + return textlength; +} + +unsigned long CPlucker::NEFendSection() // virtual in plucker base - differs only in obsoleted nef so move implementation +{ +//inefficient - Should calc start/end of section on entry to section? + unsigned long textlength = currentpos-bufferpos+buffercontent; + gotorecordnumber(bufferrec); + UInt16 thishdr_uid, thishdr_nParagraphs; + UInt32 thishdr_size; + UInt8 thishdr_type, thishdr_reserved; + GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); + if ((thishdr_reserved && continuation_bit) != 0) + { + for (UInt16 recptr = bufferrec+1; recptr < ntohs(head.recordList.numRecords); recptr++) + { + gotorecordnumber(recptr); + UInt16 thishdr_uid, thishdr_nParagraphs; + UInt32 thishdr_size; + UInt8 thishdr_type, thishdr_reserved; + GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); + // qDebug("recptr %u bufferrec %u type %u m_reserved %u", recptr, bufferrec, typ + if (thishdr_type < 2) + { + textlength += thishdr_size; + if ((thishdr_reserved && continuation_bit) == 0) break; + } + } + } + return textlength; +} + +#ifndef __STATIC +extern "C" +{ + CExpander* newcodec() { return new CPlucker; } +} +#endif |