xref: /aoo42x/main/sw/source/filter/xml/xmlitemm.cxx (revision efeef26f)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sw.hxx"
26 
27 
28 #include <editeng/memberids.hrc>
29 #include <hintids.hxx>
30 #include <svx/unomid.hxx>
31 #include <xmloff/xmlnmspe.hxx>
32 #include "xmlitmap.hxx"
33 #include <xmloff/xmltoken.hxx>
34 
35 #ifndef _UNOMID_H
36 #include <unomid.h>
37 #endif
38 
39 using namespace ::xmloff::token;
40 
41 #define MAP_ENTRY( p, l, w, m ) \
42 	{ XML_NAMESPACE_##p, XML_##l, w, m }
43 #define M_E_SI( p, l, w, m ) \
44 	{ XML_NAMESPACE_##p, XML_##l, w, MID_SW_FLAG_SPECIAL_ITEM_IMPORT|m }
45 #define M_E_SE( p, l, w, m ) \
46 	{ XML_NAMESPACE_##p, XML_##l, w, MID_SW_FLAG_SPECIAL_ITEM_EXPORT|m }
47 #define M_E_SIE( p, l, w, m ) \
48     { XML_NAMESPACE_##p, XML_##l, w, MID_SW_FLAG_SPECIAL_ITEM_EXPORT|MID_SW_FLAG_SPECIAL_ITEM_IMPORT|m }
49 
50 #define M_END { 0, XML_TOKEN_INVALID, 0, 0 }
51 
52 SvXMLItemMapEntry aXMLTableItemMap[] =
53 {
54 	// RES_FILL_ORDER
55 	// not required
56 	// RES_FRM_SIZE
57 	M_E_SE( STYLE,	WIDTH,			RES_FRM_SIZE,	MID_FRMSIZE_WIDTH ),
58 	M_E_SE( STYLE,	REL_WIDTH,		RES_FRM_SIZE,	MID_FRMSIZE_REL_WIDTH ),
59 	// RES_PAPER_BIN
60 	// not required
61 	// TODO: RES_LR_SPACE
62     M_E_SE( FO,     MARGIN,         0xFFFF/*invalid*/, MID_SW_FLAG_NO_ITEM_IMPORT),
63     M_E_SIE( FO,    MARGIN_LEFT,        RES_LR_SPACE,   MID_L_MARGIN ),
64     M_E_SIE( FO,    MARGIN_RIGHT,       RES_LR_SPACE,   MID_R_MARGIN ),
65 	// RES_UL_SPACE
66     M_E_SI( FO,     MARGIN_TOP,         RES_UL_SPACE,   MID_UP_MARGIN ),
67     M_E_SI( FO,     MARGIN_BOTTOM,      RES_UL_SPACE,   MID_LO_MARGIN ),
68 	// RES_PAGEDESC
69     MAP_ENTRY( STYLE,    PAGE_NUMBER,        RES_PAGEDESC,   MID_PAGEDESC_PAGENUMOFFSET),
70 	// RES_BREAK
71     MAP_ENTRY( FO,   BREAK_BEFORE,       RES_BREAK,  MID_BREAK_BEFORE ),
72     MAP_ENTRY( FO,   BREAK_AFTER,        RES_BREAK,  MID_BREAK_AFTER ),
73 	// RES_CNTNT
74 	// not required
75 	// RES_HEADER
76 	// not required
77 	// RES_FOOTER
78 	// not required
79 	// RES_PRINT
80 	// not required
81 	// RES_OPAQUE
82 	// not required
83 	// RES_PROTECT
84 	// not required
85 	// RES_SURROUND
86 	// not required
87 	// RES_VERT_ORIENT
88 	// not required
89 	// RES_HORI_ORIENT
90     MAP_ENTRY( TABLE,    ALIGN,                  RES_HORI_ORIENT, 0 ),
91 	// RES_ANCHOR
92 	// not required
93 	// RES_BACKGROUND
94     MAP_ENTRY( FO,   BACKGROUND_COLOR,       RES_BACKGROUND, MID_BACK_COLOR ),
95     MAP_ENTRY( STYLE,    BACKGROUND_IMAGE,       RES_BACKGROUND, MID_SW_FLAG_ELEMENT_ITEM ),
96 	// RES_BOX
97 	// not required
98 	// RES_SHADOW
99     MAP_ENTRY( STYLE,    SHADOW,             RES_SHADOW, 0 ),
100 	// RES_FRMMACRO
101 	// not required
102 	// RES_COL
103 	// not required
104 	// RES_KEEP
105     MAP_ENTRY( FO, KEEP_WITH_NEXT,       RES_KEEP, 0 ),
106 	// RES_URL
107 	// not required
108 	// RES_EDIT_IN_READONLY
109 	// not required
110 	// RES_LAYOUT_SPLIT
111     MAP_ENTRY( STYLE,    MAY_BREAK_BETWEEN_ROWS, RES_LAYOUT_SPLIT, 0 ),
112 	// RES_CHAIN
113 	// not required
114 	// RES_LINENUMBER
115 	// not required
116 	// RES_FTN_AT_TXTEND
117 	// not required
118 	// RES_END_AT_TXTEND
119 	// not required
120 	// RES_UNKNOWNATR_CONTAINER
121 	M_E_SE( TEXT, XMLNS, RES_UNKNOWNATR_CONTAINER, 0 ),
122 
123     // RES_FRAMEDIR
124     MAP_ENTRY( STYLE, WRITING_MODE, RES_FRAMEDIR, 0 ),
125 
126     // RES_COLLAPSING_BORDERS
127     MAP_ENTRY( TABLE, BORDER_MODEL, RES_COLLAPSING_BORDERS, 0 ),
128 
129     M_END
130 };
131 
132 SvXMLItemMapEntry aXMLTableColItemMap[] =
133 {
134 	M_E_SI( STYLE,	COLUMN_WIDTH,	  RES_FRM_SIZE,	MID_FRMSIZE_COL_WIDTH ),
135     MAP_ENTRY( STYLE,        REL_COLUMN_WIDTH, RES_FRM_SIZE, MID_FRMSIZE_REL_COL_WIDTH ),
136     M_END
137 };
138 
139 SvXMLItemMapEntry aXMLTableRowItemMap[] =
140 {
141 	// RES_FILL_ORDER
142 	// not required
143 	// RES_FRM_SIZE
144     MAP_ENTRY( STYLE,    ROW_HEIGHT,         RES_FRM_SIZE,   MID_FRMSIZE_FIX_HEIGHT ),
145     MAP_ENTRY( STYLE,    MIN_ROW_HEIGHT,     RES_FRM_SIZE,   MID_FRMSIZE_MIN_HEIGHT ),
146 	// RES_PAPER_BIN
147 	// not required
148 	// RES_LR_SPACE
149 	// not required
150 	// RES_UL_SPACE
151 	// not required
152 	// RES_PAGEDESC
153 	// not required
154 	// RES_BREAK
155 	// not required
156 	// RES_CNTNT
157 	// not required
158 	// RES_HEADER
159 	// not required
160 	// RES_FOOTER
161 	// not required
162 	// RES_PRINT
163 	// not required
164 	// RES_OPAQUE
165 	// not required
166 	// RES_PROTECT
167 	// not required
168 	// RES_SURROUND
169 	// not required
170 	// RES_VERT_ORIENT
171 	// not required
172 	// RES_HORI_ORIENT
173 	// not required
174 	// RES_ANCHOR
175 	// not required
176 	// RES_BACKGROUND
177     MAP_ENTRY( FO,   BACKGROUND_COLOR,       RES_BACKGROUND, MID_BACK_COLOR ),
178     MAP_ENTRY( STYLE,    BACKGROUND_IMAGE,       RES_BACKGROUND, MID_SW_FLAG_ELEMENT_ITEM ),
179 	// RES_BOX
180 	// not required
181 	// RES_ANCHOR
182 	// not required
183 	// RES_SHADOW
184 	// not required
185 	// RES_FRMMACRO
186 	// not required
187 	// RES_COL
188 	// not required
189 	// RES_KEEP
190 	// not required
191 	// RES_URL
192 	// not required
193 	// RES_EDIT_IN_READONLY
194 	// not required
195 	// RES_LAYOUT_SPLIT
196     M_E_SE( STYLE, KEEP_TOGETHER, RES_ROW_SPLIT, 0 ),
197     M_E_SE( FO, KEEP_TOGETHER, RES_ROW_SPLIT, 0 ),
198     // RES_CHAIN
199 	// not required
200 	// RES_LINENUMBER
201 	// not required
202 	// RES_FTN_AT_TXTEND
203 	// not required
204 	// RES_END_AT_TXTEND
205 	// not required
206 	// RES_UNKNOWNATR_CONTAINER
207 	M_E_SE( TEXT, XMLNS, RES_UNKNOWNATR_CONTAINER, 0 ),
208     M_END
209 };
210 
211 SvXMLItemMapEntry aXMLTableCellItemMap[] =
212 {
213 	// RES_FILL_ORDER
214 	// not required
215 	// RES_FRM_SIZE
216 	// not required
217 	// RES_PAPER_BIN
218 	// not required
219 	// RES_LR_SPACE
220 	// not required
221 	// RES_UL_SPACE
222 	// not required
223 	// RES_PAGEDESC
224 	// not required
225 	// RES_BREAK
226 	// not required
227 	// RES_CNTNT
228 	// not required
229 	// RES_HEADER
230 	// not required
231 	// RES_FOOTER
232 	// not required
233 	// RES_PRINT
234 	// not required
235 	// RES_OPAQUE
236 	// not required
237 	// RES_PROTECT
238 	// not required
239 	// RES_SURROUND
240 	// not required
241 	// RES_VERT_ORIENT
242     MAP_ENTRY( STYLE,    VERTICAL_ALIGN,                 RES_VERT_ORIENT, 0 ),
243 	// RES_HORI_ORIENT
244 	// not required
245 	// RES_ANCHOR
246 	// not required
247 	// RES_BACKGROUND
248     MAP_ENTRY( FO,   BACKGROUND_COLOR,       RES_BACKGROUND, MID_BACK_COLOR ),
249     MAP_ENTRY( STYLE,    BACKGROUND_IMAGE,       RES_BACKGROUND, MID_SW_FLAG_ELEMENT_ITEM ),
250 	// RES_BOX
251     MAP_ENTRY( STYLE,    BORDER_LINE_WIDTH,        RES_BOX, ALL_BORDER_LINE_WIDTH ),
252     MAP_ENTRY( STYLE,    BORDER_LINE_WIDTH_LEFT,   RES_BOX, LEFT_BORDER_LINE_WIDTH ),
253     MAP_ENTRY( STYLE,    BORDER_LINE_WIDTH_RIGHT,  RES_BOX, RIGHT_BORDER_LINE_WIDTH ),
254     MAP_ENTRY( STYLE,    BORDER_LINE_WIDTH_TOP,    RES_BOX, TOP_BORDER_LINE_WIDTH ),
255     MAP_ENTRY( STYLE,    BORDER_LINE_WIDTH_BOTTOM, RES_BOX, BOTTOM_BORDER_LINE_WIDTH ),
256     MAP_ENTRY( FO,   PADDING,                  RES_BOX, ALL_BORDER_PADDING ),
257     MAP_ENTRY( FO,   PADDING_LEFT,             RES_BOX, LEFT_BORDER_PADDING ),
258     MAP_ENTRY( FO,   PADDING_RIGHT,            RES_BOX, RIGHT_BORDER_PADDING ),
259     MAP_ENTRY( FO,   PADDING_TOP,              RES_BOX, TOP_BORDER_PADDING ),
260     MAP_ENTRY( FO,   PADDING_BOTTOM,           RES_BOX, BOTTOM_BORDER_PADDING ),
261     MAP_ENTRY( FO,   BORDER,                   RES_BOX, ALL_BORDER ),
262     MAP_ENTRY( FO,   BORDER_LEFT,              RES_BOX, LEFT_BORDER ),
263     MAP_ENTRY( FO,   BORDER_RIGHT,             RES_BOX, RIGHT_BORDER ),
264     MAP_ENTRY( FO,   BORDER_TOP,               RES_BOX, TOP_BORDER ),
265     MAP_ENTRY( FO,   BORDER_BOTTOM,            RES_BOX, BOTTOM_BORDER ),
266 	// RES_SHADOW
267 	// not required
268 	// RES_FRMMACRO
269 	// not required
270 	// RES_COL
271 	// not required
272 	// RES_KEEP
273 	// not required
274 	// RES_URL
275 	// not required
276 	// RES_EDIT_IN_READONLY
277 	// not required
278 	// RES_LAYOUT_SPLIT
279 	// not required
280 	// RES_CHAIN
281 	// not required
282 	// RES_LINENUMBER
283 	// not required
284 	// RES_FTN_AT_TXTEND
285 	// not required
286 	// RES_END_AT_TXTEND
287 	// not required
288 	// RES_UNKNOWNATR_CONTAINER
289 	M_E_SE( TEXT, XMLNS, RES_UNKNOWNATR_CONTAINER, 0 ),
290 
291     // RES_FRAMEDIR
292     MAP_ENTRY( STYLE, WRITING_MODE, RES_FRAMEDIR, 0 ),
293 
294     M_END
295 };
296