home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / anwor032.zip / antiword.0.32 / properties.c < prev    next >
C/C++ Source or Header  |  2001-06-25  |  2KB  |  87 lines

  1. /*
  2.  * properties.c
  3.  * Copyright (C) 1998-2001 A.J. van Os; Released under GPL
  4.  *
  5.  * Description:
  6.  * Read the properties information from a MS Word file
  7.  */
  8.  
  9. #include <stdlib.h>
  10. #include <string.h>
  11. #include "antiword.h"
  12.  
  13.  
  14. /*
  15.  * Build the lists with Property Information
  16.  */
  17. void
  18. vGetPropertyInfo(FILE *pFile, const pps_info_type *pPPS,
  19.     const long *alBBD, size_t tBBDLen, const long *alSBD, size_t tSBDLen,
  20.     const unsigned char *aucHeader, int iWordVersion)
  21. {
  22.     options_type    tOptions;
  23.  
  24.     fail(pFile == NULL || pPPS == NULL || aucHeader == NULL);
  25.     fail(alBBD == NULL || alSBD == NULL);
  26.  
  27.     vGetOptions(&tOptions);
  28.  
  29.     switch (iWordVersion) {
  30.     case 6:
  31.     case 7:
  32.         vGet6PapInfo(pFile, pPPS->tWordDocument.lSb,
  33.             alBBD, tBBDLen, aucHeader);
  34.         if (tOptions.bUseOutlineFonts) {
  35.             vGet6ChrInfo(pFile, pPPS,
  36.                 alBBD, tBBDLen, aucHeader);
  37.             vCreate6FontTable(pFile, pPPS->tWordDocument.lSb,
  38.                 alBBD, tBBDLen, aucHeader);
  39.         }
  40.         break;
  41.     case 8:
  42.         vGet8PapInfo(pFile, pPPS,
  43.             alBBD, tBBDLen, alSBD, tSBDLen, aucHeader);
  44.         if (tOptions.bUseOutlineFonts) {
  45.             vGet8ChrInfo(pFile, pPPS,
  46.                 alBBD, tBBDLen, alSBD, tSBDLen, aucHeader);
  47.             vCreate8FontTable(pFile, pPPS,
  48.                 alBBD, tBBDLen, alSBD, tSBDLen, aucHeader);
  49.         }
  50.         break;
  51.     default:
  52.         DBG_FIXME();
  53.         werr(0, "Sorry, no property information");
  54.         break;
  55.     }
  56. } /* end of vGetPropertyInfo */
  57.  
  58. /*
  59.  * ePropMod2RowInfo - Turn the Propertie Modifier into row information
  60.  *
  61.  * Returns: the row information
  62.  */
  63. row_info_enum
  64. ePropMod2RowInfo(unsigned short usPropMod, int iWordVersion)
  65. {
  66.     row_block_type    tRow;
  67.     const unsigned char    *pucPropMod;
  68.     int    iLen;
  69.  
  70.     pucPropMod = pucReadPropModListItem(usPropMod);
  71.     if (pucPropMod == NULL) {
  72.         return found_nothing;
  73.     }
  74.     iLen = (int)usGetWord(0, pucPropMod);
  75.  
  76.     switch (iWordVersion) {
  77.     case 6:
  78.     case 7:
  79.         return eGet6RowInfo(0, pucPropMod + 2, iLen, &tRow);
  80.     case 8:
  81.         return eGet8RowInfo(0, pucPropMod + 2, iLen, &tRow);
  82.     default:
  83.         DBG_FIXME();
  84.         return found_nothing;
  85.     }
  86. } /* end of ePropMod2RowInfo */
  87.