File: docField.h

package info (click to toggle)
ted 2.11-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 11,064 kB
  • ctags: 13,935
  • sloc: ansic: 120,446; makefile: 7,469; sh: 253
file content (238 lines) | stat: -rw-r--r-- 6,935 bytes parent folder | download
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
/************************************************************************/
/*									*/
/*  Fields: parts of the document that are calculated in stead of typed	*/
/*  by the user.							*/
/*									*/
/************************************************************************/

#   ifndef DOC_FIELD_H
#   define DOC_FIELD_H

#   include	<utilMemoryBuffer.h>
#   include	"docObject.h"

struct BufferItem;
struct BufferDocument;
struct DocumentField;

/************************************************************************/
/*									*/
/*  Kind of field. Is an index in a descriptive array of field kinds.	*/
/*									*/
/*  Fields in the 'Ted' sense are not necessarily fileds in the 'Word'	*/
/*  sense. Everything inside the text, that can possibly result in	*/
/*  a piece of document, but is possibly under the control of the	*/
/*  application is a field in the sense of 'Ted'.			*/
/*									*/
/*  FieldKindInformation:						*/
/*  a)  The (case insensitive) string that identifies the field in the	*/
/*	field instructions. NOTE that the notion of a field is abused	*/
/*	by 'Ted' for a few things that are not fields in MS-Word.	*/
/*  b)  Some things that are a destination in RTF are stored as a field	*/
/*	in Ted. This is the control word of the destination.		*/
/*  c)  The level at which this kind of field occurs.			*/
/*  d)  Tells whether this kind of field is a field in the RTF file.	*/
/*  e)  Tells whether this kind of field is a destination in the RTF	*/
/*	file.								*/
/*  f1) Recalculate a TEXT level field.					*/
/*  f2) Recalculate the string for a TEXT level field.			*/
/*  g)  When to recalculate fields in the text.				*/
/*  h)  Is the field result editable such as with a HYPERLINK or	*/
/*	readonly such as with a PAGEREF?				*/
/*									*/
/************************************************************************/

/*  f1  */
typedef int (*CALCULATE_TEXT_PARTICULES)(
				int *				pCalculated,
				struct BufferDocument *		bd,
				int *				pPartShift,
				int *				pStroffShift,
				struct BufferItem *		paraBi,
				int				part,
				int				partCount,
				struct DocumentField *		df,
				void *				voidadd,
				DOC_CLOSE_OBJECT		closeObject );

/*  f2  */
typedef int (*CALCULATE_TEXT_STRING)(
				int *				pCalculated,
				int *				pNewSize,
				unsigned char *			target,
				int				targetSize,
				struct BufferDocument *		bd,
				const struct BufferItem *	paraBi,
				int				part,
				int				partCount,
				const struct DocumentField *	df );

/*  g  */
#   define	FIELDdoNOTHING		0
#   define	FIELDdoNEVER		0
#   define	FIELDdoDOC_FORMATTED	(1<<0)
#   define	FIELDdoPAGE_NUMBER	(1<<1)
#   define	FIELDdoDOC_INFO		(1<<2)
#   define	FIELDdoDOC_COMPLETE	(1<<3)
#   define	FIELDdoCHFTN		(1<<4)

typedef struct FieldKindInformation
    {
    const char *		fkiLabel;			/*  a	*/
    const char *		fkiDestinationLabel;		/*  b	*/
    int				fkiLevel;			/*  c	*/
    int				fkiIsFieldInRtf;		/*  d	*/
    int				fkiIsDestinationInRtf;		/*  e	*/
    CALCULATE_TEXT_PARTICULES	fkiCalculateTextParticules;	/*  f1	*/
    CALCULATE_TEXT_STRING	fkiCalculateTextString;		/*  f2	*/
    unsigned int		fkiCalculateWhen;		/*  g	*/
    unsigned int		fkiResultEditable;		/*  h	*/
    } FieldKindInformation;

