1 /************************************************************************/
2 /*									*/
3 /*  Save a BufferDocument into an RTF file.				*/
4 /*									*/
5 /************************************************************************/
6 
7 #   include	"docRtfConfig.h"
8 
9 #   include	<stdio.h>
10 #   include	<ctype.h>
11 
12 #   include	<appDebugon.h>
13 
14 #   include	"docRtfWriterImpl.h"
15 
16 /************************************************************************/
17 /*									*/
18 /*  Write a color table.						*/
19 /*									*/
20 /************************************************************************/
21 
docRtfWriteColorTable(RtfWriter * rwc,const DocumentProperties * dp)22 int docRtfWriteColorTable(	RtfWriter *			rwc,
23 				const DocumentProperties *	dp )
24     {
25     int				i;
26     const RGB8Color *		rgb8= dp->dpColorPalette->cpColors;
27 
28     docRtfWriteDestinationBegin( rwc, "colortbl" );
29     docRtfWriteNextLine( rwc );
30 
31     for ( i= 0; i < dp->dpColorPalette->cpColorCount; rgb8++, i++ )
32 	{
33 	if  ( i != dp->dpDefaultColor )
34 	    {
35 	    docRtfWriteArgTag( rwc, "red", rgb8->rgb8Red );
36 	    docRtfWriteArgTag( rwc, "green", rgb8->rgb8Green );
37 	    docRtfWriteArgTag( rwc, "blue", rgb8->rgb8Blue );
38 	    }
39 
40 	if  ( sioOutPutByte( ';', rwc->rwSosOut ) < 0 )
41 	    { LDEB(1); return -1;	}
42 
43 	rwc->rwCol += 1;
44 	docRtfWriteNextLine( rwc );
45 	}
46 
47     docRtfWriteDestinationEnd( rwc );
48     docRtfWriteNextLine( rwc );
49 
50     return 0;
51     }
52 
53