diff -r 59758314f811 -r d4524d6a4472 Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/output_8c_source.html --- a/Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/output_8c_source.html Fri Jun 11 15:24:34 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,559 +0,0 @@ - - - - -TB9.2 Example Applications: examples/PIPS/antiword/src/output.c Source File - - - - - -

examples/PIPS/antiword/src/output.c

00001 /*
-00002  * output.c
-00003  * Copyright (C) 2002-2004 A.J. van Os; Released under GNU GPL
-00004  *
-00005  * Description:
-00006  * Generic output generating functions
-00007  */
-00008 
-00009 #include "antiword.h"
-00010 
-00011 static conversion_type  eConversionType = conversion_unknown;
-00012 static encoding_type    eEncoding = encoding_neutral;
-00013 
-00014 
-00015 /*
-00016  * vPrologue1 - get options and call a specific initialization
-00017  */
-00018 static void
-00019 vPrologue1(diagram_type *pDiag, const char *szTask, const char *szFilename)
-00020 {
-00021         options_type    tOptions;
-00022 
-00023         fail(pDiag == NULL);
-00024         fail(szTask == NULL || szTask[0] == '\0');
-00025 
-00026         vGetOptions(&tOptions);
-00027         eConversionType = tOptions.eConversionType;
-00028         eEncoding = tOptions.eEncoding;
-00029 
-00030         switch (eConversionType) {
-00031         case conversion_text:
-00032                 vPrologueTXT(pDiag, &tOptions);
-00033                 break;
-00034         case conversion_fmt_text:
-00035                 vPrologueFMT(pDiag, &tOptions);
-00036                 break;
-00037         case conversion_ps:
-00038                 vProloguePS(pDiag, szTask, szFilename, &tOptions);
-00039                 break;
-00040         case conversion_xml:
-00041                 vPrologueXML(pDiag, &tOptions);
-00042                 break;
-00043         case conversion_pdf:
-00044                 vProloguePDF(pDiag, szTask, &tOptions);
-00045                 break;
-00046         default:
-00047                 DBG_DEC(eConversionType);
-00048                 break;
-00049         }
-00050 } /* end of vPrologue1 */
-00051 
-00052 /*
-00053  * vEpilogue - clean up after everything is done
-00054  */
-00055 static void
-00056 vEpilogue(diagram_type *pDiag)
-00057 {
-00058         switch (eConversionType) {
-00059         case conversion_text:
-00060         case conversion_fmt_text:
-00061                 vEpilogueTXT(pDiag->pOutFile);
-00062                 break;
-00063         case conversion_ps:
-00064                 vEpiloguePS(pDiag);
-00065                 break;
-00066         case conversion_xml:
-00067                 vEpilogueXML(pDiag);
-00068                 break;
-00069         case conversion_pdf:
-00070                 vEpiloguePDF(pDiag);
-00071                 break;
-00072         default:
-00073                 DBG_DEC(eConversionType);
-00074                 break;
-00075         }
-00076 } /* end of vEpilogue */
-00077 
-00078 /*
-00079  * vImagePrologue - perform image initialization
-00080  */
-00081 void
-00082 vImagePrologue(diagram_type *pDiag, const imagedata_type *pImg)
-00083 {
-00084         switch (eConversionType) {
-00085         case conversion_text:
-00086         case conversion_fmt_text:
-00087                 break;
-00088         case conversion_ps:
-00089                 vImageProloguePS(pDiag, pImg);
-00090                 break;
-00091         case conversion_xml:
-00092                 break;
-00093         case conversion_pdf:
-00094                 vImageProloguePDF(pDiag, pImg);
-00095                 break;
-00096         default:
-00097                 DBG_DEC(eConversionType);
-00098                 break;
-00099         }
-00100 } /* end of vImagePrologue */
-00101 
-00102 /*
-00103  * vImageEpilogue - clean up an image
-00104  */
-00105 void
-00106 vImageEpilogue(diagram_type *pDiag)
-00107 {
-00108         switch (eConversionType) {
-00109         case conversion_text:
-00110         case conversion_fmt_text:
-00111                 break;
-00112         case conversion_ps:
-00113                 vImageEpiloguePS(pDiag);
-00114                 break;
-00115         case conversion_xml:
-00116                 break;
-00117         case conversion_pdf:
-00118                 vImageEpiloguePDF(pDiag);
-00119                 break;
-00120         default:
-00121                 DBG_DEC(eConversionType);
-00122                 break;
-00123         }
-00124 } /* end of vImageEpilogue */
-00125 
-00126 /*
-00127  * bAddDummyImage - add a dummy image
-00128  *
-00129  * return TRUE when successful, otherwise FALSE
-00130  */
-00131 BOOL
-00132 bAddDummyImage(diagram_type *pDiag, const imagedata_type *pImg)
-00133 {
-00134         switch (eConversionType) {
-00135         case conversion_text:
-00136         case conversion_fmt_text:
-00137                 return FALSE;
-00138         case conversion_ps:
-00139                 return bAddDummyImagePS(pDiag, pImg);
-00140         case conversion_xml:
-00141                 return FALSE;
-00142         case conversion_pdf:
-00143                 return bAddDummyImagePDF(pDiag, pImg);
-00144         default:
-00145                 DBG_DEC(eConversionType);
-00146                 return FALSE;
-00147         }
-00148 } /* end of bAddDummyImage */
-00149 
-00150 /*
-00151  * pCreateDiagram - create and initialize a diagram
-00152  *
-00153  * remark: does not return if the diagram can't be created
-00154  */
-00155 FILE *fp;
-00156 diagram_type *
-00157 pCreateDiagram(const char *szTask, const char *szFilename, FILE *ofp)
-00158 {
-00159         diagram_type    *pDiag;
-00160 
-00161         fail(szTask == NULL || szTask[0] == '\0');
-00162         DBG_MSG("pCreateDiagram");
-00163 
-00164         /* Get the necessary memory */
-00165         pDiag = xmalloc(sizeof(diagram_type));
-00166         /* Initialization */
-00167         #ifndef SYMBIAN
-00168         pDiag->pOutFile = stdout;
-00169         #else
-00170         pDiag->pOutFile = /*stdout*/ofp;
-00171         #endif /*SYMBIAN*/
-00172         vPrologue1(pDiag, szTask, szFilename);
-00173         /* Return success */
-00174         return pDiag;
-00175 } /* end of pCreateDiagram */
-00176 
-00177 /*
-00178  * vDestroyDiagram - remove a diagram by freeing the memory it uses
-00179  */
-00180 void
-00181 vDestroyDiagram(diagram_type *pDiag)
-00182 {
-00183         DBG_MSG("vDestroyDiagram");
-00184 
-00185         fail(pDiag == NULL);
-00186 
-00187         if (pDiag == NULL) {
-00188                 return;
-00189         }
-00190         vEpilogue(pDiag);
-00191         pDiag = xfree(pDiag);
-00192 } /* end of vDestroyDiagram */
-00193 
-00194 /*
-00195  * vPrologue2 - call a specific initialization
-00196  */
-00197 void
-00198 vPrologue2(diagram_type *pDiag, int iWordVersion)
-00199 {
-00200         switch (eConversionType) {
-00201         case conversion_text:
-00202         case conversion_fmt_text:
-00203                 break;
-00204         case conversion_ps:
-00205                 vAddFontsPS(pDiag);
-00206                 break;
-00207         case conversion_xml:
-00208                 vCreateBookIntro(pDiag, iWordVersion);
-00209                 break;
-00210         case conversion_pdf:
-00211                 vCreateInfoDictionary(pDiag, iWordVersion);
-00212                 vAddFontsPDF(pDiag);
-00213                 break;
-00214         default:
-00215                 DBG_DEC(eConversionType);
-00216                 break;
-00217         }
-00218 } /* end of vPrologue2 */
-00219 
-00220 /*
-00221  * vMove2NextLine - move to the next line
-00222  */
-00223 void
-00224 vMove2NextLine(diagram_type *pDiag, drawfile_fontref tFontRef,
-00225         USHORT usFontSize)
-00226 {
-00227         fail(pDiag == NULL);
-00228         fail(pDiag->pOutFile == NULL);
-00229         fail(usFontSize < MIN_FONT_SIZE || usFontSize > MAX_FONT_SIZE);
-00230 
-00231         switch (eConversionType) {
-00232         case conversion_text:
-00233         case conversion_fmt_text:
-00234                 vMove2NextLineTXT(pDiag);
-00235                 break;
-00236         case conversion_ps:
-00237                 vMove2NextLinePS(pDiag, usFontSize);
-00238                 break;
-00239         case conversion_xml:
-00240                 vMove2NextLineXML(pDiag);
-00241                 break;
-00242         case conversion_pdf:
-00243                 vMove2NextLinePDF(pDiag, usFontSize);
-00244                 break;
-00245         default:
-00246                 DBG_DEC(eConversionType);
-00247                 break;
-00248         }
-00249 } /* end of vMove2NextLine */
-00250 
-00251 /*
-00252  * vSubstring2Diagram - put a sub string into a diagram
-00253  */
-00254 void
-00255 vSubstring2Diagram(diagram_type *pDiag,
-00256         char *szString, size_t tStringLength, long lStringWidth,
-00257         UCHAR ucFontColor, USHORT usFontstyle, drawfile_fontref tFontRef,
-00258         USHORT usFontSize, USHORT usMaxFontSize)
-00259 {
-00260         switch (eConversionType) {
-00261         case conversion_text:
-00262                 vSubstringTXT(pDiag, szString, tStringLength, lStringWidth);
-00263                 break;
-00264         case conversion_fmt_text:
-00265                 vSubstringFMT(pDiag, szString, tStringLength, lStringWidth,
-00266                                 usFontstyle);
-00267                 break;
-00268         case conversion_ps:
-00269                 vSubstringPS(pDiag, szString, tStringLength, lStringWidth,
-00270                                 ucFontColor, usFontstyle, tFontRef,
-00271                                 usFontSize, usMaxFontSize);
-00272                 break;
-00273         case conversion_xml:
-00274                 vSubstringXML(pDiag, szString, tStringLength, lStringWidth,
-00275                                 usFontstyle);
-00276                 break;
-00277         case conversion_pdf:
-00278                 vSubstringPDF(pDiag, szString, tStringLength, lStringWidth,
-00279                                 ucFontColor, usFontstyle, tFontRef,
-00280                                 usFontSize, usMaxFontSize);
-00281                 break;
-00282         default:
-00283                 DBG_DEC(eConversionType);
-00284                 break;
-00285         }
-00286         pDiag->lXleft += lStringWidth;
-00287 } /* end of vSubstring2Diagram */
-00288 
-00289 /*
-00290  * Create a start of paragraph (phase 1)
-00291  * Before indentation, list numbering, bullets etc.
-00292  */
-00293 void
-00294 vStartOfParagraph1(diagram_type *pDiag, long lBeforeIndentation)
-00295 {
-00296         fail(pDiag == NULL);
-00297 
-00298         switch (eConversionType) {
-00299         case conversion_text:
-00300         case conversion_fmt_text:
-00301                 vStartOfParagraphTXT(pDiag, lBeforeIndentation);
-00302                 break;
-00303         case conversion_ps:
-00304                 vStartOfParagraphPS(pDiag, lBeforeIndentation);
-00305                 break;
-00306         case conversion_xml:
-00307                 break;
-00308         case conversion_pdf:
-00309                 vStartOfParagraphPDF(pDiag, lBeforeIndentation);
-00310                 break;
-00311         default:
-00312                 DBG_DEC(eConversionType);
-00313                 break;
-00314         }
-00315 } /* end of vStartOfParagraph1 */
-00316 
-00317 /*
-00318  * Create a start of paragraph (phase 2)
-00319  * After indentation, list numbering, bullets etc.
-00320  */
-00321 void
-00322 vStartOfParagraph2(diagram_type *pDiag)
-00323 {
-00324         fail(pDiag == NULL);
-00325 
-00326         switch (eConversionType) {
-00327         case conversion_text:
-00328         case conversion_fmt_text:
-00329                 break;
-00330         case conversion_ps:
-00331                 break;
-00332         case conversion_xml:
-00333                 vStartOfParagraphXML(pDiag, 1);
-00334                 break;
-00335         case conversion_pdf:
-00336                 break;
-00337         default:
-00338                 DBG_DEC(eConversionType);
-00339                 break;
-00340         }
-00341 } /* end of vStartOfParagraph2 */
-00342 
-00343 /*
-00344  * Create an end of paragraph
-00345  */
-00346 void
-00347 vEndOfParagraph(diagram_type *pDiag,
-00348         drawfile_fontref tFontRef, USHORT usFontSize, long lAfterIndentation)
-00349 {
-00350         fail(pDiag == NULL);
-00351         fail(pDiag->pOutFile == NULL);
-00352         fail(usFontSize < MIN_FONT_SIZE || usFontSize > MAX_FONT_SIZE);
-00353         fail(lAfterIndentation < 0);
-00354 
-00355         switch (eConversionType) {
-00356         case conversion_text:
-00357         case conversion_fmt_text:
-00358                 vEndOfParagraphTXT(pDiag, lAfterIndentation);
-00359                 break;
-00360         case conversion_ps:
-00361                 vEndOfParagraphPS(pDiag, usFontSize, lAfterIndentation);
-00362                 break;
-00363         case conversion_xml:
-00364                 vEndOfParagraphXML(pDiag, 1);
-00365                 break;
-00366         case conversion_pdf:
-00367                 vEndOfParagraphPDF(pDiag, usFontSize, lAfterIndentation);
-00368                 break;
-00369         default:
-00370                 DBG_DEC(eConversionType);
-00371                 break;
-00372         }
-00373 } /* end of vEndOfParagraph */
-00374 
-00375 /*
-00376  * Create an end of page
-00377  */
-00378 void
-00379 vEndOfPage(diagram_type *pDiag, long lAfterIndentation, BOOL bNewSection)
-00380 {
-00381         switch (eConversionType) {
-00382         case conversion_text:
-00383         case conversion_fmt_text:
-00384                 vEndOfPageTXT(pDiag, lAfterIndentation);
-00385                 break;
-00386         case conversion_ps:
-00387                 vEndOfPagePS(pDiag, bNewSection);
-00388                 break;
-00389         case conversion_xml:
-00390                 vEndOfPageXML(pDiag);
-00391                 break;
-00392         case conversion_pdf:
-00393                 vEndOfPagePDF(pDiag, bNewSection);
-00394                 break;
-00395         default:
-00396                 DBG_DEC(eConversionType);
-00397                 break;
-00398         }
-00399 } /* end of vEndOfPage */
-00400 
-00401 /*
-00402  * vSetHeaders - set the headers
-00403  */
-00404 void
-00405 vSetHeaders(diagram_type *pDiag, USHORT usIstd)
-00406 {
-00407         switch (eConversionType) {
-00408         case conversion_text:
-00409         case conversion_fmt_text:
-00410                 break;
-00411         case conversion_ps:
-00412                 break;
-00413         case conversion_xml:
-00414                 vSetHeadersXML(pDiag, usIstd);
-00415                 break;
-00416         case conversion_pdf:
-00417                 break;
-00418         default:
-00419                 DBG_DEC(eConversionType);
-00420                 break;
-00421         }
-00422 } /* end of vSetHeaders */
-00423 
-00424 /*
-00425  * Create a start of list
-00426  */
-00427 void
-00428 vStartOfList(diagram_type *pDiag, UCHAR ucNFC, BOOL bIsEndOfTable)
-00429 {
-00430         switch (eConversionType) {
-00431         case conversion_text:
-00432         case conversion_fmt_text:
-00433                 break;
-00434         case conversion_ps:
-00435                 break;
-00436         case conversion_xml:
-00437                 vStartOfListXML(pDiag, ucNFC, bIsEndOfTable);
-00438                 break;
-00439         case conversion_pdf:
-00440                 break;
-00441         default:
-00442                 DBG_DEC(eConversionType);
-00443                 break;
-00444         }
-00445 } /* end of vStartOfList */
-00446 
-00447 /*
-00448  * Create an end of list
-00449  */
-00450 void
-00451 vEndOfList(diagram_type *pDiag)
-00452 {
-00453         switch (eConversionType) {
-00454         case conversion_text:
-00455         case conversion_fmt_text:
-00456                 break;
-00457         case conversion_ps:
-00458                 break;
-00459         case conversion_xml:
-00460                 vEndOfListXML(pDiag);
-00461                 break;
-00462         case conversion_pdf:
-00463                 break;
-00464         default:
-00465                 DBG_DEC(eConversionType);
-00466                 break;
-00467         }
-00468 } /* end of vEndOfList */
-00469 
-00470 /*
-00471  * Create a start of a list item
-00472  */
-00473 void
-00474 vStartOfListItem(diagram_type *pDiag, BOOL bNoMarks)
-00475 {
-00476         switch (eConversionType) {
-00477         case conversion_text:
-00478         case conversion_fmt_text:
-00479                 break;
-00480         case conversion_ps:
-00481                 break;
-00482         case conversion_xml:
-00483                 vStartOfListItemXML(pDiag, bNoMarks);
-00484                 break;
-00485         case conversion_pdf:
-00486                 break;
-00487         default:
-00488                 DBG_DEC(eConversionType);
-00489                 break;
-00490         }
-00491 } /* end of vStartOfListItem */
-00492 
-00493 /*
-00494  * Create an end of a table
-00495  */
-00496 void
-00497 vEndOfTable(diagram_type *pDiag)
-00498 {
-00499         switch (eConversionType) {
-00500         case conversion_text:
-00501         case conversion_fmt_text:
-00502                 break;
-00503         case conversion_ps:
-00504                 break;
-00505         case conversion_xml:
-00506                 vEndOfTableXML(pDiag);
-00507                 break;
-00508         case conversion_pdf:
-00509                 break;
-00510         default:
-00511                 DBG_DEC(eConversionType);
-00512                 break;
-00513         }
-00514 } /* end of vEndOfTable */
-00515 
-00516 /*
-00517  * Add a table row
-00518  *
-00519  * Returns TRUE when conversion type is XML
-00520  */
-00521 BOOL
-00522 bAddTableRow(diagram_type *pDiag, char **aszColTxt,
-00523         int iNbrOfColumns, const short *asColumnWidth, UCHAR ucBorderInfo)
-00524 {
-00525         switch (eConversionType) {
-00526         case conversion_text:
-00527         case conversion_fmt_text:
-00528                 break;
-00529         case conversion_ps:
-00530                 break;
-00531         case conversion_xml:
-00532                 vAddTableRowXML(pDiag, aszColTxt,
-00533                                 iNbrOfColumns, asColumnWidth,
-00534                                 ucBorderInfo);
-00535                 return TRUE;
-00536         case conversion_pdf:
-00537                 break;
-00538         default:
-00539                 DBG_DEC(eConversionType);
-00540                 break;
-00541         }
-00542         return FALSE;
-00543 } /* end of bAddTableRow */
-
-
Generated by  - -doxygen 1.6.2
- -