nss: upgrade to release 3.73
[LibreOffice.git] / sc / source / filter / xml / xmlstyle.cxx
blobd4579a3c52151625b1b24781e22f1531455197ff
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/beans/XPropertyState.hpp>
43 #include <com/sun/star/container/XIndexAccess.hpp>
44 #include <comphelper/extract.hxx>
46 #include <rtl/ustrbuf.hxx>
47 #include <osl/diagnose.h>
49 using namespace com::sun::star;
50 using namespace ::xmloff::token;
51 using namespace ::formula;
53 #define MAP(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFSVER_010, false }
54 #define MAP_ODF13(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFSVER_013, false }
55 // extensions import/export
56 #define MAP_EXT(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, false }
57 // extensions import only
58 #define MAP_EXT_I(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, true }
59 #define MAP_END() { nullptr, 0, 0, XML_TOKEN_INVALID, 0, 0, SvtSaveOptions::ODFSVER_010, false }
61 const XMLPropertyMapEntry aXMLScCellStylesProperties[] =
63 MAP( "AsianVerticalMode", XML_NAMESPACE_STYLE, XML_GLYPH_ORIENTATION_VERTICAL, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_VERTICAL, 0),
64 MAP( "BottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_BOTTOMBORDER ),
65 MAP( "BottomBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_BOTTOMBORDERWIDTH ),
66 MAP( "CellBackColor", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
67 MAP( "CellProtection", XML_NAMESPACE_STYLE, XML_CELL_PROTECT, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_CELLPROTECTION|MID_FLAG_MERGE_PROPERTY, 0 ),
68 MAP( "CellProtection", XML_NAMESPACE_STYLE, XML_PRINT_CONTENT, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_PRINTCONTENT|MID_FLAG_MERGE_PROPERTY, 0 ),
69 MAP( "CellStyle", XML_NAMESPACE_STYLE, XML_STYLE, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_STRING, CTF_SC_CELLSTYLE ),
70 MAP( "ConditionalFormatXML", XML_NAMESPACE_STYLE, XML_MAP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_IMPORT_MAP ),
71 MAP( "ConditionalFormatXML", XML_NAMESPACE_STYLE, XML_MAP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_MAP ),
72 MAP( "DiagonalBLTR", XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_DIAGONALBLTR ),
73 MAP( "DiagonalBLTR", XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR_WIDTH, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_DIAGONALBLTRWIDTH ), // #i102690# for old files
74 MAP( "DiagonalBLTR", XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR_WIDTHS, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_DIAGONALBLTRWIDTHS ),
75 MAP( "DiagonalTLBR", XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_DIAGONALTLBR ),
76 MAP( "DiagonalTLBR", XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR_WIDTH, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_DIAGONALTLBRWIDTH ), // #i102690# for old files
77 MAP( "DiagonalTLBR", XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR_WIDTHS, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_DIAGONALTLBRWIDTHS ),
78 MAP( "HoriJustify", XML_NAMESPACE_FO, XML_TEXT_ALIGN, XML_TYPE_PROP_PARAGRAPH|XML_SC_TYPE_HORIJUSTIFY|MID_FLAG_MERGE_PROPERTY, 0 ),
79 MAP( "HoriJustify", XML_NAMESPACE_STYLE, XML_TEXT_ALIGN_SOURCE, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_HORIJUSTIFYSOURCE|MID_FLAG_MERGE_PROPERTY, 0 ),
80 MAP( "HoriJustify", XML_NAMESPACE_STYLE, XML_REPEAT_CONTENT, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_HORIJUSTIFYREPEAT|MID_FLAG_MERGE_PROPERTY, 0 ),
81 // FIXME this was wrongly exported to STYLE namespace since 2013
82 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 ),
83 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 ),
84 MAP_EXT( SC_UNONAME_CELLHJUS_METHOD, XML_NAMESPACE_CSS3TEXT, XML_TEXT_JUSTIFY, XML_TYPE_PROP_PARAGRAPH|XML_SC_TYPE_HORIJUSTIFY_METHOD, 0 ),
85 MAP( "IsCellBackgroundTransparent", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_ISTRANSPARENT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
86 MAP( "IsTextWrapped", XML_NAMESPACE_FO, XML_WRAP_OPTION, XML_TYPE_PROP_TABLE_CELL|XML_SC_ISTEXTWRAPPED, 0 ),
87 MAP( "LeftBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_ALLBORDER ),
88 MAP( "LeftBorder", XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_LEFTBORDER ),
89 MAP( "LeftBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_ALLBORDERWIDTH ),
90 MAP( "LeftBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_LEFTBORDERWIDTH ),
91 MAP( "NumberFormat", XML_NAMESPACE_STYLE, XML_DATA_STYLE_NAME, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_NUMBER|MID_FLAG_SPECIAL_ITEM, CTF_SC_NUMBERFORMAT),
92 MAP( "Orientation", XML_NAMESPACE_STYLE, XML_DIRECTION, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_ORIENTATION, 0 ),
93 MAP( "ParaBottomMargin", XML_NAMESPACE_FO, XML_PADDING, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_ALLPADDING ),
94 MAP( "ParaBottomMargin", XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_BOTTOMPADDING ),
95 MAP( "ParaIndent", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_PROP_PARAGRAPH|XML_TYPE_MEASURE16, 0 ),
96 MAP( "ParaLeftMargin", XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_LEFTPADDING ),
97 MAP( "ParaRightMargin", XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_RIGHTPADDING ),
98 MAP( "ParaTopMargin", XML_NAMESPACE_FO, XML_PADDING_TOP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_TOPPADDING ),
99 MAP( "RightBorder", XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_RIGHTBORDER ),
100 MAP( "RightBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_RIGHTBORDERWIDTH ),
101 MAP( "RotateAngle", XML_NAMESPACE_STYLE, XML_ROTATION_ANGLE, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_ROTATEANGLE, 0 ),
102 MAP( "RotateReference", XML_NAMESPACE_STYLE, XML_ROTATION_ALIGN, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_ROTATEREFERENCE, 0),
103 MAP( "ShadowFormat", XML_NAMESPACE_STYLE, XML_SHADOW, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_TEXT_SHADOW, 0 ),
104 MAP( "ShrinkToFit", XML_NAMESPACE_STYLE, XML_SHRINK_TO_FIT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BOOL, 0 ),
105 MAP( "StandardDecimals", XML_NAMESPACE_STYLE, XML_DECIMAL_PLACES, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_NUMBER16, 0 ),
106 MAP( "TopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_TOPBORDER ),
107 MAP( "TopBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_TOPBORDERWIDTH ),
108 MAP( "UserDefinedAttributes", XML_NAMESPACE_TEXT, XML_XMLNS, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),
109 MAP( "ValidationXML", XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BUILDIN_CMP_ONLY, CTF_SC_VALIDATION ),
110 MAP( "VertJustify", XML_NAMESPACE_STYLE, XML_VERTICAL_ALIGN, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_VERTJUSTIFY, 0),
111 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+
112 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
113 MAP_END()
116 const XMLPropertyMapEntry aXMLScColumnStylesProperties[] =
118 MAP( "IsManualPageBreak", XML_NAMESPACE_FO, XML_BREAK_BEFORE, XML_TYPE_PROP_TABLE_COLUMN|XML_SC_TYPE_BREAKBEFORE, 0),
119 MAP( "IsVisible", XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TYPE_PROP_TABLE_COLUMN|XML_SC_TYPE_EQUAL|MID_FLAG_SPECIAL_ITEM, CTF_SC_ISVISIBLE ),
120 MAP( "Width", XML_NAMESPACE_STYLE, XML_COLUMN_WIDTH, XML_TYPE_PROP_TABLE_COLUMN|XML_TYPE_MEASURE, 0 ),
121 MAP_END()
124 const XMLPropertyMapEntry aXMLScRowStylesImportProperties[] =
126 // #i57867# Include background color (CellBackColor/IsCellBackgroundTransparent) for import only.
127 // Import and export should use the same map, with MID_FLAG_NO_PROPERTY_EXPORT for the background entries,
128 // but this doesn't work at the moment because SvXMLImportPropertyMapper compares MID_FLAG_NO_PROPERTY to 0.
129 // If this is changed (not for 2.0.x), a single map can be used again.
131 MAP( "CellBackColor", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
132 MAP( "Height", XML_NAMESPACE_STYLE, XML_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_MEASURE, CTF_SC_ROWHEIGHT),
133 MAP( "IsCellBackgroundTransparent", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_ISTRANSPARENT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
134 MAP( "IsManualPageBreak", XML_NAMESPACE_FO, XML_BREAK_BEFORE, XML_TYPE_PROP_TABLE_ROW|XML_SC_TYPE_BREAKBEFORE, CTF_SC_ROWBREAKBEFORE),
135 MAP( "OptimalHeight", XML_NAMESPACE_STYLE, XML_USE_OPTIMAL_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_BOOL, CTF_SC_ROWOPTIMALHEIGHT),
136 MAP_END()
139 const XMLPropertyMapEntry aXMLScRowStylesProperties[] =
141 MAP( "Height", XML_NAMESPACE_STYLE, XML_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_MEASURE, CTF_SC_ROWHEIGHT),
142 MAP( "IsManualPageBreak", XML_NAMESPACE_FO, XML_BREAK_BEFORE, XML_TYPE_PROP_TABLE_ROW|XML_SC_TYPE_BREAKBEFORE, CTF_SC_ROWBREAKBEFORE),
143 MAP( "OptimalHeight", XML_NAMESPACE_STYLE, XML_USE_OPTIMAL_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_BOOL, CTF_SC_ROWOPTIMALHEIGHT),
144 MAP_END()
147 const XMLPropertyMapEntry aXMLScFromXLSRowStylesProperties[] =
149 MAP( "Height", XML_NAMESPACE_STYLE, XML_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_MEASURE, CTF_SC_ROWHEIGHT),
150 MAP( "IsManualPageBreak", XML_NAMESPACE_FO, XML_BREAK_BEFORE, XML_TYPE_PROP_TABLE_ROW|XML_SC_TYPE_BREAKBEFORE, CTF_SC_ROWBREAKBEFORE),
151 MAP( "OptimalHeight", XML_NAMESPACE_STYLE, XML_USE_OPTIMAL_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_BOOL_FALSE, CTF_SC_ROWOPTIMALHEIGHT),
152 MAP_END()
155 const XMLPropertyMapEntry aXMLScTableStylesImportProperties[] =
157 // #i57869# Include background color (CellBackColor/IsCellBackgroundTransparent) for import only.
158 // Import and export should use the same map, with MID_FLAG_NO_PROPERTY_EXPORT for the background entries,
159 // but this doesn't work at the moment because SvXMLImportPropertyMapper compares MID_FLAG_NO_PROPERTY to 0.
160 // If this is changed (not for 2.0.x), a single map can be used again.
162 MAP( "CellBackColor", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
163 MAP( "IsCellBackgroundTransparent", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_ISTRANSPARENT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
164 MAP( "IsVisible", XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TYPE_PROP_TABLE|XML_TYPE_BOOL, 0 ),
165 MAP( "PageStyle", XML_NAMESPACE_STYLE, XML_MASTER_PAGE_NAME, XML_TYPE_PROP_TABLE|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_MASTERPAGENAME ),
166 MAP( "TableLayout", XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_TYPE_PROP_TABLE|XML_TYPE_TEXT_WRITING_MODE, 0 ),
167 MAP_ODF13( "TabColor", XML_NAMESPACE_TABLE, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
168 MAP_ODF13( "TabColor", XML_NAMESPACE_TABLE_EXT, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
169 MAP_END()
172 const XMLPropertyMapEntry aXMLScTableStylesProperties[] =
174 MAP( "IsVisible", XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TYPE_PROP_TABLE|XML_TYPE_BOOL, 0 ),
175 MAP( "PageStyle", XML_NAMESPACE_STYLE, XML_MASTER_PAGE_NAME, XML_TYPE_PROP_TABLE|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_MASTERPAGENAME ),
176 MAP( "TableLayout", XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_TYPE_PROP_TABLE|XML_TYPE_TEXT_WRITING_MODE, 0 ),
177 // ODF 1.3 OFFICE-2173
178 MAP_ODF13( "TabColor", XML_NAMESPACE_TABLE, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
179 MAP_ODF13( "TabColor", XML_NAMESPACE_TABLE_EXT, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
180 MAP_END()
183 ScXMLCellExportPropertyMapper::ScXMLCellExportPropertyMapper(
184 const rtl::Reference< XMLPropertySetMapper >& rMapper )
185 : SvXMLExportPropertyMapper(rMapper)
189 ScXMLCellExportPropertyMapper::~ScXMLCellExportPropertyMapper()
193 void ScXMLCellExportPropertyMapper::ContextFilter(
194 bool bEnableFoFontFamily,
195 ::std::vector< XMLPropertyState >& rProperties,
196 const uno::Reference< beans::XPropertySet >& rPropSet ) const
198 XMLPropertyState* pPadding = nullptr;
199 XMLPropertyState* pPadding_Bottom = nullptr;
200 XMLPropertyState* pPadding_Left = nullptr;
201 XMLPropertyState* pPadding_Right = nullptr;
202 XMLPropertyState* pPadding_Top = nullptr;
204 XMLPropertyState* pBorder = nullptr;
205 XMLPropertyState* pBorder_Bottom = nullptr;
206 XMLPropertyState* pBorder_Left = nullptr;
207 XMLPropertyState* pBorder_Right = nullptr;
208 XMLPropertyState* pBorder_Top = nullptr;
209 XMLPropertyState* pSWBorder = nullptr;
210 XMLPropertyState* pSWBorder_Bottom = nullptr;
211 XMLPropertyState* pSWBorder_Left = nullptr;
212 XMLPropertyState* pSWBorder_Right = nullptr;
213 XMLPropertyState* pSWBorder_Top = nullptr;
215 XMLPropertyState* pAllBorderWidthState = nullptr;
216 XMLPropertyState* pLeftBorderWidthState = nullptr;
217 XMLPropertyState* pRightBorderWidthState = nullptr;
218 XMLPropertyState* pTopBorderWidthState = nullptr;
219 XMLPropertyState* pBottomBorderWidthState = nullptr;
220 XMLPropertyState* pSWAllBorderWidthState = nullptr;
221 XMLPropertyState* pSWLeftBorderWidthState = nullptr;
222 XMLPropertyState* pSWRightBorderWidthState = nullptr;
223 XMLPropertyState* pSWTopBorderWidthState = nullptr;
224 XMLPropertyState* pSWBottomBorderWidthState = nullptr;
225 XMLPropertyState* pDiagonalTLBRWidthState = nullptr;
226 XMLPropertyState* pDiagonalBLTRWidthState = nullptr;
228 XMLPropertyState* pParaMarginLeft = nullptr;
229 XMLPropertyState* pParaMarginLeftRel = nullptr;
230 XMLPropertyState* pParaMarginRight = nullptr;
231 XMLPropertyState* pParaMarginRightRel = nullptr;
232 XMLPropertyState* pParaMarginTop = nullptr;
233 XMLPropertyState* pParaMarginTopRel = nullptr;
234 XMLPropertyState* pParaMarginBottom = nullptr;
235 XMLPropertyState* pParaMarginBottomRel = nullptr;
237 XMLPropertyState* pParaAdjust = nullptr;
238 XMLPropertyState* pParaAdjustLast = nullptr;
240 for( auto& rProperty : rProperties )
242 XMLPropertyState* propertyState = &rProperty;
243 if (propertyState->mnIndex != -1)
245 switch( getPropertySetMapper()->GetEntryContextId( propertyState->mnIndex ) )
247 case CTF_SC_ALLPADDING: pPadding = propertyState; break;
248 case CTF_SC_BOTTOMPADDING: pPadding_Bottom = propertyState; break;
249 case CTF_SC_LEFTPADDING: pPadding_Left = propertyState; break;
250 case CTF_SC_RIGHTPADDING: pPadding_Right = propertyState; break;
251 case CTF_SC_TOPPADDING: pPadding_Top = propertyState; break;
252 case CTF_SC_ALLBORDER: pBorder = propertyState; break;
253 case CTF_SC_LEFTBORDER: pBorder_Left = propertyState; break;
254 case CTF_SC_RIGHTBORDER: pBorder_Right = propertyState; break;
255 case CTF_SC_BOTTOMBORDER: pBorder_Bottom = propertyState; break;
256 case CTF_SC_TOPBORDER: pBorder_Top = propertyState; break;
257 case CTF_SC_ALLBORDERWIDTH: pAllBorderWidthState = propertyState; break;
258 case CTF_SC_LEFTBORDERWIDTH: pLeftBorderWidthState = propertyState; break;
259 case CTF_SC_RIGHTBORDERWIDTH: pRightBorderWidthState = propertyState; break;
260 case CTF_SC_TOPBORDERWIDTH: pTopBorderWidthState = propertyState; break;
261 case CTF_SC_BOTTOMBORDERWIDTH: pBottomBorderWidthState = propertyState; break;
262 case CTF_ALLBORDER: pSWBorder = propertyState; break;
263 case CTF_LEFTBORDER: pSWBorder_Left = propertyState; break;
264 case CTF_RIGHTBORDER: pSWBorder_Right = propertyState; break;
265 case CTF_BOTTOMBORDER: pSWBorder_Bottom = propertyState; break;
266 case CTF_TOPBORDER: pSWBorder_Top = propertyState; break;
267 case CTF_ALLBORDERWIDTH: pSWAllBorderWidthState = propertyState; break;
268 case CTF_LEFTBORDERWIDTH: pSWLeftBorderWidthState = propertyState; break;
269 case CTF_RIGHTBORDERWIDTH: pSWRightBorderWidthState = propertyState; break;
270 case CTF_TOPBORDERWIDTH: pSWTopBorderWidthState = propertyState; break;
271 case CTF_BOTTOMBORDERWIDTH: pSWBottomBorderWidthState = propertyState; break;
272 case CTF_SC_DIAGONALTLBR: break; //old diagonal line attribute names without "s" are only read, not written
273 case CTF_SC_DIAGONALTLBRWIDTH: pDiagonalTLBRWidthState = propertyState; break;
274 case CTF_SC_DIAGONALBLTR: break; //old diagonal line attribute names without "s" are only read, not written
275 case CTF_SC_DIAGONALBLTRWIDTH: pDiagonalBLTRWidthState = propertyState; break;
276 case CTF_SD_SHAPE_PARA_ADJUST: pParaAdjust = propertyState; break;
277 case CTF_PARA_ADJUSTLAST: pParaAdjustLast = propertyState; break;
278 case CTF_PARALEFTMARGIN: pParaMarginLeft = propertyState; break;
279 case CTF_PARALEFTMARGIN_REL: pParaMarginLeftRel = propertyState; break;
280 case CTF_PARARIGHTMARGIN: pParaMarginRight = propertyState; break;
281 case CTF_PARARIGHTMARGIN_REL: pParaMarginRightRel = propertyState; break;
282 case CTF_PARATOPMARGIN: pParaMarginTop = propertyState; break;
283 case CTF_PARATOPMARGIN_REL: pParaMarginTopRel = propertyState; break;
284 case CTF_PARABOTTOMMARGIN: pParaMarginBottom = propertyState; break;
285 case CTF_PARABOTTOMMARGIN_REL: pParaMarginBottomRel = propertyState; break;
290 if (pPadding && pPadding_Bottom && pPadding_Left && pPadding_Right && pPadding_Top)
292 sal_Int32 nBottom = 0, nTop = 0, nLeft = 0, nRight = 0;
293 if ((pPadding_Bottom->maValue >>= nBottom) &&
294 (pPadding_Left->maValue >>= nLeft) &&
295 (pPadding_Right->maValue >>= nRight) &&
296 (pPadding_Top->maValue >>= nTop))
298 if ((nBottom == nTop) && (nLeft == nRight) && (nTop == nLeft))
300 pPadding_Bottom->mnIndex = -1;
301 pPadding_Bottom->maValue.clear();
302 pPadding_Left->mnIndex = -1;
303 pPadding_Left->maValue.clear();
304 pPadding_Right->mnIndex = -1;
305 pPadding_Right->maValue.clear();
306 pPadding_Top->mnIndex = -1;
307 pPadding_Top->maValue.clear();
309 else
311 pPadding->mnIndex = -1;
312 pPadding->maValue.clear();
316 if( pBorder )
318 if( pBorder_Left && pBorder_Right && pBorder_Top && pBorder_Bottom )
320 table::BorderLine2 aLeft, aRight, aTop, aBottom;
322 pBorder_Left->maValue >>= aLeft;
323 pBorder_Right->maValue >>= aRight;
324 pBorder_Top->maValue >>= aTop;
325 pBorder_Bottom->maValue >>= aBottom;
326 if( aLeft.Color == aRight.Color && aLeft.InnerLineWidth == aRight.InnerLineWidth &&
327 aLeft.OuterLineWidth == aRight.OuterLineWidth && aLeft.LineDistance == aRight.LineDistance &&
328 aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth &&
329 aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance &&
330 aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth &&
331 aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance &&
332 aLeft.LineStyle == aRight.LineStyle && aLeft.LineStyle == aTop.LineStyle &&
333 aLeft.LineStyle == aBottom.LineStyle && aLeft.LineWidth == aRight.LineWidth &&
334 aLeft.LineWidth == aTop.LineWidth && aLeft.LineWidth == aBottom.LineWidth )
336 pBorder_Left->mnIndex = -1;
337 pBorder_Left->maValue.clear();
338 pBorder_Right->mnIndex = -1;
339 pBorder_Right->maValue.clear();
340 pBorder_Top->mnIndex = -1;
341 pBorder_Top->maValue.clear();
342 pBorder_Bottom->mnIndex = -1;
343 pBorder_Bottom->maValue.clear();
345 else
347 pBorder->mnIndex = -1;
348 pBorder->maValue.clear();
351 else
353 pBorder->mnIndex = -1;
354 pBorder->maValue.clear();
357 if( pAllBorderWidthState )
359 if( pLeftBorderWidthState && pRightBorderWidthState && pTopBorderWidthState && pBottomBorderWidthState )
361 table::BorderLine2 aLeft, aRight, aTop, aBottom;
363 pLeftBorderWidthState->maValue >>= aLeft;
364 pRightBorderWidthState->maValue >>= aRight;
365 pTopBorderWidthState->maValue >>= aTop;
366 pBottomBorderWidthState->maValue >>= aBottom;
367 if( aLeft.InnerLineWidth == aRight.InnerLineWidth && aLeft.OuterLineWidth == aRight.OuterLineWidth &&
368 aLeft.LineDistance == aRight.LineDistance && aLeft.InnerLineWidth == aTop.InnerLineWidth &&
369 aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance &&
370 aLeft.InnerLineWidth == aBottom.InnerLineWidth && aLeft.OuterLineWidth == aBottom.OuterLineWidth &&
371 aLeft.LineDistance == aBottom.LineDistance && aLeft.LineWidth == aRight.LineWidth &&
372 aLeft.LineWidth == aTop.LineWidth && aLeft.LineWidth == aBottom.LineWidth )
374 pLeftBorderWidthState->mnIndex = -1;
375 pLeftBorderWidthState->maValue.clear();
376 pRightBorderWidthState->mnIndex = -1;
377 pRightBorderWidthState->maValue.clear();
378 pTopBorderWidthState->mnIndex = -1;
379 pTopBorderWidthState->maValue.clear();
380 pBottomBorderWidthState->mnIndex = -1;
381 pBottomBorderWidthState->maValue.clear();
383 else
385 pAllBorderWidthState->mnIndex = -1;
386 pAllBorderWidthState->maValue.clear();
389 else
391 pAllBorderWidthState->mnIndex = -1;
392 pAllBorderWidthState->maValue.clear();
396 if (pParaAdjust)
398 pParaAdjust->mnIndex = -1;
399 pParaAdjust->maValue.clear();
401 if (pParaAdjustLast)
403 pParaAdjustLast->mnIndex = -1;
404 pParaAdjustLast->maValue.clear();
406 if (pSWBorder)
408 pSWBorder->mnIndex = -1;
409 pSWBorder->maValue.clear();
411 if (pSWBorder_Left)
413 pSWBorder_Left->mnIndex = -1;
414 pSWBorder_Left->maValue.clear();
416 if (pSWBorder_Right)
418 pSWBorder_Right->mnIndex = -1;
419 pSWBorder_Right->maValue.clear();
421 if (pSWBorder_Bottom)
423 pSWBorder_Bottom->mnIndex = -1;
424 pSWBorder_Bottom->maValue.clear();
426 if (pSWBorder_Top)
428 pSWBorder_Top->mnIndex = -1;
429 pSWBorder_Top->maValue.clear();
431 if (pSWAllBorderWidthState)
433 pSWAllBorderWidthState->mnIndex = -1;
434 pSWAllBorderWidthState->maValue.clear();
436 if (pSWLeftBorderWidthState)
438 pSWLeftBorderWidthState->mnIndex = -1;
439 pSWLeftBorderWidthState->maValue.clear();
441 if (pSWRightBorderWidthState)
443 pSWRightBorderWidthState->mnIndex = -1;
444 pSWRightBorderWidthState->maValue.clear();
446 if (pSWTopBorderWidthState)
448 pSWTopBorderWidthState->mnIndex = -1;
449 pSWTopBorderWidthState->maValue.clear();
451 if (pSWBottomBorderWidthState)
453 pSWBottomBorderWidthState->mnIndex = -1;
454 pSWBottomBorderWidthState->maValue.clear();
457 if (pParaMarginLeft)
459 pParaMarginLeft->mnIndex = -1;
460 pParaMarginLeft->maValue.clear();
462 if (pParaMarginLeftRel)
464 pParaMarginLeftRel->mnIndex = -1;
465 pParaMarginLeftRel->maValue.clear();
467 if (pParaMarginRight)
469 pParaMarginRight->mnIndex = -1;
470 pParaMarginRight->maValue.clear();
472 if (pParaMarginRightRel)
474 pParaMarginRightRel->mnIndex = -1;
475 pParaMarginRightRel->maValue.clear();
477 if (pParaMarginTop)
479 pParaMarginTop->mnIndex = -1;
480 pParaMarginTop->maValue.clear();
482 if (pParaMarginTopRel)
484 pParaMarginTopRel->mnIndex = -1;
485 pParaMarginTopRel->maValue.clear();
487 if (pParaMarginBottom)
489 pParaMarginBottom->mnIndex = -1;
490 pParaMarginBottom->maValue.clear();
492 if (pParaMarginBottomRel)
494 pParaMarginBottomRel->mnIndex = -1;
495 pParaMarginBottomRel->maValue.clear();
498 // #i102690# old diagonal line attribute names without "s" are only read, not written
499 if (pDiagonalTLBRWidthState)
501 pDiagonalTLBRWidthState->mnIndex = -1;
502 pDiagonalTLBRWidthState->maValue.clear();
504 if (pDiagonalBLTRWidthState)
506 pDiagonalBLTRWidthState->mnIndex = -1;
507 pDiagonalBLTRWidthState->maValue.clear();
510 SvXMLExportPropertyMapper::ContextFilter(bEnableFoFontFamily, rProperties, rPropSet);
513 /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
514 void ScXMLCellExportPropertyMapper::handleSpecialItem(
515 SvXMLAttributeList& /* rAttrList */,
516 const XMLPropertyState& /* rProperty */,
517 const SvXMLUnitConverter& /* rUnitConverter */,
518 const SvXMLNamespaceMap& /* rNamespaceMap */,
519 const ::std::vector< XMLPropertyState > * /* pProperties */,
520 sal_uInt32 /* nIdx */ ) const
522 // the SpecialItem NumberFormat must not be handled by this method
523 // the SpecialItem ConditionlaFormat must not be handled by this method
524 // the SpecialItem CharBackColor must not be handled by this method
526 void ScXMLCellExportPropertyMapper::handleElementItem(
527 SvXMLExport& rExport,
528 const XMLPropertyState& rProperty,
529 SvXmlExportFlags /* nFlags */,
530 const ::std::vector< XMLPropertyState > * /* pProperties */,
531 sal_uInt32 /* nIdx */) const
533 sal_uInt32 nContextId = getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex );
534 OUString sURL;
535 if ( ( nContextId == CTF_SC_HYPERLINK ) &&
536 ( rProperty.maValue >>= sURL ) &&
537 !sURL.isEmpty() )
539 rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sURL );
540 rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE,
541 XML_SIMPLE );
542 sal_uInt32 nPropIndex = rProperty.mnIndex;
543 sal_uInt16 nPrefix = getPropertySetMapper()->GetEntryNameSpace( nPropIndex );
544 OUString sLocalName = getPropertySetMapper()->GetEntryXMLName( nPropIndex );
545 SvXMLElementExport aElem( rExport, nPrefix, sLocalName, true, true );
549 ScXMLRowExportPropertyMapper::ScXMLRowExportPropertyMapper(
550 const rtl::Reference< XMLPropertySetMapper >& rMapper )
551 : SvXMLExportPropertyMapper(rMapper)
555 ScXMLRowExportPropertyMapper::~ScXMLRowExportPropertyMapper()
559 void ScXMLRowExportPropertyMapper::ContextFilter(
560 bool /* bEnableFoFontFamily */,
561 ::std::vector< XMLPropertyState >& /* rProperties */,
562 const uno::Reference< beans::XPropertySet >& /* rPropSet */ ) const
564 //#108550#; don't filter the height, so other applications know the calculated height
567 ScXMLColumnExportPropertyMapper::ScXMLColumnExportPropertyMapper(
568 const rtl::Reference< XMLPropertySetMapper >& rMapper )
569 : SvXMLExportPropertyMapper(rMapper)
573 ScXMLColumnExportPropertyMapper::~ScXMLColumnExportPropertyMapper()
577 /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
578 void ScXMLColumnExportPropertyMapper::handleSpecialItem(
579 SvXMLAttributeList& /* rAttrList */,
580 const XMLPropertyState& /* rProperty */,
581 const SvXMLUnitConverter& /* rUnitConverter */,
582 const SvXMLNamespaceMap& /* rNamespaceMap */,
583 const ::std::vector< XMLPropertyState > * /* pProperties */,
584 sal_uInt32 /* nIdx */ ) const
586 // the SpecialItem IsVisible must not be handled by this method
589 ScXMLTableExportPropertyMapper::ScXMLTableExportPropertyMapper(
590 const rtl::Reference< XMLPropertySetMapper >& rMapper )
591 : SvXMLExportPropertyMapper(rMapper)
595 ScXMLTableExportPropertyMapper::~ScXMLTableExportPropertyMapper()
599 /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
600 void ScXMLTableExportPropertyMapper::handleSpecialItem(
601 SvXMLAttributeList& /* rAttrList */,
602 const XMLPropertyState& /* rProperty */,
603 const SvXMLUnitConverter& /* rUnitConverter */,
604 const SvXMLNamespaceMap& /* rNamespaceMap */,
605 const ::std::vector< XMLPropertyState > * /* pProperties */,
606 sal_uInt32 /* nIdx */ ) const
608 // the SpecialItem PageStyle must not be handled by this method
611 void ScXMLAutoStylePoolP::exportStyleAttributes(
612 SvXMLAttributeList& rAttrList,
613 XmlStyleFamily nFamily,
614 const ::std::vector< XMLPropertyState >& rProperties,
615 const SvXMLExportPropertyMapper& rPropExp
616 , const SvXMLUnitConverter& rUnitConverter,
617 const SvXMLNamespaceMap& rNamespaceMap
618 ) const
620 SvXMLAutoStylePoolP::exportStyleAttributes( rAttrList, nFamily, rProperties, rPropExp, rUnitConverter, rNamespaceMap );
621 if (nFamily == XmlStyleFamily::TABLE_CELL)
623 for(const auto& rProperty : rProperties)
625 rtl::Reference< XMLPropertySetMapper > aPropMapper(rScXMLExport.GetCellStylesPropertySetMapper());
626 sal_Int16 nContextID(aPropMapper->GetEntryContextId(rProperty.mnIndex));
627 switch (nContextID)
629 case CTF_SC_NUMBERFORMAT :
631 sal_Int32 nNumberFormat = 0;
632 if (rProperty.maValue >>= nNumberFormat)
634 OUString sAttrValue(rScXMLExport.getDataStyleName(nNumberFormat));
635 if (!sAttrValue.isEmpty())
637 GetExport().AddAttribute(
638 aPropMapper->GetEntryNameSpace(rProperty.mnIndex),
639 aPropMapper->GetEntryXMLName(rProperty.mnIndex),
640 sAttrValue );
644 break;
648 else if (nFamily == XmlStyleFamily::TABLE_TABLE)
650 for(const auto& rProperty : rProperties)
652 rtl::Reference< XMLPropertySetMapper > aPropMapper(rScXMLExport.GetTableStylesPropertySetMapper());
653 sal_Int16 nContextID(aPropMapper->GetEntryContextId(rProperty.mnIndex));
654 switch (nContextID)
656 case CTF_SC_MASTERPAGENAME :
658 OUString sName;
659 if (rProperty.maValue >>= sName)
661 GetExport().AddAttribute(
662 aPropMapper->GetEntryNameSpace(rProperty.mnIndex),
663 aPropMapper->GetEntryXMLName(rProperty.mnIndex),
664 GetExport().EncodeStyleName( sName ));
667 break;
673 void ScXMLAutoStylePoolP::exportStyleContent(
674 const css::uno::Reference< css::xml::sax::XDocumentHandler > & rHandler,
675 XmlStyleFamily nFamily,
676 const std::vector< XMLPropertyState >& rProperties,
677 const SvXMLExportPropertyMapper& rPropExp
678 , const SvXMLUnitConverter& rUnitConverter,
679 const SvXMLNamespaceMap& rNamespaceMap
680 ) const
682 SvXMLAutoStylePoolP::exportStyleContent( rHandler, nFamily, rProperties, rPropExp, rUnitConverter, rNamespaceMap );
683 if (nFamily != XmlStyleFamily::TABLE_CELL)
684 return;
686 for(const auto& rProperty : rProperties)
688 if (rProperty.mnIndex != -1)
690 sal_Int16 nContextID = rScXMLExport.GetCellStylesPropertySetMapper()->GetEntryContextId(rProperty.mnIndex);
691 switch (nContextID)
693 case CTF_SC_MAP :
695 uno::Reference<container::XIndexAccess> xIndex( rProperty.maValue, uno::UNO_QUERY );
696 if ( xIndex.is() )
698 sal_Int32 nConditionCount(xIndex->getCount());
699 for (sal_Int32 nCondition = 0; nCondition < nConditionCount; ++nCondition)
701 uno::Reference <sheet::XSheetConditionalEntry> xSheetConditionalEntry(xIndex->getByIndex(nCondition), uno::UNO_QUERY);
702 if (xSheetConditionalEntry.is())
704 OUString sStyleName(xSheetConditionalEntry->getStyleName());
705 uno::Reference <sheet::XSheetCondition> xSheetCondition(xSheetConditionalEntry, uno::UNO_QUERY);
706 if (xSheetCondition.is())
708 sheet::ConditionOperator aOperator = xSheetCondition->getOperator();
709 if (aOperator != sheet::ConditionOperator_NONE)
711 if (aOperator == sheet::ConditionOperator_FORMULA)
713 OUString sCondition = "is-true-formula("
714 + xSheetCondition->getFormula1()
715 + ")";
716 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_CONDITION, sCondition);
717 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_APPLY_STYLE_NAME, rScXMLExport.EncodeStyleName( sStyleName ));
718 OUString sOUBaseAddress;
719 ScDocument* pDoc = rScXMLExport.GetDocument();
720 ScRangeStringConverter::GetStringFromAddress( sOUBaseAddress,
721 xSheetCondition->getSourcePosition(), pDoc, FormulaGrammar::CONV_OOO );
722 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_BASE_CELL_ADDRESS, sOUBaseAddress);
723 SvXMLElementExport aMElem(rScXMLExport, XML_NAMESPACE_STYLE, XML_MAP, true, true);
725 else
727 OUString sCondition;
728 if (aOperator == sheet::ConditionOperator_BETWEEN ||
729 aOperator == sheet::ConditionOperator_NOT_BETWEEN)
731 if (aOperator == sheet::ConditionOperator_BETWEEN)
732 sCondition = "cell-content-is-between(";
733 else
734 sCondition = "cell-content-is-not-between(";
735 sCondition += xSheetCondition->getFormula1()
736 + ","
737 + xSheetCondition->getFormula2()
738 + ")";
740 else
742 sCondition = "cell-content()";
743 switch (aOperator)
745 case sheet::ConditionOperator_LESS:
746 sCondition += "<";
747 break;
748 case sheet::ConditionOperator_GREATER:
749 sCondition += ">";
750 break;
751 case sheet::ConditionOperator_LESS_EQUAL:
752 sCondition += "<=";
753 break;
754 case sheet::ConditionOperator_GREATER_EQUAL:
755 sCondition += ">=";
756 break;
757 case sheet::ConditionOperator_EQUAL:
758 sCondition += "=";
759 break;
760 case sheet::ConditionOperator_NOT_EQUAL:
761 sCondition += "!=";
762 break;
763 default:
765 // added to avoid warnings
768 sCondition += xSheetCondition->getFormula1();
770 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_CONDITION, sCondition);
771 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_APPLY_STYLE_NAME, rScXMLExport.EncodeStyleName( sStyleName ));
772 OUString sOUBaseAddress;
773 ScRangeStringConverter::GetStringFromAddress( sOUBaseAddress,
774 xSheetCondition->getSourcePosition(), rScXMLExport.GetDocument(), FormulaGrammar::CONV_OOO );
775 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_BASE_CELL_ADDRESS, sOUBaseAddress);
776 SvXMLElementExport aMElem(rScXMLExport, XML_NAMESPACE_STYLE, XML_MAP, true, true);
784 break;
790 ScXMLAutoStylePoolP::ScXMLAutoStylePoolP(ScXMLExport& rTempScXMLExport):
791 SvXMLAutoStylePoolP(rTempScXMLExport),
792 rScXMLExport(rTempScXMLExport)
796 ScXMLAutoStylePoolP::~ScXMLAutoStylePoolP()
800 XMLScPropHdlFactory::XMLScPropHdlFactory()
801 : XMLPropertyHandlerFactory()
805 XMLScPropHdlFactory::~XMLScPropHdlFactory()
809 const XMLPropertyHandler* XMLScPropHdlFactory::GetPropertyHandler( sal_Int32 nType ) const
811 nType &= MID_FLAG_MASK;
813 XMLPropertyHandler* pHdl(const_cast<XMLPropertyHandler*>(XMLPropertyHandlerFactory::GetPropertyHandler( nType )));
814 if(!pHdl)
816 switch(nType)
818 case XML_SC_TYPE_CELLPROTECTION :
820 pHdl = new XmlScPropHdl_CellProtection;
822 break;
823 case XML_SC_TYPE_PRINTCONTENT :
825 pHdl = new XmlScPropHdl_PrintContent;
827 break;
828 case XML_SC_TYPE_HORIJUSTIFY_METHOD:
829 case XML_SC_TYPE_VERTJUSTIFY_METHOD:
831 pHdl = new XmlScPropHdl_JustifyMethod;
833 break;
834 case XML_SC_TYPE_HORIJUSTIFY :
836 pHdl = new XmlScPropHdl_HoriJustify;
838 break;
839 case XML_SC_TYPE_HORIJUSTIFYSOURCE :
841 pHdl = new XmlScPropHdl_HoriJustifySource;
843 break;
844 case XML_SC_TYPE_HORIJUSTIFYREPEAT :
846 pHdl = new XmlScPropHdl_HoriJustifyRepeat;
848 break;
849 case XML_SC_TYPE_ORIENTATION :
851 pHdl = new XmlScPropHdl_Orientation;
853 break;
854 case XML_SC_TYPE_ROTATEANGLE :
856 pHdl = new XmlScPropHdl_RotateAngle;
858 break;
859 case XML_SC_TYPE_ROTATEREFERENCE :
861 pHdl = new XmlScPropHdl_RotateReference;
863 break;
864 case XML_SC_TYPE_VERTJUSTIFY :
866 pHdl = new XmlScPropHdl_VertJustify;
868 break;
869 case XML_SC_TYPE_BREAKBEFORE :
871 pHdl = new XmlScPropHdl_BreakBefore;
873 break;
874 case XML_SC_ISTEXTWRAPPED :
876 pHdl = new XmlScPropHdl_IsTextWrapped;
878 break;
879 case XML_SC_TYPE_EQUAL :
881 pHdl = new XmlScPropHdl_IsEqual;
883 break;
884 case XML_SC_TYPE_VERTICAL :
886 pHdl = new XmlScPropHdl_Vertical;
888 break;
891 if(pHdl)
892 PutHdlCache(nType, pHdl);
895 return pHdl;
898 XmlScPropHdl_CellProtection::~XmlScPropHdl_CellProtection()
902 bool XmlScPropHdl_CellProtection::equals(
903 const css::uno::Any& r1,
904 const css::uno::Any& r2 ) const
906 util::CellProtection aCellProtection1, aCellProtection2;
908 if((r1 >>= aCellProtection1) && (r2 >>= aCellProtection2))
910 return ((aCellProtection1.IsHidden == aCellProtection2.IsHidden) &&
911 (aCellProtection1.IsLocked == aCellProtection2.IsLocked) &&
912 (aCellProtection1.IsFormulaHidden == aCellProtection2.IsFormulaHidden));
914 return false;
917 bool XmlScPropHdl_CellProtection::importXML(
918 const OUString& rStrImpValue,
919 css::uno::Any& rValue,
920 const SvXMLUnitConverter& /* rUnitConverter */ ) const
922 bool bRetval(false);
924 util::CellProtection aCellProtection;
925 bool bDefault(false);
926 if (!rValue.hasValue())
928 aCellProtection.IsHidden = false;
929 aCellProtection.IsLocked = true;
930 aCellProtection.IsFormulaHidden = false;
931 aCellProtection.IsPrintHidden = false;
932 bDefault = true;
934 if ((rValue >>= aCellProtection) || bDefault)
936 if (IsXMLToken(rStrImpValue, XML_NONE))
938 aCellProtection.IsFormulaHidden = false;
939 aCellProtection.IsHidden = false;
940 aCellProtection.IsLocked = false;
941 rValue <<= aCellProtection;
942 bRetval = true;
944 else if (IsXMLToken(rStrImpValue, XML_HIDDEN_AND_PROTECTED))
946 aCellProtection.IsFormulaHidden = true;
947 aCellProtection.IsHidden = true;
948 aCellProtection.IsLocked = true;
949 rValue <<= aCellProtection;
950 bRetval = true;
952 else if (IsXMLToken(rStrImpValue, XML_PROTECTED))
954 aCellProtection.IsFormulaHidden = false;
955 aCellProtection.IsHidden = false;
956 aCellProtection.IsLocked = true;
957 rValue <<= aCellProtection;
958 bRetval = true;
960 else if (IsXMLToken(rStrImpValue, XML_FORMULA_HIDDEN))
962 aCellProtection.IsFormulaHidden = true;
963 aCellProtection.IsHidden = false;
964 aCellProtection.IsLocked = false;
965 rValue <<= aCellProtection;
966 bRetval = true;
968 else
970 sal_Int32 i(0);
971 while (i < rStrImpValue.getLength() && rStrImpValue[i] != ' ')
972 ++i;
973 OUString sFirst(rStrImpValue.copy(0, i));
974 OUString sSecond(rStrImpValue.copy(i + 1));
975 aCellProtection.IsFormulaHidden = false;
976 aCellProtection.IsHidden = false;
977 aCellProtection.IsLocked = false;
978 if ((IsXMLToken(sFirst, XML_PROTECTED)) || (IsXMLToken(sSecond, XML_PROTECTED)))
979 aCellProtection.IsLocked = true;
980 if ((IsXMLToken(sFirst, XML_FORMULA_HIDDEN)) || (IsXMLToken(sSecond, XML_FORMULA_HIDDEN)))
981 aCellProtection.IsFormulaHidden = true;
982 rValue <<= aCellProtection;
983 bRetval = true;
987 return bRetval;
990 bool XmlScPropHdl_CellProtection::exportXML(
991 OUString& rStrExpValue,
992 const css::uno::Any& rValue,
993 const SvXMLUnitConverter& /* rUnitConverter */ ) const
995 bool bRetval(false);
996 util::CellProtection aCellProtection;
998 if(rValue >>= aCellProtection)
1000 if (!(aCellProtection.IsFormulaHidden || aCellProtection.IsHidden || aCellProtection.IsLocked))
1002 rStrExpValue = GetXMLToken(XML_NONE);
1003 bRetval = true;
1005 else if (aCellProtection.IsHidden)
1007 // #i105964# "Hide all" implies "Protected" in the UI, so it must be saved as "hidden-and-protected"
1008 // even if "IsLocked" is not set in the CellProtection struct.
1009 rStrExpValue = GetXMLToken(XML_HIDDEN_AND_PROTECTED);
1010 bRetval = true;
1012 else if (aCellProtection.IsLocked && !aCellProtection.IsFormulaHidden)
1014 rStrExpValue = GetXMLToken(XML_PROTECTED);
1015 bRetval = true;
1017 else if (aCellProtection.IsFormulaHidden && !aCellProtection.IsLocked)
1019 rStrExpValue = GetXMLToken(XML_FORMULA_HIDDEN);
1020 bRetval = true;
1022 else if (aCellProtection.IsFormulaHidden && aCellProtection.IsLocked)
1024 rStrExpValue = GetXMLToken(XML_PROTECTED);
1025 rStrExpValue += " ";
1026 rStrExpValue += GetXMLToken(XML_FORMULA_HIDDEN);
1027 bRetval = true;
1031 return bRetval;
1034 XmlScPropHdl_PrintContent::~XmlScPropHdl_PrintContent()
1038 bool XmlScPropHdl_PrintContent::equals(
1039 const css::uno::Any& r1,
1040 const css::uno::Any& r2 ) const
1042 util::CellProtection aCellProtection1, aCellProtection2;
1044 if((r1 >>= aCellProtection1) && (r2 >>= aCellProtection2))
1046 return (aCellProtection1.IsPrintHidden == aCellProtection2.IsPrintHidden);
1048 return false;
1051 bool XmlScPropHdl_PrintContent::importXML(
1052 const OUString& rStrImpValue,
1053 css::uno::Any& rValue,
1054 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1056 bool bRetval(false);
1057 util::CellProtection aCellProtection;
1058 bool bDefault(false);
1059 if (!rValue.hasValue())
1061 aCellProtection.IsHidden = false;
1062 aCellProtection.IsLocked = true;
1063 aCellProtection.IsFormulaHidden = false;
1064 aCellProtection.IsPrintHidden = false;
1065 bDefault = true;
1067 if ((rValue >>= aCellProtection) || bDefault)
1069 bool bValue(false);
1070 if (::sax::Converter::convertBool(bValue, rStrImpValue))
1072 aCellProtection.IsPrintHidden = !bValue;
1073 rValue <<= aCellProtection;
1074 bRetval = true;
1078 return bRetval;
1081 bool XmlScPropHdl_PrintContent::exportXML(
1082 OUString& rStrExpValue,
1083 const css::uno::Any& rValue,
1084 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1086 bool bRetval(false);
1088 util::CellProtection aCellProtection;
1089 if(rValue >>= aCellProtection)
1091 OUStringBuffer sValue;
1092 ::sax::Converter::convertBool(sValue, !aCellProtection.IsPrintHidden);
1093 rStrExpValue = sValue.makeStringAndClear();
1094 bRetval = true;
1097 return bRetval;
1100 XmlScPropHdl_JustifyMethod::~XmlScPropHdl_JustifyMethod()
1104 bool XmlScPropHdl_JustifyMethod::equals(
1105 const css::uno::Any& r1,
1106 const css::uno::Any& r2 ) const
1108 sal_Int32 nVal1(0), nVal2(0);
1110 if((r1 >>= nVal1) && (r2 >>= nVal2))
1111 return (nVal1 == nVal2);
1112 return false;
1115 bool XmlScPropHdl_JustifyMethod::importXML(
1116 const OUString& rStrImpValue,
1117 css::uno::Any& rValue,
1118 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1120 bool bRetval = false;
1122 sal_Int32 nValue = table::CellJustifyMethod::AUTO;
1123 if (IsXMLToken(rStrImpValue, XML_AUTO))
1125 nValue = table::CellJustifyMethod::AUTO;
1126 rValue <<= nValue;
1127 bRetval = true;
1129 else if (IsXMLToken(rStrImpValue, XML_DISTRIBUTE))
1131 nValue = table::CellJustifyMethod::DISTRIBUTE;
1132 rValue <<= nValue;
1133 bRetval = true;
1135 else
1136 bRetval = true;
1138 return bRetval;
1141 bool XmlScPropHdl_JustifyMethod::exportXML(
1142 OUString& rStrExpValue,
1143 const css::uno::Any& rValue,
1144 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1146 sal_Int32 nVal(0);
1147 bool bRetval = false;
1149 if (rValue >>= nVal)
1151 switch (nVal)
1153 case table::CellJustifyMethod::AUTO:
1155 rStrExpValue = GetXMLToken(XML_AUTO);
1156 bRetval = true;
1158 break;
1159 case table::CellJustifyMethod::DISTRIBUTE:
1161 rStrExpValue = GetXMLToken(XML_DISTRIBUTE);
1162 bRetval = true;
1164 break;
1165 default:
1167 // added to avoid warnings
1171 return bRetval;
1174 XmlScPropHdl_HoriJustify::~XmlScPropHdl_HoriJustify()
1178 bool XmlScPropHdl_HoriJustify::equals(
1179 const css::uno::Any& r1,
1180 const css::uno::Any& r2 ) const
1182 table::CellHoriJustify aHoriJustify1, aHoriJustify2;
1184 if((r1 >>= aHoriJustify1) && (r2 >>= aHoriJustify2))
1185 return (aHoriJustify1 == aHoriJustify2);
1186 return false;
1189 bool XmlScPropHdl_HoriJustify::importXML(
1190 const OUString& rStrImpValue,
1191 css::uno::Any& rValue,
1192 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1194 bool bRetval(false);
1196 table::CellHoriJustify nValue = table::CellHoriJustify_LEFT;
1197 rValue >>= nValue;
1198 if (nValue != table::CellHoriJustify_REPEAT)
1200 if (IsXMLToken(rStrImpValue, XML_START))
1202 nValue = table::CellHoriJustify_LEFT;
1203 rValue <<= nValue;
1204 bRetval = true;
1206 else if (IsXMLToken(rStrImpValue, XML_END))
1208 nValue = table::CellHoriJustify_RIGHT;
1209 rValue <<= nValue;
1210 bRetval = true;
1212 else if (IsXMLToken(rStrImpValue, XML_CENTER))
1214 nValue = table::CellHoriJustify_CENTER;
1215 rValue <<= nValue;
1216 bRetval = true;
1218 else if (IsXMLToken(rStrImpValue, XML_JUSTIFY))
1220 nValue = table::CellHoriJustify_BLOCK;
1221 rValue <<= nValue;
1222 bRetval = true;
1225 else
1226 bRetval = true;
1228 return bRetval;
1231 bool XmlScPropHdl_HoriJustify::exportXML(
1232 OUString& rStrExpValue,
1233 const css::uno::Any& rValue,
1234 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1236 table::CellHoriJustify nVal;
1237 bool bRetval(false);
1239 if(rValue >>= nVal)
1241 switch (nVal)
1243 case table::CellHoriJustify_REPEAT:
1244 case table::CellHoriJustify_LEFT:
1246 rStrExpValue = GetXMLToken(XML_START);
1247 bRetval = true;
1249 break;
1250 case table::CellHoriJustify_RIGHT:
1252 rStrExpValue = GetXMLToken(XML_END);
1253 bRetval = true;
1255 break;
1256 case table::CellHoriJustify_CENTER:
1258 rStrExpValue = GetXMLToken(XML_CENTER);
1259 bRetval = true;
1261 break;
1262 case table::CellHoriJustify_BLOCK:
1264 rStrExpValue = GetXMLToken(XML_JUSTIFY);
1265 bRetval = true;
1267 break;
1268 default:
1270 // added to avoid warnings
1275 return bRetval;
1278 XmlScPropHdl_HoriJustifySource::~XmlScPropHdl_HoriJustifySource()
1282 bool XmlScPropHdl_HoriJustifySource::equals(
1283 const css::uno::Any& r1,
1284 const css::uno::Any& r2 ) const
1286 table::CellHoriJustify aHoriJustify1, aHoriJustify2;
1288 if((r1 >>= aHoriJustify1) && (r2 >>= aHoriJustify2))
1289 return (aHoriJustify1 == aHoriJustify2);
1290 return false;
1293 bool XmlScPropHdl_HoriJustifySource::importXML(
1294 const OUString& rStrImpValue,
1295 css::uno::Any& rValue,
1296 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1298 bool bRetval(false);
1300 if (IsXMLToken(rStrImpValue, XML_FIX))
1302 bRetval = true;
1304 else if (IsXMLToken(rStrImpValue, XML_VALUE_TYPE))
1306 rValue <<= table::CellHoriJustify_STANDARD;
1307 bRetval = true;
1310 return bRetval;
1313 bool XmlScPropHdl_HoriJustifySource::exportXML(
1314 OUString& rStrExpValue,
1315 const css::uno::Any& rValue,
1316 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1318 table::CellHoriJustify nVal;
1319 bool bRetval(false);
1321 if(rValue >>= nVal)
1323 if (nVal == table::CellHoriJustify_STANDARD)
1325 rStrExpValue = GetXMLToken(XML_VALUE_TYPE);
1326 bRetval = true;
1328 else
1330 rStrExpValue = GetXMLToken(XML_FIX);
1331 bRetval = true;
1335 return bRetval;
1338 XmlScPropHdl_HoriJustifyRepeat::~XmlScPropHdl_HoriJustifyRepeat()
1342 bool XmlScPropHdl_HoriJustifyRepeat::equals(
1343 const css::uno::Any& r1,
1344 const css::uno::Any& r2 ) const
1346 table::CellHoriJustify aHoriJustify1, aHoriJustify2;
1348 if((r1 >>= aHoriJustify1) && (r2 >>= aHoriJustify2))
1349 return (aHoriJustify1 == aHoriJustify2);
1350 return false;
1353 bool XmlScPropHdl_HoriJustifyRepeat::importXML(
1354 const OUString& rStrImpValue,
1355 css::uno::Any& rValue,
1356 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1358 bool bRetval(false);
1360 if (IsXMLToken(rStrImpValue, XML_FALSE))
1362 bRetval = true;
1364 else if (IsXMLToken(rStrImpValue, XML_TRUE))
1366 rValue <<= table::CellHoriJustify_REPEAT;
1367 bRetval = true;
1370 return bRetval;
1373 bool XmlScPropHdl_HoriJustifyRepeat::exportXML(
1374 OUString& rStrExpValue,
1375 const css::uno::Any& rValue,
1376 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1378 table::CellHoriJustify nVal;
1379 bool bRetval(false);
1381 if(rValue >>= nVal)
1383 if (nVal == table::CellHoriJustify_REPEAT)
1385 rStrExpValue = GetXMLToken(XML_TRUE);
1386 bRetval = true;
1388 else
1390 rStrExpValue = GetXMLToken(XML_FALSE);
1391 bRetval = true;
1395 return bRetval;
1398 XmlScPropHdl_Orientation::~XmlScPropHdl_Orientation()
1402 bool XmlScPropHdl_Orientation::equals(
1403 const css::uno::Any& r1,
1404 const css::uno::Any& r2 ) const
1406 table::CellOrientation aOrientation1, aOrientation2;
1408 if((r1 >>= aOrientation1) && (r2 >>= aOrientation2))
1409 return (aOrientation1 == aOrientation2);
1410 return false;
1413 bool XmlScPropHdl_Orientation::importXML(
1414 const OUString& rStrImpValue,
1415 css::uno::Any& rValue,
1416 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1418 bool bRetval(false);
1420 table::CellOrientation nValue;
1421 if (IsXMLToken(rStrImpValue, XML_LTR))
1423 nValue = table::CellOrientation_STANDARD;
1424 rValue <<= nValue;
1425 bRetval = true;
1427 else if (IsXMLToken(rStrImpValue, XML_TTB))
1429 nValue = table::CellOrientation_STACKED;
1430 rValue <<= nValue;
1431 bRetval = true;
1434 return bRetval;
1437 bool XmlScPropHdl_Orientation::exportXML(
1438 OUString& rStrExpValue,
1439 const css::uno::Any& rValue,
1440 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1442 table::CellOrientation nVal;
1443 bool bRetval(false);
1445 if(rValue >>= nVal)
1447 switch (nVal)
1449 case table::CellOrientation_STACKED :
1451 rStrExpValue = GetXMLToken(XML_TTB);
1452 bRetval = true;
1454 break;
1455 default:
1457 rStrExpValue = GetXMLToken(XML_LTR);
1458 bRetval = true;
1460 break;
1464 return bRetval;
1467 XmlScPropHdl_RotateAngle::~XmlScPropHdl_RotateAngle()
1471 bool XmlScPropHdl_RotateAngle::equals(
1472 const css::uno::Any& r1,
1473 const css::uno::Any& r2 ) const
1475 sal_Int32 aAngle1 = 0, aAngle2 = 0;
1477 if((r1 >>= aAngle1) && (r2 >>= aAngle2))
1478 return (aAngle1 == aAngle2);
1479 return false;
1482 bool XmlScPropHdl_RotateAngle::importXML(
1483 const OUString& rStrImpValue,
1484 css::uno::Any& rValue,
1485 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1487 bool bRetval(false);
1489 sal_Int32 nValue;
1490 if (::sax::Converter::convertNumber(nValue, rStrImpValue) && !o3tl::checked_multiply<sal_Int32>(nValue, 100, nValue))
1492 rValue <<= nValue;
1493 bRetval = true;
1496 return bRetval;
1499 bool XmlScPropHdl_RotateAngle::exportXML(
1500 OUString& rStrExpValue,
1501 const css::uno::Any& rValue,
1502 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1504 sal_Int32 nVal = 0;
1505 bool bRetval(false);
1507 if(rValue >>= nVal)
1509 rStrExpValue = OUString::number(nVal / 100);
1510 bRetval = true;
1513 return bRetval;
1516 XmlScPropHdl_RotateReference::~XmlScPropHdl_RotateReference()
1520 bool XmlScPropHdl_RotateReference::equals(
1521 const css::uno::Any& r1,
1522 const css::uno::Any& r2 ) const
1524 sal_Int32 aReference1(0), aReference2(0);
1526 if((r1 >>= aReference1) && (r2 >>= aReference2))
1527 return (aReference1 == aReference2);
1528 return false;
1531 bool XmlScPropHdl_RotateReference::importXML(
1532 const OUString& rStrImpValue,
1533 css::uno::Any& rValue,
1534 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1536 bool bRetval(false);
1538 sal_Int32 nValue;
1539 if (IsXMLToken(rStrImpValue, XML_NONE))
1541 nValue = table::CellVertJustify2::STANDARD;
1542 rValue <<= nValue;
1543 bRetval = true;
1545 else if (IsXMLToken(rStrImpValue, XML_BOTTOM))
1547 nValue = table::CellVertJustify2::BOTTOM;
1548 rValue <<= nValue;
1549 bRetval = true;
1551 else if (IsXMLToken(rStrImpValue, XML_TOP))
1553 nValue = table::CellVertJustify2::TOP;
1554 rValue <<= nValue;
1555 bRetval = true;
1557 else if (IsXMLToken(rStrImpValue, XML_CENTER))
1559 nValue = table::CellVertJustify2::CENTER;
1560 rValue <<= nValue;
1561 bRetval = true;
1564 return bRetval;
1567 bool XmlScPropHdl_RotateReference::exportXML(
1568 OUString& rStrExpValue,
1569 const css::uno::Any& rValue,
1570 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1572 sal_Int32 nVal(0);
1573 bool bRetval(false);
1575 if(rValue >>= nVal)
1577 switch (nVal)
1579 case table::CellVertJustify2::BOTTOM :
1581 rStrExpValue = GetXMLToken(XML_BOTTOM);
1582 bRetval = true;
1584 break;
1585 case table::CellVertJustify2::CENTER :
1587 rStrExpValue = GetXMLToken(XML_CENTER);
1588 bRetval = true;
1590 break;
1591 case table::CellVertJustify2::STANDARD :
1593 rStrExpValue = GetXMLToken(XML_NONE);
1594 bRetval = true;
1596 break;
1597 case table::CellVertJustify2::TOP :
1599 rStrExpValue = GetXMLToken(XML_TOP);
1600 bRetval = true;
1602 break;
1603 default:
1605 // added to avoid warnings
1610 return bRetval;
1613 XmlScPropHdl_VertJustify::~XmlScPropHdl_VertJustify()
1617 bool XmlScPropHdl_VertJustify::equals(
1618 const css::uno::Any& r1,
1619 const css::uno::Any& r2 ) const
1621 sal_Int32 aReference1(0), aReference2(0);
1623 if((r1 >>= aReference1) && (r2 >>= aReference2))
1624 return (aReference1 == aReference2);
1625 return false;
1628 bool XmlScPropHdl_VertJustify::importXML(
1629 const OUString& rStrImpValue,
1630 css::uno::Any& rValue,
1631 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1633 bool bRetval(false);
1635 sal_Int32 nValue;
1636 if (IsXMLToken(rStrImpValue, XML_AUTOMATIC))
1638 nValue = table::CellVertJustify2::STANDARD;
1639 rValue <<= nValue;
1640 bRetval = true;
1642 else if (IsXMLToken(rStrImpValue, XML_BOTTOM))
1644 nValue = table::CellVertJustify2::BOTTOM;
1645 rValue <<= nValue;
1646 bRetval = true;
1648 else if (IsXMLToken(rStrImpValue, XML_TOP))
1650 nValue = table::CellVertJustify2::TOP;
1651 rValue <<= nValue;
1652 bRetval = true;
1654 else if (IsXMLToken(rStrImpValue, XML_MIDDLE))
1656 nValue = table::CellVertJustify2::CENTER;
1657 rValue <<= nValue;
1658 bRetval = true;
1660 else if (IsXMLToken(rStrImpValue, XML_JUSTIFY))
1662 nValue = table::CellVertJustify2::BLOCK;
1663 rValue <<= nValue;
1664 bRetval = true;
1667 return bRetval;
1670 bool XmlScPropHdl_VertJustify::exportXML(
1671 OUString& rStrExpValue,
1672 const css::uno::Any& rValue,
1673 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1675 sal_Int32 nVal(0);
1676 bool bRetval(false);
1678 if(rValue >>= nVal)
1680 switch (nVal)
1682 case table::CellVertJustify2::BOTTOM :
1684 rStrExpValue = GetXMLToken(XML_BOTTOM);
1685 bRetval = true;
1687 break;
1688 case table::CellVertJustify2::CENTER :
1690 rStrExpValue = GetXMLToken(XML_MIDDLE);
1691 bRetval = true;
1693 break;
1694 case table::CellVertJustify2::STANDARD :
1696 rStrExpValue = GetXMLToken(XML_AUTOMATIC);
1697 bRetval = true;
1699 break;
1700 case table::CellVertJustify2::TOP :
1702 rStrExpValue = GetXMLToken(XML_TOP);
1703 bRetval = true;
1705 break;
1706 case table::CellVertJustify2::BLOCK :
1708 rStrExpValue = GetXMLToken(XML_JUSTIFY);
1709 bRetval = true;
1711 break;
1712 default:
1714 // added to avoid warnings
1719 return bRetval;
1722 XmlScPropHdl_BreakBefore::~XmlScPropHdl_BreakBefore()
1726 bool XmlScPropHdl_BreakBefore::equals(
1727 const css::uno::Any& r1,
1728 const css::uno::Any& r2 ) const
1730 bool aBreak1 = false, aBreak2 = false;
1732 if((r1 >>= aBreak1) && (r2 >>= aBreak2))
1733 return (aBreak1 == aBreak2);
1734 return false;
1737 bool XmlScPropHdl_BreakBefore::importXML(
1738 const OUString& rStrImpValue,
1739 css::uno::Any& rValue,
1740 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1742 bool bRetval(false);
1744 bool bValue;
1745 if (IsXMLToken(rStrImpValue, XML_AUTO))
1747 bValue = false;
1748 rValue <<= bValue;
1749 bRetval = true;
1751 else if (IsXMLToken(rStrImpValue, XML_PAGE))
1753 bValue = true;
1754 rValue <<= bValue;
1755 bRetval = true;
1758 return bRetval;
1761 bool XmlScPropHdl_BreakBefore::exportXML(
1762 OUString& rStrExpValue,
1763 const css::uno::Any& rValue,
1764 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1766 bool bRetval(false);
1768 if(::cppu::any2bool(rValue))
1770 rStrExpValue = GetXMLToken(XML_PAGE);
1771 bRetval = true;
1773 else
1775 rStrExpValue = GetXMLToken(XML_AUTO);
1776 bRetval = true;
1779 return bRetval;
1782 XmlScPropHdl_IsTextWrapped::~XmlScPropHdl_IsTextWrapped()
1786 bool XmlScPropHdl_IsTextWrapped::equals(
1787 const css::uno::Any& r1,
1788 const css::uno::Any& r2 ) const
1790 return (::cppu::any2bool(r1) == ::cppu::any2bool(r2));
1793 bool XmlScPropHdl_IsTextWrapped::importXML(
1794 const OUString& rStrImpValue,
1795 css::uno::Any& rValue,
1796 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1798 bool bRetval(false);
1800 if (IsXMLToken(rStrImpValue, XML_WRAP))
1802 rValue <<= true;
1803 bRetval = true;
1805 else if (IsXMLToken(rStrImpValue, XML_NO_WRAP))
1807 rValue <<= false;
1808 bRetval = true;
1811 return bRetval;
1814 bool XmlScPropHdl_IsTextWrapped::exportXML(
1815 OUString& rStrExpValue,
1816 const css::uno::Any& rValue,
1817 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1819 bool bRetval(false);
1821 if (::cppu::any2bool(rValue))
1823 rStrExpValue = GetXMLToken(XML_WRAP);
1824 bRetval = true;
1826 else
1828 rStrExpValue = GetXMLToken(XML_NO_WRAP);
1829 bRetval = true;
1832 return bRetval;
1835 bool XmlScPropHdl_IsEqual::importXML( const OUString& /* rStrImpValue */,
1836 css::uno::Any& /* rValue */,
1837 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1839 OSL_FAIL("should never be called");
1840 return false;
1843 bool XmlScPropHdl_IsEqual::exportXML( OUString& /* rStrExpValue */,
1844 const css::uno::Any& /* rValue */,
1845 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1847 OSL_FAIL("should never be called");
1848 return false;
1851 XmlScPropHdl_Vertical::~XmlScPropHdl_Vertical()
1855 bool XmlScPropHdl_Vertical::equals(
1856 const css::uno::Any& r1,
1857 const css::uno::Any& r2 ) const
1859 return (::cppu::any2bool(r1) == ::cppu::any2bool(r2));
1862 bool XmlScPropHdl_Vertical::importXML(
1863 const OUString& rStrImpValue,
1864 css::uno::Any& rValue,
1865 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1867 bool bRetval(false);
1869 if (IsXMLToken(rStrImpValue, XML_AUTO))
1871 rValue <<= true;
1872 bRetval = true;
1874 else if (IsXMLToken(rStrImpValue, XML_0))
1876 rValue <<= false;
1877 bRetval = true;
1880 return bRetval;
1883 bool XmlScPropHdl_Vertical::exportXML(
1884 OUString& rStrExpValue,
1885 const css::uno::Any& rValue,
1886 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1888 bool bRetval(false);
1890 if (::cppu::any2bool(rValue))
1892 rStrExpValue = GetXMLToken(XML_AUTO);
1893 bRetval = true;
1895 else
1897 rStrExpValue = GetXMLToken(XML_0);
1898 bRetval = true;
1901 return bRetval;
1904 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */