1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <editeng/memberids.h>
21 #include <hintids.hxx>
22 #include <svx/unomid.hxx>
23 #include <xmloff/xmlnamespace.hxx>
24 #include "xmlitmap.hxx"
25 #include <xmloff/xmltoken.hxx>
26 #include <o3tl/safeint.hxx>
30 using namespace ::xmloff::token
;
32 #define MAP_ENTRY( p, l, w, m ) \
33 { XML_NAMESPACE_##p, XML_##l, o3tl::narrowing<sal_uInt16>(w), m }
34 #define M_E_SI( p, l, w, m ) \
35 { XML_NAMESPACE_##p, XML_##l, o3tl::narrowing<sal_uInt16>(w), MID_SW_FLAG_SPECIAL_ITEM_IMPORT|m }
36 #define M_E_SE( p, l, w, m ) \
37 { XML_NAMESPACE_##p, XML_##l, o3tl::narrowing<sal_uInt16>(w), MID_SW_FLAG_SPECIAL_ITEM_EXPORT|m }
38 #define M_E_SIE( p, l, w, m ) \
39 { XML_NAMESPACE_##p, XML_##l, o3tl::narrowing<sal_uInt16>(w), MID_SW_FLAG_SPECIAL_ITEM_EXPORT|MID_SW_FLAG_SPECIAL_ITEM_IMPORT|m }
41 const SvXMLItemMapEntry aTableItemMap
[] =
46 M_E_SE( STYLE
, WIDTH
, RES_FRM_SIZE
, MID_FRMSIZE_WIDTH
),
47 M_E_SE( STYLE
, REL_WIDTH
, RES_FRM_SIZE
, MID_FRMSIZE_REL_WIDTH
),
50 M_E_SE( FO
, MARGIN
, 0xFFFF/*invalid*/, MID_SW_FLAG_NO_ITEM_IMPORT
),
51 M_E_SIE( FO
, MARGIN_LEFT
, RES_LR_SPACE
, MID_L_MARGIN
),
52 M_E_SIE( FO
, MARGIN_RIGHT
, RES_LR_SPACE
, MID_R_MARGIN
),
54 M_E_SI( FO
, MARGIN_TOP
, RES_UL_SPACE
, MID_UP_MARGIN
),
55 M_E_SI( FO
, MARGIN_BOTTOM
, RES_UL_SPACE
, MID_LO_MARGIN
),
57 MAP_ENTRY( STYLE
, PAGE_NUMBER
, RES_PAGEDESC
, MID_PAGEDESC_PAGENUMOFFSET
),
59 MAP_ENTRY( FO
, BREAK_BEFORE
, RES_BREAK
, MID_BREAK_BEFORE
),
60 MAP_ENTRY( FO
, BREAK_AFTER
, RES_BREAK
, MID_BREAK_AFTER
),
78 MAP_ENTRY( TABLE
, ALIGN
, RES_HORI_ORIENT
, 0 ),
82 MAP_ENTRY( FO
, BACKGROUND_COLOR
, RES_BACKGROUND
, MID_BACK_COLOR
),
83 MAP_ENTRY( STYLE
, BACKGROUND_IMAGE
, RES_BACKGROUND
, MID_SW_FLAG_ELEMENT_ITEM
),
87 MAP_ENTRY( STYLE
, SHADOW
, RES_SHADOW
, 0 ),
93 MAP_ENTRY( FO
, KEEP_WITH_NEXT
, RES_KEEP
, 0 ),
96 // RES_EDIT_IN_READONLY
99 MAP_ENTRY( STYLE
, MAY_BREAK_BETWEEN_ROWS
, RES_LAYOUT_SPLIT
, 0 ),
108 // RES_UNKNOWNATR_CONTAINER
109 M_E_SE( TEXT
, XMLNS
, RES_UNKNOWNATR_CONTAINER
, 0 ),
112 MAP_ENTRY( STYLE
, WRITING_MODE
, RES_FRAMEDIR
, 0 ),
114 // RES_COLLAPSING_BORDERS
115 MAP_ENTRY( TABLE
, BORDER_MODEL
, RES_COLLAPSING_BORDERS
, 0 )
117 const o3tl::span
<SvXMLItemMapEntry
const> aXMLTableItemMap(aTableItemMap
);
119 const SvXMLItemMapEntry aTableColItemMap
[] =
121 M_E_SI( STYLE
, COLUMN_WIDTH
, RES_FRM_SIZE
, MID_FRMSIZE_COL_WIDTH
),
122 MAP_ENTRY( STYLE
, REL_COLUMN_WIDTH
, RES_FRM_SIZE
, MID_FRMSIZE_REL_COL_WIDTH
),
124 const o3tl::span
<SvXMLItemMapEntry
const> aXMLTableColItemMap(aTableColItemMap
);
126 const SvXMLItemMapEntry aTableRowItemMap
[] =
131 MAP_ENTRY( STYLE
, ROW_HEIGHT
, RES_FRM_SIZE
, MID_FRMSIZE_FIX_HEIGHT
),
132 MAP_ENTRY( STYLE
, MIN_ROW_HEIGHT
, RES_FRM_SIZE
, MID_FRMSIZE_MIN_HEIGHT
),
150 // M_E_SE( STYLE, TEXT_CHANGES_ONLY, RES_PRINT, 0 ),
151 M_E_SE( LO_EXT
, TEXT_CHANGES_ONLY
, RES_PRINT
, 0 ),
165 MAP_ENTRY( FO
, BACKGROUND_COLOR
, RES_BACKGROUND
, MID_BACK_COLOR
),
166 MAP_ENTRY( STYLE
, BACKGROUND_IMAGE
, RES_BACKGROUND
, MID_SW_FLAG_ELEMENT_ITEM
),
181 // RES_EDIT_IN_READONLY
184 M_E_SE( STYLE
, KEEP_TOGETHER
, RES_ROW_SPLIT
, 0 ),
185 M_E_SE( FO
, KEEP_TOGETHER
, RES_ROW_SPLIT
, 0 ),
194 // RES_UNKNOWNATR_CONTAINER
195 M_E_SE( TEXT
, XMLNS
, RES_UNKNOWNATR_CONTAINER
, 0 )
197 const o3tl::span
<SvXMLItemMapEntry
const> aXMLTableRowItemMap(aTableRowItemMap
);
199 const SvXMLItemMapEntry aTableCellItemMap
[] =
222 // M_E_SE( STYLE, TEXT_CHANGES_ONLY, RES_PRINT, 0 ),
223 M_E_SE( LO_EXT
, TEXT_CHANGES_ONLY
, RES_PRINT
, 0 ),
231 MAP_ENTRY( STYLE
, VERTICAL_ALIGN
, RES_VERT_ORIENT
, 0 ),
237 MAP_ENTRY( FO
, BACKGROUND_COLOR
, RES_BACKGROUND
, MID_BACK_COLOR
),
238 MAP_ENTRY( STYLE
, BACKGROUND_IMAGE
, RES_BACKGROUND
, MID_SW_FLAG_ELEMENT_ITEM
),
240 MAP_ENTRY( STYLE
, BORDER_LINE_WIDTH
, RES_BOX
, ALL_BORDER_LINE_WIDTH
),
241 MAP_ENTRY( STYLE
, BORDER_LINE_WIDTH_LEFT
, RES_BOX
, LEFT_BORDER_LINE_WIDTH
),
242 MAP_ENTRY( STYLE
, BORDER_LINE_WIDTH_RIGHT
, RES_BOX
, RIGHT_BORDER_LINE_WIDTH
),
243 MAP_ENTRY( STYLE
, BORDER_LINE_WIDTH_TOP
, RES_BOX
, TOP_BORDER_LINE_WIDTH
),
244 MAP_ENTRY( STYLE
, BORDER_LINE_WIDTH_BOTTOM
, RES_BOX
, BOTTOM_BORDER_LINE_WIDTH
),
245 MAP_ENTRY( FO
, PADDING
, RES_BOX
, ALL_BORDER_PADDING
),
246 MAP_ENTRY( FO
, PADDING_LEFT
, RES_BOX
, LEFT_BORDER_PADDING
),
247 MAP_ENTRY( FO
, PADDING_RIGHT
, RES_BOX
, RIGHT_BORDER_PADDING
),
248 MAP_ENTRY( FO
, PADDING_TOP
, RES_BOX
, TOP_BORDER_PADDING
),
249 MAP_ENTRY( FO
, PADDING_BOTTOM
, RES_BOX
, BOTTOM_BORDER_PADDING
),
250 MAP_ENTRY( FO
, BORDER
, RES_BOX
, ALL_BORDER
),
251 MAP_ENTRY( FO
, BORDER_LEFT
, RES_BOX
, LEFT_BORDER
),
252 MAP_ENTRY( FO
, BORDER_RIGHT
, RES_BOX
, RIGHT_BORDER
),
253 MAP_ENTRY( FO
, BORDER_TOP
, RES_BOX
, TOP_BORDER
),
254 MAP_ENTRY( FO
, BORDER_BOTTOM
, RES_BOX
, BOTTOM_BORDER
),
265 // RES_EDIT_IN_READONLY
277 // RES_UNKNOWNATR_CONTAINER
278 M_E_SE( TEXT
, XMLNS
, RES_UNKNOWNATR_CONTAINER
, 0 ),
281 MAP_ENTRY( STYLE
, WRITING_MODE
, RES_FRAMEDIR
, 0 ),
282 MAP_ENTRY( LO_EXT
, WRITING_MODE
, RES_FRAMEDIR
, 0 ),
284 const o3tl::span
<SvXMLItemMapEntry
const> aXMLTableCellItemMap(aTableCellItemMap
);
286 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */