summaryrefslogtreecommitdiff
path: root/sys/src/cmd/aux/antiword/doclist.c
blob: d4ac3802669ea4b941b3f29a9196827e543a8def (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
 * doclist.c
 * Copyright (C) 2004 A.J. van Os; Released under GNU GPL
 *
 * Description:
 * Build, read and destroy list(s) of Word document information
 *
 * Note:
 * There is no real list there is always one document per document
 */

#include "antiword.h"

#define HALF_INCH	36000L  /* In millipoints */

/* Variables needed to write the Document Information List */
static document_block_type *pAnchor = NULL;
static document_block_type tInfo;


/*
 * vDestroyDocumentInfoList - destroy the Document Information List
 */
void
vDestroyDocumentInfoList(void)
{
        DBG_MSG("vDestroyDocumentInfoList");

	pAnchor = NULL;
} /* end of vDestoryDocumentInfoList */

/*
 * vCreateDocumentInfoList - create the Document Information List
 */
void
vCreateDocumentInfoList(const document_block_type *pDocument)
{
	fail(pDocument == NULL);
	fail(pAnchor != NULL);

	tInfo = *pDocument;
	pAnchor = &tInfo;
} /* end of vCreateDocumentInfoList */

/*
 * lGetDefaultTabWidth - get the default tabwidth in millipoints
 */
long
lGetDefaultTabWidth(void)
{
	long	lDefaultTabWidth;
	USHORT	usTmp;

	if (pAnchor == NULL) {
		DBG_FIXME();
		return HALF_INCH;
	}
	usTmp = pAnchor->usDefaultTabWidth;
	lDefaultTabWidth = usTmp == 0 ? HALF_INCH : lTwips2MilliPoints(usTmp);
	NO_DBG_DEC(lDefaultTabWidth);
	return lDefaultTabWidth;
} /* end of lGetDefaultTabWidth */

/*
 * ucGetDopHdrFtrSpecification - get the Heder/footer specification
 */
UCHAR
ucGetDopHdrFtrSpecification(void)
{
	if (pAnchor == NULL) {
		DBG_FIXME();
		return 0x00;
	}
	return pAnchor->ucHdrFtrSpecification;
} /* end of ucGetDopHdrFtrSpecification */