1 /************************************************************************/
2 /*									*/
3 /*  Row Properties.							*/
4 /*									*/
5 /************************************************************************/
6 
7 #   ifndef	DOC_ROW_PROPS_H
8 #   define	DOC_ROW_PROPS_H
9 
10 #   include	"docCellProperties.h"
11 #   include	"docDocumentAttributeMap.h"
12 
13 /************************************************************************/
14 /*									*/
15 /*  Row Properties.							*/
16 /*									*/
17 /************************************************************************/
18 
19 typedef struct RowProperties
20     {
21     int			rpCellCount;
22     CellProperties *	rpCells;
23 
24     int			rpHalfGapWidthTwips;
25     int			rpLeftIndentTwips;
26     int			rpHeightTwips;
27 
28     int			rpRowNumber;
29     int			rpRowBandNumber;
30     int			rpRowStyle;
31 
32 			/************************************************/
33 			/*  Row borders are not stored in the word	*/
34 			/*  binary format, and seem to be irrelevant	*/
35 			/************************************************/
36     int			rpTopBorderNumber;
37     int			rpLeftBorderNumber;
38     int			rpRightBorderNumber;
39     int			rpBottomBorderNumber;
40     int			rpVerticalBorderNumber;
41     int			rpHorizontalBorderNumber;
42 
43     int			rpShadingNumber;
44     int			rpFrameNumber;
45 
46     unsigned char	rpAlignment;
47 
48     unsigned char	rpIsTableHeader;
49     unsigned char	rpKeepOnOnePage;
50     unsigned char	rp_Keepfollow;	/*  derived property	*/
51     unsigned char	rpAutofit;
52 			/**
53 			 * 0: Cells in this table row will have left-to-right
54 			 *	precedence (the default)
55 			 * 1: Cells in this table row will have right-to-left
56 			 *	precedence
57 			 */
58     unsigned char	rpRToL;
59 
60     int			rpPreferredWidth;
61 
62     int			rpTopDefaultCellSpacing;
63     int			rpLeftDefaultCellSpacing;
64     int			rpRightDefaultCellSpacing;
65     int			rpBottomDefaultCellSpacing;
66 
67     int			rpTopCellPadding;
68     int			rpLeftCellPadding;
69     int			rpRightCellPadding;
70     int			rpBottomCellPadding;
71 
72     int			rpCellWidthBefore;
73     int			rpCellWidthAfter;
74 
75     int			rpAuthor;
76 
77 			/* TableAutoFormatUnit */
78     unsigned char	rpPreferredWidthUnit;
79 
80 			/* TableAutoFormatUnit */
81     unsigned char	rpTopDefaultCellSpacingUnit;
82     unsigned char	rpLeftDefaultCellSpacingUnit;
83     unsigned char	rpRightDefaultCellSpacingUnit;
84     unsigned char	rpBottomDefaultCellSpacingUnit;
85 
86 			/* TableAutoFormatUnit */
87     unsigned char	rpTopCellPaddingUnit;
88     unsigned char	rpLeftCellPaddingUnit;
89     unsigned char	rpRightCellPaddingUnit;
90     unsigned char	rpBottomCellPaddingUnit;
91 
92 			/* TableAutoFormatUnit */
93     unsigned char	rpCellWidthBeforeUnit;
94     unsigned char	rpCellWidthAfterUnit;
95 
96     unsigned char	rpAutoformatBorders;
97     unsigned char	rpAutoformatShading;
98     unsigned char	rpAutoformatFont;
99     unsigned char	rpAutoformatColor;
100     unsigned char	rpAutoformatApplyBestFit;
101     unsigned char	rpAutoformatFirstRow;
102     unsigned char	rpAutoformatLastRow;
103     unsigned char	rpAutoformatFirstColumn;
104     unsigned char	rpAutoformatLastColumn;
105 
106     unsigned char	rpIsLastRow;
107     } RowProperties;
108 
109 typedef enum RowProperty
110     {
111     RPprop_NONE= -1,
112 
113 		/**
114 		 *  The number of cells and their x position (cellx)
115 		 */
116     RPpropCELL_LAYOUT= 0,
117 		/**
118 		 *  Other cell properties such as borders and shading.
119 		 */
120     RPpropCELL_PROPS,
121 
122     RPpropGAP_WIDTH,
123     RPpropLEFT_INDENT,
124     RPpropHEIGHT,
125 
126     RPpropTOP_BORDER,
127     RPpropLEFT_BORDER,
128     RPpropRIGHT_BORDER,
129     RPpropBOTTOM_BORDER,
130     RPpropVERT_BORDER,
131     RPpropHORIZ_BORDER,
132 
133     RPpropSHADING,
134     RPpropFRAME,
135 
136     RPpropALIGNMENT,
137     RPpropIS_TABLE_HEADER,
138     RPpropKEEP_ON_ONE_PAGE,
139     RPpropAUTOFIT,
140     RPpropRTOL,
141 
142     /**/
143     RPpropTRW_WIDTH,
144     RPpropTRFTS_WIDTH,
145 
146     /**/
147     RPpropTRSPDT,
148     RPpropTRSPDL,
149     RPpropTRSPDR,
150     RPpropTRSPDB,
151 
152     RPpropTRPADDT,
153     RPpropTRPADDL,
154     RPpropTRPADDR,
155     RPpropTRPADDB,
156 
157     /**/
158     RPpropTRSPDFT,
159     RPpropTRSPDFL,
160     RPpropTRSPDFR,
161     RPpropTRSPDFB,
162 
163     RPpropTRPADDFT,
164     RPpropTRPADDFL,
165     RPpropTRPADDFR,
166     RPpropTRPADDFB,
167 
168     /**/
169     RPpropTRW_WIDTHB,
170     RPpropTRW_WIDTHA,
171 
172     RPpropTRFTS_WIDTHB,
173     RPpropTRFTS_WIDTHA,
174 
175     /**/
176     RPpropAUTOFORMAT_BORDERS,
177     RPpropAUTOFORMAT_SHADING,
178     RPpropAUTOFORMAT_FONT,
179     RPpropAUTOFORMAT_COLOR,
180     RPpropAUTOFORMAT_APPLY_BEST_FIT,
181     RPpropAUTOFORMAT_FIRST_ROW,
182     RPpropAUTOFORMAT_LAST_ROW,
183     RPpropAUTOFORMAT_FIRST_COLUMN,
184     RPpropAUTOFORMAT_LAST_COLUMN,
185 
186     RPpropROW_NUMBER,
187     RPpropROW_BAND_NUMBER,
188     RPpropROW_STYLE,
189 
190     RPpropIS_LAST_ROW,
191     RPpropTRAUTH,
192 
193     RPprop_COUNT,
194 
195     RPprop_IGNORED,		/*  For read/write/tool only	*/
196     RPprop_KEEPFOLLOW,		/*  For read/write/tool only	*/
197 
198     RPprop_FULL_COUNT
199     } RowProperty;
200 
201 # define RP_IS_ONE_PAGE( rp ) ( \
202 		    (rp)->rpKeepOnOnePage	|| \
203 		    (rp)->rp_Keepfollow		|| \
204 		    (rp)->rpHeightTwips != 0	|| \
205 		    (rp)->rpIsTableHeader	)
206 
207 /************************************************************************/
208 /*									*/
209 /*  Routine declarations.						*/
210 /*									*/
211 /************************************************************************/
212 
213 extern void docInitRowProperties(	RowProperties *		rp );
214 extern void docCleanRowProperties(	RowProperties *		rp );
215 
216 extern int docCopyRowProperties(	RowProperties *			to,
217 					const RowProperties *		from,
218 					const DocumentAttributeMap *	dam );
219 
220 extern int docInsertRowColumn(	RowProperties *			rp,
221 				int				n,
222 				int				shiftTail,
223 				const CellProperties *		cp,
224 				const DocumentAttributeMap *	dam );
225 
226 extern int docApproximatelyAlignedColumns(
227 				const RowProperties *	rp1,
228 				const RowProperties *	rp2 );
229 
230 extern int docUpdRowProperties(	PropertyMask *			pRpDonePask,
231 				RowProperties *			rp,
232 				const PropertyMask *		rpSetMask,
233 				const RowProperties *		rpSet,
234 				const DocumentAttributeMap *	dam );
235 
236 extern int docDeleteColumnsFromRow(
237 				RowProperties *			rp,
238 				int				col0,
239 				int				count,
240 				int				shiftTail );
241 
242 extern void docRowPropertiesSetWidth(	RowProperties *		rp,
243 					int			col0,
244 					int			col1,
245 					int			wide,
246 					int			victim,
247 					int			victimWide );
248 
249 extern int docSetRowProperty(		RowProperties *		rp,
250 					int			prop,
251 					int			arg );
252 
253 extern int docGetRowProperty(		const RowProperties *	rp,
254 					int			prop );
255 
256 extern int docEqualWidthColumns(	RowProperties *		rp,
257 					int			columns,
258 					int			wide,
259 					int			fsHalfPoints );
260 
261 extern int docColumnWidth(		const RowProperties *	rp,
262 					int			col );
263 extern int docColumnLeft(		const RowProperties *	rp,
264 					int			col );
265 extern int docColumnRight(		const RowProperties *	rp,
266 					int			col );
267 
268 extern int docRowPropertiesMakeColWider( RowProperties *	rp,
269 					int			col,
270 					int			wider );
271 
272 extern void docRowPropertyDifference(
273 				PropertyMask *			pRpDifPask,
274 				const RowProperties *		rp1,
275 				const PropertyMask *		rpCmpMask,
276 				const RowProperties *		rp2,
277 				const DocumentAttributeMap *	dam );
278 
279 extern int docCellRight(	int *			pColspan,
280 				const RowProperties *	rp,
281 				int			col );
282 
283 extern void docRowMaskToCellMask(	PropertyMask *		cellMask,
284 					const PropertyMask *	rowMask );
285 
286 extern void docRowMaskApplyCellMask(	PropertyMask *		rowMask,
287 					const PropertyMask *	cellMask );
288 
289 #   endif	/*  DOC_ROW_PROPS_H  */
290