Version 7.5.1.1, tag libreoffice-7.5.1.1
[LibreOffice.git] / sc / source / filter / xml / xmlstyle.cxx
blob2c49937788700bf5f37b4afa440493fcb34ed109
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 <sax/tools/converter.hxx>
33 #include <com/sun/star/util/CellProtection.hpp>
34 #include <com/sun/star/table/CellOrientation.hpp>
35 #include <com/sun/star/table/CellVertJustify2.hpp>
36 #include <com/sun/star/table/CellHoriJustify.hpp>
37 #include <com/sun/star/table/CellJustifyMethod.hpp>
38 #include <com/sun/star/table/BorderLine2.hpp>
39 #include <com/sun/star/sheet/XSheetConditionalEntry.hpp>
40 #include <com/sun/star/sheet/XSheetCondition.hpp>
41 #include <com/sun/star/beans/XPropertySet.hpp>
42 #include <com/sun/star/container/XIndexAccess.hpp>
43 #include <comphelper/extract.hxx>
45 #include <rtl/ustrbuf.hxx>
46 #include <osl/diagnose.h>
48 using namespace com::sun::star;
49 using namespace ::xmloff::token;
50 using namespace ::formula;
52 #define MAP(name,prefix,token,type,context) { name, prefix, token, type, context, SvtSaveOptions::ODFSVER_010, false }
53 #define MAP_ODF13(name,prefix,token,type,context) { name, prefix, token, type, context, SvtSaveOptions::ODFSVER_013, false }
54 // extensions import/export
55 #define MAP_EXT(name,prefix,token,type,context) { name, prefix, token, type, context, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, false }
56 // extensions import only
57 #define MAP_EXT_I(name,prefix,token,type,context) { name, prefix, token, type, context, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, true }
58 #define MAP_END() { nullptr }
60 const XMLPropertyMapEntry aXMLScCellStylesProperties[] =
62 MAP( SC_UNONAME_ASIANVERT, XML_NAMESPACE_STYLE, XML_GLYPH_ORIENTATION_VERTICAL, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_VERTICAL, 0),
63 MAP( SC_UNONAME_BOTTBORDER, XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_BOTTOMBORDER ),
64 MAP( SC_UNONAME_BOTTBORDER, XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_BOTTOMBORDERWIDTH ),
65 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 ),
66 MAP( SC_UNONAME_CELLPRO, XML_NAMESPACE_STYLE, XML_CELL_PROTECT, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_CELLPROTECTION|MID_FLAG_MERGE_PROPERTY, 0 ),
67 MAP( SC_UNONAME_CELLPRO, XML_NAMESPACE_STYLE, XML_PRINT_CONTENT, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_PRINTCONTENT|MID_FLAG_MERGE_PROPERTY, 0 ),
68 MAP( SC_UNONAME_CELLSTYL, XML_NAMESPACE_STYLE, XML_STYLE, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_STRING, CTF_SC_CELLSTYLE ),
69 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 ),
70 MAP( SC_UNONAME_CONDXML, XML_NAMESPACE_STYLE, XML_MAP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_MAP ),
71 MAP( SC_UNONAME_DIAGONAL_BLTR, XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_DIAGONALBLTR ),
72 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
73 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 ),
74 MAP( SC_UNONAME_DIAGONAL_TLBR, XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_DIAGONALTLBR ),
75 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
76 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 ),
77 MAP( SC_UNONAME_CELLHJUS, XML_NAMESPACE_FO, XML_TEXT_ALIGN, XML_TYPE_PROP_PARAGRAPH|XML_SC_TYPE_HORIJUSTIFY|MID_FLAG_MERGE_PROPERTY, 0 ),
78 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 ),
79 MAP( SC_UNONAME_CELLHJUS, XML_NAMESPACE_STYLE, XML_REPEAT_CONTENT, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_HORIJUSTIFYREPEAT|MID_FLAG_MERGE_PROPERTY, 0 ),
80 // FIXME this was wrongly exported to STYLE namespace since 2013
81 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 ),
82 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 ),
83 MAP_EXT( SC_UNONAME_CELLHJUS_METHOD, XML_NAMESPACE_CSS3TEXT, XML_TEXT_JUSTIFY, XML_TYPE_PROP_PARAGRAPH|XML_SC_TYPE_HORIJUSTIFY_METHOD, 0 ),
84 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 ),
85 MAP( SC_UNONAME_WRAP, XML_NAMESPACE_FO, XML_WRAP_OPTION, XML_TYPE_PROP_TABLE_CELL|XML_SC_ISTEXTWRAPPED, 0 ),
86 MAP( SC_UNONAME_LEFTBORDER, XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_ALLBORDER ),
87 MAP( SC_UNONAME_LEFTBORDER, XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_LEFTBORDER ),
88 MAP( SC_UNONAME_LEFTBORDER, XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_ALLBORDERWIDTH ),
89 MAP( SC_UNONAME_LEFTBORDER, XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_LEFTBORDERWIDTH ),
90 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),
91 MAP( SC_UNONAME_ORIENT, XML_NAMESPACE_STYLE, XML_DIRECTION, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_ORIENTATION, 0 ),
92 MAP( SC_UNONAME_PBMARGIN, XML_NAMESPACE_FO, XML_PADDING, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_ALLPADDING ),
93 MAP( SC_UNONAME_PBMARGIN, XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_BOTTOMPADDING ),
94 MAP( SC_UNONAME_PINDENT, XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_PROP_PARAGRAPH|XML_TYPE_MEASURE16, 0 ),
95 MAP( SC_UNONAME_PLMARGIN, XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_LEFTPADDING ),
96 MAP( SC_UNONAME_PRMARGIN, XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_RIGHTPADDING ),
97 MAP( SC_UNONAME_PTMARGIN, XML_NAMESPACE_FO, XML_PADDING_TOP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_TOPPADDING ),
98 MAP( SC_UNONAME_RIGHTBORDER, XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_RIGHTBORDER ),
99 MAP( SC_UNONAME_RIGHTBORDER, XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_RIGHTBORDERWIDTH ),
100 MAP( SC_UNONAME_ROTANG, XML_NAMESPACE_STYLE, XML_ROTATION_ANGLE, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_ROTATEANGLE, 0 ),
101 MAP( SC_UNONAME_ROTREF, XML_NAMESPACE_STYLE, XML_ROTATION_ALIGN, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_ROTATEREFERENCE, 0),
102 MAP( SC_UNONAME_SHADOW, XML_NAMESPACE_STYLE, XML_SHADOW, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_TEXT_SHADOW, 0 ),
103 MAP( SC_UNONAME_SHRINK_TO_FIT, XML_NAMESPACE_STYLE, XML_SHRINK_TO_FIT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BOOL, 0 ),
104 MAP( SC_UNO_STANDARDDEC, XML_NAMESPACE_STYLE, XML_DECIMAL_PLACES, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_NUMBER16, 0 ),
105 MAP( SC_UNONAME_TOPBORDER, XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_TOPBORDER ),
106 MAP( SC_UNONAME_TOPBORDER, XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_TOPBORDERWIDTH ),
107 MAP( SC_UNONAME_USERDEF, XML_NAMESPACE_TEXT, XML_XMLNS, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),
108 MAP( SC_UNONAME_VALIXML, XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BUILDIN_CMP_ONLY, CTF_SC_VALIDATION ),
109 MAP( SC_UNONAME_CELLVJUS, XML_NAMESPACE_STYLE, XML_VERTICAL_ALIGN, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_VERTJUSTIFY, 0),
110 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+
111 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
112 MAP_END()
115 const XMLPropertyMapEntry aXMLScColumnStylesProperties[] =
117 MAP( SC_UNONAME_MANPAGE, XML_NAMESPACE_FO, XML_BREAK_BEFORE, XML_TYPE_PROP_TABLE_COLUMN|XML_SC_TYPE_BREAKBEFORE, 0),
118 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 ),
119 MAP( SC_UNONAME_CELLWID, XML_NAMESPACE_STYLE, XML_COLUMN_WIDTH, XML_TYPE_PROP_TABLE_COLUMN|XML_TYPE_MEASURE, 0 ),
120 MAP_END()
123 const XMLPropertyMapEntry aXMLScRowStylesImportProperties[] =
125 // #i57867# Include background color (CellBackColor/IsCellBackgroundTransparent) for import only.
126 // Import and export should use the same map, with MID_FLAG_NO_PROPERTY_EXPORT for the background entries,
127 // but this doesn't work at the moment because SvXMLImportPropertyMapper compares MID_FLAG_NO_PROPERTY to 0.
128 // If this is changed (not for 2.0.x), a single map can be used again.
130 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 ),
131 MAP( SC_UNONAME_CELLHGT, XML_NAMESPACE_STYLE, XML_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_MEASURE, CTF_SC_ROWHEIGHT),
132 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 ),
133 MAP( SC_UNONAME_MANPAGE, XML_NAMESPACE_FO, XML_BREAK_BEFORE, XML_TYPE_PROP_TABLE_ROW|XML_SC_TYPE_BREAKBEFORE, CTF_SC_ROWBREAKBEFORE),
134 MAP( SC_UNONAME_OHEIGHT, XML_NAMESPACE_STYLE, XML_USE_OPTIMAL_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_BOOL, CTF_SC_ROWOPTIMALHEIGHT),
135 MAP_END()
138 const XMLPropertyMapEntry aXMLScRowStylesProperties[] =
140 MAP( SC_UNONAME_CELLHGT, XML_NAMESPACE_STYLE, XML_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_MEASURE, CTF_SC_ROWHEIGHT),
141 MAP( SC_UNONAME_MANPAGE, XML_NAMESPACE_FO, XML_BREAK_BEFORE, XML_TYPE_PROP_TABLE_ROW|XML_SC_TYPE_BREAKBEFORE, CTF_SC_ROWBREAKBEFORE),
142 MAP( SC_UNONAME_OHEIGHT, XML_NAMESPACE_STYLE, XML_USE_OPTIMAL_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_BOOL, CTF_SC_ROWOPTIMALHEIGHT),
143 MAP_END()
146 const XMLPropertyMapEntry aXMLScFromXLSRowStylesProperties[] =
148 MAP( SC_UNONAME_CELLHGT, XML_NAMESPACE_STYLE, XML_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_MEASURE, CTF_SC_ROWHEIGHT),
149 MAP( SC_UNONAME_MANPAGE, XML_NAMESPACE_FO, XML_BREAK_BEFORE, XML_TYPE_PROP_TABLE_ROW|XML_SC_TYPE_BREAKBEFORE, CTF_SC_ROWBREAKBEFORE),
150 MAP( SC_UNONAME_OHEIGHT, XML_NAMESPACE_STYLE, XML_USE_OPTIMAL_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_BOOL_FALSE, CTF_SC_ROWOPTIMALHEIGHT),
151 MAP_END()
154 const XMLPropertyMapEntry aXMLScTableStylesImportProperties[] =
156 // #i57869# Include background color (CellBackColor/IsCellBackgroundTransparent) for import only.
157 // Import and export should use the same map, with MID_FLAG_NO_PROPERTY_EXPORT for the background entries,
158 // but this doesn't work at the moment because SvXMLImportPropertyMapper compares MID_FLAG_NO_PROPERTY to 0.
159 // If this is changed (not for 2.0.x), a single map can be used again.
161 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 ),
162 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 ),
163 MAP( SC_UNONAME_CELLVIS, XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TYPE_PROP_TABLE|XML_TYPE_BOOL, 0 ),
164 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 ),
165 MAP( SC_UNONAME_TABLAYOUT, XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_TYPE_PROP_TABLE|XML_TYPE_TEXT_WRITING_MODE, 0 ),
166 MAP_ODF13( SC_UNONAME_TABCOLOR, XML_NAMESPACE_TABLE, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
167 MAP_ODF13( SC_UNONAME_TABCOLOR, XML_NAMESPACE_TABLE_EXT, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
168 MAP_END()
171 const XMLPropertyMapEntry aXMLScTableStylesProperties[] =
173 MAP( SC_UNONAME_CELLVIS, XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TYPE_PROP_TABLE|XML_TYPE_BOOL, 0 ),
174 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 ),
175 MAP( SC_UNONAME_TABLAYOUT, XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_TYPE_PROP_TABLE|XML_TYPE_TEXT_WRITING_MODE, 0 ),
176 // ODF 1.3 OFFICE-2173
177 MAP_ODF13( SC_UNONAME_TABCOLOR, XML_NAMESPACE_TABLE, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
178 MAP_ODF13( SC_UNONAME_TABCOLOR, XML_NAMESPACE_TABLE_EXT, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
179 MAP_END()
182 ScXMLCellExportPropertyMapper::ScXMLCellExportPropertyMapper(
183 const rtl::Reference< XMLPropertySetMapper >& rMapper )
184 : SvXMLExportPropertyMapper(rMapper)
188 ScXMLCellExportPropertyMapper::~ScXMLCellExportPropertyMapper()
192 void ScXMLCellExportPropertyMapper::ContextFilter(
193 bool bEnableFoFontFamily,
194 ::std::vector< XMLPropertyState >& rProperties,
195 const uno::Reference< beans::XPropertySet >& rPropSet ) const
197 XMLPropertyState* pPadding = nullptr;
198 XMLPropertyState* pPadding_Bottom = nullptr;
199 XMLPropertyState* pPadding_Left = nullptr;
200 XMLPropertyState* pPadding_Right = nullptr;
201 XMLPropertyState* pPadding_Top = nullptr;
203 XMLPropertyState* pBorder = nullptr;
204 XMLPropertyState* pBorder_Bottom = nullptr;
205 XMLPropertyState* pBorder_Left = nullptr;
206 XMLPropertyState* pBorder_Right = nullptr;
207 XMLPropertyState* pBorder_Top = nullptr;
208 XMLPropertyState* pSWBorder = nullptr;
209 XMLPropertyState* pSWBorder_Bottom = nullptr;
210 XMLPropertyState* pSWBorder_Left = nullptr;
211 XMLPropertyState* pSWBorder_Right = nullptr;
212 XMLPropertyState* pSWBorder_Top = nullptr;
214 XMLPropertyState* pAllBorderWidthState = nullptr;
215 XMLPropertyState* pLeftBorderWidthState = nullptr;
216 XMLPropertyState* pRightBorderWidthState = nullptr;
217 XMLPropertyState* pTopBorderWidthState = nullptr;
218 XMLPropertyState* pBottomBorderWidthState = nullptr;
219 XMLPropertyState* pSWAllBorderWidthState = nullptr;
220 XMLPropertyState* pSWLeftBorderWidthState = nullptr;
221 XMLPropertyState* pSWRightBorderWidthState = nullptr;
222 XMLPropertyState* pSWTopBorderWidthState = nullptr;
223 XMLPropertyState* pSWBottomBorderWidthState = nullptr;
224 XMLPropertyState* pDiagonalTLBRWidthState = nullptr;
225 XMLPropertyState* pDiagonalBLTRWidthState = nullptr;
227 XMLPropertyState* pParaMarginLeft = nullptr;
228 XMLPropertyState* pParaMarginLeftRel = nullptr;
229 XMLPropertyState* pParaMarginRight = nullptr;
230 XMLPropertyState* pParaMarginRightRel = nullptr;
231 XMLPropertyState* pParaMarginTop = nullptr;
232 XMLPropertyState* pParaMarginTopRel = nullptr;
233 XMLPropertyState* pParaMarginBottom = nullptr;
234 XMLPropertyState* pParaMarginBottomRel = nullptr;
236 XMLPropertyState* pParaAdjust = nullptr;
237 XMLPropertyState* pParaAdjustLast = nullptr;
239 for( auto& rProperty : rProperties )
241 XMLPropertyState* propertyState = &rProperty;
242 if (propertyState->mnIndex != -1)
244 switch( getPropertySetMapper()->GetEntryContextId( propertyState->mnIndex ) )
246 case CTF_SC_ALLPADDING: pPadding = propertyState; break;
247 case CTF_SC_BOTTOMPADDING: pPadding_Bottom = propertyState; break;
248 case CTF_SC_LEFTPADDING: pPadding_Left = propertyState; break;
249 case CTF_SC_RIGHTPADDING: pPadding_Right = propertyState; break;
250 case CTF_SC_TOPPADDING: pPadding_Top = propertyState; break;
251 case CTF_SC_ALLBORDER: pBorder = propertyState; break;
252 case CTF_SC_LEFTBORDER: pBorder_Left = propertyState; break;
253 case CTF_SC_RIGHTBORDER: pBorder_Right = propertyState; break;
254 case CTF_SC_BOTTOMBORDER: pBorder_Bottom = propertyState; break;
255 case CTF_SC_TOPBORDER: pBorder_Top = propertyState; break;
256 case CTF_SC_ALLBORDERWIDTH: pAllBorderWidthState = propertyState; break;
257 case CTF_SC_LEFTBORDERWIDTH: pLeftBorderWidthState = propertyState; break;
258 case CTF_SC_RIGHTBORDERWIDTH: pRightBorderWidthState = propertyState; break;
259 case CTF_SC_TOPBORDERWIDTH: pTopBorderWidthState = propertyState; break;
260 case CTF_SC_BOTTOMBORDERWIDTH: pBottomBorderWidthState = propertyState; break;
261 case CTF_ALLBORDER: pSWBorder = propertyState; break;
262 case CTF_LEFTBORDER: pSWBorder_Left = propertyState; break;
263 case CTF_RIGHTBORDER: pSWBorder_Right = propertyState; break;
264 case CTF_BOTTOMBORDER: pSWBorder_Bottom = propertyState; break;
265 case CTF_TOPBORDER: pSWBorder_Top = propertyState; break;
266 case CTF_ALLBORDERWIDTH: pSWAllBorderWidthState = propertyState; break;
267 case CTF_LEFTBORDERWIDTH: pSWLeftBorderWidthState = propertyState; break;
268 case CTF_RIGHTBORDERWIDTH: pSWRightBorderWidthState = propertyState; break;
269 case CTF_TOPBORDERWIDTH: pSWTopBorderWidthState = propertyState; break;
270 case CTF_BOTTOMBORDERWIDTH: pSWBottomBorderWidthState = propertyState; break;
271 case CTF_SC_DIAGONALTLBR: break; //old diagonal line attribute names without "s" are only read, not written
272 case CTF_SC_DIAGONALTLBRWIDTH: pDiagonalTLBRWidthState = propertyState; break;
273 case CTF_SC_DIAGONALBLTR: break; //old diagonal line attribute names without "s" are only read, not written
274 case CTF_SC_DIAGONALBLTRWIDTH: pDiagonalBLTRWidthState = propertyState; break;
275 case CTF_SD_SHAPE_PARA_ADJUST: pParaAdjust = propertyState; break;
276 case CTF_PARA_ADJUSTLAST: pParaAdjustLast = propertyState; break;
277 case CTF_PARALEFTMARGIN: pParaMarginLeft = propertyState; break;
278 case CTF_PARALEFTMARGIN_REL: pParaMarginLeftRel = propertyState; break;
279 case CTF_PARARIGHTMARGIN: pParaMarginRight = propertyState; break;
280 case CTF_PARARIGHTMARGIN_REL: pParaMarginRightRel = propertyState; break;
281 case CTF_PARATOPMARGIN: pParaMarginTop = propertyState; break;
282 case CTF_PARATOPMARGIN_REL: pParaMarginTopRel = propertyState; break;
283 case CTF_PARABOTTOMMARGIN: pParaMarginBottom = propertyState; break;
284 case CTF_PARABOTTOMMARGIN_REL: pParaMarginBottomRel = propertyState; break;
289 if (pPadding && pPadding_Bottom && pPadding_Left && pPadding_Right && pPadding_Top)
291 sal_Int32 nBottom = 0, nTop = 0, nLeft = 0, nRight = 0;
292 if ((pPadding_Bottom->maValue >>= nBottom) &&
293 (pPadding_Left->maValue >>= nLeft) &&
294 (pPadding_Right->maValue >>= nRight) &&
295 (pPadding_Top->maValue >>= nTop))
297 if ((nBottom == nTop) && (nLeft == nRight) && (nTop == nLeft))
299 pPadding_Bottom->mnIndex = -1;
300 pPadding_Bottom->maValue.clear();
301 pPadding_Left->mnIndex = -1;
302 pPadding_Left->maValue.clear();
303 pPadding_Right->mnIndex = -1;
304 pPadding_Right->maValue.clear();
305 pPadding_Top->mnIndex = -1;
306 pPadding_Top->maValue.clear();
308 else
310 pPadding->mnIndex = -1;
311 pPadding->maValue.clear();
315 if( pBorder )
317 if( pBorder_Left && pBorder_Right && pBorder_Top && pBorder_Bottom )
319 table::BorderLine2 aLeft, aRight, aTop, aBottom;
321 pBorder_Left->maValue >>= aLeft;
322 pBorder_Right->maValue >>= aRight;
323 pBorder_Top->maValue >>= aTop;
324 pBorder_Bottom->maValue >>= aBottom;
325 if( aLeft.Color == aRight.Color && aLeft.InnerLineWidth == aRight.InnerLineWidth &&
326 aLeft.OuterLineWidth == aRight.OuterLineWidth && aLeft.LineDistance == aRight.LineDistance &&
327 aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth &&
328 aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance &&
329 aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth &&
330 aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance &&
331 aLeft.LineStyle == aRight.LineStyle && aLeft.LineStyle == aTop.LineStyle &&
332 aLeft.LineStyle == aBottom.LineStyle && aLeft.LineWidth == aRight.LineWidth &&
333 aLeft.LineWidth == aTop.LineWidth && aLeft.LineWidth == aBottom.LineWidth )
335 pBorder_Left->mnIndex = -1;
336 pBorder_Left->maValue.clear();
337 pBorder_Right->mnIndex = -1;
338 pBorder_Right->maValue.clear();
339 pBorder_Top->mnIndex = -1;
340 pBorder_Top->maValue.clear();
341 pBorder_Bottom->mnIndex = -1;
342 pBorder_Bottom->maValue.clear();
344 else
346 pBorder->mnIndex = -1;
347 pBorder->maValue.clear();
350 else
352 pBorder->mnIndex = -1;
353 pBorder->maValue.clear();
356 if( pAllBorderWidthState )
358 if( pLeftBorderWidthState && pRightBorderWidthState && pTopBorderWidthState && pBottomBorderWidthState )
360 table::BorderLine2 aLeft, aRight, aTop, aBottom;
362 pLeftBorderWidthState->maValue >>= aLeft;
363 pRightBorderWidthState->maValue >>= aRight;
364 pTopBorderWidthState->maValue >>= aTop;
365 pBottomBorderWidthState->maValue >>= aBottom;
366 if( aLeft.InnerLineWidth == aRight.InnerLineWidth && aLeft.OuterLineWidth == aRight.OuterLineWidth &&
367 aLeft.LineDistance == aRight.LineDistance && aLeft.InnerLineWidth == aTop.InnerLineWidth &&
368 aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance &&
369 aLeft.InnerLineWidth == aBottom.InnerLineWidth && aLeft.OuterLineWidth == aBottom.OuterLineWidth &&
370 aLeft.LineDistance == aBottom.LineDistance && aLeft.LineWidth == aRight.LineWidth &&
371 aLeft.LineWidth == aTop.LineWidth && aLeft.LineWidth == aBottom.LineWidth )
373 pLeftBorderWidthState->mnIndex = -1;
374 pLeftBorderWidthState->maValue.clear();
375 pRightBorderWidthState->mnIndex = -1;
376 pRightBorderWidthState->maValue.clear();
377 pTopBorderWidthState->mnIndex = -1;
378 pTopBorderWidthState->maValue.clear();
379 pBottomBorderWidthState->mnIndex = -1;
380 pBottomBorderWidthState->maValue.clear();
382 else
384 pAllBorderWidthState->mnIndex = -1;
385 pAllBorderWidthState->maValue.clear();
388 else
390 pAllBorderWidthState->mnIndex = -1;
391 pAllBorderWidthState->maValue.clear();
395 if (pParaAdjust)
397 pParaAdjust->mnIndex = -1;
398 pParaAdjust->maValue.clear();
400 if (pParaAdjustLast)
402 pParaAdjustLast->mnIndex = -1;
403 pParaAdjustLast->maValue.clear();
405 if (pSWBorder)
407 pSWBorder->mnIndex = -1;
408 pSWBorder->maValue.clear();
410 if (pSWBorder_Left)
412 pSWBorder_Left->mnIndex = -1;
413 pSWBorder_Left->maValue.clear();
415 if (pSWBorder_Right)
417 pSWBorder_Right->mnIndex = -1;
418 pSWBorder_Right->maValue.clear();
420 if (pSWBorder_Bottom)
422 pSWBorder_Bottom->mnIndex = -1;
423 pSWBorder_Bottom->maValue.clear();
425 if (pSWBorder_Top)
427 pSWBorder_Top->mnIndex = -1;
428 pSWBorder_Top->maValue.clear();
430 if (pSWAllBorderWidthState)
432 pSWAllBorderWidthState->mnIndex = -1;
433 pSWAllBorderWidthState->maValue.clear();
435 if (pSWLeftBorderWidthState)
437 pSWLeftBorderWidthState->mnIndex = -1;
438 pSWLeftBorderWidthState->maValue.clear();
440 if (pSWRightBorderWidthState)
442 pSWRightBorderWidthState->mnIndex = -1;
443 pSWRightBorderWidthState->maValue.clear();
445 if (pSWTopBorderWidthState)
447 pSWTopBorderWidthState->mnIndex = -1;
448 pSWTopBorderWidthState->maValue.clear();
450 if (pSWBottomBorderWidthState)
452 pSWBottomBorderWidthState->mnIndex = -1;
453 pSWBottomBorderWidthState->maValue.clear();
456 if (pParaMarginLeft)
458 pParaMarginLeft->mnIndex = -1;
459 pParaMarginLeft->maValue.clear();
461 if (pParaMarginLeftRel)
463 pParaMarginLeftRel->mnIndex = -1;
464 pParaMarginLeftRel->maValue.clear();
466 if (pParaMarginRight)
468 pParaMarginRight->mnIndex = -1;
469 pParaMarginRight->maValue.clear();
471 if (pParaMarginRightRel)
473 pParaMarginRightRel->mnIndex = -1;
474 pParaMarginRightRel->maValue.clear();
476 if (pParaMarginTop)
478 pParaMarginTop->mnIndex = -1;
479 pParaMarginTop->maValue.clear();
481 if (pParaMarginTopRel)
483 pParaMarginTopRel->mnIndex = -1;
484 pParaMarginTopRel->maValue.clear();
486 if (pParaMarginBottom)
488 pParaMarginBottom->mnIndex = -1;
489 pParaMarginBottom->maValue.clear();
491 if (pParaMarginBottomRel)
493 pParaMarginBottomRel->mnIndex = -1;
494 pParaMarginBottomRel->maValue.clear();
497 // #i102690# old diagonal line attribute names without "s" are only read, not written
498 if (pDiagonalTLBRWidthState)
500 pDiagonalTLBRWidthState->mnIndex = -1;
501 pDiagonalTLBRWidthState->maValue.clear();
503 if (pDiagonalBLTRWidthState)
505 pDiagonalBLTRWidthState->mnIndex = -1;
506 pDiagonalBLTRWidthState->maValue.clear();
509 SvXMLExportPropertyMapper::ContextFilter(bEnableFoFontFamily, rProperties, rPropSet);
512 /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
513 void ScXMLCellExportPropertyMapper::handleSpecialItem(
514 SvXMLAttributeList& /* rAttrList */,
515 const XMLPropertyState& /* rProperty */,
516 const SvXMLUnitConverter& /* rUnitConverter */,
517 const SvXMLNamespaceMap& /* rNamespaceMap */,
518 const ::std::vector< XMLPropertyState > * /* pProperties */,
519 sal_uInt32 /* nIdx */ ) const
521 // the SpecialItem NumberFormat must not be handled by this method
522 // the SpecialItem ConditionlaFormat must not be handled by this method
523 // the SpecialItem CharBackColor must not be handled by this method
525 void ScXMLCellExportPropertyMapper::handleElementItem(
526 SvXMLExport& rExport,
527 const XMLPropertyState& rProperty,
528 SvXmlExportFlags /* nFlags */,
529 const ::std::vector< XMLPropertyState > * /* pProperties */,
530 sal_uInt32 /* nIdx */) const
532 sal_uInt32 nContextId = getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex );
533 OUString sURL;
534 if ( ( nContextId == CTF_SC_HYPERLINK ) &&
535 ( rProperty.maValue >>= sURL ) &&
536 !sURL.isEmpty() )
538 rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sURL );
539 rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE,
540 XML_SIMPLE );
541 sal_uInt32 nPropIndex = rProperty.mnIndex;
542 sal_uInt16 nPrefix = getPropertySetMapper()->GetEntryNameSpace( nPropIndex );
543 OUString sLocalName = getPropertySetMapper()->GetEntryXMLName( nPropIndex );
544 SvXMLElementExport aElem( rExport, nPrefix, sLocalName, true, true );
548 ScXMLRowExportPropertyMapper::ScXMLRowExportPropertyMapper(
549 const rtl::Reference< XMLPropertySetMapper >& rMapper )
550 : SvXMLExportPropertyMapper(rMapper)
554 ScXMLRowExportPropertyMapper::~ScXMLRowExportPropertyMapper()
558 void ScXMLRowExportPropertyMapper::ContextFilter(
559 bool /* bEnableFoFontFamily */,
560 ::std::vector< XMLPropertyState >& /* rProperties */,
561 const uno::Reference< beans::XPropertySet >& /* rPropSet */ ) const
563 //#108550#; don't filter the height, so other applications know the calculated height
566 ScXMLColumnExportPropertyMapper::ScXMLColumnExportPropertyMapper(
567 const rtl::Reference< XMLPropertySetMapper >& rMapper )
568 : SvXMLExportPropertyMapper(rMapper)
572 ScXMLColumnExportPropertyMapper::~ScXMLColumnExportPropertyMapper()
576 /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
577 void ScXMLColumnExportPropertyMapper::handleSpecialItem(
578 SvXMLAttributeList& /* rAttrList */,
579 const XMLPropertyState& /* rProperty */,
580 const SvXMLUnitConverter& /* rUnitConverter */,
581 const SvXMLNamespaceMap& /* rNamespaceMap */,
582 const ::std::vector< XMLPropertyState > * /* pProperties */,
583 sal_uInt32 /* nIdx */ ) const
585 // the SpecialItem IsVisible must not be handled by this method
588 ScXMLTableExportPropertyMapper::ScXMLTableExportPropertyMapper(
589 const rtl::Reference< XMLPropertySetMapper >& rMapper )
590 : SvXMLExportPropertyMapper(rMapper)
594 ScXMLTableExportPropertyMapper::~ScXMLTableExportPropertyMapper()
598 /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
599 void ScXMLTableExportPropertyMapper::handleSpecialItem(
600 SvXMLAttributeList& /* rAttrList */,
601 const XMLPropertyState& /* rProperty */,
602 const SvXMLUnitConverter& /* rUnitConverter */,
603 const SvXMLNamespaceMap& /* rNamespaceMap */,
604 const ::std::vector< XMLPropertyState > * /* pProperties */,
605 sal_uInt32 /* nIdx */ ) const
607 // the SpecialItem PageStyle must not be handled by this method
610 void ScXMLAutoStylePoolP::exportStyleAttributes(
611 SvXMLAttributeList& rAttrList,
612 XmlStyleFamily nFamily,
613 const ::std::vector< XMLPropertyState >& rProperties,
614 const SvXMLExportPropertyMapper& rPropExp
615 , const SvXMLUnitConverter& rUnitConverter,
616 const SvXMLNamespaceMap& rNamespaceMap
617 ) const
619 SvXMLAutoStylePoolP::exportStyleAttributes( rAttrList, nFamily, rProperties, rPropExp, rUnitConverter, rNamespaceMap );
620 if (nFamily == XmlStyleFamily::TABLE_CELL)
622 for(const auto& rProperty : rProperties)
624 rtl::Reference< XMLPropertySetMapper > aPropMapper(rScXMLExport.GetCellStylesPropertySetMapper());
625 sal_Int16 nContextID(aPropMapper->GetEntryContextId(rProperty.mnIndex));
626 switch (nContextID)
628 case CTF_SC_NUMBERFORMAT :
630 sal_Int32 nNumberFormat = 0;
631 if (rProperty.maValue >>= nNumberFormat)
633 OUString sAttrValue(rScXMLExport.getDataStyleName(nNumberFormat));
634 if (!sAttrValue.isEmpty())
636 GetExport().AddAttribute(
637 aPropMapper->GetEntryNameSpace(rProperty.mnIndex),
638 aPropMapper->GetEntryXMLName(rProperty.mnIndex),
639 sAttrValue );
643 break;
647 else if (nFamily == XmlStyleFamily::TABLE_TABLE)
649 for(const auto& rProperty : rProperties)
651 rtl::Reference< XMLPropertySetMapper > aPropMapper(rScXMLExport.GetTableStylesPropertySetMapper());
652 sal_Int16 nContextID(aPropMapper->GetEntryContextId(rProperty.mnIndex));
653 switch (nContextID)
655 case CTF_SC_MASTERPAGENAME :
657 OUString sName;
658 if (rProperty.maValue >>= sName)
660 GetExport().AddAttribute(
661 aPropMapper->GetEntryNameSpace(rProperty.mnIndex),
662 aPropMapper->GetEntryXMLName(rProperty.mnIndex),
663 GetExport().EncodeStyleName( sName ));
666 break;
672 void ScXMLAutoStylePoolP::exportStyleContent(
673 const css::uno::Reference< css::xml::sax::XDocumentHandler > & rHandler,
674 XmlStyleFamily nFamily,
675 const std::vector< XMLPropertyState >& rProperties,
676 const SvXMLExportPropertyMapper& rPropExp
677 , const SvXMLUnitConverter& rUnitConverter,
678 const SvXMLNamespaceMap& rNamespaceMap
679 ) const
681 SvXMLAutoStylePoolP::exportStyleContent( rHandler, nFamily, rProperties, rPropExp, rUnitConverter, rNamespaceMap );
682 if (nFamily != XmlStyleFamily::TABLE_CELL)
683 return;
685 for(const auto& rProperty : rProperties)
687 if (rProperty.mnIndex != -1)
689 sal_Int16 nContextID = rScXMLExport.GetCellStylesPropertySetMapper()->GetEntryContextId(rProperty.mnIndex);
690 switch (nContextID)
692 case CTF_SC_MAP :
694 uno::Reference<container::XIndexAccess> xIndex( rProperty.maValue, uno::UNO_QUERY );
695 if ( xIndex.is() )
697 sal_Int32 nConditionCount(xIndex->getCount());
698 for (sal_Int32 nCondition = 0; nCondition < nConditionCount; ++nCondition)
700 uno::Reference <sheet::XSheetConditionalEntry> xSheetConditionalEntry(xIndex->getByIndex(nCondition), uno::UNO_QUERY);
701 if (xSheetConditionalEntry.is())
703 OUString sStyleName(xSheetConditionalEntry->getStyleName());
704 uno::Reference <sheet::XSheetCondition> xSheetCondition(xSheetConditionalEntry, uno::UNO_QUERY);
705 if (xSheetCondition.is())
707 sheet::ConditionOperator aOperator = xSheetCondition->getOperator();
708 if (aOperator != sheet::ConditionOperator_NONE)
710 if (aOperator == sheet::ConditionOperator_FORMULA)
712 OUString sCondition = "is-true-formula("
713 + xSheetCondition->getFormula1()
714 + ")";
715 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_CONDITION, sCondition);
716 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_APPLY_STYLE_NAME, rScXMLExport.EncodeStyleName( sStyleName ));
717 OUString sOUBaseAddress;
718 ScDocument* pDoc = rScXMLExport.GetDocument();
719 ScRangeStringConverter::GetStringFromAddress( sOUBaseAddress,
720 xSheetCondition->getSourcePosition(), pDoc, FormulaGrammar::CONV_OOO );
721 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_BASE_CELL_ADDRESS, sOUBaseAddress);
722 SvXMLElementExport aMElem(rScXMLExport, XML_NAMESPACE_STYLE, XML_MAP, true, true);
724 else
726 OUString sCondition;
727 if (aOperator == sheet::ConditionOperator_BETWEEN ||
728 aOperator == sheet::ConditionOperator_NOT_BETWEEN)
730 if (aOperator == sheet::ConditionOperator_BETWEEN)
731 sCondition = "cell-content-is-between(";
732 else
733 sCondition = "cell-content-is-not-between(";
734 sCondition += xSheetCondition->getFormula1()
735 + ","
736 + xSheetCondition->getFormula2()
737 + ")";
739 else
741 sCondition = "cell-content()";
742 switch (aOperator)
744 case sheet::ConditionOperator_LESS:
745 sCondition += "<";
746 break;
747 case sheet::ConditionOperator_GREATER:
748 sCondition += ">";
749 break;
750 case sheet::ConditionOperator_LESS_EQUAL:
751 sCondition += "<=";
752 break;
753 case sheet::ConditionOperator_GREATER_EQUAL:
754 sCondition += ">=";
755 break;
756 case sheet::ConditionOperator_EQUAL:
757 sCondition += "=";
758 break;
759 case sheet::ConditionOperator_NOT_EQUAL:
760 sCondition += "!=";
761 break;
762 default:
764 // added to avoid warnings
767 sCondition += xSheetCondition->getFormula1();
769 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_CONDITION, sCondition);
770 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_APPLY_STYLE_NAME, rScXMLExport.EncodeStyleName( sStyleName ));
771 OUString sOUBaseAddress;
772 ScRangeStringConverter::GetStringFromAddress( sOUBaseAddress,
773 xSheetCondition->getSourcePosition(), rScXMLExport.GetDocument(), FormulaGrammar::CONV_OOO );
774 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_BASE_CELL_ADDRESS, sOUBaseAddress);
775 SvXMLElementExport aMElem(rScXMLExport, XML_NAMESPACE_STYLE, XML_MAP, true, true);
783 break;
789 ScXMLAutoStylePoolP::ScXMLAutoStylePoolP(ScXMLExport& rTempScXMLExport):
790 SvXMLAutoStylePoolP(rTempScXMLExport),
791 rScXMLExport(rTempScXMLExport)
795 ScXMLAutoStylePoolP::~ScXMLAutoStylePoolP()
799 XMLScPropHdlFactory::XMLScPropHdlFactory()
803 XMLScPropHdlFactory::~XMLScPropHdlFactory()
807 const XMLPropertyHandler* XMLScPropHdlFactory::GetPropertyHandler( sal_Int32 nType ) const
809 nType &= MID_FLAG_MASK;
811 XMLPropertyHandler* pHdl(const_cast<XMLPropertyHandler*>(XMLPropertyHandlerFactory::GetPropertyHandler( nType )));
812 if(!pHdl)
814 switch(nType)
816 case XML_SC_TYPE_CELLPROTECTION :
818 pHdl = new XmlScPropHdl_CellProtection;
820 break;
821 case XML_SC_TYPE_PRINTCONTENT :
823 pHdl = new XmlScPropHdl_PrintContent;
825 break;
826 case XML_SC_TYPE_HORIJUSTIFY_METHOD:
827 case XML_SC_TYPE_VERTJUSTIFY_METHOD:
829 pHdl = new XmlScPropHdl_JustifyMethod;
831 break;
832 case XML_SC_TYPE_HORIJUSTIFY :
834 pHdl = new XmlScPropHdl_HoriJustify;
836 break;
837 case XML_SC_TYPE_HORIJUSTIFYSOURCE :
839 pHdl = new XmlScPropHdl_HoriJustifySource;
841 break;
842 case XML_SC_TYPE_HORIJUSTIFYREPEAT :
844 pHdl = new XmlScPropHdl_HoriJustifyRepeat;
846 break;
847 case XML_SC_TYPE_ORIENTATION :
849 pHdl = new XmlScPropHdl_Orientation;
851 break;
852 case XML_SC_TYPE_ROTATEANGLE :
854 pHdl = new XmlScPropHdl_RotateAngle;
856 break;
857 case XML_SC_TYPE_ROTATEREFERENCE :
859 pHdl = new XmlScPropHdl_RotateReference;
861 break;
862 case XML_SC_TYPE_VERTJUSTIFY :
864 pHdl = new XmlScPropHdl_VertJustify;
866 break;
867 case XML_SC_TYPE_BREAKBEFORE :
869 pHdl = new XmlScPropHdl_BreakBefore;
871 break;
872 case XML_SC_ISTEXTWRAPPED :
874 pHdl = new XmlScPropHdl_IsTextWrapped;
876 break;
877 case XML_SC_TYPE_EQUAL :
879 pHdl = new XmlScPropHdl_IsEqual;
881 break;
882 case XML_SC_TYPE_VERTICAL :
884 pHdl = new XmlScPropHdl_Vertical;
886 break;
889 if(pHdl)
890 PutHdlCache(nType, pHdl);
893 return pHdl;
896 XmlScPropHdl_CellProtection::~XmlScPropHdl_CellProtection()
900 bool XmlScPropHdl_CellProtection::equals(
901 const css::uno::Any& r1,
902 const css::uno::Any& r2 ) const
904 util::CellProtection aCellProtection1, aCellProtection2;
906 if((r1 >>= aCellProtection1) && (r2 >>= aCellProtection2))
908 return ((aCellProtection1.IsHidden == aCellProtection2.IsHidden) &&
909 (aCellProtection1.IsLocked == aCellProtection2.IsLocked) &&
910 (aCellProtection1.IsFormulaHidden == aCellProtection2.IsFormulaHidden));
912 return false;
915 bool XmlScPropHdl_CellProtection::importXML(
916 const OUString& rStrImpValue,
917 css::uno::Any& rValue,
918 const SvXMLUnitConverter& /* rUnitConverter */ ) const
920 bool bRetval(false);
922 util::CellProtection aCellProtection;
923 bool bDefault(false);
924 if (!rValue.hasValue())
926 aCellProtection.IsHidden = false;
927 aCellProtection.IsLocked = true;
928 aCellProtection.IsFormulaHidden = false;
929 aCellProtection.IsPrintHidden = false;
930 bDefault = true;
932 if ((rValue >>= aCellProtection) || bDefault)
934 if (IsXMLToken(rStrImpValue, XML_NONE))
936 aCellProtection.IsFormulaHidden = false;
937 aCellProtection.IsHidden = false;
938 aCellProtection.IsLocked = false;
939 rValue <<= aCellProtection;
940 bRetval = true;
942 else if (IsXMLToken(rStrImpValue, XML_HIDDEN_AND_PROTECTED))
944 aCellProtection.IsFormulaHidden = true;
945 aCellProtection.IsHidden = true;
946 aCellProtection.IsLocked = true;
947 rValue <<= aCellProtection;
948 bRetval = true;
950 else if (IsXMLToken(rStrImpValue, XML_PROTECTED))
952 aCellProtection.IsFormulaHidden = false;
953 aCellProtection.IsHidden = false;
954 aCellProtection.IsLocked = true;
955 rValue <<= aCellProtection;
956 bRetval = true;
958 else if (IsXMLToken(rStrImpValue, XML_FORMULA_HIDDEN))
960 aCellProtection.IsFormulaHidden = true;
961 aCellProtection.IsHidden = false;
962 aCellProtection.IsLocked = false;
963 rValue <<= aCellProtection;
964 bRetval = true;
966 else
968 sal_Int32 i(0);
969 while (i < rStrImpValue.getLength() && rStrImpValue[i] != ' ')
970 ++i;
971 OUString sFirst(rStrImpValue.copy(0, i));
972 OUString sSecond(rStrImpValue.copy(i + 1));
973 aCellProtection.IsFormulaHidden = false;
974 aCellProtection.IsHidden = false;
975 aCellProtection.IsLocked = false;
976 if ((IsXMLToken(sFirst, XML_PROTECTED)) || (IsXMLToken(sSecond, XML_PROTECTED)))
977 aCellProtection.IsLocked = true;
978 if ((IsXMLToken(sFirst, XML_FORMULA_HIDDEN)) || (IsXMLToken(sSecond, XML_FORMULA_HIDDEN)))
979 aCellProtection.IsFormulaHidden = true;
980 rValue <<= aCellProtection;
981 bRetval = true;
985 return bRetval;
988 bool XmlScPropHdl_CellProtection::exportXML(
989 OUString& rStrExpValue,
990 const css::uno::Any& rValue,
991 const SvXMLUnitConverter& /* rUnitConverter */ ) const
993 bool bRetval(false);
994 util::CellProtection aCellProtection;
996 if(rValue >>= aCellProtection)
998 if (!(aCellProtection.IsFormulaHidden || aCellProtection.IsHidden || aCellProtection.IsLocked))
1000 rStrExpValue = GetXMLToken(XML_NONE);
1001 bRetval = true;
1003 else if (aCellProtection.IsHidden)
1005 // #i105964# "Hide all" implies "Protected" in the UI, so it must be saved as "hidden-and-protected"
1006 // even if "IsLocked" is not set in the CellProtection struct.
1007 rStrExpValue = GetXMLToken(XML_HIDDEN_AND_PROTECTED);
1008 bRetval = true;
1010 else if (aCellProtection.IsLocked && !aCellProtection.IsFormulaHidden)
1012 rStrExpValue = GetXMLToken(XML_PROTECTED);
1013 bRetval = true;
1015 else if (aCellProtection.IsFormulaHidden && !aCellProtection.IsLocked)
1017 rStrExpValue = GetXMLToken(XML_FORMULA_HIDDEN);
1018 bRetval = true;
1020 else if (aCellProtection.IsFormulaHidden && aCellProtection.IsLocked)
1022 rStrExpValue = GetXMLToken(XML_PROTECTED);
1023 rStrExpValue += " ";
1024 rStrExpValue += GetXMLToken(XML_FORMULA_HIDDEN);
1025 bRetval = true;
1029 return bRetval;
1032 XmlScPropHdl_PrintContent::~XmlScPropHdl_PrintContent()
1036 bool XmlScPropHdl_PrintContent::equals(
1037 const css::uno::Any& r1,
1038 const css::uno::Any& r2 ) const
1040 util::CellProtection aCellProtection1, aCellProtection2;
1042 if((r1 >>= aCellProtection1) && (r2 >>= aCellProtection2))
1044 return (aCellProtection1.IsPrintHidden == aCellProtection2.IsPrintHidden);
1046 return false;
1049 bool XmlScPropHdl_PrintContent::importXML(
1050 const OUString& rStrImpValue,
1051 css::uno::Any& rValue,
1052 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1054 bool bRetval(false);
1055 util::CellProtection aCellProtection;
1056 bool bDefault(false);
1057 if (!rValue.hasValue())
1059 aCellProtection.IsHidden = false;
1060 aCellProtection.IsLocked = true;
1061 aCellProtection.IsFormulaHidden = false;
1062 aCellProtection.IsPrintHidden = false;
1063 bDefault = true;
1065 if ((rValue >>= aCellProtection) || bDefault)
1067 bool bValue(false);
1068 if (::sax::Converter::convertBool(bValue, rStrImpValue))
1070 aCellProtection.IsPrintHidden = !bValue;
1071 rValue <<= aCellProtection;
1072 bRetval = true;
1076 return bRetval;
1079 bool XmlScPropHdl_PrintContent::exportXML(
1080 OUString& rStrExpValue,
1081 const css::uno::Any& rValue,
1082 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1084 bool bRetval(false);
1086 util::CellProtection aCellProtection;
1087 if(rValue >>= aCellProtection)
1089 OUStringBuffer sValue;
1090 ::sax::Converter::convertBool(sValue, !aCellProtection.IsPrintHidden);
1091 rStrExpValue = sValue.makeStringAndClear();
1092 bRetval = true;
1095 return bRetval;
1098 XmlScPropHdl_JustifyMethod::~XmlScPropHdl_JustifyMethod()
1102 bool XmlScPropHdl_JustifyMethod::equals(
1103 const css::uno::Any& r1,
1104 const css::uno::Any& r2 ) const
1106 sal_Int32 nVal1(0), nVal2(0);
1108 if((r1 >>= nVal1) && (r2 >>= nVal2))
1109 return (nVal1 == nVal2);
1110 return false;
1113 bool XmlScPropHdl_JustifyMethod::importXML(
1114 const OUString& rStrImpValue,
1115 css::uno::Any& rValue,
1116 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1118 bool bRetval = false;
1120 sal_Int32 nValue = table::CellJustifyMethod::AUTO;
1121 if (IsXMLToken(rStrImpValue, XML_AUTO))
1123 nValue = table::CellJustifyMethod::AUTO;
1124 rValue <<= nValue;
1125 bRetval = true;
1127 else if (IsXMLToken(rStrImpValue, XML_DISTRIBUTE))
1129 nValue = table::CellJustifyMethod::DISTRIBUTE;
1130 rValue <<= nValue;
1131 bRetval = true;
1133 else
1134 bRetval = true;
1136 return bRetval;
1139 bool XmlScPropHdl_JustifyMethod::exportXML(
1140 OUString& rStrExpValue,
1141 const css::uno::Any& rValue,
1142 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1144 sal_Int32 nVal(0);
1145 bool bRetval = false;
1147 if (rValue >>= nVal)
1149 switch (nVal)
1151 case table::CellJustifyMethod::AUTO:
1153 rStrExpValue = GetXMLToken(XML_AUTO);
1154 bRetval = true;
1156 break;
1157 case table::CellJustifyMethod::DISTRIBUTE:
1159 rStrExpValue = GetXMLToken(XML_DISTRIBUTE);
1160 bRetval = true;
1162 break;
1163 default:
1165 // added to avoid warnings
1169 return bRetval;
1172 XmlScPropHdl_HoriJustify::~XmlScPropHdl_HoriJustify()
1176 bool XmlScPropHdl_HoriJustify::equals(
1177 const css::uno::Any& r1,
1178 const css::uno::Any& r2 ) const
1180 table::CellHoriJustify aHoriJustify1, aHoriJustify2;
1182 if((r1 >>= aHoriJustify1) && (r2 >>= aHoriJustify2))
1183 return (aHoriJustify1 == aHoriJustify2);
1184 return false;
1187 bool XmlScPropHdl_HoriJustify::importXML(
1188 const OUString& rStrImpValue,
1189 css::uno::Any& rValue,
1190 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1192 bool bRetval(false);
1194 table::CellHoriJustify nValue = table::CellHoriJustify_LEFT;
1195 rValue >>= nValue;
1196 if (nValue != table::CellHoriJustify_REPEAT)
1198 if (IsXMLToken(rStrImpValue, XML_START))
1200 nValue = table::CellHoriJustify_LEFT;
1201 rValue <<= nValue;
1202 bRetval = true;
1204 else if (IsXMLToken(rStrImpValue, XML_END))
1206 nValue = table::CellHoriJustify_RIGHT;
1207 rValue <<= nValue;
1208 bRetval = true;
1210 else if (IsXMLToken(rStrImpValue, XML_CENTER))
1212 nValue = table::CellHoriJustify_CENTER;
1213 rValue <<= nValue;
1214 bRetval = true;
1216 else if (IsXMLToken(rStrImpValue, XML_JUSTIFY))
1218 nValue = table::CellHoriJustify_BLOCK;
1219 rValue <<= nValue;
1220 bRetval = true;
1223 else
1224 bRetval = true;
1226 return bRetval;
1229 bool XmlScPropHdl_HoriJustify::exportXML(
1230 OUString& rStrExpValue,
1231 const css::uno::Any& rValue,
1232 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1234 table::CellHoriJustify nVal;
1235 bool bRetval(false);
1237 if(rValue >>= nVal)
1239 switch (nVal)
1241 case table::CellHoriJustify_REPEAT:
1242 case table::CellHoriJustify_LEFT:
1244 rStrExpValue = GetXMLToken(XML_START);
1245 bRetval = true;
1247 break;
1248 case table::CellHoriJustify_RIGHT:
1250 rStrExpValue = GetXMLToken(XML_END);
1251 bRetval = true;
1253 break;
1254 case table::CellHoriJustify_CENTER:
1256 rStrExpValue = GetXMLToken(XML_CENTER);
1257 bRetval = true;
1259 break;
1260 case table::CellHoriJustify_BLOCK:
1262 rStrExpValue = GetXMLToken(XML_JUSTIFY);
1263 bRetval = true;
1265 break;
1266 default:
1268 // added to avoid warnings
1273 return bRetval;
1276 XmlScPropHdl_HoriJustifySource::~XmlScPropHdl_HoriJustifySource()
1280 bool XmlScPropHdl_HoriJustifySource::equals(
1281 const css::uno::Any& r1,
1282 const css::uno::Any& r2 ) const
1284 table::CellHoriJustify aHoriJustify1, aHoriJustify2;
1286 if((r1 >>= aHoriJustify1) && (r2 >>= aHoriJustify2))
1287 return (aHoriJustify1 == aHoriJustify2);
1288 return false;
1291 bool XmlScPropHdl_HoriJustifySource::importXML(
1292 const OUString& rStrImpValue,
1293 css::uno::Any& rValue,
1294 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1296 bool bRetval(false);
1298 if (IsXMLToken(rStrImpValue, XML_FIX))
1300 bRetval = true;
1302 else if (IsXMLToken(rStrImpValue, XML_VALUE_TYPE))
1304 rValue <<= table::CellHoriJustify_STANDARD;
1305 bRetval = true;
1308 return bRetval;
1311 bool XmlScPropHdl_HoriJustifySource::exportXML(
1312 OUString& rStrExpValue,
1313 const css::uno::Any& rValue,
1314 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1316 table::CellHoriJustify nVal;
1317 bool bRetval(false);
1319 if(rValue >>= nVal)
1321 if (nVal == table::CellHoriJustify_STANDARD)
1323 rStrExpValue = GetXMLToken(XML_VALUE_TYPE);
1324 bRetval = true;
1326 else
1328 rStrExpValue = GetXMLToken(XML_FIX);
1329 bRetval = true;
1333 return bRetval;
1336 XmlScPropHdl_HoriJustifyRepeat::~XmlScPropHdl_HoriJustifyRepeat()
1340 bool XmlScPropHdl_HoriJustifyRepeat::equals(
1341 const css::uno::Any& r1,
1342 const css::uno::Any& r2 ) const
1344 table::CellHoriJustify aHoriJustify1, aHoriJustify2;
1346 if((r1 >>= aHoriJustify1) && (r2 >>= aHoriJustify2))
1347 return (aHoriJustify1 == aHoriJustify2);
1348 return false;
1351 bool XmlScPropHdl_HoriJustifyRepeat::importXML(
1352 const OUString& rStrImpValue,
1353 css::uno::Any& rValue,
1354 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1356 bool bRetval(false);
1358 if (IsXMLToken(rStrImpValue, XML_FALSE))
1360 bRetval = true;
1362 else if (IsXMLToken(rStrImpValue, XML_TRUE))
1364 rValue <<= table::CellHoriJustify_REPEAT;
1365 bRetval = true;
1368 return bRetval;
1371 bool XmlScPropHdl_HoriJustifyRepeat::exportXML(
1372 OUString& rStrExpValue,
1373 const css::uno::Any& rValue,
1374 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1376 table::CellHoriJustify nVal;
1377 bool bRetval(false);
1379 if(rValue >>= nVal)
1381 if (nVal == table::CellHoriJustify_REPEAT)
1383 rStrExpValue = GetXMLToken(XML_TRUE);
1384 bRetval = true;
1386 else
1388 rStrExpValue = GetXMLToken(XML_FALSE);
1389 bRetval = true;
1393 return bRetval;
1396 XmlScPropHdl_Orientation::~XmlScPropHdl_Orientation()
1400 bool XmlScPropHdl_Orientation::equals(
1401 const css::uno::Any& r1,
1402 const css::uno::Any& r2 ) const
1404 table::CellOrientation aOrientation1, aOrientation2;
1406 if((r1 >>= aOrientation1) && (r2 >>= aOrientation2))
1407 return (aOrientation1 == aOrientation2);
1408 return false;
1411 bool XmlScPropHdl_Orientation::importXML(
1412 const OUString& rStrImpValue,
1413 css::uno::Any& rValue,
1414 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1416 bool bRetval(false);
1418 table::CellOrientation nValue;
1419 if (IsXMLToken(rStrImpValue, XML_LTR))
1421 nValue = table::CellOrientation_STANDARD;
1422 rValue <<= nValue;
1423 bRetval = true;
1425 else if (IsXMLToken(rStrImpValue, XML_TTB))
1427 nValue = table::CellOrientation_STACKED;
1428 rValue <<= nValue;
1429 bRetval = true;
1432 return bRetval;
1435 bool XmlScPropHdl_Orientation::exportXML(
1436 OUString& rStrExpValue,
1437 const css::uno::Any& rValue,
1438 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1440 table::CellOrientation nVal;
1441 bool bRetval(false);
1443 if(rValue >>= nVal)
1445 switch (nVal)
1447 case table::CellOrientation_STACKED :
1449 rStrExpValue = GetXMLToken(XML_TTB);
1450 bRetval = true;
1452 break;
1453 default:
1455 rStrExpValue = GetXMLToken(XML_LTR);
1456 bRetval = true;
1458 break;
1462 return bRetval;
1465 XmlScPropHdl_RotateAngle::~XmlScPropHdl_RotateAngle()
1469 bool XmlScPropHdl_RotateAngle::equals(
1470 const css::uno::Any& r1,
1471 const css::uno::Any& r2 ) const
1473 sal_Int32 aAngle1 = 0, aAngle2 = 0;
1475 if((r1 >>= aAngle1) && (r2 >>= aAngle2))
1476 return (aAngle1 == aAngle2);
1477 return false;
1480 bool XmlScPropHdl_RotateAngle::importXML(
1481 const OUString& rStrImpValue,
1482 css::uno::Any& rValue,
1483 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1485 bool bRetval(false);
1487 sal_Int32 nValue;
1488 if (::sax::Converter::convertNumber(nValue, rStrImpValue) && !o3tl::checked_multiply<sal_Int32>(nValue, 100, nValue))
1490 rValue <<= nValue;
1491 bRetval = true;
1494 return bRetval;
1497 bool XmlScPropHdl_RotateAngle::exportXML(
1498 OUString& rStrExpValue,
1499 const css::uno::Any& rValue,
1500 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1502 sal_Int32 nVal = 0;
1503 bool bRetval(false);
1505 if(rValue >>= nVal)
1507 rStrExpValue = OUString::number(nVal / 100);
1508 bRetval = true;
1511 return bRetval;
1514 XmlScPropHdl_RotateReference::~XmlScPropHdl_RotateReference()
1518 bool XmlScPropHdl_RotateReference::equals(
1519 const css::uno::Any& r1,
1520 const css::uno::Any& r2 ) const
1522 sal_Int32 aReference1(0), aReference2(0);
1524 if((r1 >>= aReference1) && (r2 >>= aReference2))
1525 return (aReference1 == aReference2);
1526 return false;
1529 bool XmlScPropHdl_RotateReference::importXML(
1530 const OUString& rStrImpValue,
1531 css::uno::Any& rValue,
1532 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1534 bool bRetval(false);
1536 sal_Int32 nValue;
1537 if (IsXMLToken(rStrImpValue, XML_NONE))
1539 nValue = table::CellVertJustify2::STANDARD;
1540 rValue <<= nValue;
1541 bRetval = true;
1543 else if (IsXMLToken(rStrImpValue, XML_BOTTOM))
1545 nValue = table::CellVertJustify2::BOTTOM;
1546 rValue <<= nValue;
1547 bRetval = true;
1549 else if (IsXMLToken(rStrImpValue, XML_TOP))
1551 nValue = table::CellVertJustify2::TOP;
1552 rValue <<= nValue;
1553 bRetval = true;
1555 else if (IsXMLToken(rStrImpValue, XML_CENTER))
1557 nValue = table::CellVertJustify2::CENTER;
1558 rValue <<= nValue;
1559 bRetval = true;
1562 return bRetval;
1565 bool XmlScPropHdl_RotateReference::exportXML(
1566 OUString& rStrExpValue,
1567 const css::uno::Any& rValue,
1568 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1570 sal_Int32 nVal(0);
1571 bool bRetval(false);
1573 if(rValue >>= nVal)
1575 switch (nVal)
1577 case table::CellVertJustify2::BOTTOM :
1579 rStrExpValue = GetXMLToken(XML_BOTTOM);
1580 bRetval = true;
1582 break;
1583 case table::CellVertJustify2::CENTER :
1585 rStrExpValue = GetXMLToken(XML_CENTER);
1586 bRetval = true;
1588 break;
1589 case table::CellVertJustify2::STANDARD :
1591 rStrExpValue = GetXMLToken(XML_NONE);
1592 bRetval = true;
1594 break;
1595 case table::CellVertJustify2::TOP :
1597 rStrExpValue = GetXMLToken(XML_TOP);
1598 bRetval = true;
1600 break;
1601 default:
1603 // added to avoid warnings
1608 return bRetval;
1611 XmlScPropHdl_VertJustify::~XmlScPropHdl_VertJustify()
1615 bool XmlScPropHdl_VertJustify::equals(
1616 const css::uno::Any& r1,
1617 const css::uno::Any& r2 ) const
1619 sal_Int32 aReference1(0), aReference2(0);
1621 if((r1 >>= aReference1) && (r2 >>= aReference2))
1622 return (aReference1 == aReference2);
1623 return false;
1626 bool XmlScPropHdl_VertJustify::importXML(
1627 const OUString& rStrImpValue,
1628 css::uno::Any& rValue,
1629 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1631 bool bRetval(false);
1633 sal_Int32 nValue;
1634 if (IsXMLToken(rStrImpValue, XML_AUTOMATIC))
1636 nValue = table::CellVertJustify2::STANDARD;
1637 rValue <<= nValue;
1638 bRetval = true;
1640 else if (IsXMLToken(rStrImpValue, XML_BOTTOM))
1642 nValue = table::CellVertJustify2::BOTTOM;
1643 rValue <<= nValue;
1644 bRetval = true;
1646 else if (IsXMLToken(rStrImpValue, XML_TOP))
1648 nValue = table::CellVertJustify2::TOP;
1649 rValue <<= nValue;
1650 bRetval = true;
1652 else if (IsXMLToken(rStrImpValue, XML_MIDDLE))
1654 nValue = table::CellVertJustify2::CENTER;
1655 rValue <<= nValue;
1656 bRetval = true;
1658 else if (IsXMLToken(rStrImpValue, XML_JUSTIFY))
1660 nValue = table::CellVertJustify2::BLOCK;
1661 rValue <<= nValue;
1662 bRetval = true;
1665 return bRetval;
1668 bool XmlScPropHdl_VertJustify::exportXML(
1669 OUString& rStrExpValue,
1670 const css::uno::Any& rValue,
1671 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1673 sal_Int32 nVal(0);
1674 bool bRetval(false);
1676 if(rValue >>= nVal)
1678 switch (nVal)
1680 case table::CellVertJustify2::BOTTOM :
1682 rStrExpValue = GetXMLToken(XML_BOTTOM);
1683 bRetval = true;
1685 break;
1686 case table::CellVertJustify2::CENTER :
1688 rStrExpValue = GetXMLToken(XML_MIDDLE);
1689 bRetval = true;
1691 break;
1692 case table::CellVertJustify2::STANDARD :
1694 rStrExpValue = GetXMLToken(XML_AUTOMATIC);
1695 bRetval = true;
1697 break;
1698 case table::CellVertJustify2::TOP :
1700 rStrExpValue = GetXMLToken(XML_TOP);
1701 bRetval = true;
1703 break;
1704 case table::CellVertJustify2::BLOCK :
1706 rStrExpValue = GetXMLToken(XML_JUSTIFY);
1707 bRetval = true;
1709 break;
1710 default:
1712 // added to avoid warnings
1717 return bRetval;
1720 XmlScPropHdl_BreakBefore::~XmlScPropHdl_BreakBefore()
1724 bool XmlScPropHdl_BreakBefore::equals(
1725 const css::uno::Any& r1,
1726 const css::uno::Any& r2 ) const
1728 bool aBreak1 = false, aBreak2 = false;
1730 if((r1 >>= aBreak1) && (r2 >>= aBreak2))
1731 return (aBreak1 == aBreak2);
1732 return false;
1735 bool XmlScPropHdl_BreakBefore::importXML(
1736 const OUString& rStrImpValue,
1737 css::uno::Any& rValue,
1738 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1740 bool bRetval(false);
1742 bool bValue;
1743 if (IsXMLToken(rStrImpValue, XML_AUTO))
1745 bValue = false;
1746 rValue <<= bValue;
1747 bRetval = true;
1749 else if (IsXMLToken(rStrImpValue, XML_PAGE))
1751 bValue = true;
1752 rValue <<= bValue;
1753 bRetval = true;
1756 return bRetval;
1759 bool XmlScPropHdl_BreakBefore::exportXML(
1760 OUString& rStrExpValue,
1761 const css::uno::Any& rValue,
1762 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1764 bool bRetval(false);
1766 if(::cppu::any2bool(rValue))
1768 rStrExpValue = GetXMLToken(XML_PAGE);
1769 bRetval = true;
1771 else
1773 rStrExpValue = GetXMLToken(XML_AUTO);
1774 bRetval = true;
1777 return bRetval;
1780 XmlScPropHdl_IsTextWrapped::~XmlScPropHdl_IsTextWrapped()
1784 bool XmlScPropHdl_IsTextWrapped::equals(
1785 const css::uno::Any& r1,
1786 const css::uno::Any& r2 ) const
1788 return (::cppu::any2bool(r1) == ::cppu::any2bool(r2));
1791 bool XmlScPropHdl_IsTextWrapped::importXML(
1792 const OUString& rStrImpValue,
1793 css::uno::Any& rValue,
1794 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1796 bool bRetval(false);
1798 if (IsXMLToken(rStrImpValue, XML_WRAP))
1800 rValue <<= true;
1801 bRetval = true;
1803 else if (IsXMLToken(rStrImpValue, XML_NO_WRAP))
1805 rValue <<= false;
1806 bRetval = true;
1809 return bRetval;
1812 bool XmlScPropHdl_IsTextWrapped::exportXML(
1813 OUString& rStrExpValue,
1814 const css::uno::Any& rValue,
1815 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1817 bool bRetval(false);
1819 if (::cppu::any2bool(rValue))
1821 rStrExpValue = GetXMLToken(XML_WRAP);
1822 bRetval = true;
1824 else
1826 rStrExpValue = GetXMLToken(XML_NO_WRAP);
1827 bRetval = true;
1830 return bRetval;
1833 bool XmlScPropHdl_IsEqual::importXML( const OUString& /* rStrImpValue */,
1834 css::uno::Any& /* rValue */,
1835 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1837 OSL_FAIL("should never be called");
1838 return false;
1841 bool XmlScPropHdl_IsEqual::exportXML( OUString& /* rStrExpValue */,
1842 const css::uno::Any& /* rValue */,
1843 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1845 OSL_FAIL("should never be called");
1846 return false;
1849 XmlScPropHdl_Vertical::~XmlScPropHdl_Vertical()
1853 bool XmlScPropHdl_Vertical::equals(
1854 const css::uno::Any& r1,
1855 const css::uno::Any& r2 ) const
1857 return (::cppu::any2bool(r1) == ::cppu::any2bool(r2));
1860 bool XmlScPropHdl_Vertical::importXML(
1861 const OUString& rStrImpValue,
1862 css::uno::Any& rValue,
1863 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1865 bool bRetval(false);
1867 if (IsXMLToken(rStrImpValue, XML_AUTO))
1869 rValue <<= true;
1870 bRetval = true;
1872 else if (IsXMLToken(rStrImpValue, XML_0))
1874 rValue <<= false;
1875 bRetval = true;
1878 return bRetval;
1881 bool XmlScPropHdl_Vertical::exportXML(
1882 OUString& rStrExpValue,
1883 const css::uno::Any& rValue,
1884 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1886 bool bRetval(false);
1888 if (::cppu::any2bool(rValue))
1890 rStrExpValue = GetXMLToken(XML_AUTO);
1891 bRetval = true;
1893 else
1895 rStrExpValue = GetXMLToken(XML_0);
1896 bRetval = true;
1899 return bRetval;
1902 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */