📄 prop8.c
字号:
for (iIndex2 = 0; iIndex2 < iRun; iIndex2++) { NO_DBG_HEX(ulGetLong(iIndex2 * 4, aucFpage)); iFodo = 2 * (int)ucGetByte( (iRun + 1) * 4 + iIndex2 * 13, aucFpage); if (iFodo <= 0) { continue; } iLen = 2 * (int)ucGetByte(iFodo, aucFpage); if (iLen == 0) { iFodo++; iLen = 2 * (int)ucGetByte(iFodo, aucFpage); } usIstd = usGetWord(iFodo + 1, aucFpage); vFillStyleFromStylesheet(usIstd, &tStyle); vGet8StyleInfo(iFodo, aucFpage + 3, iLen - 3, &tStyle); ulCharPos = ulGetLong(iIndex2 * 4, aucFpage); NO_DBG_HEX(ulCharPos); tStyle.ulFileOffset = ulCharPos2FileOffsetX( ulCharPos, &tStyle.eListID); vAdd2StyleInfoList(&tStyle); eRowInfo = eGet8RowInfo(iFodo, aucFpage + 3, iLen - 3, &tRow); switch (eRowInfo) { case found_a_cell: if (ulCharPosFirst != CP_INVALID) { break; } ulCharPosFirst = ulGetLong( iIndex2 * 4, aucFpage); NO_DBG_HEX(ulCharPosFirst); tRow.ulCharPosStart = ulCharPosFirst; tRow.ulFileOffsetStart = ulCharPos2FileOffset(ulCharPosFirst); NO_DBG_HEX_C( tRow.ulFileOffsetStart == FC_INVALID, ulCharPosFirst); break; case found_end_of_row: ulCharPosLast = ulGetLong( iIndex2 * 4, aucFpage); NO_DBG_HEX(ulCharPosLast); tRow.ulCharPosEnd = ulCharPosLast; tRow.ulFileOffsetEnd = ulCharPos2FileOffset(ulCharPosLast); NO_DBG_HEX_C(tRow.ulFileOffsetEnd == FC_INVALID, ulCharPosLast); vAdd2RowInfoList(&tRow); (void)memset(&tRow, 0, sizeof(tRow)); ulCharPosFirst = CP_INVALID; break; case found_nothing: break; default: DBG_DEC(eRowInfo); break; } } } aulParfPage = xfree(aulParfPage);} /* end of vGet8PapInfo *//* * Fill the font information block with information * from a Word 8/9/10/11 file. */voidvGet8FontInfo(int iFodo, USHORT usIstd, const UCHAR *aucGrpprl, int iBytes, font_block_type *pFont){ long lTmp; int iFodoOff, iInfoLen; USHORT usFtc0, usFtc1, usFtc2, usTmp; UCHAR ucTmp; fail(iFodo < 0 || aucGrpprl == NULL || pFont == NULL); usFtc0 = USHRT_MAX; usFtc1 = USHRT_MAX; usFtc2 = USHRT_MAX; iFodoOff = 0; while (iBytes >= iFodoOff + 2) { switch (usGetWord(iFodo + iFodoOff, aucGrpprl)) { case 0x0800: /* fRMarkDel */ ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl); if (ucTmp == 0) { pFont->usFontStyle &= ~FONT_MARKDEL; } else { pFont->usFontStyle |= FONT_MARKDEL; } break; case 0x0835: /* fBold */ ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl); switch (ucTmp) { case 0: /* Unset */ pFont->usFontStyle &= ~FONT_BOLD; break; case 1: /* Set */ pFont->usFontStyle |= FONT_BOLD; break; case 128: /* Unchanged */ break; case 129: /* Negation */ pFont->usFontStyle ^= FONT_BOLD; break; default: DBG_DEC(ucTmp); DBG_FIXME(); break; } break; case 0x0836: /* fItalic */ ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl); switch (ucTmp) { case 0: /* Unset */ pFont->usFontStyle &= ~FONT_ITALIC; break; case 1: /* Set */ pFont->usFontStyle |= FONT_ITALIC; break; case 128: /* Unchanged */ break; case 129: /* Negation */ pFont->usFontStyle ^= FONT_ITALIC; break; default: DBG_DEC(ucTmp); DBG_FIXME(); break; } break; case 0x0837: /* fStrike */ ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl); switch (ucTmp) { case 0: /* Unset */ pFont->usFontStyle &= ~FONT_STRIKE; break; case 1: /* Set */ pFont->usFontStyle |= FONT_STRIKE; break; case 128: /* Unchanged */ break; case 129: /* Negation */ pFont->usFontStyle ^= FONT_STRIKE; break; default: DBG_DEC(ucTmp); DBG_FIXME(); break; } break; case 0x083a: /* fSmallCaps */ ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl); switch (ucTmp) { case 0: /* Unset */ pFont->usFontStyle &= ~FONT_SMALL_CAPITALS; break; case 1: /* Set */ pFont->usFontStyle |= FONT_SMALL_CAPITALS; break; case 128: /* Unchanged */ break; case 129: /* Negation */ pFont->usFontStyle ^= FONT_SMALL_CAPITALS; break; default: DBG_DEC(ucTmp); DBG_FIXME(); break; } break; case 0x083b: /* fCaps */ ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl); switch (ucTmp) { case 0: /* Unset */ pFont->usFontStyle &= ~FONT_CAPITALS; break; case 1: /* Set */ pFont->usFontStyle |= FONT_CAPITALS; break; case 128: /* Unchanged */ break; case 129: /* Negation */ pFont->usFontStyle ^= FONT_CAPITALS; break; default: DBG_DEC(ucTmp); DBG_FIXME(); break; } break; case 0x083c: /* fVanish */ ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl); switch (ucTmp) { case 0: /* Unset */ pFont->usFontStyle &= ~FONT_HIDDEN; break; case 1: /* Set */ pFont->usFontStyle |= FONT_HIDDEN; break; case 128: /* Unchanged */ break; case 129: /* Negation */ pFont->usFontStyle ^= FONT_HIDDEN; break; default: DBG_DEC(ucTmp); DBG_FIXME(); break; } break; case 0x2a32: /* cDefault */ pFont->usFontStyle &= FONT_HIDDEN; pFont->ucFontColor = FONT_COLOR_DEFAULT; break; case 0x2a33: /* cPlain */ DBG_MSG("2a33: cPlain"); vFillFontFromStylesheet(usIstd, pFont); break; case 0x2a3e: /* cKul */ ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl); if (ucTmp == 0 || ucTmp == 5) { pFont->usFontStyle &= ~FONT_UNDERLINE; } else { NO_DBG_MSG("Underline text"); pFont->usFontStyle |= FONT_UNDERLINE; if (ucTmp == 6) { DBG_MSG("Bold text"); pFont->usFontStyle |= FONT_BOLD; } } break; case 0x2a42: /* cIco */ pFont->ucFontColor = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl); NO_DBG_DEC(pFont->ucFontColor); break; case 0x2a44: /* cHpsInc */ DBG_MSG("0x2a44: sprmCHpsInc"); ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl); DBG_DEC(ucTmp); break; case 0x2a48: /* cIss */ ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl); ucTmp &= 0x07; if (ucTmp == 1) { pFont->usFontStyle |= FONT_SUPERSCRIPT; NO_DBG_MSG("Superscript"); } else if (ucTmp == 2) { pFont->usFontStyle |= FONT_SUBSCRIPT; NO_DBG_MSG("Subscript"); } break; case 0x4a30: /* cIstd */ usTmp = usGetWord(iFodo + iFodoOff + 2, aucGrpprl); NO_DBG_DEC(usTmp); break; case 0x4a43: /* cHps */ pFont->usFontSize = usGetWord(iFodo + iFodoOff + 2, aucGrpprl); NO_DBG_DEC(pFont->usFontSize); break; case 0x4a4d: /* cHpsMul */ DBG_MSG("0x4a4d: sprmCHpsMul"); usTmp = usGetWord(iFodo + iFodoOff + 2, aucGrpprl); DBG_DEC(usTmp); break; case 0x4a4f: /* cFtc0 */ usFtc0 = usGetWord(iFodo + iFodoOff + 2, aucGrpprl); break; case 0x4a50: /* cFtc1 */ usFtc1 = usGetWord(iFodo + iFodoOff + 2, aucGrpprl); break; case 0x4a51: /* cFtc2 */ usFtc2 = usGetWord(iFodo + iFodoOff + 2, aucGrpprl); break; case 0xca47: /* cMajority */ DBG_MSG("0xca47: sprmCMajority"); break; case 0xca4a: /* cHpsInc1 */ usTmp = usGetWord(iFodo + iFodoOff + 2, aucGrpprl); lTmp = (long)pFont->usFontSize + (long)usTmp; if (lTmp < 8) { pFont->usFontSize = 8; } else if (lTmp > 32766) { pFont->usFontSize = 32766; } else { pFont->usFontSize = (USHORT)lTmp; } break; case 0xca4c: /* cMajority50 */ DBG_MSG("0xca4c: sprmCMajority50"); break; case 0xea3f: /* cHps, cHpsPos */ ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl); DBG_DEC(ucTmp); if (ucTmp != 0) { pFont->usFontSize = (USHORT)ucTmp; } ucTmp = ucGetByte(iFodo + iFodoOff + 3, aucGrpprl); DBG_DEC(ucTmp); break; default: break; } iInfoLen = iGet8InfoLength(iFodo + iFodoOff, aucGrpprl); fail(iInfoLen <= 0); iFodoOff += iInfoLen; } /* Combine the Ftc's to a FontNumber */ NO_DBG_DEC_C(usFtc0 != USHRT_MAX, usFtc0); NO_DBG_DEC_C(usFtc2 != USHRT_MAX, usFtc2); NO_DBG_DEC_C(usFtc1 != USHRT_MAX, usFtc1); if (usFtc0 <= 0x7fff) { if (usFtc0 <= (USHORT)UCHAR_MAX) { pFont->ucFontNumber = (UCHAR)usFtc0; } else { DBG_DEC(usFtc0); DBG_FIXME(); pFont->ucFontNumber = 0; } } else if (usFtc2 <= 0x7fff) { if (usFtc2 <= (USHORT)UCHAR_MAX) { pFont->ucFontNumber = (UCHAR)usFtc2; } else { DBG_DEC(usFtc2); DBG_FIXME(); pFont->ucFontNumber = 0; } } else if (usFtc1 <= 0x7fff) { if (usFtc1 <= (USHORT)UCHAR_MAX) { pFont->ucFontNumber = (UCHAR)usFtc1; } else { DBG_DEC(usFtc1); DBG_FIXME(); pFont->ucFontNumber = 0; } }} /* end of vGet8FontInfo *//* * Fill the picture information block with information * from a Word 8/9/10/11 file. * Returns TRUE when successful, otherwise FALSE */static BOOLbGet8PicInfo(int iFodo, const UCHAR *aucGrpprl, int iBytes, picture_block_type *pPicture){ ULONG ulTmp; int iFodoOff, iInfoLen; BOOL bFound; UCHAR ucTmp; fail(iFodo <= 0 || aucGrpprl == NULL || pPicture == NULL); iFodoOff = 0; bFound = FALSE; while (iBytes >= iFodoOff + 2) { switch (usGetWord(iFodo + iFodoOff, aucGrpprl)) {#if 0 case 0x0806: /* fData */ ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl); if (ucTmp == 0x01) { /* Not a picture, but a form field */ return FALSE; } DBG_DEC_C(ucTmp != 0, ucTmp); break;#endif case 0x080a: /* fOle2 */ ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl); if (ucTmp == 0x01) { /* Not a picture, but an OLE object */ return FALSE; } DBG_DEC_C(ucTmp != 0, ucTmp); break; case 0x680e: /* fcObj */ ulTmp = ulGetLong(iFodo + iFodoOff + 2, aucGrpprl); DBG_HEX(ulTmp); break; case 0x6a03: /* fcPic */ pPicture->ulPictureOffset = ulGetLong( iFodo + iFodoOff + 2, aucGrpprl); bFound = TRUE; break; default: break; } iInfoLen = iGet8InfoLength(iFodo + iFodoOff, aucGrpprl); fail(iInfoLen <= 0); iFodoOff += iInfoLen; } return bFound;} /* end of bGet8PicInfo *//* * Build the lists with Character Information for Word 8/9/10/11 files */voidvGet8ChrInfo(FILE *pFile, const pps_info_type *pPPS, const ULONG *aulBBD, size_t tBBDLen, const ULONG *aulSBD, size_t tSBDLen, const UCHAR *aucHeader){ font_block_type tFont; picture_block_type tPicture; ULONG *aulCharPage; UCHAR *aucBuffer; ULONG ulFileOffset, ulCharPos, ulBeginCharInfo; size_t tCharInfoLen, tOffset, tLen; int iIndex, iIndex2, iRun, iFodo, iLen; USHORT usIstd; UCHAR aucFpage[BIG_BLOCK_SIZE]; fail(pFile == NULL || pPPS == NULL || aucHeader == NULL); fail(aulBBD == NULL || aulSBD == NULL); ulBeginCharInfo = ulGetLong(0xfa, aucHeader); /* fcPlcfbteChpx */ NO_DBG_HEX(ulBeginCharInfo); tCharInfoLen = (size_t)ulGetLong(0xfe, aucHeader); /* lcbPlcfbteChpx */ NO_DBG_DEC(tCharInfoLen); if (tCharInfoLen < 4) { DBG_DEC(tCharInfoLen); return; } aucBuffer = aucFillInfoBuffer(pFile, &pPPS->tTable, aulBBD, tBBDLen, aulSBD, tSBDLen, ulBeginCharInfo, tCharInfoLen); if (aucBuffer == NULL) { return; } NO_DBG_PRINT_BLOCK(aucBuffer, tCharInfoLen); tLen = (tCharInfoLen / 4 - 1) / 2; aulCharPage = xcalloc(tLen, sizeof(ULONG)); for (iIndex = 0, tOffset = (tLen + 1) * 4; iIndex < (int)tLen; iIndex++, tOffset += 4) { aulCharPage[iIndex] = ulGetLong(tOffset, aucBuffer); NO_DBG_DEC(aulCharPage[iIndex]); } DBG_HEX(ulGetLong(0, aucBuffer)); aucBuffer = xfree(aucBuffer); NO_DBG_PRINT_BLOCK(aucHeader, HEADER_SIZE); for (iIndex = 0; iIndex < (int)tLen; iIndex++) { fail(aulCharPage[iIndex] > ULONG_MAX / BIG_BLOCK_SIZE); if (!bReadBuffer(pFile, pPPS->tWordDocument.ulSB, aulBBD, tBBDLen, BIG_BLOCK_SIZE, aucFpage, aulCharPage[iIndex] * BIG_BLOCK_SIZE, BIG_BLOCK_SIZE)) { break; } NO_DBG_PRINT_BLOCK(aucFpage, BIG_BLOCK_SIZE); iRun = (int)ucGetByte(0x1ff, aucFpage); NO_DBG_DEC(iRun); for (iIndex2 = 0; iIndex2 < iRun; iIndex2++) { ulCharPos = ulGetLong(iIndex2 * 4, aucFpage); ulFileOffset = ulCharPos2FileOffset(ulCharPos); iFodo = 2 * (int)ucGetByte( (iRun + 1) * 4 + iIndex2, aucFpage); iLen = (int)ucGetByte(iFodo, aucFpage); usIstd = usGetIstd(ulFileOffset); vFillFontFromStylesheet(usIstd, &tFont); if (iFodo != 0) { vGet8FontInfo(iFodo, usIstd, aucFpage + 1, iLen - 1, &tFont); } tFont.ulFileOffset = ulFileOffset; vAdd2FontInfoList(&tFont); if (iFodo <= 0) { continue; } (void)memset(&tPicture, 0, sizeof(tPicture)); if (bGet8PicInfo(iFodo, aucFpage + 1, iLen - 1, &tPicture)) { tPicture.ulFileOffset = ulFileOffset; tPicture.ulFileOffsetPicture = ulDataPos2FileOffset( tPicture.ulPictureOffset); vAdd2PictInfoList(&tPicture); } } } aulCharPage = xfree(aulCharPage);} /* end of vGet8ChrInfo */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -