1 /************************************************************************/
2 /* */
3 /* Read/Write paragraph cell to/from 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 "docRtfWriterImpl.h"
15 # include "docRtfTags.h"
16
17 /************************************************************************/
18 /* */
19 /* Save Cell Properties. */
20 /* */
21 /************************************************************************/
22
docRtfSaveCellProperties(RtfWriter * rw,const PropertyMask * cpSetMask,const CellProperties * cpSet,int shiftLeft)23 void docRtfSaveCellProperties( RtfWriter * rw,
24 const PropertyMask * cpSetMask,
25 const CellProperties * cpSet,
26 int shiftLeft )
27 {
28 const int anyway= 0;
29
30 if ( PROPmaskISSET( cpSetMask, CLpropVALIGN ) )
31 {
32 docRtfWriteEnumTag( rw, DOCrtf_CellValignTags,
33 cpSet->cpValign,
34 DOCrtf_CellValignTagCount, DOCtva_COUNT );
35 }
36
37 if ( PROPmaskISSET( cpSetMask, CLpropHOR_MERGE ) )
38 {
39 docRtfWriteEnumTag( rw, DOCrtf_CellHorMergeTags,
40 cpSet->cpHorizontalMerge,
41 DOCrtf_CellHorMergeTagCount, CELLmerge_COUNT );
42 }
43
44 if ( PROPmaskISSET( cpSetMask, CLpropVERT_MERGE ) )
45 {
46 docRtfWriteEnumTag( rw, DOCrtf_CellVerMergeTags,
47 cpSet->cpVerticalMerge,
48 DOCrtf_CellVerMergeTagCount, CELLmerge_COUNT );
49 }
50
51 if ( PROPmaskISSET( cpSetMask, CLpropTOP_BORDER ) )
52 {
53 docRtfSaveBorderByNumber( rw, "clbrdrt",
54 cpSet->cpTopBorderNumber, anyway );
55 }
56 if ( PROPmaskISSET( cpSetMask, CLpropLEFT_BORDER ) )
57 {
58 docRtfSaveBorderByNumber( rw, "clbrdrl",
59 cpSet->cpLeftBorderNumber, anyway );
60 }
61 if ( PROPmaskISSET( cpSetMask, CLpropRIGHT_BORDER ) )
62 {
63 docRtfSaveBorderByNumber( rw, "clbrdrr",
64 cpSet->cpRightBorderNumber, anyway );
65 }
66 if ( PROPmaskISSET( cpSetMask, CLpropBOTTOM_BORDER ) )
67 {
68 docRtfSaveBorderByNumber( rw, "clbrdrb",
69 cpSet->cpBottomBorderNumber, anyway );
70 }
71
72 if ( PROPmaskISSET( cpSetMask, CLpropLEFT_PADDING_UNIT ) ||
73 PROPmaskISSET( cpSetMask, CLpropLEFT_PADDING ) )
74 {
75 /* NOTE: Word 2003 swaps left and top */
76 docRtfSaveAutoSpace( rw,
77 "clpadft", cpSet->cpLeftPaddingUnit,
78 "clpadt", cpSet->cpLeftPadding ); /* !!! */
79 }
80 if ( PROPmaskISSET( cpSetMask, CLpropTOP_PADDING_UNIT ) ||
81 PROPmaskISSET( cpSetMask, CLpropTOP_PADDING ) )
82 {
83 /* NOTE: Word 2003 swaps left and top */
84 docRtfSaveAutoSpace( rw,
85 "clpadfl", cpSet->cpTopPaddingUnit,
86 "clpadl", cpSet->cpTopPadding ); /* !!! */
87 }
88 if ( PROPmaskISSET( cpSetMask, CLpropRIGHT_PADDING_UNIT ) ||
89 PROPmaskISSET( cpSetMask, CLpropRIGHT_PADDING ) )
90 {
91 docRtfSaveAutoSpace( rw,
92 "clpadfr", cpSet->cpRightPaddingUnit,
93 "clpadr", cpSet->cpRightPadding );
94 }
95 if ( PROPmaskISSET( cpSetMask, CLpropBOTTOM_PADDING_UNIT ) ||
96 PROPmaskISSET( cpSetMask, CLpropBOTTOM_PADDING ) )
97 {
98 docRtfSaveAutoSpace( rw,
99 "clpadfb", cpSet->cpBottomPaddingUnit,
100 "clpadb", cpSet->cpBottomPadding );
101 }
102 if ( PROPmaskISSET( cpSetMask, CLpropCLFTS_WIDTH ) ||
103 PROPmaskISSET( cpSetMask, CLpropCLW_WIDTH ) )
104 {
105 docRtfSaveAutoSpace( rw,
106 "clftsWidth", cpSet->cpPreferredWidthUnit,
107 "clwWidth", cpSet->cpPreferredWidth );
108 }
109
110 if ( PROPmaskISSET( cpSetMask, CLpropSHADING ) )
111 {
112 docRtfSaveShadingByNumber( rw, cpSet->cpShadingNumber,
113 DOCrtf_CellShadingTags, DOCrtf_CellShadingTagCount,
114 "clcfpat", "clcbpat", "clshdng" );
115 }
116
117 /**/
118 if ( PROPmaskISSET( cpSetMask, CLpropTEXT_FLOW ) )
119 {
120 docRtfWriteEnumTag( rw, DOCrtf_CellTextFlowTags,
121 cpSet->cpTextFlow,
122 DOCrtf_CellTextFlowTagCount, TXflow_COUNT );
123 }
124
125 /* LAST! */
126 if ( PROPmaskISSET( cpSetMask, CLpropCELLX ) )
127 {
128 docRtfWriteArgTag( rw, "cellx",
129 cpSet->cpRightBoundaryTwips- shiftLeft );
130 }
131
132 docRtfWriteNextLine( rw );
133 }
134
135