1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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"
22 #include "xmlimprt.hxx"
24 #include "XMLConverter.hxx"
25 #include "rangeutl.hxx"
26 #include "unonames.hxx"
28 #include <xmloff/xmlnmspe.hxx>
29 #include <xmloff/xmltypes.hxx>
30 #include <xmloff/families.hxx>
31 #include <xmloff/xmlnumfe.hxx>
32 #include <xmloff/xmlnumfi.hxx>
33 #include <xmloff/nmspmap.hxx>
34 #include <xmloff/attrlist.hxx>
35 #include <xmloff/contextid.hxx>
36 #include <xmloff/txtprmap.hxx>
37 #include <sax/tools/converter.hxx>
38 #include <com/sun/star/util/CellProtection.hpp>
39 #include <com/sun/star/table/CellOrientation.hpp>
40 #include <com/sun/star/table/CellVertJustify2.hpp>
41 #include <com/sun/star/table/CellHoriJustify.hpp>
42 #include <com/sun/star/table/CellJustifyMethod.hpp>
43 #include <com/sun/star/table/TableBorder.hpp>
44 #include <com/sun/star/table/BorderLine2.hpp>
45 #include <com/sun/star/sheet/XSheetConditionalEntry.hpp>
46 #include <com/sun/star/sheet/XSheetCondition.hpp>
47 #include <com/sun/star/beans/XPropertyState.hpp>
48 #include <comphelper/extract.hxx>
50 #include <rtl/ustrbuf.hxx>
52 using namespace com::sun::star
;
53 using namespace ::xmloff::token
;
54 using namespace ::formula
;
56 #define MAP(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFVER_010, false }
57 // extensions import/export
58 #define MAP_EXT(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFVER_012_EXT_COMPAT, false }
59 // extensions import only
60 #define MAP_EXT_I(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFVER_012_EXT_COMPAT, true }
61 #define MAP_END() { NULL, 0, 0, XML_TOKEN_INVALID, 0, 0, SvtSaveOptions::ODFVER_010, false }
63 const XMLPropertyMapEntry aXMLScCellStylesProperties
[] =
65 MAP( "AsianVerticalMode", XML_NAMESPACE_STYLE
, XML_GLYPH_ORIENTATION_VERTICAL
, XML_TYPE_PROP_TABLE_CELL
|XML_SC_TYPE_VERTICAL
, 0),
66 MAP( "BottomBorder", XML_NAMESPACE_FO
, XML_BORDER_BOTTOM
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_BORDER
, CTF_SC_BOTTOMBORDER
),
67 MAP( "BottomBorder", XML_NAMESPACE_STYLE
, XML_BORDER_LINE_WIDTH_BOTTOM
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_BORDER_WIDTH
, CTF_SC_BOTTOMBORDERWIDTH
),
68 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 ),
69 MAP( "CellProtection", XML_NAMESPACE_STYLE
, XML_CELL_PROTECT
, XML_TYPE_PROP_TABLE_CELL
|XML_SC_TYPE_CELLPROTECTION
|MID_FLAG_MERGE_PROPERTY
, 0 ),
70 MAP( "CellProtection", XML_NAMESPACE_STYLE
, XML_PRINT_CONTENT
, XML_TYPE_PROP_TABLE_CELL
|XML_SC_TYPE_PRINTCONTENT
|MID_FLAG_MERGE_PROPERTY
, 0 ),
71 MAP( "CellStyle", XML_NAMESPACE_STYLE
, XML_STYLE
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_STRING
, CTF_SC_CELLSTYLE
),
72 MAP( "ConditionalFormatXML", XML_NAMESPACE_STYLE
, XML_MAP
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_STRING
|MID_FLAG_SPECIAL_ITEM
, CTF_SC_IMPORT_MAP
),
73 MAP( "ConditionalFormatXML", XML_NAMESPACE_STYLE
, XML_MAP
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_STRING
|MID_FLAG_SPECIAL_ITEM
, CTF_SC_MAP
),
74 MAP( "DiagonalBLTR", XML_NAMESPACE_STYLE
, XML_DIAGONAL_BL_TR
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_BORDER
, CTF_SC_DIAGONALBLTR
),
75 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
76 MAP( "DiagonalBLTR", XML_NAMESPACE_STYLE
, XML_DIAGONAL_BL_TR_WIDTHS
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_BORDER_WIDTH
, CTF_SC_DIAGONALBLTRWIDTHS
),
77 MAP( "DiagonalTLBR", XML_NAMESPACE_STYLE
, XML_DIAGONAL_TL_BR
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_BORDER
, CTF_SC_DIAGONALTLBR
),
78 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
79 MAP( "DiagonalTLBR", XML_NAMESPACE_STYLE
, XML_DIAGONAL_TL_BR_WIDTHS
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_BORDER_WIDTH
, CTF_SC_DIAGONALTLBRWIDTHS
),
80 MAP( "HoriJustify", XML_NAMESPACE_FO
, XML_TEXT_ALIGN
, XML_TYPE_PROP_PARAGRAPH
|XML_SC_TYPE_HORIJUSTIFY
|MID_FLAG_MERGE_PROPERTY
, 0 ),
81 MAP( "HoriJustify", XML_NAMESPACE_STYLE
, XML_TEXT_ALIGN_SOURCE
, XML_TYPE_PROP_TABLE_CELL
|XML_SC_TYPE_HORIJUSTIFYSOURCE
|MID_FLAG_MERGE_PROPERTY
, 0 ),
82 MAP( "HoriJustify", XML_NAMESPACE_STYLE
, XML_REPEAT_CONTENT
, XML_TYPE_PROP_TABLE_CELL
|XML_SC_TYPE_HORIJUSTIFYREPEAT
|MID_FLAG_MERGE_PROPERTY
, 0 ),
83 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
),
84 MAP_EXT( SC_UNONAME_CELLHJUS_METHOD
, XML_NAMESPACE_CSS3TEXT
, XML_TEXT_JUSTIFY
, XML_TYPE_PROP_PARAGRAPH
|XML_SC_TYPE_HORIJUSTIFY_METHOD
, 0 ),
85 MAP( "IsCellBackgroundTransparent", XML_NAMESPACE_FO
, XML_BACKGROUND_COLOR
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_ISTRANSPARENT
|MID_FLAG_MULTI_PROPERTY
|MID_FLAG_MERGE_ATTRIBUTE
, 0 ),
86 MAP( "IsTextWrapped", XML_NAMESPACE_FO
, XML_WRAP_OPTION
, XML_TYPE_PROP_TABLE_CELL
|XML_SC_ISTEXTWRAPPED
, 0 ),
87 MAP( "LeftBorder", XML_NAMESPACE_FO
, XML_BORDER
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_BORDER
, CTF_SC_ALLBORDER
),
88 MAP( "LeftBorder", XML_NAMESPACE_FO
, XML_BORDER_LEFT
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_BORDER
, CTF_SC_LEFTBORDER
),
89 MAP( "LeftBorder", XML_NAMESPACE_STYLE
, XML_BORDER_LINE_WIDTH
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_BORDER_WIDTH
, CTF_SC_ALLBORDERWIDTH
),
90 MAP( "LeftBorder", XML_NAMESPACE_STYLE
, XML_BORDER_LINE_WIDTH_LEFT
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_BORDER_WIDTH
, CTF_SC_LEFTBORDERWIDTH
),
91 MAP( "NumberFormat", XML_NAMESPACE_STYLE
, XML_DATA_STYLE_NAME
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_NUMBER
|MID_FLAG_SPECIAL_ITEM
, CTF_SC_NUMBERFORMAT
),
92 MAP( "Orientation", XML_NAMESPACE_STYLE
, XML_DIRECTION
, XML_TYPE_PROP_TABLE_CELL
|XML_SC_TYPE_ORIENTATION
, 0 ),
93 MAP( "ParaBottomMargin", XML_NAMESPACE_FO
, XML_PADDING
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_MEASURE
, CTF_SC_ALLPADDING
),
94 MAP( "ParaBottomMargin", XML_NAMESPACE_FO
, XML_PADDING_BOTTOM
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_MEASURE
, CTF_SC_BOTTOMPADDING
),
95 MAP( "ParaIndent", XML_NAMESPACE_FO
, XML_MARGIN_LEFT
, XML_TYPE_PROP_PARAGRAPH
|XML_TYPE_MEASURE16
, 0 ),
96 MAP( "ParaLeftMargin", XML_NAMESPACE_FO
, XML_PADDING_LEFT
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_MEASURE
, CTF_SC_LEFTPADDING
),
97 MAP( "ParaRightMargin", XML_NAMESPACE_FO
, XML_PADDING_RIGHT
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_MEASURE
, CTF_SC_RIGHTPADDING
),
98 MAP( "ParaTopMargin", XML_NAMESPACE_FO
, XML_PADDING_TOP
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_MEASURE
, CTF_SC_TOPPADDING
),
99 MAP( "RightBorder", XML_NAMESPACE_FO
, XML_BORDER_RIGHT
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_BORDER
, CTF_SC_RIGHTBORDER
),
100 MAP( "RightBorder", XML_NAMESPACE_STYLE
, XML_BORDER_LINE_WIDTH_RIGHT
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_BORDER_WIDTH
, CTF_SC_RIGHTBORDERWIDTH
),
101 MAP( "RotateAngle", XML_NAMESPACE_STYLE
, XML_ROTATION_ANGLE
, XML_TYPE_PROP_TABLE_CELL
|XML_SC_TYPE_ROTATEANGLE
, 0 ),
102 MAP( "RotateReference", XML_NAMESPACE_STYLE
, XML_ROTATION_ALIGN
, XML_TYPE_PROP_TABLE_CELL
|XML_SC_TYPE_ROTATEREFERENCE
, 0),
103 MAP( "ShadowFormat", XML_NAMESPACE_STYLE
, XML_SHADOW
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_TEXT_SHADOW
, 0 ),
104 MAP( "ShrinkToFit", XML_NAMESPACE_STYLE
, XML_SHRINK_TO_FIT
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_BOOL
, 0 ),
105 MAP( "StandardDecimals", XML_NAMESPACE_STYLE
, XML_DECIMAL_PLACES
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_NUMBER16
, 0 ),
106 MAP( "TopBorder", XML_NAMESPACE_FO
, XML_BORDER_TOP
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_BORDER
, CTF_SC_TOPBORDER
),
107 MAP( "TopBorder", XML_NAMESPACE_STYLE
, XML_BORDER_LINE_WIDTH_TOP
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_BORDER_WIDTH
, CTF_SC_TOPBORDERWIDTH
),
108 MAP( "UserDefinedAttributes", XML_NAMESPACE_TEXT
, XML_XMLNS
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_ATTRIBUTE_CONTAINER
| MID_FLAG_SPECIAL_ITEM
, 0 ),
109 MAP( "ValidationXML", XML_NAMESPACE_TABLE
, XML_CONTENT_VALIDATION
, XML_TYPE_PROP_TABLE_CELL
|XML_TYPE_BUILDIN_CMP_ONLY
, CTF_SC_VALIDATION
),
110 MAP( "VertJustify", XML_NAMESPACE_STYLE
, XML_VERTICAL_ALIGN
, XML_TYPE_PROP_TABLE_CELL
|XML_SC_TYPE_VERTJUSTIFY
, 0),
111 MAP_EXT_I( SC_UNONAME_CELLVJUS_METHOD
, XML_NAMESPACE_STYLE
, XML_VERTICAL_JUSTIFY
, XML_TYPE_PROP_TABLE_CELL
|XML_SC_TYPE_VERTJUSTIFY_METHOD
, 0 ), // proposed ODF 1.2+
112 MAP_EXT( SC_UNONAME_CELLVJUS_METHOD
, XML_NAMESPACE_LO_EXT
, XML_VERTICAL_JUSTIFY
, XML_TYPE_PROP_TABLE_CELL
|XML_SC_TYPE_VERTJUSTIFY_METHOD
, 0 ), // extension namespace
116 const XMLPropertyMapEntry aXMLScColumnStylesProperties
[] =
118 MAP( "IsManualPageBreak", XML_NAMESPACE_FO
, XML_BREAK_BEFORE
, XML_TYPE_PROP_TABLE_COLUMN
|XML_SC_TYPE_BREAKBEFORE
, 0),
119 MAP( "IsVisible", XML_NAMESPACE_TABLE
, XML_DISPLAY
, XML_TYPE_PROP_TABLE_COLUMN
|XML_SC_TYPE_EQUAL
|MID_FLAG_SPECIAL_ITEM
, CTF_SC_ISVISIBLE
),
120 MAP( "Width", XML_NAMESPACE_STYLE
, XML_COLUMN_WIDTH
, XML_TYPE_PROP_TABLE_COLUMN
|XML_TYPE_MEASURE
, 0 ),
124 const XMLPropertyMapEntry aXMLScRowStylesImportProperties
[] =
126 // #i57867# Include background color (CellBackColor/IsCellBackgroundTransparent) for import only.
127 // Import and export should use the same map, with MID_FLAG_NO_PROPERTY_EXPORT for the background entries,
128 // but this doesn't work at the moment because SvXMLImportPropertyMapper compares MID_FLAG_NO_PROPERTY to 0.
129 // If this is changed (not for 2.0.x), a single map can be used again.
131 MAP( "CellBackColor", XML_NAMESPACE_FO
, XML_BACKGROUND_COLOR
, XML_TYPE_PROP_TABLE_ROW
|XML_TYPE_COLORTRANSPARENT
|MID_FLAG_MULTI_PROPERTY
|MID_FLAG_MERGE_ATTRIBUTE
, 0 ),
132 MAP( "Height", XML_NAMESPACE_STYLE
, XML_ROW_HEIGHT
, XML_TYPE_PROP_TABLE_ROW
|XML_TYPE_MEASURE
, CTF_SC_ROWHEIGHT
),
133 MAP( "IsCellBackgroundTransparent", XML_NAMESPACE_FO
, XML_BACKGROUND_COLOR
, XML_TYPE_PROP_TABLE_ROW
|XML_TYPE_ISTRANSPARENT
|MID_FLAG_MULTI_PROPERTY
|MID_FLAG_MERGE_ATTRIBUTE
, 0 ),
134 MAP( "IsManualPageBreak", XML_NAMESPACE_FO
, XML_BREAK_BEFORE
, XML_TYPE_PROP_TABLE_ROW
|XML_SC_TYPE_BREAKBEFORE
, CTF_SC_ROWBREAKBEFORE
),
135 MAP( "OptimalHeight", XML_NAMESPACE_STYLE
, XML_USE_OPTIMAL_ROW_HEIGHT
, XML_TYPE_PROP_TABLE_ROW
|XML_TYPE_BOOL
, CTF_SC_ROWOPTIMALHEIGHT
),
139 const XMLPropertyMapEntry aXMLScRowStylesProperties
[] =
141 MAP( "Height", XML_NAMESPACE_STYLE
, XML_ROW_HEIGHT
, XML_TYPE_PROP_TABLE_ROW
|XML_TYPE_MEASURE
, CTF_SC_ROWHEIGHT
),
142 MAP( "IsManualPageBreak", XML_NAMESPACE_FO
, XML_BREAK_BEFORE
, XML_TYPE_PROP_TABLE_ROW
|XML_SC_TYPE_BREAKBEFORE
, CTF_SC_ROWBREAKBEFORE
),
143 MAP( "OptimalHeight", XML_NAMESPACE_STYLE
, XML_USE_OPTIMAL_ROW_HEIGHT
, XML_TYPE_PROP_TABLE_ROW
|XML_TYPE_BOOL
, CTF_SC_ROWOPTIMALHEIGHT
),
147 const XMLPropertyMapEntry aXMLScFromXLSRowStylesProperties
[] =
149 MAP( "Height", XML_NAMESPACE_STYLE
, XML_ROW_HEIGHT
, XML_TYPE_PROP_TABLE_ROW
|XML_TYPE_MEASURE
, CTF_SC_ROWHEIGHT
),
150 MAP( "IsManualPageBreak", XML_NAMESPACE_FO
, XML_BREAK_BEFORE
, XML_TYPE_PROP_TABLE_ROW
|XML_SC_TYPE_BREAKBEFORE
, CTF_SC_ROWBREAKBEFORE
),
151 MAP( "OptimalHeight", XML_NAMESPACE_STYLE
, XML_USE_OPTIMAL_ROW_HEIGHT
, XML_TYPE_PROP_TABLE_ROW
|XML_TYPE_BOOL_FALSE
, CTF_SC_ROWOPTIMALHEIGHT
),
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( "TabColor", XML_NAMESPACE_TABLE
, XML_TAB_COLOR
, XML_TYPE_PROP_TABLE
|XML_TYPE_COLORAUTO
, 0 ),
168 MAP_EXT( "TabColor", XML_NAMESPACE_TABLE_EXT
, XML_TAB_COLOR
, XML_TYPE_PROP_TABLE
|XML_TYPE_COLORAUTO
, 0 ),
172 const XMLPropertyMapEntry aXMLScTableStylesProperties
[] =
174 MAP( "IsVisible", XML_NAMESPACE_TABLE
, XML_DISPLAY
, XML_TYPE_PROP_TABLE
|XML_TYPE_BOOL
, 0 ),
175 MAP( "PageStyle", XML_NAMESPACE_STYLE
, XML_MASTER_PAGE_NAME
, XML_TYPE_PROP_TABLE
|XML_TYPE_STRING
|MID_FLAG_SPECIAL_ITEM
, CTF_SC_MASTERPAGENAME
),
176 MAP( "TableLayout", XML_NAMESPACE_STYLE
, XML_WRITING_MODE
, XML_TYPE_PROP_TABLE
|XML_TYPE_TEXT_WRITING_MODE
, 0 ),
177 MAP_EXT( "TabColor", XML_NAMESPACE_TABLE_EXT
, XML_TAB_COLOR
, XML_TYPE_PROP_TABLE
|XML_TYPE_COLORAUTO
, 0 ),
181 ScXMLCellExportPropertyMapper::ScXMLCellExportPropertyMapper(
182 const rtl::Reference
< XMLPropertySetMapper
>& rMapper
)
183 : SvXMLExportPropertyMapper(rMapper
)
187 ScXMLCellExportPropertyMapper::~ScXMLCellExportPropertyMapper()
191 void ScXMLCellExportPropertyMapper::ContextFilter(
192 bool bEnableFoFontFamily
,
193 ::std::vector
< XMLPropertyState
>& rProperties
,
194 uno::Reference
< beans::XPropertySet
> rPropSet
) const
196 XMLPropertyState
* pPadding
= NULL
;
197 XMLPropertyState
* pPadding_Bottom
= NULL
;
198 XMLPropertyState
* pPadding_Left
= NULL
;
199 XMLPropertyState
* pPadding_Right
= NULL
;
200 XMLPropertyState
* pPadding_Top
= NULL
;
202 XMLPropertyState
* pBorder
= NULL
;
203 XMLPropertyState
* pBorder_Bottom
= NULL
;
204 XMLPropertyState
* pBorder_Left
= NULL
;
205 XMLPropertyState
* pBorder_Right
= NULL
;
206 XMLPropertyState
* pBorder_Top
= NULL
;
207 XMLPropertyState
* pSWBorder
= NULL
;
208 XMLPropertyState
* pSWBorder_Bottom
= NULL
;
209 XMLPropertyState
* pSWBorder_Left
= NULL
;
210 XMLPropertyState
* pSWBorder_Right
= NULL
;
211 XMLPropertyState
* pSWBorder_Top
= NULL
;
213 XMLPropertyState
* pAllBorderWidthState
= NULL
;
214 XMLPropertyState
* pLeftBorderWidthState
= NULL
;
215 XMLPropertyState
* pRightBorderWidthState
= NULL
;
216 XMLPropertyState
* pTopBorderWidthState
= NULL
;
217 XMLPropertyState
* pBottomBorderWidthState
= NULL
;
218 XMLPropertyState
* pSWAllBorderWidthState
= NULL
;
219 XMLPropertyState
* pSWLeftBorderWidthState
= NULL
;
220 XMLPropertyState
* pSWRightBorderWidthState
= NULL
;
221 XMLPropertyState
* pSWTopBorderWidthState
= NULL
;
222 XMLPropertyState
* pSWBottomBorderWidthState
= NULL
;
223 XMLPropertyState
* pDiagonalTLBRWidthState
= NULL
;
224 XMLPropertyState
* pDiagonalBLTRWidthState
= NULL
;
226 XMLPropertyState
* pParaMarginLeft
= NULL
;
227 XMLPropertyState
* pParaMarginLeftRel
= NULL
;
228 XMLPropertyState
* pParaMarginRight
= NULL
;
229 XMLPropertyState
* pParaMarginRightRel
= NULL
;
230 XMLPropertyState
* pParaMarginTop
= NULL
;
231 XMLPropertyState
* pParaMarginTopRel
= NULL
;
232 XMLPropertyState
* pParaMarginBottom
= NULL
;
233 XMLPropertyState
* pParaMarginBottomRel
= NULL
;
235 XMLPropertyState
* pParaAdjust
= NULL
;
236 XMLPropertyState
* pParaAdjustLast
= NULL
;
238 ::std::vector
< XMLPropertyState
>::iterator
aEndIter(rProperties
.end());
239 for( ::std::vector
< XMLPropertyState
>::iterator aIter
= rProperties
.begin();
240 aIter
!= aEndIter
; ++aIter
)
242 XMLPropertyState
* propertyState
= &(*aIter
);
243 if (propertyState
->mnIndex
!= -1)
245 switch( getPropertySetMapper()->GetEntryContextId( propertyState
->mnIndex
) )
247 case CTF_SC_ALLPADDING
: pPadding
= propertyState
; break;
248 case CTF_SC_BOTTOMPADDING
: pPadding_Bottom
= propertyState
; break;
249 case CTF_SC_LEFTPADDING
: pPadding_Left
= propertyState
; break;
250 case CTF_SC_RIGHTPADDING
: pPadding_Right
= propertyState
; break;
251 case CTF_SC_TOPPADDING
: pPadding_Top
= propertyState
; break;
252 case CTF_SC_ALLBORDER
: pBorder
= propertyState
; break;
253 case CTF_SC_LEFTBORDER
: pBorder_Left
= propertyState
; break;
254 case CTF_SC_RIGHTBORDER
: pBorder_Right
= propertyState
; break;
255 case CTF_SC_BOTTOMBORDER
: pBorder_Bottom
= propertyState
; break;
256 case CTF_SC_TOPBORDER
: pBorder_Top
= propertyState
; break;
257 case CTF_SC_ALLBORDERWIDTH
: pAllBorderWidthState
= propertyState
; break;
258 case CTF_SC_LEFTBORDERWIDTH
: pLeftBorderWidthState
= propertyState
; break;
259 case CTF_SC_RIGHTBORDERWIDTH
: pRightBorderWidthState
= propertyState
; break;
260 case CTF_SC_TOPBORDERWIDTH
: pTopBorderWidthState
= propertyState
; break;
261 case CTF_SC_BOTTOMBORDERWIDTH
: pBottomBorderWidthState
= propertyState
; break;
262 case CTF_ALLBORDER
: pSWBorder
= propertyState
; break;
263 case CTF_LEFTBORDER
: pSWBorder_Left
= propertyState
; break;
264 case CTF_RIGHTBORDER
: pSWBorder_Right
= propertyState
; break;
265 case CTF_BOTTOMBORDER
: pSWBorder_Bottom
= propertyState
; break;
266 case CTF_TOPBORDER
: pSWBorder_Top
= propertyState
; break;
267 case CTF_ALLBORDERWIDTH
: pSWAllBorderWidthState
= propertyState
; break;
268 case CTF_LEFTBORDERWIDTH
: pSWLeftBorderWidthState
= propertyState
; break;
269 case CTF_RIGHTBORDERWIDTH
: pSWRightBorderWidthState
= propertyState
; break;
270 case CTF_TOPBORDERWIDTH
: pSWTopBorderWidthState
= propertyState
; break;
271 case CTF_BOTTOMBORDERWIDTH
: pSWBottomBorderWidthState
= propertyState
; break;
272 case CTF_SC_DIAGONALTLBR
: break; //old diagonal line attribute names without "s" are only read, not written
273 case CTF_SC_DIAGONALTLBRWIDTH
: pDiagonalTLBRWidthState
= propertyState
; break;
274 case CTF_SC_DIAGONALBLTR
: break; //old diagonal line attribute names without "s" are only read, not written
275 case CTF_SC_DIAGONALBLTRWIDTH
: pDiagonalBLTRWidthState
= propertyState
; break;
276 case CTF_SD_SHAPE_PARA_ADJUST
: pParaAdjust
= propertyState
; break;
277 case CTF_PARA_ADJUSTLAST
: pParaAdjustLast
= propertyState
; break;
278 case CTF_PARALEFTMARGIN
: pParaMarginLeft
= propertyState
; break;
279 case CTF_PARALEFTMARGIN_REL
: pParaMarginLeftRel
= propertyState
; break;
280 case CTF_PARARIGHTMARGIN
: pParaMarginRight
= propertyState
; break;
281 case CTF_PARARIGHTMARGIN_REL
: pParaMarginRightRel
= propertyState
; break;
282 case CTF_PARATOPMARGIN
: pParaMarginTop
= propertyState
; break;
283 case CTF_PARATOPMARGIN_REL
: pParaMarginTopRel
= propertyState
; break;
284 case CTF_PARABOTTOMMARGIN
: pParaMarginBottom
= propertyState
; break;
285 case CTF_PARABOTTOMMARGIN_REL
: pParaMarginBottomRel
= propertyState
; break;
290 if (pPadding
&& pPadding_Bottom
&& pPadding_Left
&& pPadding_Right
&& pPadding_Top
)
292 sal_Int32 nBottom
= 0, nTop
= 0, nLeft
= 0, nRight
= 0;
293 if ((pPadding_Bottom
->maValue
>>= nBottom
) &&
294 (pPadding_Left
->maValue
>>= nLeft
) &&
295 (pPadding_Right
->maValue
>>= nRight
) &&
296 (pPadding_Top
->maValue
>>= nTop
))
298 if ((nBottom
== nTop
) && (nLeft
== nRight
) && (nTop
== nLeft
))
300 pPadding_Bottom
->mnIndex
= -1;
301 pPadding_Bottom
->maValue
.clear();
302 pPadding_Left
->mnIndex
= -1;
303 pPadding_Left
->maValue
.clear();
304 pPadding_Right
->mnIndex
= -1;
305 pPadding_Right
->maValue
.clear();
306 pPadding_Top
->mnIndex
= -1;
307 pPadding_Top
->maValue
.clear();
311 pPadding
->mnIndex
= -1;
312 pPadding
->maValue
.clear();
318 if( pBorder_Left
&& pBorder_Right
&& pBorder_Top
&& pBorder_Bottom
)
320 table::BorderLine2 aLeft
, aRight
, aTop
, aBottom
;
322 pBorder_Left
->maValue
>>= aLeft
;
323 pBorder_Right
->maValue
>>= aRight
;
324 pBorder_Top
->maValue
>>= aTop
;
325 pBorder_Bottom
->maValue
>>= aBottom
;
326 if( aLeft
.Color
== aRight
.Color
&& aLeft
.InnerLineWidth
== aRight
.InnerLineWidth
&&
327 aLeft
.OuterLineWidth
== aRight
.OuterLineWidth
&& aLeft
.LineDistance
== aRight
.LineDistance
&&
328 aLeft
.Color
== aTop
.Color
&& aLeft
.InnerLineWidth
== aTop
.InnerLineWidth
&&
329 aLeft
.OuterLineWidth
== aTop
.OuterLineWidth
&& aLeft
.LineDistance
== aTop
.LineDistance
&&
330 aLeft
.Color
== aBottom
.Color
&& aLeft
.InnerLineWidth
== aBottom
.InnerLineWidth
&&
331 aLeft
.OuterLineWidth
== aBottom
.OuterLineWidth
&& aLeft
.LineDistance
== aBottom
.LineDistance
&&
332 aLeft
.LineStyle
== aRight
.LineStyle
&& aLeft
.LineStyle
== aTop
.LineStyle
&&
333 aLeft
.LineStyle
== aBottom
.LineStyle
&& aLeft
.LineWidth
== aRight
.LineWidth
&&
334 aLeft
.LineWidth
== aTop
.LineWidth
&& aLeft
.LineWidth
== aBottom
.LineWidth
)
336 pBorder_Left
->mnIndex
= -1;
337 pBorder_Left
->maValue
.clear();
338 pBorder_Right
->mnIndex
= -1;
339 pBorder_Right
->maValue
.clear();
340 pBorder_Top
->mnIndex
= -1;
341 pBorder_Top
->maValue
.clear();
342 pBorder_Bottom
->mnIndex
= -1;
343 pBorder_Bottom
->maValue
.clear();
347 pBorder
->mnIndex
= -1;
348 pBorder
->maValue
.clear();
353 pBorder
->mnIndex
= -1;
354 pBorder
->maValue
.clear();
357 if( pAllBorderWidthState
)
359 if( pLeftBorderWidthState
&& pRightBorderWidthState
&& pTopBorderWidthState
&& pBottomBorderWidthState
)
361 table::BorderLine2 aLeft
, aRight
, aTop
, aBottom
;
363 pLeftBorderWidthState
->maValue
>>= aLeft
;
364 pRightBorderWidthState
->maValue
>>= aRight
;
365 pTopBorderWidthState
->maValue
>>= aTop
;
366 pBottomBorderWidthState
->maValue
>>= aBottom
;
367 if( aLeft
.InnerLineWidth
== aRight
.InnerLineWidth
&& aLeft
.OuterLineWidth
== aRight
.OuterLineWidth
&&
368 aLeft
.LineDistance
== aRight
.LineDistance
&& aLeft
.InnerLineWidth
== aTop
.InnerLineWidth
&&
369 aLeft
.OuterLineWidth
== aTop
.OuterLineWidth
&& aLeft
.LineDistance
== aTop
.LineDistance
&&
370 aLeft
.InnerLineWidth
== aBottom
.InnerLineWidth
&& aLeft
.OuterLineWidth
== aBottom
.OuterLineWidth
&&
371 aLeft
.LineDistance
== aBottom
.LineDistance
&& aLeft
.LineWidth
== aRight
.LineWidth
&&
372 aLeft
.LineWidth
== aTop
.LineWidth
&& aLeft
.LineWidth
== aBottom
.LineWidth
)
374 pLeftBorderWidthState
->mnIndex
= -1;
375 pLeftBorderWidthState
->maValue
.clear();
376 pRightBorderWidthState
->mnIndex
= -1;
377 pRightBorderWidthState
->maValue
.clear();
378 pTopBorderWidthState
->mnIndex
= -1;
379 pTopBorderWidthState
->maValue
.clear();
380 pBottomBorderWidthState
->mnIndex
= -1;
381 pBottomBorderWidthState
->maValue
.clear();
385 pAllBorderWidthState
->mnIndex
= -1;
386 pAllBorderWidthState
->maValue
.clear();
391 pAllBorderWidthState
->mnIndex
= -1;
392 pAllBorderWidthState
->maValue
.clear();
398 pParaAdjust
->mnIndex
= -1;
399 pParaAdjust
->maValue
.clear();
403 pParaAdjustLast
->mnIndex
= -1;
404 pParaAdjustLast
->maValue
.clear();
408 pSWBorder
->mnIndex
= -1;
409 pSWBorder
->maValue
.clear();
413 pSWBorder_Left
->mnIndex
= -1;
414 pSWBorder_Left
->maValue
.clear();
418 pSWBorder_Right
->mnIndex
= -1;
419 pSWBorder_Right
->maValue
.clear();
421 if (pSWBorder_Bottom
)
423 pSWBorder_Bottom
->mnIndex
= -1;
424 pSWBorder_Bottom
->maValue
.clear();
428 pSWBorder_Top
->mnIndex
= -1;
429 pSWBorder_Top
->maValue
.clear();
431 if (pSWAllBorderWidthState
)
433 pSWAllBorderWidthState
->mnIndex
= -1;
434 pSWAllBorderWidthState
->maValue
.clear();
436 if (pSWLeftBorderWidthState
)
438 pSWLeftBorderWidthState
->mnIndex
= -1;
439 pSWLeftBorderWidthState
->maValue
.clear();
441 if (pSWRightBorderWidthState
)
443 pSWRightBorderWidthState
->mnIndex
= -1;
444 pSWRightBorderWidthState
->maValue
.clear();
446 if (pSWTopBorderWidthState
)
448 pSWTopBorderWidthState
->mnIndex
= -1;
449 pSWTopBorderWidthState
->maValue
.clear();
451 if (pSWBottomBorderWidthState
)
453 pSWBottomBorderWidthState
->mnIndex
= -1;
454 pSWBottomBorderWidthState
->maValue
.clear();
459 pParaMarginLeft
->mnIndex
= -1;
460 pParaMarginLeft
->maValue
.clear();
462 if (pParaMarginLeftRel
)
464 pParaMarginLeftRel
->mnIndex
= -1;
465 pParaMarginLeftRel
->maValue
.clear();
467 if (pParaMarginRight
)
469 pParaMarginRight
->mnIndex
= -1;
470 pParaMarginRight
->maValue
.clear();
472 if (pParaMarginRightRel
)
474 pParaMarginRightRel
->mnIndex
= -1;
475 pParaMarginRightRel
->maValue
.clear();
479 pParaMarginTop
->mnIndex
= -1;
480 pParaMarginTop
->maValue
.clear();
482 if (pParaMarginTopRel
)
484 pParaMarginTopRel
->mnIndex
= -1;
485 pParaMarginTopRel
->maValue
.clear();
487 if (pParaMarginBottom
)
489 pParaMarginBottom
->mnIndex
= -1;
490 pParaMarginBottom
->maValue
.clear();
492 if (pParaMarginBottomRel
)
494 pParaMarginBottomRel
->mnIndex
= -1;
495 pParaMarginBottomRel
->maValue
.clear();
498 // #i102690# old diagonal line attribute names without "s" are only read, not written
499 if (pDiagonalTLBRWidthState
)
501 pDiagonalTLBRWidthState
->mnIndex
= -1;
502 pDiagonalTLBRWidthState
->maValue
.clear();
504 if (pDiagonalBLTRWidthState
)
506 pDiagonalBLTRWidthState
->mnIndex
= -1;
507 pDiagonalBLTRWidthState
->maValue
.clear();
510 SvXMLExportPropertyMapper::ContextFilter(bEnableFoFontFamily
, rProperties
, rPropSet
);
513 /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
514 void ScXMLCellExportPropertyMapper::handleSpecialItem(
515 SvXMLAttributeList
& /* rAttrList */,
516 const XMLPropertyState
& /* rProperty */,
517 const SvXMLUnitConverter
& /* rUnitConverter */,
518 const SvXMLNamespaceMap
& /* rNamespaceMap */,
519 const ::std::vector
< XMLPropertyState
> * /* pProperties */,
520 sal_uInt32
/* nIdx */ ) const
522 // the SpecialItem NumberFormat must not be handled by this method
523 // the SpecialItem ConditionlaFormat must not be handled by this method
524 // the SpecialItem CharBackColor must not be handled by this method
526 void ScXMLCellExportPropertyMapper::handleElementItem(
527 SvXMLExport
& rExport
,
528 const XMLPropertyState
& rProperty
,
529 SvXmlExportFlags
/* nFlags */,
530 const ::std::vector
< XMLPropertyState
> * /* pProperties */,
531 sal_uInt32
/* nIdx */) const
533 sal_uInt32 nContextId
= getPropertySetMapper()->GetEntryContextId( rProperty
.mnIndex
);
535 if ( ( nContextId
== CTF_SC_HYPERLINK
) &&
536 ( rProperty
.maValue
>>= sURL
) &&
539 rExport
.AddAttribute( XML_NAMESPACE_XLINK
, XML_HREF
, sURL
);
540 rExport
.AddAttribute( XML_NAMESPACE_XLINK
, XML_TYPE
,
542 sal_uInt32 nPropIndex
= rProperty
.mnIndex
;
543 sal_uInt16 nPrefix
= getPropertySetMapper()->GetEntryNameSpace( nPropIndex
);
544 OUString sLocalName
= getPropertySetMapper()->GetEntryXMLName( nPropIndex
);
545 SvXMLElementExport
aElem( rExport
, nPrefix
, sLocalName
, true, true );
549 ScXMLRowExportPropertyMapper::ScXMLRowExportPropertyMapper(
550 const rtl::Reference
< XMLPropertySetMapper
>& rMapper
)
551 : SvXMLExportPropertyMapper(rMapper
)
555 ScXMLRowExportPropertyMapper::~ScXMLRowExportPropertyMapper()
559 void ScXMLRowExportPropertyMapper::ContextFilter(
560 bool /* bEnableFoFontFamily */,
561 ::std::vector
< XMLPropertyState
>& /* rProperties */,
562 uno::Reference
< beans::XPropertySet
> /* rPropSet */ ) const
564 //#108550#; don't filter the height, so other applications know the calculated height
567 ScXMLColumnExportPropertyMapper::ScXMLColumnExportPropertyMapper(
568 const rtl::Reference
< XMLPropertySetMapper
>& rMapper
)
569 : SvXMLExportPropertyMapper(rMapper
)
573 ScXMLColumnExportPropertyMapper::~ScXMLColumnExportPropertyMapper()
577 /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
578 void ScXMLColumnExportPropertyMapper::handleSpecialItem(
579 SvXMLAttributeList
& /* rAttrList */,
580 const XMLPropertyState
& /* rProperty */,
581 const SvXMLUnitConverter
& /* rUnitConverter */,
582 const SvXMLNamespaceMap
& /* rNamespaceMap */,
583 const ::std::vector
< XMLPropertyState
> * /* pProperties */,
584 sal_uInt32
/* nIdx */ ) const
586 // the SpecialItem IsVisible must not be handled by this method
589 ScXMLTableExportPropertyMapper::ScXMLTableExportPropertyMapper(
590 const rtl::Reference
< XMLPropertySetMapper
>& rMapper
)
591 : SvXMLExportPropertyMapper(rMapper
)
595 ScXMLTableExportPropertyMapper::~ScXMLTableExportPropertyMapper()
599 /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
600 void ScXMLTableExportPropertyMapper::handleSpecialItem(
601 SvXMLAttributeList
& /* rAttrList */,
602 const XMLPropertyState
& /* rProperty */,
603 const SvXMLUnitConverter
& /* rUnitConverter */,
604 const SvXMLNamespaceMap
& /* rNamespaceMap */,
605 const ::std::vector
< XMLPropertyState
> * /* pProperties */,
606 sal_uInt32
/* nIdx */ ) const
608 // the SpecialItem PageStyle must not be handled by this method
611 void ScXMLAutoStylePoolP::exportStyleAttributes(
612 SvXMLAttributeList
& rAttrList
,
614 const ::std::vector
< XMLPropertyState
>& rProperties
,
615 const SvXMLExportPropertyMapper
& rPropExp
616 , const SvXMLUnitConverter
& rUnitConverter
,
617 const SvXMLNamespaceMap
& rNamespaceMap
620 SvXMLAutoStylePoolP::exportStyleAttributes( rAttrList
, nFamily
, rProperties
, rPropExp
, rUnitConverter
, rNamespaceMap
);
621 if (nFamily
== XML_STYLE_FAMILY_TABLE_CELL
)
623 ::std::vector
< XMLPropertyState
>::const_iterator
i(rProperties
.begin());
624 ::std::vector
< XMLPropertyState
>::const_iterator
endi(rProperties
.end());
625 for(; i
!= endi
; ++i
)
627 rtl::Reference
< XMLPropertySetMapper
> aPropMapper(rScXMLExport
.GetCellStylesPropertySetMapper());
628 sal_Int16
nContextID(aPropMapper
->GetEntryContextId(i
->mnIndex
));
631 case CTF_SC_NUMBERFORMAT
:
633 sal_Int32 nNumberFormat
= 0;
634 if (i
->maValue
>>= nNumberFormat
)
636 OUString
sAttrValue(rScXMLExport
.getDataStyleName(nNumberFormat
));
637 if (!sAttrValue
.isEmpty())
639 GetExport().AddAttribute(
640 aPropMapper
->GetEntryNameSpace(i
->mnIndex
),
641 aPropMapper
->GetEntryXMLName(i
->mnIndex
),
650 else if (nFamily
== XML_STYLE_FAMILY_TABLE_TABLE
)
652 ::std::vector
< XMLPropertyState
>::const_iterator
i(rProperties
.begin());
653 ::std::vector
< XMLPropertyState
>::const_iterator
endi(rProperties
.end());
654 for(; i
!= endi
; ++i
)
656 rtl::Reference
< XMLPropertySetMapper
> aPropMapper(rScXMLExport
.GetTableStylesPropertySetMapper());
657 sal_Int16
nContextID(aPropMapper
->GetEntryContextId(i
->mnIndex
));
660 case CTF_SC_MASTERPAGENAME
:
663 if (i
->maValue
>>= sName
)
665 GetExport().AddAttribute(
666 aPropMapper
->GetEntryNameSpace(i
->mnIndex
),
667 aPropMapper
->GetEntryXMLName(i
->mnIndex
),
668 GetExport().EncodeStyleName( sName
));
677 void ScXMLAutoStylePoolP::exportStyleContent(
678 const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XDocumentHandler
> & rHandler
,
680 const std::vector
< XMLPropertyState
>& rProperties
,
681 const SvXMLExportPropertyMapper
& rPropExp
682 , const SvXMLUnitConverter
& rUnitConverter
,
683 const SvXMLNamespaceMap
& rNamespaceMap
686 SvXMLAutoStylePoolP::exportStyleContent( rHandler
, nFamily
, rProperties
, rPropExp
, rUnitConverter
, rNamespaceMap
);
687 if (nFamily
== XML_STYLE_FAMILY_TABLE_CELL
)
689 bool bNotFound
= true;
690 ::std::vector
< XMLPropertyState
>::const_iterator
i(rProperties
.begin());
691 ::std::vector
< XMLPropertyState
>::const_iterator
endi(rProperties
.end());
692 for(; i
!= endi
&& bNotFound
; ++i
)
694 if (i
->mnIndex
!= -1)
696 sal_Int16 nContextID
= rScXMLExport
.GetCellStylesPropertySetMapper()->GetEntryContextId(i
->mnIndex
);
701 uno::Reference
<container::XIndexAccess
> xIndex( i
->maValue
, uno::UNO_QUERY
);
704 sal_Int32
nConditionCount(xIndex
->getCount());
705 for (sal_Int32 nCondition
= 0; nCondition
< nConditionCount
; ++nCondition
)
707 uno::Reference
<sheet::XSheetConditionalEntry
> xSheetConditionalEntry(xIndex
->getByIndex(nCondition
), uno::UNO_QUERY
);
708 if (xSheetConditionalEntry
.is())
710 OUString
sStyleName(xSheetConditionalEntry
->getStyleName());
711 uno::Reference
<sheet::XSheetCondition
> xSheetCondition(xSheetConditionalEntry
, uno::UNO_QUERY
);
712 if (xSheetCondition
.is())
714 sheet::ConditionOperator aOperator
= xSheetCondition
->getOperator();
715 if (aOperator
!= sheet::ConditionOperator_NONE
)
717 if (aOperator
== sheet::ConditionOperator_FORMULA
)
719 OUString
sCondition("is-true-formula(");
720 sCondition
+= xSheetCondition
->getFormula1();
722 rScXMLExport
.AddAttribute(XML_NAMESPACE_STYLE
, XML_CONDITION
, sCondition
);
723 rScXMLExport
.AddAttribute(XML_NAMESPACE_STYLE
, XML_APPLY_STYLE_NAME
, rScXMLExport
.EncodeStyleName( sStyleName
));
724 OUString sOUBaseAddress
;
725 ScDocument
* pDoc
= rScXMLExport
.GetDocument();
726 ScRangeStringConverter::GetStringFromAddress( sOUBaseAddress
,
727 xSheetCondition
->getSourcePosition(), pDoc
, FormulaGrammar::CONV_OOO
);
728 rScXMLExport
.AddAttribute(XML_NAMESPACE_STYLE
, XML_BASE_CELL_ADDRESS
, sOUBaseAddress
);
729 SvXMLElementExport
aMElem(rScXMLExport
, XML_NAMESPACE_STYLE
, XML_MAP
, true, true);
734 if (aOperator
== sheet::ConditionOperator_BETWEEN
||
735 aOperator
== sheet::ConditionOperator_NOT_BETWEEN
)
737 if (aOperator
== sheet::ConditionOperator_BETWEEN
)
738 sCondition
= "cell-content-is-between(";
740 sCondition
= "cell-content-is-not-between(";
741 sCondition
+= xSheetCondition
->getFormula1();
743 sCondition
+= xSheetCondition
->getFormula2();
748 sCondition
= "cell-content()";
751 case sheet::ConditionOperator_LESS
:
754 case sheet::ConditionOperator_GREATER
:
757 case sheet::ConditionOperator_LESS_EQUAL
:
760 case sheet::ConditionOperator_GREATER_EQUAL
:
763 case sheet::ConditionOperator_EQUAL
:
766 case sheet::ConditionOperator_NOT_EQUAL
:
771 // added to avoid warnings
774 sCondition
+= xSheetCondition
->getFormula1();
776 rScXMLExport
.AddAttribute(XML_NAMESPACE_STYLE
, XML_CONDITION
, sCondition
);
777 rScXMLExport
.AddAttribute(XML_NAMESPACE_STYLE
, XML_APPLY_STYLE_NAME
, rScXMLExport
.EncodeStyleName( sStyleName
));
778 OUString sOUBaseAddress
;
779 ScRangeStringConverter::GetStringFromAddress( sOUBaseAddress
,
780 xSheetCondition
->getSourcePosition(), rScXMLExport
.GetDocument(), FormulaGrammar::CONV_OOO
);
781 rScXMLExport
.AddAttribute(XML_NAMESPACE_STYLE
, XML_BASE_CELL_ADDRESS
, sOUBaseAddress
);
782 SvXMLElementExport
aMElem(rScXMLExport
, XML_NAMESPACE_STYLE
, XML_MAP
, true, true);
797 ScXMLAutoStylePoolP::ScXMLAutoStylePoolP(ScXMLExport
& rTempScXMLExport
):
798 SvXMLAutoStylePoolP(rTempScXMLExport
),
799 rScXMLExport(rTempScXMLExport
)
803 ScXMLAutoStylePoolP::~ScXMLAutoStylePoolP()
807 void ScXMLStyleExport::exportStyleAttributes(
808 const ::com::sun::star::uno::Reference
<
809 ::com::sun::star::style::XStyle
> & rStyle
)
811 uno::Reference
< beans::XPropertySet
> xPropSet( rStyle
, uno::UNO_QUERY
);
814 uno::Reference
< beans::XPropertySetInfo
> xPropSetInfo(xPropSet
->getPropertySetInfo());
815 OUString
sNumberFormat("NumberFormat");
816 if( xPropSetInfo
->hasPropertyByName( sNumberFormat
) )
818 uno::Reference
< beans::XPropertyState
> xPropState( xPropSet
, uno::UNO_QUERY
);
819 if( xPropState
.is() && (beans::PropertyState_DIRECT_VALUE
==
820 xPropState
->getPropertyState( sNumberFormat
)) )
822 sal_Int32 nNumberFormat
= 0;
823 if (xPropSet
->getPropertyValue( sNumberFormat
) >>= nNumberFormat
)
824 GetExport().AddAttribute( XML_NAMESPACE_STYLE
, XML_DATA_STYLE_NAME
,
825 GetExport().getDataStyleName(nNumberFormat
) );
831 void ScXMLStyleExport::exportStyleContent(
832 const ::com::sun::star::uno::Reference
<
833 ::com::sun::star::style::XStyle
> & /* rStyle */ )
837 ScXMLStyleExport::ScXMLStyleExport(
839 const OUString
& rPoolStyleName
,
840 SvXMLAutoStylePoolP
*pAutoStyleP
)
841 : XMLStyleExport(rExp
, rPoolStyleName
, pAutoStyleP
)
845 ScXMLStyleExport::~ScXMLStyleExport()
849 XMLScPropHdlFactory::XMLScPropHdlFactory()
850 : XMLPropertyHandlerFactory()
854 XMLScPropHdlFactory::~XMLScPropHdlFactory()
858 const XMLPropertyHandler
* XMLScPropHdlFactory::GetPropertyHandler( sal_Int32 nType
) const
860 nType
&= MID_FLAG_MASK
;
862 XMLPropertyHandler
* pHdl(const_cast<XMLPropertyHandler
*>(XMLPropertyHandlerFactory::GetPropertyHandler( nType
)));
867 case XML_SC_TYPE_CELLPROTECTION
:
869 pHdl
= new XmlScPropHdl_CellProtection
;
872 case XML_SC_TYPE_PRINTCONTENT
:
874 pHdl
= new XmlScPropHdl_PrintContent
;
877 case XML_SC_TYPE_HORIJUSTIFY_METHOD
:
878 case XML_SC_TYPE_VERTJUSTIFY_METHOD
:
880 pHdl
= new XmlScPropHdl_JustifyMethod
;
883 case XML_SC_TYPE_HORIJUSTIFY
:
885 pHdl
= new XmlScPropHdl_HoriJustify
;
888 case XML_SC_TYPE_HORIJUSTIFYSOURCE
:
890 pHdl
= new XmlScPropHdl_HoriJustifySource
;
893 case XML_SC_TYPE_HORIJUSTIFYREPEAT
:
895 pHdl
= new XmlScPropHdl_HoriJustifyRepeat
;
898 case XML_SC_TYPE_ORIENTATION
:
900 pHdl
= new XmlScPropHdl_Orientation
;
903 case XML_SC_TYPE_ROTATEANGLE
:
905 pHdl
= new XmlScPropHdl_RotateAngle
;
908 case XML_SC_TYPE_ROTATEREFERENCE
:
910 pHdl
= new XmlScPropHdl_RotateReference
;
913 case XML_SC_TYPE_VERTJUSTIFY
:
915 pHdl
= new XmlScPropHdl_VertJustify
;
918 case XML_SC_TYPE_BREAKBEFORE
:
920 pHdl
= new XmlScPropHdl_BreakBefore
;
923 case XML_SC_ISTEXTWRAPPED
:
925 pHdl
= new XmlScPropHdl_IsTextWrapped
;
928 case XML_SC_TYPE_EQUAL
:
930 pHdl
= new XmlScPropHdl_IsEqual
;
933 case XML_SC_TYPE_VERTICAL
:
935 pHdl
= new XmlScPropHdl_Vertical
;
941 PutHdlCache(nType
, pHdl
);
947 XmlScPropHdl_CellProtection::~XmlScPropHdl_CellProtection()
951 bool XmlScPropHdl_CellProtection::equals(
952 const ::com::sun::star::uno::Any
& r1
,
953 const ::com::sun::star::uno::Any
& r2
) const
955 util::CellProtection aCellProtection1
, aCellProtection2
;
957 if((r1
>>= aCellProtection1
) && (r2
>>= aCellProtection2
))
959 return ((aCellProtection1
.IsHidden
== aCellProtection2
.IsHidden
) &&
960 (aCellProtection1
.IsLocked
== aCellProtection2
.IsLocked
) &&
961 (aCellProtection1
.IsFormulaHidden
== aCellProtection2
.IsFormulaHidden
));
966 bool XmlScPropHdl_CellProtection::importXML(
967 const OUString
& rStrImpValue
,
968 ::com::sun::star::uno::Any
& rValue
,
969 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
973 util::CellProtection aCellProtection
;
974 bool bDefault(false);
975 if (!rValue
.hasValue())
977 aCellProtection
.IsHidden
= false;
978 aCellProtection
.IsLocked
= sal_True
;
979 aCellProtection
.IsFormulaHidden
= false;
980 aCellProtection
.IsPrintHidden
= false;
983 if ((rValue
>>= aCellProtection
) || bDefault
)
985 if (IsXMLToken(rStrImpValue
, XML_NONE
))
987 aCellProtection
.IsFormulaHidden
= false;
988 aCellProtection
.IsHidden
= false;
989 aCellProtection
.IsLocked
= false;
990 rValue
<<= aCellProtection
;
993 else if (IsXMLToken(rStrImpValue
, XML_HIDDEN_AND_PROTECTED
))
995 aCellProtection
.IsFormulaHidden
= sal_True
;
996 aCellProtection
.IsHidden
= sal_True
;
997 aCellProtection
.IsLocked
= sal_True
;
998 rValue
<<= aCellProtection
;
1001 else if (IsXMLToken(rStrImpValue
, XML_PROTECTED
))
1003 aCellProtection
.IsFormulaHidden
= false;
1004 aCellProtection
.IsHidden
= false;
1005 aCellProtection
.IsLocked
= sal_True
;
1006 rValue
<<= aCellProtection
;
1009 else if (IsXMLToken(rStrImpValue
, XML_FORMULA_HIDDEN
))
1011 aCellProtection
.IsFormulaHidden
= sal_True
;
1012 aCellProtection
.IsHidden
= false;
1013 aCellProtection
.IsLocked
= false;
1014 rValue
<<= aCellProtection
;
1020 while (i
< rStrImpValue
.getLength() && rStrImpValue
[i
] != ' ')
1022 OUString
sFirst(rStrImpValue
.copy(0, i
));
1023 OUString
sSecond(rStrImpValue
.copy(i
+ 1));
1024 aCellProtection
.IsFormulaHidden
= false;
1025 aCellProtection
.IsHidden
= false;
1026 aCellProtection
.IsLocked
= false;
1027 if ((IsXMLToken(sFirst
, XML_PROTECTED
)) || (IsXMLToken(sSecond
, XML_PROTECTED
)))
1028 aCellProtection
.IsLocked
= sal_True
;
1029 if ((IsXMLToken(sFirst
, XML_FORMULA_HIDDEN
)) || (IsXMLToken(sSecond
, XML_FORMULA_HIDDEN
)))
1030 aCellProtection
.IsFormulaHidden
= sal_True
;
1031 rValue
<<= aCellProtection
;
1039 bool XmlScPropHdl_CellProtection::exportXML(
1040 OUString
& rStrExpValue
,
1041 const ::com::sun::star::uno::Any
& rValue
,
1042 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1044 bool bRetval(false);
1045 util::CellProtection aCellProtection
;
1047 if(rValue
>>= aCellProtection
)
1049 if (!(aCellProtection
.IsFormulaHidden
|| aCellProtection
.IsHidden
|| aCellProtection
.IsLocked
))
1051 rStrExpValue
= GetXMLToken(XML_NONE
);
1054 else if (aCellProtection
.IsHidden
)
1056 // #i105964# "Hide all" implies "Protected" in the UI, so it must be saved as "hidden-and-protected"
1057 // even if "IsLocked" is not set in the CellProtection struct.
1058 rStrExpValue
= GetXMLToken(XML_HIDDEN_AND_PROTECTED
);
1061 else if (aCellProtection
.IsLocked
&& !(aCellProtection
.IsFormulaHidden
|| aCellProtection
.IsHidden
))
1063 rStrExpValue
= GetXMLToken(XML_PROTECTED
);
1066 else if (aCellProtection
.IsFormulaHidden
&& !(aCellProtection
.IsLocked
|| aCellProtection
.IsHidden
))
1068 rStrExpValue
= GetXMLToken(XML_FORMULA_HIDDEN
);
1071 else if (aCellProtection
.IsFormulaHidden
&& aCellProtection
.IsLocked
)
1073 rStrExpValue
= GetXMLToken(XML_PROTECTED
);
1074 rStrExpValue
+= " ";
1075 rStrExpValue
+= GetXMLToken(XML_FORMULA_HIDDEN
);
1083 XmlScPropHdl_PrintContent::~XmlScPropHdl_PrintContent()
1087 bool XmlScPropHdl_PrintContent::equals(
1088 const ::com::sun::star::uno::Any
& r1
,
1089 const ::com::sun::star::uno::Any
& r2
) const
1091 util::CellProtection aCellProtection1
, aCellProtection2
;
1093 if((r1
>>= aCellProtection1
) && (r2
>>= aCellProtection2
))
1095 return (aCellProtection1
.IsPrintHidden
== aCellProtection2
.IsPrintHidden
);
1100 bool XmlScPropHdl_PrintContent::importXML(
1101 const OUString
& rStrImpValue
,
1102 ::com::sun::star::uno::Any
& rValue
,
1103 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1105 bool bRetval(false);
1106 util::CellProtection aCellProtection
;
1107 bool bDefault(false);
1108 if (!rValue
.hasValue())
1110 aCellProtection
.IsHidden
= false;
1111 aCellProtection
.IsLocked
= sal_True
;
1112 aCellProtection
.IsFormulaHidden
= false;
1113 aCellProtection
.IsPrintHidden
= false;
1116 if ((rValue
>>= aCellProtection
) || bDefault
)
1119 if (::sax::Converter::convertBool(bValue
, rStrImpValue
))
1121 aCellProtection
.IsPrintHidden
= !bValue
;
1122 rValue
<<= aCellProtection
;
1130 bool XmlScPropHdl_PrintContent::exportXML(
1131 OUString
& rStrExpValue
,
1132 const ::com::sun::star::uno::Any
& rValue
,
1133 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1135 bool bRetval(false);
1137 util::CellProtection aCellProtection
;
1138 if(rValue
>>= aCellProtection
)
1140 OUStringBuffer sValue
;
1141 ::sax::Converter::convertBool(sValue
, !aCellProtection
.IsPrintHidden
);
1142 rStrExpValue
= sValue
.makeStringAndClear();
1149 XmlScPropHdl_JustifyMethod::~XmlScPropHdl_JustifyMethod()
1153 bool XmlScPropHdl_JustifyMethod::equals(
1154 const ::com::sun::star::uno::Any
& r1
,
1155 const ::com::sun::star::uno::Any
& r2
) const
1157 sal_Int32
nVal1(0), nVal2(0);
1159 if((r1
>>= nVal1
) && (r2
>>= nVal2
))
1160 return (nVal1
== nVal2
);
1164 bool XmlScPropHdl_JustifyMethod::importXML(
1165 const OUString
& rStrImpValue
,
1166 ::com::sun::star::uno::Any
& rValue
,
1167 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1169 bool bRetval
= false;
1171 sal_Int32 nValue
= table::CellJustifyMethod::AUTO
;
1172 if (IsXMLToken(rStrImpValue
, XML_AUTO
))
1174 nValue
= table::CellJustifyMethod::AUTO
;
1178 else if (IsXMLToken(rStrImpValue
, XML_DISTRIBUTE
))
1180 nValue
= table::CellJustifyMethod::DISTRIBUTE
;
1190 bool XmlScPropHdl_JustifyMethod::exportXML(
1191 OUString
& rStrExpValue
,
1192 const ::com::sun::star::uno::Any
& rValue
,
1193 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1196 bool bRetval
= false;
1198 if (rValue
>>= nVal
)
1202 case table::CellJustifyMethod::AUTO
:
1204 rStrExpValue
= GetXMLToken(XML_AUTO
);
1208 case table::CellJustifyMethod::DISTRIBUTE
:
1210 rStrExpValue
= GetXMLToken(XML_DISTRIBUTE
);
1216 // added to avoid warnings
1223 XmlScPropHdl_HoriJustify::~XmlScPropHdl_HoriJustify()
1227 bool XmlScPropHdl_HoriJustify::equals(
1228 const ::com::sun::star::uno::Any
& r1
,
1229 const ::com::sun::star::uno::Any
& r2
) const
1231 table::CellHoriJustify aHoriJustify1
, aHoriJustify2
;
1233 if((r1
>>= aHoriJustify1
) && (r2
>>= aHoriJustify2
))
1234 return (aHoriJustify1
== aHoriJustify2
);
1238 bool XmlScPropHdl_HoriJustify::importXML(
1239 const OUString
& rStrImpValue
,
1240 ::com::sun::star::uno::Any
& rValue
,
1241 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1243 bool bRetval(false);
1245 table::CellHoriJustify nValue
= table::CellHoriJustify_LEFT
;
1247 if (nValue
!= table::CellHoriJustify_REPEAT
)
1249 if (IsXMLToken(rStrImpValue
, XML_START
))
1251 nValue
= table::CellHoriJustify_LEFT
;
1255 else if (IsXMLToken(rStrImpValue
, XML_END
))
1257 nValue
= table::CellHoriJustify_RIGHT
;
1261 else if (IsXMLToken(rStrImpValue
, XML_CENTER
))
1263 nValue
= table::CellHoriJustify_CENTER
;
1267 else if (IsXMLToken(rStrImpValue
, XML_JUSTIFY
))
1269 nValue
= table::CellHoriJustify_BLOCK
;
1280 bool XmlScPropHdl_HoriJustify::exportXML(
1281 OUString
& rStrExpValue
,
1282 const ::com::sun::star::uno::Any
& rValue
,
1283 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1285 table::CellHoriJustify nVal
;
1286 bool bRetval(false);
1292 case table::CellHoriJustify_REPEAT
:
1293 case table::CellHoriJustify_LEFT
:
1295 rStrExpValue
= GetXMLToken(XML_START
);
1299 case table::CellHoriJustify_RIGHT
:
1301 rStrExpValue
= GetXMLToken(XML_END
);
1305 case table::CellHoriJustify_CENTER
:
1307 rStrExpValue
= GetXMLToken(XML_CENTER
);
1311 case table::CellHoriJustify_BLOCK
:
1313 rStrExpValue
= GetXMLToken(XML_JUSTIFY
);
1319 // added to avoid warnings
1327 XmlScPropHdl_HoriJustifySource::~XmlScPropHdl_HoriJustifySource()
1331 bool XmlScPropHdl_HoriJustifySource::equals(
1332 const ::com::sun::star::uno::Any
& r1
,
1333 const ::com::sun::star::uno::Any
& r2
) const
1335 table::CellHoriJustify aHoriJustify1
, aHoriJustify2
;
1337 if((r1
>>= aHoriJustify1
) && (r2
>>= aHoriJustify2
))
1338 return (aHoriJustify1
== aHoriJustify2
);
1342 bool XmlScPropHdl_HoriJustifySource::importXML(
1343 const OUString
& rStrImpValue
,
1344 ::com::sun::star::uno::Any
& rValue
,
1345 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1347 bool bRetval(false);
1349 if (IsXMLToken(rStrImpValue
, XML_FIX
))
1353 else if (IsXMLToken(rStrImpValue
, XML_VALUE_TYPE
))
1355 table::CellHoriJustify
nValue(table::CellHoriJustify_STANDARD
);
1363 bool XmlScPropHdl_HoriJustifySource::exportXML(
1364 OUString
& rStrExpValue
,
1365 const ::com::sun::star::uno::Any
& rValue
,
1366 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1368 table::CellHoriJustify nVal
;
1369 bool bRetval(false);
1373 if (nVal
== table::CellHoriJustify_STANDARD
)
1375 rStrExpValue
= GetXMLToken(XML_VALUE_TYPE
);
1380 rStrExpValue
= GetXMLToken(XML_FIX
);
1388 XmlScPropHdl_HoriJustifyRepeat::~XmlScPropHdl_HoriJustifyRepeat()
1392 bool XmlScPropHdl_HoriJustifyRepeat::equals(
1393 const ::com::sun::star::uno::Any
& r1
,
1394 const ::com::sun::star::uno::Any
& r2
) const
1396 table::CellHoriJustify aHoriJustify1
, aHoriJustify2
;
1398 if((r1
>>= aHoriJustify1
) && (r2
>>= aHoriJustify2
))
1399 return (aHoriJustify1
== aHoriJustify2
);
1403 bool XmlScPropHdl_HoriJustifyRepeat::importXML(
1404 const OUString
& rStrImpValue
,
1405 ::com::sun::star::uno::Any
& rValue
,
1406 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1408 bool bRetval(false);
1410 if (IsXMLToken(rStrImpValue
, XML_FALSE
))
1414 else if (IsXMLToken(rStrImpValue
, XML_TRUE
))
1416 table::CellHoriJustify nValue
= table::CellHoriJustify_REPEAT
;
1424 bool XmlScPropHdl_HoriJustifyRepeat::exportXML(
1425 OUString
& rStrExpValue
,
1426 const ::com::sun::star::uno::Any
& rValue
,
1427 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1429 table::CellHoriJustify nVal
;
1430 bool bRetval(false);
1434 if (nVal
== table::CellHoriJustify_REPEAT
)
1436 rStrExpValue
= GetXMLToken(XML_TRUE
);
1441 rStrExpValue
= GetXMLToken(XML_FALSE
);
1449 XmlScPropHdl_Orientation::~XmlScPropHdl_Orientation()
1453 bool XmlScPropHdl_Orientation::equals(
1454 const ::com::sun::star::uno::Any
& r1
,
1455 const ::com::sun::star::uno::Any
& r2
) const
1457 table::CellOrientation aOrientation1
, aOrientation2
;
1459 if((r1
>>= aOrientation1
) && (r2
>>= aOrientation2
))
1460 return (aOrientation1
== aOrientation2
);
1464 bool XmlScPropHdl_Orientation::importXML(
1465 const OUString
& rStrImpValue
,
1466 ::com::sun::star::uno::Any
& rValue
,
1467 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1469 bool bRetval(false);
1471 table::CellOrientation nValue
;
1472 if (IsXMLToken(rStrImpValue
, XML_LTR
))
1474 nValue
= table::CellOrientation_STANDARD
;
1478 else if (IsXMLToken(rStrImpValue
, XML_TTB
))
1480 nValue
= table::CellOrientation_STACKED
;
1488 bool XmlScPropHdl_Orientation::exportXML(
1489 OUString
& rStrExpValue
,
1490 const ::com::sun::star::uno::Any
& rValue
,
1491 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1493 table::CellOrientation nVal
;
1494 bool bRetval(false);
1500 case table::CellOrientation_STACKED
:
1502 rStrExpValue
= GetXMLToken(XML_TTB
);
1508 rStrExpValue
= GetXMLToken(XML_LTR
);
1518 XmlScPropHdl_RotateAngle::~XmlScPropHdl_RotateAngle()
1522 bool XmlScPropHdl_RotateAngle::equals(
1523 const ::com::sun::star::uno::Any
& r1
,
1524 const ::com::sun::star::uno::Any
& r2
) const
1526 sal_Int32 aAngle1
= 0, aAngle2
= 0;
1528 if((r1
>>= aAngle1
) && (r2
>>= aAngle2
))
1529 return (aAngle1
== aAngle2
);
1533 bool XmlScPropHdl_RotateAngle::importXML(
1534 const OUString
& rStrImpValue
,
1535 ::com::sun::star::uno::Any
& rValue
,
1536 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1538 bool bRetval(false);
1541 if (::sax::Converter::convertNumber(nValue
, rStrImpValue
))
1551 bool XmlScPropHdl_RotateAngle::exportXML(
1552 OUString
& rStrExpValue
,
1553 const ::com::sun::star::uno::Any
& rValue
,
1554 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1557 bool bRetval(false);
1561 OUStringBuffer sValue
;
1562 ::sax::Converter::convertNumber(sValue
, sal_Int32(nVal
/ 100));
1563 rStrExpValue
= sValue
.makeStringAndClear();
1570 XmlScPropHdl_RotateReference::~XmlScPropHdl_RotateReference()
1574 bool XmlScPropHdl_RotateReference::equals(
1575 const ::com::sun::star::uno::Any
& r1
,
1576 const ::com::sun::star::uno::Any
& r2
) const
1578 sal_Int32
aReference1(0), aReference2(0);
1580 if((r1
>>= aReference1
) && (r2
>>= aReference2
))
1581 return (aReference1
== aReference2
);
1585 bool XmlScPropHdl_RotateReference::importXML(
1586 const OUString
& rStrImpValue
,
1587 ::com::sun::star::uno::Any
& rValue
,
1588 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1590 bool bRetval(false);
1593 if (IsXMLToken(rStrImpValue
, XML_NONE
))
1595 nValue
= table::CellVertJustify2::STANDARD
;
1599 else if (IsXMLToken(rStrImpValue
, XML_BOTTOM
))
1601 nValue
= table::CellVertJustify2::BOTTOM
;
1605 else if (IsXMLToken(rStrImpValue
, XML_TOP
))
1607 nValue
= table::CellVertJustify2::TOP
;
1611 else if (IsXMLToken(rStrImpValue
, XML_CENTER
))
1613 nValue
= table::CellVertJustify2::CENTER
;
1621 bool XmlScPropHdl_RotateReference::exportXML(
1622 OUString
& rStrExpValue
,
1623 const ::com::sun::star::uno::Any
& rValue
,
1624 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1627 bool bRetval(false);
1633 case table::CellVertJustify2::BOTTOM
:
1635 rStrExpValue
= GetXMLToken(XML_BOTTOM
);
1639 case table::CellVertJustify2::CENTER
:
1641 rStrExpValue
= GetXMLToken(XML_CENTER
);
1645 case table::CellVertJustify2::STANDARD
:
1647 rStrExpValue
= GetXMLToken(XML_NONE
);
1651 case table::CellVertJustify2::TOP
:
1653 rStrExpValue
= GetXMLToken(XML_TOP
);
1659 // added to avoid warnings
1667 XmlScPropHdl_VertJustify::~XmlScPropHdl_VertJustify()
1671 bool XmlScPropHdl_VertJustify::equals(
1672 const ::com::sun::star::uno::Any
& r1
,
1673 const ::com::sun::star::uno::Any
& r2
) const
1675 sal_Int32
aReference1(0), aReference2(0);
1677 if((r1
>>= aReference1
) && (r2
>>= aReference2
))
1678 return (aReference1
== aReference2
);
1682 bool XmlScPropHdl_VertJustify::importXML(
1683 const OUString
& rStrImpValue
,
1684 ::com::sun::star::uno::Any
& rValue
,
1685 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1687 bool bRetval(false);
1690 if (IsXMLToken(rStrImpValue
, XML_AUTOMATIC
))
1692 nValue
= table::CellVertJustify2::STANDARD
;
1696 else if (IsXMLToken(rStrImpValue
, XML_BOTTOM
))
1698 nValue
= table::CellVertJustify2::BOTTOM
;
1702 else if (IsXMLToken(rStrImpValue
, XML_TOP
))
1704 nValue
= table::CellVertJustify2::TOP
;
1708 else if (IsXMLToken(rStrImpValue
, XML_MIDDLE
))
1710 nValue
= table::CellVertJustify2::CENTER
;
1714 else if (IsXMLToken(rStrImpValue
, XML_JUSTIFY
))
1716 nValue
= table::CellVertJustify2::BLOCK
;
1724 bool XmlScPropHdl_VertJustify::exportXML(
1725 OUString
& rStrExpValue
,
1726 const ::com::sun::star::uno::Any
& rValue
,
1727 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1730 bool bRetval(false);
1736 case table::CellVertJustify2::BOTTOM
:
1738 rStrExpValue
= GetXMLToken(XML_BOTTOM
);
1742 case table::CellVertJustify2::CENTER
:
1744 rStrExpValue
= GetXMLToken(XML_MIDDLE
);
1748 case table::CellVertJustify2::STANDARD
:
1750 rStrExpValue
= GetXMLToken(XML_AUTOMATIC
);
1754 case table::CellVertJustify2::TOP
:
1756 rStrExpValue
= GetXMLToken(XML_TOP
);
1760 case table::CellVertJustify2::BLOCK
:
1762 rStrExpValue
= GetXMLToken(XML_JUSTIFY
);
1768 // added to avoid warnings
1776 XmlScPropHdl_BreakBefore::~XmlScPropHdl_BreakBefore()
1780 bool XmlScPropHdl_BreakBefore::equals(
1781 const ::com::sun::star::uno::Any
& r1
,
1782 const ::com::sun::star::uno::Any
& r2
) const
1784 bool aBreak1
= false, aBreak2
= false;
1786 if((r1
>>= aBreak1
) && (r2
>>= aBreak2
))
1787 return (aBreak1
== aBreak2
);
1791 bool XmlScPropHdl_BreakBefore::importXML(
1792 const OUString
& rStrImpValue
,
1793 ::com::sun::star::uno::Any
& rValue
,
1794 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1796 bool bRetval(false);
1799 if (IsXMLToken(rStrImpValue
, XML_AUTO
))
1805 else if (IsXMLToken(rStrImpValue
, XML_PAGE
))
1815 bool XmlScPropHdl_BreakBefore::exportXML(
1816 OUString
& rStrExpValue
,
1817 const ::com::sun::star::uno::Any
& rValue
,
1818 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1820 bool bRetval(false);
1822 if(::cppu::any2bool(rValue
))
1824 rStrExpValue
= GetXMLToken(XML_PAGE
);
1829 rStrExpValue
= GetXMLToken(XML_AUTO
);
1836 XmlScPropHdl_IsTextWrapped::~XmlScPropHdl_IsTextWrapped()
1840 bool XmlScPropHdl_IsTextWrapped::equals(
1841 const ::com::sun::star::uno::Any
& r1
,
1842 const ::com::sun::star::uno::Any
& r2
) const
1844 return (::cppu::any2bool(r1
) == ::cppu::any2bool(r2
));
1847 bool XmlScPropHdl_IsTextWrapped::importXML(
1848 const OUString
& rStrImpValue
,
1849 ::com::sun::star::uno::Any
& rValue
,
1850 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1852 bool bRetval(false);
1854 if (IsXMLToken(rStrImpValue
, XML_WRAP
))
1859 else if (IsXMLToken(rStrImpValue
, XML_NO_WRAP
))
1868 bool XmlScPropHdl_IsTextWrapped::exportXML(
1869 OUString
& rStrExpValue
,
1870 const ::com::sun::star::uno::Any
& rValue
,
1871 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1873 bool bRetval(false);
1875 if (::cppu::any2bool(rValue
))
1877 rStrExpValue
= GetXMLToken(XML_WRAP
);
1882 rStrExpValue
= GetXMLToken(XML_NO_WRAP
);
1889 bool XmlScPropHdl_IsEqual::importXML( const OUString
& /* rStrImpValue */,
1890 ::com::sun::star::uno::Any
& /* rValue */,
1891 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1893 OSL_FAIL("should never be called");
1897 bool XmlScPropHdl_IsEqual::exportXML( OUString
& /* rStrExpValue */,
1898 const ::com::sun::star::uno::Any
& /* rValue */,
1899 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1901 OSL_FAIL("should never be called");
1905 XmlScPropHdl_Vertical::~XmlScPropHdl_Vertical()
1909 bool XmlScPropHdl_Vertical::equals(
1910 const ::com::sun::star::uno::Any
& r1
,
1911 const ::com::sun::star::uno::Any
& r2
) const
1913 return (::cppu::any2bool(r1
) == ::cppu::any2bool(r2
));
1916 bool XmlScPropHdl_Vertical::importXML(
1917 const OUString
& rStrImpValue
,
1918 ::com::sun::star::uno::Any
& rValue
,
1919 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1921 bool bRetval(false);
1923 if (IsXMLToken(rStrImpValue
, XML_AUTO
))
1928 else if (IsXMLToken(rStrImpValue
, XML_0
))
1937 bool XmlScPropHdl_Vertical::exportXML(
1938 OUString
& rStrExpValue
,
1939 const ::com::sun::star::uno::Any
& rValue
,
1940 const SvXMLUnitConverter
& /* rUnitConverter */ ) const
1942 bool bRetval(false);
1944 if (::cppu::any2bool(rValue
))
1946 rStrExpValue
= GetXMLToken(XML_AUTO
);
1951 rStrExpValue
= GetXMLToken(XML_0
);
1958 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */