doclist.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * doclist.c
  3. * Copyright (C) 2004 A.J. van Os; Released under GNU GPL
  4. *
  5. * Description:
  6. * Build, read and destroy list(s) of Word document information
  7. *
  8. * Note:
  9. * There is no real list there is always one document per document
  10. */
  11. #include "antiword.h"
  12. #define HALF_INCH 36000L /* In millipoints */
  13. /* Variables needed to write the Document Information List */
  14. static document_block_type *pAnchor = NULL;
  15. static document_block_type tInfo;
  16. /*
  17. * vDestroyDocumentInfoList - destroy the Document Information List
  18. */
  19. void
  20. vDestroyDocumentInfoList(void)
  21. {
  22. DBG_MSG("vDestroyDocumentInfoList");
  23. pAnchor = NULL;
  24. } /* end of vDestoryDocumentInfoList */
  25. /*
  26. * vCreateDocumentInfoList - create the Document Information List
  27. */
  28. void
  29. vCreateDocumentInfoList(const document_block_type *pDocument)
  30. {
  31. fail(pDocument == NULL);
  32. fail(pAnchor != NULL);
  33. tInfo = *pDocument;
  34. pAnchor = &tInfo;
  35. } /* end of vCreateDocumentInfoList */
  36. /*
  37. * lGetDefaultTabWidth - get the default tabwidth in millipoints
  38. */
  39. long
  40. lGetDefaultTabWidth(void)
  41. {
  42. long lDefaultTabWidth;
  43. USHORT usTmp;
  44. if (pAnchor == NULL) {
  45. DBG_FIXME();
  46. return HALF_INCH;
  47. }
  48. usTmp = pAnchor->usDefaultTabWidth;
  49. lDefaultTabWidth = usTmp == 0 ? HALF_INCH : lTwips2MilliPoints(usTmp);
  50. NO_DBG_DEC(lDefaultTabWidth);
  51. return lDefaultTabWidth;
  52. } /* end of lGetDefaultTabWidth */
  53. /*
  54. * ucGetDopHdrFtrSpecification - get the Heder/footer specification
  55. */
  56. UCHAR
  57. ucGetDopHdrFtrSpecification(void)
  58. {
  59. if (pAnchor == NULL) {
  60. DBG_FIXME();
  61. return 0x00;
  62. }
  63. return pAnchor->ucHdrFtrSpecification;
  64. } /* end of ucGetDopHdrFtrSpecification */