typedef enum FieldKind
    {
    DOCfkFREE= -1,
    DOCfkUNKNOWN= 0,
    DOCfkHYPERLINK,
    DOCfkXE,
    DOCfkTC,
    DOCfkTCN,
    DOCfkBOOKMARK,
    DOCfkPAGE,
    DOCfkPAGEREF,
    DOCfkNUMPAGES,
    DOCfkREF,

    DOCfkCREATEDATE,
    DOCfkSAVEDATE,
    DOCfkPRINTDATE,

    DOCfkAUTHOR,
    DOCfkCOMMENTS,
    DOCfkKEYWORDS,
    DOCfkSUBJECT,
    DOCfkTITLE,
    DOCfkFILENAME,

    DOCfkSYMBOL,
    DOCfkCHFTN,

    DOCfkINCLUDEPICTURE,

    DOCfk_COUNT
    } FieldKind;

typedef struct DocumentField
    {
    int			dfPage;
    FieldKind		dfKind;
    MemoryBuffer	dfData;
    MemoryBuffer	dfInstructions;
    } DocumentField;

typedef struct FieldInstructionsComponent
    {
    int		ficOffset;
    int		ficSize;
    } FieldInstructionsComponent;

#   define	DOCmaxBOOKMARK	39

typedef struct DocumentFieldList
    {
    DocumentField *	dflFields;
    int			dflFieldCount;
    } DocumentFieldList;

/************************************************************************/
/*									*/
/*  Field Kind Information.						*/
/*									*/
/************************************************************************/

extern const FieldKindInformation	DOC_FieldKinds[];
extern const int			DOC_FieldKindCount;

/************************************************************************/
/*									*/
/*  Pass through information for recalculating fields.			*/
/*									*/
/************************************************************************/

typedef struct RecalculateFields
    {
    struct BufferDocument *	rfBd;
    void *			rfVoidadd;
    DOC_CLOSE_OBJECT		rfCloseObject;
    unsigned int		rfFieldsUpdated;
    unsigned int		rfUpdateFlags;
    } RecalculateFields;

/************************************************************************/
/*									*/
/*  Administrative routines.						*/
/*									*/
/************************************************************************/

extern void docInitRecalculateFields(	RecalculateFields *	rf );

extern int docFieldGetSymbol(		const DocumentField *	df,
					const char **		pFontName,
					int *			pFontSize,
					const char **		pSymbName,
					int *			pSymbSize,
					const char **		pSizeString,
					int *			pSizeSize );

extern int docFieldGetHyperlink(	const DocumentField *	df,
					const char **		pFileName,
					int *			pFileSize,
					const char **		pMarkName,
					int *			pMarkSize );

extern int docFieldGetBookmark(		const DocumentField *	df,
					const char **		pMarkName,
					int *			pMarkSize );

extern int docFieldGetPageref(		const DocumentField *	df,
					const char **		pMarkName,
					int *			pMarkSize );

extern int docFieldGetIncludePicture(	const DocumentField *	df,
					const char **		pFileName,
					int *			pFileSize );

extern int docFieldGetRef(		const DocumentField *	df,
					const char **		pMarkName,
					int *			pMarkSize );

extern int docFieldSetBookmark(		DocumentField *		df,
					const unsigned char *	mark,
					int			markSize );

extern int docFieldSetRef(		DocumentField *		df,
					const unsigned char *	mark,
					int			markSize );

extern int docFieldSetPageref(		DocumentField *		df,
					const unsigned char *	mark,
					int			markSize );

extern void docInitField(		DocumentField *	df );

extern void docCleanField(		DocumentField *		df );

extern void docCleanFieldList(		DocumentFieldList *	dfl );
extern void docInitFieldList(		DocumentFieldList *	dfl );

DocumentField *	docClaimFieldCopy(	DocumentFieldList *	dfl,
					int *			pNr,
					const DocumentField *	dfFrom );

extern int docFieldSetHyperlink(	DocumentField *		df,
					const unsigned char *	fileName,
					int			fileSize,
					const unsigned char *	markName,
					int			markSize );

#   endif /*  DOC_FIELD_H  */