diff options
Diffstat (limited to 'sw/source/filter/ww1/w1class.cxx')
-rw-r--r-- | sw/source/filter/ww1/w1class.cxx | 354 |
1 files changed, 177 insertions, 177 deletions
diff --git a/sw/source/filter/ww1/w1class.cxx b/sw/source/filter/ww1/w1class.cxx index 90f1b4dd80ef..9f7ddb08093c 100644 --- a/sw/source/filter/ww1/w1class.cxx +++ b/sw/source/filter/ww1/w1class.cxx @@ -59,13 +59,13 @@ Ww1Fib::Ww1Fib( SvStream& _rStream ) ///////////////////////////////////////////////////////////// PlainText -Ww1PlainText::Ww1PlainText(Ww1Fib& rWwFib, ULONG nFilePos, ULONG nCountBytes) +Ww1PlainText::Ww1PlainText(Ww1Fib& rWwFib, sal_uLong nFilePos, sal_uLong nCountBytes) : rFib(rWwFib), ulFilePos(nFilePos), ulCountBytes(nCountBytes), ulSeek(0), bOK(true) { } -sal_Unicode Ww1PlainText::operator [] ( ULONG ulOffset ) +sal_Unicode Ww1PlainText::operator [] ( sal_uLong ulOffset ) { DBG_ASSERT( ulOffset<Count(), "Ww1PlainText" ); sal_Unicode cRet; @@ -80,7 +80,7 @@ sal_Unicode Ww1PlainText::operator [] ( ULONG ulOffset ) return cRet; } -String Ww1PlainText::GetText( ULONG ulOffset, ULONG nLen ) const +String Ww1PlainText::GetText( sal_uLong ulOffset, sal_uLong nLen ) const { String sRet; ByteString aStr; @@ -102,7 +102,7 @@ Ww1Style::~Ww1Style() delete pPapx; } -void Ww1Style::SetDefaults(BYTE stc) +void Ww1Style::SetDefaults(sal_uInt8 stc) { if( 222 == stc ) { @@ -112,9 +112,9 @@ void Ww1Style::SetDefaults(BYTE stc) } } -USHORT Ww1Style::ReadName( BYTE*&p, USHORT& rnCountBytes, USHORT stc ) +sal_uInt16 Ww1Style::ReadName( sal_uInt8*&p, sal_uInt16& rnCountBytes, sal_uInt16 stc ) { - BYTE nCountBytes = SVBT8ToByte(p); + sal_uInt8 nCountBytes = SVBT8ToByte(p); p++; rnCountBytes--; if( !nCountBytes ) // default @@ -177,9 +177,9 @@ USHORT Ww1Style::ReadName( BYTE*&p, USHORT& rnCountBytes, USHORT stc ) return 0; } -USHORT Ww1Style::ReadChpx( BYTE*&p, USHORT& rnCountBytes ) +sal_uInt16 Ww1Style::ReadChpx( sal_uInt8*&p, sal_uInt16& rnCountBytes ) { - USHORT nCountBytes = SVBT8ToByte(p); + sal_uInt16 nCountBytes = SVBT8ToByte(p); p++; rnCountBytes--; if (nCountBytes != 255 // unused @@ -195,9 +195,9 @@ USHORT Ww1Style::ReadChpx( BYTE*&p, USHORT& rnCountBytes ) return 0; } -USHORT Ww1Style::ReadPapx(BYTE*&p, USHORT& rnCountBytes) +sal_uInt16 Ww1Style::ReadPapx(sal_uInt8*&p, sal_uInt16& rnCountBytes) { - USHORT nCountBytes = SVBT8ToByte(p); + sal_uInt16 nCountBytes = SVBT8ToByte(p); p++; rnCountBytes--; if (nCountBytes != 255) @@ -212,7 +212,7 @@ USHORT Ww1Style::ReadPapx(BYTE*&p, USHORT& rnCountBytes) return 0; } -USHORT Ww1Style::ReadEstcp(BYTE*&p, USHORT& rnCountBytes) +sal_uInt16 Ww1Style::ReadEstcp(sal_uInt8*&p, sal_uInt16& rnCountBytes) { stcNext = SVBT8ToByte(p); p++; @@ -228,22 +228,22 @@ USHORT Ww1Style::ReadEstcp(BYTE*&p, USHORT& rnCountBytes) Ww1StyleSheet::Ww1StyleSheet(Ww1Fib& _rFib) : cstcStd(0), rFib(_rFib), - bOK(FALSE) + bOK(sal_False) { - USHORT cbStshf = rFib.GetFIB().cbStshfGet(); + sal_uInt16 cbStshf = rFib.GetFIB().cbStshfGet(); DBG_ASSERT(cbStshf>=17, "Ww1StyleSheet"); - for (USHORT stc=0;stc<Count();stc++) + for (sal_uInt16 stc=0;stc<Count();stc++) { aStyles[stc].SetParent(this); - aStyles[stc].SetDefaults((BYTE)stc); + aStyles[stc].SetDefaults((sal_uInt8)stc); } - BYTE* del = NULL; + sal_uInt8* del = NULL; if (rFib.GetStream().Seek(rFib.GetFIB().fcStshfGet()) - == (ULONG)rFib.GetFIB().fcStshfGet() - && (del = new BYTE[cbStshf]) != NULL - && rFib.GetStream().Read(del, cbStshf) == (ULONG)cbStshf) + == (sal_uLong)rFib.GetFIB().fcStshfGet() + && (del = new sal_uInt8[cbStshf]) != NULL + && rFib.GetStream().Read(del, cbStshf) == (sal_uLong)cbStshf) { - BYTE* p = del; + sal_uInt8* p = del; cstcStd = SVBT16ToShort(p); p += sizeof(SVBT16); cbStshf -= sizeof(SVBT16); @@ -257,17 +257,17 @@ Ww1StyleSheet::Ww1StyleSheet(Ww1Fib& _rFib) delete [] del; } -USHORT Ww1StyleSheet::ReadNames( BYTE*& p, USHORT& rnCountBytes ) +sal_uInt16 Ww1StyleSheet::ReadNames( sal_uInt8*& p, sal_uInt16& rnCountBytes ) { - USHORT nCountBytes = SVBT16ToShort(p); + sal_uInt16 nCountBytes = SVBT16ToShort(p); p += sizeof(SVBT16); DBG_ASSERT(rnCountBytes>=nCountBytes, "Ww1StyleSheet"); rnCountBytes = rnCountBytes - nCountBytes; nCountBytes = nCountBytes - sizeof(SVBT16); - USHORT stcp = 0; + sal_uInt16 stcp = 0; while (nCountBytes > 0) { - USHORT stc = (stcp - cstcStd) & 255; + sal_uInt16 stc = (stcp - cstcStd) & 255; aStyles[stc].ReadName(p, nCountBytes, stc); stcp++; } @@ -275,17 +275,17 @@ USHORT Ww1StyleSheet::ReadNames( BYTE*& p, USHORT& rnCountBytes ) return 0; } -USHORT Ww1StyleSheet::ReadChpx(BYTE*& p, USHORT& rnCountBytes) +sal_uInt16 Ww1StyleSheet::ReadChpx(sal_uInt8*& p, sal_uInt16& rnCountBytes) { - USHORT nCountBytes = SVBT16ToShort(p); + sal_uInt16 nCountBytes = SVBT16ToShort(p); p += sizeof(SVBT16); DBG_ASSERT(rnCountBytes>=nCountBytes, "Ww1StyleSheet"); rnCountBytes = rnCountBytes - nCountBytes; nCountBytes = nCountBytes - sizeof(SVBT16); - USHORT stcp = 0; + sal_uInt16 stcp = 0; while (nCountBytes > 0) { - USHORT stc = (stcp - cstcStd) & 255; + sal_uInt16 stc = (stcp - cstcStd) & 255; aStyles[stc].ReadChpx(p, nCountBytes); stcp++; } @@ -293,17 +293,17 @@ USHORT Ww1StyleSheet::ReadChpx(BYTE*& p, USHORT& rnCountBytes) return 0; } -USHORT Ww1StyleSheet::ReadPapx(BYTE*& p, USHORT& rnCountBytes) +sal_uInt16 Ww1StyleSheet::ReadPapx(sal_uInt8*& p, sal_uInt16& rnCountBytes) { - USHORT nCountBytes = SVBT16ToShort(p); + sal_uInt16 nCountBytes = SVBT16ToShort(p); p += sizeof(SVBT16); DBG_ASSERT(rnCountBytes>=nCountBytes, "Ww1StyleSheet"); rnCountBytes = rnCountBytes - nCountBytes; nCountBytes = nCountBytes - sizeof(SVBT16); - USHORT stcp = 0; + sal_uInt16 stcp = 0; while (nCountBytes > 0) { - USHORT stc = (stcp - cstcStd) & 255; + sal_uInt16 stc = (stcp - cstcStd) & 255; aStyles[stc].ReadPapx(p, nCountBytes); stcp++; } @@ -311,15 +311,15 @@ USHORT Ww1StyleSheet::ReadPapx(BYTE*& p, USHORT& rnCountBytes) return 0; } -USHORT Ww1StyleSheet::ReadEstcp(BYTE*& p, USHORT& rnCountBytes) +sal_uInt16 Ww1StyleSheet::ReadEstcp(sal_uInt8*& p, sal_uInt16& rnCountBytes) { - USHORT iMac = SVBT16ToShort(p); + sal_uInt16 iMac = SVBT16ToShort(p); p += sizeof(SVBT16); DBG_ASSERT(rnCountBytes>=sizeof(SVBT16), "Ww1StyleSheet"); rnCountBytes -= sizeof(SVBT16); - for (USHORT stcp=0;stcp<iMac;stcp++) + for (sal_uInt16 stcp=0;stcp<iMac;stcp++) { - USHORT stc = (stcp - cstcStd) & 255; + sal_uInt16 stc = (stcp - cstcStd) & 255; aStyles[stc].ReadEstcp(p, rnCountBytes); } DBG_ASSERT(rnCountBytes==0, "Ww1StyleSheet"); @@ -328,7 +328,7 @@ USHORT Ww1StyleSheet::ReadEstcp(BYTE*& p, USHORT& rnCountBytes) ///////////////////////////////////////////////////////////////// Fonts -Ww1Fonts::Ww1Fonts(Ww1Fib& rInFib, ULONG nFieldFlgs) +Ww1Fonts::Ww1Fonts(Ww1Fib& rInFib, sal_uLong nFieldFlgs) : pFontA(0), rFib(rInFib), nFieldFlags(nFieldFlgs), nMax(0), bOK(false) { if(rFib.GetFIB().cbSttbfffnGet() > 2 ) // ueberhaupt fonts? @@ -336,7 +336,7 @@ Ww1Fonts::Ww1Fonts(Ww1Fib& rInFib, ULONG nFieldFlgs) SVBT16 nCountBytes; DBG_ASSERT(rFib.GetFIB().cbSttbfffnGet() > sizeof(nCountBytes), "Ww1Fonts"); if (rFib.GetStream().Seek(rFib.GetFIB().fcSttbfffnGet()) - == (ULONG)rFib.GetFIB().fcSttbfffnGet()) + == (sal_uLong)rFib.GetFIB().fcSttbfffnGet()) if (rFib.GetStream().Read(nCountBytes, sizeof(nCountBytes)) == sizeof(nCountBytes)) // Laenge steht hier nochmal { @@ -347,7 +347,7 @@ Ww1Fonts::Ww1Fonts(Ww1Fib& rInFib, ULONG nFieldFlgs) - sizeof(nCountBytes)]; // Alloziere Font-Array //~ Ww1: new-NULL if (rFib.GetStream().Read(pA, rFib.GetFIB().cbSttbfffnGet() - - sizeof(nCountBytes)) == (ULONG)rFib.GetFIB().cbSttbfffnGet() + - sizeof(nCountBytes)) == (sal_uLong)rFib.GetFIB().cbSttbfffnGet() - sizeof(nCountBytes)) // lese alle Fonts {} //nothing @@ -356,7 +356,7 @@ Ww1Fonts::Ww1Fonts(Ww1Fib& rInFib, ULONG nFieldFlgs) W1_FFN* p = pA; while (1) { - USHORT nNextSiz; + sal_uInt16 nNextSiz; nNextSiz = p->cbFfnM1Get() + 1; if(nNextSiz > nLeft) break; @@ -371,7 +371,7 @@ Ww1Fonts::Ww1Fonts(Ww1Fib& rInFib, ULONG nFieldFlgs) pFontA = new W1_FFN*[nMax]; // alloziere Index-Array //~ Ww1: new-NULL pFontA[0] = pA; // fuelle Index-Array - USHORT i; + sal_uInt16 i; for(i=1, p=pA; i<nMax; i++) { p = (W1_FFN*)(((char*)p) + p->cbFfnM1Get() + 1); @@ -382,10 +382,10 @@ Ww1Fonts::Ww1Fonts(Ww1Fib& rInFib, ULONG nFieldFlgs) pFontA = 0; // Keine Eintraege -> kein Array } } - bOK = TRUE; + bOK = sal_True; } -W1_FFN* Ww1Fonts::GetFFN(USHORT nNum) +W1_FFN* Ww1Fonts::GetFFN(sal_uInt16 nNum) { W1_FFN* pRet = NULL; if (pFontA) @@ -405,22 +405,22 @@ Ww1Dop::Ww1Dop(Ww1Fib& _rFib) else nRead = rFib.GetFIB().cbDopGet(); bOK = rFib.GetStream().Seek(rFib.GetFIB().fcDopGet()) == - (ULONG)rFib.GetFIB().fcDopGet() && - rFib.GetStream().Read(&aDop, nRead) == (ULONG)nRead; + (sal_uLong)rFib.GetFIB().fcDopGet() && + rFib.GetStream().Read(&aDop, nRead) == (sal_uLong)nRead; } /////////////////////////////////////////////////////////////// Picture -Ww1Picture::Ww1Picture(SvStream& rStream, ULONG ulFilePos) +Ww1Picture::Ww1Picture(SvStream& rStream, sal_uLong ulFilePos) : bOK(false), pPic(0) { ulFilePos &= 0xffffff; //~ ww1: warum auch immer - im highbyte steht eine 5?!?! SVBT32 lcb; - if (rStream.Seek(ulFilePos) == (ULONG)ulFilePos) - if (rStream.Read(&lcb, sizeof(lcb)) == (ULONG)sizeof(lcb)) + if (rStream.Seek(ulFilePos) == (sal_uLong)ulFilePos) + if (rStream.Read(&lcb, sizeof(lcb)) == (sal_uLong)sizeof(lcb)) if (sizeof(int)>=4 || SVBT32ToUInt32(lcb) < 0x8000) //~ mdt: 64K & 16bit - if ((pPic = (W1_PIC*)(new BYTE[SVBT32ToUInt32(lcb)])) != NULL) - if (rStream.Seek(ulFilePos) == (ULONG)ulFilePos) - if (rStream.Read(pPic, SVBT32ToUInt32(lcb)) == (ULONG)SVBT32ToUInt32(lcb)) + if ((pPic = (W1_PIC*)(new sal_uInt8[SVBT32ToUInt32(lcb)])) != NULL) + if (rStream.Seek(ulFilePos) == (sal_uLong)ulFilePos) + if (rStream.Read(pPic, SVBT32ToUInt32(lcb)) == (sal_uLong)SVBT32ToUInt32(lcb)) { DBG_ASSERT(pPic->cbHeaderGet()==sizeof(*pPic)-sizeof(pPic->rgb), "Ww1Picture"); bOK = true; @@ -428,43 +428,43 @@ Ww1Picture::Ww1Picture(SvStream& rStream, ULONG ulFilePos) } ////////////////////////////////////////////////////////////////// Sprm -Ww1Sprm::Ww1Sprm(BYTE* x, USHORT _nCountBytes) +Ww1Sprm::Ww1Sprm(sal_uInt8* x, sal_uInt16 _nCountBytes) : p(NULL), nCountBytes(_nCountBytes), - bOK(FALSE), + bOK(sal_False), pArr(NULL), count(0) { if (nCountBytes == 0) - bOK = TRUE; + bOK = sal_True; else - if ((p = new BYTE[nCountBytes]) != NULL) + if ((p = new sal_uInt8[nCountBytes]) != NULL) { memcpy(p, x, nCountBytes); if (ReCalc()) - bOK = TRUE; + bOK = sal_True; } } -Ww1Sprm::Ww1Sprm(SvStream& rStream, ULONG ulFilePos) +Ww1Sprm::Ww1Sprm(SvStream& rStream, sal_uLong ulFilePos) : p(NULL), nCountBytes(0), - bOK(FALSE), + bOK(sal_False), pArr(NULL), count(0) { SVBT8 x; ByteToSVBT8(0, x); - if (rStream.Seek(ulFilePos) == (ULONG)ulFilePos) - if (rStream.Read(&x, sizeof(x)) == (ULONG)sizeof(x)) + if (rStream.Seek(ulFilePos) == (sal_uLong)ulFilePos) + if (rStream.Read(&x, sizeof(x)) == (sal_uLong)sizeof(x)) if ((nCountBytes = SVBT8ToByte(x)) == 255 || !nCountBytes - || (p = new BYTE[nCountBytes]) != NULL) + || (p = new sal_uInt8[nCountBytes]) != NULL) if (nCountBytes == 255 || !nCountBytes - || rStream.Read(p, nCountBytes) == (ULONG)nCountBytes) + || rStream.Read(p, nCountBytes) == (sal_uLong)nCountBytes) if (ReCalc()) - bOK = TRUE; + bOK = sal_True; } Ww1Sprm::~Ww1Sprm() @@ -473,22 +473,22 @@ Ww1Sprm::~Ww1Sprm() delete p; } -USHORT Ww1SingleSprm::Size(BYTE* /*pSprm*/) +sal_uInt16 Ww1SingleSprm::Size(sal_uInt8* /*pSprm*/) { return nCountBytes; } -USHORT Ww1SingleSprmTab::Size(BYTE* pSprm) // Doc 24/25, Fastsave-Sprm +sal_uInt16 Ww1SingleSprmTab::Size(sal_uInt8* pSprm) // Doc 24/25, Fastsave-Sprm { DBG_ASSERT(nCountBytes==0, "Ww1SingleSprmTab"); - USHORT nRet = sizeof(SVBT8); - USHORT nSize = SVBT8ToByte(pSprm); + sal_uInt16 nRet = sizeof(SVBT8); + sal_uInt16 nSize = SVBT8ToByte(pSprm); if (nSize != 255) nRet = nRet + nSize; else { - USHORT nDel = SVBT8ToByte(pSprm+1) * 4; - USHORT nIns = SVBT8ToByte(pSprm + 3 + nDel) * 3; + sal_uInt16 nDel = SVBT8ToByte(pSprm+1) * 4; + sal_uInt16 nIns = SVBT8ToByte(pSprm + 3 + nDel) * 3; nRet += nDel + nIns; } DBG_ASSERT(nRet <= 354, "Ww1SingleSprmTab"); @@ -497,9 +497,9 @@ USHORT Ww1SingleSprmTab::Size(BYTE* pSprm) // Doc 24/25, Fastsave-Sprm return nRet; } -USHORT Ww1SingleSprmByteSized::Size(BYTE* pSprm) +sal_uInt16 Ww1SingleSprmByteSized::Size(sal_uInt8* pSprm) { - USHORT nRet; + sal_uInt16 nRet; nRet = SVBT8ToByte(pSprm); nRet += sizeof(SVBT8); // var. l. byte-size // pSprm += sizeof(SVBT8); // var. l. byte-size @@ -507,9 +507,9 @@ USHORT Ww1SingleSprmByteSized::Size(BYTE* pSprm) return nRet; } -USHORT Ww1SingleSprmWordSized::Size(BYTE* pSprm) +sal_uInt16 Ww1SingleSprmWordSized::Size(sal_uInt8* pSprm) { - USHORT nRet; + sal_uInt16 nRet; nRet = SVBT16ToShort(pSprm); nRet += sizeof(SVBT16); // var. l. word-size // pSprm += sizeof(SVBT16); // var. l. word-size @@ -517,19 +517,19 @@ USHORT Ww1SingleSprmWordSized::Size(BYTE* pSprm) return nRet; } -static BYTE nLast = 0; -static BYTE nCurrent = 0; -USHORT Ww1Sprm::GetSize(BYTE nId, BYTE* pSprm) +static sal_uInt8 nLast = 0; +static sal_uInt8 nCurrent = 0; +sal_uInt16 Ww1Sprm::GetSize(sal_uInt8 nId, sal_uInt8* pSprm) { //DBG_ASSERT( nId < sizeof(aTab) / sizeof(*aTab), "Ww1Sprm" ); - USHORT nL = 0; + sal_uInt16 nL = 0; nL = GetTab(nId).Size(pSprm); nLast = nCurrent; nCurrent = nId; return nL; } -BOOL Ww1Sprm::Fill(USHORT index, BYTE& nId, USHORT& nL, BYTE*& pSprm) +sal_Bool Ww1Sprm::Fill(sal_uInt16 index, sal_uInt8& nId, sal_uInt16& nL, sal_uInt8*& pSprm) { //DBG_ASSERT( nId < sizeof(aTab) / sizeof(*aTab), "Ww1Sprm"); DBG_ASSERT(index < Count(), "Ww1Sprm"); @@ -537,22 +537,22 @@ BOOL Ww1Sprm::Fill(USHORT index, BYTE& nId, USHORT& nL, BYTE*& pSprm) nId = SVBT8ToByte(pSprm); pSprm++; nL = GetTab(nId).Size(pSprm); - return TRUE; + return sal_True; } -BOOL Ww1Sprm::ReCalc() +sal_Bool Ww1Sprm::ReCalc() { - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; delete pArr; pArr = NULL; count = 0; if (nCountBytes != 255) // not unused? { - USHORT cbsik = nCountBytes; - BYTE* psik = p; + sal_uInt16 cbsik = nCountBytes; + sal_uInt8* psik = p; while (cbsik > 0) { - USHORT iLen = GetSizeBrutto(psik); + sal_uInt16 iLen = GetSizeBrutto(psik); DBG_ASSERT(iLen<=cbsik, "Ww1Sprm"); if (iLen > cbsik) cbsik = 0; // ignore the rest: we are wrong... @@ -564,16 +564,16 @@ BOOL Ww1Sprm::ReCalc() } } if (bRet - && (pArr = new USHORT[count]) != NULL) + && (pArr = new sal_uInt16[count]) != NULL) { cbsik = nCountBytes; - USHORT offset = 0; - USHORT current = 0; + sal_uInt16 offset = 0; + sal_uInt16 current = 0; psik = p; while (current<count) { pArr[current++] = offset; - USHORT iLen = GetSizeBrutto(psik); + sal_uInt16 iLen = GetSizeBrutto(psik); psik += iLen; if (iLen > cbsik) cbsik = 0; @@ -715,33 +715,33 @@ void Ww1Sprm::InitTab() } ////////////////////////////////////////////////////////////// SprmPapx -Ww1SprmPapx::Ww1SprmPapx(BYTE* pByte, USHORT nSize) : +Ww1SprmPapx::Ww1SprmPapx(sal_uInt8* pByte, sal_uInt16 nSize) : Ww1Sprm(Sprm(pByte, nSize), SprmSize(pByte, nSize)) { memset(&aPapx, 0, sizeof(aPapx)); memcpy(&aPapx, pByte, nSize<sizeof(aPapx)?nSize:sizeof(aPapx)); } -USHORT Ww1SprmPapx::SprmSize(BYTE*, USHORT nSize) +sal_uInt16 Ww1SprmPapx::SprmSize(sal_uInt8*, sal_uInt16 nSize) { - USHORT nRet = 0; + sal_uInt16 nRet = 0; if (nSize >= sizeof(W1_PAPX)) nRet = nSize - ( sizeof(W1_PAPX) - 1 ); // im W1_PAPX ist das // 1. SprmByte enthalten return nRet; } -BYTE* Ww1SprmPapx::Sprm(BYTE* pByte, USHORT nSize) +sal_uInt8* Ww1SprmPapx::Sprm(sal_uInt8* pByte, sal_uInt16 nSize) { - BYTE* pRet = NULL; + sal_uInt8* pRet = NULL; if (nSize >= sizeof(W1_PAPX)) pRet = ((W1_PAPX*)(pByte))->grpprlGet(); return pRet; } /////////////////////////////////////////////////////////////////// Plc -Ww1Plc::Ww1Plc(Ww1Fib& rInFib, ULONG ulFilePos, USHORT nInCountBytes, - USHORT nInItemSize) +Ww1Plc::Ww1Plc(Ww1Fib& rInFib, sal_uLong ulFilePos, sal_uInt16 nInCountBytes, + sal_uInt16 nInItemSize) : p(0), nCountBytes(nInCountBytes), iMac(0), nItemSize(nInItemSize), bOK(false), rFib(rInFib) { @@ -749,17 +749,17 @@ Ww1Plc::Ww1Plc(Ww1Fib& rInFib, ULONG ulFilePos, USHORT nInCountBytes, bOK = true; else { - if (rFib.GetStream().Seek(ulFilePos) == (ULONG)ulFilePos) + if (rFib.GetStream().Seek(ulFilePos) == (sal_uLong)ulFilePos) { - if ((p = new BYTE[nCountBytes]) != NULL) + if ((p = new sal_uInt8[nCountBytes]) != NULL) { - if (rFib.GetStream().Read(p, nCountBytes) == (ULONG)nCountBytes) + if (rFib.GetStream().Read(p, nCountBytes) == (sal_uLong)nCountBytes) { bOK = true; iMac = (nCountBytes - sizeof(SVBT32)) / (sizeof(SVBT32) + nItemSize); - DBG_ASSERT(iMac * ((USHORT)sizeof(ULONG) + nItemSize) + - (USHORT)sizeof(SVBT32) == nCountBytes, "Ww1Plc"); + DBG_ASSERT(iMac * ((sal_uInt16)sizeof(sal_uLong) + nItemSize) + + (sal_uInt16)sizeof(SVBT32) == nCountBytes, "Ww1Plc"); } } } @@ -771,25 +771,25 @@ Ww1Plc::~Ww1Plc() delete p; } -void Ww1Plc::Seek(ULONG ulSeek, USHORT& nIndex) +void Ww1Plc::Seek(sal_uLong ulSeek, sal_uInt16& nIndex) { if (iMac) for (;nIndex <= iMac && Where(nIndex) < ulSeek;nIndex++) ; } -ULONG Ww1Plc::Where(USHORT nIndex) +sal_uLong Ww1Plc::Where(sal_uInt16 nIndex) { - ULONG ulRet = 0xffffffff; + sal_uLong ulRet = 0xffffffff; DBG_ASSERT(nIndex <= iMac, "index out of bounds"); if (iMac && nIndex <= iMac) ulRet = SVBT32ToUInt32(p + sizeof(SVBT32) * nIndex); return ulRet; } -BYTE* Ww1Plc::GetData(USHORT nIndex) +sal_uInt8* Ww1Plc::GetData(sal_uInt16 nIndex) { - BYTE* pRet = NULL; + sal_uInt8* pRet = NULL; DBG_ASSERT(nIndex < iMac, "index out of bounds"); if (nIndex < iMac) pRet = p + (iMac + 1) * sizeof(SVBT32) + @@ -817,14 +817,14 @@ BYTE* Ww1Plc::GetData(USHORT nIndex) // Die Anzahl wird in nMax zurueckgeliefert. // im Index 0 stehen alle Strings nacheinander, ab Index 1 werden // die einzelnen Strings referenziert. -Ww1StringList::Ww1StringList( SvStream& rSt, ULONG nFc, USHORT nCb ) +Ww1StringList::Ww1StringList( SvStream& rSt, sal_uLong nFc, sal_uInt16 nCb ) : pIdxA(0), nMax(0) { if( nCb > 2 ) // ueberhaupt Eintraege ? { SVBT16 nCountBytes; DBG_ASSERT(nCb > sizeof(nCountBytes), "Ww1StringList"); - if (rSt.Seek(nFc) == (ULONG)nFc) + if (rSt.Seek(nFc) == (sal_uLong)nFc) if (rSt.Read(nCountBytes, sizeof(nCountBytes)) == sizeof(nCountBytes)) // Laenge steht hier nochmal { @@ -835,14 +835,14 @@ Ww1StringList::Ww1StringList( SvStream& rSt, ULONG nFc, USHORT nCb ) // Alloziere PString-Array //~ Ww1: new-NULL if (rSt.Read(pA, nCb - sizeof(nCountBytes)) - == (ULONG)nCb - sizeof(nCountBytes)) // lese alle + == (sal_uLong)nCb - sizeof(nCountBytes)) // lese alle {}// do nothing // Zaehle, wieviele Fonts enthalten long nLeft = nCb - sizeof(nCountBytes); sal_Char* p = pA; while (1) { - USHORT nNextSiz; + sal_uInt16 nNextSiz; nNextSiz = *p + 1; if(nNextSiz > nLeft) break; @@ -858,9 +858,9 @@ Ww1StringList::Ww1StringList( SvStream& rSt, ULONG nFc, USHORT nCb ) pIdxA[0] = pA; // Index 0 : alles // ab Index 1 C-Strings pIdxA[1] = pA + 1; // fuelle Index-Array - USHORT i = 2; + sal_uInt16 i = 2; p = pA; - BYTE nL = *p; + sal_uInt8 nL = *p; while(1) { p += nL + 1; // Neues Laengen-Byte @@ -877,7 +877,7 @@ Ww1StringList::Ww1StringList( SvStream& rSt, ULONG nFc, USHORT nCb ) } } } -const String Ww1StringList::GetStr( USHORT nNum ) const +const String Ww1StringList::GetStr( sal_uInt16 nNum ) const { String sRet; if( nNum <= nMax ) @@ -889,10 +889,10 @@ Ww1Bookmarks::Ww1Bookmarks(Ww1Fib& rInFib) : aNames(rInFib), rFib(rInFib), nIsEnd(0) { pPos[0] = new Ww1PlcBookmarkPos(rFib, rFib.GetFIB().fcPlcfbkfGet(), - rFib.GetFIB().cbPlcfbkfGet(), FALSE); + rFib.GetFIB().cbPlcfbkfGet(), sal_False); nPlcIdx[0] = 0; pPos[1] = new Ww1PlcBookmarkPos(rFib, rFib.GetFIB().fcPlcfbklGet(), - rFib.GetFIB().cbPlcfbklGet(), TRUE); + rFib.GetFIB().cbPlcfbklGet(), sal_True); nPlcIdx[1] = 0; bOK = !aNames.GetError() && !pPos[0]->GetError() && !pPos[1]->GetError(); } @@ -914,8 +914,8 @@ void Ww1Bookmarks::operator ++( int ) { nPlcIdx[nIsEnd]++; - ULONG l0 = pPos[0]->Where(nPlcIdx[0]); - ULONG l1 = pPos[1]->Where(nPlcIdx[1]); + sal_uLong l0 = pPos[0]->Where(nPlcIdx[0]); + sal_uLong l1 = pPos[1]->Where(nPlcIdx[1]); if( l0 < l1 ) nIsEnd = 0; else if( l1 < l0 ) @@ -932,7 +932,7 @@ long Ww1Bookmarks::GetHandle() const if( nIsEnd ) return nPlcIdx[1]; - const BYTE* p = pPos[0]->GetData( nPlcIdx[0] ); + const sal_uInt8* p = pPos[0]->GetData( nPlcIdx[0] ); if( p ) return SVBT16ToShort( p ); } @@ -943,10 +943,10 @@ long Ww1Bookmarks::Len() const { if( nIsEnd ) { - DBG_ASSERT( FALSE, "Falscher Aufruf (1) von Ww1Bookmarks::Len()" ); + DBG_ASSERT( sal_False, "Falscher Aufruf (1) von Ww1Bookmarks::Len()" ); return 0; } - USHORT nEndIdx = SVBT16ToShort(pPos[0]->GetData(nPlcIdx[0])); + sal_uInt16 nEndIdx = SVBT16ToShort(pPos[0]->GetData(nPlcIdx[0])); return pPos[1]->Where(nEndIdx) - pPos[0]->Where(nPlcIdx[0]); } @@ -958,27 +958,27 @@ const String Ww1Bookmarks::GetName() const } /////////////////////////////////////////////////////////////////// Fkp -Ww1Fkp::Ww1Fkp(SvStream& rStream, ULONG ulFilePos, USHORT _nItemSize) : +Ww1Fkp::Ww1Fkp(SvStream& rStream, sal_uLong ulFilePos, sal_uInt16 _nItemSize) : nItemSize(_nItemSize), - bOK(FALSE) + bOK(sal_False) { - if (rStream.Seek(ulFilePos) == (ULONG)ulFilePos) + if (rStream.Seek(ulFilePos) == (sal_uLong)ulFilePos) if (rStream.Read(aFkp, sizeof(aFkp)) == sizeof(aFkp)) - bOK = TRUE; + bOK = sal_True; } -ULONG Ww1Fkp::Where(USHORT nIndex) +sal_uLong Ww1Fkp::Where(sal_uInt16 nIndex) { - ULONG lRet = 0xffffffff; + sal_uLong lRet = 0xffffffff; DBG_ASSERT(nIndex<=Count(), "index out of bounds"); if (nIndex<=Count()) lRet = SVBT32ToUInt32(aFkp+nIndex*sizeof(SVBT32)); return lRet; } -BYTE* Ww1Fkp::GetData(USHORT nIndex) +sal_uInt8* Ww1Fkp::GetData(sal_uInt16 nIndex) { - BYTE* pRet = NULL; + sal_uInt8* pRet = NULL; DBG_ASSERT(nIndex<=Count(), "index out of bounds"); if (nIndex<=Count()) pRet = aFkp + (Count()+1) * sizeof(SVBT32) + @@ -987,13 +987,13 @@ BYTE* Ww1Fkp::GetData(USHORT nIndex) } //////////////////////////////////////////////////////////////// FkpPap -BOOL Ww1FkpPap::Fill(USHORT nIndex, BYTE*& p, USHORT& rnCountBytes) +sal_Bool Ww1FkpPap::Fill(sal_uInt16 nIndex, sal_uInt8*& p, sal_uInt16& rnCountBytes) { DBG_ASSERT( nIndex < Count(), "Ww1FkpPap::Fill() Index out of Range" ); - USHORT nOffset = SVBT8ToByte(GetData(nIndex)) * 2; + sal_uInt16 nOffset = SVBT8ToByte(GetData(nIndex)) * 2; if (nOffset) { - DBG_ASSERT(nOffset>(USHORT)(Count()*sizeof(SVBT32)), "calc error"); + DBG_ASSERT(nOffset>(sal_uInt16)(Count()*sizeof(SVBT32)), "calc error"); // rnCountBytes = SVBT8ToByte(aFkp+nOffset) * 2 + 1; // SH: +1 ????? rnCountBytes = SVBT8ToByte(aFkp+nOffset) * 2; nOffset += sizeof(SVBT8); @@ -1011,33 +1011,33 @@ BOOL Ww1FkpPap::Fill(USHORT nIndex, BYTE*& p, USHORT& rnCountBytes) p = NULL; rnCountBytes = 0; } - return TRUE; + return sal_True; } //////////////////////////////////////////////////////////////// FkpChp -BOOL Ww1FkpChp::Fill(USHORT nIndex, W1_CHP& aChp) +sal_Bool Ww1FkpChp::Fill(sal_uInt16 nIndex, W1_CHP& aChp) { DBG_ASSERT( nIndex < Count(), "Ww1FkpChp::Fill() Index out of Range" ); memset(&aChp, 0, sizeof(aChp)); // Default, da verkuerzt gespeichert - USHORT nOffset = GetData(nIndex)[0] * 2; + sal_uInt16 nOffset = GetData(nIndex)[0] * 2; if (nOffset) { - DBG_ASSERT(nOffset>(USHORT)(Count()*sizeof(SVBT32)), "calc error"); - USHORT nCountBytes = aFkp[nOffset]; + DBG_ASSERT(nOffset>(sal_uInt16)(Count()*sizeof(SVBT32)), "calc error"); + sal_uInt16 nCountBytes = aFkp[nOffset]; nOffset += sizeof(SVBT8); DBG_ASSERT(nCountBytes <= 511-nOffset, "calc error"); DBG_ASSERT(nCountBytes <= sizeof(aChp), "calc error"); memcpy(&aChp, aFkp+nOffset, nCountBytes); } - return TRUE; + return sal_True; } ///////////////////////////////////////////////////////////////// Assoc Ww1Assoc::Ww1Assoc(Ww1Fib& _rFib) - : rFib(_rFib), pBuffer(NULL), bOK(FALSE) + : rFib(_rFib), pBuffer(NULL), bOK(sal_False) { - USHORT cb = rFib.GetFIB().cbSttbfAssocGet(); - USHORT i; + sal_uInt16 cb = rFib.GetFIB().cbSttbfAssocGet(); + sal_uInt16 i; for ( i = 0; i < MaxFields; i++ ) pStrTbl[i] = NULL; @@ -1046,23 +1046,23 @@ Ww1Assoc::Ww1Assoc(Ww1Fib& _rFib) rFib.GetFIB().fcSttbfAssocGet() && rFib.GetStream().Read(pBuffer, cb) == cb) { - USHORT j; + sal_uInt16 j; DBG_ASSERT( cb == SVBT16ToShort( *(SVBT16*)pBuffer ), "size missmatch"); for (i=0,j=sizeof(SVBT16);j<cb && i<Criteria1;i++) { pStrTbl[i] = pBuffer+j; j += (*pBuffer + j) + 1; } - bOK = TRUE; + bOK = sal_True; } } -String Ww1Assoc::GetStr(USHORT code) +String Ww1Assoc::GetStr(sal_uInt16 code) { String sRet; DBG_ASSERT(code<MaxFields, "out of range"); if (pStrTbl[code] != NULL) - for( USHORT i=0;i<pStrTbl[code][0];i++ ) + for( sal_uInt16 i=0;i<pStrTbl[code][0];i++ ) sRet += String( pStrTbl[code][i+1], RTL_TEXTENCODING_MS_1252 ); return sRet; } @@ -1074,7 +1074,7 @@ Ww1Pap::Ww1Pap(Ww1Fib& _rFib) { } -void Ww1Pap::Seek(ULONG ulSeek) +void Ww1Pap::Seek(sal_uLong ulSeek) { while (ulSeek > Where()) (*this)++; @@ -1084,9 +1084,9 @@ void Ww1Pap::Seek(ULONG ulSeek) // Fkps der zugehoerige Index auf 0 gesetzt werden soll // ( darf fuer Push/Pop nicht passieren ) // Ein eleganterer Weg faellt mir auf die Schnelle nicht ein -ULONG Ww1Pap::Where( BOOL bSetIndex ) +sal_uLong Ww1Pap::Where( sal_Bool bSetIndex ) { - ULONG ulRet = 0xffffffff; + sal_uLong ulRet = 0xffffffff; if (pPap == NULL) if (nPlcIndex < Count()) { @@ -1116,46 +1116,46 @@ void Ww1Pap::operator++(int) // SH: FindSprm sucht in grpprl nach Sprm nId // Rueckgabe: Pointer oder 0 -BOOL Ww1Pap::FindSprm(USHORT nId, BYTE* pStart, BYTE* pEnd) -{ - Ww1Sprm aSprm( pStart, static_cast< USHORT >(pEnd-pStart) ); - USHORT nC = aSprm.Count(); - USHORT i; - BYTE nI; - USHORT nLen; - BYTE *pData; +sal_Bool Ww1Pap::FindSprm(sal_uInt16 nId, sal_uInt8* pStart, sal_uInt8* pEnd) +{ + Ww1Sprm aSprm( pStart, static_cast< sal_uInt16 >(pEnd-pStart) ); + sal_uInt16 nC = aSprm.Count(); + sal_uInt16 i; + sal_uInt8 nI; + sal_uInt16 nLen; + sal_uInt8 *pData; for( i = 0; i < nC; i++ ){ aSprm.Fill( i, nI, nLen, pData ); if( nI == nId ) - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } -BOOL Ww1Pap::HasId0(USHORT nId) +sal_Bool Ww1Pap::HasId0(sal_uInt16 nId) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; UpdateIdx(); if( !pPap ){ - DBG_ASSERT( FALSE, "Ww1Pap::HasId():: kann kein pPap erzeugen" ); - return FALSE; + DBG_ASSERT( sal_False, "Ww1Pap::HasId():: kann kein pPap erzeugen" ); + return sal_False; } - BYTE* pByte; - USHORT n; + sal_uInt8* pByte; + sal_uInt16 n; if( pPap->Fill(nFkpIndex, pByte, n) ){ - BYTE* p2 = ((W1_PAPX*)(pByte))->grpprlGet(); // SH: Offset fehlte + sal_uInt8* p2 = ((W1_PAPX*)(pByte))->grpprlGet(); // SH: Offset fehlte bRet = FindSprm( nId, p2, pByte + n ); } return bRet; } -BOOL Ww1Pap::HasId(USHORT nId) +sal_Bool Ww1Pap::HasId(sal_uInt16 nId) { - BOOL bRet = FALSE; - USHORT nPushedPlcIndex2 = nPlcIndex; - USHORT nPushedFkpIndex2 = nFkpIndex; + sal_Bool bRet = sal_False; + sal_uInt16 nPushedPlcIndex2 = nPlcIndex; + sal_uInt16 nPushedFkpIndex2 = nFkpIndex; bRet = HasId0( nId ); if (nPlcIndex != nPushedPlcIndex2) { @@ -1164,7 +1164,7 @@ BOOL Ww1Pap::HasId(USHORT nId) } nPlcIndex = nPushedPlcIndex2; nFkpIndex = nPushedFkpIndex2; - Where( FALSE ); + Where( sal_False ); return bRet; } @@ -1175,7 +1175,7 @@ Ww1Chp::Ww1Chp(Ww1Fib& _rFib) { } -void Ww1Chp::Seek(ULONG ulSeek) +void Ww1Chp::Seek(sal_uLong ulSeek) { while (ulSeek > Where()) (*this)++; @@ -1185,9 +1185,9 @@ void Ww1Chp::Seek(ULONG ulSeek) // Fkps der zugehoerige Index auf 0 gesetzt werden soll // ( darf fuer Push/Pop nicht passieren ) // Ein eleganterer Weg faellt mir auf die Schnelle nicht ein -ULONG Ww1Chp::Where( BOOL bSetIndex ) +sal_uLong Ww1Chp::Where( sal_Bool bSetIndex ) { - ULONG ulRet = 0xffffffff; + sal_uLong ulRet = 0xffffffff; if (pChp == NULL) if (nPlcIndex < Count()) { @@ -1217,8 +1217,8 @@ void Ww1Chp::operator++(int) } ////////////////////////////////////////////////////////////// Manager -Ww1Manager::Ww1Manager(SvStream& rStrm, ULONG nFieldFlgs) - : bOK(FALSE), bInTtp(FALSE), bInStyle(FALSE), bStopAll(FALSE), aFib(rStrm), +Ww1Manager::Ww1Manager(SvStream& rStrm, sal_uLong nFieldFlgs) + : bOK(sal_False), bInTtp(sal_False), bInStyle(sal_False), bStopAll(sal_False), aFib(rStrm), aDop(aFib), aFonts(aFib, nFieldFlgs), aDoc(aFib), pDoc(&aDoc), ulDocSeek(0), pSeek(&ulDocSeek), aFld(aFib), pFld(&aFld), aChp(aFib), aPap(aFib), aFtn(aFib), aBooks(aFib), @@ -1235,22 +1235,22 @@ Ww1Manager::Ww1Manager(SvStream& rStrm, ULONG nFieldFlgs) && !aBooks.GetError(); } -BOOL Ww1Manager::HasInTable() +sal_Bool Ww1Manager::HasInTable() { return aPap.HasId(24); // Ww1SingleSprmPFInTable } -BOOL Ww1Manager::HasTtp() +sal_Bool Ww1Manager::HasTtp() { return aPap.HasId(25); // Ww1SingleSprmPTtp } -BOOL Ww1Manager::HasPPc() +sal_Bool Ww1Manager::HasPPc() { return aPap.HasId(29); // Ww1SingleSprmPPc } -BOOL Ww1Manager::HasPDxaAbs() +sal_Bool Ww1Manager::HasPDxaAbs() { return aPap.HasId(26); // Ww1SingleSprmPDxaAbs } |