Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <com/sun/star/text/XTextColumns.hpp>
30 : : #include <com/sun/star/text/TextColumn.hpp>
31 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
32 : : #include <com/sun/star/style/VerticalAlignment.hpp>
33 : : #include <com/sun/star/beans/XPropertySet.hpp>
34 : : #include <sax/tools/converter.hxx>
35 : : #include <xmloff/xmltkmap.hxx>
36 : : #include <xmloff/xmluconv.hxx>
37 : : #include <xmloff/nmspmap.hxx>
38 : : #include "xmloff/xmlnmspe.hxx"
39 : : #include <xmloff/xmlimp.hxx>
40 : : #include <xmloff/xmltoken.hxx>
41 : : #include "XMLTextColumnsContext.hxx"
42 : :
43 : : using ::rtl::OUString;
44 : : using ::rtl::OUStringBuffer;
45 : :
46 : : using namespace ::com::sun::star;
47 : : using namespace ::com::sun::star::uno;
48 : : using namespace ::com::sun::star::lang;
49 : : using namespace ::com::sun::star::text;
50 : : using namespace ::com::sun::star::style;
51 : : using namespace ::com::sun::star::beans;
52 : : using namespace ::xmloff::token;
53 : :
54 : : enum SvXMLTokenMapAttrs
55 : : {
56 : : XML_TOK_COLUMN_WIDTH,
57 : : XML_TOK_COLUMN_MARGIN_LEFT,
58 : : XML_TOK_COLUMN_MARGIN_RIGHT,
59 : : XML_TOK_COLUMN_END=XML_TOK_UNKNOWN
60 : : };
61 : :
62 : : enum SvXMLSepTokenMapAttrs
63 : : {
64 : : XML_TOK_COLUMN_SEP_WIDTH,
65 : : XML_TOK_COLUMN_SEP_HEIGHT,
66 : : XML_TOK_COLUMN_SEP_COLOR,
67 : : XML_TOK_COLUMN_SEP_ALIGN,
68 : : XML_TOK_COLUMN_SEP_STYLE,
69 : : XML_TOK_COLUMN_SEP_END=XML_TOK_UNKNOWN
70 : : };
71 : :
72 : : static SvXMLTokenMapEntry aColAttrTokenMap[] =
73 : : {
74 : : { XML_NAMESPACE_STYLE, XML_REL_WIDTH, XML_TOK_COLUMN_WIDTH },
75 : : { XML_NAMESPACE_FO, XML_START_INDENT, XML_TOK_COLUMN_MARGIN_LEFT },
76 : : { XML_NAMESPACE_FO, XML_END_INDENT, XML_TOK_COLUMN_MARGIN_RIGHT },
77 : : XML_TOKEN_MAP_END
78 : : };
79 : :
80 : : static SvXMLTokenMapEntry aColSepAttrTokenMap[] =
81 : : {
82 : : { XML_NAMESPACE_STYLE, XML_WIDTH, XML_TOK_COLUMN_SEP_WIDTH },
83 : : { XML_NAMESPACE_STYLE, XML_COLOR, XML_TOK_COLUMN_SEP_COLOR },
84 : : { XML_NAMESPACE_STYLE, XML_HEIGHT, XML_TOK_COLUMN_SEP_HEIGHT },
85 : : { XML_NAMESPACE_STYLE, XML_VERTICAL_ALIGN, XML_TOK_COLUMN_SEP_ALIGN },
86 : : { XML_NAMESPACE_STYLE, XML_STYLE, XML_TOK_COLUMN_SEP_STYLE },
87 : : XML_TOKEN_MAP_END
88 : : };
89 : :
90 : : SvXMLEnumMapEntry const pXML_Sep_Style_Enum[] =
91 : : {
92 : : { XML_NONE, 0 },
93 : : { XML_SOLID, 1 },
94 : : { XML_DOTTED, 2 },
95 : : { XML_DASHED, 3 },
96 : : { XML_TOKEN_INVALID, 0 }
97 : : };
98 : :
99 : : SvXMLEnumMapEntry const pXML_Sep_Align_Enum[] =
100 : : {
101 : : { XML_TOP, VerticalAlignment_TOP },
102 : : { XML_MIDDLE, VerticalAlignment_MIDDLE },
103 : : { XML_BOTTOM, VerticalAlignment_BOTTOM },
104 : : { XML_TOKEN_INVALID, 0 }
105 : : };
106 : :
107 : : class XMLTextColumnContext_Impl: public SvXMLImportContext
108 : : {
109 : : text::TextColumn aColumn;
110 : :
111 : : public:
112 : : TYPEINFO();
113 : :
114 : : XMLTextColumnContext_Impl( SvXMLImport& rImport, sal_uInt16 nPrfx,
115 : : const OUString& rLName,
116 : : const uno::Reference<
117 : : xml::sax::XAttributeList > & xAttrList,
118 : : const SvXMLTokenMap& rTokenMap );
119 : :
120 : : virtual ~XMLTextColumnContext_Impl();
121 : :
122 : 0 : text::TextColumn& getTextColumn() { return aColumn; }
123 : : };
124 : :
125 [ # # ][ # # ]: 0 : TYPEINIT1( XMLTextColumnContext_Impl, SvXMLImportContext );
126 : :
127 : 24 : XMLTextColumnContext_Impl::XMLTextColumnContext_Impl(
128 : : SvXMLImport& rImport, sal_uInt16 nPrfx,
129 : : const OUString& rLName,
130 : : const uno::Reference<
131 : : xml::sax::XAttributeList > & xAttrList,
132 : : const SvXMLTokenMap& rTokenMap ) :
133 : 24 : SvXMLImportContext( rImport, nPrfx, rLName )
134 : : {
135 : 24 : aColumn.Width = 0;
136 : 24 : aColumn.LeftMargin = 0;
137 : 24 : aColumn.RightMargin = 0;
138 : :
139 [ + - ][ + - ]: 24 : sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
[ + - ]
140 [ + + ]: 96 : for( sal_Int16 i=0; i < nAttrCount; i++ )
141 : : {
142 [ + - ][ + - ]: 72 : const OUString& rAttrName = xAttrList->getNameByIndex( i );
143 : 72 : OUString aLocalName;
144 : : sal_uInt16 nPrefix =
145 : 72 : GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
146 [ + - ]: 72 : &aLocalName );
147 [ + - ][ + - ]: 72 : const OUString& rValue = xAttrList->getValueByIndex( i );
148 : :
149 : : sal_Int32 nVal;
150 [ + - ]: 72 : switch( rTokenMap.Get( nPrefix, aLocalName ) )
[ + + + - ]
151 : : {
152 : : case XML_TOK_COLUMN_WIDTH:
153 : : {
154 : 24 : sal_Int32 nPos = rValue.indexOf( (sal_Unicode)'*' );
155 [ + - ][ + - ]: 24 : if( nPos != -1 && nPos+1 == rValue.getLength() )
[ + - ]
156 : : {
157 : 24 : OUString sTmp( rValue.copy( 0, nPos ) );
158 [ + - ][ + - ]: 24 : if (::sax::Converter::convertNumber(
159 : : nVal, sTmp, 0, USHRT_MAX))
160 : 24 : aColumn.Width = nVal;
161 : : }
162 : : }
163 : 24 : break;
164 : : case XML_TOK_COLUMN_MARGIN_LEFT:
165 [ + - ][ + - ]: 24 : if( GetImport().GetMM100UnitConverter().
166 : : convertMeasureToCore( nVal, rValue ) )
167 : 24 : aColumn.LeftMargin = nVal;
168 : 24 : break;
169 : : case XML_TOK_COLUMN_MARGIN_RIGHT:
170 : :
171 [ + - ][ + - ]: 24 : if( GetImport().GetMM100UnitConverter().
172 : : convertMeasureToCore( nVal, rValue ) )
173 : 24 : aColumn.RightMargin = nVal;
174 : 24 : break;
175 : : default:
176 : 0 : break;
177 : : }
178 : 72 : }
179 : 24 : }
180 : :
181 : 24 : XMLTextColumnContext_Impl::~XMLTextColumnContext_Impl()
182 : : {
183 [ - + ]: 48 : }
184 : :
185 : : // --------------------------------------------------------------------------
186 : :
187 : : class XMLTextColumnSepContext_Impl: public SvXMLImportContext
188 : : {
189 : : sal_Int32 nWidth;
190 : : sal_Int32 nColor;
191 : : sal_Int8 nHeight;
192 : : sal_Int8 nStyle;
193 : : VerticalAlignment eVertAlign;
194 : :
195 : :
196 : : public:
197 : : TYPEINFO();
198 : :
199 : : XMLTextColumnSepContext_Impl( SvXMLImport& rImport, sal_uInt16 nPrfx,
200 : : const OUString& rLName,
201 : : const uno::Reference<
202 : : xml::sax::XAttributeList > & xAttrList,
203 : : const SvXMLTokenMap& rTokenMap );
204 : :
205 : : virtual ~XMLTextColumnSepContext_Impl();
206 : :
207 : 0 : sal_Int32 GetWidth() const { return nWidth; }
208 : 0 : sal_Int32 GetColor() const { return nColor; }
209 : 0 : sal_Int8 GetHeight() const { return nHeight; }
210 : 0 : sal_Int8 GetStyle() const { return nStyle; }
211 : 0 : VerticalAlignment GetVertAlign() const { return eVertAlign; }
212 : : };
213 : :
214 : :
215 [ # # ][ # # ]: 0 : TYPEINIT1( XMLTextColumnSepContext_Impl, SvXMLImportContext );
216 : :
217 : 0 : XMLTextColumnSepContext_Impl::XMLTextColumnSepContext_Impl(
218 : : SvXMLImport& rImport, sal_uInt16 nPrfx,
219 : : const OUString& rLName,
220 : : const uno::Reference<
221 : : xml::sax::XAttributeList > & xAttrList,
222 : : const SvXMLTokenMap& rTokenMap ) :
223 : : SvXMLImportContext( rImport, nPrfx, rLName ),
224 : : nWidth( 2 ),
225 : : nColor( 0 ),
226 : : nHeight( 100 ),
227 : : nStyle( 1 ),
228 : 0 : eVertAlign( VerticalAlignment_TOP )
229 : : {
230 [ # # ][ # # ]: 0 : sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
[ # # ]
231 [ # # ]: 0 : for( sal_Int16 i=0; i < nAttrCount; i++ )
232 : : {
233 [ # # ][ # # ]: 0 : const OUString& rAttrName = xAttrList->getNameByIndex( i );
234 : 0 : OUString aLocalName;
235 : : sal_uInt16 nPrefix =
236 : 0 : GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
237 [ # # ]: 0 : &aLocalName );
238 [ # # ][ # # ]: 0 : const OUString& rValue = xAttrList->getValueByIndex( i );
239 : :
240 : : sal_Int32 nVal;
241 [ # # ][ # # : 0 : switch( rTokenMap.Get( nPrefix, aLocalName ) )
# # # # ]
242 : : {
243 : : case XML_TOK_COLUMN_SEP_WIDTH:
244 [ # # ][ # # ]: 0 : if( GetImport().GetMM100UnitConverter().
245 : : convertMeasureToCore( nVal, rValue ) )
246 : 0 : nWidth = nVal;
247 : 0 : break;
248 : : case XML_TOK_COLUMN_SEP_HEIGHT:
249 [ # # ][ # # ]: 0 : if (::sax::Converter::convertPercent( nVal, rValue ) &&
[ # # ][ # # ]
[ # # ]
250 : : nVal >=1 && nVal <= 100 )
251 : 0 : nHeight = (sal_Int8)nVal;
252 : 0 : break;
253 : : case XML_TOK_COLUMN_SEP_COLOR:
254 : : {
255 [ # # ]: 0 : ::sax::Converter::convertColor( nColor, rValue );
256 : : }
257 : 0 : break;
258 : : case XML_TOK_COLUMN_SEP_ALIGN:
259 : : {
260 : : sal_uInt16 nAlign;
261 [ # # ]: 0 : if( GetImport().GetMM100UnitConverter().
262 : : convertEnum( nAlign, rValue,
263 [ # # ]: 0 : pXML_Sep_Align_Enum ) )
264 : 0 : eVertAlign = (VerticalAlignment)nAlign;
265 : : }
266 : 0 : break;
267 : : case XML_TOK_COLUMN_SEP_STYLE:
268 : : {
269 : : sal_uInt16 nStyleVal;
270 [ # # ]: 0 : if( GetImport().GetMM100UnitConverter().
271 : : convertEnum( nStyleVal, rValue,
272 [ # # ]: 0 : pXML_Sep_Style_Enum ) )
273 : 0 : nStyle = (sal_Int8)nStyleVal;
274 : : }
275 : 0 : break;
276 : : }
277 : 0 : }
278 : 0 : }
279 : :
280 : 0 : XMLTextColumnSepContext_Impl::~XMLTextColumnSepContext_Impl()
281 : : {
282 [ # # ]: 0 : }
283 : :
284 : : // --------------------------------------------------------------------------
285 : :
286 : 16 : class XMLTextColumnsArray_Impl : public std::vector<XMLTextColumnContext_Impl *> {};
287 : :
288 [ # # ][ # # ]: 0 : TYPEINIT1( XMLTextColumnsContext, XMLElementPropertyContext );
289 : :
290 : 25 : XMLTextColumnsContext::XMLTextColumnsContext(
291 : : SvXMLImport& rImport, sal_uInt16 nPrfx,
292 : : const OUString& rLName,
293 : : const Reference< xml::sax::XAttributeList >&
294 : : xAttrList,
295 : : const XMLPropertyState& rProp,
296 : : ::std::vector< XMLPropertyState > &rProps )
297 : : : XMLElementPropertyContext( rImport, nPrfx, rLName, rProp, rProps )
298 : : , sSeparatorLineIsOn(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineIsOn"))
299 : : , sSeparatorLineWidth(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineWidth"))
300 : : , sSeparatorLineColor(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineColor"))
301 : : , sSeparatorLineRelativeHeight(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineRelativeHeight"))
302 : : , sSeparatorLineVerticalAlignment(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineVerticalAlignment"))
303 : : , sIsAutomatic(RTL_CONSTASCII_USTRINGPARAM("IsAutomatic"))
304 : : , sAutomaticDistance(RTL_CONSTASCII_USTRINGPARAM("AutomaticDistance"))
305 : : , sSeparatorLineStyle(RTL_CONSTASCII_USTRINGPARAM("SeparatorLineStyle"))
306 : : , pColumns( 0 )
307 : : , pColumnSep( 0 )
308 [ + - ]: 25 : , pColumnAttrTokenMap( new SvXMLTokenMap(aColAttrTokenMap) )
309 [ + - ]: 25 : , pColumnSepAttrTokenMap( new SvXMLTokenMap(aColSepAttrTokenMap) )
310 : : , nCount( 0 )
311 : : , bAutomatic( sal_False )
312 [ + - ][ + - ]: 50 : , nAutomaticDistance( 0 )
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
313 : : {
314 [ + - ][ + - ]: 25 : sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
[ + - ]
315 : : sal_Int32 nVal;
316 [ + + ]: 75 : for( sal_Int16 i=0; i < nAttrCount; i++ )
317 : : {
318 [ + - ][ + - ]: 50 : const OUString& rAttrName = xAttrList->getNameByIndex( i );
319 : 50 : OUString aLocalName;
320 : : sal_uInt16 nPrefix =
321 : 50 : GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
322 [ + - ]: 50 : &aLocalName );
323 [ + - ][ + - ]: 50 : const OUString& rValue = xAttrList->getValueByIndex( i );
324 [ + - ]: 50 : if( XML_NAMESPACE_FO == nPrefix )
325 : : {
326 [ + - ][ + + ]: 75 : if( IsXMLToken( aLocalName, XML_COLUMN_COUNT ) &&
[ + - ][ + + ]
327 [ + - ]: 25 : ::sax::Converter::convertNumber( nVal, rValue, 0, SHRT_MAX ))
328 : : {
329 : 25 : nCount = (sal_Int16)nVal;
330 : : }
331 [ + - ][ + - ]: 25 : else if( IsXMLToken( aLocalName, XML_COLUMN_GAP ) )
332 : : {
333 : 25 : bAutomatic = GetImport().GetMM100UnitConverter().
334 [ + - ]: 25 : convertMeasureToCore( nAutomaticDistance, rValue );
335 : : }
336 : : }
337 : 50 : }
338 : 25 : }
339 : :
340 : 25 : XMLTextColumnsContext::~XMLTextColumnsContext()
341 : : {
342 [ + + ]: 25 : if( pColumns )
343 : : {
344 [ + - ][ + + ]: 64 : for (XMLTextColumnsArray_Impl::iterator it = pColumns->begin();
345 : 32 : it != pColumns->end(); ++it)
346 : : {
347 [ + - ]: 24 : (*it)->ReleaseRef();
348 : : }
349 : : }
350 [ - + ]: 25 : if( pColumnSep )
351 [ # # ]: 0 : pColumnSep->ReleaseRef();
352 : :
353 [ + + ]: 25 : delete pColumns;
354 [ + - ][ + - ]: 25 : delete pColumnAttrTokenMap;
355 [ + - ][ + - ]: 25 : delete pColumnSepAttrTokenMap;
356 [ - + ]: 50 : }
357 : :
358 : 24 : SvXMLImportContext *XMLTextColumnsContext::CreateChildContext(
359 : : sal_uInt16 nPrefix,
360 : : const OUString& rLocalName,
361 : : const uno::Reference< xml::sax::XAttributeList > & xAttrList )
362 : : {
363 : 24 : SvXMLImportContext *pContext = 0;
364 : :
365 [ + - + - ]: 48 : if( XML_NAMESPACE_STYLE == nPrefix &&
[ + - ]
366 : 24 : IsXMLToken( rLocalName, XML_COLUMN ) )
367 : : {
368 : : XMLTextColumnContext_Impl *pColumn =
369 : 24 : new XMLTextColumnContext_Impl( GetImport(), nPrefix, rLocalName,
370 [ + - ][ + - ]: 24 : xAttrList, *pColumnAttrTokenMap );
371 : :
372 : : // add new tabstop to array of tabstops
373 [ + + ]: 24 : if( !pColumns )
374 [ + - ][ + - ]: 8 : pColumns = new XMLTextColumnsArray_Impl;
375 : :
376 [ + - ]: 24 : pColumns->push_back( pColumn );
377 : 24 : pColumn->AddRef();
378 : :
379 : 24 : pContext = pColumn;
380 : : }
381 [ # # # # ]: 0 : else if( XML_NAMESPACE_STYLE == nPrefix &&
[ # # ]
382 : 0 : IsXMLToken( rLocalName, XML_COLUMN_SEP ) )
383 : : {
384 : : pColumnSep =
385 : 0 : new XMLTextColumnSepContext_Impl( GetImport(), nPrefix, rLocalName,
386 [ # # ]: 0 : xAttrList, *pColumnSepAttrTokenMap );
387 : 0 : pColumnSep->AddRef();
388 : :
389 : 0 : pContext = pColumnSep;
390 : : }
391 : : else
392 : : {
393 [ # # ]: 0 : pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
394 : : }
395 : :
396 : 24 : return pContext;
397 : : }
398 : :
399 : 25 : void XMLTextColumnsContext::EndElement( )
400 : : {
401 [ + - ]: 25 : Reference<XMultiServiceFactory> xFactory(GetImport().GetModel(),UNO_QUERY);
402 [ - + ]: 25 : if( !xFactory.is() )
403 : : return;
404 : :
405 [ + - ]: 25 : Reference<XInterface> xIfc = xFactory->createInstance(
406 [ + - ][ + - ]: 25 : OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextColumns")));
407 [ - + ]: 25 : if( !xIfc.is() )
408 : : return;
409 : :
410 [ + - ]: 25 : Reference< XTextColumns > xColumns( xIfc, UNO_QUERY );
411 [ - + ]: 25 : if ( 0 == nCount )
412 : : {
413 : : // zero columns = no columns -> 1 column
414 [ # # ][ # # ]: 0 : xColumns->setColumnCount( 1 );
415 : : }
416 [ - + ]: 25 : else if( !bAutomatic && pColumns &&
[ # # # # ]
[ - + ]
417 : 0 : pColumns->size() == (sal_uInt16)nCount )
418 : : {
419 : : // if we have column descriptions, one per column, and we don't use
420 : : // automatic width, then set the column widths
421 : :
422 : 0 : sal_Int32 nRelWidth = 0;
423 : 0 : sal_uInt16 nColumnsWithWidth = 0;
424 : : sal_Int16 i;
425 : :
426 [ # # ]: 0 : for( i = 0; i < nCount; i++ )
427 : : {
428 : : const TextColumn& rColumn =
429 : 0 : (*pColumns)[(sal_uInt16)i]->getTextColumn();
430 [ # # ]: 0 : if( rColumn.Width > 0 )
431 : : {
432 : 0 : nRelWidth += rColumn.Width;
433 : 0 : nColumnsWithWidth++;
434 : : }
435 : : }
436 [ # # ]: 0 : if( nColumnsWithWidth < nCount )
437 : : {
438 : : sal_Int32 nColWidth = 0==nRelWidth
439 : : ? USHRT_MAX / nCount
440 [ # # ]: 0 : : nRelWidth / nColumnsWithWidth;
441 : :
442 [ # # ]: 0 : for( i=0; i < nCount; i++ )
443 : : {
444 : : TextColumn& rColumn =
445 : 0 : (*pColumns)[(sal_uInt16)i]->getTextColumn();
446 [ # # ]: 0 : if( rColumn.Width == 0 )
447 : : {
448 : 0 : rColumn.Width = nColWidth;
449 : 0 : nRelWidth += rColumn.Width;
450 [ # # ]: 0 : if( 0 == --nColumnsWithWidth )
451 : 0 : break;
452 : : }
453 : : }
454 : : }
455 : :
456 [ # # ]: 0 : Sequence< TextColumn > aColumns( (sal_Int32)nCount );
457 [ # # ]: 0 : TextColumn *pTextColumns = aColumns.getArray();
458 [ # # ]: 0 : for( i=0; i < nCount; i++ )
459 : 0 : *pTextColumns++ = (*pColumns)[(sal_uInt16)i]->getTextColumn();
460 : :
461 [ # # ][ # # ]: 0 : xColumns->setColumns( aColumns );
[ # # ]
462 : : }
463 : : else
464 : : {
465 : : // only set column count (and let the columns be distributed
466 : : // automatically)
467 : :
468 [ + - ][ + - ]: 25 : xColumns->setColumnCount( nCount );
469 : : }
470 : :
471 [ + - ]: 25 : Reference < XPropertySet > xPropSet( xColumns, UNO_QUERY );
472 [ + - ]: 25 : if( xPropSet.is() )
473 : : {
474 : 25 : Any aAny;
475 : 25 : sal_Bool bOn = pColumnSep != 0;
476 : :
477 [ + - ]: 25 : aAny.setValue( &bOn, ::getBooleanCppuType() );
478 [ + - ][ + - ]: 25 : xPropSet->setPropertyValue( sSeparatorLineIsOn, aAny );
479 : :
480 [ - + ]: 25 : if( pColumnSep )
481 : : {
482 [ # # ]: 0 : if( pColumnSep->GetWidth() )
483 : : {
484 [ # # ]: 0 : aAny <<= pColumnSep->GetWidth();
485 [ # # ][ # # ]: 0 : xPropSet->setPropertyValue( sSeparatorLineWidth, aAny );
486 : : }
487 [ # # ]: 0 : if( pColumnSep->GetHeight() )
488 : : {
489 [ # # ]: 0 : aAny <<= pColumnSep->GetHeight();
490 [ # # ]: 0 : xPropSet->setPropertyValue( sSeparatorLineRelativeHeight,
491 [ # # ]: 0 : aAny );
492 : : }
493 [ # # ]: 0 : if ( pColumnSep->GetStyle() )
494 : : {
495 [ # # ]: 0 : aAny <<= pColumnSep->GetStyle();
496 [ # # ][ # # ]: 0 : xPropSet->setPropertyValue( sSeparatorLineStyle, aAny );
497 : : }
498 : :
499 : :
500 [ # # ]: 0 : aAny <<= pColumnSep->GetColor();
501 [ # # ][ # # ]: 0 : xPropSet->setPropertyValue( sSeparatorLineColor, aAny );
502 : :
503 : :
504 [ # # ]: 0 : aAny <<= pColumnSep->GetVertAlign();
505 [ # # ][ # # ]: 0 : xPropSet->setPropertyValue( sSeparatorLineVerticalAlignment, aAny );
506 : : }
507 : :
508 : : // handle 'automatic columns': column distance
509 [ + - ]: 25 : if( bAutomatic )
510 : : {
511 [ + - ]: 25 : aAny <<= nAutomaticDistance;
512 [ + - ][ + - ]: 25 : xPropSet->setPropertyValue( sAutomaticDistance, aAny );
513 : 25 : }
514 : : }
515 : :
516 [ + - ]: 25 : aProp.maValue <<= xColumns;
517 : :
518 : 25 : SetInsert( sal_True );
519 [ - + ][ + - ]: 25 : XMLElementPropertyContext::EndElement();
[ + - ]
520 : :
521 : : }
522 : :
523 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|