examples/PIPS/antiword/src/doclist.c

00001 /*
00002  * doclist.c
00003  * Copyright (C) 2004 A.J. van Os; Released under GNU GPL
00004  *
00005  * Description:
00006  * Build, read and destroy list(s) of Word document information
00007  *
00008  * Note:
00009  * There is no real list there is always one document per document
00010  */
00011 
00012 #include "antiword.h"
00013 
00014 #define HALF_INCH       36000L  /* In millipoints */
00015 
00016 /* Variables needed to write the Document Information List */
00017 static document_block_type *pAnchor = NULL;
00018 static document_block_type tInfo;
00019 
00020 
00021 /*
00022  * vDestroyDocumentInfoList - destroy the Document Information List
00023  */
00024 void
00025 vDestroyDocumentInfoList(void)
00026 {
00027         DBG_MSG("vDestroyDocumentInfoList");
00028 
00029         pAnchor = NULL;
00030 } /* end of vDestoryDocumentInfoList */
00031 
00032 /*
00033  * vCreateDocumentInfoList - create the Document Information List
00034  */
00035 void
00036 vCreateDocumentInfoList(const document_block_type *pDocument)
00037 {
00038         fail(pDocument == NULL);
00039         fail(pAnchor != NULL);
00040 
00041         tInfo = *pDocument;
00042         pAnchor = &tInfo;
00043 } /* end of vCreateDocumentInfoList */
00044 
00045 /*
00046  * lGetDefaultTabWidth - get the default tabwidth in millipoints
00047  */
00048 long
00049 lGetDefaultTabWidth(void)
00050 {
00051         long    lDefaultTabWidth;
00052         USHORT  usTmp;
00053 
00054         if (pAnchor == NULL) {
00055                 DBG_FIXME();
00056                 return HALF_INCH;
00057         }
00058         usTmp = pAnchor->usDefaultTabWidth;
00059         lDefaultTabWidth = usTmp == 0 ? HALF_INCH : lTwips2MilliPoints(usTmp);
00060         NO_DBG_DEC(lDefaultTabWidth);
00061         return lDefaultTabWidth;
00062 } /* end of lGetDefaultTabWidth */
00063 
00064 /*
00065  * ucGetDopHdrFtrSpecification - get the Heder/footer specification
00066  */
00067 UCHAR
00068 ucGetDopHdrFtrSpecification(void)
00069 {
00070         if (pAnchor == NULL) {
00071                 DBG_FIXME();
00072                 return 0x00;
00073         }
00074         return pAnchor->ucHdrFtrSpecification;
00075 } /* end of ucGetDopHdrFtrSpecification */

Generated by  doxygen 1.6.2