Update ooo320-m1
[ooovba.git] / sc / source / filter / xml / xmlstyle.cxx
blob5a44499481ca6fbe3457d5031b472779969adf99
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmlstyle.cxx,v $
10 * $Revision: 1.70.62.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
35 #include "xmlstyle.hxx"
36 #include "xmlexprt.hxx"
37 #include "xmlimprt.hxx"
39 #include "XMLConverter.hxx"
40 #include "rangeutl.hxx"
42 #include <xmloff/xmlnmspe.hxx>
43 #include <xmloff/xmluconv.hxx>
44 #include <xmloff/xmltypes.hxx>
45 #include <xmloff/families.hxx>
46 #include <xmloff/xmlnumfe.hxx>
47 #include <xmloff/xmlnumfi.hxx>
48 #include <xmloff/nmspmap.hxx>
49 #include <xmloff/attrlist.hxx>
50 #include <xmloff/contextid.hxx>
51 #include <xmloff/txtprmap.hxx>
52 #include <tools/debug.hxx>
53 #include <com/sun/star/util/CellProtection.hpp>
54 #include <com/sun/star/table/CellOrientation.hpp>
55 #include <com/sun/star/table/CellVertJustify.hpp>
56 #include <com/sun/star/table/CellHoriJustify.hpp>
57 #include <com/sun/star/table/TableBorder.hpp>
58 #include <com/sun/star/sheet/XSheetConditionalEntries.hpp>
59 #include <com/sun/star/sheet/XSheetConditionalEntry.hpp>
60 #include <com/sun/star/sheet/XSheetCondition.hpp>
61 #include <com/sun/star/beans/XPropertyState.hpp>
62 #include <comphelper/extract.hxx>
64 #include <rtl/ustrbuf.hxx>
66 using namespace com::sun::star;
67 using namespace ::xmloff::token;
68 using namespace ::formula;
69 using ::rtl::OUString;
71 #define MAP(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFVER_010 }
72 #define MAP_END() { NULL, 0, 0, XML_TOKEN_INVALID, 0, 0, SvtSaveOptions::ODFVER_010 }
74 const XMLPropertyMapEntry aXMLScCellStylesProperties[] =
76 MAP( "AsianVerticalMode", XML_NAMESPACE_STYLE, XML_GLYPH_ORIENTATION_VERTICAL, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_VERTICAL, 0),
77 MAP( "BottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_BOTTOMBORDER ),
78 MAP( "BottomBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_BOTTOMBORDERWIDTH ),
79 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 ),
80 MAP( "CellProtection", XML_NAMESPACE_STYLE, XML_CELL_PROTECT, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_CELLPROTECTION|MID_FLAG_MERGE_PROPERTY, 0 ),
81 MAP( "CellProtection", XML_NAMESPACE_STYLE, XML_PRINT_CONTENT, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_PRINTCONTENT|MID_FLAG_MERGE_PROPERTY, 0 ),
82 MAP( "CellStyle", XML_NAMESPACE_STYLE, XML_STYLE, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_STRING, CTF_SC_CELLSTYLE ),
83 MAP( "ConditionalFormatXML", XML_NAMESPACE_STYLE, XML_MAP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_IMPORT_MAP ),
84 MAP( "ConditionalFormatXML", XML_NAMESPACE_STYLE, XML_MAP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_MAP ),
85 MAP( "DiagonalBLTR", XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_DIAGONALBLTR ),
86 MAP( "DiagonalBLTR", XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR_WIDTH, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_DIAGONALBLTRWIDTH ),
87 MAP( "DiagonalTLBR", XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_DIAGONALTLBR ),
88 MAP( "DiagonalTLBR", XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR_WIDTH, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_DIAGONALTLBRWIDTH ),
89 MAP( "HoriJustify", XML_NAMESPACE_FO, XML_TEXT_ALIGN, XML_TYPE_PROP_PARAGRAPH|XML_SC_TYPE_HORIJUSTIFY|MID_FLAG_MERGE_PROPERTY, 0 ),
90 MAP( "HoriJustify", XML_NAMESPACE_STYLE, XML_TEXT_ALIGN_SOURCE, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_HORIJUSTIFYSOURCE|MID_FLAG_MERGE_PROPERTY, 0 ),
91 MAP( "HoriJustify", XML_NAMESPACE_STYLE, XML_REPEAT_CONTENT, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_HORIJUSTIFYREPEAT|MID_FLAG_MERGE_PROPERTY, 0 ),
92 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 ),
93 MAP( "IsTextWrapped", XML_NAMESPACE_FO, XML_WRAP_OPTION, XML_TYPE_PROP_TABLE_CELL|XML_SC_ISTEXTWRAPPED, 0 ),
94 MAP( "LeftBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_ALLBORDER ),
95 MAP( "LeftBorder", XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_LEFTBORDER ),
96 MAP( "LeftBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_ALLBORDERWIDTH ),
97 MAP( "LeftBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_LEFTBORDERWIDTH ),
98 MAP( "NumberFormat", XML_NAMESPACE_STYLE, XML_DATA_STYLE_NAME, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_NUMBER|MID_FLAG_SPECIAL_ITEM, CTF_SC_NUMBERFORMAT),
99 MAP( "Orientation", XML_NAMESPACE_STYLE, XML_DIRECTION, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_ORIENTATION, 0 ),
100 MAP( "ParaBottomMargin", XML_NAMESPACE_FO, XML_PADDING, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_ALLPADDING ),
101 MAP( "ParaBottomMargin", XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_BOTTOMPADDING ),
102 MAP( "ParaIndent", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_PROP_PARAGRAPH|XML_TYPE_MEASURE16, 0 ),
103 // MAP( "ParaIsHyphenation", XML_NAMESPACE_FO, XML_HYPHENATE, XML_TYPE_PROP_TEXT|XML_TYPE_BOOL, 0 ),
104 MAP( "ParaLeftMargin", XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_LEFTPADDING ),
105 MAP( "ParaRightMargin", XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_RIGHTPADDING ),
106 MAP( "ParaTopMargin", XML_NAMESPACE_FO, XML_PADDING_TOP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_TOPPADDING ),
107 MAP( "RightBorder", XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_RIGHTBORDER ),
108 MAP( "RightBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_RIGHTBORDERWIDTH ),
109 MAP( "RotateAngle", XML_NAMESPACE_STYLE, XML_ROTATION_ANGLE, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_ROTATEANGLE, 0 ),
110 MAP( "RotateReference", XML_NAMESPACE_STYLE, XML_ROTATION_ALIGN, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_ROTATEREFERENCE, 0),
111 MAP( "ShadowFormat", XML_NAMESPACE_STYLE, XML_SHADOW, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_TEXT_SHADOW, 0 ),
112 MAP( "ShrinkToFit", XML_NAMESPACE_STYLE, XML_SHRINK_TO_FIT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BOOL, 0 ),
113 MAP( "StandardDecimals", XML_NAMESPACE_STYLE, XML_DECIMAL_PLACES, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_NUMBER16, 0 ),
114 MAP( "TopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_TOPBORDER ),
115 MAP( "TopBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_TOPBORDERWIDTH ),
116 MAP( "UserDefinedAttributes", XML_NAMESPACE_TEXT, XML_XMLNS, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),
117 MAP( "ValidationXML", XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BUILDIN_CMP_ONLY, CTF_SC_VALIDATION ),
118 MAP( "VertJustify", XML_NAMESPACE_STYLE, XML_VERTICAL_ALIGN, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_VERTJUSTIFY, 0),
119 // MAP( "WritingMode", XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_TYPE_PROP_PARAGRAPH|XML_TYPE_TEXT_WRITING_MODE_WITH_DEFAULT, 0 ),
120 MAP_END()
123 const XMLPropertyMapEntry aXMLScColumnStylesProperties[] =
125 MAP( "IsManualPageBreak", XML_NAMESPACE_FO, XML_BREAK_BEFORE, XML_TYPE_PROP_TABLE_COLUMN|XML_SC_TYPE_BREAKBEFORE, 0),
126 MAP( "IsVisible", XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TYPE_PROP_TABLE_COLUMN|XML_SC_TYPE_EQUAL|MID_FLAG_SPECIAL_ITEM, CTF_SC_ISVISIBLE ),
127 MAP( "Width", XML_NAMESPACE_STYLE, XML_COLUMN_WIDTH, XML_TYPE_PROP_TABLE_COLUMN|XML_TYPE_MEASURE, 0 ),
128 // MAP( "OptimalWidth", XML_NAMESPACE_STYLE, XML_USE_OPTIMAL_COLUMN_WIDTH, XML_TYPE_PROP_TABLE_COLUMN|XML_TYPE_BOOL, 0),
129 MAP_END()
132 const XMLPropertyMapEntry aXMLScRowStylesImportProperties[] =
134 // #i57867# Include background color (CellBackColor/IsCellBackgroundTransparent) for import only.
135 // Import and export should use the same map, with MID_FLAG_NO_PROPERTY_EXPORT for the background entries,
136 // but this doesn't work at the moment because SvXMLImportPropertyMapper compares MID_FLAG_NO_PROPERTY to 0.
137 // If this is changed (not for 2.0.x), a single map can be used again.
139 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 ),
140 MAP( "Height", XML_NAMESPACE_STYLE, XML_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_MEASURE, CTF_SC_ROWHEIGHT),
141 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 ),
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 aXMLScRowStylesProperties[] =
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, 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_END()
170 const XMLPropertyMapEntry aXMLScTableStylesProperties[] =
172 MAP( "IsVisible", XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TYPE_PROP_TABLE|XML_TYPE_BOOL, 0 ),
173 MAP( "PageStyle", XML_NAMESPACE_STYLE, XML_MASTER_PAGE_NAME, XML_TYPE_PROP_TABLE|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_MASTERPAGENAME ),
174 MAP( "TableLayout", XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_TYPE_PROP_TABLE|XML_TYPE_TEXT_WRITING_MODE, 0 ),
175 MAP_END()
178 ScXMLCellExportPropertyMapper::ScXMLCellExportPropertyMapper(
179 const UniReference< XMLPropertySetMapper >& rMapper )
180 : SvXMLExportPropertyMapper(rMapper)
184 ScXMLCellExportPropertyMapper::~ScXMLCellExportPropertyMapper()
188 void ScXMLCellExportPropertyMapper::ContextFilter(
189 ::std::vector< XMLPropertyState >& rProperties,
190 uno::Reference< beans::XPropertySet > rPropSet ) const
192 XMLPropertyState* pPadding = NULL;
193 XMLPropertyState* pPadding_Bottom = NULL;
194 XMLPropertyState* pPadding_Left = NULL;
195 XMLPropertyState* pPadding_Right = NULL;
196 XMLPropertyState* pPadding_Top = NULL;
198 XMLPropertyState* pBorder = NULL;
199 XMLPropertyState* pBorder_Bottom = NULL;
200 XMLPropertyState* pBorder_Left = NULL;
201 XMLPropertyState* pBorder_Right = NULL;
202 XMLPropertyState* pBorder_Top = NULL;
203 XMLPropertyState* pSWBorder = NULL;
204 XMLPropertyState* pSWBorder_Bottom = NULL;
205 XMLPropertyState* pSWBorder_Left = NULL;
206 XMLPropertyState* pSWBorder_Right = NULL;
207 XMLPropertyState* pSWBorder_Top = NULL;
208 XMLPropertyState* pDiagonalTLBR = NULL;
209 XMLPropertyState* pDiagonalBLTR = NULL;
211 XMLPropertyState* pAllBorderWidthState = NULL;
212 XMLPropertyState* pLeftBorderWidthState = NULL;
213 XMLPropertyState* pRightBorderWidthState = NULL;
214 XMLPropertyState* pTopBorderWidthState = NULL;
215 XMLPropertyState* pBottomBorderWidthState = NULL;
216 XMLPropertyState* pSWAllBorderWidthState = NULL;
217 XMLPropertyState* pSWLeftBorderWidthState = NULL;
218 XMLPropertyState* pSWRightBorderWidthState = NULL;
219 XMLPropertyState* pSWTopBorderWidthState = NULL;
220 XMLPropertyState* pSWBottomBorderWidthState = NULL;
221 XMLPropertyState* pDiagonalTLBRWidthState = NULL;
222 XMLPropertyState* pDiagonalBLTRWidthState = NULL;
224 XMLPropertyState* pParaMarginLeft = NULL;
225 XMLPropertyState* pParaMarginLeftRel = NULL;
226 XMLPropertyState* pParaMarginRight = NULL;
227 XMLPropertyState* pParaMarginRightRel = NULL;
228 XMLPropertyState* pParaMarginTop = NULL;
229 XMLPropertyState* pParaMarginTopRel = NULL;
230 XMLPropertyState* pParaMarginBottom = NULL;
231 XMLPropertyState* pParaMarginBottomRel = NULL;
233 XMLPropertyState* pParaAdjust = NULL;
234 XMLPropertyState* pParaAdjustLast = NULL;
236 ::std::vector< XMLPropertyState >::iterator aEndIter(rProperties.end());
237 for( ::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin();
238 aIter != aEndIter; ++aIter )
240 XMLPropertyState* propertie = &(*aIter);
241 if (propertie->mnIndex != -1)
243 switch( getPropertySetMapper()->GetEntryContextId( propertie->mnIndex ) )
245 case CTF_SC_ALLPADDING: pPadding = propertie; break;
246 case CTF_SC_BOTTOMPADDING: pPadding_Bottom = propertie; break;
247 case CTF_SC_LEFTPADDING: pPadding_Left = propertie; break;
248 case CTF_SC_RIGHTPADDING: pPadding_Right = propertie; break;
249 case CTF_SC_TOPPADDING: pPadding_Top = propertie; break;
250 case CTF_SC_ALLBORDER: pBorder = propertie; break;
251 case CTF_SC_LEFTBORDER: pBorder_Left = propertie; break;
252 case CTF_SC_RIGHTBORDER: pBorder_Right = propertie; break;
253 case CTF_SC_BOTTOMBORDER: pBorder_Bottom = propertie; break;
254 case CTF_SC_TOPBORDER: pBorder_Top = propertie; break;
255 case CTF_SC_ALLBORDERWIDTH: pAllBorderWidthState = propertie; break;
256 case CTF_SC_LEFTBORDERWIDTH: pLeftBorderWidthState = propertie; break;
257 case CTF_SC_RIGHTBORDERWIDTH: pRightBorderWidthState = propertie; break;
258 case CTF_SC_TOPBORDERWIDTH: pTopBorderWidthState = propertie; break;
259 case CTF_SC_BOTTOMBORDERWIDTH: pBottomBorderWidthState = propertie; break;
260 case CTF_ALLBORDER: pSWBorder = propertie; break;
261 case CTF_LEFTBORDER: pSWBorder_Left = propertie; break;
262 case CTF_RIGHTBORDER: pSWBorder_Right = propertie; break;
263 case CTF_BOTTOMBORDER: pSWBorder_Bottom = propertie; break;
264 case CTF_TOPBORDER: pSWBorder_Top = propertie; break;
265 case CTF_ALLBORDERWIDTH: pSWAllBorderWidthState = propertie; break;
266 case CTF_LEFTBORDERWIDTH: pSWLeftBorderWidthState = propertie; break;
267 case CTF_RIGHTBORDERWIDTH: pSWRightBorderWidthState = propertie; break;
268 case CTF_TOPBORDERWIDTH: pSWTopBorderWidthState = propertie; break;
269 case CTF_BOTTOMBORDERWIDTH: pSWBottomBorderWidthState = propertie; break;
270 case CTF_SC_DIAGONALTLBR: pDiagonalTLBR = propertie; break;
271 case CTF_SC_DIAGONALTLBRWIDTH: pDiagonalTLBRWidthState = propertie; break;
272 case CTF_SC_DIAGONALBLTR: pDiagonalBLTR = propertie; break;
273 case CTF_SC_DIAGONALBLTRWIDTH: pDiagonalBLTRWidthState = propertie; break;
274 case CTF_SD_SHAPE_PARA_ADJUST: pParaAdjust = propertie; break;
275 case CTF_PARA_ADJUSTLAST: pParaAdjustLast = propertie; break;
276 case CTF_PARALEFTMARGIN: pParaMarginLeft = propertie; break;
277 case CTF_PARALEFTMARGIN_REL: pParaMarginLeftRel = propertie; break;
278 case CTF_PARARIGHTMARGIN: pParaMarginRight = propertie; break;
279 case CTF_PARARIGHTMARGIN_REL: pParaMarginRightRel = propertie; break;
280 case CTF_PARATOPMARGIN: pParaMarginTop = propertie; break;
281 case CTF_PARATOPMARGIN_REL: pParaMarginTopRel = propertie; break;
282 case CTF_PARABOTTOMMARGIN: pParaMarginBottom = propertie; break;
283 case CTF_PARABOTTOMMARGIN_REL: pParaMarginBottomRel = propertie; break;
288 if (pPadding && pPadding_Bottom && pPadding_Left && pPadding_Right && pPadding_Top)
290 sal_Int32 nBottom = 0, nTop = 0, nLeft = 0, nRight = 0;
291 if ((pPadding_Bottom->maValue >>= nBottom) &&
292 (pPadding_Left->maValue >>= nLeft) &&
293 (pPadding_Right->maValue >>= nRight) &&
294 (pPadding_Top->maValue >>= nTop))
296 if ((nBottom == nTop) && (nLeft == nRight) && (nTop == nLeft))
298 pPadding_Bottom->mnIndex = -1;
299 pPadding_Bottom->maValue.clear();
300 pPadding_Left->mnIndex = -1;
301 pPadding_Left->maValue.clear();
302 pPadding_Right->mnIndex = -1;
303 pPadding_Right->maValue.clear();
304 pPadding_Top->mnIndex = -1;
305 pPadding_Top->maValue.clear();
307 else
309 pPadding->mnIndex = -1;
310 pPadding->maValue.clear();
314 if( pBorder )
316 if( pBorder_Left && pBorder_Right && pBorder_Top && pBorder_Bottom )
318 table::BorderLine aLeft, aRight, aTop, aBottom;
320 pBorder_Left->maValue >>= aLeft;
321 pBorder_Right->maValue >>= aRight;
322 pBorder_Top->maValue >>= aTop;
323 pBorder_Bottom->maValue >>= aBottom;
324 if( aLeft.Color == aRight.Color && aLeft.InnerLineWidth == aRight.InnerLineWidth &&
325 aLeft.OuterLineWidth == aRight.OuterLineWidth && aLeft.LineDistance == aRight.LineDistance &&
326 aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth &&
327 aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance &&
328 aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth &&
329 aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance )
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::BorderLine 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 )
368 pLeftBorderWidthState->mnIndex = -1;
369 pLeftBorderWidthState->maValue.clear();
370 pRightBorderWidthState->mnIndex = -1;
371 pRightBorderWidthState->maValue.clear();
372 pTopBorderWidthState->mnIndex = -1;
373 pTopBorderWidthState->maValue.clear();
374 pBottomBorderWidthState->mnIndex = -1;
375 pBottomBorderWidthState->maValue.clear();
377 else
379 pAllBorderWidthState->mnIndex = -1;
380 pAllBorderWidthState->maValue.clear();
383 else
385 pAllBorderWidthState->mnIndex = -1;
386 pAllBorderWidthState->maValue.clear();
390 if (pParaAdjust)
392 pParaAdjust->mnIndex = -1;
393 pParaAdjust->maValue.clear();
395 if (pParaAdjustLast)
397 pParaAdjustLast->mnIndex = -1;
398 pParaAdjustLast->maValue.clear();
400 if (pSWBorder)
402 pSWBorder->mnIndex = -1;
403 pSWBorder->maValue.clear();
405 if (pSWBorder_Left)
407 pSWBorder_Left->mnIndex = -1;
408 pSWBorder_Left->maValue.clear();
410 if (pSWBorder_Right)
412 pSWBorder_Right->mnIndex = -1;
413 pSWBorder_Right->maValue.clear();
415 if (pSWBorder_Bottom)
417 pSWBorder_Bottom->mnIndex = -1;
418 pSWBorder_Bottom->maValue.clear();
420 if (pSWBorder_Top)
422 pSWBorder_Top->mnIndex = -1;
423 pSWBorder_Top->maValue.clear();
425 if (pSWAllBorderWidthState)
427 pSWAllBorderWidthState->mnIndex = -1;
428 pSWAllBorderWidthState->maValue.clear();
430 if (pSWLeftBorderWidthState)
432 pSWLeftBorderWidthState->mnIndex = -1;
433 pSWLeftBorderWidthState->maValue.clear();
435 if (pSWRightBorderWidthState)
437 pSWRightBorderWidthState->mnIndex = -1;
438 pSWRightBorderWidthState->maValue.clear();
440 if (pSWTopBorderWidthState)
442 pSWTopBorderWidthState->mnIndex = -1;
443 pSWTopBorderWidthState->maValue.clear();
445 if (pSWBottomBorderWidthState)
447 pSWBottomBorderWidthState->mnIndex = -1;
448 pSWBottomBorderWidthState->maValue.clear();
451 if (pParaMarginLeft)
453 pParaMarginLeft->mnIndex = -1;
454 pParaMarginLeft->maValue.clear();
456 if (pParaMarginLeftRel)
458 pParaMarginLeftRel->mnIndex = -1;
459 pParaMarginLeftRel->maValue.clear();
461 if (pParaMarginRight)
463 pParaMarginRight->mnIndex = -1;
464 pParaMarginRight->maValue.clear();
466 if (pParaMarginRightRel)
468 pParaMarginRightRel->mnIndex = -1;
469 pParaMarginRightRel->maValue.clear();
471 if (pParaMarginTop)
473 pParaMarginTop->mnIndex = -1;
474 pParaMarginTop->maValue.clear();
476 if (pParaMarginTopRel)
478 pParaMarginTopRel->mnIndex = -1;
479 pParaMarginTopRel->maValue.clear();
481 if (pParaMarginBottom)
483 pParaMarginBottom->mnIndex = -1;
484 pParaMarginBottom->maValue.clear();
486 if (pParaMarginBottomRel)
488 pParaMarginBottomRel->mnIndex = -1;
489 pParaMarginBottomRel->maValue.clear();
492 SvXMLExportPropertyMapper::ContextFilter(rProperties, rPropSet);
495 /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
496 void ScXMLCellExportPropertyMapper::handleSpecialItem(
497 SvXMLAttributeList& /* rAttrList */,
498 const XMLPropertyState& /* rProperty */,
499 const SvXMLUnitConverter& /* rUnitConverter */,
500 const SvXMLNamespaceMap& /* rNamespaceMap */,
501 const ::std::vector< XMLPropertyState > * /* pProperties */,
502 sal_uInt32 /* nIdx */ ) const
504 // the SpecialItem NumberFormat must not be handled by this method
505 // the SpecialItem ConditionlaFormat must not be handled by this method
506 // the SpecialItem CharBackColor must not be handled by this method
509 ScXMLRowExportPropertyMapper::ScXMLRowExportPropertyMapper(
510 const UniReference< XMLPropertySetMapper >& rMapper )
511 : SvXMLExportPropertyMapper(rMapper)
515 ScXMLRowExportPropertyMapper::~ScXMLRowExportPropertyMapper()
519 void ScXMLRowExportPropertyMapper::ContextFilter(
520 ::std::vector< XMLPropertyState >& /* rProperties */,
521 uno::Reference< beans::XPropertySet > /* rPropSet */ ) const
523 //#108550#; don't filter the height, so other applications know the calculated height
525 /* XMLPropertyState* pHeight = NULL;
526 XMLPropertyState* pOptimalHeight = NULL;
528 for( ::std::vector< XMLPropertyState >::iterator propertie = rProperties.begin();
529 propertie != rProperties.end();
530 ++propertie )
532 switch( getPropertySetMapper()->GetEntryContextId( propertie->mnIndex ) )
534 case CTF_SC_ROWHEIGHT: pHeight = propertie; break;
535 case CTF_SC_ROWOPTIMALHEIGHT: pOptimalHeight = propertie; break;
538 if ((pHeight && pOptimalHeight && ::cppu::any2bool( pOptimalHeight->maValue )) ||
539 (pHeight && !pOptimalHeight))
541 pHeight->mnIndex = -1;
542 pHeight->maValue.clear();
544 if (pOptimalHeight)
546 pOptimalHeight->mnIndex = -1;
547 pOptimalHeight->maValue.clear();
551 ScXMLColumnExportPropertyMapper::ScXMLColumnExportPropertyMapper(
552 const UniReference< XMLPropertySetMapper >& rMapper )
553 : SvXMLExportPropertyMapper(rMapper)
557 ScXMLColumnExportPropertyMapper::~ScXMLColumnExportPropertyMapper()
561 /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
562 void ScXMLColumnExportPropertyMapper::handleSpecialItem(
563 SvXMLAttributeList& /* rAttrList */,
564 const XMLPropertyState& /* rProperty */,
565 const SvXMLUnitConverter& /* rUnitConverter */,
566 const SvXMLNamespaceMap& /* rNamespaceMap */,
567 const ::std::vector< XMLPropertyState > * /* pProperties */,
568 sal_uInt32 /* nIdx */ ) const
570 // the SpecialItem IsVisible must not be handled by this method
573 ScXMLTableExportPropertyMapper::ScXMLTableExportPropertyMapper(
574 const UniReference< XMLPropertySetMapper >& rMapper )
575 : SvXMLExportPropertyMapper(rMapper)
579 ScXMLTableExportPropertyMapper::~ScXMLTableExportPropertyMapper()
583 /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
584 void ScXMLTableExportPropertyMapper::handleSpecialItem(
585 SvXMLAttributeList& /* rAttrList */,
586 const XMLPropertyState& /* rProperty */,
587 const SvXMLUnitConverter& /* rUnitConverter */,
588 const SvXMLNamespaceMap& /* rNamespaceMap */,
589 const ::std::vector< XMLPropertyState > * /* pProperties */,
590 sal_uInt32 /* nIdx */ ) const
592 // the SpecialItem PageStyle must not be handled by this method
595 void ScXMLAutoStylePoolP::exportStyleAttributes(
596 SvXMLAttributeList& rAttrList,
597 sal_Int32 nFamily,
598 const ::std::vector< XMLPropertyState >& rProperties,
599 const SvXMLExportPropertyMapper& rPropExp
600 , const SvXMLUnitConverter& rUnitConverter,
601 const SvXMLNamespaceMap& rNamespaceMap
602 ) const
604 SvXMLAutoStylePoolP::exportStyleAttributes( rAttrList, nFamily, rProperties, rPropExp, rUnitConverter, rNamespaceMap );
605 if (nFamily == XML_STYLE_FAMILY_TABLE_CELL)
607 ::std::vector< XMLPropertyState >::const_iterator i(rProperties.begin());
608 ::std::vector< XMLPropertyState >::const_iterator endi(rProperties.end());
609 while (i != endi)
611 UniReference< XMLPropertySetMapper > aPropMapper(rScXMLExport.GetCellStylesPropertySetMapper());
612 sal_Int16 nContextID(aPropMapper->GetEntryContextId(i->mnIndex));
613 switch (nContextID)
615 case CTF_SC_NUMBERFORMAT :
617 sal_Int32 nNumberFormat = 0;
618 if (i->maValue >>= nNumberFormat)
620 rtl::OUString sAttrValue(rScXMLExport.getDataStyleName(nNumberFormat));
621 if (sAttrValue.getLength())
623 GetExport().AddAttribute(
624 aPropMapper->GetEntryNameSpace(i->mnIndex),
625 aPropMapper->GetEntryXMLName(i->mnIndex),
626 sAttrValue );
630 break;
632 ++i;
635 else if (nFamily == XML_STYLE_FAMILY_TABLE_TABLE)
637 ::std::vector< XMLPropertyState >::const_iterator i(rProperties.begin());
638 ::std::vector< XMLPropertyState >::const_iterator endi(rProperties.end());
639 while(i != endi)
641 UniReference< XMLPropertySetMapper > aPropMapper(rScXMLExport.GetTableStylesPropertySetMapper());
642 sal_Int16 nContextID(aPropMapper->GetEntryContextId(i->mnIndex));
643 switch (nContextID)
645 case CTF_SC_MASTERPAGENAME :
647 rtl::OUString sName;
648 if (i->maValue >>= sName)
650 GetExport().AddAttribute(
651 aPropMapper->GetEntryNameSpace(i->mnIndex),
652 aPropMapper->GetEntryXMLName(i->mnIndex),
653 GetExport().EncodeStyleName( sName ));
656 break;
658 ++i;
663 void ScXMLAutoStylePoolP::exportStyleContent(
664 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
665 sal_Int32 nFamily,
666 const std::vector< XMLPropertyState >& rProperties,
667 const SvXMLExportPropertyMapper& rPropExp
668 , const SvXMLUnitConverter& rUnitConverter,
669 const SvXMLNamespaceMap& rNamespaceMap
670 ) const
672 SvXMLAutoStylePoolP::exportStyleContent( rHandler, nFamily, rProperties, rPropExp, rUnitConverter, rNamespaceMap );
673 if (nFamily == XML_STYLE_FAMILY_TABLE_CELL)
675 sal_Bool bNotFound = sal_True;
676 ::std::vector< XMLPropertyState >::const_iterator i(rProperties.begin());
677 ::std::vector< XMLPropertyState >::const_iterator endi(rProperties.end());
678 while ((i != endi) && bNotFound)
680 if (i->mnIndex != -1)
682 sal_Int16 nContextID = rScXMLExport.GetCellStylesPropertySetMapper()->GetEntryContextId(i->mnIndex);
683 switch (nContextID)
685 case CTF_SC_MAP :
687 uno::Reference<container::XIndexAccess> xIndex( i->maValue, uno::UNO_QUERY );
688 if ( xIndex.is() )
690 sal_Int32 nConditionCount(xIndex->getCount());
691 for (sal_Int32 nCondition = 0; nCondition < nConditionCount; ++nCondition)
693 uno::Reference <sheet::XSheetConditionalEntry> xSheetConditionalEntry(xIndex->getByIndex(nCondition), uno::UNO_QUERY);
694 if (xSheetConditionalEntry.is())
696 rtl::OUString sStyleName(xSheetConditionalEntry->getStyleName());
697 uno::Reference <sheet::XSheetCondition> xSheetCondition(xSheetConditionalEntry, uno::UNO_QUERY);
698 if (xSheetCondition.is())
700 sheet::ConditionOperator aOperator = xSheetCondition->getOperator();
701 if (aOperator != sheet::ConditionOperator_NONE)
703 if (aOperator == sheet::ConditionOperator_FORMULA)
705 rtl::OUString sCondition(RTL_CONSTASCII_USTRINGPARAM("is-true-formula("));
706 sCondition += xSheetCondition->getFormula1();
707 sCondition += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"));
708 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_CONDITION, sCondition);
709 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_APPLY_STYLE_NAME, rScXMLExport.EncodeStyleName( sStyleName ));
710 OUString sOUBaseAddress;
711 ScDocument* pDoc = rScXMLExport.GetDocument();
712 ScRangeStringConverter::GetStringFromAddress( sOUBaseAddress,
713 xSheetCondition->getSourcePosition(), pDoc, FormulaGrammar::CONV_OOO );
714 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_BASE_CELL_ADDRESS, sOUBaseAddress);
715 SvXMLElementExport aMElem(rScXMLExport, XML_NAMESPACE_STYLE, XML_MAP, sal_True, sal_True);
717 else
719 rtl::OUString sCondition;
720 if (aOperator == sheet::ConditionOperator_BETWEEN ||
721 aOperator == sheet::ConditionOperator_NOT_BETWEEN)
723 if (aOperator == sheet::ConditionOperator_BETWEEN)
724 sCondition = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("cell-content-is-between("));
725 else
726 sCondition = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("cell-content-is-not-between("));
727 sCondition += xSheetCondition->getFormula1();
728 sCondition += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
729 sCondition += xSheetCondition->getFormula2();
730 sCondition += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"));
732 else
734 sCondition = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("cell-content()"));
735 switch (aOperator)
737 case sheet::ConditionOperator_LESS:
738 sCondition += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("<"));
739 break;
740 case sheet::ConditionOperator_GREATER:
741 sCondition += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(">"));
742 break;
743 case sheet::ConditionOperator_LESS_EQUAL:
744 sCondition += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("<="));
745 break;
746 case sheet::ConditionOperator_GREATER_EQUAL:
747 sCondition += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(">="));
748 break;
749 case sheet::ConditionOperator_EQUAL:
750 sCondition += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("="));
751 break;
752 case sheet::ConditionOperator_NOT_EQUAL:
753 sCondition += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("!="));
754 break;
755 default:
757 // added to avoid warnings
760 sCondition += xSheetCondition->getFormula1();
762 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_CONDITION, sCondition);
763 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_APPLY_STYLE_NAME, rScXMLExport.EncodeStyleName( sStyleName ));
764 OUString sOUBaseAddress;
765 ScRangeStringConverter::GetStringFromAddress( sOUBaseAddress,
766 xSheetCondition->getSourcePosition(), rScXMLExport.GetDocument(), FormulaGrammar::CONV_OOO );
767 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_BASE_CELL_ADDRESS, sOUBaseAddress);
768 SvXMLElementExport aMElem(rScXMLExport, XML_NAMESPACE_STYLE, XML_MAP, sal_True, sal_True);
776 break;
779 ++i;
784 ScXMLAutoStylePoolP::ScXMLAutoStylePoolP(ScXMLExport& rTempScXMLExport):
785 SvXMLAutoStylePoolP(rTempScXMLExport),
786 rScXMLExport(rTempScXMLExport)
790 ScXMLAutoStylePoolP::~ScXMLAutoStylePoolP()
795 void ScXMLStyleExport::exportStyleAttributes(
796 const ::com::sun::star::uno::Reference<
797 ::com::sun::star::style::XStyle > & rStyle )
799 uno::Reference< beans::XPropertySet > xPropSet( rStyle, uno::UNO_QUERY );
800 if (xPropSet.is())
802 uno::Reference< beans::XPropertySetInfo > xPropSetInfo(xPropSet->getPropertySetInfo());
803 rtl::OUString sNumberFormat(RTL_CONSTASCII_USTRINGPARAM("NumberFormat"));
804 if( xPropSetInfo->hasPropertyByName( sNumberFormat ) )
806 uno::Reference< beans::XPropertyState > xPropState( xPropSet, uno::UNO_QUERY );
807 if( xPropState.is() && (beans::PropertyState_DIRECT_VALUE ==
808 xPropState->getPropertyState( sNumberFormat )) )
810 sal_Int32 nNumberFormat = 0;
811 if (xPropSet->getPropertyValue( sNumberFormat ) >>= nNumberFormat)
812 GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_DATA_STYLE_NAME,
813 GetExport().getDataStyleName(nNumberFormat) );
819 void ScXMLStyleExport::exportStyleContent(
820 const ::com::sun::star::uno::Reference<
821 ::com::sun::star::style::XStyle > & /* rStyle */ )
825 ScXMLStyleExport::ScXMLStyleExport(
826 SvXMLExport& rExp,
827 const ::rtl::OUString& rPoolStyleName,
828 SvXMLAutoStylePoolP *pAutoStyleP )
829 : XMLStyleExport(rExp, rPoolStyleName, pAutoStyleP)
833 ScXMLStyleExport::~ScXMLStyleExport()
837 XMLScPropHdlFactory::XMLScPropHdlFactory()
838 : XMLPropertyHandlerFactory()
842 XMLScPropHdlFactory::~XMLScPropHdlFactory()
846 const XMLPropertyHandler* XMLScPropHdlFactory::GetPropertyHandler( sal_Int32 nType ) const
848 nType &= MID_FLAG_MASK;
850 XMLPropertyHandler* pHdl((XMLPropertyHandler*)XMLPropertyHandlerFactory::GetPropertyHandler( nType ));
851 if(!pHdl)
853 switch(nType)
855 case XML_SC_TYPE_CELLPROTECTION :
857 pHdl = new XmlScPropHdl_CellProtection;
859 break;
860 case XML_SC_TYPE_PRINTCONTENT :
862 pHdl = new XmlScPropHdl_PrintContent;
864 break;
865 case XML_SC_TYPE_HORIJUSTIFY :
867 pHdl = new XmlScPropHdl_HoriJustify;
869 break;
870 case XML_SC_TYPE_HORIJUSTIFYSOURCE :
872 pHdl = new XmlScPropHdl_HoriJustifySource;
874 break;
875 case XML_SC_TYPE_HORIJUSTIFYREPEAT :
877 pHdl = new XmlScPropHdl_HoriJustifyRepeat;
879 break;
880 case XML_SC_TYPE_ORIENTATION :
882 pHdl = new XmlScPropHdl_Orientation;
884 break;
885 case XML_SC_TYPE_ROTATEANGLE :
887 pHdl = new XmlScPropHdl_RotateAngle;
889 break;
890 case XML_SC_TYPE_ROTATEREFERENCE :
892 pHdl = new XmlScPropHdl_RotateReference;
894 break;
895 case XML_SC_TYPE_VERTJUSTIFY :
897 pHdl = new XmlScPropHdl_VertJustify;
899 break;
900 case XML_SC_TYPE_BREAKBEFORE :
902 pHdl = new XmlScPropHdl_BreakBefore;
904 break;
905 case XML_SC_ISTEXTWRAPPED :
907 pHdl = new XmlScPropHdl_IsTextWrapped;
909 break;
910 case XML_SC_TYPE_EQUAL :
912 pHdl = new XmlScPropHdl_IsEqual;
914 break;
915 case XML_SC_TYPE_VERTICAL :
917 pHdl = new XmlScPropHdl_Vertical;
919 break;
922 if(pHdl)
923 PutHdlCache(nType, pHdl);
926 return pHdl;
929 XmlScPropHdl_CellProtection::~XmlScPropHdl_CellProtection()
933 bool XmlScPropHdl_CellProtection::equals(
934 const ::com::sun::star::uno::Any& r1,
935 const ::com::sun::star::uno::Any& r2 ) const
937 util::CellProtection aCellProtection1, aCellProtection2;
939 if((r1 >>= aCellProtection1) && (r2 >>= aCellProtection2))
941 return ((aCellProtection1.IsHidden == aCellProtection2.IsHidden) &&
942 (aCellProtection1.IsLocked == aCellProtection2.IsLocked) &&
943 (aCellProtection1.IsFormulaHidden == aCellProtection2.IsFormulaHidden));
945 return sal_False;
948 sal_Bool XmlScPropHdl_CellProtection::importXML(
949 const ::rtl::OUString& rStrImpValue,
950 ::com::sun::star::uno::Any& rValue,
951 const SvXMLUnitConverter& /* rUnitConverter */ ) const
953 sal_Bool bRetval(sal_False);
955 util::CellProtection aCellProtection;
956 sal_Bool bDefault(sal_False);
957 if (!rValue.hasValue())
959 aCellProtection.IsHidden = sal_False;
960 aCellProtection.IsLocked = sal_True;
961 aCellProtection.IsFormulaHidden = sal_False;
962 aCellProtection.IsPrintHidden = sal_False;
963 bDefault = sal_True;
965 if ((rValue >>= aCellProtection) || bDefault)
967 if (!IsXMLToken(rStrImpValue, XML_NONE))
969 if (!IsXMLToken(rStrImpValue, XML_HIDDEN_AND_PROTECTED))
971 if (!IsXMLToken(rStrImpValue, XML_PROTECTED))
973 if (!IsXMLToken(rStrImpValue, XML_FORMULA_HIDDEN))
975 sal_Int16 i(0);
976 while (i < rStrImpValue.getLength() && rStrImpValue[i] != ' ')
977 ++i;
978 rtl::OUString sFirst(rStrImpValue.copy(0, i));
979 rtl::OUString sSecond(rStrImpValue.copy(i + 1));
980 aCellProtection.IsFormulaHidden = sal_False;
981 aCellProtection.IsHidden = sal_False;
982 aCellProtection.IsLocked = sal_False;
983 if ((IsXMLToken(sFirst, XML_PROTECTED)) || (IsXMLToken(sSecond, XML_PROTECTED)))
984 aCellProtection.IsLocked = sal_True;
985 if ((IsXMLToken(sFirst, XML_FORMULA_HIDDEN)) || (IsXMLToken(sSecond, XML_FORMULA_HIDDEN)))
986 aCellProtection.IsFormulaHidden = sal_True;
987 rValue <<= aCellProtection;
988 bRetval = sal_True;
990 else
992 aCellProtection.IsFormulaHidden = sal_True;
993 aCellProtection.IsHidden = sal_False;
994 aCellProtection.IsLocked = sal_False;
995 rValue <<= aCellProtection;
996 bRetval = sal_True;
999 else
1001 aCellProtection.IsFormulaHidden = sal_False;
1002 aCellProtection.IsHidden = sal_False;
1003 aCellProtection.IsLocked = sal_True;
1004 rValue <<= aCellProtection;
1005 bRetval = sal_True;
1008 else
1010 aCellProtection.IsFormulaHidden = sal_True;
1011 aCellProtection.IsHidden = sal_True;
1012 aCellProtection.IsLocked = sal_True;
1013 rValue <<= aCellProtection;
1014 bRetval = sal_True;
1017 else
1019 aCellProtection.IsFormulaHidden = sal_False;
1020 aCellProtection.IsHidden = sal_False;
1021 aCellProtection.IsLocked = sal_False;
1022 rValue <<= aCellProtection;
1023 bRetval = sal_True;
1027 return bRetval;
1030 sal_Bool XmlScPropHdl_CellProtection::exportXML(
1031 ::rtl::OUString& rStrExpValue,
1032 const ::com::sun::star::uno::Any& rValue,
1033 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1035 sal_Bool bRetval(sal_False);
1036 util::CellProtection aCellProtection;
1038 if(rValue >>= aCellProtection)
1040 if (!(aCellProtection.IsFormulaHidden || aCellProtection.IsHidden || aCellProtection.IsLocked))
1042 rStrExpValue = GetXMLToken(XML_NONE);
1043 bRetval = sal_True;
1045 else if (aCellProtection.IsHidden && aCellProtection.IsLocked)
1047 rStrExpValue = GetXMLToken(XML_HIDDEN_AND_PROTECTED);
1048 bRetval = sal_True;
1050 else if (aCellProtection.IsLocked && !(aCellProtection.IsFormulaHidden || aCellProtection.IsHidden))
1052 rStrExpValue = GetXMLToken(XML_PROTECTED);
1053 bRetval = sal_True;
1055 else if (aCellProtection.IsFormulaHidden && !(aCellProtection.IsLocked || aCellProtection.IsHidden))
1057 rStrExpValue = GetXMLToken(XML_FORMULA_HIDDEN);
1058 bRetval = sal_True;
1060 else if (aCellProtection.IsFormulaHidden && aCellProtection.IsLocked)
1062 rStrExpValue = GetXMLToken(XML_PROTECTED);
1063 rStrExpValue += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" "));
1064 rStrExpValue += GetXMLToken(XML_FORMULA_HIDDEN);
1065 bRetval = sal_True;
1069 return bRetval;
1072 XmlScPropHdl_PrintContent::~XmlScPropHdl_PrintContent()
1076 bool XmlScPropHdl_PrintContent::equals(
1077 const ::com::sun::star::uno::Any& r1,
1078 const ::com::sun::star::uno::Any& r2 ) const
1080 util::CellProtection aCellProtection1, aCellProtection2;
1082 if((r1 >>= aCellProtection1) && (r2 >>= aCellProtection2))
1084 return (aCellProtection1.IsPrintHidden == aCellProtection2.IsPrintHidden);
1086 return sal_False;
1089 sal_Bool XmlScPropHdl_PrintContent::importXML(
1090 const ::rtl::OUString& rStrImpValue,
1091 ::com::sun::star::uno::Any& rValue,
1092 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1094 sal_Bool bRetval(sal_False);
1095 util::CellProtection aCellProtection;
1096 sal_Bool bDefault(sal_False);
1097 if (!rValue.hasValue())
1099 aCellProtection.IsHidden = sal_False;
1100 aCellProtection.IsLocked = sal_True;
1101 aCellProtection.IsFormulaHidden = sal_False;
1102 aCellProtection.IsPrintHidden = sal_False;
1103 bDefault = sal_True;
1105 if ((rValue >>= aCellProtection) || bDefault)
1107 sal_Bool bValue;
1108 if (SvXMLUnitConverter::convertBool(bValue, rStrImpValue))
1110 aCellProtection.IsPrintHidden = !bValue;
1111 rValue <<= aCellProtection;
1112 bRetval = sal_True;
1116 return bRetval;
1119 sal_Bool XmlScPropHdl_PrintContent::exportXML(
1120 ::rtl::OUString& rStrExpValue,
1121 const ::com::sun::star::uno::Any& rValue,
1122 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1124 sal_Bool bRetval(sal_False);
1126 util::CellProtection aCellProtection;
1127 if(rValue >>= aCellProtection)
1129 rtl::OUStringBuffer sValue;
1130 SvXMLUnitConverter::convertBool(sValue, !aCellProtection.IsPrintHidden);
1131 rStrExpValue = sValue.makeStringAndClear();
1132 bRetval = sal_True;
1135 return bRetval;
1138 XmlScPropHdl_HoriJustify::~XmlScPropHdl_HoriJustify()
1142 bool XmlScPropHdl_HoriJustify::equals(
1143 const ::com::sun::star::uno::Any& r1,
1144 const ::com::sun::star::uno::Any& r2 ) const
1146 table::CellHoriJustify aHoriJustify1, aHoriJustify2;
1148 if((r1 >>= aHoriJustify1) && (r2 >>= aHoriJustify2))
1149 return (aHoriJustify1 == aHoriJustify2);
1150 return sal_False;
1153 sal_Bool XmlScPropHdl_HoriJustify::importXML(
1154 const ::rtl::OUString& rStrImpValue,
1155 ::com::sun::star::uno::Any& rValue,
1156 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1158 sal_Bool bRetval(sal_False);
1160 table::CellHoriJustify nValue = table::CellHoriJustify_LEFT;
1161 rValue >>= nValue;
1162 if (nValue != table::CellHoriJustify_REPEAT)
1164 if (IsXMLToken(rStrImpValue, XML_START))
1166 nValue = table::CellHoriJustify_LEFT;
1167 rValue <<= nValue;
1168 bRetval = sal_True;
1170 else if (IsXMLToken(rStrImpValue, XML_END))
1172 nValue = table::CellHoriJustify_RIGHT;
1173 rValue <<= nValue;
1174 bRetval = sal_True;
1176 else if (IsXMLToken(rStrImpValue, XML_CENTER))
1178 nValue = table::CellHoriJustify_CENTER;
1179 rValue <<= nValue;
1180 bRetval = sal_True;
1182 else if (IsXMLToken(rStrImpValue, XML_JUSTIFY))
1184 nValue = table::CellHoriJustify_BLOCK;
1185 rValue <<= nValue;
1186 bRetval = sal_True;
1189 else
1190 bRetval = sal_True;
1192 return bRetval;
1195 sal_Bool XmlScPropHdl_HoriJustify::exportXML(
1196 ::rtl::OUString& rStrExpValue,
1197 const ::com::sun::star::uno::Any& rValue,
1198 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1200 table::CellHoriJustify nVal;
1201 sal_Bool bRetval(sal_False);
1203 if(rValue >>= nVal)
1205 switch (nVal)
1207 case table::CellHoriJustify_REPEAT:
1208 case table::CellHoriJustify_LEFT:
1210 rStrExpValue = GetXMLToken(XML_START);
1211 bRetval = sal_True;
1213 break;
1214 case table::CellHoriJustify_RIGHT:
1216 rStrExpValue = GetXMLToken(XML_END);
1217 bRetval = sal_True;
1219 break;
1220 case table::CellHoriJustify_CENTER:
1222 rStrExpValue = GetXMLToken(XML_CENTER);
1223 bRetval = sal_True;
1225 break;
1226 case table::CellHoriJustify_BLOCK:
1228 rStrExpValue = GetXMLToken(XML_JUSTIFY);
1229 bRetval = sal_True;
1231 break;
1232 default:
1234 // added to avoid warnings
1239 return bRetval;
1242 XmlScPropHdl_HoriJustifySource::~XmlScPropHdl_HoriJustifySource()
1246 bool XmlScPropHdl_HoriJustifySource::equals(
1247 const ::com::sun::star::uno::Any& r1,
1248 const ::com::sun::star::uno::Any& r2 ) const
1250 table::CellHoriJustify aHoriJustify1, aHoriJustify2;
1252 if((r1 >>= aHoriJustify1) && (r2 >>= aHoriJustify2))
1253 return (aHoriJustify1 == aHoriJustify2);
1254 return sal_False;
1257 sal_Bool XmlScPropHdl_HoriJustifySource::importXML(
1258 const ::rtl::OUString& rStrImpValue,
1259 ::com::sun::star::uno::Any& rValue,
1260 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1262 sal_Bool bRetval(sal_False);
1264 if (IsXMLToken(rStrImpValue, XML_FIX))
1266 bRetval = sal_True;
1268 else if (IsXMLToken(rStrImpValue, XML_VALUE_TYPE))
1270 table::CellHoriJustify nValue(table::CellHoriJustify_STANDARD);
1271 rValue <<= nValue;
1272 bRetval = sal_True;
1275 return bRetval;
1278 sal_Bool XmlScPropHdl_HoriJustifySource::exportXML(
1279 ::rtl::OUString& rStrExpValue,
1280 const ::com::sun::star::uno::Any& rValue,
1281 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1283 table::CellHoriJustify nVal;
1284 sal_Bool bRetval(sal_False);
1286 if(rValue >>= nVal)
1288 if (nVal == table::CellHoriJustify_STANDARD)
1290 rStrExpValue = GetXMLToken(XML_VALUE_TYPE);
1291 bRetval = sal_True;
1293 else
1295 rStrExpValue = GetXMLToken(XML_FIX);
1296 bRetval = sal_True;
1300 return bRetval;
1303 XmlScPropHdl_HoriJustifyRepeat::~XmlScPropHdl_HoriJustifyRepeat()
1307 bool XmlScPropHdl_HoriJustifyRepeat::equals(
1308 const ::com::sun::star::uno::Any& r1,
1309 const ::com::sun::star::uno::Any& r2 ) const
1311 table::CellHoriJustify aHoriJustify1, aHoriJustify2;
1313 if((r1 >>= aHoriJustify1) && (r2 >>= aHoriJustify2))
1314 return (aHoriJustify1 == aHoriJustify2);
1315 return sal_False;
1318 sal_Bool XmlScPropHdl_HoriJustifyRepeat::importXML(
1319 const ::rtl::OUString& rStrImpValue,
1320 ::com::sun::star::uno::Any& rValue,
1321 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1323 sal_Bool bRetval(sal_False);
1325 if (IsXMLToken(rStrImpValue, XML_FALSE))
1327 bRetval = sal_True;
1329 else if (IsXMLToken(rStrImpValue, XML_TRUE))
1331 table::CellHoriJustify nValue = table::CellHoriJustify_REPEAT;
1332 rValue <<= nValue;
1333 bRetval = sal_True;
1336 return bRetval;
1339 sal_Bool XmlScPropHdl_HoriJustifyRepeat::exportXML(
1340 ::rtl::OUString& rStrExpValue,
1341 const ::com::sun::star::uno::Any& rValue,
1342 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1344 table::CellHoriJustify nVal;
1345 sal_Bool bRetval(sal_False);
1347 if(rValue >>= nVal)
1349 if (nVal == table::CellHoriJustify_REPEAT)
1351 rStrExpValue = GetXMLToken(XML_TRUE);
1352 bRetval = sal_True;
1354 else
1356 rStrExpValue = GetXMLToken(XML_FALSE);
1357 bRetval = sal_True;
1361 return bRetval;
1364 XmlScPropHdl_Orientation::~XmlScPropHdl_Orientation()
1368 bool XmlScPropHdl_Orientation::equals(
1369 const ::com::sun::star::uno::Any& r1,
1370 const ::com::sun::star::uno::Any& r2 ) const
1372 table::CellOrientation aOrientation1, aOrientation2;
1374 if((r1 >>= aOrientation1) && (r2 >>= aOrientation2))
1375 return (aOrientation1 == aOrientation2);
1376 return sal_False;
1379 sal_Bool XmlScPropHdl_Orientation::importXML(
1380 const ::rtl::OUString& rStrImpValue,
1381 ::com::sun::star::uno::Any& rValue,
1382 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1384 sal_Bool bRetval(sal_False);
1386 table::CellOrientation nValue;
1387 if (IsXMLToken(rStrImpValue, XML_LTR))
1389 nValue = table::CellOrientation_STANDARD;
1390 rValue <<= nValue;
1391 bRetval = sal_True;
1393 else if (IsXMLToken(rStrImpValue, XML_TTB))
1395 nValue = table::CellOrientation_STACKED;
1396 rValue <<= nValue;
1397 bRetval = sal_True;
1400 return bRetval;
1403 sal_Bool XmlScPropHdl_Orientation::exportXML(
1404 ::rtl::OUString& rStrExpValue,
1405 const ::com::sun::star::uno::Any& rValue,
1406 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1408 table::CellOrientation nVal;
1409 sal_Bool bRetval(sal_False);
1411 if(rValue >>= nVal)
1413 switch (nVal)
1415 case table::CellOrientation_STACKED :
1417 rStrExpValue = GetXMLToken(XML_TTB);
1418 bRetval = sal_True;
1420 break;
1421 default:
1423 rStrExpValue = GetXMLToken(XML_LTR);
1424 bRetval = sal_True;
1426 break;
1430 return bRetval;
1433 XmlScPropHdl_RotateAngle::~XmlScPropHdl_RotateAngle()
1437 bool XmlScPropHdl_RotateAngle::equals(
1438 const ::com::sun::star::uno::Any& r1,
1439 const ::com::sun::star::uno::Any& r2 ) const
1441 sal_Int32 aAngle1 = 0, aAngle2 = 0;
1443 if((r1 >>= aAngle1) && (r2 >>= aAngle2))
1444 return (aAngle1 == aAngle2);
1445 return sal_False;
1448 sal_Bool XmlScPropHdl_RotateAngle::importXML(
1449 const ::rtl::OUString& rStrImpValue,
1450 ::com::sun::star::uno::Any& rValue,
1451 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1453 sal_Bool bRetval(sal_False);
1455 sal_Int32 nValue;
1456 if (SvXMLUnitConverter::convertNumber(nValue, rStrImpValue))
1458 nValue *= 100;
1459 rValue <<= nValue;
1460 bRetval = sal_True;
1463 return bRetval;
1466 sal_Bool XmlScPropHdl_RotateAngle::exportXML(
1467 ::rtl::OUString& rStrExpValue,
1468 const ::com::sun::star::uno::Any& rValue,
1469 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1471 sal_Int32 nVal = 0;
1472 sal_Bool bRetval(sal_False);
1474 if(rValue >>= nVal)
1476 rtl::OUStringBuffer sValue;
1477 SvXMLUnitConverter::convertNumber(sValue, sal_Int32(nVal / 100));
1478 rStrExpValue = sValue.makeStringAndClear();
1479 bRetval = sal_True;
1482 return bRetval;
1485 XmlScPropHdl_RotateReference::~XmlScPropHdl_RotateReference()
1489 bool XmlScPropHdl_RotateReference::equals(
1490 const ::com::sun::star::uno::Any& r1,
1491 const ::com::sun::star::uno::Any& r2 ) const
1493 table::CellVertJustify aReference1, aReference2;
1495 if((r1 >>= aReference1) && (r2 >>= aReference2))
1496 return (aReference1 == aReference2);
1497 return sal_False;
1500 sal_Bool XmlScPropHdl_RotateReference::importXML(
1501 const ::rtl::OUString& rStrImpValue,
1502 ::com::sun::star::uno::Any& rValue,
1503 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1505 sal_Bool bRetval(sal_False);
1507 table::CellVertJustify nValue;
1508 if (IsXMLToken(rStrImpValue, XML_NONE))
1510 nValue = table::CellVertJustify_STANDARD;
1511 rValue <<= nValue;
1512 bRetval = sal_True;
1514 else if (IsXMLToken(rStrImpValue, XML_BOTTOM))
1516 nValue = table::CellVertJustify_BOTTOM;
1517 rValue <<= nValue;
1518 bRetval = sal_True;
1520 else if (IsXMLToken(rStrImpValue, XML_TOP))
1522 nValue = table::CellVertJustify_TOP;
1523 rValue <<= nValue;
1524 bRetval = sal_True;
1526 else if (IsXMLToken(rStrImpValue, XML_CENTER))
1528 nValue = table::CellVertJustify_CENTER;
1529 rValue <<= nValue;
1530 bRetval = sal_True;
1533 return bRetval;
1536 sal_Bool XmlScPropHdl_RotateReference::exportXML(
1537 ::rtl::OUString& rStrExpValue,
1538 const ::com::sun::star::uno::Any& rValue,
1539 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1541 table::CellVertJustify nVal;
1542 sal_Bool bRetval(sal_False);
1544 if(rValue >>= nVal)
1546 switch (nVal)
1548 case table::CellVertJustify_BOTTOM :
1550 rStrExpValue = GetXMLToken(XML_BOTTOM);
1551 bRetval = sal_True;
1553 break;
1554 case table::CellVertJustify_CENTER :
1556 rStrExpValue = GetXMLToken(XML_CENTER);
1557 bRetval = sal_True;
1559 break;
1560 case table::CellVertJustify_STANDARD :
1562 rStrExpValue = GetXMLToken(XML_NONE);
1563 bRetval = sal_True;
1565 break;
1566 case table::CellVertJustify_TOP :
1568 rStrExpValue = GetXMLToken(XML_TOP);
1569 bRetval = sal_True;
1571 break;
1572 default:
1574 // added to avoid warnings
1579 return bRetval;
1582 XmlScPropHdl_VertJustify::~XmlScPropHdl_VertJustify()
1586 bool XmlScPropHdl_VertJustify::equals(
1587 const ::com::sun::star::uno::Any& r1,
1588 const ::com::sun::star::uno::Any& r2 ) const
1590 table::CellVertJustify aReference1, aReference2;
1592 if((r1 >>= aReference1) && (r2 >>= aReference2))
1593 return (aReference1 == aReference2);
1594 return sal_False;
1597 sal_Bool XmlScPropHdl_VertJustify::importXML(
1598 const ::rtl::OUString& rStrImpValue,
1599 ::com::sun::star::uno::Any& rValue,
1600 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1602 sal_Bool bRetval(sal_False);
1604 table::CellVertJustify nValue;
1605 if (IsXMLToken(rStrImpValue, XML_AUTOMATIC))
1607 nValue = table::CellVertJustify_STANDARD;
1608 rValue <<= nValue;
1609 bRetval = sal_True;
1611 else if (IsXMLToken(rStrImpValue, XML_BOTTOM))
1613 nValue = table::CellVertJustify_BOTTOM;
1614 rValue <<= nValue;
1615 bRetval = sal_True;
1617 else if (IsXMLToken(rStrImpValue, XML_TOP))
1619 nValue = table::CellVertJustify_TOP;
1620 rValue <<= nValue;
1621 bRetval = sal_True;
1623 else if (IsXMLToken(rStrImpValue, XML_MIDDLE))
1625 nValue = table::CellVertJustify_CENTER;
1626 rValue <<= nValue;
1627 bRetval = sal_True;
1630 return bRetval;
1633 sal_Bool XmlScPropHdl_VertJustify::exportXML(
1634 ::rtl::OUString& rStrExpValue,
1635 const ::com::sun::star::uno::Any& rValue,
1636 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1638 table::CellVertJustify nVal;
1639 sal_Bool bRetval(sal_False);
1641 if(rValue >>= nVal)
1643 switch (nVal)
1645 case table::CellVertJustify_BOTTOM :
1647 rStrExpValue = GetXMLToken(XML_BOTTOM);
1648 bRetval = sal_True;
1650 break;
1651 case table::CellVertJustify_CENTER :
1653 rStrExpValue = GetXMLToken(XML_MIDDLE);
1654 bRetval = sal_True;
1656 break;
1657 case table::CellVertJustify_STANDARD :
1659 rStrExpValue = GetXMLToken(XML_AUTOMATIC);
1660 bRetval = sal_True;
1662 break;
1663 case table::CellVertJustify_TOP :
1665 rStrExpValue = GetXMLToken(XML_TOP);
1666 bRetval = sal_True;
1668 break;
1669 default:
1671 // added to avoid warnings
1676 return bRetval;
1679 XmlScPropHdl_BreakBefore::~XmlScPropHdl_BreakBefore()
1683 bool XmlScPropHdl_BreakBefore::equals(
1684 const ::com::sun::star::uno::Any& r1,
1685 const ::com::sun::star::uno::Any& r2 ) const
1687 sal_Bool aBreak1 = 0, aBreak2 = 0;
1689 if((r1 >>= aBreak1) && (r2 >>= aBreak2))
1690 return (aBreak1 == aBreak2);
1691 return sal_False;
1694 sal_Bool XmlScPropHdl_BreakBefore::importXML(
1695 const ::rtl::OUString& rStrImpValue,
1696 ::com::sun::star::uno::Any& rValue,
1697 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1699 sal_Bool bRetval(sal_False);
1701 sal_Bool bValue;
1702 if (IsXMLToken(rStrImpValue, XML_AUTO))
1704 bValue = sal_False;
1705 rValue = ::cppu::bool2any(bValue);
1706 bRetval = sal_True;
1708 else if (IsXMLToken(rStrImpValue, XML_PAGE))
1710 bValue = sal_True;
1711 rValue = ::cppu::bool2any(bValue);
1712 bRetval = sal_True;
1715 return bRetval;
1718 sal_Bool XmlScPropHdl_BreakBefore::exportXML(
1719 ::rtl::OUString& rStrExpValue,
1720 const ::com::sun::star::uno::Any& rValue,
1721 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1723 sal_Bool bRetval(sal_False);
1725 if(::cppu::any2bool(rValue))
1727 rStrExpValue = GetXMLToken(XML_PAGE);
1728 bRetval = sal_True;
1730 else
1732 rStrExpValue = GetXMLToken(XML_AUTO);
1733 bRetval = sal_True;
1736 return bRetval;
1739 XmlScPropHdl_IsTextWrapped::~XmlScPropHdl_IsTextWrapped()
1743 bool XmlScPropHdl_IsTextWrapped::equals(
1744 const ::com::sun::star::uno::Any& r1,
1745 const ::com::sun::star::uno::Any& r2 ) const
1747 return (::cppu::any2bool(r1) == ::cppu::any2bool(r2));
1750 sal_Bool XmlScPropHdl_IsTextWrapped::importXML(
1751 const ::rtl::OUString& rStrImpValue,
1752 ::com::sun::star::uno::Any& rValue,
1753 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1755 sal_Bool bRetval(sal_False);
1757 if (IsXMLToken(rStrImpValue, XML_WRAP))
1759 rValue = ::cppu::bool2any(sal_True);
1760 bRetval = sal_True;
1762 else if (IsXMLToken(rStrImpValue, XML_NO_WRAP))
1764 rValue = ::cppu::bool2any(sal_False);
1765 bRetval = sal_True;
1768 return bRetval;
1771 sal_Bool XmlScPropHdl_IsTextWrapped::exportXML(
1772 ::rtl::OUString& rStrExpValue,
1773 const ::com::sun::star::uno::Any& rValue,
1774 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1776 sal_Bool bRetval(sal_False);
1778 if (::cppu::any2bool(rValue))
1780 rStrExpValue = GetXMLToken(XML_WRAP);
1781 bRetval = sal_True;
1783 else
1785 rStrExpValue = GetXMLToken(XML_NO_WRAP);
1786 bRetval = sal_True;
1789 return bRetval;
1792 sal_Bool XmlScPropHdl_IsEqual::importXML( const ::rtl::OUString& /* rStrImpValue */,
1793 ::com::sun::star::uno::Any& /* rValue */,
1794 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1796 DBG_ERROR("should never be called");
1797 return sal_False;
1800 sal_Bool XmlScPropHdl_IsEqual::exportXML( ::rtl::OUString& /* rStrExpValue */,
1801 const ::com::sun::star::uno::Any& /* rValue */,
1802 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1804 DBG_ERROR("should never be called");
1805 return sal_False;
1808 XmlScPropHdl_Vertical::~XmlScPropHdl_Vertical()
1812 bool XmlScPropHdl_Vertical::equals(
1813 const ::com::sun::star::uno::Any& r1,
1814 const ::com::sun::star::uno::Any& r2 ) const
1816 return (::cppu::any2bool(r1) == ::cppu::any2bool(r2));
1819 sal_Bool XmlScPropHdl_Vertical::importXML(
1820 const ::rtl::OUString& rStrImpValue,
1821 ::com::sun::star::uno::Any& rValue,
1822 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1824 sal_Bool bRetval(sal_False);
1826 if (IsXMLToken(rStrImpValue, XML_AUTO))
1828 rValue = ::cppu::bool2any(sal_True);
1829 bRetval = sal_True;
1831 else if (IsXMLToken(rStrImpValue, XML_0))
1833 rValue = ::cppu::bool2any(sal_False);
1834 bRetval = sal_True;
1837 return bRetval;
1840 sal_Bool XmlScPropHdl_Vertical::exportXML(
1841 ::rtl::OUString& rStrExpValue,
1842 const ::com::sun::star::uno::Any& rValue,
1843 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1845 sal_Bool bRetval(sal_False);
1847 if (::cppu::any2bool(rValue))
1849 rStrExpValue = GetXMLToken(XML_AUTO);
1850 bRetval = sal_True;
1852 else
1854 rStrExpValue = GetXMLToken(XML_0);
1855 bRetval = sal_True;
1858 return bRetval;