diff -r f345bda72bc4 -r 43e37759235e Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/properties_8c_source.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/properties_8c_source.html Tue Mar 30 16:16:55 2010 +0100 @@ -0,0 +1,214 @@ + + +
+ +00001 /* +00002 * properties.c +00003 * Copyright (C) 1998-2005 A.J. van Os; Released under GNU GPL +00004 * +00005 * Description: +00006 * Read the properties information from a MS Word file +00007 */ +00008 +00009 #include <stdlib.h> +00010 #include <string.h> +00011 #include "antiword.h" +00012 +00013 +00014 /* +00015 * Build the lists with Property Information +00016 */ +00017 void +00018 vGetPropertyInfo(FILE *pFile, const pps_info_type *pPPS, +00019 const ULONG *aulBBD, size_t tBBDLen, +00020 const ULONG *aulSBD, size_t tSBDLen, +00021 const UCHAR *aucHeader, int iWordVersion) +00022 { +00023 options_type tOptions; +00024 +00025 TRACE_MSG("vGetPropertyInfo"); +00026 +00027 fail(pFile == NULL); +00028 fail(pPPS == NULL && iWordVersion >= 6); +00029 fail(aulBBD == NULL && tBBDLen != 0); +00030 fail(aulSBD == NULL && tSBDLen != 0); +00031 fail(aucHeader == NULL); +00032 +00033 /* Get the options */ +00034 vGetOptions(&tOptions); +00035 +00036 /* Get the property information per Word version */ +00037 switch (iWordVersion) { +00038 case 0: +00039 vGet0DopInfo(pFile, aucHeader); +00040 vGet0SepInfo(pFile, aucHeader); +00041 vGet0PapInfo(pFile, aucHeader); +00042 if (tOptions.eConversionType == conversion_draw || +00043 tOptions.eConversionType == conversion_ps || +00044 tOptions.eConversionType == conversion_xml || +00045 tOptions.eConversionType == conversion_fmt_text || +00046 tOptions.eConversionType == conversion_pdf) { +00047 vGet0ChrInfo(pFile, aucHeader); +00048 } +00049 if (tOptions.eConversionType == conversion_draw || +00050 tOptions.eConversionType == conversion_ps || +00051 tOptions.eConversionType == conversion_pdf) { +00052 vCreate0FontTable(); +00053 } +00054 vSet0SummaryInfo(pFile, aucHeader); +00055 break; +00056 case 1: +00057 case 2: +00058 vGet2Stylesheet(pFile, iWordVersion, aucHeader); +00059 vGet2DopInfo(pFile, aucHeader); +00060 vGet2SepInfo(pFile, aucHeader); +00061 vGet2PapInfo(pFile, aucHeader); +00062 if (tOptions.eConversionType == conversion_ps || +00063 tOptions.eConversionType == conversion_pdf) { +00064 vGet2HdrFtrInfo(pFile, aucHeader); +00065 } +00066 if (tOptions.eConversionType == conversion_draw || +00067 tOptions.eConversionType == conversion_ps || +00068 tOptions.eConversionType == conversion_xml || +00069 tOptions.eConversionType == conversion_fmt_text || +00070 tOptions.eConversionType == conversion_pdf) { +00071 vGet2ChrInfo(pFile, iWordVersion, aucHeader); +00072 } +00073 if (tOptions.eConversionType == conversion_draw || +00074 tOptions.eConversionType == conversion_ps || +00075 tOptions.eConversionType == conversion_pdf) { +00076 vCreate2FontTable(pFile, iWordVersion, aucHeader); +00077 } +00078 vSet2SummaryInfo(pFile, iWordVersion, aucHeader); +00079 break; +00080 case 4: +00081 case 5: +00082 break; +00083 case 6: +00084 case 7: +00085 vGet6Stylesheet(pFile, pPPS->tWordDocument.ulSB, +00086 aulBBD, tBBDLen, aucHeader); +00087 vGet6DopInfo(pFile, pPPS->tWordDocument.ulSB, +00088 aulBBD, tBBDLen, aucHeader); +00089 vGet6SepInfo(pFile, pPPS->tWordDocument.ulSB, +00090 aulBBD, tBBDLen, aucHeader); +00091 vGet6PapInfo(pFile, pPPS->tWordDocument.ulSB, +00092 aulBBD, tBBDLen, aucHeader); +00093 if (tOptions.eConversionType == conversion_ps || +00094 tOptions.eConversionType == conversion_pdf) { +00095 vGet6HdrFtrInfo(pFile, pPPS->tWordDocument.ulSB, +00096 aulBBD, tBBDLen, aucHeader); +00097 } +00098 if (tOptions.eConversionType == conversion_draw || +00099 tOptions.eConversionType == conversion_ps || +00100 tOptions.eConversionType == conversion_xml || +00101 tOptions.eConversionType == conversion_fmt_text || +00102 tOptions.eConversionType == conversion_pdf) { +00103 vGet6ChrInfo(pFile, pPPS->tWordDocument.ulSB, +00104 aulBBD, tBBDLen, aucHeader); +00105 } +00106 if (tOptions.eConversionType == conversion_draw || +00107 tOptions.eConversionType == conversion_ps || +00108 tOptions.eConversionType == conversion_pdf) { +00109 vCreate6FontTable(pFile, pPPS->tWordDocument.ulSB, +00110 aulBBD, tBBDLen, aucHeader); +00111 } +00112 vSet6SummaryInfo(pFile, pPPS, +00113 aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader); +00114 break; +00115 case 8: +00116 vGet8LstInfo(pFile, pPPS, +00117 aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader); +00118 vGet8Stylesheet(pFile, pPPS, +00119 aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader); +00120 vGet8DopInfo(pFile, &pPPS->tTable, +00121 aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader); +00122 vGet8SepInfo(pFile, pPPS, +00123 aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader); +00124 vGet8PapInfo(pFile, pPPS, +00125 aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader); +00126 if (tOptions.eConversionType == conversion_ps || +00127 tOptions.eConversionType == conversion_pdf) { +00128 vGet8HdrFtrInfo(pFile, &pPPS->tTable, +00129 aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader); +00130 } +00131 if (tOptions.eConversionType == conversion_draw || +00132 tOptions.eConversionType == conversion_ps || +00133 tOptions.eConversionType == conversion_xml || +00134 tOptions.eConversionType == conversion_fmt_text || +00135 tOptions.eConversionType == conversion_pdf) { +00136 vGet8ChrInfo(pFile, pPPS, +00137 aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader); +00138 } +00139 if (tOptions.eConversionType == conversion_draw || +00140 tOptions.eConversionType == conversion_ps || +00141 tOptions.eConversionType == conversion_pdf) { +00142 vCreate8FontTable(pFile, pPPS, +00143 aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader); +00144 } +00145 vSet8SummaryInfo(pFile, pPPS, +00146 aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader); +00147 break; +00148 default: +00149 DBG_DEC(iWordVersion); +00150 DBG_FIXME(); +00151 werr(0, "Sorry, no property information"); +00152 break; +00153 } +00154 +00155 /* Temporarily: Correct the font table */ +00156 vCorrectFontTable(tOptions.eConversionType, tOptions.eEncoding); +00157 } /* end of vGetPropertyInfo */ +00158 +00159 /* +00160 * ePropMod2RowInfo - Turn the Property Modifier into row information +00161 * +00162 * Returns: the row information +00163 */ +00164 row_info_enum +00165 ePropMod2RowInfo(USHORT usPropMod, int iWordVersion) +00166 { +00167 row_block_type tRow; +00168 const UCHAR *aucPropMod; +00169 int iLen; +00170 +00171 TRACE_MSG("ePropMod2RowInfo"); +00172 +00173 aucPropMod = aucReadPropModListItem(usPropMod); +00174 if (aucPropMod == NULL) { +00175 return found_nothing; +00176 } +00177 iLen = (int)usGetWord(0, aucPropMod); +00178 +00179 switch (iWordVersion) { +00180 case 0: +00181 return found_nothing; +00182 case 1: +00183 case 2: +00184 return eGet2RowInfo(0, aucPropMod + 2, iLen, &tRow); +00185 case 4: +00186 case 5: +00187 return found_nothing; +00188 case 6: +00189 case 7: +00190 return eGet6RowInfo(0, aucPropMod + 2, iLen, &tRow); +00191 case 8: +00192 return eGet8RowInfo(0, aucPropMod + 2, iLen, &tRow); +00193 default: +00194 DBG_DEC(iWordVersion); +00195 DBG_FIXME(); +00196 return found_nothing; +00197 } +00198 } /* end of ePropMod2RowInfo */ +