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 <com/sun/star/xml/AttributeData.hpp>
21 #include <com/sun/star/beans/XMultiPropertySet.hpp>
22 #include <com/sun/star/lang/IllegalArgumentException.hpp>
23 #include <com/sun/star/lang/WrappedTargetException.hpp>
24 #include <com/sun/star/beans/UnknownPropertyException.hpp>
25 #include <com/sun/star/beans/PropertyVetoException.hpp>
26 #include <com/sun/star/beans/TolerantPropertySetResultType.hpp>
27 #include <rtl/ustrbuf.hxx>
28 #include <xmloff/xmlprmap.hxx>
29 #include <xmloff/nmspmap.hxx>
30 #include <xmloff/xmlimppr.hxx>
31 #include <xmloff/xmlimp.hxx>
33 #include "xmloff/unoatrcn.hxx"
34 #include "xmloff/xmlnmspe.hxx"
35 #include <xmloff/xmltoken.hxx>
36 #include "xmloff/xmlerror.hxx"
37 #include "xmloff/contextid.hxx"
45 using namespace ::com::sun::star::uno
;
46 using namespace ::com::sun::star::beans
;
47 using namespace ::com::sun::star::container
;
48 using namespace ::com::sun::star::xml
;
49 using namespace ::com::sun::star::xml::sax
;
51 using namespace ::std
;
52 using namespace ::xmloff::token
;
53 using ::com::sun::star::lang::IllegalArgumentException
;
54 using ::com::sun::star::lang::WrappedTargetException
;
55 using ::com::sun::star::beans::UnknownPropertyException
;
56 using ::com::sun::star::beans::PropertyVetoException
;
59 SvXMLImportPropertyMapper::SvXMLImportPropertyMapper(
60 const UniReference
< XMLPropertySetMapper
>& rMapper
,
63 maPropMapper ( rMapper
)
67 SvXMLImportPropertyMapper::~SvXMLImportPropertyMapper()
72 void SvXMLImportPropertyMapper::ChainImportMapper(
73 const UniReference
< SvXMLImportPropertyMapper
>& rMapper
)
75 // add map entries from rMapper to current map
76 maPropMapper
->AddMapperEntry( rMapper
->getPropertySetMapper() );
77 // rMapper uses the same map as 'this'
78 rMapper
->maPropMapper
= maPropMapper
;
80 // set rMapper as last mapper in current chain
81 UniReference
< SvXMLImportPropertyMapper
> xNext
= mxNextMapper
;
84 while( xNext
->mxNextMapper
.is())
85 xNext
= xNext
->mxNextMapper
;
86 xNext
->mxNextMapper
= rMapper
;
89 mxNextMapper
= rMapper
;
91 // if rMapper was already chained, correct
92 // map pointer of successors
95 while( xNext
->mxNextMapper
.is())
97 xNext
= xNext
->mxNextMapper
;
98 xNext
->maPropMapper
= maPropMapper
;
102 /** fills the given itemset with the attributes in the given list */
103 void SvXMLImportPropertyMapper::importXML(
104 vector
< XMLPropertyState
>& rProperties
,
105 Reference
< XAttributeList
> xAttrList
,
106 const SvXMLUnitConverter
& rUnitConverter
,
107 const SvXMLNamespaceMap
& rNamespaceMap
,
108 sal_uInt32 nPropType
,
110 sal_Int32 nEndIdx
) const
112 sal_Int16 nAttr
= xAttrList
->getLength();
114 Reference
< XNameContainer
> xAttrContainer
;
116 if( -1 == nStartIdx
)
119 nEndIdx
= maPropMapper
->GetEntryCount();
120 for( sal_Int16 i
=0; i
< nAttr
; i
++ )
122 const OUString
& rAttrName
= xAttrList
->getNameByIndex( i
);
123 OUString aLocalName
, aPrefix
, aNamespace
;
124 sal_uInt16 nPrefix
= rNamespaceMap
.GetKeyByAttrName( rAttrName
, &aPrefix
,
125 &aLocalName
, &aNamespace
);
127 if( XML_NAMESPACE_XMLNS
== nPrefix
)
130 const OUString
& rValue
= xAttrList
->getValueByIndex( i
);
132 // index of actual property map entry
133 // This looks very strange, but it works well:
134 // If the start index is 0, the new value will become -1, and
135 // GetEntryIndex will start searching with position 0.
136 // Otherwise GetEntryIndex will start with the next position specified.
137 sal_Int32 nIndex
= nStartIdx
- 1;
138 sal_uInt32 nFlags
= 0; // flags of actual property map entry
139 sal_Bool bFound
= sal_False
;
141 // for better error reporting: this should be set true if no
143 sal_Bool bNoWarning
= sal_False
;
144 bool bAlienImport
= false;
148 // find an entry for this attribute
149 nIndex
= maPropMapper
->GetEntryIndex( nPrefix
, aLocalName
,
152 if( nIndex
> -1 && nIndex
< nEndIdx
)
154 // create a XMLPropertyState with an empty value
156 nFlags
= maPropMapper
->GetEntryFlags( nIndex
);
157 if( (( nFlags
& MID_FLAG_NO_PROPERTY
) == MID_FLAG_NO_PROPERTY
) && (maPropMapper
->GetEntryContextId( nIndex
) == CTF_ALIEN_ATTRIBUTE_IMPORT
) )
164 if( ( nFlags
& MID_FLAG_ELEMENT_ITEM_IMPORT
) == 0 )
166 XMLPropertyState
aNewProperty( nIndex
);
167 sal_Int32 nReference
= -1;
169 // if this is a multi attribute check if another attribute already set
170 // this any. If so use this as a initial value
171 if( ( nFlags
& MID_FLAG_MERGE_PROPERTY
) != 0 )
173 const OUString
aAPIName( maPropMapper
->GetEntryAPIName( nIndex
) );
174 const sal_Int32 nSize
= rProperties
.size();
175 for( nReference
= 0; nReference
< nSize
; nReference
++ )
177 sal_Int32 nRefIdx
= rProperties
[nReference
].mnIndex
;
178 if( (nRefIdx
!= -1) && (nIndex
!= nRefIdx
) &&
179 (maPropMapper
->GetEntryAPIName( nRefIdx
) == aAPIName
))
181 aNewProperty
= rProperties
[nReference
];
182 aNewProperty
.mnIndex
= nIndex
;
187 if( nReference
== nSize
)
191 sal_Bool bSet
= sal_False
;
192 if( ( nFlags
& MID_FLAG_SPECIAL_ITEM_IMPORT
) == 0 )
194 // let the XMLPropertySetMapper decide how to import the value
195 bSet
= maPropMapper
->importXML( rValue
, aNewProperty
,
200 sal_uInt32 nOldSize
= rProperties
.size();
202 bSet
= handleSpecialItem( aNewProperty
, rProperties
,
203 rValue
, rUnitConverter
,
206 // no warning if handleSpecialItem added properties
207 bNoWarning
|= ( nOldSize
!= rProperties
.size() );
210 // no warning if we found could set the item. This
211 // 'remembers' bSet across multi properties.
214 // store the property in the given vector
217 if( nReference
== -1 )
218 rProperties
.push_back( aNewProperty
);
220 rProperties
[nReference
] = aNewProperty
;
224 // warn about unknown value. Unless it's a
225 // multi property: Then we get another chance
228 ((nFlags
& MID_FLAG_MULTI_PROPERTY
) == 0) )
230 Sequence
<OUString
> aSeq(2);
233 rImport
.SetError( XMLERROR_FLAG_WARNING
|
234 XMLERROR_STYLE_ATTR_VALUE
,
246 SAL_INFO_IF((XML_NAMESPACE_NONE
!= nPrefix
) &&
247 !(XML_NAMESPACE_UNKNOWN_FLAG
& nPrefix
) &&
248 !bAlienImport
, "xmloff.style",
249 "unknown attribute: \"" << rAttrName
<< "\"");
250 if( (XML_NAMESPACE_UNKNOWN_FLAG
& nPrefix
) || (XML_NAMESPACE_NONE
== nPrefix
) || bAlienImport
)
252 if( !xAttrContainer
.is() )
254 // add an unknown attribute container to the properties
255 Reference
< XNameContainer
> xNew( SvUnoAttributeContainer_CreateInstance(), UNO_QUERY
);
256 xAttrContainer
= xNew
;
258 // find map entry and create new property state
263 case XML_TYPE_PROP_CHART
:
264 nIndex
= maPropMapper
->FindEntryIndex( "ChartUserDefinedAttributes", XML_NAMESPACE_TEXT
, GetXMLToken(XML_XMLNS
) );
266 case XML_TYPE_PROP_PARAGRAPH
:
267 nIndex
= maPropMapper
->FindEntryIndex( "ParaUserDefinedAttributes", XML_NAMESPACE_TEXT
, GetXMLToken(XML_XMLNS
) );
269 case XML_TYPE_PROP_TEXT
:
270 nIndex
= maPropMapper
->FindEntryIndex( "TextUserDefinedAttributes", XML_NAMESPACE_TEXT
, GetXMLToken(XML_XMLNS
) );
275 // other property type or property not found
277 nIndex
= maPropMapper
->FindEntryIndex( "UserDefinedAttributes", XML_NAMESPACE_TEXT
, GetXMLToken(XML_XMLNS
) );
280 // #106963#; use userdefined attribute only if it is in the specified property range
281 if( nIndex
!= -1 && nIndex
>= nStartIdx
&& nIndex
< nEndIdx
)
284 aAny
<<= xAttrContainer
;
285 XMLPropertyState
aNewProperty( nIndex
, aAny
);
287 // push it on our stack so we export it later
288 rProperties
.push_back( aNewProperty
);
292 if( xAttrContainer
.is() )
295 aData
.Type
= GetXMLToken( XML_CDATA
);
296 aData
.Value
= rValue
;
298 OUStringBuffer sName
;
299 if( XML_NAMESPACE_NONE
!= nPrefix
)
301 sName
.append( aPrefix
);
302 sName
.append( sal_Unicode(':') );
303 aData
.Namespace
= aNamespace
;
306 sName
.append( aLocalName
);
310 xAttrContainer
->insertByName( sName
.makeStringAndClear(), aAny
);
315 while( ( nIndex
>= 0 ) && (( nFlags
& MID_FLAG_MULTI_PROPERTY
) != 0 ) );
318 finished( rProperties
, nStartIdx
, nEndIdx
);
321 /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_IMPORT flag set */
322 bool SvXMLImportPropertyMapper::handleSpecialItem(
323 XMLPropertyState
& rProperty
,
324 vector
< XMLPropertyState
>& rProperties
,
325 const OUString
& rValue
,
326 const SvXMLUnitConverter
& rUnitConverter
,
327 const SvXMLNamespaceMap
& rNamespaceMap
) const
329 OSL_ENSURE( mxNextMapper
.is(), "unsuported special item in xml import" );
330 if( mxNextMapper
.is() )
331 return mxNextMapper
->handleSpecialItem( rProperty
, rProperties
, rValue
,
332 rUnitConverter
, rNamespaceMap
);
337 void SvXMLImportPropertyMapper::FillPropertySequence(
338 const ::std::vector
< XMLPropertyState
>& rProperties
,
339 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& rValues
)
342 sal_Int32 nCount
= rProperties
.size();
343 sal_Int32 nValueCount
= 0;
344 rValues
.realloc( nCount
);
345 PropertyValue
*pProps
= rValues
.getArray();
346 for( sal_Int32 i
=0; i
< nCount
; i
++ )
348 const XMLPropertyState
& rProp
= rProperties
[i
];
349 sal_Int32 nIdx
= rProp
.mnIndex
;
352 pProps
->Name
= maPropMapper
->GetEntryAPIName( nIdx
);
353 if( !pProps
->Name
.isEmpty() )
355 pProps
->Value
<<= rProp
.maValue
;
360 if( nValueCount
< nCount
)
361 rValues
.realloc( nValueCount
);
364 void SvXMLImportPropertyMapper::CheckSpecialContext(
365 const ::std::vector
< XMLPropertyState
>& aProperties
,
366 const ::com::sun::star::uno::Reference
<
367 ::com::sun::star::beans::XPropertySet
> rPropSet
,
368 _ContextID_Index_Pair
* pSpecialContextIds
) const
370 OSL_ENSURE( rPropSet
.is(), "need an XPropertySet" );
371 sal_Int32 nCount
= aProperties
.size();
373 Reference
< XPropertySetInfo
> xInfo(rPropSet
->getPropertySetInfo());
375 for( sal_Int32 i
=0; i
< nCount
; i
++ )
377 const XMLPropertyState
& rProp
= aProperties
[i
];
378 sal_Int32 nIdx
= rProp
.mnIndex
;
380 // disregard property state if it has an invalid index
384 const sal_Int32 nPropFlags
= maPropMapper
->GetEntryFlags( nIdx
);
386 // handle no-property and special items
387 if( ( pSpecialContextIds
!= NULL
) &&
388 ( ( 0 != ( nPropFlags
& MID_FLAG_NO_PROPERTY_IMPORT
) ) ||
389 ( 0 != ( nPropFlags
& MID_FLAG_SPECIAL_ITEM_IMPORT
) ) ) )
391 // maybe it's one of our special context ids?
392 sal_Int16 nContextId
= maPropMapper
->GetEntryContextId(nIdx
);
394 for ( sal_Int32 n
= 0;
395 pSpecialContextIds
[n
].nContextID
!= -1;
398 // found: set index in pSpecialContextIds array
399 if ( pSpecialContextIds
[n
].nContextID
== nContextId
)
401 pSpecialContextIds
[n
].nIndex
= i
;
410 sal_Bool
SvXMLImportPropertyMapper::FillPropertySet(
411 const vector
< XMLPropertyState
>& aProperties
,
412 const Reference
< XPropertySet
> rPropSet
,
413 _ContextID_Index_Pair
* pSpecialContextIds
) const
415 sal_Bool bSet
= sal_False
;
417 Reference
< XTolerantMultiPropertySet
> xTolPropSet( rPropSet
, UNO_QUERY
);
418 if (xTolPropSet
.is())
419 bSet
= _FillTolerantMultiPropertySet( aProperties
, xTolPropSet
, maPropMapper
, rImport
,
420 pSpecialContextIds
);
424 // get property set info
425 Reference
< XPropertySetInfo
> xInfo(rPropSet
->getPropertySetInfo());
427 // check for multi-property set
428 Reference
<XMultiPropertySet
> xMultiPropSet( rPropSet
, UNO_QUERY
);
429 if ( xMultiPropSet
.is() )
431 // Try XMultiPropertySet. If that fails, try the regular route.
432 bSet
= _FillMultiPropertySet( aProperties
, xMultiPropSet
,
434 pSpecialContextIds
);
436 bSet
= _FillPropertySet( aProperties
, rPropSet
,
437 xInfo
, maPropMapper
, rImport
,
441 bSet
= _FillPropertySet( aProperties
, rPropSet
, xInfo
,
442 maPropMapper
, rImport
,
443 pSpecialContextIds
);
449 sal_Bool
SvXMLImportPropertyMapper::_FillPropertySet(
450 const vector
<XMLPropertyState
> & rProperties
,
451 const Reference
<XPropertySet
> & rPropSet
,
452 const Reference
<XPropertySetInfo
> & rPropSetInfo
,
453 const UniReference
<XMLPropertySetMapper
> & rPropMapper
,
454 SvXMLImport
& rImport
,
455 _ContextID_Index_Pair
* pSpecialContextIds
)
457 OSL_ENSURE( rPropSet
.is(), "need an XPropertySet" );
458 OSL_ENSURE( rPropSetInfo
.is(), "need an XPropertySetInfo" );
461 sal_Bool bSet
= sal_False
;
462 sal_Int32 nCount
= rProperties
.size();
464 // iterate over property states that we want to set
465 for( sal_Int32 i
=0; i
< nCount
; i
++ )
467 const XMLPropertyState
& rProp
= rProperties
[i
];
468 sal_Int32 nIdx
= rProp
.mnIndex
;
470 // disregard property state if it has an invalid index
474 const OUString
& rPropName
= rPropMapper
->GetEntryAPIName( nIdx
);
475 const sal_Int32 nPropFlags
= rPropMapper
->GetEntryFlags( nIdx
);
477 if ( ( 0 == ( nPropFlags
& MID_FLAG_NO_PROPERTY
) ) &&
478 ( ( 0 != ( nPropFlags
& MID_FLAG_MUST_EXIST
) ) ||
479 rPropSetInfo
->hasPropertyByName( rPropName
) ) )
481 // try setting the property
484 rPropSet
->setPropertyValue( rPropName
, rProp
.maValue
);
487 catch ( const IllegalArgumentException
& e
)
489 // illegal value: check whether this property is
490 // allowed to throw this exception
491 if ( 0 == ( nPropFlags
& MID_FLAG_PROPERTY_MAY_EXCEPT
) )
493 Sequence
<OUString
> aSeq(1);
496 XMLERROR_STYLE_PROP_VALUE
| XMLERROR_FLAG_ERROR
,
497 aSeq
, e
.Message
, NULL
);
500 catch ( const UnknownPropertyException
& e
)
502 // unknown property: This is always an error!
503 Sequence
<OUString
> aSeq(1);
506 XMLERROR_STYLE_PROP_UNKNOWN
| XMLERROR_FLAG_ERROR
,
507 aSeq
, e
.Message
, NULL
);
509 catch ( const PropertyVetoException
& e
)
511 // property veto: this shouldn't happen
512 Sequence
<OUString
> aSeq(1);
515 XMLERROR_STYLE_PROP_OTHER
| XMLERROR_FLAG_ERROR
,
516 aSeq
, e
.Message
, NULL
);
518 catch ( const WrappedTargetException
& e
)
520 // wrapped target: this shouldn't happen either
521 Sequence
<OUString
> aSeq(1);
524 XMLERROR_STYLE_PROP_OTHER
| XMLERROR_FLAG_ERROR
,
525 aSeq
, e
.Message
, NULL
);
529 // handle no-property and special items
530 if( ( pSpecialContextIds
!= NULL
) &&
531 ( ( 0 != ( nPropFlags
& MID_FLAG_NO_PROPERTY_IMPORT
) ) ||
532 ( 0 != ( nPropFlags
& MID_FLAG_SPECIAL_ITEM_IMPORT
) ) ) )
534 // maybe it's one of our special context ids?
535 sal_Int16 nContextId
= rPropMapper
->GetEntryContextId(nIdx
);
537 for ( sal_Int32 n
= 0;
538 pSpecialContextIds
[n
].nContextID
!= -1;
541 // found: set index in pSpecialContextIds array
542 if ( pSpecialContextIds
[n
].nContextID
== nContextId
)
544 pSpecialContextIds
[n
].nIndex
= i
;
556 typedef pair
<const OUString
*, const Any
* > PropertyPair
;
557 typedef vector
<PropertyPair
> PropertyPairs
;
559 struct PropertyPairLessFunctor
:
560 public std::binary_function
<PropertyPair
, PropertyPair
, bool>
562 bool operator()( const PropertyPair
& a
, const PropertyPair
& b
) const
564 return (*a
.first
< *b
.first
? true : false);
568 void SvXMLImportPropertyMapper::_PrepareForMultiPropertySet(
569 const vector
<XMLPropertyState
> & rProperties
,
570 const Reference
<XPropertySetInfo
> & rPropSetInfo
,
571 const UniReference
<XMLPropertySetMapper
> & rPropMapper
,
572 _ContextID_Index_Pair
* pSpecialContextIds
,
573 Sequence
<OUString
>& rNames
,
574 Sequence
<Any
>& rValues
)
576 sal_Int32 nCount
= rProperties
.size();
578 // property pairs structure stores names + values of properties to be set.
579 PropertyPairs aPropertyPairs
;
580 aPropertyPairs
.reserve( nCount
);
582 // iterate over property states that we want to set
584 for( i
= 0; i
< nCount
; i
++ )
586 const XMLPropertyState
& rProp
= rProperties
[i
];
587 sal_Int32 nIdx
= rProp
.mnIndex
;
589 // disregard property state if it has an invalid index
593 const OUString
& rPropName
= rPropMapper
->GetEntryAPIName( nIdx
);
594 const sal_Int32 nPropFlags
= rPropMapper
->GetEntryFlags( nIdx
);
596 if ( ( 0 == ( nPropFlags
& MID_FLAG_NO_PROPERTY
) ) &&
597 ( ( 0 != ( nPropFlags
& MID_FLAG_MUST_EXIST
) ) ||
598 !rPropSetInfo
.is() ||
599 (rPropSetInfo
.is() && rPropSetInfo
->hasPropertyByName( rPropName
)) ) )
601 // save property into property pair structure
602 aPropertyPairs
.push_back( PropertyPair( &rPropName
, &rProp
.maValue
) );
605 // handle no-property and special items
606 if( ( pSpecialContextIds
!= NULL
) &&
607 ( ( 0 != ( nPropFlags
& MID_FLAG_NO_PROPERTY_IMPORT
) ) ||
608 ( 0 != ( nPropFlags
& MID_FLAG_SPECIAL_ITEM_IMPORT
) ) ) )
610 // maybe it's one of our special context ids?
611 sal_Int16 nContextId
= rPropMapper
->GetEntryContextId(nIdx
);
612 for ( sal_Int32 n
= 0;
613 pSpecialContextIds
[n
].nContextID
!= -1;
616 // found: set index in pSpecialContextIds array
617 if ( pSpecialContextIds
[n
].nContextID
== nContextId
)
619 pSpecialContextIds
[n
].nIndex
= i
;
626 // We now need to construct the sequences and actually the set
629 // sort the property pairs
630 sort( aPropertyPairs
.begin(), aPropertyPairs
.end(),
631 PropertyPairLessFunctor());
634 rNames
.realloc( aPropertyPairs
.size() );
635 OUString
* pNamesArray
= rNames
.getArray();
636 rValues
.realloc( aPropertyPairs
.size() );
637 Any
* pValuesArray
= rValues
.getArray();
639 // copy values into sequences
641 for( PropertyPairs::iterator aIter
= aPropertyPairs
.begin();
642 aIter
!= aPropertyPairs
.end();
645 pNamesArray
[i
] = *(aIter
->first
);
646 pValuesArray
[i
++] = *(aIter
->second
);
650 sal_Bool
SvXMLImportPropertyMapper::_FillMultiPropertySet(
651 const vector
<XMLPropertyState
> & rProperties
,
652 const Reference
<XMultiPropertySet
> & rMultiPropSet
,
653 const Reference
<XPropertySetInfo
> & rPropSetInfo
,
654 const UniReference
<XMLPropertySetMapper
> & rPropMapper
,
655 _ContextID_Index_Pair
* pSpecialContextIds
)
657 OSL_ENSURE( rMultiPropSet
.is(), "Need multi property set. ");
658 OSL_ENSURE( rPropSetInfo
.is(), "Need property set info." );
660 sal_Bool bSuccessful
= sal_False
;
662 Sequence
<OUString
> aNames
;
663 Sequence
<Any
> aValues
;
665 _PrepareForMultiPropertySet(rProperties
, rPropSetInfo
, rPropMapper
, pSpecialContextIds
,
668 // and, finally, try to set the values
671 rMultiPropSet
->setPropertyValues( aNames
, aValues
);
672 bSuccessful
= sal_True
;
676 OSL_ENSURE(bSuccessful
, "Exception caught; style may not be imported correctly.");
682 sal_Bool
SvXMLImportPropertyMapper::_FillTolerantMultiPropertySet(
683 const vector
<XMLPropertyState
> & rProperties
,
684 const Reference
<XTolerantMultiPropertySet
> & rTolMultiPropSet
,
685 const UniReference
<XMLPropertySetMapper
> & rPropMapper
,
686 SvXMLImport
& rImport
,
687 _ContextID_Index_Pair
* pSpecialContextIds
)
689 OSL_ENSURE( rTolMultiPropSet
.is(), "Need tolerant multi property set. ");
691 sal_Bool bSuccessful
= sal_False
;
693 Sequence
<OUString
> aNames
;
694 Sequence
<Any
> aValues
;
696 _PrepareForMultiPropertySet(rProperties
, Reference
<XPropertySetInfo
>(NULL
), rPropMapper
, pSpecialContextIds
,
699 // and, finally, try to set the values
702 Sequence
< SetPropertyTolerantFailed
> aResults(rTolMultiPropSet
->setPropertyValuesTolerant( aNames
, aValues
));
703 if (aResults
.getLength() == 0)
704 bSuccessful
= sal_True
;
707 sal_Int32
nCount(aResults
.getLength());
708 for( sal_Int32 i
= 0; i
< nCount
; ++i
)
710 Sequence
<OUString
> aSeq(1);
711 aSeq
[0] = aResults
[i
].Name
;
713 switch (aResults
[i
].Result
)
715 case TolerantPropertySetResultType::UNKNOWN_PROPERTY
:
716 sMessage
= "UNKNOWN_PROPERTY";
718 case TolerantPropertySetResultType::ILLEGAL_ARGUMENT
:
719 sMessage
= "ILLEGAL_ARGUMENT";
721 case TolerantPropertySetResultType::PROPERTY_VETO
:
722 sMessage
= "PROPERTY_VETO";
724 case TolerantPropertySetResultType::WRAPPED_TARGET
:
725 sMessage
= "WRAPPED_TARGET";
729 XMLERROR_STYLE_PROP_OTHER
| XMLERROR_FLAG_ERROR
,
730 aSeq
, sMessage
, NULL
);
736 OSL_ENSURE(bSuccessful
, "Exception caught; style may not be imported correctly.");
742 void SvXMLImportPropertyMapper::finished(
743 vector
< XMLPropertyState
>& rProperties
,
744 sal_Int32 nStartIndex
, sal_Int32 nEndIndex
) const
746 // nothing to do here
747 if( mxNextMapper
.is() )
748 mxNextMapper
->finished( rProperties
, nStartIndex
, nEndIndex
);
751 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */