1 #   ifndef		DOC_LAYOUT_POSITION_H
2 #   define		DOC_LAYOUT_POSITION_H
3 
4 #   include	<geo2DInteger.h>
5 
6 /************************************************************************/
7 /*									*/
8 /*  Used to layout lines of text.					*/
9 /*									*/
10 /*  A0 paper is 4* 29.7 cm high: 20* 28.3465* 4* 29.7= 67351.3 Twips.	*/
11 /*  So an unsigned short limits us to A1 paper.				*/
12 /*									*/
13 /************************************************************************/
14 
15 typedef struct LayoutPosition
16     {
17     int			lpPageYTwips;
18     unsigned short	lpPage;
19     unsigned char	lpColumn;
20     unsigned char	lpAtTopOfColumn;
21     } LayoutPosition;
22 
23 typedef struct BlockOrigin
24     {
25     int			boXShift;
26     int			boYShift;
27     LayoutPosition	boFrameOverride;
28     int			boOverrideFrame;
29     } BlockOrigin;
30 
31 # define DOC_SAME_FRAME( lp1, lp2 ) ( \
32 		    (lp1)->lpPage == (lp2)->lpPage		&& \
33 		    (lp1)->lpColumn == (lp2)->lpColumn		)
34 
35 # define DOC_SAME_POSITION( lp1, lp2 ) ( \
36 		    (lp1)->lpPageYTwips == (lp2)->lpPageYTwips	&& \
37 		    (lp1)->lpPage == (lp2)->lpPage		&& \
38 		    (lp1)->lpColumn == (lp2)->lpColumn		)
39 
40 # define DOC_COLUMN_AFTER( lp1, lp2 ) ( \
41 		    (lp1)->lpPage > (lp2)->lpPage		|| \
42 		    ( (lp1)->lpPage == (lp2)->lpPage && \
43 		      (lp1)->lpColumn >  (lp2)->lpColumn )		)
44 
45 #   define LPOSDEB(lp) appDebug( "%s(%3d): %s= [%2d.%d:%4d%c]\n",	\
46 			    __FILE__, __LINE__, #lp,		\
47 			    (lp)->lpPage, (lp)->lpColumn,	\
48 			    (lp)->lpPageYTwips,			\
49 			    (lp)->lpAtTopOfColumn?'^':'_' );
50 
51 /************************************************************************/
52 /*									*/
53 /*  Routine Declarations.						*/
54 /*									*/
55 /************************************************************************/
56 
57 extern void docInitLayoutPosition(	LayoutPosition *	lp );
58 extern void docInitBlockOrigin(		BlockOrigin *		bo );
59 
60 extern void docLayoutPushBottomDown(	LayoutPosition *	lpRowBottom,
61 					const LayoutPosition *	lpColBottom );
62 
63 extern void docLayoutPushBottomDownShifted(
64 					LayoutPosition *	lpRowBottom,
65 					const LayoutPosition *	lpColBottom,
66 					const BlockOrigin *	bo );
67 
68 extern void docShiftPosition(		LayoutPosition *	to,
69 					const BlockOrigin *	bo,
70 					const LayoutPosition *	from );
71 
72 extern int docCompareLayoutPositions(	const LayoutPosition *		lp1,
73 					const LayoutPosition *		lp2 );
74 
75 extern void docShiftRectangle(	DocumentRectangle *		to,
76 				const BlockOrigin *		bo,
77 				const DocumentRectangle *	from );
78 
79 #   endif	/*	DOC_LAYOUT_POSITION_H	*/
80