1 /************************************************************************/
2 /*									*/
3 /*  Pieces of text, physically implemented as a 'Section' thay are	*/
4 /*  outside the normal flow of text.					*/
5 /*									*/
6 /************************************************************************/
7 
8 #   ifndef	DOC_EXTERNAL_ITEM_H
9 #   define	DOC_EXTERNAL_ITEM_H
10 
11 #   include	<docDocumentField.h>
12 #   include	<docListNumberTree.h>
13 
14 /************************************************************************/
15 /*									*/
16 /*  Forward declarations of structs.					*/
17 /*									*/
18 /************************************************************************/
19 
20 struct BufferDocument;
21 struct BufferItem;
22 struct DocumentField;
23 
24 /************************************************************************/
25 /*									*/
26 /*  Headers and/or footers appear on different pages, depending on	*/
27 /*  whether the section has a title page and/or the document has facing	*/
28 /*  pages. These are the options as they exist on the tool. In my	*/
29 /*  opinion these are also the possibilities from the users perspective.*/
30 /*									*/
31 /*  The arrays are a mapping from the options to the header/footer data	*/
32 /*  structure that is used in the implementation.			*/
33 /*									*/
34 /************************************************************************/
35 
36 typedef enum WhatPages
37     {
38     PAGES_FIRST_PAGE= 0,
39     PAGES_SUBSEQUENT_PAGES,
40     PAGES_ALL_PAGES,
41     PAGES_ODD_PAGES,
42     PAGES_EVEN_PAGES,
43     PAGES__COUNT
44     } WhatPages;
45 
46 extern const int DOC_HeaderScopes[PAGES__COUNT];
47 extern const int DOC_FooterScopes[PAGES__COUNT];
48 
49 /************************************************************************/
50 /*									*/
51 /*  A structure describing an external item.				*/
52 /*									*/
53 /************************************************************************/
54 
55 typedef struct DocumentTree
56     {
57     struct BufferItem *		dtRoot;
58     int				dtPageFormattedFor;
59     int				dtColumnFormattedFor;
60     int				dtY0UsedTwips;
61     int				dtY1UsedTwips;
62 				/**
63 				 *  The top position that is reserved for the
64 				 *  tree. For the page footers, this also
65 				 *  determines the page bottom for the body
66 				 *  text and the notes.
67 				 */
68     int				dtY0ReservedTwips;
69     int				dtY1ReservedTwips;
70 
71     int				dtPageSelectedUpon;
72     int				dtColumnSelectedIn;
73 
74     ListNumberTrees		dtListNumberTrees;
75     ListNumberTreeNode		dtOutlineTree;
76 
77     ChildFields			dtRootFields;
78     } DocumentTree;
79 
80 /************************************************************************/
81 /*									*/
82 /*  Routine declarations.						*/
83 /*									*/
84 /************************************************************************/
85 
86 extern void docInitDocumentTree(	DocumentTree *		dt );
87 
88 extern void docCleanDocumentTree(	struct BufferDocument *	bd,
89 					DocumentTree *		dt );
90 
91 extern void docInvalidateTreeLayout(	DocumentTree *		dt );
92 
93 extern int docAddRootFieldToTree(	DocumentTree *		dt,
94 					DocumentField *		dfCh );
95 
96 #   endif
97