1 /************************************************************************/
2 /*									*/
3 /*  Exchange of section properties with RTF.				*/
4 /*									*/
5 /************************************************************************/
6 
7 #   include	"docRtfConfig.h"
8 
9 #   include	<stdio.h>
10 #   include	<ctype.h>
11 
12 #   include	<appDebugon.h>
13 
14 #   include	"docRtfReaderImpl.h"
15 #   include	<docTreeType.h>
16 #   include	<docTreeNode.h>
17 
18 /************************************************************************/
19 /*									*/
20 /*  Handle a section property when reading RTF.				*/
21 /*									*/
22 /************************************************************************/
23 
docRtfRememberSectionProperty(const RtfControlWord * rcw,int arg,RtfReader * rrc)24 int docRtfRememberSectionProperty(	const RtfControlWord *	rcw,
25 					int			arg,
26 					RtfReader *		rrc )
27     {
28     SectionProperties *		sp= &(rrc->rrcSectionProperties);
29 
30     if  ( rrc->rrcTree						&&
31 	  rrc->rrcTree->dtRoot					&&
32 	  rrc->rrcTree->dtRoot->biTreeType != DOCinBODY	)
33 	{
34 	/* SSDEB(docTreeTypeStr(rrc->rrcTree->dtRoot->biTreeType),rcw->rcwWord); */
35 	return 0;
36 	}
37 
38     switch( rcw->rcwID )
39 	{
40 	case SPprop_NONE:
41 	    {
42 	    const DocumentProperties *	dp;
43 
44 	    if  ( ! rrc->rrDocument )
45 		{ XDEB(rrc->rrDocument); return -1;	}
46 
47 	    dp= &(rrc->rrDocument->bdProperties);
48 
49 	    docCleanSectionProperties( sp );
50 	    docInitSectionProperties( sp );
51 	    rrc->rrcSectionColumn= 0;
52 
53 	    sp->spDocumentGeometry= dp->dpGeometry;
54 	    sp->spNotesProperties= dp->dpNotesProps;
55 	    }
56 	    return 0;
57 
58 	case SPpropSTYLE:
59 	    rrc->rrcStyle.dsLevel= DOClevSECT;
60 	    break;
61 
62 	/***/
63 	case SPprop_COLUMN_NUMBER:
64 	    rrc->rrcSectionColumn= arg- 1;
65 	    return 0;
66 
67 	case SPprop_COLUMN_WIDTH:
68 	    if  ( sp->spColumnCount < 2				||
69 		  rrc->rrcSectionColumn < 0			||
70 		  rrc->rrcSectionColumn >= sp->spColumnCount	)
71 		{
72 		/*LLDEB(rrc->rrcSectionColumn,sp->spColumnCount);*/
73 		return 0;
74 		}
75 
76 	    sp->spColumns[rrc->rrcSectionColumn].scColumnWidthTwips= arg;
77 	    return 0;
78 
79 	case SPprop_COLUMN_RIGHT:
80 	    if  ( sp->spColumnCount < 2				||
81 		  rrc->rrcSectionColumn < 0			||
82 		  rrc->rrcSectionColumn >= sp->spColumnCount	)
83 		{ LLDEB(rrc->rrcSectionColumn,sp->spColumnCount); return 0; }
84 
85 	    sp->spColumns[rrc->rrcSectionColumn].scSpaceToRightTwips= arg;
86 	    return 0;
87 	}
88 
89     if  ( docSetSectionProperty( sp, rcw->rcwID, arg ) < 0 )
90 	{ SLDEB(rcw->rcwWord,arg); return -1;	}
91 
92     PROPmaskADD( &(rrc->rrcSectionPropertyMask), rcw->rcwID );
93     PROPmaskADD( &(rrc->rrcStyle.dsSectMask), rcw->rcwID );
94 
95     return 0;
96     }
97 
98