Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / sc / source / filter / xml / xmlstyle.cxx
bloba8ca7bbdce596f395f62733c835ea43b9686e74c
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/xmlnmspe.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::ODFVER_010, false }
54 // extensions import/export
55 #define MAP_EXT(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFVER_012_EXT_COMPAT, false }
56 // extensions import only
57 #define MAP_EXT_I(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFVER_012_EXT_COMPAT, true }
58 #define MAP_END() { nullptr, 0, 0, XML_TOKEN_INVALID, 0, 0, SvtSaveOptions::ODFVER_010, false }
60 const XMLPropertyMapEntry aXMLScCellStylesProperties[] =
62 MAP( "AsianVerticalMode", XML_NAMESPACE_STYLE, XML_GLYPH_ORIENTATION_VERTICAL, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_VERTICAL, 0),
63 MAP( "BottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_BOTTOMBORDER ),
64 MAP( "BottomBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_BOTTOMBORDERWIDTH ),
65 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 ),
66 MAP( "CellProtection", XML_NAMESPACE_STYLE, XML_CELL_PROTECT, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_CELLPROTECTION|MID_FLAG_MERGE_PROPERTY, 0 ),
67 MAP( "CellProtection", XML_NAMESPACE_STYLE, XML_PRINT_CONTENT, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_PRINTCONTENT|MID_FLAG_MERGE_PROPERTY, 0 ),
68 MAP( "CellStyle", XML_NAMESPACE_STYLE, XML_STYLE, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_STRING, CTF_SC_CELLSTYLE ),
69 MAP( "ConditionalFormatXML", XML_NAMESPACE_STYLE, XML_MAP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_IMPORT_MAP ),
70 MAP( "ConditionalFormatXML", XML_NAMESPACE_STYLE, XML_MAP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_MAP ),
71 MAP( "DiagonalBLTR", XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_DIAGONALBLTR ),
72 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
73 MAP( "DiagonalBLTR", XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR_WIDTHS, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_DIAGONALBLTRWIDTHS ),
74 MAP( "DiagonalTLBR", XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_DIAGONALTLBR ),
75 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
76 MAP( "DiagonalTLBR", XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR_WIDTHS, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_DIAGONALTLBRWIDTHS ),
77 MAP( "HoriJustify", XML_NAMESPACE_FO, XML_TEXT_ALIGN, XML_TYPE_PROP_PARAGRAPH|XML_SC_TYPE_HORIJUSTIFY|MID_FLAG_MERGE_PROPERTY, 0 ),
78 MAP( "HoriJustify", XML_NAMESPACE_STYLE, XML_TEXT_ALIGN_SOURCE, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_HORIJUSTIFYSOURCE|MID_FLAG_MERGE_PROPERTY, 0 ),
79 MAP( "HoriJustify", XML_NAMESPACE_STYLE, XML_REPEAT_CONTENT, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_HORIJUSTIFYREPEAT|MID_FLAG_MERGE_PROPERTY, 0 ),
80 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 ),
81 MAP_EXT( SC_UNONAME_CELLHJUS_METHOD, XML_NAMESPACE_CSS3TEXT, XML_TEXT_JUSTIFY, XML_TYPE_PROP_PARAGRAPH|XML_SC_TYPE_HORIJUSTIFY_METHOD, 0 ),
82 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 ),
83 MAP( "IsTextWrapped", XML_NAMESPACE_FO, XML_WRAP_OPTION, XML_TYPE_PROP_TABLE_CELL|XML_SC_ISTEXTWRAPPED, 0 ),
84 MAP( "LeftBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_ALLBORDER ),
85 MAP( "LeftBorder", XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_LEFTBORDER ),
86 MAP( "LeftBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_ALLBORDERWIDTH ),
87 MAP( "LeftBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_LEFTBORDERWIDTH ),
88 MAP( "NumberFormat", XML_NAMESPACE_STYLE, XML_DATA_STYLE_NAME, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_NUMBER|MID_FLAG_SPECIAL_ITEM, CTF_SC_NUMBERFORMAT),
89 MAP( "Orientation", XML_NAMESPACE_STYLE, XML_DIRECTION, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_ORIENTATION, 0 ),
90 MAP( "ParaBottomMargin", XML_NAMESPACE_FO, XML_PADDING, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_ALLPADDING ),
91 MAP( "ParaBottomMargin", XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_BOTTOMPADDING ),
92 MAP( "ParaIndent", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_PROP_PARAGRAPH|XML_TYPE_MEASURE16, 0 ),
93 MAP( "ParaLeftMargin", XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_LEFTPADDING ),
94 MAP( "ParaRightMargin", XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_RIGHTPADDING ),
95 MAP( "ParaTopMargin", XML_NAMESPACE_FO, XML_PADDING_TOP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_TOPPADDING ),
96 MAP( "RightBorder", XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_RIGHTBORDER ),
97 MAP( "RightBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_RIGHTBORDERWIDTH ),
98 MAP( "RotateAngle", XML_NAMESPACE_STYLE, XML_ROTATION_ANGLE, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_ROTATEANGLE, 0 ),
99 MAP( "RotateReference", XML_NAMESPACE_STYLE, XML_ROTATION_ALIGN, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_ROTATEREFERENCE, 0),
100 MAP( "ShadowFormat", XML_NAMESPACE_STYLE, XML_SHADOW, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_TEXT_SHADOW, 0 ),
101 MAP( "ShrinkToFit", XML_NAMESPACE_STYLE, XML_SHRINK_TO_FIT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BOOL, 0 ),
102 MAP( "StandardDecimals", XML_NAMESPACE_STYLE, XML_DECIMAL_PLACES, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_NUMBER16, 0 ),
103 MAP( "TopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_TOPBORDER ),
104 MAP( "TopBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_TOPBORDERWIDTH ),
105 MAP( "UserDefinedAttributes", XML_NAMESPACE_TEXT, XML_XMLNS, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),
106 MAP( "ValidationXML", XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BUILDIN_CMP_ONLY, CTF_SC_VALIDATION ),
107 MAP( "VertJustify", XML_NAMESPACE_STYLE, XML_VERTICAL_ALIGN, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_VERTJUSTIFY, 0),
108 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+
109 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
110 MAP_END()
113 const XMLPropertyMapEntry aXMLScColumnStylesProperties[] =
115 MAP( "IsManualPageBreak", XML_NAMESPACE_FO, XML_BREAK_BEFORE, XML_TYPE_PROP_TABLE_COLUMN|XML_SC_TYPE_BREAKBEFORE, 0),
116 MAP( "IsVisible", XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TYPE_PROP_TABLE_COLUMN|XML_SC_TYPE_EQUAL|MID_FLAG_SPECIAL_ITEM, CTF_SC_ISVISIBLE ),
117 MAP( "Width", XML_NAMESPACE_STYLE, XML_COLUMN_WIDTH, XML_TYPE_PROP_TABLE_COLUMN|XML_TYPE_MEASURE, 0 ),
118 MAP_END()
121 const XMLPropertyMapEntry aXMLScRowStylesImportProperties[] =
123 // #i57867# Include background color (CellBackColor/IsCellBackgroundTransparent) for import only.
124 // Import and export should use the same map, with MID_FLAG_NO_PROPERTY_EXPORT for the background entries,
125 // but this doesn't work at the moment because SvXMLImportPropertyMapper compares MID_FLAG_NO_PROPERTY to 0.
126 // If this is changed (not for 2.0.x), a single map can be used again.
128 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 ),
129 MAP( "Height", XML_NAMESPACE_STYLE, XML_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_MEASURE, CTF_SC_ROWHEIGHT),
130 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 ),
131 MAP( "IsManualPageBreak", XML_NAMESPACE_FO, XML_BREAK_BEFORE, XML_TYPE_PROP_TABLE_ROW|XML_SC_TYPE_BREAKBEFORE, CTF_SC_ROWBREAKBEFORE),
132 MAP( "OptimalHeight", XML_NAMESPACE_STYLE, XML_USE_OPTIMAL_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_BOOL, CTF_SC_ROWOPTIMALHEIGHT),
133 MAP_END()
136 const XMLPropertyMapEntry aXMLScRowStylesProperties[] =
138 MAP( "Height", XML_NAMESPACE_STYLE, XML_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_MEASURE, CTF_SC_ROWHEIGHT),
139 MAP( "IsManualPageBreak", XML_NAMESPACE_FO, XML_BREAK_BEFORE, XML_TYPE_PROP_TABLE_ROW|XML_SC_TYPE_BREAKBEFORE, CTF_SC_ROWBREAKBEFORE),
140 MAP( "OptimalHeight", XML_NAMESPACE_STYLE, XML_USE_OPTIMAL_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_BOOL, CTF_SC_ROWOPTIMALHEIGHT),
141 MAP_END()
144 const XMLPropertyMapEntry aXMLScFromXLSRowStylesProperties[] =
146 MAP( "Height", XML_NAMESPACE_STYLE, XML_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_MEASURE, CTF_SC_ROWHEIGHT),
147 MAP( "IsManualPageBreak", XML_NAMESPACE_FO, XML_BREAK_BEFORE, XML_TYPE_PROP_TABLE_ROW|XML_SC_TYPE_BREAKBEFORE, CTF_SC_ROWBREAKBEFORE),
148 MAP( "OptimalHeight", XML_NAMESPACE_STYLE, XML_USE_OPTIMAL_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_BOOL_FALSE, CTF_SC_ROWOPTIMALHEIGHT),
149 MAP_END()
152 const XMLPropertyMapEntry aXMLScTableStylesImportProperties[] =
154 // #i57869# Include background color (CellBackColor/IsCellBackgroundTransparent) for import only.
155 // Import and export should use the same map, with MID_FLAG_NO_PROPERTY_EXPORT for the background entries,
156 // but this doesn't work at the moment because SvXMLImportPropertyMapper compares MID_FLAG_NO_PROPERTY to 0.
157 // If this is changed (not for 2.0.x), a single map can be used again.
159 MAP( "CellBackColor", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
160 MAP( "IsCellBackgroundTransparent", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_ISTRANSPARENT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
161 MAP( "IsVisible", XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TYPE_PROP_TABLE|XML_TYPE_BOOL, 0 ),
162 MAP( "PageStyle", XML_NAMESPACE_STYLE, XML_MASTER_PAGE_NAME, XML_TYPE_PROP_TABLE|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_MASTERPAGENAME ),
163 MAP( "TableLayout", XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_TYPE_PROP_TABLE|XML_TYPE_TEXT_WRITING_MODE, 0 ),
164 MAP( "TabColor", XML_NAMESPACE_TABLE, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
165 MAP_EXT( "TabColor", XML_NAMESPACE_TABLE_EXT, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
166 MAP_END()
169 const XMLPropertyMapEntry aXMLScTableStylesProperties[] =
171 MAP( "IsVisible", XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TYPE_PROP_TABLE|XML_TYPE_BOOL, 0 ),
172 MAP( "PageStyle", XML_NAMESPACE_STYLE, XML_MASTER_PAGE_NAME, XML_TYPE_PROP_TABLE|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_MASTERPAGENAME ),
173 MAP( "TableLayout", XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_TYPE_PROP_TABLE|XML_TYPE_TEXT_WRITING_MODE, 0 ),
174 MAP_EXT( "TabColor", XML_NAMESPACE_TABLE_EXT, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
175 MAP_END()
178 ScXMLCellExportPropertyMapper::ScXMLCellExportPropertyMapper(
179 const rtl::Reference< XMLPropertySetMapper >& rMapper )
180 : SvXMLExportPropertyMapper(rMapper)
184 ScXMLCellExportPropertyMapper::~ScXMLCellExportPropertyMapper()
188 void ScXMLCellExportPropertyMapper::ContextFilter(
189 bool bEnableFoFontFamily,
190 ::std::vector< XMLPropertyState >& rProperties,
191 const uno::Reference< beans::XPropertySet >& rPropSet ) const
193 XMLPropertyState* pPadding = nullptr;
194 XMLPropertyState* pPadding_Bottom = nullptr;
195 XMLPropertyState* pPadding_Left = nullptr;
196 XMLPropertyState* pPadding_Right = nullptr;
197 XMLPropertyState* pPadding_Top = nullptr;
199 XMLPropertyState* pBorder = nullptr;
200 XMLPropertyState* pBorder_Bottom = nullptr;
201 XMLPropertyState* pBorder_Left = nullptr;
202 XMLPropertyState* pBorder_Right = nullptr;
203 XMLPropertyState* pBorder_Top = nullptr;
204 XMLPropertyState* pSWBorder = nullptr;
205 XMLPropertyState* pSWBorder_Bottom = nullptr;
206 XMLPropertyState* pSWBorder_Left = nullptr;
207 XMLPropertyState* pSWBorder_Right = nullptr;
208 XMLPropertyState* pSWBorder_Top = nullptr;
210 XMLPropertyState* pAllBorderWidthState = nullptr;
211 XMLPropertyState* pLeftBorderWidthState = nullptr;
212 XMLPropertyState* pRightBorderWidthState = nullptr;
213 XMLPropertyState* pTopBorderWidthState = nullptr;
214 XMLPropertyState* pBottomBorderWidthState = nullptr;
215 XMLPropertyState* pSWAllBorderWidthState = nullptr;
216 XMLPropertyState* pSWLeftBorderWidthState = nullptr;
217 XMLPropertyState* pSWRightBorderWidthState = nullptr;
218 XMLPropertyState* pSWTopBorderWidthState = nullptr;
219 XMLPropertyState* pSWBottomBorderWidthState = nullptr;
220 XMLPropertyState* pDiagonalTLBRWidthState = nullptr;
221 XMLPropertyState* pDiagonalBLTRWidthState = nullptr;
223 XMLPropertyState* pParaMarginLeft = nullptr;
224 XMLPropertyState* pParaMarginLeftRel = nullptr;
225 XMLPropertyState* pParaMarginRight = nullptr;
226 XMLPropertyState* pParaMarginRightRel = nullptr;
227 XMLPropertyState* pParaMarginTop = nullptr;
228 XMLPropertyState* pParaMarginTopRel = nullptr;
229 XMLPropertyState* pParaMarginBottom = nullptr;
230 XMLPropertyState* pParaMarginBottomRel = nullptr;
232 XMLPropertyState* pParaAdjust = nullptr;
233 XMLPropertyState* pParaAdjustLast = nullptr;
235 for( auto& rProperty : rProperties )
237 XMLPropertyState* propertyState = &rProperty;
238 if (propertyState->mnIndex != -1)
240 switch( getPropertySetMapper()->GetEntryContextId( propertyState->mnIndex ) )
242 case CTF_SC_ALLPADDING: pPadding = propertyState; break;
243 case CTF_SC_BOTTOMPADDING: pPadding_Bottom = propertyState; break;
244 case CTF_SC_LEFTPADDING: pPadding_Left = propertyState; break;
245 case CTF_SC_RIGHTPADDING: pPadding_Right = propertyState; break;
246 case CTF_SC_TOPPADDING: pPadding_Top = propertyState; break;
247 case CTF_SC_ALLBORDER: pBorder = propertyState; break;
248 case CTF_SC_LEFTBORDER: pBorder_Left = propertyState; break;
249 case CTF_SC_RIGHTBORDER: pBorder_Right = propertyState; break;
250 case CTF_SC_BOTTOMBORDER: pBorder_Bottom = propertyState; break;
251 case CTF_SC_TOPBORDER: pBorder_Top = propertyState; break;
252 case CTF_SC_ALLBORDERWIDTH: pAllBorderWidthState = propertyState; break;
253 case CTF_SC_LEFTBORDERWIDTH: pLeftBorderWidthState = propertyState; break;
254 case CTF_SC_RIGHTBORDERWIDTH: pRightBorderWidthState = propertyState; break;
255 case CTF_SC_TOPBORDERWIDTH: pTopBorderWidthState = propertyState; break;
256 case CTF_SC_BOTTOMBORDERWIDTH: pBottomBorderWidthState = propertyState; break;
257 case CTF_ALLBORDER: pSWBorder = propertyState; break;
258 case CTF_LEFTBORDER: pSWBorder_Left = propertyState; break;
259 case CTF_RIGHTBORDER: pSWBorder_Right = propertyState; break;
260 case CTF_BOTTOMBORDER: pSWBorder_Bottom = propertyState; break;
261 case CTF_TOPBORDER: pSWBorder_Top = propertyState; break;
262 case CTF_ALLBORDERWIDTH: pSWAllBorderWidthState = propertyState; break;
263 case CTF_LEFTBORDERWIDTH: pSWLeftBorderWidthState = propertyState; break;
264 case CTF_RIGHTBORDERWIDTH: pSWRightBorderWidthState = propertyState; break;
265 case CTF_TOPBORDERWIDTH: pSWTopBorderWidthState = propertyState; break;
266 case CTF_BOTTOMBORDERWIDTH: pSWBottomBorderWidthState = propertyState; break;
267 case CTF_SC_DIAGONALTLBR: break; //old diagonal line attribute names without "s" are only read, not written
268 case CTF_SC_DIAGONALTLBRWIDTH: pDiagonalTLBRWidthState = propertyState; break;
269 case CTF_SC_DIAGONALBLTR: break; //old diagonal line attribute names without "s" are only read, not written
270 case CTF_SC_DIAGONALBLTRWIDTH: pDiagonalBLTRWidthState = propertyState; break;
271 case CTF_SD_SHAPE_PARA_ADJUST: pParaAdjust = propertyState; break;
272 case CTF_PARA_ADJUSTLAST: pParaAdjustLast = propertyState; break;
273 case CTF_PARALEFTMARGIN: pParaMarginLeft = propertyState; break;
274 case CTF_PARALEFTMARGIN_REL: pParaMarginLeftRel = propertyState; break;
275 case CTF_PARARIGHTMARGIN: pParaMarginRight = propertyState; break;
276 case CTF_PARARIGHTMARGIN_REL: pParaMarginRightRel = propertyState; break;
277 case CTF_PARATOPMARGIN: pParaMarginTop = propertyState; break;
278 case CTF_PARATOPMARGIN_REL: pParaMarginTopRel = propertyState; break;
279 case CTF_PARABOTTOMMARGIN: pParaMarginBottom = propertyState; break;
280 case CTF_PARABOTTOMMARGIN_REL: pParaMarginBottomRel = propertyState; break;
285 if (pPadding && pPadding_Bottom && pPadding_Left && pPadding_Right && pPadding_Top)
287 sal_Int32 nBottom = 0, nTop = 0, nLeft = 0, nRight = 0;
288 if ((pPadding_Bottom->maValue >>= nBottom) &&
289 (pPadding_Left->maValue >>= nLeft) &&
290 (pPadding_Right->maValue >>= nRight) &&
291 (pPadding_Top->maValue >>= nTop))
293 if ((nBottom == nTop) && (nLeft == nRight) && (nTop == nLeft))
295 pPadding_Bottom->mnIndex = -1;
296 pPadding_Bottom->maValue.clear();
297 pPadding_Left->mnIndex = -1;
298 pPadding_Left->maValue.clear();
299 pPadding_Right->mnIndex = -1;
300 pPadding_Right->maValue.clear();
301 pPadding_Top->mnIndex = -1;
302 pPadding_Top->maValue.clear();
304 else
306 pPadding->mnIndex = -1;
307 pPadding->maValue.clear();
311 if( pBorder )
313 if( pBorder_Left && pBorder_Right && pBorder_Top && pBorder_Bottom )
315 table::BorderLine2 aLeft, aRight, aTop, aBottom;
317 pBorder_Left->maValue >>= aLeft;
318 pBorder_Right->maValue >>= aRight;
319 pBorder_Top->maValue >>= aTop;
320 pBorder_Bottom->maValue >>= aBottom;
321 if( aLeft.Color == aRight.Color && aLeft.InnerLineWidth == aRight.InnerLineWidth &&
322 aLeft.OuterLineWidth == aRight.OuterLineWidth && aLeft.LineDistance == aRight.LineDistance &&
323 aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth &&
324 aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance &&
325 aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth &&
326 aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance &&
327 aLeft.LineStyle == aRight.LineStyle && aLeft.LineStyle == aTop.LineStyle &&
328 aLeft.LineStyle == aBottom.LineStyle && aLeft.LineWidth == aRight.LineWidth &&
329 aLeft.LineWidth == aTop.LineWidth && aLeft.LineWidth == aBottom.LineWidth )
331 pBorder_Left->mnIndex = -1;
332 pBorder_Left->maValue.clear();
333 pBorder_Right->mnIndex = -1;
334 pBorder_Right->maValue.clear();
335 pBorder_Top->mnIndex = -1;
336 pBorder_Top->maValue.clear();
337 pBorder_Bottom->mnIndex = -1;
338 pBorder_Bottom->maValue.clear();
340 else
342 pBorder->mnIndex = -1;
343 pBorder->maValue.clear();
346 else
348 pBorder->mnIndex = -1;
349 pBorder->maValue.clear();
352 if( pAllBorderWidthState )
354 if( pLeftBorderWidthState && pRightBorderWidthState && pTopBorderWidthState && pBottomBorderWidthState )
356 table::BorderLine2 aLeft, aRight, aTop, aBottom;
358 pLeftBorderWidthState->maValue >>= aLeft;
359 pRightBorderWidthState->maValue >>= aRight;
360 pTopBorderWidthState->maValue >>= aTop;
361 pBottomBorderWidthState->maValue >>= aBottom;
362 if( aLeft.InnerLineWidth == aRight.InnerLineWidth && aLeft.OuterLineWidth == aRight.OuterLineWidth &&
363 aLeft.LineDistance == aRight.LineDistance && aLeft.InnerLineWidth == aTop.InnerLineWidth &&
364 aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance &&
365 aLeft.InnerLineWidth == aBottom.InnerLineWidth && aLeft.OuterLineWidth == aBottom.OuterLineWidth &&
366 aLeft.LineDistance == aBottom.LineDistance && aLeft.LineWidth == aRight.LineWidth &&
367 aLeft.LineWidth == aTop.LineWidth && aLeft.LineWidth == aBottom.LineWidth )
369 pLeftBorderWidthState->mnIndex = -1;
370 pLeftBorderWidthState->maValue.clear();
371 pRightBorderWidthState->mnIndex = -1;
372 pRightBorderWidthState->maValue.clear();
373 pTopBorderWidthState->mnIndex = -1;
374 pTopBorderWidthState->maValue.clear();
375 pBottomBorderWidthState->mnIndex = -1;
376 pBottomBorderWidthState->maValue.clear();
378 else
380 pAllBorderWidthState->mnIndex = -1;
381 pAllBorderWidthState->maValue.clear();
384 else
386 pAllBorderWidthState->mnIndex = -1;
387 pAllBorderWidthState->maValue.clear();
391 if (pParaAdjust)
393 pParaAdjust->mnIndex = -1;
394 pParaAdjust->maValue.clear();
396 if (pParaAdjustLast)
398 pParaAdjustLast->mnIndex = -1;
399 pParaAdjustLast->maValue.clear();
401 if (pSWBorder)
403 pSWBorder->mnIndex = -1;
404 pSWBorder->maValue.clear();
406 if (pSWBorder_Left)
408 pSWBorder_Left->mnIndex = -1;
409 pSWBorder_Left->maValue.clear();
411 if (pSWBorder_Right)
413 pSWBorder_Right->mnIndex = -1;
414 pSWBorder_Right->maValue.clear();
416 if (pSWBorder_Bottom)
418 pSWBorder_Bottom->mnIndex = -1;
419 pSWBorder_Bottom->maValue.clear();
421 if (pSWBorder_Top)
423 pSWBorder_Top->mnIndex = -1;
424 pSWBorder_Top->maValue.clear();
426 if (pSWAllBorderWidthState)
428 pSWAllBorderWidthState->mnIndex = -1;
429 pSWAllBorderWidthState->maValue.clear();
431 if (pSWLeftBorderWidthState)
433 pSWLeftBorderWidthState->mnIndex = -1;
434 pSWLeftBorderWidthState->maValue.clear();
436 if (pSWRightBorderWidthState)
438 pSWRightBorderWidthState->mnIndex = -1;
439 pSWRightBorderWidthState->maValue.clear();
441 if (pSWTopBorderWidthState)
443 pSWTopBorderWidthState->mnIndex = -1;
444 pSWTopBorderWidthState->maValue.clear();
446 if (pSWBottomBorderWidthState)
448 pSWBottomBorderWidthState->mnIndex = -1;
449 pSWBottomBorderWidthState->maValue.clear();
452 if (pParaMarginLeft)
454 pParaMarginLeft->mnIndex = -1;
455 pParaMarginLeft->maValue.clear();
457 if (pParaMarginLeftRel)
459 pParaMarginLeftRel->mnIndex = -1;
460 pParaMarginLeftRel->maValue.clear();
462 if (pParaMarginRight)
464 pParaMarginRight->mnIndex = -1;
465 pParaMarginRight->maValue.clear();
467 if (pParaMarginRightRel)
469 pParaMarginRightRel->mnIndex = -1;
470 pParaMarginRightRel->maValue.clear();
472 if (pParaMarginTop)
474 pParaMarginTop->mnIndex = -1;
475 pParaMarginTop->maValue.clear();
477 if (pParaMarginTopRel)
479 pParaMarginTopRel->mnIndex = -1;
480 pParaMarginTopRel->maValue.clear();
482 if (pParaMarginBottom)
484 pParaMarginBottom->mnIndex = -1;
485 pParaMarginBottom->maValue.clear();
487 if (pParaMarginBottomRel)
489 pParaMarginBottomRel->mnIndex = -1;
490 pParaMarginBottomRel->maValue.clear();
493 // #i102690# old diagonal line attribute names without "s" are only read, not written
494 if (pDiagonalTLBRWidthState)
496 pDiagonalTLBRWidthState->mnIndex = -1;
497 pDiagonalTLBRWidthState->maValue.clear();
499 if (pDiagonalBLTRWidthState)
501 pDiagonalBLTRWidthState->mnIndex = -1;
502 pDiagonalBLTRWidthState->maValue.clear();
505 SvXMLExportPropertyMapper::ContextFilter(bEnableFoFontFamily, rProperties, rPropSet);
508 /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
509 void ScXMLCellExportPropertyMapper::handleSpecialItem(
510 SvXMLAttributeList& /* rAttrList */,
511 const XMLPropertyState& /* rProperty */,
512 const SvXMLUnitConverter& /* rUnitConverter */,
513 const SvXMLNamespaceMap& /* rNamespaceMap */,
514 const ::std::vector< XMLPropertyState > * /* pProperties */,
515 sal_uInt32 /* nIdx */ ) const
517 // the SpecialItem NumberFormat must not be handled by this method
518 // the SpecialItem ConditionlaFormat must not be handled by this method
519 // the SpecialItem CharBackColor must not be handled by this method
521 void ScXMLCellExportPropertyMapper::handleElementItem(
522 SvXMLExport& rExport,
523 const XMLPropertyState& rProperty,
524 SvXmlExportFlags /* nFlags */,
525 const ::std::vector< XMLPropertyState > * /* pProperties */,
526 sal_uInt32 /* nIdx */) const
528 sal_uInt32 nContextId = getPropertySetMapper()->GetEntryContextId( rProperty.mnIndex );
529 OUString sURL;
530 if ( ( nContextId == CTF_SC_HYPERLINK ) &&
531 ( rProperty.maValue >>= sURL ) &&
532 !sURL.isEmpty() )
534 rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sURL );
535 rExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE,
536 XML_SIMPLE );
537 sal_uInt32 nPropIndex = rProperty.mnIndex;
538 sal_uInt16 nPrefix = getPropertySetMapper()->GetEntryNameSpace( nPropIndex );
539 OUString sLocalName = getPropertySetMapper()->GetEntryXMLName( nPropIndex );
540 SvXMLElementExport aElem( rExport, nPrefix, sLocalName, true, true );
544 ScXMLRowExportPropertyMapper::ScXMLRowExportPropertyMapper(
545 const rtl::Reference< XMLPropertySetMapper >& rMapper )
546 : SvXMLExportPropertyMapper(rMapper)
550 ScXMLRowExportPropertyMapper::~ScXMLRowExportPropertyMapper()
554 void ScXMLRowExportPropertyMapper::ContextFilter(
555 bool /* bEnableFoFontFamily */,
556 ::std::vector< XMLPropertyState >& /* rProperties */,
557 const uno::Reference< beans::XPropertySet >& /* rPropSet */ ) const
559 //#108550#; don't filter the height, so other applications know the calculated height
562 ScXMLColumnExportPropertyMapper::ScXMLColumnExportPropertyMapper(
563 const rtl::Reference< XMLPropertySetMapper >& rMapper )
564 : SvXMLExportPropertyMapper(rMapper)
568 ScXMLColumnExportPropertyMapper::~ScXMLColumnExportPropertyMapper()
572 /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
573 void ScXMLColumnExportPropertyMapper::handleSpecialItem(
574 SvXMLAttributeList& /* rAttrList */,
575 const XMLPropertyState& /* rProperty */,
576 const SvXMLUnitConverter& /* rUnitConverter */,
577 const SvXMLNamespaceMap& /* rNamespaceMap */,
578 const ::std::vector< XMLPropertyState > * /* pProperties */,
579 sal_uInt32 /* nIdx */ ) const
581 // the SpecialItem IsVisible must not be handled by this method
584 ScXMLTableExportPropertyMapper::ScXMLTableExportPropertyMapper(
585 const rtl::Reference< XMLPropertySetMapper >& rMapper )
586 : SvXMLExportPropertyMapper(rMapper)
590 ScXMLTableExportPropertyMapper::~ScXMLTableExportPropertyMapper()
594 /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
595 void ScXMLTableExportPropertyMapper::handleSpecialItem(
596 SvXMLAttributeList& /* rAttrList */,
597 const XMLPropertyState& /* rProperty */,
598 const SvXMLUnitConverter& /* rUnitConverter */,
599 const SvXMLNamespaceMap& /* rNamespaceMap */,
600 const ::std::vector< XMLPropertyState > * /* pProperties */,
601 sal_uInt32 /* nIdx */ ) const
603 // the SpecialItem PageStyle must not be handled by this method
606 void ScXMLAutoStylePoolP::exportStyleAttributes(
607 SvXMLAttributeList& rAttrList,
608 sal_Int32 nFamily,
609 const ::std::vector< XMLPropertyState >& rProperties,
610 const SvXMLExportPropertyMapper& rPropExp
611 , const SvXMLUnitConverter& rUnitConverter,
612 const SvXMLNamespaceMap& rNamespaceMap
613 ) const
615 SvXMLAutoStylePoolP::exportStyleAttributes( rAttrList, nFamily, rProperties, rPropExp, rUnitConverter, rNamespaceMap );
616 if (nFamily == XML_STYLE_FAMILY_TABLE_CELL)
618 for(const auto& rProperty : rProperties)
620 rtl::Reference< XMLPropertySetMapper > aPropMapper(rScXMLExport.GetCellStylesPropertySetMapper());
621 sal_Int16 nContextID(aPropMapper->GetEntryContextId(rProperty.mnIndex));
622 switch (nContextID)
624 case CTF_SC_NUMBERFORMAT :
626 sal_Int32 nNumberFormat = 0;
627 if (rProperty.maValue >>= nNumberFormat)
629 OUString sAttrValue(rScXMLExport.getDataStyleName(nNumberFormat));
630 if (!sAttrValue.isEmpty())
632 GetExport().AddAttribute(
633 aPropMapper->GetEntryNameSpace(rProperty.mnIndex),
634 aPropMapper->GetEntryXMLName(rProperty.mnIndex),
635 sAttrValue );
639 break;
643 else if (nFamily == XML_STYLE_FAMILY_TABLE_TABLE)
645 for(const auto& rProperty : rProperties)
647 rtl::Reference< XMLPropertySetMapper > aPropMapper(rScXMLExport.GetTableStylesPropertySetMapper());
648 sal_Int16 nContextID(aPropMapper->GetEntryContextId(rProperty.mnIndex));
649 switch (nContextID)
651 case CTF_SC_MASTERPAGENAME :
653 OUString sName;
654 if (rProperty.maValue >>= sName)
656 GetExport().AddAttribute(
657 aPropMapper->GetEntryNameSpace(rProperty.mnIndex),
658 aPropMapper->GetEntryXMLName(rProperty.mnIndex),
659 GetExport().EncodeStyleName( sName ));
662 break;
668 void ScXMLAutoStylePoolP::exportStyleContent(
669 const css::uno::Reference< css::xml::sax::XDocumentHandler > & rHandler,
670 sal_Int32 nFamily,
671 const std::vector< XMLPropertyState >& rProperties,
672 const SvXMLExportPropertyMapper& rPropExp
673 , const SvXMLUnitConverter& rUnitConverter,
674 const SvXMLNamespaceMap& rNamespaceMap
675 ) const
677 SvXMLAutoStylePoolP::exportStyleContent( rHandler, nFamily, rProperties, rPropExp, rUnitConverter, rNamespaceMap );
678 if (nFamily == XML_STYLE_FAMILY_TABLE_CELL)
680 for(const auto& rProperty : rProperties)
682 if (rProperty.mnIndex != -1)
684 sal_Int16 nContextID = rScXMLExport.GetCellStylesPropertySetMapper()->GetEntryContextId(rProperty.mnIndex);
685 switch (nContextID)
687 case CTF_SC_MAP :
689 uno::Reference<container::XIndexAccess> xIndex( rProperty.maValue, uno::UNO_QUERY );
690 if ( xIndex.is() )
692 sal_Int32 nConditionCount(xIndex->getCount());
693 for (sal_Int32 nCondition = 0; nCondition < nConditionCount; ++nCondition)
695 uno::Reference <sheet::XSheetConditionalEntry> xSheetConditionalEntry(xIndex->getByIndex(nCondition), uno::UNO_QUERY);
696 if (xSheetConditionalEntry.is())
698 OUString sStyleName(xSheetConditionalEntry->getStyleName());
699 uno::Reference <sheet::XSheetCondition> xSheetCondition(xSheetConditionalEntry, uno::UNO_QUERY);
700 if (xSheetCondition.is())
702 sheet::ConditionOperator aOperator = xSheetCondition->getOperator();
703 if (aOperator != sheet::ConditionOperator_NONE)
705 if (aOperator == sheet::ConditionOperator_FORMULA)
707 OUString sCondition = "is-true-formula("
708 + xSheetCondition->getFormula1()
709 + ")";
710 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_CONDITION, sCondition);
711 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_APPLY_STYLE_NAME, rScXMLExport.EncodeStyleName( sStyleName ));
712 OUString sOUBaseAddress;
713 ScDocument* pDoc = rScXMLExport.GetDocument();
714 ScRangeStringConverter::GetStringFromAddress( sOUBaseAddress,
715 xSheetCondition->getSourcePosition(), pDoc, FormulaGrammar::CONV_OOO );
716 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_BASE_CELL_ADDRESS, sOUBaseAddress);
717 SvXMLElementExport aMElem(rScXMLExport, XML_NAMESPACE_STYLE, XML_MAP, true, true);
719 else
721 OUString sCondition;
722 if (aOperator == sheet::ConditionOperator_BETWEEN ||
723 aOperator == sheet::ConditionOperator_NOT_BETWEEN)
725 if (aOperator == sheet::ConditionOperator_BETWEEN)
726 sCondition = "cell-content-is-between(";
727 else
728 sCondition = "cell-content-is-not-between(";
729 sCondition += xSheetCondition->getFormula1()
730 + ","
731 + xSheetCondition->getFormula2()
732 + ")";
734 else
736 sCondition = "cell-content()";
737 switch (aOperator)
739 case sheet::ConditionOperator_LESS:
740 sCondition += "<";
741 break;
742 case sheet::ConditionOperator_GREATER:
743 sCondition += ">";
744 break;
745 case sheet::ConditionOperator_LESS_EQUAL:
746 sCondition += "<=";
747 break;
748 case sheet::ConditionOperator_GREATER_EQUAL:
749 sCondition += ">=";
750 break;
751 case sheet::ConditionOperator_EQUAL:
752 sCondition += "=";
753 break;
754 case sheet::ConditionOperator_NOT_EQUAL:
755 sCondition += "!=";
756 break;
757 default:
759 // added to avoid warnings
762 sCondition += xSheetCondition->getFormula1();
764 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_CONDITION, sCondition);
765 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_APPLY_STYLE_NAME, rScXMLExport.EncodeStyleName( sStyleName ));
766 OUString sOUBaseAddress;
767 ScRangeStringConverter::GetStringFromAddress( sOUBaseAddress,
768 xSheetCondition->getSourcePosition(), rScXMLExport.GetDocument(), FormulaGrammar::CONV_OOO );
769 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_BASE_CELL_ADDRESS, sOUBaseAddress);
770 SvXMLElementExport aMElem(rScXMLExport, XML_NAMESPACE_STYLE, XML_MAP, true, true);
778 break;
785 ScXMLAutoStylePoolP::ScXMLAutoStylePoolP(ScXMLExport& rTempScXMLExport):
786 SvXMLAutoStylePoolP(rTempScXMLExport),
787 rScXMLExport(rTempScXMLExport)
791 ScXMLAutoStylePoolP::~ScXMLAutoStylePoolP()
795 void ScXMLStyleExport::exportStyleAttributes(
796 const css::uno::Reference< css::style::XStyle > & rStyle )
798 uno::Reference< beans::XPropertySet > xPropSet( rStyle, uno::UNO_QUERY );
799 if (xPropSet.is())
801 uno::Reference< beans::XPropertySetInfo > xPropSetInfo(xPropSet->getPropertySetInfo());
802 OUString sNumberFormat("NumberFormat");
803 if( xPropSetInfo->hasPropertyByName( sNumberFormat ) )
805 uno::Reference< beans::XPropertyState > xPropState( xPropSet, uno::UNO_QUERY );
806 if( xPropState.is() && (beans::PropertyState_DIRECT_VALUE ==
807 xPropState->getPropertyState( sNumberFormat )) )
809 sal_Int32 nNumberFormat = 0;
810 if (xPropSet->getPropertyValue( sNumberFormat ) >>= nNumberFormat)
811 GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_DATA_STYLE_NAME,
812 GetExport().getDataStyleName(nNumberFormat) );
818 void ScXMLStyleExport::exportStyleContent( const css::uno::Reference<css::style::XStyle > & /* rStyle */ )
822 ScXMLStyleExport::ScXMLStyleExport(
823 SvXMLExport& rExp,
824 SvXMLAutoStylePoolP *pAutoStyleP )
825 : XMLStyleExport(rExp, pAutoStyleP)
829 ScXMLStyleExport::~ScXMLStyleExport()
833 XMLScPropHdlFactory::XMLScPropHdlFactory()
834 : XMLPropertyHandlerFactory()
838 XMLScPropHdlFactory::~XMLScPropHdlFactory()
842 const XMLPropertyHandler* XMLScPropHdlFactory::GetPropertyHandler( sal_Int32 nType ) const
844 nType &= MID_FLAG_MASK;
846 XMLPropertyHandler* pHdl(const_cast<XMLPropertyHandler*>(XMLPropertyHandlerFactory::GetPropertyHandler( nType )));
847 if(!pHdl)
849 switch(nType)
851 case XML_SC_TYPE_CELLPROTECTION :
853 pHdl = new XmlScPropHdl_CellProtection;
855 break;
856 case XML_SC_TYPE_PRINTCONTENT :
858 pHdl = new XmlScPropHdl_PrintContent;
860 break;
861 case XML_SC_TYPE_HORIJUSTIFY_METHOD:
862 case XML_SC_TYPE_VERTJUSTIFY_METHOD:
864 pHdl = new XmlScPropHdl_JustifyMethod;
866 break;
867 case XML_SC_TYPE_HORIJUSTIFY :
869 pHdl = new XmlScPropHdl_HoriJustify;
871 break;
872 case XML_SC_TYPE_HORIJUSTIFYSOURCE :
874 pHdl = new XmlScPropHdl_HoriJustifySource;
876 break;
877 case XML_SC_TYPE_HORIJUSTIFYREPEAT :
879 pHdl = new XmlScPropHdl_HoriJustifyRepeat;
881 break;
882 case XML_SC_TYPE_ORIENTATION :
884 pHdl = new XmlScPropHdl_Orientation;
886 break;
887 case XML_SC_TYPE_ROTATEANGLE :
889 pHdl = new XmlScPropHdl_RotateAngle;
891 break;
892 case XML_SC_TYPE_ROTATEREFERENCE :
894 pHdl = new XmlScPropHdl_RotateReference;
896 break;
897 case XML_SC_TYPE_VERTJUSTIFY :
899 pHdl = new XmlScPropHdl_VertJustify;
901 break;
902 case XML_SC_TYPE_BREAKBEFORE :
904 pHdl = new XmlScPropHdl_BreakBefore;
906 break;
907 case XML_SC_ISTEXTWRAPPED :
909 pHdl = new XmlScPropHdl_IsTextWrapped;
911 break;
912 case XML_SC_TYPE_EQUAL :
914 pHdl = new XmlScPropHdl_IsEqual;
916 break;
917 case XML_SC_TYPE_VERTICAL :
919 pHdl = new XmlScPropHdl_Vertical;
921 break;
924 if(pHdl)
925 PutHdlCache(nType, pHdl);
928 return pHdl;
931 XmlScPropHdl_CellProtection::~XmlScPropHdl_CellProtection()
935 bool XmlScPropHdl_CellProtection::equals(
936 const css::uno::Any& r1,
937 const css::uno::Any& r2 ) const
939 util::CellProtection aCellProtection1, aCellProtection2;
941 if((r1 >>= aCellProtection1) && (r2 >>= aCellProtection2))
943 return ((aCellProtection1.IsHidden == aCellProtection2.IsHidden) &&
944 (aCellProtection1.IsLocked == aCellProtection2.IsLocked) &&
945 (aCellProtection1.IsFormulaHidden == aCellProtection2.IsFormulaHidden));
947 return false;
950 bool XmlScPropHdl_CellProtection::importXML(
951 const OUString& rStrImpValue,
952 css::uno::Any& rValue,
953 const SvXMLUnitConverter& /* rUnitConverter */ ) const
955 bool bRetval(false);
957 util::CellProtection aCellProtection;
958 bool bDefault(false);
959 if (!rValue.hasValue())
961 aCellProtection.IsHidden = false;
962 aCellProtection.IsLocked = true;
963 aCellProtection.IsFormulaHidden = false;
964 aCellProtection.IsPrintHidden = false;
965 bDefault = true;
967 if ((rValue >>= aCellProtection) || bDefault)
969 if (IsXMLToken(rStrImpValue, XML_NONE))
971 aCellProtection.IsFormulaHidden = false;
972 aCellProtection.IsHidden = false;
973 aCellProtection.IsLocked = false;
974 rValue <<= aCellProtection;
975 bRetval = true;
977 else if (IsXMLToken(rStrImpValue, XML_HIDDEN_AND_PROTECTED))
979 aCellProtection.IsFormulaHidden = true;
980 aCellProtection.IsHidden = true;
981 aCellProtection.IsLocked = true;
982 rValue <<= aCellProtection;
983 bRetval = true;
985 else if (IsXMLToken(rStrImpValue, XML_PROTECTED))
987 aCellProtection.IsFormulaHidden = false;
988 aCellProtection.IsHidden = false;
989 aCellProtection.IsLocked = true;
990 rValue <<= aCellProtection;
991 bRetval = true;
993 else if (IsXMLToken(rStrImpValue, XML_FORMULA_HIDDEN))
995 aCellProtection.IsFormulaHidden = true;
996 aCellProtection.IsHidden = false;
997 aCellProtection.IsLocked = false;
998 rValue <<= aCellProtection;
999 bRetval = true;
1001 else
1003 sal_Int32 i(0);
1004 while (i < rStrImpValue.getLength() && rStrImpValue[i] != ' ')
1005 ++i;
1006 OUString sFirst(rStrImpValue.copy(0, i));
1007 OUString sSecond(rStrImpValue.copy(i + 1));
1008 aCellProtection.IsFormulaHidden = false;
1009 aCellProtection.IsHidden = false;
1010 aCellProtection.IsLocked = false;
1011 if ((IsXMLToken(sFirst, XML_PROTECTED)) || (IsXMLToken(sSecond, XML_PROTECTED)))
1012 aCellProtection.IsLocked = true;
1013 if ((IsXMLToken(sFirst, XML_FORMULA_HIDDEN)) || (IsXMLToken(sSecond, XML_FORMULA_HIDDEN)))
1014 aCellProtection.IsFormulaHidden = true;
1015 rValue <<= aCellProtection;
1016 bRetval = true;
1020 return bRetval;
1023 bool XmlScPropHdl_CellProtection::exportXML(
1024 OUString& rStrExpValue,
1025 const css::uno::Any& rValue,
1026 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1028 bool bRetval(false);
1029 util::CellProtection aCellProtection;
1031 if(rValue >>= aCellProtection)
1033 if (!(aCellProtection.IsFormulaHidden || aCellProtection.IsHidden || aCellProtection.IsLocked))
1035 rStrExpValue = GetXMLToken(XML_NONE);
1036 bRetval = true;
1038 else if (aCellProtection.IsHidden)
1040 // #i105964# "Hide all" implies "Protected" in the UI, so it must be saved as "hidden-and-protected"
1041 // even if "IsLocked" is not set in the CellProtection struct.
1042 rStrExpValue = GetXMLToken(XML_HIDDEN_AND_PROTECTED);
1043 bRetval = true;
1045 else if (aCellProtection.IsLocked && !aCellProtection.IsFormulaHidden)
1047 rStrExpValue = GetXMLToken(XML_PROTECTED);
1048 bRetval = true;
1050 else if (aCellProtection.IsFormulaHidden && !aCellProtection.IsLocked)
1052 rStrExpValue = GetXMLToken(XML_FORMULA_HIDDEN);
1053 bRetval = true;
1055 else if (aCellProtection.IsFormulaHidden && aCellProtection.IsLocked)
1057 rStrExpValue = GetXMLToken(XML_PROTECTED);
1058 rStrExpValue += " ";
1059 rStrExpValue += GetXMLToken(XML_FORMULA_HIDDEN);
1060 bRetval = true;
1064 return bRetval;
1067 XmlScPropHdl_PrintContent::~XmlScPropHdl_PrintContent()
1071 bool XmlScPropHdl_PrintContent::equals(
1072 const css::uno::Any& r1,
1073 const css::uno::Any& r2 ) const
1075 util::CellProtection aCellProtection1, aCellProtection2;
1077 if((r1 >>= aCellProtection1) && (r2 >>= aCellProtection2))
1079 return (aCellProtection1.IsPrintHidden == aCellProtection2.IsPrintHidden);
1081 return false;
1084 bool XmlScPropHdl_PrintContent::importXML(
1085 const OUString& rStrImpValue,
1086 css::uno::Any& rValue,
1087 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1089 bool bRetval(false);
1090 util::CellProtection aCellProtection;
1091 bool bDefault(false);
1092 if (!rValue.hasValue())
1094 aCellProtection.IsHidden = false;
1095 aCellProtection.IsLocked = true;
1096 aCellProtection.IsFormulaHidden = false;
1097 aCellProtection.IsPrintHidden = false;
1098 bDefault = true;
1100 if ((rValue >>= aCellProtection) || bDefault)
1102 bool bValue(false);
1103 if (::sax::Converter::convertBool(bValue, rStrImpValue))
1105 aCellProtection.IsPrintHidden = !bValue;
1106 rValue <<= aCellProtection;
1107 bRetval = true;
1111 return bRetval;
1114 bool XmlScPropHdl_PrintContent::exportXML(
1115 OUString& rStrExpValue,
1116 const css::uno::Any& rValue,
1117 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1119 bool bRetval(false);
1121 util::CellProtection aCellProtection;
1122 if(rValue >>= aCellProtection)
1124 OUStringBuffer sValue;
1125 ::sax::Converter::convertBool(sValue, !aCellProtection.IsPrintHidden);
1126 rStrExpValue = sValue.makeStringAndClear();
1127 bRetval = true;
1130 return bRetval;
1133 XmlScPropHdl_JustifyMethod::~XmlScPropHdl_JustifyMethod()
1137 bool XmlScPropHdl_JustifyMethod::equals(
1138 const css::uno::Any& r1,
1139 const css::uno::Any& r2 ) const
1141 sal_Int32 nVal1(0), nVal2(0);
1143 if((r1 >>= nVal1) && (r2 >>= nVal2))
1144 return (nVal1 == nVal2);
1145 return false;
1148 bool XmlScPropHdl_JustifyMethod::importXML(
1149 const OUString& rStrImpValue,
1150 css::uno::Any& rValue,
1151 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1153 bool bRetval = false;
1155 sal_Int32 nValue = table::CellJustifyMethod::AUTO;
1156 if (IsXMLToken(rStrImpValue, XML_AUTO))
1158 nValue = table::CellJustifyMethod::AUTO;
1159 rValue <<= nValue;
1160 bRetval = true;
1162 else if (IsXMLToken(rStrImpValue, XML_DISTRIBUTE))
1164 nValue = table::CellJustifyMethod::DISTRIBUTE;
1165 rValue <<= nValue;
1166 bRetval = true;
1168 else
1169 bRetval = true;
1171 return bRetval;
1174 bool XmlScPropHdl_JustifyMethod::exportXML(
1175 OUString& rStrExpValue,
1176 const css::uno::Any& rValue,
1177 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1179 sal_Int32 nVal(0);
1180 bool bRetval = false;
1182 if (rValue >>= nVal)
1184 switch (nVal)
1186 case table::CellJustifyMethod::AUTO:
1188 rStrExpValue = GetXMLToken(XML_AUTO);
1189 bRetval = true;
1191 break;
1192 case table::CellJustifyMethod::DISTRIBUTE:
1194 rStrExpValue = GetXMLToken(XML_DISTRIBUTE);
1195 bRetval = true;
1197 break;
1198 default:
1200 // added to avoid warnings
1204 return bRetval;
1207 XmlScPropHdl_HoriJustify::~XmlScPropHdl_HoriJustify()
1211 bool XmlScPropHdl_HoriJustify::equals(
1212 const css::uno::Any& r1,
1213 const css::uno::Any& r2 ) const
1215 table::CellHoriJustify aHoriJustify1, aHoriJustify2;
1217 if((r1 >>= aHoriJustify1) && (r2 >>= aHoriJustify2))
1218 return (aHoriJustify1 == aHoriJustify2);
1219 return false;
1222 bool XmlScPropHdl_HoriJustify::importXML(
1223 const OUString& rStrImpValue,
1224 css::uno::Any& rValue,
1225 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1227 bool bRetval(false);
1229 table::CellHoriJustify nValue = table::CellHoriJustify_LEFT;
1230 rValue >>= nValue;
1231 if (nValue != table::CellHoriJustify_REPEAT)
1233 if (IsXMLToken(rStrImpValue, XML_START))
1235 nValue = table::CellHoriJustify_LEFT;
1236 rValue <<= nValue;
1237 bRetval = true;
1239 else if (IsXMLToken(rStrImpValue, XML_END))
1241 nValue = table::CellHoriJustify_RIGHT;
1242 rValue <<= nValue;
1243 bRetval = true;
1245 else if (IsXMLToken(rStrImpValue, XML_CENTER))
1247 nValue = table::CellHoriJustify_CENTER;
1248 rValue <<= nValue;
1249 bRetval = true;
1251 else if (IsXMLToken(rStrImpValue, XML_JUSTIFY))
1253 nValue = table::CellHoriJustify_BLOCK;
1254 rValue <<= nValue;
1255 bRetval = true;
1258 else
1259 bRetval = true;
1261 return bRetval;
1264 bool XmlScPropHdl_HoriJustify::exportXML(
1265 OUString& rStrExpValue,
1266 const css::uno::Any& rValue,
1267 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1269 table::CellHoriJustify nVal;
1270 bool bRetval(false);
1272 if(rValue >>= nVal)
1274 switch (nVal)
1276 case table::CellHoriJustify_REPEAT:
1277 case table::CellHoriJustify_LEFT:
1279 rStrExpValue = GetXMLToken(XML_START);
1280 bRetval = true;
1282 break;
1283 case table::CellHoriJustify_RIGHT:
1285 rStrExpValue = GetXMLToken(XML_END);
1286 bRetval = true;
1288 break;
1289 case table::CellHoriJustify_CENTER:
1291 rStrExpValue = GetXMLToken(XML_CENTER);
1292 bRetval = true;
1294 break;
1295 case table::CellHoriJustify_BLOCK:
1297 rStrExpValue = GetXMLToken(XML_JUSTIFY);
1298 bRetval = true;
1300 break;
1301 default:
1303 // added to avoid warnings
1308 return bRetval;
1311 XmlScPropHdl_HoriJustifySource::~XmlScPropHdl_HoriJustifySource()
1315 bool XmlScPropHdl_HoriJustifySource::equals(
1316 const css::uno::Any& r1,
1317 const css::uno::Any& r2 ) const
1319 table::CellHoriJustify aHoriJustify1, aHoriJustify2;
1321 if((r1 >>= aHoriJustify1) && (r2 >>= aHoriJustify2))
1322 return (aHoriJustify1 == aHoriJustify2);
1323 return false;
1326 bool XmlScPropHdl_HoriJustifySource::importXML(
1327 const OUString& rStrImpValue,
1328 css::uno::Any& rValue,
1329 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1331 bool bRetval(false);
1333 if (IsXMLToken(rStrImpValue, XML_FIX))
1335 bRetval = true;
1337 else if (IsXMLToken(rStrImpValue, XML_VALUE_TYPE))
1339 rValue <<= table::CellHoriJustify_STANDARD;
1340 bRetval = true;
1343 return bRetval;
1346 bool XmlScPropHdl_HoriJustifySource::exportXML(
1347 OUString& rStrExpValue,
1348 const css::uno::Any& rValue,
1349 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1351 table::CellHoriJustify nVal;
1352 bool bRetval(false);
1354 if(rValue >>= nVal)
1356 if (nVal == table::CellHoriJustify_STANDARD)
1358 rStrExpValue = GetXMLToken(XML_VALUE_TYPE);
1359 bRetval = true;
1361 else
1363 rStrExpValue = GetXMLToken(XML_FIX);
1364 bRetval = true;
1368 return bRetval;
1371 XmlScPropHdl_HoriJustifyRepeat::~XmlScPropHdl_HoriJustifyRepeat()
1375 bool XmlScPropHdl_HoriJustifyRepeat::equals(
1376 const css::uno::Any& r1,
1377 const css::uno::Any& r2 ) const
1379 table::CellHoriJustify aHoriJustify1, aHoriJustify2;
1381 if((r1 >>= aHoriJustify1) && (r2 >>= aHoriJustify2))
1382 return (aHoriJustify1 == aHoriJustify2);
1383 return false;
1386 bool XmlScPropHdl_HoriJustifyRepeat::importXML(
1387 const OUString& rStrImpValue,
1388 css::uno::Any& rValue,
1389 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1391 bool bRetval(false);
1393 if (IsXMLToken(rStrImpValue, XML_FALSE))
1395 bRetval = true;
1397 else if (IsXMLToken(rStrImpValue, XML_TRUE))
1399 rValue <<= table::CellHoriJustify_REPEAT;
1400 bRetval = true;
1403 return bRetval;
1406 bool XmlScPropHdl_HoriJustifyRepeat::exportXML(
1407 OUString& rStrExpValue,
1408 const css::uno::Any& rValue,
1409 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1411 table::CellHoriJustify nVal;
1412 bool bRetval(false);
1414 if(rValue >>= nVal)
1416 if (nVal == table::CellHoriJustify_REPEAT)
1418 rStrExpValue = GetXMLToken(XML_TRUE);
1419 bRetval = true;
1421 else
1423 rStrExpValue = GetXMLToken(XML_FALSE);
1424 bRetval = true;
1428 return bRetval;
1431 XmlScPropHdl_Orientation::~XmlScPropHdl_Orientation()
1435 bool XmlScPropHdl_Orientation::equals(
1436 const css::uno::Any& r1,
1437 const css::uno::Any& r2 ) const
1439 table::CellOrientation aOrientation1, aOrientation2;
1441 if((r1 >>= aOrientation1) && (r2 >>= aOrientation2))
1442 return (aOrientation1 == aOrientation2);
1443 return false;
1446 bool XmlScPropHdl_Orientation::importXML(
1447 const OUString& rStrImpValue,
1448 css::uno::Any& rValue,
1449 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1451 bool bRetval(false);
1453 table::CellOrientation nValue;
1454 if (IsXMLToken(rStrImpValue, XML_LTR))
1456 nValue = table::CellOrientation_STANDARD;
1457 rValue <<= nValue;
1458 bRetval = true;
1460 else if (IsXMLToken(rStrImpValue, XML_TTB))
1462 nValue = table::CellOrientation_STACKED;
1463 rValue <<= nValue;
1464 bRetval = true;
1467 return bRetval;
1470 bool XmlScPropHdl_Orientation::exportXML(
1471 OUString& rStrExpValue,
1472 const css::uno::Any& rValue,
1473 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1475 table::CellOrientation nVal;
1476 bool bRetval(false);
1478 if(rValue >>= nVal)
1480 switch (nVal)
1482 case table::CellOrientation_STACKED :
1484 rStrExpValue = GetXMLToken(XML_TTB);
1485 bRetval = true;
1487 break;
1488 default:
1490 rStrExpValue = GetXMLToken(XML_LTR);
1491 bRetval = true;
1493 break;
1497 return bRetval;
1500 XmlScPropHdl_RotateAngle::~XmlScPropHdl_RotateAngle()
1504 bool XmlScPropHdl_RotateAngle::equals(
1505 const css::uno::Any& r1,
1506 const css::uno::Any& r2 ) const
1508 sal_Int32 aAngle1 = 0, aAngle2 = 0;
1510 if((r1 >>= aAngle1) && (r2 >>= aAngle2))
1511 return (aAngle1 == aAngle2);
1512 return false;
1515 bool XmlScPropHdl_RotateAngle::importXML(
1516 const OUString& rStrImpValue,
1517 css::uno::Any& rValue,
1518 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1520 bool bRetval(false);
1522 sal_Int32 nValue;
1523 if (::sax::Converter::convertNumber(nValue, rStrImpValue) && !o3tl::checked_multiply<sal_Int32>(nValue, 100, nValue))
1525 rValue <<= nValue;
1526 bRetval = true;
1529 return bRetval;
1532 bool XmlScPropHdl_RotateAngle::exportXML(
1533 OUString& rStrExpValue,
1534 const css::uno::Any& rValue,
1535 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1537 sal_Int32 nVal = 0;
1538 bool bRetval(false);
1540 if(rValue >>= nVal)
1542 rStrExpValue = OUString::number(nVal / 100);
1543 bRetval = true;
1546 return bRetval;
1549 XmlScPropHdl_RotateReference::~XmlScPropHdl_RotateReference()
1553 bool XmlScPropHdl_RotateReference::equals(
1554 const css::uno::Any& r1,
1555 const css::uno::Any& r2 ) const
1557 sal_Int32 aReference1(0), aReference2(0);
1559 if((r1 >>= aReference1) && (r2 >>= aReference2))
1560 return (aReference1 == aReference2);
1561 return false;
1564 bool XmlScPropHdl_RotateReference::importXML(
1565 const OUString& rStrImpValue,
1566 css::uno::Any& rValue,
1567 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1569 bool bRetval(false);
1571 sal_Int32 nValue;
1572 if (IsXMLToken(rStrImpValue, XML_NONE))
1574 nValue = table::CellVertJustify2::STANDARD;
1575 rValue <<= nValue;
1576 bRetval = true;
1578 else if (IsXMLToken(rStrImpValue, XML_BOTTOM))
1580 nValue = table::CellVertJustify2::BOTTOM;
1581 rValue <<= nValue;
1582 bRetval = true;
1584 else if (IsXMLToken(rStrImpValue, XML_TOP))
1586 nValue = table::CellVertJustify2::TOP;
1587 rValue <<= nValue;
1588 bRetval = true;
1590 else if (IsXMLToken(rStrImpValue, XML_CENTER))
1592 nValue = table::CellVertJustify2::CENTER;
1593 rValue <<= nValue;
1594 bRetval = true;
1597 return bRetval;
1600 bool XmlScPropHdl_RotateReference::exportXML(
1601 OUString& rStrExpValue,
1602 const css::uno::Any& rValue,
1603 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1605 sal_Int32 nVal(0);
1606 bool bRetval(false);
1608 if(rValue >>= nVal)
1610 switch (nVal)
1612 case table::CellVertJustify2::BOTTOM :
1614 rStrExpValue = GetXMLToken(XML_BOTTOM);
1615 bRetval = true;
1617 break;
1618 case table::CellVertJustify2::CENTER :
1620 rStrExpValue = GetXMLToken(XML_CENTER);
1621 bRetval = true;
1623 break;
1624 case table::CellVertJustify2::STANDARD :
1626 rStrExpValue = GetXMLToken(XML_NONE);
1627 bRetval = true;
1629 break;
1630 case table::CellVertJustify2::TOP :
1632 rStrExpValue = GetXMLToken(XML_TOP);
1633 bRetval = true;
1635 break;
1636 default:
1638 // added to avoid warnings
1643 return bRetval;
1646 XmlScPropHdl_VertJustify::~XmlScPropHdl_VertJustify()
1650 bool XmlScPropHdl_VertJustify::equals(
1651 const css::uno::Any& r1,
1652 const css::uno::Any& r2 ) const
1654 sal_Int32 aReference1(0), aReference2(0);
1656 if((r1 >>= aReference1) && (r2 >>= aReference2))
1657 return (aReference1 == aReference2);
1658 return false;
1661 bool XmlScPropHdl_VertJustify::importXML(
1662 const OUString& rStrImpValue,
1663 css::uno::Any& rValue,
1664 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1666 bool bRetval(false);
1668 sal_Int32 nValue;
1669 if (IsXMLToken(rStrImpValue, XML_AUTOMATIC))
1671 nValue = table::CellVertJustify2::STANDARD;
1672 rValue <<= nValue;
1673 bRetval = true;
1675 else if (IsXMLToken(rStrImpValue, XML_BOTTOM))
1677 nValue = table::CellVertJustify2::BOTTOM;
1678 rValue <<= nValue;
1679 bRetval = true;
1681 else if (IsXMLToken(rStrImpValue, XML_TOP))
1683 nValue = table::CellVertJustify2::TOP;
1684 rValue <<= nValue;
1685 bRetval = true;
1687 else if (IsXMLToken(rStrImpValue, XML_MIDDLE))
1689 nValue = table::CellVertJustify2::CENTER;
1690 rValue <<= nValue;
1691 bRetval = true;
1693 else if (IsXMLToken(rStrImpValue, XML_JUSTIFY))
1695 nValue = table::CellVertJustify2::BLOCK;
1696 rValue <<= nValue;
1697 bRetval = true;
1700 return bRetval;
1703 bool XmlScPropHdl_VertJustify::exportXML(
1704 OUString& rStrExpValue,
1705 const css::uno::Any& rValue,
1706 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1708 sal_Int32 nVal(0);
1709 bool bRetval(false);
1711 if(rValue >>= nVal)
1713 switch (nVal)
1715 case table::CellVertJustify2::BOTTOM :
1717 rStrExpValue = GetXMLToken(XML_BOTTOM);
1718 bRetval = true;
1720 break;
1721 case table::CellVertJustify2::CENTER :
1723 rStrExpValue = GetXMLToken(XML_MIDDLE);
1724 bRetval = true;
1726 break;
1727 case table::CellVertJustify2::STANDARD :
1729 rStrExpValue = GetXMLToken(XML_AUTOMATIC);
1730 bRetval = true;
1732 break;
1733 case table::CellVertJustify2::TOP :
1735 rStrExpValue = GetXMLToken(XML_TOP);
1736 bRetval = true;
1738 break;
1739 case table::CellVertJustify2::BLOCK :
1741 rStrExpValue = GetXMLToken(XML_JUSTIFY);
1742 bRetval = true;
1744 break;
1745 default:
1747 // added to avoid warnings
1752 return bRetval;
1755 XmlScPropHdl_BreakBefore::~XmlScPropHdl_BreakBefore()
1759 bool XmlScPropHdl_BreakBefore::equals(
1760 const css::uno::Any& r1,
1761 const css::uno::Any& r2 ) const
1763 bool aBreak1 = false, aBreak2 = false;
1765 if((r1 >>= aBreak1) && (r2 >>= aBreak2))
1766 return (aBreak1 == aBreak2);
1767 return false;
1770 bool XmlScPropHdl_BreakBefore::importXML(
1771 const OUString& rStrImpValue,
1772 css::uno::Any& rValue,
1773 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1775 bool bRetval(false);
1777 bool bValue;
1778 if (IsXMLToken(rStrImpValue, XML_AUTO))
1780 bValue = false;
1781 rValue <<= bValue;
1782 bRetval = true;
1784 else if (IsXMLToken(rStrImpValue, XML_PAGE))
1786 bValue = true;
1787 rValue <<= bValue;
1788 bRetval = true;
1791 return bRetval;
1794 bool XmlScPropHdl_BreakBefore::exportXML(
1795 OUString& rStrExpValue,
1796 const css::uno::Any& rValue,
1797 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1799 bool bRetval(false);
1801 if(::cppu::any2bool(rValue))
1803 rStrExpValue = GetXMLToken(XML_PAGE);
1804 bRetval = true;
1806 else
1808 rStrExpValue = GetXMLToken(XML_AUTO);
1809 bRetval = true;
1812 return bRetval;
1815 XmlScPropHdl_IsTextWrapped::~XmlScPropHdl_IsTextWrapped()
1819 bool XmlScPropHdl_IsTextWrapped::equals(
1820 const css::uno::Any& r1,
1821 const css::uno::Any& r2 ) const
1823 return (::cppu::any2bool(r1) == ::cppu::any2bool(r2));
1826 bool XmlScPropHdl_IsTextWrapped::importXML(
1827 const OUString& rStrImpValue,
1828 css::uno::Any& rValue,
1829 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1831 bool bRetval(false);
1833 if (IsXMLToken(rStrImpValue, XML_WRAP))
1835 rValue <<= true;
1836 bRetval = true;
1838 else if (IsXMLToken(rStrImpValue, XML_NO_WRAP))
1840 rValue <<= false;
1841 bRetval = true;
1844 return bRetval;
1847 bool XmlScPropHdl_IsTextWrapped::exportXML(
1848 OUString& rStrExpValue,
1849 const css::uno::Any& rValue,
1850 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1852 bool bRetval(false);
1854 if (::cppu::any2bool(rValue))
1856 rStrExpValue = GetXMLToken(XML_WRAP);
1857 bRetval = true;
1859 else
1861 rStrExpValue = GetXMLToken(XML_NO_WRAP);
1862 bRetval = true;
1865 return bRetval;
1868 bool XmlScPropHdl_IsEqual::importXML( const OUString& /* rStrImpValue */,
1869 css::uno::Any& /* rValue */,
1870 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1872 OSL_FAIL("should never be called");
1873 return false;
1876 bool XmlScPropHdl_IsEqual::exportXML( OUString& /* rStrExpValue */,
1877 const css::uno::Any& /* rValue */,
1878 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1880 OSL_FAIL("should never be called");
1881 return false;
1884 XmlScPropHdl_Vertical::~XmlScPropHdl_Vertical()
1888 bool XmlScPropHdl_Vertical::equals(
1889 const css::uno::Any& r1,
1890 const css::uno::Any& r2 ) const
1892 return (::cppu::any2bool(r1) == ::cppu::any2bool(r2));
1895 bool XmlScPropHdl_Vertical::importXML(
1896 const OUString& rStrImpValue,
1897 css::uno::Any& rValue,
1898 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1900 bool bRetval(false);
1902 if (IsXMLToken(rStrImpValue, XML_AUTO))
1904 rValue <<= true;
1905 bRetval = true;
1907 else if (IsXMLToken(rStrImpValue, XML_0))
1909 rValue <<= false;
1910 bRetval = true;
1913 return bRetval;
1916 bool XmlScPropHdl_Vertical::exportXML(
1917 OUString& rStrExpValue,
1918 const css::uno::Any& rValue,
1919 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1921 bool bRetval(false);
1923 if (::cppu::any2bool(rValue))
1925 rStrExpValue = GetXMLToken(XML_AUTO);
1926 bRetval = true;
1928 else
1930 rStrExpValue = GetXMLToken(XML_0);
1931 bRetval = true;
1934 return bRetval;
1937 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */