1 /************************************************************************/
2 /*									*/
3 /*  Item Shading.							*/
4 /*									*/
5 /************************************************************************/
6 
7 #   ifndef	DOC_ITEM_SHADING_H
8 #   define	DOC_ITEM_SHADING_H
9 
10 #   include	<utilPropMask.h>
11 #   include	<utilColor.h>
12 #   include	<utilPalette.h>
13 
14 /************************************************************************/
15 /*									*/
16 /*  1)  The shading of a BufferItem such as a table cell or a		*/
17 /*	paragraph.							*/
18 /*  2)  Numbers for the properties.					*/
19 /*  3)  Expanded form of the shading for the use in tools. (Remove the	*/
20 /*	indirection via the palette).					*/
21 /*									*/
22 /************************************************************************/
23 
24 /*  1  */
25 typedef struct ItemShading
26     {
27     short		isBackColor;
28     short		isForeColor;
29 
30     unsigned short	isLevel;
31     unsigned char	isPattern;
32     } ItemShading;
33 
34 # define DOCisSHADING(is) ((is)->isBackColor!=0||(is)->isForeColor!=0)
35 
36 /*  2  */
37 typedef enum ShadingProperty
38     {
39     ISprop_NONE= -1,
40 
41     ISpropBACK_COLOR= 0,
42     ISpropFORE_COLOR,
43     ISpropLEVEL,
44     ISpropPATTERN,
45 
46     ISprop_COUNT,
47 
48     ISpropBACK_SOLID,
49 
50     ISprop_FULL_COUNT
51     } ShadingProperty;
52 
53 /*  3  */
54 typedef struct ExpandedItemShading
55     {
56     int			eisBackColorExplicit;
57     int			eisForeColorExplicit;
58     RGB8Color		eisBackColor;
59     RGB8Color		eisForeColor;
60 
61     unsigned int	eisLevel;
62     unsigned int	eisPattern;
63     } ExpandedItemShading;
64 
65 #   define	docCopyItemShading( is1, is2 ) *(is1)= *(is2)
66 #   define	docCleanItemShading( is ) /*void*/
67 
68 /************************************************************************/
69 /*									*/
70 /*  Routine declarations.						*/
71 /*									*/
72 /************************************************************************/
73 
74 extern void docInitItemShading(		ItemShading *		is );
75 extern void docInitExpandedItemShading(	ExpandedItemShading *	eis );
76 
77 extern void docUpdateItemShading(
78 				PropertyMask *			pIsDoneMask,
79 				ItemShading *			isTo,
80 				const PropertyMask *		isSetMask,
81 				const ItemShading *		isFrom,
82 				const int *			colorMap );
83 
84 extern void docUpdateExpandedItemShading(
85 				PropertyMask *			pIsDoneMask,
86 				ExpandedItemShading *		eisTo,
87 				const PropertyMask *		isSetMask,
88 				const ExpandedItemShading *	eisFrom );
89 
90 extern void docExpandItemShading(	ExpandedItemShading *	eis,
91 					const ItemShading *	is,
92 					const ColorPalette *	cp );
93 
94 extern int docIndirectItemShading(
95 				PropertyMask *			pDoneMask,
96 				ItemShading *			is,
97 				const PropertyMask *		setMask,
98 				const ExpandedItemShading *	eis,
99 				ColorPalette *			cp );
100 
101 extern int docSetShadingProperty(	ItemShading *		is,
102 					int			prop,
103 					int			arg );
104 
105 extern int docGetShadingProperty(	const ItemShading *	is,
106 					int			prop );
107 
108 #   endif	/*  DOC_ITEM_SHADING_H  */
109