1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sc.hxx"
26
27
28 #include "xmlstyle.hxx"
29 #include "xmlexprt.hxx"
30 #include "xmlimprt.hxx"
31
32 #include "XMLConverter.hxx"
33 #include "rangeutl.hxx"
34
35 #include <xmloff/xmlnmspe.hxx>
36 #include <xmloff/xmluconv.hxx>
37 #include <xmloff/xmltypes.hxx>
38 #include <xmloff/families.hxx>
39 #include <xmloff/xmlnumfe.hxx>
40 #include <xmloff/xmlnumfi.hxx>
41 #include <xmloff/nmspmap.hxx>
42 #include <xmloff/attrlist.hxx>
43 #include <xmloff/contextid.hxx>
44 #include <xmloff/txtprmap.hxx>
45 #include <tools/debug.hxx>
46 #include <com/sun/star/util/CellProtection.hpp>
47 #include <com/sun/star/table/CellOrientation.hpp>
48 #include <com/sun/star/table/CellVertJustify.hpp>
49 #include <com/sun/star/table/CellHoriJustify.hpp>
50 #include <com/sun/star/table/TableBorder.hpp>
51 #include <com/sun/star/sheet/XSheetConditionalEntries.hpp>
52 #include <com/sun/star/sheet/XSheetConditionalEntry.hpp>
53 #include <com/sun/star/sheet/XSheetCondition.hpp>
54 #include <com/sun/star/beans/XPropertyState.hpp>
55 #include <comphelper/extract.hxx>
56
57 #include <rtl/ustrbuf.hxx>
58
59 using namespace com::sun::star;
60 using namespace ::xmloff::token;
61 using namespace ::formula;
62 using ::rtl::OUString;
63
64 #define MAP(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, static_cast<sal_Int32>(type), context, SvtSaveOptions::ODFVER_010 }
65 #define MAP_EXT(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFVER_LATEST }
66 #define MAP_END() { NULL, 0, 0, XML_TOKEN_INVALID, 0, 0, SvtSaveOptions::ODFVER_010 }
67
68 const XMLPropertyMapEntry aXMLScCellStylesProperties[] =
69 {
70 MAP( "AsianVerticalMode", XML_NAMESPACE_STYLE, XML_GLYPH_ORIENTATION_VERTICAL, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_VERTICAL, 0),
71 MAP( "BottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_BOTTOMBORDER ),
72 MAP( "BottomBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_BOTTOMBORDERWIDTH ),
73 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 ),
74 MAP( "CellProtection", XML_NAMESPACE_STYLE, XML_CELL_PROTECT, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_CELLPROTECTION|MID_FLAG_MERGE_PROPERTY, 0 ),
75 MAP( "CellProtection", XML_NAMESPACE_STYLE, XML_PRINT_CONTENT, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_PRINTCONTENT|MID_FLAG_MERGE_PROPERTY, 0 ),
76 MAP( "CellStyle", XML_NAMESPACE_STYLE, XML_STYLE, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_STRING, CTF_SC_CELLSTYLE ),
77 MAP( "ConditionalFormatXML", XML_NAMESPACE_STYLE, XML_MAP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_IMPORT_MAP ),
78 MAP( "ConditionalFormatXML", XML_NAMESPACE_STYLE, XML_MAP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_MAP ),
79 MAP( "DiagonalBLTR", XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_DIAGONALBLTR ),
80 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
81 MAP( "DiagonalBLTR", XML_NAMESPACE_STYLE, XML_DIAGONAL_BL_TR_WIDTHS, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_DIAGONALBLTRWIDTHS ),
82 MAP( "DiagonalTLBR", XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_DIAGONALTLBR ),
83 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
84 MAP( "DiagonalTLBR", XML_NAMESPACE_STYLE, XML_DIAGONAL_TL_BR_WIDTHS, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_DIAGONALTLBRWIDTHS ),
85 MAP( "HoriJustify", XML_NAMESPACE_FO, XML_TEXT_ALIGN, XML_TYPE_PROP_PARAGRAPH|XML_SC_TYPE_HORIJUSTIFY|MID_FLAG_MERGE_PROPERTY, 0 ),
86 MAP( "HoriJustify", XML_NAMESPACE_STYLE, XML_TEXT_ALIGN_SOURCE, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_HORIJUSTIFYSOURCE|MID_FLAG_MERGE_PROPERTY, 0 ),
87 MAP( "HoriJustify", XML_NAMESPACE_STYLE, XML_REPEAT_CONTENT, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_HORIJUSTIFYREPEAT|MID_FLAG_MERGE_PROPERTY, 0 ),
88 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 ),
89 MAP( "IsTextWrapped", XML_NAMESPACE_FO, XML_WRAP_OPTION, XML_TYPE_PROP_TABLE_CELL|XML_SC_ISTEXTWRAPPED, 0 ),
90 MAP( "LeftBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_ALLBORDER ),
91 MAP( "LeftBorder", XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_LEFTBORDER ),
92 MAP( "LeftBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_ALLBORDERWIDTH ),
93 MAP( "LeftBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_LEFTBORDERWIDTH ),
94 MAP( "NumberFormat", XML_NAMESPACE_STYLE, XML_DATA_STYLE_NAME, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_NUMBER|MID_FLAG_SPECIAL_ITEM, CTF_SC_NUMBERFORMAT),
95 MAP( "Orientation", XML_NAMESPACE_STYLE, XML_DIRECTION, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_ORIENTATION, 0 ),
96 MAP( "ParaBottomMargin", XML_NAMESPACE_FO, XML_PADDING, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_ALLPADDING ),
97 MAP( "ParaBottomMargin", XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_BOTTOMPADDING ),
98 MAP( "ParaIndent", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_PROP_PARAGRAPH|XML_TYPE_MEASURE16, 0 ),
99 // MAP( "ParaIsHyphenation", XML_NAMESPACE_FO, XML_HYPHENATE, XML_TYPE_PROP_TEXT|XML_TYPE_BOOL, 0 ),
100 MAP( "ParaLeftMargin", XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_LEFTPADDING ),
101 MAP( "ParaRightMargin", XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_RIGHTPADDING ),
102 MAP( "ParaTopMargin", XML_NAMESPACE_FO, XML_PADDING_TOP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_MEASURE, CTF_SC_TOPPADDING ),
103 MAP( "RightBorder", XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_RIGHTBORDER ),
104 MAP( "RightBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_RIGHTBORDERWIDTH ),
105 MAP( "RotateAngle", XML_NAMESPACE_STYLE, XML_ROTATION_ANGLE, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_ROTATEANGLE, 0 ),
106 MAP( "RotateReference", XML_NAMESPACE_STYLE, XML_ROTATION_ALIGN, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_ROTATEREFERENCE, 0),
107 MAP( "ShadowFormat", XML_NAMESPACE_STYLE, XML_SHADOW, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_TEXT_SHADOW, 0 ),
108 MAP( "ShrinkToFit", XML_NAMESPACE_STYLE, XML_SHRINK_TO_FIT, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BOOL, 0 ),
109 MAP( "StandardDecimals", XML_NAMESPACE_STYLE, XML_DECIMAL_PLACES, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_NUMBER16, 0 ),
110 MAP( "TopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_TOPBORDER ),
111 MAP( "TopBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER_WIDTH, CTF_SC_TOPBORDERWIDTH ),
112 MAP( "UserDefinedAttributes", XML_NAMESPACE_TEXT, XML_XMLNS, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),
113 MAP( "ValidationXML", XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BUILDIN_CMP_ONLY, CTF_SC_VALIDATION ),
114 MAP( "VertJustify", XML_NAMESPACE_STYLE, XML_VERTICAL_ALIGN, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_VERTJUSTIFY, 0),
115 // MAP( "WritingMode", XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_TYPE_PROP_PARAGRAPH|XML_TYPE_TEXT_WRITING_MODE_WITH_DEFAULT, 0 ),
116 MAP_END()
117 };
118
119 const XMLPropertyMapEntry aXMLScColumnStylesProperties[] =
120 {
121 MAP( "IsManualPageBreak", XML_NAMESPACE_FO, XML_BREAK_BEFORE, XML_TYPE_PROP_TABLE_COLUMN|XML_SC_TYPE_BREAKBEFORE, 0),
122 MAP( "IsVisible", XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TYPE_PROP_TABLE_COLUMN|XML_SC_TYPE_EQUAL|MID_FLAG_SPECIAL_ITEM, CTF_SC_ISVISIBLE ),
123 MAP( "Width", XML_NAMESPACE_STYLE, XML_COLUMN_WIDTH, XML_TYPE_PROP_TABLE_COLUMN|XML_TYPE_MEASURE, 0 ),
124 // MAP( "OptimalWidth", XML_NAMESPACE_STYLE, XML_USE_OPTIMAL_COLUMN_WIDTH, XML_TYPE_PROP_TABLE_COLUMN|XML_TYPE_BOOL, 0),
125 MAP_END()
126 };
127
128 const XMLPropertyMapEntry aXMLScRowStylesImportProperties[] =
129 {
130 // #i57867# Include background color (CellBackColor/IsCellBackgroundTransparent) for import only.
131 // Import and export should use the same map, with MID_FLAG_NO_PROPERTY_EXPORT for the background entries,
132 // but this doesn't work at the moment because SvXMLImportPropertyMapper compares MID_FLAG_NO_PROPERTY to 0.
133 // If this is changed (not for 2.0.x), a single map can be used again.
134
135 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 ),
136 MAP( "Height", XML_NAMESPACE_STYLE, XML_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_MEASURE, CTF_SC_ROWHEIGHT),
137 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 ),
138 MAP( "IsManualPageBreak", XML_NAMESPACE_FO, XML_BREAK_BEFORE, XML_TYPE_PROP_TABLE_ROW|XML_SC_TYPE_BREAKBEFORE, CTF_SC_ROWBREAKBEFORE),
139 MAP( "OptimalHeight", XML_NAMESPACE_STYLE, XML_USE_OPTIMAL_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_BOOL, CTF_SC_ROWOPTIMALHEIGHT),
140 MAP_END()
141 };
142
143 const XMLPropertyMapEntry aXMLScRowStylesProperties[] =
144 {
145 MAP( "Height", XML_NAMESPACE_STYLE, XML_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_MEASURE, CTF_SC_ROWHEIGHT),
146 MAP( "IsManualPageBreak", XML_NAMESPACE_FO, XML_BREAK_BEFORE, XML_TYPE_PROP_TABLE_ROW|XML_SC_TYPE_BREAKBEFORE, CTF_SC_ROWBREAKBEFORE),
147 MAP( "OptimalHeight", XML_NAMESPACE_STYLE, XML_USE_OPTIMAL_ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_BOOL, CTF_SC_ROWOPTIMALHEIGHT),
148 MAP_END()
149 };
150
151 const XMLPropertyMapEntry aXMLScTableStylesImportProperties[] =
152 {
153 // #i57869# Include background color (CellBackColor/IsCellBackgroundTransparent) for import only.
154 // Import and export should use the same map, with MID_FLAG_NO_PROPERTY_EXPORT for the background entries,
155 // but this doesn't work at the moment because SvXMLImportPropertyMapper compares MID_FLAG_NO_PROPERTY to 0.
156 // If this is changed (not for 2.0.x), a single map can be used again.
157
158 MAP( "CellBackColor", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
159 MAP( "IsCellBackgroundTransparent", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_ISTRANSPARENT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
160 MAP( "IsVisible", XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TYPE_PROP_TABLE|XML_TYPE_BOOL, 0 ),
161 MAP( "PageStyle", XML_NAMESPACE_STYLE, XML_MASTER_PAGE_NAME, XML_TYPE_PROP_TABLE|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_MASTERPAGENAME ),
162 MAP( "TableLayout", XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_TYPE_PROP_TABLE|XML_TYPE_TEXT_WRITING_MODE, 0 ),
163 MAP( "TabColor", XML_NAMESPACE_TABLE, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
164 MAP_EXT( "TabColor", XML_NAMESPACE_TABLE_EXT, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
165 MAP_END()
166 };
167
168 const XMLPropertyMapEntry aXMLScTableStylesProperties[] =
169 {
170 MAP( "IsVisible", XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TYPE_PROP_TABLE|XML_TYPE_BOOL, 0 ),
171 MAP( "PageStyle", XML_NAMESPACE_STYLE, XML_MASTER_PAGE_NAME, XML_TYPE_PROP_TABLE|XML_TYPE_STRING|MID_FLAG_SPECIAL_ITEM, CTF_SC_MASTERPAGENAME ),
172 MAP( "TableLayout", XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_TYPE_PROP_TABLE|XML_TYPE_TEXT_WRITING_MODE, 0 ),
173 MAP_EXT( "TabColor", XML_NAMESPACE_TABLE_EXT, XML_TAB_COLOR, XML_TYPE_PROP_TABLE|XML_TYPE_COLORAUTO, 0 ),
174 MAP_END()
175 };
176
ScXMLCellExportPropertyMapper(const UniReference<XMLPropertySetMapper> & rMapper)177 ScXMLCellExportPropertyMapper::ScXMLCellExportPropertyMapper(
178 const UniReference< XMLPropertySetMapper >& rMapper )
179 : SvXMLExportPropertyMapper(rMapper)
180 {
181 }
182
~ScXMLCellExportPropertyMapper()183 ScXMLCellExportPropertyMapper::~ScXMLCellExportPropertyMapper()
184 {
185 }
186
ContextFilter(::std::vector<XMLPropertyState> & rProperties,uno::Reference<beans::XPropertySet> rPropSet) const187 void ScXMLCellExportPropertyMapper::ContextFilter(
188 ::std::vector< XMLPropertyState >& rProperties,
189 uno::Reference< beans::XPropertySet > rPropSet ) const
190 {
191 XMLPropertyState* pPadding = NULL;
192 XMLPropertyState* pPadding_Bottom = NULL;
193 XMLPropertyState* pPadding_Left = NULL;
194 XMLPropertyState* pPadding_Right = NULL;
195 XMLPropertyState* pPadding_Top = NULL;
196
197 XMLPropertyState* pBorder = NULL;
198 XMLPropertyState* pBorder_Bottom = NULL;
199 XMLPropertyState* pBorder_Left = NULL;
200 XMLPropertyState* pBorder_Right = NULL;
201 XMLPropertyState* pBorder_Top = NULL;
202 XMLPropertyState* pSWBorder = NULL;
203 XMLPropertyState* pSWBorder_Bottom = NULL;
204 XMLPropertyState* pSWBorder_Left = NULL;
205 XMLPropertyState* pSWBorder_Right = NULL;
206 XMLPropertyState* pSWBorder_Top = NULL;
207 XMLPropertyState* pDiagonalTLBR = NULL;
208 XMLPropertyState* pDiagonalBLTR = NULL;
209
210 XMLPropertyState* pAllBorderWidthState = NULL;
211 XMLPropertyState* pLeftBorderWidthState = NULL;
212 XMLPropertyState* pRightBorderWidthState = NULL;
213 XMLPropertyState* pTopBorderWidthState = NULL;
214 XMLPropertyState* pBottomBorderWidthState = NULL;
215 XMLPropertyState* pSWAllBorderWidthState = NULL;
216 XMLPropertyState* pSWLeftBorderWidthState = NULL;
217 XMLPropertyState* pSWRightBorderWidthState = NULL;
218 XMLPropertyState* pSWTopBorderWidthState = NULL;
219 XMLPropertyState* pSWBottomBorderWidthState = NULL;
220 XMLPropertyState* pDiagonalTLBRWidthState = NULL;
221 XMLPropertyState* pDiagonalBLTRWidthState = NULL;
222
223 XMLPropertyState* pParaMarginLeft = NULL;
224 XMLPropertyState* pParaMarginLeftRel = NULL;
225 XMLPropertyState* pParaMarginRight = NULL;
226 XMLPropertyState* pParaMarginRightRel = NULL;
227 XMLPropertyState* pParaMarginTop = NULL;
228 XMLPropertyState* pParaMarginTopRel = NULL;
229 XMLPropertyState* pParaMarginBottom = NULL;
230 XMLPropertyState* pParaMarginBottomRel = NULL;
231
232 XMLPropertyState* pParaAdjust = NULL;
233 XMLPropertyState* pParaAdjustLast = NULL;
234
235 ::std::vector< XMLPropertyState >::iterator aEndIter(rProperties.end());
236 for( ::std::vector< XMLPropertyState >::iterator aIter = rProperties.begin();
237 aIter != aEndIter; ++aIter )
238 {
239 XMLPropertyState* propertie = &(*aIter);
240 if (propertie->mnIndex != -1)
241 {
242 switch( getPropertySetMapper()->GetEntryContextId( propertie->mnIndex ) )
243 {
244 case CTF_SC_ALLPADDING: pPadding = propertie; break;
245 case CTF_SC_BOTTOMPADDING: pPadding_Bottom = propertie; break;
246 case CTF_SC_LEFTPADDING: pPadding_Left = propertie; break;
247 case CTF_SC_RIGHTPADDING: pPadding_Right = propertie; break;
248 case CTF_SC_TOPPADDING: pPadding_Top = propertie; break;
249 case CTF_SC_ALLBORDER: pBorder = propertie; break;
250 case CTF_SC_LEFTBORDER: pBorder_Left = propertie; break;
251 case CTF_SC_RIGHTBORDER: pBorder_Right = propertie; break;
252 case CTF_SC_BOTTOMBORDER: pBorder_Bottom = propertie; break;
253 case CTF_SC_TOPBORDER: pBorder_Top = propertie; break;
254 case CTF_SC_ALLBORDERWIDTH: pAllBorderWidthState = propertie; break;
255 case CTF_SC_LEFTBORDERWIDTH: pLeftBorderWidthState = propertie; break;
256 case CTF_SC_RIGHTBORDERWIDTH: pRightBorderWidthState = propertie; break;
257 case CTF_SC_TOPBORDERWIDTH: pTopBorderWidthState = propertie; break;
258 case CTF_SC_BOTTOMBORDERWIDTH: pBottomBorderWidthState = propertie; break;
259 case CTF_ALLBORDER: pSWBorder = propertie; break;
260 case CTF_LEFTBORDER: pSWBorder_Left = propertie; break;
261 case CTF_RIGHTBORDER: pSWBorder_Right = propertie; break;
262 case CTF_BOTTOMBORDER: pSWBorder_Bottom = propertie; break;
263 case CTF_TOPBORDER: pSWBorder_Top = propertie; break;
264 case CTF_ALLBORDERWIDTH: pSWAllBorderWidthState = propertie; break;
265 case CTF_LEFTBORDERWIDTH: pSWLeftBorderWidthState = propertie; break;
266 case CTF_RIGHTBORDERWIDTH: pSWRightBorderWidthState = propertie; break;
267 case CTF_TOPBORDERWIDTH: pSWTopBorderWidthState = propertie; break;
268 case CTF_BOTTOMBORDERWIDTH: pSWBottomBorderWidthState = propertie; break;
269 case CTF_SC_DIAGONALTLBR: pDiagonalTLBR = propertie; break;
270 case CTF_SC_DIAGONALTLBRWIDTH: pDiagonalTLBRWidthState = propertie; break;
271 case CTF_SC_DIAGONALBLTR: pDiagonalBLTR = propertie; break;
272 case CTF_SC_DIAGONALBLTRWIDTH: pDiagonalBLTRWidthState = propertie; break;
273 case CTF_SD_SHAPE_PARA_ADJUST: pParaAdjust = propertie; break;
274 case CTF_PARA_ADJUSTLAST: pParaAdjustLast = propertie; break;
275 case CTF_PARALEFTMARGIN: pParaMarginLeft = propertie; break;
276 case CTF_PARALEFTMARGIN_REL: pParaMarginLeftRel = propertie; break;
277 case CTF_PARARIGHTMARGIN: pParaMarginRight = propertie; break;
278 case CTF_PARARIGHTMARGIN_REL: pParaMarginRightRel = propertie; break;
279 case CTF_PARATOPMARGIN: pParaMarginTop = propertie; break;
280 case CTF_PARATOPMARGIN_REL: pParaMarginTopRel = propertie; break;
281 case CTF_PARABOTTOMMARGIN: pParaMarginBottom = propertie; break;
282 case CTF_PARABOTTOMMARGIN_REL: pParaMarginBottomRel = propertie; break;
283 }
284 }
285 }
286
287 if (pPadding && pPadding_Bottom && pPadding_Left && pPadding_Right && pPadding_Top)
288 {
289 sal_Int32 nBottom = 0, nTop = 0, nLeft = 0, nRight = 0;
290 if ((pPadding_Bottom->maValue >>= nBottom) &&
291 (pPadding_Left->maValue >>= nLeft) &&
292 (pPadding_Right->maValue >>= nRight) &&
293 (pPadding_Top->maValue >>= nTop))
294 {
295 if ((nBottom == nTop) && (nLeft == nRight) && (nTop == nLeft))
296 {
297 pPadding_Bottom->mnIndex = -1;
298 pPadding_Bottom->maValue.clear();
299 pPadding_Left->mnIndex = -1;
300 pPadding_Left->maValue.clear();
301 pPadding_Right->mnIndex = -1;
302 pPadding_Right->maValue.clear();
303 pPadding_Top->mnIndex = -1;
304 pPadding_Top->maValue.clear();
305 }
306 else
307 {
308 pPadding->mnIndex = -1;
309 pPadding->maValue.clear();
310 }
311 }
312 }
313 if( pBorder )
314 {
315 if( pBorder_Left && pBorder_Right && pBorder_Top && pBorder_Bottom )
316 {
317 table::BorderLine aLeft, aRight, aTop, aBottom;
318
319 pBorder_Left->maValue >>= aLeft;
320 pBorder_Right->maValue >>= aRight;
321 pBorder_Top->maValue >>= aTop;
322 pBorder_Bottom->maValue >>= aBottom;
323 if( aLeft.Color == aRight.Color && aLeft.InnerLineWidth == aRight.InnerLineWidth &&
324 aLeft.OuterLineWidth == aRight.OuterLineWidth && aLeft.LineDistance == aRight.LineDistance &&
325 aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth &&
326 aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance &&
327 aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth &&
328 aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance )
329 {
330 pBorder_Left->mnIndex = -1;
331 pBorder_Left->maValue.clear();
332 pBorder_Right->mnIndex = -1;
333 pBorder_Right->maValue.clear();
334 pBorder_Top->mnIndex = -1;
335 pBorder_Top->maValue.clear();
336 pBorder_Bottom->mnIndex = -1;
337 pBorder_Bottom->maValue.clear();
338 }
339 else
340 {
341 pBorder->mnIndex = -1;
342 pBorder->maValue.clear();
343 }
344 }
345 else
346 {
347 pBorder->mnIndex = -1;
348 pBorder->maValue.clear();
349 }
350 }
351 if( pAllBorderWidthState )
352 {
353 if( pLeftBorderWidthState && pRightBorderWidthState && pTopBorderWidthState && pBottomBorderWidthState )
354 {
355 table::BorderLine aLeft, aRight, aTop, aBottom;
356
357 pLeftBorderWidthState->maValue >>= aLeft;
358 pRightBorderWidthState->maValue >>= aRight;
359 pTopBorderWidthState->maValue >>= aTop;
360 pBottomBorderWidthState->maValue >>= aBottom;
361 if( aLeft.InnerLineWidth == aRight.InnerLineWidth && aLeft.OuterLineWidth == aRight.OuterLineWidth &&
362 aLeft.LineDistance == aRight.LineDistance && aLeft.InnerLineWidth == aTop.InnerLineWidth &&
363 aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance &&
364 aLeft.InnerLineWidth == aBottom.InnerLineWidth && aLeft.OuterLineWidth == aBottom.OuterLineWidth &&
365 aLeft.LineDistance == aBottom.LineDistance )
366 {
367 pLeftBorderWidthState->mnIndex = -1;
368 pLeftBorderWidthState->maValue.clear();
369 pRightBorderWidthState->mnIndex = -1;
370 pRightBorderWidthState->maValue.clear();
371 pTopBorderWidthState->mnIndex = -1;
372 pTopBorderWidthState->maValue.clear();
373 pBottomBorderWidthState->mnIndex = -1;
374 pBottomBorderWidthState->maValue.clear();
375 }
376 else
377 {
378 pAllBorderWidthState->mnIndex = -1;
379 pAllBorderWidthState->maValue.clear();
380 }
381 }
382 else
383 {
384 pAllBorderWidthState->mnIndex = -1;
385 pAllBorderWidthState->maValue.clear();
386 }
387 }
388
389 if (pParaAdjust)
390 {
391 pParaAdjust->mnIndex = -1;
392 pParaAdjust->maValue.clear();
393 }
394 if (pParaAdjustLast)
395 {
396 pParaAdjustLast->mnIndex = -1;
397 pParaAdjustLast->maValue.clear();
398 }
399 if (pSWBorder)
400 {
401 pSWBorder->mnIndex = -1;
402 pSWBorder->maValue.clear();
403 }
404 if (pSWBorder_Left)
405 {
406 pSWBorder_Left->mnIndex = -1;
407 pSWBorder_Left->maValue.clear();
408 }
409 if (pSWBorder_Right)
410 {
411 pSWBorder_Right->mnIndex = -1;
412 pSWBorder_Right->maValue.clear();
413 }
414 if (pSWBorder_Bottom)
415 {
416 pSWBorder_Bottom->mnIndex = -1;
417 pSWBorder_Bottom->maValue.clear();
418 }
419 if (pSWBorder_Top)
420 {
421 pSWBorder_Top->mnIndex = -1;
422 pSWBorder_Top->maValue.clear();
423 }
424 if (pSWAllBorderWidthState)
425 {
426 pSWAllBorderWidthState->mnIndex = -1;
427 pSWAllBorderWidthState->maValue.clear();
428 }
429 if (pSWLeftBorderWidthState)
430 {
431 pSWLeftBorderWidthState->mnIndex = -1;
432 pSWLeftBorderWidthState->maValue.clear();
433 }
434 if (pSWRightBorderWidthState)
435 {
436 pSWRightBorderWidthState->mnIndex = -1;
437 pSWRightBorderWidthState->maValue.clear();
438 }
439 if (pSWTopBorderWidthState)
440 {
441 pSWTopBorderWidthState->mnIndex = -1;
442 pSWTopBorderWidthState->maValue.clear();
443 }
444 if (pSWBottomBorderWidthState)
445 {
446 pSWBottomBorderWidthState->mnIndex = -1;
447 pSWBottomBorderWidthState->maValue.clear();
448 }
449
450 if (pParaMarginLeft)
451 {
452 pParaMarginLeft->mnIndex = -1;
453 pParaMarginLeft->maValue.clear();
454 }
455 if (pParaMarginLeftRel)
456 {
457 pParaMarginLeftRel->mnIndex = -1;
458 pParaMarginLeftRel->maValue.clear();
459 }
460 if (pParaMarginRight)
461 {
462 pParaMarginRight->mnIndex = -1;
463 pParaMarginRight->maValue.clear();
464 }
465 if (pParaMarginRightRel)
466 {
467 pParaMarginRightRel->mnIndex = -1;
468 pParaMarginRightRel->maValue.clear();
469 }
470 if (pParaMarginTop)
471 {
472 pParaMarginTop->mnIndex = -1;
473 pParaMarginTop->maValue.clear();
474 }
475 if (pParaMarginTopRel)
476 {
477 pParaMarginTopRel->mnIndex = -1;
478 pParaMarginTopRel->maValue.clear();
479 }
480 if (pParaMarginBottom)
481 {
482 pParaMarginBottom->mnIndex = -1;
483 pParaMarginBottom->maValue.clear();
484 }
485 if (pParaMarginBottomRel)
486 {
487 pParaMarginBottomRel->mnIndex = -1;
488 pParaMarginBottomRel->maValue.clear();
489 }
490
491 // #i102690# old diagonal line attribute names without "s" are only read, not written
492 if (pDiagonalTLBRWidthState)
493 {
494 pDiagonalTLBRWidthState->mnIndex = -1;
495 pDiagonalTLBRWidthState->maValue.clear();
496 }
497 if (pDiagonalBLTRWidthState)
498 {
499 pDiagonalBLTRWidthState->mnIndex = -1;
500 pDiagonalBLTRWidthState->maValue.clear();
501 }
502
503 SvXMLExportPropertyMapper::ContextFilter(rProperties, rPropSet);
504 }
505
506 /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
handleSpecialItem(SvXMLAttributeList &,const XMLPropertyState &,const SvXMLUnitConverter &,const SvXMLNamespaceMap &,const::std::vector<XMLPropertyState> *,sal_uInt32) const507 void ScXMLCellExportPropertyMapper::handleSpecialItem(
508 SvXMLAttributeList& /* rAttrList */,
509 const XMLPropertyState& /* rProperty */,
510 const SvXMLUnitConverter& /* rUnitConverter */,
511 const SvXMLNamespaceMap& /* rNamespaceMap */,
512 const ::std::vector< XMLPropertyState > * /* pProperties */,
513 sal_uInt32 /* nIdx */ ) const
514 {
515 // the SpecialItem NumberFormat must not be handled by this method
516 // the SpecialItem ConditionlaFormat must not be handled by this method
517 // the SpecialItem CharBackColor must not be handled by this method
518 }
519
ScXMLRowExportPropertyMapper(const UniReference<XMLPropertySetMapper> & rMapper)520 ScXMLRowExportPropertyMapper::ScXMLRowExportPropertyMapper(
521 const UniReference< XMLPropertySetMapper >& rMapper )
522 : SvXMLExportPropertyMapper(rMapper)
523 {
524 }
525
~ScXMLRowExportPropertyMapper()526 ScXMLRowExportPropertyMapper::~ScXMLRowExportPropertyMapper()
527 {
528 }
529
ContextFilter(::std::vector<XMLPropertyState> &,uno::Reference<beans::XPropertySet>) const530 void ScXMLRowExportPropertyMapper::ContextFilter(
531 ::std::vector< XMLPropertyState >& /* rProperties */,
532 uno::Reference< beans::XPropertySet > /* rPropSet */ ) const
533 {
534 //#108550#; don't filter the height, so other applications know the calculated height
535
536 /* XMLPropertyState* pHeight = NULL;
537 XMLPropertyState* pOptimalHeight = NULL;
538
539 for( ::std::vector< XMLPropertyState >::iterator propertie = rProperties.begin();
540 propertie != rProperties.end();
541 ++propertie )
542 {
543 switch( getPropertySetMapper()->GetEntryContextId( propertie->mnIndex ) )
544 {
545 case CTF_SC_ROWHEIGHT: pHeight = propertie; break;
546 case CTF_SC_ROWOPTIMALHEIGHT: pOptimalHeight = propertie; break;
547 }
548 }
549 if ((pHeight && pOptimalHeight && ::cppu::any2bool( pOptimalHeight->maValue )) ||
550 (pHeight && !pOptimalHeight))
551 {
552 pHeight->mnIndex = -1;
553 pHeight->maValue.clear();
554 }
555 if (pOptimalHeight)
556 {
557 pOptimalHeight->mnIndex = -1;
558 pOptimalHeight->maValue.clear();
559 }*/
560 }
561
ScXMLColumnExportPropertyMapper(const UniReference<XMLPropertySetMapper> & rMapper)562 ScXMLColumnExportPropertyMapper::ScXMLColumnExportPropertyMapper(
563 const UniReference< XMLPropertySetMapper >& rMapper )
564 : SvXMLExportPropertyMapper(rMapper)
565 {
566 }
567
~ScXMLColumnExportPropertyMapper()568 ScXMLColumnExportPropertyMapper::~ScXMLColumnExportPropertyMapper()
569 {
570 }
571
572 /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
handleSpecialItem(SvXMLAttributeList &,const XMLPropertyState &,const SvXMLUnitConverter &,const SvXMLNamespaceMap &,const::std::vector<XMLPropertyState> *,sal_uInt32) const573 void ScXMLColumnExportPropertyMapper::handleSpecialItem(
574 SvXMLAttributeList& /* rAttrList */,
575 const XMLPropertyState& /* rProperty */,
576 const SvXMLUnitConverter& /* rUnitConverter */,
577 const SvXMLNamespaceMap& /* rNamespaceMap */,
578 const ::std::vector< XMLPropertyState > * /* pProperties */,
579 sal_uInt32 /* nIdx */ ) const
580 {
581 // the SpecialItem IsVisible must not be handled by this method
582 }
583
ScXMLTableExportPropertyMapper(const UniReference<XMLPropertySetMapper> & rMapper)584 ScXMLTableExportPropertyMapper::ScXMLTableExportPropertyMapper(
585 const UniReference< XMLPropertySetMapper >& rMapper )
586 : SvXMLExportPropertyMapper(rMapper)
587 {
588 }
589
~ScXMLTableExportPropertyMapper()590 ScXMLTableExportPropertyMapper::~ScXMLTableExportPropertyMapper()
591 {
592 }
593
594 /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
handleSpecialItem(SvXMLAttributeList &,const XMLPropertyState &,const SvXMLUnitConverter &,const SvXMLNamespaceMap &,const::std::vector<XMLPropertyState> *,sal_uInt32) const595 void ScXMLTableExportPropertyMapper::handleSpecialItem(
596 SvXMLAttributeList& /* rAttrList */,
597 const XMLPropertyState& /* rProperty */,
598 const SvXMLUnitConverter& /* rUnitConverter */,
599 const SvXMLNamespaceMap& /* rNamespaceMap */,
600 const ::std::vector< XMLPropertyState > * /* pProperties */,
601 sal_uInt32 /* nIdx */ ) const
602 {
603 // the SpecialItem PageStyle must not be handled by this method
604 }
605
exportStyleAttributes(SvXMLAttributeList & rAttrList,sal_Int32 nFamily,const::std::vector<XMLPropertyState> & rProperties,const SvXMLExportPropertyMapper & rPropExp,const SvXMLUnitConverter & rUnitConverter,const SvXMLNamespaceMap & rNamespaceMap) const606 void ScXMLAutoStylePoolP::exportStyleAttributes(
607 SvXMLAttributeList& rAttrList,
608 sal_Int32 nFamily,
609 const ::std::vector< XMLPropertyState >& rProperties,
610 const SvXMLExportPropertyMapper& rPropExp
611 , const SvXMLUnitConverter& rUnitConverter,
612 const SvXMLNamespaceMap& rNamespaceMap
613 ) const
614 {
615 SvXMLAutoStylePoolP::exportStyleAttributes( rAttrList, nFamily, rProperties, rPropExp, rUnitConverter, rNamespaceMap );
616 if (nFamily == XML_STYLE_FAMILY_TABLE_CELL)
617 {
618 ::std::vector< XMLPropertyState >::const_iterator i(rProperties.begin());
619 ::std::vector< XMLPropertyState >::const_iterator endi(rProperties.end());
620 while (i != endi)
621 {
622 UniReference< XMLPropertySetMapper > aPropMapper(rScXMLExport.GetCellStylesPropertySetMapper());
623 sal_Int16 nContextID(aPropMapper->GetEntryContextId(i->mnIndex));
624 switch (nContextID)
625 {
626 case CTF_SC_NUMBERFORMAT :
627 {
628 sal_Int32 nNumberFormat = 0;
629 if (i->maValue >>= nNumberFormat)
630 {
631 rtl::OUString sAttrValue(rScXMLExport.getDataStyleName(nNumberFormat));
632 if (sAttrValue.getLength())
633 {
634 GetExport().AddAttribute(
635 aPropMapper->GetEntryNameSpace(i->mnIndex),
636 aPropMapper->GetEntryXMLName(i->mnIndex),
637 sAttrValue );
638 }
639 }
640 }
641 break;
642 }
643 ++i;
644 }
645 }
646 else if (nFamily == XML_STYLE_FAMILY_TABLE_TABLE)
647 {
648 ::std::vector< XMLPropertyState >::const_iterator i(rProperties.begin());
649 ::std::vector< XMLPropertyState >::const_iterator endi(rProperties.end());
650 while(i != endi)
651 {
652 UniReference< XMLPropertySetMapper > aPropMapper(rScXMLExport.GetTableStylesPropertySetMapper());
653 sal_Int16 nContextID(aPropMapper->GetEntryContextId(i->mnIndex));
654 switch (nContextID)
655 {
656 case CTF_SC_MASTERPAGENAME :
657 {
658 rtl::OUString sName;
659 if (i->maValue >>= sName)
660 {
661 GetExport().AddAttribute(
662 aPropMapper->GetEntryNameSpace(i->mnIndex),
663 aPropMapper->GetEntryXMLName(i->mnIndex),
664 GetExport().EncodeStyleName( sName ));
665 }
666 }
667 break;
668 }
669 ++i;
670 }
671 }
672 }
673
exportStyleContent(const::com::sun::star::uno::Reference<::com::sun::star::xml::sax::XDocumentHandler> & rHandler,sal_Int32 nFamily,const std::vector<XMLPropertyState> & rProperties,const SvXMLExportPropertyMapper & rPropExp,const SvXMLUnitConverter & rUnitConverter,const SvXMLNamespaceMap & rNamespaceMap) const674 void ScXMLAutoStylePoolP::exportStyleContent(
675 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
676 sal_Int32 nFamily,
677 const std::vector< XMLPropertyState >& rProperties,
678 const SvXMLExportPropertyMapper& rPropExp
679 , const SvXMLUnitConverter& rUnitConverter,
680 const SvXMLNamespaceMap& rNamespaceMap
681 ) const
682 {
683 SvXMLAutoStylePoolP::exportStyleContent( rHandler, nFamily, rProperties, rPropExp, rUnitConverter, rNamespaceMap );
684 if (nFamily == XML_STYLE_FAMILY_TABLE_CELL)
685 {
686 sal_Bool bNotFound = sal_True;
687 ::std::vector< XMLPropertyState >::const_iterator i(rProperties.begin());
688 ::std::vector< XMLPropertyState >::const_iterator endi(rProperties.end());
689 while ((i != endi) && bNotFound)
690 {
691 if (i->mnIndex != -1)
692 {
693 sal_Int16 nContextID = rScXMLExport.GetCellStylesPropertySetMapper()->GetEntryContextId(i->mnIndex);
694 switch (nContextID)
695 {
696 case CTF_SC_MAP :
697 {
698 uno::Reference<container::XIndexAccess> xIndex( i->maValue, uno::UNO_QUERY );
699 if ( xIndex.is() )
700 {
701 sal_Int32 nConditionCount(xIndex->getCount());
702 for (sal_Int32 nCondition = 0; nCondition < nConditionCount; ++nCondition)
703 {
704 uno::Reference <sheet::XSheetConditionalEntry> xSheetConditionalEntry(xIndex->getByIndex(nCondition), uno::UNO_QUERY);
705 if (xSheetConditionalEntry.is())
706 {
707 rtl::OUString sStyleName(xSheetConditionalEntry->getStyleName());
708 uno::Reference <sheet::XSheetCondition> xSheetCondition(xSheetConditionalEntry, uno::UNO_QUERY);
709 if (xSheetCondition.is())
710 {
711 sheet::ConditionOperator aOperator = xSheetCondition->getOperator();
712 if (aOperator != sheet::ConditionOperator_NONE)
713 {
714 if (aOperator == sheet::ConditionOperator_FORMULA)
715 {
716 rtl::OUString sCondition(RTL_CONSTASCII_USTRINGPARAM("is-true-formula("));
717 sCondition += xSheetCondition->getFormula1();
718 sCondition += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"));
719 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_CONDITION, sCondition);
720 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_APPLY_STYLE_NAME, rScXMLExport.EncodeStyleName( sStyleName ));
721 OUString sOUBaseAddress;
722 ScDocument* pDoc = rScXMLExport.GetDocument();
723 ScRangeStringConverter::GetStringFromAddress( sOUBaseAddress,
724 xSheetCondition->getSourcePosition(), pDoc, FormulaGrammar::CONV_OOO );
725 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_BASE_CELL_ADDRESS, sOUBaseAddress);
726 SvXMLElementExport aMElem(rScXMLExport, XML_NAMESPACE_STYLE, XML_MAP, sal_True, sal_True);
727 }
728 else
729 {
730 rtl::OUString sCondition;
731 if (aOperator == sheet::ConditionOperator_BETWEEN ||
732 aOperator == sheet::ConditionOperator_NOT_BETWEEN)
733 {
734 if (aOperator == sheet::ConditionOperator_BETWEEN)
735 sCondition = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("cell-content-is-between("));
736 else
737 sCondition = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("cell-content-is-not-between("));
738 sCondition += xSheetCondition->getFormula1();
739 sCondition += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
740 sCondition += xSheetCondition->getFormula2();
741 sCondition += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"));
742 }
743 else
744 {
745 sCondition = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("cell-content()"));
746 switch (aOperator)
747 {
748 case sheet::ConditionOperator_LESS:
749 sCondition += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("<"));
750 break;
751 case sheet::ConditionOperator_GREATER:
752 sCondition += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(">"));
753 break;
754 case sheet::ConditionOperator_LESS_EQUAL:
755 sCondition += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("<="));
756 break;
757 case sheet::ConditionOperator_GREATER_EQUAL:
758 sCondition += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(">="));
759 break;
760 case sheet::ConditionOperator_EQUAL:
761 sCondition += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("="));
762 break;
763 case sheet::ConditionOperator_NOT_EQUAL:
764 sCondition += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("!="));
765 break;
766 default:
767 {
768 // added to avoid warnings
769 }
770 }
771 sCondition += xSheetCondition->getFormula1();
772 }
773 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_CONDITION, sCondition);
774 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_APPLY_STYLE_NAME, rScXMLExport.EncodeStyleName( sStyleName ));
775 OUString sOUBaseAddress;
776 ScRangeStringConverter::GetStringFromAddress( sOUBaseAddress,
777 xSheetCondition->getSourcePosition(), rScXMLExport.GetDocument(), FormulaGrammar::CONV_OOO );
778 rScXMLExport.AddAttribute(XML_NAMESPACE_STYLE, XML_BASE_CELL_ADDRESS, sOUBaseAddress);
779 SvXMLElementExport aMElem(rScXMLExport, XML_NAMESPACE_STYLE, XML_MAP, sal_True, sal_True);
780 }
781 }
782 }
783 }
784 }
785 }
786 }
787 break;
788 }
789 }
790 ++i;
791 }
792 }
793 }
794
ScXMLAutoStylePoolP(ScXMLExport & rTempScXMLExport)795 ScXMLAutoStylePoolP::ScXMLAutoStylePoolP(ScXMLExport& rTempScXMLExport):
796 SvXMLAutoStylePoolP(rTempScXMLExport),
797 rScXMLExport(rTempScXMLExport)
798 {
799 }
800
~ScXMLAutoStylePoolP()801 ScXMLAutoStylePoolP::~ScXMLAutoStylePoolP()
802 {
803 }
804
805
exportStyleAttributes(const::com::sun::star::uno::Reference<::com::sun::star::style::XStyle> & rStyle)806 void ScXMLStyleExport::exportStyleAttributes(
807 const ::com::sun::star::uno::Reference<
808 ::com::sun::star::style::XStyle > & rStyle )
809 {
810 uno::Reference< beans::XPropertySet > xPropSet( rStyle, uno::UNO_QUERY );
811 if (xPropSet.is())
812 {
813 uno::Reference< beans::XPropertySetInfo > xPropSetInfo(xPropSet->getPropertySetInfo());
814 rtl::OUString sNumberFormat(RTL_CONSTASCII_USTRINGPARAM("NumberFormat"));
815 if( xPropSetInfo->hasPropertyByName( sNumberFormat ) )
816 {
817 uno::Reference< beans::XPropertyState > xPropState( xPropSet, uno::UNO_QUERY );
818 if( xPropState.is() && (beans::PropertyState_DIRECT_VALUE ==
819 xPropState->getPropertyState( sNumberFormat )) )
820 {
821 sal_Int32 nNumberFormat = 0;
822 if (xPropSet->getPropertyValue( sNumberFormat ) >>= nNumberFormat)
823 GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_DATA_STYLE_NAME,
824 GetExport().getDataStyleName(nNumberFormat) );
825 }
826 }
827 }
828 }
829
exportStyleContent(const::com::sun::star::uno::Reference<::com::sun::star::style::XStyle> &)830 void ScXMLStyleExport::exportStyleContent(
831 const ::com::sun::star::uno::Reference<
832 ::com::sun::star::style::XStyle > & /* rStyle */ )
833 {
834 }
835
ScXMLStyleExport(SvXMLExport & rExp,const::rtl::OUString & rPoolStyleName,SvXMLAutoStylePoolP * pAutoStyleP)836 ScXMLStyleExport::ScXMLStyleExport(
837 SvXMLExport& rExp,
838 const ::rtl::OUString& rPoolStyleName,
839 SvXMLAutoStylePoolP *pAutoStyleP )
840 : XMLStyleExport(rExp, rPoolStyleName, pAutoStyleP)
841 {
842 }
843
~ScXMLStyleExport()844 ScXMLStyleExport::~ScXMLStyleExport()
845 {
846 }
847
XMLScPropHdlFactory()848 XMLScPropHdlFactory::XMLScPropHdlFactory()
849 : XMLPropertyHandlerFactory()
850 {
851 }
852
~XMLScPropHdlFactory()853 XMLScPropHdlFactory::~XMLScPropHdlFactory()
854 {
855 }
856
GetPropertyHandler(sal_Int32 nType) const857 const XMLPropertyHandler* XMLScPropHdlFactory::GetPropertyHandler( sal_Int32 nType ) const
858 {
859 nType &= MID_FLAG_MASK;
860
861 XMLPropertyHandler* pHdl((XMLPropertyHandler*)XMLPropertyHandlerFactory::GetPropertyHandler( nType ));
862 if(!pHdl)
863 {
864 switch(nType)
865 {
866 case XML_SC_TYPE_CELLPROTECTION :
867 {
868 pHdl = new XmlScPropHdl_CellProtection;
869 }
870 break;
871 case XML_SC_TYPE_PRINTCONTENT :
872 {
873 pHdl = new XmlScPropHdl_PrintContent;
874 }
875 break;
876 case XML_SC_TYPE_HORIJUSTIFY :
877 {
878 pHdl = new XmlScPropHdl_HoriJustify;
879 }
880 break;
881 case XML_SC_TYPE_HORIJUSTIFYSOURCE :
882 {
883 pHdl = new XmlScPropHdl_HoriJustifySource;
884 }
885 break;
886 case XML_SC_TYPE_HORIJUSTIFYREPEAT :
887 {
888 pHdl = new XmlScPropHdl_HoriJustifyRepeat;
889 }
890 break;
891 case XML_SC_TYPE_ORIENTATION :
892 {
893 pHdl = new XmlScPropHdl_Orientation;
894 }
895 break;
896 case XML_SC_TYPE_ROTATEANGLE :
897 {
898 pHdl = new XmlScPropHdl_RotateAngle;
899 }
900 break;
901 case XML_SC_TYPE_ROTATEREFERENCE :
902 {
903 pHdl = new XmlScPropHdl_RotateReference;
904 }
905 break;
906 case XML_SC_TYPE_VERTJUSTIFY :
907 {
908 pHdl = new XmlScPropHdl_VertJustify;
909 }
910 break;
911 case XML_SC_TYPE_BREAKBEFORE :
912 {
913 pHdl = new XmlScPropHdl_BreakBefore;
914 }
915 break;
916 case XML_SC_ISTEXTWRAPPED :
917 {
918 pHdl = new XmlScPropHdl_IsTextWrapped;
919 }
920 break;
921 case XML_SC_TYPE_EQUAL :
922 {
923 pHdl = new XmlScPropHdl_IsEqual;
924 }
925 break;
926 case XML_SC_TYPE_VERTICAL :
927 {
928 pHdl = new XmlScPropHdl_Vertical;
929 }
930 break;
931 }
932
933 if(pHdl)
934 PutHdlCache(nType, pHdl);
935 }
936
937 return pHdl;
938 }
939
~XmlScPropHdl_CellProtection()940 XmlScPropHdl_CellProtection::~XmlScPropHdl_CellProtection()
941 {
942 }
943
equals(const::com::sun::star::uno::Any & r1,const::com::sun::star::uno::Any & r2) const944 bool XmlScPropHdl_CellProtection::equals(
945 const ::com::sun::star::uno::Any& r1,
946 const ::com::sun::star::uno::Any& r2 ) const
947 {
948 util::CellProtection aCellProtection1, aCellProtection2;
949
950 if((r1 >>= aCellProtection1) && (r2 >>= aCellProtection2))
951 {
952 return ((aCellProtection1.IsHidden == aCellProtection2.IsHidden) &&
953 (aCellProtection1.IsLocked == aCellProtection2.IsLocked) &&
954 (aCellProtection1.IsFormulaHidden == aCellProtection2.IsFormulaHidden));
955 }
956 return sal_False;
957 }
958
importXML(const::rtl::OUString & rStrImpValue,::com::sun::star::uno::Any & rValue,const SvXMLUnitConverter &) const959 sal_Bool XmlScPropHdl_CellProtection::importXML(
960 const ::rtl::OUString& rStrImpValue,
961 ::com::sun::star::uno::Any& rValue,
962 const SvXMLUnitConverter& /* rUnitConverter */ ) const
963 {
964 sal_Bool bRetval(sal_False);
965
966 util::CellProtection aCellProtection;
967 sal_Bool bDefault(sal_False);
968 if (!rValue.hasValue())
969 {
970 aCellProtection.IsHidden = sal_False;
971 aCellProtection.IsLocked = sal_True;
972 aCellProtection.IsFormulaHidden = sal_False;
973 aCellProtection.IsPrintHidden = sal_False;
974 bDefault = sal_True;
975 }
976 if ((rValue >>= aCellProtection) || bDefault)
977 {
978 if (!IsXMLToken(rStrImpValue, XML_NONE))
979 {
980 if (!IsXMLToken(rStrImpValue, XML_HIDDEN_AND_PROTECTED))
981 {
982 if (!IsXMLToken(rStrImpValue, XML_PROTECTED))
983 {
984 if (!IsXMLToken(rStrImpValue, XML_FORMULA_HIDDEN))
985 {
986 sal_Int16 i(0);
987 while (i < rStrImpValue.getLength() && rStrImpValue[i] != ' ')
988 ++i;
989 rtl::OUString sFirst(rStrImpValue.copy(0, i));
990 rtl::OUString sSecond(rStrImpValue.copy(i + 1));
991 aCellProtection.IsFormulaHidden = sal_False;
992 aCellProtection.IsHidden = sal_False;
993 aCellProtection.IsLocked = sal_False;
994 if ((IsXMLToken(sFirst, XML_PROTECTED)) || (IsXMLToken(sSecond, XML_PROTECTED)))
995 aCellProtection.IsLocked = sal_True;
996 if ((IsXMLToken(sFirst, XML_FORMULA_HIDDEN)) || (IsXMLToken(sSecond, XML_FORMULA_HIDDEN)))
997 aCellProtection.IsFormulaHidden = sal_True;
998 rValue <<= aCellProtection;
999 bRetval = sal_True;
1000 }
1001 else
1002 {
1003 aCellProtection.IsFormulaHidden = sal_True;
1004 aCellProtection.IsHidden = sal_False;
1005 aCellProtection.IsLocked = sal_False;
1006 rValue <<= aCellProtection;
1007 bRetval = sal_True;
1008 }
1009 }
1010 else
1011 {
1012 aCellProtection.IsFormulaHidden = sal_False;
1013 aCellProtection.IsHidden = sal_False;
1014 aCellProtection.IsLocked = sal_True;
1015 rValue <<= aCellProtection;
1016 bRetval = sal_True;
1017 }
1018 }
1019 else
1020 {
1021 aCellProtection.IsFormulaHidden = sal_True;
1022 aCellProtection.IsHidden = sal_True;
1023 aCellProtection.IsLocked = sal_True;
1024 rValue <<= aCellProtection;
1025 bRetval = sal_True;
1026 }
1027 }
1028 else
1029 {
1030 aCellProtection.IsFormulaHidden = sal_False;
1031 aCellProtection.IsHidden = sal_False;
1032 aCellProtection.IsLocked = sal_False;
1033 rValue <<= aCellProtection;
1034 bRetval = sal_True;
1035 }
1036 }
1037
1038 return bRetval;
1039 }
1040
exportXML(::rtl::OUString & rStrExpValue,const::com::sun::star::uno::Any & rValue,const SvXMLUnitConverter &) const1041 sal_Bool XmlScPropHdl_CellProtection::exportXML(
1042 ::rtl::OUString& rStrExpValue,
1043 const ::com::sun::star::uno::Any& rValue,
1044 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1045 {
1046 sal_Bool bRetval(sal_False);
1047 util::CellProtection aCellProtection;
1048
1049 if(rValue >>= aCellProtection)
1050 {
1051 if (!(aCellProtection.IsFormulaHidden || aCellProtection.IsHidden || aCellProtection.IsLocked))
1052 {
1053 rStrExpValue = GetXMLToken(XML_NONE);
1054 bRetval = sal_True;
1055 }
1056 else if (aCellProtection.IsHidden)
1057 {
1058 // #i105964# "Hide all" implies "Protected" in the UI, so it must be saved as "hidden-and-protected"
1059 // even if "IsLocked" is not set in the CellProtection struct.
1060 rStrExpValue = GetXMLToken(XML_HIDDEN_AND_PROTECTED);
1061 bRetval = sal_True;
1062 }
1063 else if (aCellProtection.IsLocked && !(aCellProtection.IsFormulaHidden || aCellProtection.IsHidden))
1064 {
1065 rStrExpValue = GetXMLToken(XML_PROTECTED);
1066 bRetval = sal_True;
1067 }
1068 else if (aCellProtection.IsFormulaHidden && !(aCellProtection.IsLocked || aCellProtection.IsHidden))
1069 {
1070 rStrExpValue = GetXMLToken(XML_FORMULA_HIDDEN);
1071 bRetval = sal_True;
1072 }
1073 else if (aCellProtection.IsFormulaHidden && aCellProtection.IsLocked)
1074 {
1075 rStrExpValue = GetXMLToken(XML_PROTECTED);
1076 rStrExpValue += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" "));
1077 rStrExpValue += GetXMLToken(XML_FORMULA_HIDDEN);
1078 bRetval = sal_True;
1079 }
1080 }
1081
1082 return bRetval;
1083 }
1084
~XmlScPropHdl_PrintContent()1085 XmlScPropHdl_PrintContent::~XmlScPropHdl_PrintContent()
1086 {
1087 }
1088
equals(const::com::sun::star::uno::Any & r1,const::com::sun::star::uno::Any & r2) const1089 bool XmlScPropHdl_PrintContent::equals(
1090 const ::com::sun::star::uno::Any& r1,
1091 const ::com::sun::star::uno::Any& r2 ) const
1092 {
1093 util::CellProtection aCellProtection1, aCellProtection2;
1094
1095 if((r1 >>= aCellProtection1) && (r2 >>= aCellProtection2))
1096 {
1097 return (aCellProtection1.IsPrintHidden == aCellProtection2.IsPrintHidden);
1098 }
1099 return sal_False;
1100 }
1101
importXML(const::rtl::OUString & rStrImpValue,::com::sun::star::uno::Any & rValue,const SvXMLUnitConverter &) const1102 sal_Bool XmlScPropHdl_PrintContent::importXML(
1103 const ::rtl::OUString& rStrImpValue,
1104 ::com::sun::star::uno::Any& rValue,
1105 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1106 {
1107 sal_Bool bRetval(sal_False);
1108 util::CellProtection aCellProtection;
1109 sal_Bool bDefault(sal_False);
1110 if (!rValue.hasValue())
1111 {
1112 aCellProtection.IsHidden = sal_False;
1113 aCellProtection.IsLocked = sal_True;
1114 aCellProtection.IsFormulaHidden = sal_False;
1115 aCellProtection.IsPrintHidden = sal_False;
1116 bDefault = sal_True;
1117 }
1118 if ((rValue >>= aCellProtection) || bDefault)
1119 {
1120 sal_Bool bValue;
1121 if (SvXMLUnitConverter::convertBool(bValue, rStrImpValue))
1122 {
1123 aCellProtection.IsPrintHidden = !bValue;
1124 rValue <<= aCellProtection;
1125 bRetval = sal_True;
1126 }
1127 }
1128
1129 return bRetval;
1130 }
1131
exportXML(::rtl::OUString & rStrExpValue,const::com::sun::star::uno::Any & rValue,const SvXMLUnitConverter &) const1132 sal_Bool XmlScPropHdl_PrintContent::exportXML(
1133 ::rtl::OUString& rStrExpValue,
1134 const ::com::sun::star::uno::Any& rValue,
1135 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1136 {
1137 sal_Bool bRetval(sal_False);
1138
1139 util::CellProtection aCellProtection;
1140 if(rValue >>= aCellProtection)
1141 {
1142 rtl::OUStringBuffer sValue;
1143 SvXMLUnitConverter::convertBool(sValue, !aCellProtection.IsPrintHidden);
1144 rStrExpValue = sValue.makeStringAndClear();
1145 bRetval = sal_True;
1146 }
1147
1148 return bRetval;
1149 }
1150
~XmlScPropHdl_HoriJustify()1151 XmlScPropHdl_HoriJustify::~XmlScPropHdl_HoriJustify()
1152 {
1153 }
1154
equals(const::com::sun::star::uno::Any & r1,const::com::sun::star::uno::Any & r2) const1155 bool XmlScPropHdl_HoriJustify::equals(
1156 const ::com::sun::star::uno::Any& r1,
1157 const ::com::sun::star::uno::Any& r2 ) const
1158 {
1159 table::CellHoriJustify aHoriJustify1, aHoriJustify2;
1160
1161 if((r1 >>= aHoriJustify1) && (r2 >>= aHoriJustify2))
1162 return (aHoriJustify1 == aHoriJustify2);
1163 return sal_False;
1164 }
1165
importXML(const::rtl::OUString & rStrImpValue,::com::sun::star::uno::Any & rValue,const SvXMLUnitConverter &) const1166 sal_Bool XmlScPropHdl_HoriJustify::importXML(
1167 const ::rtl::OUString& rStrImpValue,
1168 ::com::sun::star::uno::Any& rValue,
1169 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1170 {
1171 sal_Bool bRetval(sal_False);
1172
1173 table::CellHoriJustify nValue = table::CellHoriJustify_LEFT;
1174 rValue >>= nValue;
1175 if (nValue != table::CellHoriJustify_REPEAT)
1176 {
1177 if (IsXMLToken(rStrImpValue, XML_START))
1178 {
1179 nValue = table::CellHoriJustify_LEFT;
1180 rValue <<= nValue;
1181 bRetval = sal_True;
1182 }
1183 else if (IsXMLToken(rStrImpValue, XML_END))
1184 {
1185 nValue = table::CellHoriJustify_RIGHT;
1186 rValue <<= nValue;
1187 bRetval = sal_True;
1188 }
1189 else if (IsXMLToken(rStrImpValue, XML_CENTER))
1190 {
1191 nValue = table::CellHoriJustify_CENTER;
1192 rValue <<= nValue;
1193 bRetval = sal_True;
1194 }
1195 else if (IsXMLToken(rStrImpValue, XML_JUSTIFY))
1196 {
1197 nValue = table::CellHoriJustify_BLOCK;
1198 rValue <<= nValue;
1199 bRetval = sal_True;
1200 }
1201 }
1202 else
1203 bRetval = sal_True;
1204
1205 return bRetval;
1206 }
1207
exportXML(::rtl::OUString & rStrExpValue,const::com::sun::star::uno::Any & rValue,const SvXMLUnitConverter &) const1208 sal_Bool XmlScPropHdl_HoriJustify::exportXML(
1209 ::rtl::OUString& rStrExpValue,
1210 const ::com::sun::star::uno::Any& rValue,
1211 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1212 {
1213 table::CellHoriJustify nVal;
1214 sal_Bool bRetval(sal_False);
1215
1216 if(rValue >>= nVal)
1217 {
1218 switch (nVal)
1219 {
1220 case table::CellHoriJustify_REPEAT:
1221 case table::CellHoriJustify_LEFT:
1222 {
1223 rStrExpValue = GetXMLToken(XML_START);
1224 bRetval = sal_True;
1225 }
1226 break;
1227 case table::CellHoriJustify_RIGHT:
1228 {
1229 rStrExpValue = GetXMLToken(XML_END);
1230 bRetval = sal_True;
1231 }
1232 break;
1233 case table::CellHoriJustify_CENTER:
1234 {
1235 rStrExpValue = GetXMLToken(XML_CENTER);
1236 bRetval = sal_True;
1237 }
1238 break;
1239 case table::CellHoriJustify_BLOCK:
1240 {
1241 rStrExpValue = GetXMLToken(XML_JUSTIFY);
1242 bRetval = sal_True;
1243 }
1244 break;
1245 default:
1246 {
1247 // added to avoid warnings
1248 }
1249 }
1250 }
1251
1252 return bRetval;
1253 }
1254
~XmlScPropHdl_HoriJustifySource()1255 XmlScPropHdl_HoriJustifySource::~XmlScPropHdl_HoriJustifySource()
1256 {
1257 }
1258
equals(const::com::sun::star::uno::Any & r1,const::com::sun::star::uno::Any & r2) const1259 bool XmlScPropHdl_HoriJustifySource::equals(
1260 const ::com::sun::star::uno::Any& r1,
1261 const ::com::sun::star::uno::Any& r2 ) const
1262 {
1263 table::CellHoriJustify aHoriJustify1, aHoriJustify2;
1264
1265 if((r1 >>= aHoriJustify1) && (r2 >>= aHoriJustify2))
1266 return (aHoriJustify1 == aHoriJustify2);
1267 return sal_False;
1268 }
1269
importXML(const::rtl::OUString & rStrImpValue,::com::sun::star::uno::Any & rValue,const SvXMLUnitConverter &) const1270 sal_Bool XmlScPropHdl_HoriJustifySource::importXML(
1271 const ::rtl::OUString& rStrImpValue,
1272 ::com::sun::star::uno::Any& rValue,
1273 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1274 {
1275 sal_Bool bRetval(sal_False);
1276
1277 if (IsXMLToken(rStrImpValue, XML_FIX))
1278 {
1279 bRetval = sal_True;
1280 }
1281 else if (IsXMLToken(rStrImpValue, XML_VALUE_TYPE))
1282 {
1283 table::CellHoriJustify nValue(table::CellHoriJustify_STANDARD);
1284 rValue <<= nValue;
1285 bRetval = sal_True;
1286 }
1287
1288 return bRetval;
1289 }
1290
exportXML(::rtl::OUString & rStrExpValue,const::com::sun::star::uno::Any & rValue,const SvXMLUnitConverter &) const1291 sal_Bool XmlScPropHdl_HoriJustifySource::exportXML(
1292 ::rtl::OUString& rStrExpValue,
1293 const ::com::sun::star::uno::Any& rValue,
1294 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1295 {
1296 table::CellHoriJustify nVal;
1297 sal_Bool bRetval(sal_False);
1298
1299 if(rValue >>= nVal)
1300 {
1301 if (nVal == table::CellHoriJustify_STANDARD)
1302 {
1303 rStrExpValue = GetXMLToken(XML_VALUE_TYPE);
1304 bRetval = sal_True;
1305 }
1306 else
1307 {
1308 rStrExpValue = GetXMLToken(XML_FIX);
1309 bRetval = sal_True;
1310 }
1311 }
1312
1313 return bRetval;
1314 }
1315
~XmlScPropHdl_HoriJustifyRepeat()1316 XmlScPropHdl_HoriJustifyRepeat::~XmlScPropHdl_HoriJustifyRepeat()
1317 {
1318 }
1319
equals(const::com::sun::star::uno::Any & r1,const::com::sun::star::uno::Any & r2) const1320 bool XmlScPropHdl_HoriJustifyRepeat::equals(
1321 const ::com::sun::star::uno::Any& r1,
1322 const ::com::sun::star::uno::Any& r2 ) const
1323 {
1324 table::CellHoriJustify aHoriJustify1, aHoriJustify2;
1325
1326 if((r1 >>= aHoriJustify1) && (r2 >>= aHoriJustify2))
1327 return (aHoriJustify1 == aHoriJustify2);
1328 return sal_False;
1329 }
1330
importXML(const::rtl::OUString & rStrImpValue,::com::sun::star::uno::Any & rValue,const SvXMLUnitConverter &) const1331 sal_Bool XmlScPropHdl_HoriJustifyRepeat::importXML(
1332 const ::rtl::OUString& rStrImpValue,
1333 ::com::sun::star::uno::Any& rValue,
1334 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1335 {
1336 sal_Bool bRetval(sal_False);
1337
1338 if (IsXMLToken(rStrImpValue, XML_FALSE))
1339 {
1340 bRetval = sal_True;
1341 }
1342 else if (IsXMLToken(rStrImpValue, XML_TRUE))
1343 {
1344 table::CellHoriJustify nValue = table::CellHoriJustify_REPEAT;
1345 rValue <<= nValue;
1346 bRetval = sal_True;
1347 }
1348
1349 return bRetval;
1350 }
1351
exportXML(::rtl::OUString & rStrExpValue,const::com::sun::star::uno::Any & rValue,const SvXMLUnitConverter &) const1352 sal_Bool XmlScPropHdl_HoriJustifyRepeat::exportXML(
1353 ::rtl::OUString& rStrExpValue,
1354 const ::com::sun::star::uno::Any& rValue,
1355 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1356 {
1357 table::CellHoriJustify nVal;
1358 sal_Bool bRetval(sal_False);
1359
1360 if(rValue >>= nVal)
1361 {
1362 if (nVal == table::CellHoriJustify_REPEAT)
1363 {
1364 rStrExpValue = GetXMLToken(XML_TRUE);
1365 bRetval = sal_True;
1366 }
1367 else
1368 {
1369 rStrExpValue = GetXMLToken(XML_FALSE);
1370 bRetval = sal_True;
1371 }
1372 }
1373
1374 return bRetval;
1375 }
1376
~XmlScPropHdl_Orientation()1377 XmlScPropHdl_Orientation::~XmlScPropHdl_Orientation()
1378 {
1379 }
1380
equals(const::com::sun::star::uno::Any & r1,const::com::sun::star::uno::Any & r2) const1381 bool XmlScPropHdl_Orientation::equals(
1382 const ::com::sun::star::uno::Any& r1,
1383 const ::com::sun::star::uno::Any& r2 ) const
1384 {
1385 table::CellOrientation aOrientation1, aOrientation2;
1386
1387 if((r1 >>= aOrientation1) && (r2 >>= aOrientation2))
1388 return (aOrientation1 == aOrientation2);
1389 return sal_False;
1390 }
1391
importXML(const::rtl::OUString & rStrImpValue,::com::sun::star::uno::Any & rValue,const SvXMLUnitConverter &) const1392 sal_Bool XmlScPropHdl_Orientation::importXML(
1393 const ::rtl::OUString& rStrImpValue,
1394 ::com::sun::star::uno::Any& rValue,
1395 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1396 {
1397 sal_Bool bRetval(sal_False);
1398
1399 table::CellOrientation nValue;
1400 if (IsXMLToken(rStrImpValue, XML_LTR))
1401 {
1402 nValue = table::CellOrientation_STANDARD;
1403 rValue <<= nValue;
1404 bRetval = sal_True;
1405 }
1406 else if (IsXMLToken(rStrImpValue, XML_TTB))
1407 {
1408 nValue = table::CellOrientation_STACKED;
1409 rValue <<= nValue;
1410 bRetval = sal_True;
1411 }
1412
1413 return bRetval;
1414 }
1415
exportXML(::rtl::OUString & rStrExpValue,const::com::sun::star::uno::Any & rValue,const SvXMLUnitConverter &) const1416 sal_Bool XmlScPropHdl_Orientation::exportXML(
1417 ::rtl::OUString& rStrExpValue,
1418 const ::com::sun::star::uno::Any& rValue,
1419 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1420 {
1421 table::CellOrientation nVal;
1422 sal_Bool bRetval(sal_False);
1423
1424 if(rValue >>= nVal)
1425 {
1426 switch (nVal)
1427 {
1428 case table::CellOrientation_STACKED :
1429 {
1430 rStrExpValue = GetXMLToken(XML_TTB);
1431 bRetval = sal_True;
1432 }
1433 break;
1434 default:
1435 {
1436 rStrExpValue = GetXMLToken(XML_LTR);
1437 bRetval = sal_True;
1438 }
1439 break;
1440 }
1441 }
1442
1443 return bRetval;
1444 }
1445
~XmlScPropHdl_RotateAngle()1446 XmlScPropHdl_RotateAngle::~XmlScPropHdl_RotateAngle()
1447 {
1448 }
1449
equals(const::com::sun::star::uno::Any & r1,const::com::sun::star::uno::Any & r2) const1450 bool XmlScPropHdl_RotateAngle::equals(
1451 const ::com::sun::star::uno::Any& r1,
1452 const ::com::sun::star::uno::Any& r2 ) const
1453 {
1454 sal_Int32 aAngle1 = 0, aAngle2 = 0;
1455
1456 if((r1 >>= aAngle1) && (r2 >>= aAngle2))
1457 return (aAngle1 == aAngle2);
1458 return sal_False;
1459 }
1460
importXML(const::rtl::OUString & rStrImpValue,::com::sun::star::uno::Any & rValue,const SvXMLUnitConverter &) const1461 sal_Bool XmlScPropHdl_RotateAngle::importXML(
1462 const ::rtl::OUString& rStrImpValue,
1463 ::com::sun::star::uno::Any& rValue,
1464 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1465 {
1466 sal_Bool bRetval(sal_False);
1467
1468 sal_Int32 nValue;
1469 if (SvXMLUnitConverter::convertNumber(nValue, rStrImpValue))
1470 {
1471 nValue *= 100;
1472 rValue <<= nValue;
1473 bRetval = sal_True;
1474 }
1475
1476 return bRetval;
1477 }
1478
exportXML(::rtl::OUString & rStrExpValue,const::com::sun::star::uno::Any & rValue,const SvXMLUnitConverter &) const1479 sal_Bool XmlScPropHdl_RotateAngle::exportXML(
1480 ::rtl::OUString& rStrExpValue,
1481 const ::com::sun::star::uno::Any& rValue,
1482 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1483 {
1484 sal_Int32 nVal = 0;
1485 sal_Bool bRetval(sal_False);
1486
1487 if(rValue >>= nVal)
1488 {
1489 rtl::OUStringBuffer sValue;
1490 SvXMLUnitConverter::convertNumber(sValue, sal_Int32(nVal / 100));
1491 rStrExpValue = sValue.makeStringAndClear();
1492 bRetval = sal_True;
1493 }
1494
1495 return bRetval;
1496 }
1497
~XmlScPropHdl_RotateReference()1498 XmlScPropHdl_RotateReference::~XmlScPropHdl_RotateReference()
1499 {
1500 }
1501
equals(const::com::sun::star::uno::Any & r1,const::com::sun::star::uno::Any & r2) const1502 bool XmlScPropHdl_RotateReference::equals(
1503 const ::com::sun::star::uno::Any& r1,
1504 const ::com::sun::star::uno::Any& r2 ) const
1505 {
1506 table::CellVertJustify aReference1, aReference2;
1507
1508 if((r1 >>= aReference1) && (r2 >>= aReference2))
1509 return (aReference1 == aReference2);
1510 return sal_False;
1511 }
1512
importXML(const::rtl::OUString & rStrImpValue,::com::sun::star::uno::Any & rValue,const SvXMLUnitConverter &) const1513 sal_Bool XmlScPropHdl_RotateReference::importXML(
1514 const ::rtl::OUString& rStrImpValue,
1515 ::com::sun::star::uno::Any& rValue,
1516 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1517 {
1518 sal_Bool bRetval(sal_False);
1519
1520 table::CellVertJustify nValue;
1521 if (IsXMLToken(rStrImpValue, XML_NONE))
1522 {
1523 nValue = table::CellVertJustify_STANDARD;
1524 rValue <<= nValue;
1525 bRetval = sal_True;
1526 }
1527 else if (IsXMLToken(rStrImpValue, XML_BOTTOM))
1528 {
1529 nValue = table::CellVertJustify_BOTTOM;
1530 rValue <<= nValue;
1531 bRetval = sal_True;
1532 }
1533 else if (IsXMLToken(rStrImpValue, XML_TOP))
1534 {
1535 nValue = table::CellVertJustify_TOP;
1536 rValue <<= nValue;
1537 bRetval = sal_True;
1538 }
1539 else if (IsXMLToken(rStrImpValue, XML_CENTER))
1540 {
1541 nValue = table::CellVertJustify_CENTER;
1542 rValue <<= nValue;
1543 bRetval = sal_True;
1544 }
1545
1546 return bRetval;
1547 }
1548
exportXML(::rtl::OUString & rStrExpValue,const::com::sun::star::uno::Any & rValue,const SvXMLUnitConverter &) const1549 sal_Bool XmlScPropHdl_RotateReference::exportXML(
1550 ::rtl::OUString& rStrExpValue,
1551 const ::com::sun::star::uno::Any& rValue,
1552 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1553 {
1554 table::CellVertJustify nVal;
1555 sal_Bool bRetval(sal_False);
1556
1557 if(rValue >>= nVal)
1558 {
1559 switch (nVal)
1560 {
1561 case table::CellVertJustify_BOTTOM :
1562 {
1563 rStrExpValue = GetXMLToken(XML_BOTTOM);
1564 bRetval = sal_True;
1565 }
1566 break;
1567 case table::CellVertJustify_CENTER :
1568 {
1569 rStrExpValue = GetXMLToken(XML_CENTER);
1570 bRetval = sal_True;
1571 }
1572 break;
1573 case table::CellVertJustify_STANDARD :
1574 {
1575 rStrExpValue = GetXMLToken(XML_NONE);
1576 bRetval = sal_True;
1577 }
1578 break;
1579 case table::CellVertJustify_TOP :
1580 {
1581 rStrExpValue = GetXMLToken(XML_TOP);
1582 bRetval = sal_True;
1583 }
1584 break;
1585 default:
1586 {
1587 // added to avoid warnings
1588 }
1589 }
1590 }
1591
1592 return bRetval;
1593 }
1594
~XmlScPropHdl_VertJustify()1595 XmlScPropHdl_VertJustify::~XmlScPropHdl_VertJustify()
1596 {
1597 }
1598
equals(const::com::sun::star::uno::Any & r1,const::com::sun::star::uno::Any & r2) const1599 bool XmlScPropHdl_VertJustify::equals(
1600 const ::com::sun::star::uno::Any& r1,
1601 const ::com::sun::star::uno::Any& r2 ) const
1602 {
1603 table::CellVertJustify aReference1, aReference2;
1604
1605 if((r1 >>= aReference1) && (r2 >>= aReference2))
1606 return (aReference1 == aReference2);
1607 return sal_False;
1608 }
1609
importXML(const::rtl::OUString & rStrImpValue,::com::sun::star::uno::Any & rValue,const SvXMLUnitConverter &) const1610 sal_Bool XmlScPropHdl_VertJustify::importXML(
1611 const ::rtl::OUString& rStrImpValue,
1612 ::com::sun::star::uno::Any& rValue,
1613 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1614 {
1615 sal_Bool bRetval(sal_False);
1616
1617 table::CellVertJustify nValue;
1618 if (IsXMLToken(rStrImpValue, XML_AUTOMATIC))
1619 {
1620 nValue = table::CellVertJustify_STANDARD;
1621 rValue <<= nValue;
1622 bRetval = sal_True;
1623 }
1624 else if (IsXMLToken(rStrImpValue, XML_BOTTOM))
1625 {
1626 nValue = table::CellVertJustify_BOTTOM;
1627 rValue <<= nValue;
1628 bRetval = sal_True;
1629 }
1630 else if (IsXMLToken(rStrImpValue, XML_TOP))
1631 {
1632 nValue = table::CellVertJustify_TOP;
1633 rValue <<= nValue;
1634 bRetval = sal_True;
1635 }
1636 else if (IsXMLToken(rStrImpValue, XML_MIDDLE))
1637 {
1638 nValue = table::CellVertJustify_CENTER;
1639 rValue <<= nValue;
1640 bRetval = sal_True;
1641 }
1642
1643 return bRetval;
1644 }
1645
exportXML(::rtl::OUString & rStrExpValue,const::com::sun::star::uno::Any & rValue,const SvXMLUnitConverter &) const1646 sal_Bool XmlScPropHdl_VertJustify::exportXML(
1647 ::rtl::OUString& rStrExpValue,
1648 const ::com::sun::star::uno::Any& rValue,
1649 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1650 {
1651 table::CellVertJustify nVal;
1652 sal_Bool bRetval(sal_False);
1653
1654 if(rValue >>= nVal)
1655 {
1656 switch (nVal)
1657 {
1658 case table::CellVertJustify_BOTTOM :
1659 {
1660 rStrExpValue = GetXMLToken(XML_BOTTOM);
1661 bRetval = sal_True;
1662 }
1663 break;
1664 case table::CellVertJustify_CENTER :
1665 {
1666 rStrExpValue = GetXMLToken(XML_MIDDLE);
1667 bRetval = sal_True;
1668 }
1669 break;
1670 case table::CellVertJustify_STANDARD :
1671 {
1672 rStrExpValue = GetXMLToken(XML_AUTOMATIC);
1673 bRetval = sal_True;
1674 }
1675 break;
1676 case table::CellVertJustify_TOP :
1677 {
1678 rStrExpValue = GetXMLToken(XML_TOP);
1679 bRetval = sal_True;
1680 }
1681 break;
1682 default:
1683 {
1684 // added to avoid warnings
1685 }
1686 }
1687 }
1688
1689 return bRetval;
1690 }
1691
~XmlScPropHdl_BreakBefore()1692 XmlScPropHdl_BreakBefore::~XmlScPropHdl_BreakBefore()
1693 {
1694 }
1695
equals(const::com::sun::star::uno::Any & r1,const::com::sun::star::uno::Any & r2) const1696 bool XmlScPropHdl_BreakBefore::equals(
1697 const ::com::sun::star::uno::Any& r1,
1698 const ::com::sun::star::uno::Any& r2 ) const
1699 {
1700 sal_Bool aBreak1 = 0, aBreak2 = 0;
1701
1702 if((r1 >>= aBreak1) && (r2 >>= aBreak2))
1703 return (aBreak1 == aBreak2);
1704 return sal_False;
1705 }
1706
importXML(const::rtl::OUString & rStrImpValue,::com::sun::star::uno::Any & rValue,const SvXMLUnitConverter &) const1707 sal_Bool XmlScPropHdl_BreakBefore::importXML(
1708 const ::rtl::OUString& rStrImpValue,
1709 ::com::sun::star::uno::Any& rValue,
1710 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1711 {
1712 sal_Bool bRetval(sal_False);
1713
1714 sal_Bool bValue;
1715 if (IsXMLToken(rStrImpValue, XML_AUTO))
1716 {
1717 bValue = sal_False;
1718 rValue = ::cppu::bool2any(bValue);
1719 bRetval = sal_True;
1720 }
1721 else if (IsXMLToken(rStrImpValue, XML_PAGE))
1722 {
1723 bValue = sal_True;
1724 rValue = ::cppu::bool2any(bValue);
1725 bRetval = sal_True;
1726 }
1727
1728 return bRetval;
1729 }
1730
exportXML(::rtl::OUString & rStrExpValue,const::com::sun::star::uno::Any & rValue,const SvXMLUnitConverter &) const1731 sal_Bool XmlScPropHdl_BreakBefore::exportXML(
1732 ::rtl::OUString& rStrExpValue,
1733 const ::com::sun::star::uno::Any& rValue,
1734 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1735 {
1736 sal_Bool bRetval(sal_False);
1737
1738 if(::cppu::any2bool(rValue))
1739 {
1740 rStrExpValue = GetXMLToken(XML_PAGE);
1741 bRetval = sal_True;
1742 }
1743 else
1744 {
1745 rStrExpValue = GetXMLToken(XML_AUTO);
1746 bRetval = sal_True;
1747 }
1748
1749 return bRetval;
1750 }
1751
~XmlScPropHdl_IsTextWrapped()1752 XmlScPropHdl_IsTextWrapped::~XmlScPropHdl_IsTextWrapped()
1753 {
1754 }
1755
equals(const::com::sun::star::uno::Any & r1,const::com::sun::star::uno::Any & r2) const1756 bool XmlScPropHdl_IsTextWrapped::equals(
1757 const ::com::sun::star::uno::Any& r1,
1758 const ::com::sun::star::uno::Any& r2 ) const
1759 {
1760 return (::cppu::any2bool(r1) == ::cppu::any2bool(r2));
1761 }
1762
importXML(const::rtl::OUString & rStrImpValue,::com::sun::star::uno::Any & rValue,const SvXMLUnitConverter &) const1763 sal_Bool XmlScPropHdl_IsTextWrapped::importXML(
1764 const ::rtl::OUString& rStrImpValue,
1765 ::com::sun::star::uno::Any& rValue,
1766 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1767 {
1768 sal_Bool bRetval(sal_False);
1769
1770 if (IsXMLToken(rStrImpValue, XML_WRAP))
1771 {
1772 rValue = ::cppu::bool2any(sal_True);
1773 bRetval = sal_True;
1774 }
1775 else if (IsXMLToken(rStrImpValue, XML_NO_WRAP))
1776 {
1777 rValue = ::cppu::bool2any(sal_False);
1778 bRetval = sal_True;
1779 }
1780
1781 return bRetval;
1782 }
1783
exportXML(::rtl::OUString & rStrExpValue,const::com::sun::star::uno::Any & rValue,const SvXMLUnitConverter &) const1784 sal_Bool XmlScPropHdl_IsTextWrapped::exportXML(
1785 ::rtl::OUString& rStrExpValue,
1786 const ::com::sun::star::uno::Any& rValue,
1787 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1788 {
1789 sal_Bool bRetval(sal_False);
1790
1791 if (::cppu::any2bool(rValue))
1792 {
1793 rStrExpValue = GetXMLToken(XML_WRAP);
1794 bRetval = sal_True;
1795 }
1796 else
1797 {
1798 rStrExpValue = GetXMLToken(XML_NO_WRAP);
1799 bRetval = sal_True;
1800 }
1801
1802 return bRetval;
1803 }
1804
importXML(const::rtl::OUString &,::com::sun::star::uno::Any &,const SvXMLUnitConverter &) const1805 sal_Bool XmlScPropHdl_IsEqual::importXML( const ::rtl::OUString& /* rStrImpValue */,
1806 ::com::sun::star::uno::Any& /* rValue */,
1807 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1808 {
1809 DBG_ERROR("should never be called");
1810 return sal_False;
1811 }
1812
exportXML(::rtl::OUString &,const::com::sun::star::uno::Any &,const SvXMLUnitConverter &) const1813 sal_Bool XmlScPropHdl_IsEqual::exportXML( ::rtl::OUString& /* rStrExpValue */,
1814 const ::com::sun::star::uno::Any& /* rValue */,
1815 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1816 {
1817 DBG_ERROR("should never be called");
1818 return sal_False;
1819 }
1820
~XmlScPropHdl_Vertical()1821 XmlScPropHdl_Vertical::~XmlScPropHdl_Vertical()
1822 {
1823 }
1824
equals(const::com::sun::star::uno::Any & r1,const::com::sun::star::uno::Any & r2) const1825 bool XmlScPropHdl_Vertical::equals(
1826 const ::com::sun::star::uno::Any& r1,
1827 const ::com::sun::star::uno::Any& r2 ) const
1828 {
1829 return (::cppu::any2bool(r1) == ::cppu::any2bool(r2));
1830 }
1831
importXML(const::rtl::OUString & rStrImpValue,::com::sun::star::uno::Any & rValue,const SvXMLUnitConverter &) const1832 sal_Bool XmlScPropHdl_Vertical::importXML(
1833 const ::rtl::OUString& rStrImpValue,
1834 ::com::sun::star::uno::Any& rValue,
1835 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1836 {
1837 sal_Bool bRetval(sal_False);
1838
1839 if (IsXMLToken(rStrImpValue, XML_AUTO))
1840 {
1841 rValue = ::cppu::bool2any(sal_True);
1842 bRetval = sal_True;
1843 }
1844 else if (IsXMLToken(rStrImpValue, XML_0))
1845 {
1846 rValue = ::cppu::bool2any(sal_False);
1847 bRetval = sal_True;
1848 }
1849
1850 return bRetval;
1851 }
1852
exportXML(::rtl::OUString & rStrExpValue,const::com::sun::star::uno::Any & rValue,const SvXMLUnitConverter &) const1853 sal_Bool XmlScPropHdl_Vertical::exportXML(
1854 ::rtl::OUString& rStrExpValue,
1855 const ::com::sun::star::uno::Any& rValue,
1856 const SvXMLUnitConverter& /* rUnitConverter */ ) const
1857 {
1858 sal_Bool bRetval(sal_False);
1859
1860 if (::cppu::any2bool(rValue))
1861 {
1862 rStrExpValue = GetXMLToken(XML_AUTO);
1863 bRetval = sal_True;
1864 }
1865 else
1866 {
1867 rStrExpValue = GetXMLToken(XML_0);
1868 bRetval = sal_True;
1869 }
1870
1871 return bRetval;
1872 }
1873