tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / sc / source / filter / xml / xmlstyle.cxx
blob7f98e13be3f99bb23d3020b42f2e3789f65d442b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 "xmlstyle.hxx"
21 #include "xmlexprt.hxx"
23 #include <rangeutl.hxx>
24 #include <unonames.hxx>
26 #include <o3tl/safeint.hxx>
27 #include <xmloff/xmlnamespace.hxx>
28 #include <xmloff/xmltypes.hxx>
29 #include <xmloff/families.hxx>
30 #include <xmloff/contextid.hxx>
31 #include <xmloff/txtprmap.hxx>
32 #include <xmloff/XMLComplexColorHandler.hxx>
33 #include <xmloff/XMLComplexColorExport.hxx>
34 #include <docmodel/color/ComplexColor.hxx>
35 #include <docmodel/uno/UnoComplexColor.hxx>
36 #include <sax/tools/converter.hxx>
37 #include <com/sun/star/util/CellProtection.hpp>
38 #include <com/sun/star/table/CellOrientation.hpp>
39 #include <com/sun/star/table/CellVertJustify2.hpp>
40 #include <com/sun/star/table/CellHoriJustify.hpp>
41 #include <com/sun/star/table/CellJustifyMethod.hpp>
42 #include <com/sun/star/table/BorderLine2.hpp>
43 #include <com/sun/star/util/XComplexColor.hpp>
44 #include <com/sun/star/sheet/XSheetConditionalEntry.hpp>
45 #include <com/sun/star/sheet/XSheetCondition.hpp>
46 #include <com/sun/star/beans/XPropertySet.hpp>
47 #include <com/sun/star/container/XIndexAccess.hpp>
48 #include <comphelper/extract.hxx>
50 #include <rtl/ustrbuf.hxx>
51 #include <osl/diagnose.h>
53 using namespace com::sun::star;
54 using namespace ::xmloff::token;
55 using namespace ::formula;
57 #define MAP(name,prefix,token,type,context) { name, prefix, token, type, context, SvtSaveOptions::ODFSVER_010, false }
58 #define MAP_ODF13(name,prefix,token,type,context) { name, prefix, token, type, context, SvtSaveOptions::ODFSVER_013, false }
59 // extensions import/export
60 #define MAP_EXT(name,prefix,token,type,context) { name, prefix, token, type, context, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, false }
61 // extensions import only
62 #define MAP_EXT_I(name,prefix,token,type,context) { name, prefix, token, type, context, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, true }
63 #define MAP_END() { nullptr }
65 const XMLPropertyMapEntry aXMLScCellStylesProperties[] =
67 MAP( SC_UNONAME_ASIANVERT, XML_NAMESPACE_STYLE, XML_GLYPH_ORIENTATION_VERTICAL, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_VERTICAL, 0),
68 MAP( SC_UNONAME_BOTTBORDER, XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_BOTTOMBORDER ),
69 MAP( SC_UNONAME_BOTTBORDER, XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_BOTTOMBORDERWIDTH ),
70 MAP_EXT(SC_UNONAME_BOTTOM_BORDER_COMPLEX_COLOR, XML_NAMESPACE_LO_EXT, XML_BORDER_BOTTOM_COMPLEX_COLOR, XML_TYPE_PROP_TABLE_CELL | XML_TYPE_COMPLEX_COLOR | MID_FLAG_ELEMENT_ITEM, CTF_COMPLEX_COLOR),
71 MAP( SC_UNONAME_CELLBACK, XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
72 MAP_EXT( SC_UNONAME_CELL_BACKGROUND_COMPLEX_COLOR, XML_NAMESPACE_LO_EXT, XML_BACKGROUND_COMPLEX_COLOR, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_COMPLEX_COLOR|MID_FLAG_ELEMENT_ITEM, CTF_COMPLEX_COLOR),
73 MAP( SC_UNONAME_CELLPRO, XML_NAMESPACE_STYLE, XML_CELL_PROTECT, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_CELLPROTECTION|MID_FLAG_MERGE_PROPERTY, 0 ),
74 MAP( SC_UNONAME_CELLPRO, XML_NAMESPACE_STYLE, XML_PRINT_CONTENT, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_PRINTCONTENT|MID_FLAG_MERGE_PROPERTY, 0 ),
75 MAP( SC_UNONAME_CELLSTYL, XML_NAMESPACE_STYLE, XML_STYLE, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_STRING, CTF_SC_CELLSTYLE ),
76 MAP( SC_UNONAME_CONDXML, XML_NAMESPACE_STYLE, XML_MAP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_IMPORT_MAP ),
77 MAP( SC_UNONAME_CONDXML, XML_NAMESPACE_STYLE, XML_MAP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_MAP ),
78 MAP( SC_UNONAME_DIAGONAL_BLTR, XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_DIAGONALBLTR ),
79 MAP( SC_UNONAME_DIAGONAL_BLTR, XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR_WIDTH, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_DIAGONALBLTRWIDTH ), // #i102690# for old files
80 MAP( SC_UNONAME_DIAGONAL_BLTR, XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR_WIDTHS, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_DIAGONALBLTRWIDTHS ),
81 MAP( SC_UNONAME_DIAGONAL_TLBR, XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_DIAGONALTLBR ),
82 MAP( SC_UNONAME_DIAGONAL_TLBR, XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR_WIDTH, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_DIAGONALTLBRWIDTH ), // #i102690# for old files
83 MAP( SC_UNONAME_DIAGONAL_TLBR, XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR_WIDTHS, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_DIAGONALTLBRWIDTHS ),
84 MAP( SC_UNONAME_CELLHJUS, XML_NAMESPACE_FO, XML_TEXT_ALIGN, XML_TYPE_PROP_PARAGRAPH|XML_SC_TYPE_HORIJUSTIFY|MID_FLAG_MERGE_PROPERTY, 0 ),
85 MAP( SC_UNONAME_CELLHJUS, XML_NAMESPACE_STYLE, XML_TEXT_ALIGN_SOURCE, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_HORIJUSTIFYSOURCE|MID_FLAG_MERGE_PROPERTY, 0 ),
86 MAP( SC_UNONAME_CELLHJUS, XML_NAMESPACE_STYLE, XML_REPEAT_CONTENT, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_HORIJUSTIFYREPEAT|MID_FLAG_MERGE_PROPERTY, 0 ),
87 // FIXME this was wrongly exported to STYLE namespace since 2013
88 MAP_EXT( SC_UNONAME_HYPERLINK, XML_NAMESPACE_STYLE, XML_HYPERLINK, XML_TYPE_PROP_TABLE_CELL | XML_TYPE_STRING | MID_FLAG_ELEMENT_ITEM, CTF_SC_HYPERLINK ),
89 MAP_EXT( SC_UNONAME_HYPERLINK, XML_NAMESPACE_LO_EXT, XML_HYPERLINK, XML_TYPE_PROP_TABLE_CELL | XML_TYPE_STRING | MID_FLAG_ELEMENT_ITEM, CTF_SC_HYPERLINK ),
90 MAP_EXT( SC_UNONAME_CELLHJUS_METHOD, XML_NAMESPACE_CSS3TEXT, XML_TEXT_JUSTIFY, XML_TYPE_PROP_PARAGRAPH|XML_SC_TYPE_HORIJUSTIFY_METHOD, 0 ),
91 MAP( SC_UNONAME_CELLTRAN, XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_ISTRANSPARENT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
92 MAP( SC_UNONAME_WRAP, XML_NAMESPACE_FO, XML_WRAP_OPTION, XML_TYPE_PROP_TABLE_CELL|XML_SC_ISTEXTWRAPPED, 0 ),
93 MAP( SC_UNONAME_LEFTBORDER, XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_ALLBORDER ),
94 MAP( SC_UNONAME_LEFTBORDER, XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_LEFTBORDER ),
95 MAP_EXT(SC_UNONAME_LEFT_BORDER_COMPLEX_COLOR, XML_NAMESPACE_LO_EXT, XML_BORDER_LEFT_COMPLEX_COLOR, XML_TYPE_PROP_TABLE_CELL | XML_TYPE_COMPLEX_COLOR | MID_FLAG_ELEMENT_ITEM, CTF_COMPLEX_COLOR),
96 MAP( SC_UNONAME_LEFTBORDER, XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_ALLBORDERWIDTH ),
97 MAP( SC_UNONAME_LEFTBORDER, XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_LEFTBORDERWIDTH ),
98 MAP( SC_UNONAME_NUMFMT, XML_NAMESPACE_STYLE, XML_DATA_STYLE_NAME, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_NUMBER|MID_FLAG_SPECIAL_ITEM, CTF_SC_NUMBERFORMAT),
99 MAP( SC_UNONAME_ORIENT, XML_NAMESPACE_STYLE, XML_DIRECTION, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_ORIENTATION, 0 ),
100 MAP( SC_UNONAME_PBMARGIN, XML_NAMESPACE_FO, XML_PADDING, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_ALLPADDING ),
101 MAP( SC_UNONAME_PBMARGIN, XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_BOTTOMPADDING ),
102 MAP( SC_UNONAME_PINDENT, XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_PROP_PARAGRAPH|XML_TYPE_MEASURE16, 0 ),
103 MAP( SC_UNONAME_PLMARGIN, XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_LEFTPADDING ),
104 MAP( SC_UNONAME_PRMARGIN, XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_RIGHTPADDING ),
105 MAP( SC_UNONAME_PTMARGIN, XML_NAMESPACE_FO, XML_PADDING_TOP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_TOPPADDING ),
106 MAP( SC_UNONAME_RIGHTBORDER, XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_RIGHTBORDER ),
107 MAP( SC_UNONAME_RIGHTBORDER, XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_RIGHTBORDERWIDTH ),
108 MAP_EXT(SC_UNONAME_RIGHT_BORDER_COMPLEX_COLOR, XML_NAMESPACE_LO_EXT, XML_BORDER_RIGHT_COMPLEX_COLOR, XML_TYPE_PROP_TABLE_CELL | XML_TYPE_COMPLEX_COLOR | MID_FLAG_ELEMENT_ITEM, CTF_COMPLEX_COLOR),
109 MAP( SC_UNONAME_ROTANG, XML_NAMESPACE_STYLE, XML_ROTATION_ANGLE, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_ROTATEANGLE, 0 ),
110 MAP( SC_UNONAME_ROTREF, XML_NAMESPACE_STYLE, XML_ROTATION_ALIGN, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_ROTATEREFERENCE, 0),
111 MAP( SC_UNONAME_SHADOW, XML_NAMESPACE_STYLE, XML_SHADOW, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_TEXT_SHADOW, 0 ),
112 MAP( SC_UNONAME_SHRINK_TO_FIT, XML_NAMESPACE_STYLE, XML_SHRINK_TO_FIT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BOOL, 0 ),
113 MAP( SC_UNO_STANDARDDEC, XML_NAMESPACE_STYLE, XML_DECIMAL_PLACES, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_NUMBER16, 0 ),
114 MAP( SC_UNONAME_TOPBORDER, XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_TOPBORDER ),
115 MAP( SC_UNONAME_TOPBORDER, XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_TOPBORDERWIDTH ),
116 MAP_EXT(SC_UNONAME_TOP_BORDER_COMPLEX_COLOR, XML_NAMESPACE_LO_EXT, XML_BORDER_TOP_COMPLEX_COLOR, XML_TYPE_PROP_TABLE_CELL | XML_TYPE_COMPLEX_COLOR | MID_FLAG_ELEMENT_ITEM, CTF_COMPLEX_COLOR),
117 MAP( SC_UNONAME_USERDEF, XML_NAMESPACE_TEXT, XML_XMLNS, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),
118 MAP( SC_UNONAME_VALIXML, XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BUILDIN_CMP_ONLY, CTF_SC_VALIDATION ),
119 MAP( SC_UNONAME_CELLVJUS, XML_NAMESPACE_STYLE, XML_VERTICAL_ALIGN, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_VERTJUSTIFY, 0),
120 MAP_EXT_I( SC_UNONAME_CELLVJUS_METHOD, XML_NAMESPACE_STYLE, XML_VERTICAL_JUSTIFY, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_VERTJUSTIFY_METHOD, 0 ), // proposed ODF 1.2+
121 MAP_EXT( SC_UNONAME_CELLVJUS_METHOD, XML_NAMESPACE_LO_EXT, XML_VERTICAL_JUSTIFY, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_VERTJUSTIFY_METHOD, 0 ), // extension namespace
122 MAP_END()
125 const XMLPropertyMapEntry aXMLScColumnStylesProperties[] =
127 MAP( SC_UNONAME_MANPAGE, XML_NAMESPACE_FO, XML_BREAK_BEFORE, XML_TYPE_PROP_TABLE_COLUMN|XML_SC_TYPE_BREAKBEFORE, 0),
128 MAP( SC_UNONAME_CELLVIS, XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TYPE_PROP_TABLE_COLUMN|XML_SC_TYPE_EQUAL|MID_FLAG_SPECIAL_ITEM, CTF_SC_ISVISIBLE ),
129 MAP( SC_UNONAME_CELLWID, XML_NAMESPACE_STYLE, XML_COLUMN_WIDTH, XML_TYPE_PROP_TABLE_COLUMN|XML_TYPE_MEASURE, 0 ),
130 MAP_END()
133 const XMLPropertyMapEntry aXMLScRowStylesImportProperties[] =
135 // #i57867# Include background color (CellBackColor/IsCellBackgroundTransparent) for import only.
136 // Import and export should use the same map, with MID_FLAG_NO_PROPERTY_EXPORT for the background entries,
137 // but this doesn't work at the moment because SvXMLImportPropertyMapper compares MID_FLAG_NO_PROPERTY to 0.
138 // If this is changed (not for 2.0.x), a single map can be used again.
140 MAP( SC_UNONAME_CELLBACK, XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
141 MAP( SC_UNONAME_CELLHGT, XML_NAMESPACE_STYLE, XML_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_MEASURE, CTF_SC_ROWHEIGHT),
142 MAP( SC_UNONAME_CELLTRAN, XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_ISTRANSPARENT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
143 MAP_EXT( SC_UNONAME_CELL_BACKGROUND_COMPLEX_COLOR, XML_NAMESPACE_LO_EXT, XML_BACKGROUND_COMPLEX_COLOR, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_COMPLEX_COLOR, CTF_COMPLEX_COLOR ),
144 MAP( SC_UNONAME_MANPAGE, XML_NAMESPACE_FO, XML_BREAK_BEFORE, XML_TYPE_PROP_TABLE_ROW|XML_SC_TYPE_BREAKBEFORE, CTF_SC_ROWBREAKBEFORE),
145 MAP( SC_UNONAME_OHEIGHT, XML_NAMESPACE_STYLE, XML_USE_OPTIMAL_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_BOOL, CTF_SC_ROWOPTIMALHEIGHT),
146 MAP_END()
149 const XMLPropertyMapEntry aXMLScRowStylesProperties[] =
151 MAP( SC_UNONAME_CELLHGT, XML_NAMESPACE_STYLE, XML_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_MEASURE, CTF_SC_ROWHEIGHT),
152 MAP( SC_UNONAME_MANPAGE, XML_NAMESPACE_FO, XML_BREAK_BEFORE, XML_TYPE_PROP_TABLE_ROW|XML_SC_TYPE_BREAKBEFORE, CTF_SC_ROWBREAKBEFORE),
153 MAP( SC_UNONAME_OHEIGHT, XML_NAMESPACE_STYLE, XML_USE_OPTIMAL_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_BOOL, CTF_SC_ROWOPTIMALHEIGHT),
154 MAP_END()
157 const XMLPropertyMapEntry aXMLScFromXLSRowStylesProperties[] =
159 MAP( SC_UNONAME_CELLHGT, XML_NAMESPACE_STYLE, XML_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_MEASURE, CTF_SC_ROWHEIGHT),
160 MAP( SC_UNONAME_MANPAGE, XML_NAMESPACE_FO, XML_BREAK_BEFORE, XML_TYPE_PROP_TABLE_ROW|XML_SC_TYPE_BREAKBEFORE, CTF_SC_ROWBREAKBEFORE),
161 MAP( SC_UNONAME_OHEIGHT, XML_NAMESPACE_STYLE, XML_USE_OPTIMAL_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_BOOL_FALSE, CTF_SC_ROWOPTIMALHEIGHT),
162 MAP_END()
165 const XMLPropertyMapEntry aXMLScTableStylesImportProperties[] =
167 // #i57869# Include background color (CellBackColor/IsCellBackgroundTransparent) for import only.
168 // Import and export should use the same map, with MID_FLAG_NO_PROPERTY_EXPORT for the background entries,
169 // but this doesn't work at the moment because SvXMLImportPropertyMapper compares MID_FLAG_NO_PROPERTY to 0.
170 // If this is changed (not for 2.0.x), a single map can be used again.
172 MAP( SC_UNONAME_CELLBACK, XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
173 MAP( SC_UNONAME_CELLTRAN, XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_ISTRANSPARENT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
174 MAP_EXT( SC_UNONAME_CELL_BACKGROUND_COMPLEX_COLOR, XML_NAMESPACE_LO_EXT, XML_BACKGROUND_COMPLEX_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COMPLEX_COLOR, CTF_COMPLEX_COLOR ),
175 MAP( SC_UNONAME_CELLVIS, XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TYPE_PROP_TABLE|XML_TYPE_BOOL, 0 ),
176 MAP( SC_UNONAME_PAGESTL, XML_NAMESPACE_STYLE, XML_MASTER_PAGE_NAME, XML_TYPE_PROP_TABLE|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_MASTERPAGENAME ),
177 MAP( SC_UNONAME_TABLAYOUT, XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_TYPE_PROP_TABLE|XML_TYPE_TEXT_WRITING_MODE, 0 ),
178 MAP_ODF13( SC_UNONAME_TABCOLOR, XML_NAMESPACE_TABLE, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
179 MAP_ODF13( SC_UNONAME_TABCOLOR, XML_NAMESPACE_TABLE_EXT, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
180 MAP_END()
183 const XMLPropertyMapEntry aXMLScTableStylesProperties[] =
185 MAP( SC_UNONAME_CELLVIS, XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TYPE_PROP_TABLE|XML_TYPE_BOOL, 0 ),
186 MAP( SC_UNONAME_PAGESTL, XML_NAMESPACE_STYLE, XML_MASTER_PAGE_NAME, XML_TYPE_PROP_TABLE|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_MASTERPAGENAME ),
187 MAP( SC_UNONAME_TABLAYOUT, XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_TYPE_PROP_TABLE|XML_TYPE_TEXT_WRITING_MODE, 0 ),
188 // ODF 1.3 OFFICE-2173
189 MAP_ODF13( SC_UNONAME_TABCOLOR, XML_NAMESPACE_TABLE, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
190 MAP_ODF13( SC_UNONAME_TABCOLOR, XML_NAMESPACE_TABLE_EXT, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
191 MAP_END()
194 ScXMLCellExportPropertyMapper::ScXMLCellExportPropertyMapper(
195 const rtl::Reference< XMLPropertySetMapper >& rMapper )
196 : SvXMLExportPropertyMapper(rMapper)
200 ScXMLCellExportPropertyMapper::~ScXMLCellExportPropertyMapper()
204 void ScXMLCellExportPropertyMapper::ContextFilter(
205 bool bEnableFoFontFamily,
206 ::std::vector< XMLPropertyState >& rProperties,
207 const uno::Reference< beans::XPropertySet >& rPropSet ) const
209 XMLPropertyState* pPadding = nullptr;
210 XMLPropertyState* pPadding_Bottom = nullptr;
211 XMLPropertyState* pPadding_Left = nullptr;
212 XMLPropertyState* pPadding_Right = nullptr;
213 XMLPropertyState* pPadding_Top = nullptr;
215 XMLPropertyState* pBorder = nullptr;
216 XMLPropertyState* pBorder_Bottom = nullptr;
217 XMLPropertyState* pBorder_Left = nullptr;
218 XMLPropertyState* pBorder_Right = nullptr;
219 XMLPropertyState* pBorder_Top = nullptr;
220 XMLPropertyState* pSWBorder = nullptr;
221 XMLPropertyState* pSWBorder_Bottom = nullptr;
222 XMLPropertyState* pSWBorder_Left = nullptr;
223 XMLPropertyState* pSWBorder_Right = nullptr;
224 XMLPropertyState* pSWBorder_Top = nullptr;
226 XMLPropertyState* pAllBorderWidthState = nullptr;
227 XMLPropertyState* pLeftBorderWidthState = nullptr;
228 XMLPropertyState* pRightBorderWidthState = nullptr;
229 XMLPropertyState* pTopBorderWidthState = nullptr;
230 XMLPropertyState* pBottomBorderWidthState = nullptr;
231 XMLPropertyState* pSWAllBorderWidthState = nullptr;
232 XMLPropertyState* pSWLeftBorderWidthState = nullptr;
233 XMLPropertyState* pSWRightBorderWidthState = nullptr;
234 XMLPropertyState* pSWTopBorderWidthState = nullptr;
235 XMLPropertyState* pSWBottomBorderWidthState = nullptr;
236 XMLPropertyState* pDiagonalTLBRWidthState = nullptr;
237 XMLPropertyState* pDiagonalBLTRWidthState = nullptr;
239 XMLPropertyState* pParaMarginLeft = nullptr;
240 XMLPropertyState* pParaMarginLeftRel = nullptr;
241 XMLPropertyState* pParaMarginRight = nullptr;
242 XMLPropertyState* pParaMarginRightRel = nullptr;
243 XMLPropertyState* pParaMarginTop = nullptr;
244 XMLPropertyState* pParaMarginTopRel = nullptr;
245 XMLPropertyState* pParaMarginBottom = nullptr;
246 XMLPropertyState* pParaMarginBottomRel = nullptr;
248 XMLPropertyState* pParaAdjust = nullptr;
249 XMLPropertyState* pParaAdjustLast = nullptr;
251 for( auto& rProperty : rProperties )
253 XMLPropertyState* propertyState = &rProperty;
254 if (propertyState->mnIndex != -1)
256 switch( getPropertySetMapper()->GetEntryContextId( propertyState->mnIndex ) )
258 case CTF_SC_ALLPADDING: pPadding = propertyState; break;
259 case CTF_SC_BOTTOMPADDING: pPadding_Bottom = propertyState; break;
260 case CTF_SC_LEFTPADDING: pPadding_Left = propertyState; break;
261 case CTF_SC_RIGHTPADDING: pPadding_Right = propertyState; break;
262 case CTF_SC_TOPPADDING: pPadding_Top = propertyState; break;
263 case CTF_SC_ALLBORDER: pBorder = propertyState; break;
264 case CTF_SC_LEFTBORDER: pBorder_Left = propertyState; break;
265 case CTF_SC_RIGHTBORDER: pBorder_Right = propertyState; break;
266 case CTF_SC_BOTTOMBORDER: pBorder_Bottom = propertyState; break;
267 case CTF_SC_TOPBORDER: pBorder_Top = propertyState; break;
268 case CTF_SC_ALLBORDERWIDTH: pAllBorderWidthState = propertyState; break;
269 case CTF_SC_LEFTBORDERWIDTH: pLeftBorderWidthState = propertyState; break;
270 case CTF_SC_RIGHTBORDERWIDTH: pRightBorderWidthState = propertyState; break;
271 case CTF_SC_TOPBORDERWIDTH: pTopBorderWidthState = propertyState; break;
272 case CTF_SC_BOTTOMBORDERWIDTH: pBottomBorderWidthState = propertyState; break;
273 case CTF_ALLBORDER: pSWBorder = propertyState; break;
274 case CTF_LEFTBORDER: pSWBorder_Left = propertyState; break;
275 case CTF_RIGHTBORDER: pSWBorder_Right = propertyState; break;
276 case CTF_BOTTOMBORDER: pSWBorder_Bottom = propertyState; break;
277 case CTF_TOPBORDER: pSWBorder_Top = propertyState; break;
278 case CTF_ALLBORDERWIDTH: pSWAllBorderWidthState = propertyState; break;
279 case CTF_LEFTBORDERWIDTH: pSWLeftBorderWidthState = propertyState; break;
280 case CTF_RIGHTBORDERWIDTH: pSWRightBorderWidthState = propertyState; break;
281 case CTF_TOPBORDERWIDTH: pSWTopBorderWidthState = propertyState; break;
282 case CTF_BOTTOMBORDERWIDTH: pSWBottomBorderWidthState = propertyState; break;
283 case CTF_SC_DIAGONALTLBR: break; //old diagonal line attribute names without "s" are only read, not written
284 case CTF_SC_DIAGONALTLBRWIDTH: pDiagonalTLBRWidthState = propertyState; break;
285 case CTF_SC_DIAGONALBLTR: break; //old diagonal line attribute names without "s" are only read, not written
286 case CTF_SC_DIAGONALBLTRWIDTH: pDiagonalBLTRWidthState = propertyState; break;
287 case CTF_SD_SHAPE_PARA_ADJUST: pParaAdjust = propertyState; break;
288 case CTF_PARA_ADJUSTLAST: pParaAdjustLast = propertyState; break;
289 case CTF_PARALEFTMARGIN: pParaMarginLeft = propertyState; break;
290 case CTF_PARALEFTMARGIN_REL: pParaMarginLeftRel = propertyState; break;
291 case CTF_PARARIGHTMARGIN: pParaMarginRight = propertyState; break;
292 case CTF_PARARIGHTMARGIN_REL: pParaMarginRightRel = propertyState; break;
293 case CTF_PARATOPMARGIN: pParaMarginTop = propertyState; break;
294 case CTF_PARATOPMARGIN_REL: pParaMarginTopRel = propertyState; break;
295 case CTF_PARABOTTOMMARGIN: pParaMarginBottom = propertyState; break;
296 case CTF_PARABOTTOMMARGIN_REL: pParaMarginBottomRel = propertyState; break;
301 if (pPadding && pPadding_Bottom && pPadding_Left && pPadding_Right && pPadding_Top)
303 sal_Int32 nBottom = 0, nTop = 0, nLeft = 0, nRight = 0;
304 if ((pPadding_Bottom->maValue >>= nBottom) &&
305 (pPadding_Left->maValue >>= nLeft) &&
306 (pPadding_Right->maValue >>= nRight) &&
307 (pPadding_Top->maValue >>= nTop))
309 if ((nBottom == nTop) && (nLeft == nRight) && (nTop == nLeft))
311 pPadding_Bottom->mnIndex = -1;
312 pPadding_Bottom->maValue.clear();
313 pPadding_Left->mnIndex = -1;
314 pPadding_Left->maValue.clear();
315 pPadding_Right->mnIndex = -1;
316 pPadding_Right->maValue.clear();
317 pPadding_Top->mnIndex = -1;
318 pPadding_Top->maValue.clear();
320 else
322 pPadding->mnIndex = -1;
323 pPadding->maValue.clear();
327 if( pBorder )
329 if( pBorder_Left && pBorder_Right && pBorder_Top && pBorder_Bottom )
331 table::BorderLine2 aLeft, aRight, aTop, aBottom;
333 pBorder_Left->maValue >>= aLeft;
334 pBorder_Right->maValue >>= aRight;
335 pBorder_Top->maValue >>= aTop;
336 pBorder_Bottom->maValue >>= aBottom;
337 if( aLeft.Color == aRight.Color && aLeft.InnerLineWidth == aRight.InnerLineWidth &&
338 aLeft.OuterLineWidth == aRight.OuterLineWidth && aLeft.LineDistance == aRight.LineDistance &&
339 aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth &&
340 aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance &&
341 aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth &&
342 aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance &&
343 aLeft.LineStyle == aRight.LineStyle && aLeft.LineStyle == aTop.LineStyle &&
344 aLeft.LineStyle == aBottom.LineStyle && aLeft.LineWidth == aRight.LineWidth &&
345 aLeft.LineWidth == aTop.LineWidth && aLeft.LineWidth == aBottom.LineWidth )
347 pBorder_Left->mnIndex = -1;
348 pBorder_Left->maValue.clear();
349 pBorder_Right->mnIndex = -1;
350 pBorder_Right->maValue.clear();
351 pBorder_Top->mnIndex = -1;
352 pBorder_Top->maValue.clear();
353 pBorder_Bottom->mnIndex = -1;
354 pBorder_Bottom->maValue.clear();
356 else
358 pBorder->mnIndex = -1;
359 pBorder->maValue.clear();
362 else
364 pBorder->mnIndex = -1;
365 pBorder->maValue.clear();
368 if( pAllBorderWidthState )
370 if( pLeftBorderWidthState && pRightBorderWidthState && pTopBorderWidthState && pBottomBorderWidthState )
372 table::BorderLine2 aLeft, aRight, aTop, aBottom;
374 pLeftBorderWidthState->maValue >>= aLeft;
375 pRightBorderWidthState->maValue >>= aRight;
376 pTopBorderWidthState->maValue >>= aTop;
377 pBottomBorderWidthState->maValue >>= aBottom;
378 if( aLeft.InnerLineWidth == aRight.InnerLineWidth && aLeft.OuterLineWidth == aRight.OuterLineWidth &&
379 aLeft.LineDistance == aRight.LineDistance && aLeft.InnerLineWidth == aTop.InnerLineWidth &&
380 aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance &&
381 aLeft.InnerLineWidth == aBottom.InnerLineWidth && aLeft.OuterLineWidth == aBottom.OuterLineWidth &&
382 aLeft.LineDistance == aBottom.LineDistance && aLeft.LineWidth == aRight.LineWidth &&
383 aLeft.LineWidth == aTop.LineWidth && aLeft.LineWidth == aBottom.LineWidth )
385 pLeftBorderWidthState->mnIndex = -1;
386 pLeftBorderWidthState->maValue.clear();
387 pRightBorderWidthState->mnIndex = -1;
388 pRightBorderWidthState->maValue.clear();
389 pTopBorderWidthState->mnIndex = -1;
390 pTopBorderWidthState->maValue.clear();
391 pBottomBorderWidthState->mnIndex = -1;
392 pBottomBorderWidthState->maValue.clear();
394 else
396 pAllBorderWidthState->mnIndex = -1;
397 pAllBorderWidthState->maValue.clear();
400 else
402 pAllBorderWidthState->mnIndex = -1;
403 pAllBorderWidthState->maValue.clear();
407 if (pParaAdjust)
409 pParaAdjust->mnIndex = -1;
410 pParaAdjust->maValue.clear();
412 if (pParaAdjustLast)
414 pParaAdjustLast->mnIndex = -1;
415 pParaAdjustLast->maValue.clear();
417 if (pSWBorder)
419 pSWBorder->mnIndex = -1;
420 pSWBorder->maValue.clear();
422 if (pSWBorder_Left)
424 pSWBorder_Left->mnIndex = -1;
425 pSWBorder_Left->maValue.clear();
427 if (pSWBorder_Right)
429 pSWBorder_Right->mnIndex = -1;
430 pSWBorder_Right->maValue.clear();
432 if (pSWBorder_Bottom)
434 pSWBorder_Bottom->mnIndex = -1;
435 pSWBorder_Bottom->maValue.clear();
437 if (pSWBorder_Top)
439 pSWBorder_Top->mnIndex = -1;
440 pSWBorder_Top->maValue.clear();
442 if (pSWAllBorderWidthState)
444 pSWAllBorderWidthState->mnIndex = -1;
445 pSWAllBorderWidthState->maValue.clear();
447 if (pSWLeftBorderWidthState)
449 pSWLeftBorderWidthState->mnIndex = -1;
450 pSWLeftBorderWidthState->maValue.clear();
452 if (pSWRightBorderWidthState)
454 pSWRightBorderWidthState->mnIndex = -1;
455 pSWRightBorderWidthState->maValue.clear();
457 if (pSWTopBorderWidthState)
459 pSWTopBorderWidthState->mnIndex = -1;
460 pSWTopBorderWidthState->maValue.clear();
462 if (pSWBottomBorderWidthState)
464 pSWBottomBorderWidthState->mnIndex = -1;
465 pSWBottomBorderWidthState->maValue.clear();
468 if (pParaMarginLeft)
470 pParaMarginLeft->mnIndex = -1;
471 pParaMarginLeft->maValue.clear();
473 if (pParaMarginLeftRel)
475 pParaMarginLeftRel->mnIndex = -1;
476 pParaMarginLeftRel->maValue.clear();
478 if (pParaMarginRight)
480 pParaMarginRight->mnIndex = -1;
481 pParaMarginRight->maValue.clear();
483 if (pParaMarginRightRel)
485 pParaMarginRightRel->mnIndex = -1;
486 pParaMarginRightRel->maValue.clear();
488 if (pParaMarginTop)
490 pParaMarginTop->mnIndex = -1;
491 pParaMarginTop->maValue.clear();
493 if (pParaMarginTopRel)
495 pParaMarginTopRel->mnIndex = -1;
496 pParaMarginTopRel->maValue.clear();
498 if (pParaMarginBottom)
500 pParaMarginBottom->mnIndex = -1;
501 pParaMarginBottom->maValue.clear();
503 if (pParaMarginBottomRel)
505 pParaMarginBottomRel->mnIndex = -1;
506 pParaMarginBottomRel->maValue.clear();
509 // #i102690# old diagonal line attribute names without "s" are only read, not written
510 if (pDiagonalTLBRWidthState)
512 pDiagonalTLBRWidthState->mnIndex = -1;
513 pDiagonalTLBRWidthState->maValue.clear();
515 if (pDiagonalBLTRWidthState)
517 pDiagonalBLTRWidthState->mnIndex = -1;
518 pDiagonalBLTRWidthState->maValue.clear();
521 SvXMLExportPropertyMapper::ContextFilter(bEnableFoFontFamily, rProperties, rPropSet);
524 /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
525 void ScXMLCellExportPropertyMapper::handleSpecialItem(
526 comphelper::AttributeList& /* rAttrList */,
527 const XMLPropertyState& /* rProperty */,
528 const SvXMLUnitConverter& /* rUnitConverter */,
529 const SvXMLNamespaceMap& /* rNamespaceMap */,
530 const ::std::vector< XMLPropertyState > * /* pProperties */,
531 sal_uInt32 /* nIdx */ ) const
533 // the SpecialItem NumberFormat must not be handled by this method
534 // the SpecialItem ConditionlaFormat must not be handled by this method
535 // the SpecialItem CharBackColor must not be handled by this method
538 void ScXMLCellExportPropertyMapper::handleElementItem(
539 SvXMLExport& rExport,
540 const XMLPropertyState& rProperty,
541 SvXmlExportFlags /* nFlags */,
542 const ::std::vector< XMLPropertyState > * /* pProperties */,
543 sal_uInt32 /* nIdx */) const
545 sal_uInt32 nContextId = getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex );
546 switch (nContextId)
548 case CTF_SC_HYPERLINK:
550 OUString sURL;
551 if ((rProperty.maValue >>= sURL) && !sURL.isEmpty())
553 rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sURL );
554 rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE,
555 XML_SIMPLE );
556 sal_uInt32 nPropIndex = rProperty.mnIndex;
557 sal_uInt16 nPrefix = getPropertySetMapper()->GetEntryNameSpace( nPropIndex );
558 OUString sLocalName = getPropertySetMapper()->GetEntryXMLName( nPropIndex );
559 SvXMLElementExport aElem( rExport, nPrefix, sLocalName, true, true );
562 break;
563 case CTF_COMPLEX_COLOR:
565 XMLComplexColorExport aExport(rExport);
566 aExport.exportXML(rProperty.maValue,
567 getPropertySetMapper()->GetEntryNameSpace(rProperty.mnIndex),
568 getPropertySetMapper()->GetEntryXMLName(rProperty.mnIndex));
570 break;
571 default:
572 break;
576 ScXMLRowExportPropertyMapper::ScXMLRowExportPropertyMapper(
577 const rtl::Reference< XMLPropertySetMapper >& rMapper )
578 : SvXMLExportPropertyMapper(rMapper)
582 ScXMLRowExportPropertyMapper::~ScXMLRowExportPropertyMapper()
586 void ScXMLRowExportPropertyMapper::ContextFilter(
587 bool /* bEnableFoFontFamily */,
588 ::std::vector< XMLPropertyState >& /* rProperties */,
589 const uno::Reference< beans::XPropertySet >& /* rPropSet */ ) const
591 //#108550#; don't filter the height, so other applications know the calculated height
594 ScXMLColumnExportPropertyMapper::ScXMLColumnExportPropertyMapper(
595 const rtl::Reference< XMLPropertySetMapper >& rMapper )
596 : SvXMLExportPropertyMapper(rMapper)
600 ScXMLColumnExportPropertyMapper::~ScXMLColumnExportPropertyMapper()
604 /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
605 void ScXMLColumnExportPropertyMapper::handleSpecialItem(
606 comphelper::AttributeList& /* rAttrList */,
607 const XMLPropertyState& /* rProperty */,
608 const SvXMLUnitConverter& /* rUnitConverter */,
609 const SvXMLNamespaceMap& /* rNamespaceMap */,
610 const ::std::vector< XMLPropertyState > * /* pProperties */,
611 sal_uInt32 /* nIdx */ ) const
613 // the SpecialItem IsVisible must not be handled by this method
616 ScXMLTableExportPropertyMapper::ScXMLTableExportPropertyMapper(
617 const rtl::Reference< XMLPropertySetMapper >& rMapper )
618 : SvXMLExportPropertyMapper(rMapper)
622 ScXMLTableExportPropertyMapper::~ScXMLTableExportPropertyMapper()
626 /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
627 void ScXMLTableExportPropertyMapper::handleSpecialItem(
628 comphelper::AttributeList& /* rAttrList */,
629 const XMLPropertyState& /* rProperty */,
630 const SvXMLUnitConverter& /* rUnitConverter */,
631 const SvXMLNamespaceMap& /* rNamespaceMap */,
632 const ::std::vector< XMLPropertyState > * /* pProperties */,
633 sal_uInt32 /* nIdx */ ) const
635 // the SpecialItem PageStyle must not be handled by this method
638 void ScXMLAutoStylePoolP::exportStyleAttributes(
639 comphelper::AttributeList& rAttrList,
640 XmlStyleFamily nFamily,
641 const ::std::vector< XMLPropertyState >& rProperties,
642 const SvXMLExportPropertyMapper& rPropExp
643 , const SvXMLUnitConverter& rUnitConverter,
644 const SvXMLNamespaceMap& rNamespaceMap
645 ) const
647 SvXMLAutoStylePoolP::exportStyleAttributes( rAttrList, nFamily, rProperties, rPropExp, rUnitConverter, rNamespaceMap );
648 if (nFamily == XmlStyleFamily::TABLE_CELL)
650 for(const auto& rProperty : rProperties)
652 rtl::Reference< XMLPropertySetMapper > aPropMapper(rScXMLExport.GetCellStylesPropertySetMapper());
653 sal_Int16 nContextID(aPropMapper->GetEntryContextId(rProperty.mnIndex));
654 switch (nContextID)
656 case CTF_SC_NUMBERFORMAT :
658 sal_Int32 nNumberFormat = 0;
659 if (rProperty.maValue >>= nNumberFormat)
661 OUString sAttrValue(rScXMLExport.getDataStyleName(nNumberFormat));
662 if (!sAttrValue.isEmpty())
664 GetExport().AddAttribute(
665 aPropMapper->GetEntryNameSpace(rProperty.mnIndex),
666 aPropMapper->GetEntryXMLName(rProperty.mnIndex),
667 sAttrValue );
671 break;
675 else if (nFamily == XmlStyleFamily::TABLE_TABLE)
677 for(const auto& rProperty : rProperties)
679 rtl::Reference< XMLPropertySetMapper > aPropMapper(rScXMLExport.GetTableStylesPropertySetMapper());
680 sal_Int16 nContextID(aPropMapper->GetEntryContextId(rProperty.mnIndex));
681 switch (nContextID)
683 case CTF_SC_MASTERPAGENAME :
685 OUString sName;
686 if (rProperty.maValue >>= sName)
688 GetExport().AddAttribute(
689 aPropMapper->GetEntryNameSpace(rProperty.mnIndex),
690 aPropMapper->GetEntryXMLName(rProperty.mnIndex),
691 GetExport().EncodeStyleName( sName ));
694 break;
700 void ScXMLAutoStylePoolP::exportStyleContent(
701 const css::uno::Reference< css::xml::sax::XDocumentHandler > & rHandler,
702 XmlStyleFamily nFamily,
703 const std::vector< XMLPropertyState >& rProperties,
704 const SvXMLExportPropertyMapper& rPropExp
705 , const SvXMLUnitConverter& rUnitConverter,
706 const SvXMLNamespaceMap& rNamespaceMap
707 ) const
709 SvXMLAutoStylePoolP::exportStyleContent( rHandler, nFamily, rProperties, rPropExp, rUnitConverter, rNamespaceMap );
710 if (nFamily != XmlStyleFamily::TABLE_CELL)
711 return;
713 ScDocument* pDoc = rScXMLExport.GetDocument();
715 for(const auto& rProperty : rProperties)
717 if (rProperty.mnIndex != -1)
719 sal_Int16 nContextID = rScXMLExport.GetCellStylesPropertySetMapper()->GetEntryContextId(rProperty.mnIndex);
720 switch (nContextID)
722 case CTF_SC_MAP :
724 uno::Reference<container::XIndexAccess> xIndex( rProperty.maValue, uno::UNO_QUERY );
725 if ( xIndex.is() )
727 sal_Int32 nConditionCount(xIndex->getCount());
728 for (sal_Int32 nCondition = 0; nCondition < nConditionCount; ++nCondition)
730 uno::Reference <sheet::XSheetConditionalEntry> xSheetConditionalEntry(xIndex->getByIndex(nCondition), uno::UNO_QUERY);
731 if (xSheetConditionalEntry.is())
733 OUString sStyleName(xSheetConditionalEntry->getStyleName());
734 uno::Reference <sheet::XSheetCondition> xSheetCondition(xSheetConditionalEntry, uno::UNO_QUERY);
735 if (xSheetCondition.is())
737 sheet::ConditionOperator aOperator = xSheetCondition->getOperator();
738 if (aOperator != sheet::ConditionOperator_NONE)
740 if (aOperator == sheet::ConditionOperator_FORMULA)
742 OUString sCondition = "is-true-formula("
743 + xSheetCondition->getFormula1()
744 + ")";
745 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_CONDITION, sCondition);
746 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_APPLY_STYLE_NAME, rScXMLExport.EncodeStyleName( sStyleName ));
747 OUString sOUBaseAddress;
748 ScRangeStringConverter::GetStringFromAddress( sOUBaseAddress,
749 xSheetCondition->getSourcePosition(), pDoc, FormulaGrammar::CONV_OOO );
750 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_BASE_CELL_ADDRESS, sOUBaseAddress);
751 SvXMLElementExport aMElem(rScXMLExport, XML_NAMESPACE_STYLE, XML_MAP, true, true);
753 else
755 OUString sCondition;
756 if (aOperator == sheet::ConditionOperator_BETWEEN ||
757 aOperator == sheet::ConditionOperator_NOT_BETWEEN)
759 if (aOperator == sheet::ConditionOperator_BETWEEN)
760 sCondition = "cell-content-is-between(";
761 else
762 sCondition = "cell-content-is-not-between(";
763 sCondition += xSheetCondition->getFormula1()
764 + ","
765 + xSheetCondition->getFormula2()
766 + ")";
768 else
770 sCondition = "cell-content()";
771 switch (aOperator)
773 case sheet::ConditionOperator_LESS:
774 sCondition += "<";
775 break;
776 case sheet::ConditionOperator_GREATER:
777 sCondition += ">";
778 break;
779 case sheet::ConditionOperator_LESS_EQUAL:
780 sCondition += "<=";
781 break;
782 case sheet::ConditionOperator_GREATER_EQUAL:
783 sCondition += ">=";
784 break;
785 case sheet::ConditionOperator_EQUAL:
786 sCondition += "=";
787 break;
788 case sheet::ConditionOperator_NOT_EQUAL:
789 sCondition += "!=";
790 break;
791 default:
793 // added to avoid warnings
796 sCondition += xSheetCondition->getFormula1();
798 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_CONDITION, sCondition);
799 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_APPLY_STYLE_NAME, rScXMLExport.EncodeStyleName( sStyleName ));
800 OUString sOUBaseAddress;
801 ScRangeStringConverter::GetStringFromAddress( sOUBaseAddress,
802 xSheetCondition->getSourcePosition(), pDoc, FormulaGrammar::CONV_OOO );
803 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_BASE_CELL_ADDRESS, sOUBaseAddress);
804 SvXMLElementExport aMElem(rScXMLExport, XML_NAMESPACE_STYLE, XML_MAP, true, true);
812 break;
818 ScXMLAutoStylePoolP::ScXMLAutoStylePoolP(ScXMLExport& rTempScXMLExport):
819 SvXMLAutoStylePoolP(rTempScXMLExport),
820 rScXMLExport(rTempScXMLExport)
824 ScXMLAutoStylePoolP::~ScXMLAutoStylePoolP()
828 XMLScPropHdlFactory::XMLScPropHdlFactory()
832 XMLScPropHdlFactory::~XMLScPropHdlFactory()
836 const XMLPropertyHandler* XMLScPropHdlFactory::GetPropertyHandler( sal_Int32 nType ) const
838 nType &= MID_FLAG_MASK;
840 XMLPropertyHandler* pHdl(const_cast<XMLPropertyHandler*>(XMLPropertyHandlerFactory::GetPropertyHandler( nType )));
841 if(!pHdl)
843 switch(nType)
845 case XML_SC_TYPE_CELLPROTECTION :
847 pHdl = new XmlScPropHdl_CellProtection;
849 break;
850 case XML_SC_TYPE_PRINTCONTENT :
852 pHdl = new XmlScPropHdl_PrintContent;
854 break;
855 case XML_SC_TYPE_HORIJUSTIFY_METHOD:
856 case XML_SC_TYPE_VERTJUSTIFY_METHOD:
858 pHdl = new XmlScPropHdl_JustifyMethod;
860 break;
861 case XML_SC_TYPE_HORIJUSTIFY :
863 pHdl = new XmlScPropHdl_HoriJustify;
865 break;
866 case XML_SC_TYPE_HORIJUSTIFYSOURCE :
868 pHdl = new XmlScPropHdl_HoriJustifySource;
870 break;
871 case XML_SC_TYPE_HORIJUSTIFYREPEAT :
873 pHdl = new XmlScPropHdl_HoriJustifyRepeat;
875 break;
876 case XML_SC_TYPE_ORIENTATION :
878 pHdl = new XmlScPropHdl_Orientation;
880 break;
881 case XML_SC_TYPE_ROTATEANGLE :
883 pHdl = new XmlScPropHdl_RotateAngle;
885 break;
886 case XML_SC_TYPE_ROTATEREFERENCE :
888 pHdl = new XmlScPropHdl_RotateReference;
890 break;
891 case XML_SC_TYPE_VERTJUSTIFY :
893 pHdl = new XmlScPropHdl_VertJustify;
895 break;
896 case XML_SC_TYPE_BREAKBEFORE :
898 pHdl = new XmlScPropHdl_BreakBefore;
900 break;
901 case XML_SC_ISTEXTWRAPPED :
903 pHdl = new XmlScPropHdl_IsTextWrapped;
905 break;
906 case XML_SC_TYPE_EQUAL :
908 pHdl = new XmlScPropHdl_IsEqual;
910 break;
911 case XML_SC_TYPE_VERTICAL :
913 pHdl = new XmlScPropHdl_Vertical;
915 break;
918 if(pHdl)
919 PutHdlCache(nType, pHdl);
922 return pHdl;
925 XmlScPropHdl_CellProtection::~XmlScPropHdl_CellProtection()
929 bool XmlScPropHdl_CellProtection::equals(
930 const css::uno::Any& r1,
931 const css::uno::Any& r2 ) const
933 util::CellProtection aCellProtection1, aCellProtection2;
935 if((r1 >>= aCellProtection1) && (r2 >>= aCellProtection2))
937 return ((aCellProtection1.IsHidden == aCellProtection2.IsHidden) &&
938 (aCellProtection1.IsLocked == aCellProtection2.IsLocked) &&
939 (aCellProtection1.IsFormulaHidden == aCellProtection2.IsFormulaHidden));
941 return false;
944 bool XmlScPropHdl_CellProtection::importXML(
945 const OUString& rStrImpValue,
946 css::uno::Any& rValue,
947 const SvXMLUnitConverter& /* rUnitConverter */ ) const
949 bool bRetval(false);
951 util::CellProtection aCellProtection;
952 bool bDefault(false);
953 if (!rValue.hasValue())
955 aCellProtection.IsHidden = false;
956 aCellProtection.IsLocked = true;
957 aCellProtection.IsFormulaHidden = false;
958 aCellProtection.IsPrintHidden = false;
959 bDefault = true;
961 if ((rValue >>= aCellProtection) || bDefault)
963 if (IsXMLToken(rStrImpValue, XML_NONE))
965 aCellProtection.IsFormulaHidden = false;
966 aCellProtection.IsHidden = false;
967 aCellProtection.IsLocked = false;
968 rValue <<= aCellProtection;
969 bRetval = true;
971 else if (IsXMLToken(rStrImpValue, XML_HIDDEN_AND_PROTECTED))
973 aCellProtection.IsFormulaHidden = true;
974 aCellProtection.IsHidden = true;
975 aCellProtection.IsLocked = true;
976 rValue <<= aCellProtection;
977 bRetval = true;
979 else if (IsXMLToken(rStrImpValue, XML_PROTECTED))
981 aCellProtection.IsFormulaHidden = false;
982 aCellProtection.IsHidden = false;
983 aCellProtection.IsLocked = true;
984 rValue <<= aCellProtection;
985 bRetval = true;
987 else if (IsXMLToken(rStrImpValue, XML_FORMULA_HIDDEN))
989 aCellProtection.IsFormulaHidden = true;
990 aCellProtection.IsHidden = false;
991 aCellProtection.IsLocked = false;
992 rValue <<= aCellProtection;
993 bRetval = true;
995 else
997 sal_Int32 i(0);
998 while (i < rStrImpValue.getLength() && rStrImpValue[i] != ' ')
999 ++i;
1000 OUString sFirst(rStrImpValue.copy(0, i));
1001 OUString sSecond(rStrImpValue.copy(i + 1));
1002 aCellProtection.IsFormulaHidden = false;
1003 aCellProtection.IsHidden = false;
1004 aCellProtection.IsLocked = false;
1005 if ((IsXMLToken(sFirst, XML_PROTECTED)) || (IsXMLToken(sSecond, XML_PROTECTED)))
1006 aCellProtection.IsLocked = true;
1007 if ((IsXMLToken(sFirst, XML_FORMULA_HIDDEN)) || (IsXMLToken(sSecond, XML_FORMULA_HIDDEN)))
1008 aCellProtection.IsFormulaHidden = true;
1009 rValue <<= aCellProtection;
1010 bRetval = true;
1014 return bRetval;
1017 bool XmlScPropHdl_CellProtection::exportXML(
1018 OUString& rStrExpValue,
1019 const css::uno::Any& rValue,
1020 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1022 bool bRetval(false);
1023 util::CellProtection aCellProtection;
1025 if(rValue >>= aCellProtection)
1027 if (!(aCellProtection.IsFormulaHidden || aCellProtection.IsHidden || aCellProtection.IsLocked))
1029 rStrExpValue = GetXMLToken(XML_NONE);
1030 bRetval = true;
1032 else if (aCellProtection.IsHidden)
1034 // #i105964# "Hide all" implies "Protected" in the UI, so it must be saved as "hidden-and-protected"
1035 // even if "IsLocked" is not set in the CellProtection struct.
1036 rStrExpValue = GetXMLToken(XML_HIDDEN_AND_PROTECTED);
1037 bRetval = true;
1039 else if (aCellProtection.IsLocked && !aCellProtection.IsFormulaHidden)
1041 rStrExpValue = GetXMLToken(XML_PROTECTED);
1042 bRetval = true;
1044 else if (aCellProtection.IsFormulaHidden && !aCellProtection.IsLocked)
1046 rStrExpValue = GetXMLToken(XML_FORMULA_HIDDEN);
1047 bRetval = true;
1049 else if (aCellProtection.IsFormulaHidden && aCellProtection.IsLocked)
1051 rStrExpValue = GetXMLToken(XML_PROTECTED);
1052 rStrExpValue += " ";
1053 rStrExpValue += GetXMLToken(XML_FORMULA_HIDDEN);
1054 bRetval = true;
1058 return bRetval;
1061 XmlScPropHdl_PrintContent::~XmlScPropHdl_PrintContent()
1065 bool XmlScPropHdl_PrintContent::equals(
1066 const css::uno::Any& r1,
1067 const css::uno::Any& r2 ) const
1069 util::CellProtection aCellProtection1, aCellProtection2;
1071 if((r1 >>= aCellProtection1) && (r2 >>= aCellProtection2))
1073 return (aCellProtection1.IsPrintHidden == aCellProtection2.IsPrintHidden);
1075 return false;
1078 bool XmlScPropHdl_PrintContent::importXML(
1079 const OUString& rStrImpValue,
1080 css::uno::Any& rValue,
1081 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1083 bool bRetval(false);
1084 util::CellProtection aCellProtection;
1085 bool bDefault(false);
1086 if (!rValue.hasValue())
1088 aCellProtection.IsHidden = false;
1089 aCellProtection.IsLocked = true;
1090 aCellProtection.IsFormulaHidden = false;
1091 aCellProtection.IsPrintHidden = false;
1092 bDefault = true;
1094 if ((rValue >>= aCellProtection) || bDefault)
1096 bool bValue(false);
1097 if (::sax::Converter::convertBool(bValue, rStrImpValue))
1099 aCellProtection.IsPrintHidden = !bValue;
1100 rValue <<= aCellProtection;
1101 bRetval = true;
1105 return bRetval;
1108 bool XmlScPropHdl_PrintContent::exportXML(
1109 OUString& rStrExpValue,
1110 const css::uno::Any& rValue,
1111 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1113 bool bRetval(false);
1115 util::CellProtection aCellProtection;
1116 if(rValue >>= aCellProtection)
1118 OUStringBuffer sValue;
1119 ::sax::Converter::convertBool(sValue, !aCellProtection.IsPrintHidden);
1120 rStrExpValue = sValue.makeStringAndClear();
1121 bRetval = true;
1124 return bRetval;
1127 XmlScPropHdl_JustifyMethod::~XmlScPropHdl_JustifyMethod()
1131 bool XmlScPropHdl_JustifyMethod::equals(
1132 const css::uno::Any& r1,
1133 const css::uno::Any& r2 ) const
1135 sal_Int32 nVal1(0), nVal2(0);
1137 if((r1 >>= nVal1) && (r2 >>= nVal2))
1138 return (nVal1 == nVal2);
1139 return false;
1142 bool XmlScPropHdl_JustifyMethod::importXML(
1143 const OUString& rStrImpValue,
1144 css::uno::Any& rValue,
1145 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1147 bool bRetval = false;
1149 sal_Int32 nValue = table::CellJustifyMethod::AUTO;
1150 if (IsXMLToken(rStrImpValue, XML_AUTO))
1152 nValue = table::CellJustifyMethod::AUTO;
1153 rValue <<= nValue;
1154 bRetval = true;
1156 else if (IsXMLToken(rStrImpValue, XML_DISTRIBUTE))
1158 nValue = table::CellJustifyMethod::DISTRIBUTE;
1159 rValue <<= nValue;
1160 bRetval = true;
1162 else
1163 bRetval = true;
1165 return bRetval;
1168 bool XmlScPropHdl_JustifyMethod::exportXML(
1169 OUString& rStrExpValue,
1170 const css::uno::Any& rValue,
1171 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1173 sal_Int32 nVal(0);
1174 bool bRetval = false;
1176 if (rValue >>= nVal)
1178 switch (nVal)
1180 case table::CellJustifyMethod::AUTO:
1182 rStrExpValue = GetXMLToken(XML_AUTO);
1183 bRetval = true;
1185 break;
1186 case table::CellJustifyMethod::DISTRIBUTE:
1188 rStrExpValue = GetXMLToken(XML_DISTRIBUTE);
1189 bRetval = true;
1191 break;
1192 default:
1194 // added to avoid warnings
1198 return bRetval;
1201 XmlScPropHdl_HoriJustify::~XmlScPropHdl_HoriJustify()
1205 bool XmlScPropHdl_HoriJustify::equals(
1206 const css::uno::Any& r1,
1207 const css::uno::Any& r2 ) const
1209 table::CellHoriJustify aHoriJustify1, aHoriJustify2;
1211 if((r1 >>= aHoriJustify1) && (r2 >>= aHoriJustify2))
1212 return (aHoriJustify1 == aHoriJustify2);
1213 return false;
1216 bool XmlScPropHdl_HoriJustify::importXML(
1217 const OUString& rStrImpValue,
1218 css::uno::Any& rValue,
1219 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1221 bool bRetval(false);
1223 table::CellHoriJustify nValue = table::CellHoriJustify_LEFT;
1224 rValue >>= nValue;
1225 if (nValue != table::CellHoriJustify_REPEAT)
1227 if (IsXMLToken(rStrImpValue, XML_START))
1229 nValue = table::CellHoriJustify_LEFT;
1230 rValue <<= nValue;
1231 bRetval = true;
1233 else if (IsXMLToken(rStrImpValue, XML_END))
1235 nValue = table::CellHoriJustify_RIGHT;
1236 rValue <<= nValue;
1237 bRetval = true;
1239 else if (IsXMLToken(rStrImpValue, XML_CENTER))
1241 nValue = table::CellHoriJustify_CENTER;
1242 rValue <<= nValue;
1243 bRetval = true;
1245 else if (IsXMLToken(rStrImpValue, XML_JUSTIFY))
1247 nValue = table::CellHoriJustify_BLOCK;
1248 rValue <<= nValue;
1249 bRetval = true;
1252 else
1253 bRetval = true;
1255 return bRetval;
1258 bool XmlScPropHdl_HoriJustify::exportXML(
1259 OUString& rStrExpValue,
1260 const css::uno::Any& rValue,
1261 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1263 table::CellHoriJustify nVal;
1264 bool bRetval(false);
1266 if(rValue >>= nVal)
1268 switch (nVal)
1270 case table::CellHoriJustify_REPEAT:
1271 case table::CellHoriJustify_LEFT:
1273 rStrExpValue = GetXMLToken(XML_START);
1274 bRetval = true;
1276 break;
1277 case table::CellHoriJustify_RIGHT:
1279 rStrExpValue = GetXMLToken(XML_END);
1280 bRetval = true;
1282 break;
1283 case table::CellHoriJustify_CENTER:
1285 rStrExpValue = GetXMLToken(XML_CENTER);
1286 bRetval = true;
1288 break;
1289 case table::CellHoriJustify_BLOCK:
1291 rStrExpValue = GetXMLToken(XML_JUSTIFY);
1292 bRetval = true;
1294 break;
1295 default:
1297 // added to avoid warnings
1302 return bRetval;
1305 XmlScPropHdl_HoriJustifySource::~XmlScPropHdl_HoriJustifySource()
1309 bool XmlScPropHdl_HoriJustifySource::equals(
1310 const css::uno::Any& r1,
1311 const css::uno::Any& r2 ) const
1313 table::CellHoriJustify aHoriJustify1, aHoriJustify2;
1315 if((r1 >>= aHoriJustify1) && (r2 >>= aHoriJustify2))
1316 return (aHoriJustify1 == aHoriJustify2);
1317 return false;
1320 bool XmlScPropHdl_HoriJustifySource::importXML(
1321 const OUString& rStrImpValue,
1322 css::uno::Any& rValue,
1323 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1325 bool bRetval(false);
1327 if (IsXMLToken(rStrImpValue, XML_FIX))
1329 bRetval = true;
1331 else if (IsXMLToken(rStrImpValue, XML_VALUE_TYPE))
1333 rValue <<= table::CellHoriJustify_STANDARD;
1334 bRetval = true;
1337 return bRetval;
1340 bool XmlScPropHdl_HoriJustifySource::exportXML(
1341 OUString& rStrExpValue,
1342 const css::uno::Any& rValue,
1343 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1345 table::CellHoriJustify nVal;
1346 bool bRetval(false);
1348 if(rValue >>= nVal)
1350 if (nVal == table::CellHoriJustify_STANDARD)
1352 rStrExpValue = GetXMLToken(XML_VALUE_TYPE);
1353 bRetval = true;
1355 else
1357 rStrExpValue = GetXMLToken(XML_FIX);
1358 bRetval = true;
1362 return bRetval;
1365 XmlScPropHdl_HoriJustifyRepeat::~XmlScPropHdl_HoriJustifyRepeat()
1369 bool XmlScPropHdl_HoriJustifyRepeat::equals(
1370 const css::uno::Any& r1,
1371 const css::uno::Any& r2 ) const
1373 table::CellHoriJustify aHoriJustify1, aHoriJustify2;
1375 if((r1 >>= aHoriJustify1) && (r2 >>= aHoriJustify2))
1376 return (aHoriJustify1 == aHoriJustify2);
1377 return false;
1380 bool XmlScPropHdl_HoriJustifyRepeat::importXML(
1381 const OUString& rStrImpValue,
1382 css::uno::Any& rValue,
1383 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1385 bool bRetval(false);
1387 if (IsXMLToken(rStrImpValue, XML_FALSE))
1389 bRetval = true;
1391 else if (IsXMLToken(rStrImpValue, XML_TRUE))
1393 rValue <<= table::CellHoriJustify_REPEAT;
1394 bRetval = true;
1397 return bRetval;
1400 bool XmlScPropHdl_HoriJustifyRepeat::exportXML(
1401 OUString& rStrExpValue,
1402 const css::uno::Any& rValue,
1403 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1405 table::CellHoriJustify nVal;
1406 bool bRetval(false);
1408 if(rValue >>= nVal)
1410 if (nVal == table::CellHoriJustify_REPEAT)
1412 rStrExpValue = GetXMLToken(XML_TRUE);
1413 bRetval = true;
1415 else
1417 rStrExpValue = GetXMLToken(XML_FALSE);
1418 bRetval = true;
1422 return bRetval;
1425 XmlScPropHdl_Orientation::~XmlScPropHdl_Orientation()
1429 bool XmlScPropHdl_Orientation::equals(
1430 const css::uno::Any& r1,
1431 const css::uno::Any& r2 ) const
1433 table::CellOrientation aOrientation1, aOrientation2;
1435 if((r1 >>= aOrientation1) && (r2 >>= aOrientation2))
1436 return (aOrientation1 == aOrientation2);
1437 return false;
1440 bool XmlScPropHdl_Orientation::importXML(
1441 const OUString& rStrImpValue,
1442 css::uno::Any& rValue,
1443 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1445 bool bRetval(false);
1447 table::CellOrientation nValue;
1448 if (IsXMLToken(rStrImpValue, XML_LTR))
1450 nValue = table::CellOrientation_STANDARD;
1451 rValue <<= nValue;
1452 bRetval = true;
1454 else if (IsXMLToken(rStrImpValue, XML_TTB))
1456 nValue = table::CellOrientation_STACKED;
1457 rValue <<= nValue;
1458 bRetval = true;
1461 return bRetval;
1464 bool XmlScPropHdl_Orientation::exportXML(
1465 OUString& rStrExpValue,
1466 const css::uno::Any& rValue,
1467 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1469 table::CellOrientation nVal;
1470 bool bRetval(false);
1472 if(rValue >>= nVal)
1474 switch (nVal)
1476 case table::CellOrientation_STACKED :
1478 rStrExpValue = GetXMLToken(XML_TTB);
1479 bRetval = true;
1481 break;
1482 default:
1484 rStrExpValue = GetXMLToken(XML_LTR);
1485 bRetval = true;
1487 break;
1491 return bRetval;
1494 XmlScPropHdl_RotateAngle::~XmlScPropHdl_RotateAngle()
1498 bool XmlScPropHdl_RotateAngle::equals(
1499 const css::uno::Any& r1,
1500 const css::uno::Any& r2 ) const
1502 sal_Int32 aAngle1 = 0, aAngle2 = 0;
1504 if((r1 >>= aAngle1) && (r2 >>= aAngle2))
1505 return (aAngle1 == aAngle2);
1506 return false;
1509 bool XmlScPropHdl_RotateAngle::importXML(
1510 const OUString& rStrImpValue,
1511 css::uno::Any& rValue,
1512 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1514 bool bRetval(false);
1516 double fValue;
1517 if (::sax::Converter::convertAngle(fValue, rStrImpValue))
1519 rValue <<= static_cast<sal_Int32>(basegfx::fround(fValue * 100)); // It is already 0<=fValue<=36000.
1520 bRetval = true;
1523 return bRetval;
1526 bool XmlScPropHdl_RotateAngle::exportXML(
1527 OUString& rStrExpValue,
1528 const css::uno::Any& rValue,
1529 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1531 sal_Int32 nVal = 0;
1532 bool bRetval(false);
1534 if(rValue >>= nVal)
1536 rStrExpValue = OUString::number(nVal / 100);
1537 bRetval = true;
1540 return bRetval;
1543 XmlScPropHdl_RotateReference::~XmlScPropHdl_RotateReference()
1547 bool XmlScPropHdl_RotateReference::equals(
1548 const css::uno::Any& r1,
1549 const css::uno::Any& r2 ) const
1551 sal_Int32 aReference1(0), aReference2(0);
1553 if((r1 >>= aReference1) && (r2 >>= aReference2))
1554 return (aReference1 == aReference2);
1555 return false;
1558 bool XmlScPropHdl_RotateReference::importXML(
1559 const OUString& rStrImpValue,
1560 css::uno::Any& rValue,
1561 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1563 bool bRetval(false);
1565 sal_Int32 nValue;
1566 if (IsXMLToken(rStrImpValue, XML_NONE))
1568 nValue = table::CellVertJustify2::STANDARD;
1569 rValue <<= nValue;
1570 bRetval = true;
1572 else if (IsXMLToken(rStrImpValue, XML_BOTTOM))
1574 nValue = table::CellVertJustify2::BOTTOM;
1575 rValue <<= nValue;
1576 bRetval = true;
1578 else if (IsXMLToken(rStrImpValue, XML_TOP))
1580 nValue = table::CellVertJustify2::TOP;
1581 rValue <<= nValue;
1582 bRetval = true;
1584 else if (IsXMLToken(rStrImpValue, XML_CENTER))
1586 nValue = table::CellVertJustify2::CENTER;
1587 rValue <<= nValue;
1588 bRetval = true;
1591 return bRetval;
1594 bool XmlScPropHdl_RotateReference::exportXML(
1595 OUString& rStrExpValue,
1596 const css::uno::Any& rValue,
1597 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1599 sal_Int32 nVal(0);
1600 bool bRetval(false);
1602 if(rValue >>= nVal)
1604 switch (nVal)
1606 case table::CellVertJustify2::BOTTOM :
1608 rStrExpValue = GetXMLToken(XML_BOTTOM);
1609 bRetval = true;
1611 break;
1612 case table::CellVertJustify2::CENTER :
1614 rStrExpValue = GetXMLToken(XML_CENTER);
1615 bRetval = true;
1617 break;
1618 case table::CellVertJustify2::STANDARD :
1620 rStrExpValue = GetXMLToken(XML_NONE);
1621 bRetval = true;
1623 break;
1624 case table::CellVertJustify2::TOP :
1626 rStrExpValue = GetXMLToken(XML_TOP);
1627 bRetval = true;
1629 break;
1630 default:
1632 // added to avoid warnings
1637 return bRetval;
1640 XmlScPropHdl_VertJustify::~XmlScPropHdl_VertJustify()
1644 bool XmlScPropHdl_VertJustify::equals(
1645 const css::uno::Any& r1,
1646 const css::uno::Any& r2 ) const
1648 sal_Int32 aReference1(0), aReference2(0);
1650 if((r1 >>= aReference1) && (r2 >>= aReference2))
1651 return (aReference1 == aReference2);
1652 return false;
1655 bool XmlScPropHdl_VertJustify::importXML(
1656 const OUString& rStrImpValue,
1657 css::uno::Any& rValue,
1658 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1660 bool bRetval(false);
1662 sal_Int32 nValue;
1663 if (IsXMLToken(rStrImpValue, XML_AUTOMATIC))
1665 nValue = table::CellVertJustify2::STANDARD;
1666 rValue <<= nValue;
1667 bRetval = true;
1669 else if (IsXMLToken(rStrImpValue, XML_BOTTOM))
1671 nValue = table::CellVertJustify2::BOTTOM;
1672 rValue <<= nValue;
1673 bRetval = true;
1675 else if (IsXMLToken(rStrImpValue, XML_TOP))
1677 nValue = table::CellVertJustify2::TOP;
1678 rValue <<= nValue;
1679 bRetval = true;
1681 else if (IsXMLToken(rStrImpValue, XML_MIDDLE))
1683 nValue = table::CellVertJustify2::CENTER;
1684 rValue <<= nValue;
1685 bRetval = true;
1687 else if (IsXMLToken(rStrImpValue, XML_JUSTIFY))
1689 nValue = table::CellVertJustify2::BLOCK;
1690 rValue <<= nValue;
1691 bRetval = true;
1694 return bRetval;
1697 bool XmlScPropHdl_VertJustify::exportXML(
1698 OUString& rStrExpValue,
1699 const css::uno::Any& rValue,
1700 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1702 sal_Int32 nVal(0);
1703 bool bRetval(false);
1705 if(rValue >>= nVal)
1707 switch (nVal)
1709 case table::CellVertJustify2::BOTTOM :
1711 rStrExpValue = GetXMLToken(XML_BOTTOM);
1712 bRetval = true;
1714 break;
1715 case table::CellVertJustify2::CENTER :
1717 rStrExpValue = GetXMLToken(XML_MIDDLE);
1718 bRetval = true;
1720 break;
1721 case table::CellVertJustify2::STANDARD :
1723 rStrExpValue = GetXMLToken(XML_AUTOMATIC);
1724 bRetval = true;
1726 break;
1727 case table::CellVertJustify2::TOP :
1729 rStrExpValue = GetXMLToken(XML_TOP);
1730 bRetval = true;
1732 break;
1733 case table::CellVertJustify2::BLOCK :
1735 rStrExpValue = GetXMLToken(XML_JUSTIFY);
1736 bRetval = true;
1738 break;
1739 default:
1741 // added to avoid warnings
1746 return bRetval;
1749 XmlScPropHdl_BreakBefore::~XmlScPropHdl_BreakBefore()
1753 bool XmlScPropHdl_BreakBefore::equals(
1754 const css::uno::Any& r1,
1755 const css::uno::Any& r2 ) const
1757 bool aBreak1 = false, aBreak2 = false;
1759 if((r1 >>= aBreak1) && (r2 >>= aBreak2))
1760 return (aBreak1 == aBreak2);
1761 return false;
1764 bool XmlScPropHdl_BreakBefore::importXML(
1765 const OUString& rStrImpValue,
1766 css::uno::Any& rValue,
1767 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1769 bool bRetval(false);
1771 bool bValue;
1772 if (IsXMLToken(rStrImpValue, XML_AUTO))
1774 bValue = false;
1775 rValue <<= bValue;
1776 bRetval = true;
1778 else if (IsXMLToken(rStrImpValue, XML_PAGE))
1780 bValue = true;
1781 rValue <<= bValue;
1782 bRetval = true;
1785 return bRetval;
1788 bool XmlScPropHdl_BreakBefore::exportXML(
1789 OUString& rStrExpValue,
1790 const css::uno::Any& rValue,
1791 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1793 bool bRetval(false);
1795 if(::cppu::any2bool(rValue))
1797 rStrExpValue = GetXMLToken(XML_PAGE);
1798 bRetval = true;
1800 else
1802 rStrExpValue = GetXMLToken(XML_AUTO);
1803 bRetval = true;
1806 return bRetval;
1809 XmlScPropHdl_IsTextWrapped::~XmlScPropHdl_IsTextWrapped()
1813 bool XmlScPropHdl_IsTextWrapped::equals(
1814 const css::uno::Any& r1,
1815 const css::uno::Any& r2 ) const
1817 return (::cppu::any2bool(r1) == ::cppu::any2bool(r2));
1820 bool XmlScPropHdl_IsTextWrapped::importXML(
1821 const OUString& rStrImpValue,
1822 css::uno::Any& rValue,
1823 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1825 bool bRetval(false);
1827 if (IsXMLToken(rStrImpValue, XML_WRAP))
1829 rValue <<= true;
1830 bRetval = true;
1832 else if (IsXMLToken(rStrImpValue, XML_NO_WRAP))
1834 rValue <<= false;
1835 bRetval = true;
1838 return bRetval;
1841 bool XmlScPropHdl_IsTextWrapped::exportXML(
1842 OUString& rStrExpValue,
1843 const css::uno::Any& rValue,
1844 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1846 bool bRetval(false);
1848 if (::cppu::any2bool(rValue))
1850 rStrExpValue = GetXMLToken(XML_WRAP);
1851 bRetval = true;
1853 else
1855 rStrExpValue = GetXMLToken(XML_NO_WRAP);
1856 bRetval = true;
1859 return bRetval;
1862 bool XmlScPropHdl_IsEqual::importXML( const OUString& /* rStrImpValue */,
1863 css::uno::Any& /* rValue */,
1864 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1866 OSL_FAIL("should never be called");
1867 return false;
1870 bool XmlScPropHdl_IsEqual::exportXML( OUString& /* rStrExpValue */,
1871 const css::uno::Any& /* rValue */,
1872 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1874 OSL_FAIL("should never be called");
1875 return false;
1878 XmlScPropHdl_Vertical::~XmlScPropHdl_Vertical()
1882 bool XmlScPropHdl_Vertical::equals(
1883 const css::uno::Any& r1,
1884 const css::uno::Any& r2 ) const
1886 return (::cppu::any2bool(r1) == ::cppu::any2bool(r2));
1889 bool XmlScPropHdl_Vertical::importXML(
1890 const OUString& rStrImpValue,
1891 css::uno::Any& rValue,
1892 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1894 bool bRetval(false);
1896 if (IsXMLToken(rStrImpValue, XML_AUTO))
1898 rValue <<= true;
1899 bRetval = true;
1901 else if (IsXMLToken(rStrImpValue, XML_0))
1903 rValue <<= false;
1904 bRetval = true;
1907 return bRetval;
1910 bool XmlScPropHdl_Vertical::exportXML(
1911 OUString& rStrExpValue,
1912 const css::uno::Any& rValue,
1913 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1915 bool bRetval(false);
1917 if (::cppu::any2bool(rValue))
1919 rStrExpValue = GetXMLToken(XML_AUTO);
1920 bRetval = true;
1922 else
1924 rStrExpValue = GetXMLToken(XML_0);
1925 bRetval = true;
1928 return bRetval;
1931 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */