1*63bba73cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*63bba73cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*63bba73cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*63bba73cSAndrew Rist  * distributed with this work for additional information
6*63bba73cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*63bba73cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*63bba73cSAndrew Rist  * "License"); you may not use this file except in compliance
9*63bba73cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*63bba73cSAndrew Rist  *
11*63bba73cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*63bba73cSAndrew Rist  *
13*63bba73cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*63bba73cSAndrew Rist  * software distributed under the License is distributed on an
15*63bba73cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*63bba73cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*63bba73cSAndrew Rist  * specific language governing permissions and limitations
18*63bba73cSAndrew Rist  * under the License.
19*63bba73cSAndrew Rist  *
20*63bba73cSAndrew Rist  *************************************************************/
21*63bba73cSAndrew Rist 
22*63bba73cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_xmloff.hxx"
26cdf0e10cSrcweir #include "propertyimport.hxx"
27cdf0e10cSrcweir #include <xmloff/xmlimp.hxx>
28cdf0e10cSrcweir #include <xmloff/xmluconv.hxx>
29cdf0e10cSrcweir #include <xmloff/nmspmap.hxx>
30cdf0e10cSrcweir #include <osl/diagnose.h>
31cdf0e10cSrcweir #include <comphelper/extract.hxx>
32cdf0e10cSrcweir #include "callbacks.hxx"
33cdf0e10cSrcweir #include "xmloff/xmlnmspe.hxx"
34cdf0e10cSrcweir #include <tools/date.hxx>
35cdf0e10cSrcweir #include <tools/time.hxx>
36cdf0e10cSrcweir #include <tools/datetime.hxx>
37cdf0e10cSrcweir #include <com/sun/star/util/Date.hpp>
38cdf0e10cSrcweir #include <com/sun/star/util/Time.hpp>
39cdf0e10cSrcweir #include <com/sun/star/util/DateTime.hpp>
40cdf0e10cSrcweir #include <unotools/datetime.hxx>
41cdf0e10cSrcweir #include <rtl/logfile.hxx>
42cdf0e10cSrcweir 
43cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0
44cdf0e10cSrcweir     #ifndef _OSL_THREAD_H_
45cdf0e10cSrcweir     #include <osl/thread.h>
46cdf0e10cSrcweir     #endif
47cdf0e10cSrcweir #endif
48cdf0e10cSrcweir 
49cdf0e10cSrcweir //.........................................................................
50cdf0e10cSrcweir namespace xmloff
51cdf0e10cSrcweir {
52cdf0e10cSrcweir //.........................................................................
53cdf0e10cSrcweir 
54cdf0e10cSrcweir 	using namespace ::com::sun::star::uno;
55cdf0e10cSrcweir 	using namespace ::com::sun::star::beans;
56cdf0e10cSrcweir 	using namespace ::com::sun::star::xml;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir 	// NO using namespace ...util !!!
59cdf0e10cSrcweir 	// need a tools Date/Time/DateTime below, which would conflict with the uno types then
60cdf0e10cSrcweir 
61cdf0e10cSrcweir #define TYPE_DATE		1
62cdf0e10cSrcweir #define TYPE_TIME		2
63cdf0e10cSrcweir #define TYPE_DATETIME	3
64cdf0e10cSrcweir 
65cdf0e10cSrcweir //=====================================================================
66cdf0e10cSrcweir //= PropertyConversion
67cdf0e10cSrcweir //=====================================================================
68cdf0e10cSrcweir namespace
69cdf0e10cSrcweir {
70cdf0e10cSrcweir     //---------------------------------------------------------------------
lcl_getTime(double _nValue)71cdf0e10cSrcweir     ::com::sun::star::util::Time lcl_getTime(double _nValue)
72cdf0e10cSrcweir     {
73cdf0e10cSrcweir 	    ::com::sun::star::util::Time aTime;
74cdf0e10cSrcweir 	    sal_uInt32 nIntValue = sal_Int32(_nValue * 8640000);
75cdf0e10cSrcweir 	    nIntValue *= 8640000;
76cdf0e10cSrcweir 	    aTime.HundredthSeconds = (sal_uInt16)( nIntValue % 100 );
77cdf0e10cSrcweir 	    nIntValue /= 100;
78cdf0e10cSrcweir 	    aTime.Seconds = (sal_uInt16)( nIntValue % 60 );
79cdf0e10cSrcweir 	    nIntValue /= 60;
80cdf0e10cSrcweir 	    aTime.Minutes = (sal_uInt16)( nIntValue % 60 );
81cdf0e10cSrcweir 	    nIntValue /= 60;
82cdf0e10cSrcweir 	    OSL_ENSURE(nIntValue < 24, "lcl_getTime: more than a day?");
83cdf0e10cSrcweir 	    aTime.Hours = static_cast< sal_uInt16 >( nIntValue );
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 	    return aTime;
86cdf0e10cSrcweir     }
87cdf0e10cSrcweir 
88cdf0e10cSrcweir     //---------------------------------------------------------------------
lcl_getDate(double _nValue)89cdf0e10cSrcweir     static ::com::sun::star::util::Date lcl_getDate( double _nValue )
90cdf0e10cSrcweir     {
91cdf0e10cSrcweir 	    Date aToolsDate((sal_uInt32)_nValue);
92cdf0e10cSrcweir 	    ::com::sun::star::util::Date aDate;
93cdf0e10cSrcweir 	    ::utl::typeConvert(aToolsDate, aDate);
94cdf0e10cSrcweir 	    return aDate;
95cdf0e10cSrcweir     }
96cdf0e10cSrcweir }
97cdf0e10cSrcweir 
98cdf0e10cSrcweir //---------------------------------------------------------------------
convertString(SvXMLImport & _rImporter,const::com::sun::star::uno::Type & _rExpectedType,const::rtl::OUString & _rReadCharacters,const SvXMLEnumMapEntry * _pEnumMap,const sal_Bool _bInvertBoolean)99cdf0e10cSrcweir Any PropertyConversion::convertString( SvXMLImport& _rImporter, const ::com::sun::star::uno::Type& _rExpectedType,
100cdf0e10cSrcweir 	const ::rtl::OUString& _rReadCharacters, const SvXMLEnumMapEntry* _pEnumMap, const sal_Bool _bInvertBoolean )
101cdf0e10cSrcweir {
102cdf0e10cSrcweir 	Any aReturn;
103cdf0e10cSrcweir 	sal_Bool bEnumAsInt = sal_False;
104cdf0e10cSrcweir 	switch (_rExpectedType.getTypeClass())
105cdf0e10cSrcweir 	{
106cdf0e10cSrcweir 		case TypeClass_BOOLEAN:		// sal_Bool
107cdf0e10cSrcweir 		{
108cdf0e10cSrcweir 			sal_Bool bValue;
109cdf0e10cSrcweir         #if OSL_DEBUG_LEVEL > 0
110cdf0e10cSrcweir 			sal_Bool bSuccess =
111cdf0e10cSrcweir 		#endif
112cdf0e10cSrcweir 			_rImporter.GetMM100UnitConverter().convertBool(bValue, _rReadCharacters);
113cdf0e10cSrcweir 			OSL_ENSURE(bSuccess,
114cdf0e10cSrcweir 					::rtl::OString("PropertyConversion::convertString: could not convert \"")
115cdf0e10cSrcweir 				+=	::rtl::OString(_rReadCharacters.getStr(), _rReadCharacters.getLength(), RTL_TEXTENCODING_ASCII_US)
116cdf0e10cSrcweir 				+=	::rtl::OString("\" into a boolean!"));
117cdf0e10cSrcweir 			aReturn = ::cppu::bool2any(_bInvertBoolean ? !bValue : bValue);
118cdf0e10cSrcweir 		}
119cdf0e10cSrcweir 		break;
120cdf0e10cSrcweir 		case TypeClass_SHORT:		// sal_Int16
121cdf0e10cSrcweir 		case TypeClass_LONG:		// sal_Int32
122cdf0e10cSrcweir 			if (!_pEnumMap)
123cdf0e10cSrcweir 			{	// it's a real int32/16 property
124cdf0e10cSrcweir 				sal_Int32 nValue(0);
125cdf0e10cSrcweir         #if OSL_DEBUG_LEVEL > 0
126cdf0e10cSrcweir 				sal_Bool bSuccess =
127cdf0e10cSrcweir 		#endif
128cdf0e10cSrcweir 				_rImporter.GetMM100UnitConverter().convertNumber(nValue, _rReadCharacters);
129cdf0e10cSrcweir 				OSL_ENSURE(bSuccess,
130cdf0e10cSrcweir 						::rtl::OString("PropertyConversion::convertString: could not convert \"")
131cdf0e10cSrcweir 					+=	::rtl::OString(_rReadCharacters.getStr(), _rReadCharacters.getLength(), RTL_TEXTENCODING_ASCII_US)
132cdf0e10cSrcweir 					+=	::rtl::OString("\" into an integer!"));
133cdf0e10cSrcweir 				if (TypeClass_SHORT == _rExpectedType.getTypeClass())
134cdf0e10cSrcweir 					aReturn <<= (sal_Int16)nValue;
135cdf0e10cSrcweir 				else
136cdf0e10cSrcweir 					aReturn <<= (sal_Int32)nValue;
137cdf0e10cSrcweir 				break;
138cdf0e10cSrcweir 			}
139cdf0e10cSrcweir 			bEnumAsInt = sal_True;
140cdf0e10cSrcweir 			// NO BREAK! handle it as enum
141cdf0e10cSrcweir 		case TypeClass_ENUM:
142cdf0e10cSrcweir 		{
143cdf0e10cSrcweir 			sal_uInt16 nEnumValue(0);
144cdf0e10cSrcweir         #if OSL_DEBUG_LEVEL > 0
145cdf0e10cSrcweir 			sal_Bool bSuccess =
146cdf0e10cSrcweir 		#endif
147cdf0e10cSrcweir 			_rImporter.GetMM100UnitConverter().convertEnum(nEnumValue, _rReadCharacters, _pEnumMap);
148cdf0e10cSrcweir 			OSL_ENSURE(bSuccess, "PropertyConversion::convertString: could not convert to an enum value!");
149cdf0e10cSrcweir 			if (bEnumAsInt)
150cdf0e10cSrcweir 				if (TypeClass_SHORT == _rExpectedType.getTypeClass())
151cdf0e10cSrcweir 					aReturn <<= (sal_Int16)nEnumValue;
152cdf0e10cSrcweir 				else
153cdf0e10cSrcweir 					aReturn <<= (sal_Int32)nEnumValue;
154cdf0e10cSrcweir 			else
155cdf0e10cSrcweir 				aReturn = ::cppu::int2enum((sal_Int32)nEnumValue, _rExpectedType);
156cdf0e10cSrcweir 		}
157cdf0e10cSrcweir 		break;
158cdf0e10cSrcweir 		case TypeClass_HYPER:
159cdf0e10cSrcweir 		{
160cdf0e10cSrcweir 			OSL_ENSURE(sal_False, "PropertyConversion::convertString: 64-bit integers not implemented yet!");
161cdf0e10cSrcweir 		}
162cdf0e10cSrcweir 		break;
163cdf0e10cSrcweir 		case TypeClass_DOUBLE:
164cdf0e10cSrcweir 		{
165cdf0e10cSrcweir 			double nValue;
166cdf0e10cSrcweir         #if OSL_DEBUG_LEVEL > 0
167cdf0e10cSrcweir 			sal_Bool bSuccess =
168cdf0e10cSrcweir 		#endif
169cdf0e10cSrcweir 			_rImporter.GetMM100UnitConverter().convertDouble(nValue, _rReadCharacters);
170cdf0e10cSrcweir 			OSL_ENSURE(bSuccess,
171cdf0e10cSrcweir 					::rtl::OString("PropertyConversion::convertString: could not convert \"")
172cdf0e10cSrcweir 				+=	::rtl::OString(_rReadCharacters.getStr(), _rReadCharacters.getLength(), RTL_TEXTENCODING_ASCII_US)
173cdf0e10cSrcweir 				+=	::rtl::OString("\" into a double!"));
174cdf0e10cSrcweir 			aReturn <<= (double)nValue;
175cdf0e10cSrcweir 		}
176cdf0e10cSrcweir 		break;
177cdf0e10cSrcweir 		case TypeClass_STRING:
178cdf0e10cSrcweir 			aReturn <<= _rReadCharacters;
179cdf0e10cSrcweir 			break;
180cdf0e10cSrcweir 		case TypeClass_STRUCT:
181cdf0e10cSrcweir 		{
182cdf0e10cSrcweir 			sal_Int32 nType = 0;
183cdf0e10cSrcweir             if ( _rExpectedType.equals( ::cppu::UnoType< ::com::sun::star::util::Date >::get() ) )
184cdf0e10cSrcweir                 nType = TYPE_DATE;
185cdf0e10cSrcweir             else if ( _rExpectedType.equals( ::cppu::UnoType< ::com::sun::star::util::Time >::get() ) )
186cdf0e10cSrcweir                 nType = TYPE_TIME;
187cdf0e10cSrcweir             else  if ( _rExpectedType.equals( ::cppu::UnoType< ::com::sun::star::util::DateTime >::get() ) )
188cdf0e10cSrcweir                 nType = TYPE_DATETIME;
189cdf0e10cSrcweir 
190cdf0e10cSrcweir             if ( nType )
191cdf0e10cSrcweir 			{
192cdf0e10cSrcweir 				// first extract the double
193cdf0e10cSrcweir 				double nValue = 0;
194cdf0e10cSrcweir             #if OSL_DEBUG_LEVEL > 0
195cdf0e10cSrcweir 				sal_Bool bSuccess =
196cdf0e10cSrcweir 			#endif
197cdf0e10cSrcweir 				_rImporter.GetMM100UnitConverter().convertDouble(nValue, _rReadCharacters);
198cdf0e10cSrcweir 				OSL_ENSURE(bSuccess,
199cdf0e10cSrcweir 						::rtl::OString("PropertyConversion::convertString: could not convert \"")
200cdf0e10cSrcweir 					+=	::rtl::OString(_rReadCharacters.getStr(), _rReadCharacters.getLength(), RTL_TEXTENCODING_ASCII_US)
201cdf0e10cSrcweir 					+=	::rtl::OString("\" into a double!"));
202cdf0e10cSrcweir 
203cdf0e10cSrcweir 				// then convert it into the target type
204cdf0e10cSrcweir 				switch (nType)
205cdf0e10cSrcweir 				{
206cdf0e10cSrcweir 					case TYPE_DATE:
207cdf0e10cSrcweir 					{
208cdf0e10cSrcweir 						OSL_ENSURE(((sal_uInt32)nValue) - nValue == 0,
209cdf0e10cSrcweir 							"PropertyConversion::convertString: a Date value with a fractional part?");
210cdf0e10cSrcweir 						aReturn <<= lcl_getDate(nValue);
211cdf0e10cSrcweir 					}
212cdf0e10cSrcweir 					break;
213cdf0e10cSrcweir 					case TYPE_TIME:
214cdf0e10cSrcweir 					{
215cdf0e10cSrcweir 						OSL_ENSURE(((sal_uInt32)nValue) == 0,
216cdf0e10cSrcweir 							"PropertyConversion::convertString: a Time value with more than a fractional part?");
217cdf0e10cSrcweir 						aReturn <<= lcl_getTime(nValue);
218cdf0e10cSrcweir 					}
219cdf0e10cSrcweir 					break;
220cdf0e10cSrcweir 					case TYPE_DATETIME:
221cdf0e10cSrcweir 					{
222cdf0e10cSrcweir 						::com::sun::star::util::Time aTime = lcl_getTime(nValue);
223cdf0e10cSrcweir 						::com::sun::star::util::Date aDate = lcl_getDate(nValue);
224cdf0e10cSrcweir 
225cdf0e10cSrcweir 						::com::sun::star::util::DateTime aDateTime;
226cdf0e10cSrcweir 						aDateTime.HundredthSeconds = aTime.HundredthSeconds;
227cdf0e10cSrcweir 						aDateTime.Seconds = aTime.Seconds;
228cdf0e10cSrcweir 						aDateTime.Minutes = aTime.Minutes;
229cdf0e10cSrcweir 						aDateTime.Hours = aTime.Hours;
230cdf0e10cSrcweir 						aDateTime.Day = aDate.Day;
231cdf0e10cSrcweir 						aDateTime.Month = aDate.Month;
232cdf0e10cSrcweir 						aDateTime.Year = aDate.Year;
233cdf0e10cSrcweir 						aReturn <<= aDateTime;
234cdf0e10cSrcweir 					}
235cdf0e10cSrcweir 					break;
236cdf0e10cSrcweir 				}
237cdf0e10cSrcweir 			}
238cdf0e10cSrcweir 			else
239cdf0e10cSrcweir 				OSL_ENSURE(sal_False, "PropertyConversion::convertString: unsupported property type!");
240cdf0e10cSrcweir 		}
241cdf0e10cSrcweir 		break;
242cdf0e10cSrcweir 		default:
243cdf0e10cSrcweir 			OSL_ENSURE(sal_False, "PropertyConversion::convertString: invalid type class!");
244cdf0e10cSrcweir 	}
245cdf0e10cSrcweir 
246cdf0e10cSrcweir 	return aReturn;
247cdf0e10cSrcweir }
248cdf0e10cSrcweir 
249cdf0e10cSrcweir //---------------------------------------------------------------------
xmlTypeToUnoType(const::rtl::OUString & _rType)250cdf0e10cSrcweir Type PropertyConversion::xmlTypeToUnoType( const ::rtl::OUString& _rType )
251cdf0e10cSrcweir {
252cdf0e10cSrcweir     Type aUnoType( ::getVoidCppuType() );
253cdf0e10cSrcweir 
254cdf0e10cSrcweir 	DECLARE_STL_USTRINGACCESS_MAP( ::com::sun::star::uno::Type, MapString2Type );
255cdf0e10cSrcweir 	static MapString2Type s_aTypeNameMap;
256cdf0e10cSrcweir 	if ( s_aTypeNameMap.empty() )
257cdf0e10cSrcweir 	{
258cdf0e10cSrcweir 		s_aTypeNameMap[ token::GetXMLToken( token::XML_BOOLEAN ) ] = ::getBooleanCppuType();
259cdf0e10cSrcweir 		s_aTypeNameMap[ token::GetXMLToken( token::XML_FLOAT )   ] = ::getCppuType( static_cast< double* >(NULL) );
260cdf0e10cSrcweir 		s_aTypeNameMap[ token::GetXMLToken( token::XML_STRING )  ] = ::getCppuType( static_cast< ::rtl::OUString* >(NULL) );
261cdf0e10cSrcweir 		s_aTypeNameMap[ token::GetXMLToken( token::XML_VOID )    ] = ::getVoidCppuType();
262cdf0e10cSrcweir 	}
263cdf0e10cSrcweir 
264cdf0e10cSrcweir 	const ConstMapString2TypeIterator aTypePos = s_aTypeNameMap.find( _rType );
265cdf0e10cSrcweir     OSL_ENSURE( s_aTypeNameMap.end() != aTypePos, "PropertyConversion::xmlTypeToUnoType: invalid property name!" );
266cdf0e10cSrcweir 	if ( s_aTypeNameMap.end() != aTypePos )
267cdf0e10cSrcweir 		aUnoType = aTypePos->second;
268cdf0e10cSrcweir 
269cdf0e10cSrcweir     return aUnoType;
270cdf0e10cSrcweir }
271cdf0e10cSrcweir 
272cdf0e10cSrcweir //=====================================================================
273cdf0e10cSrcweir //= OPropertyImport
274cdf0e10cSrcweir //=====================================================================
275cdf0e10cSrcweir //---------------------------------------------------------------------
OPropertyImport(OFormLayerXMLImport_Impl & _rImport,sal_uInt16 _nPrefix,const::rtl::OUString & _rName)276cdf0e10cSrcweir OPropertyImport::OPropertyImport(OFormLayerXMLImport_Impl& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName)
277cdf0e10cSrcweir 	:SvXMLImportContext(_rImport.getGlobalContext(), _nPrefix, _rName)
278cdf0e10cSrcweir 	,m_rContext(_rImport)
279cdf0e10cSrcweir 	,m_bTrackAttributes(sal_False)
280cdf0e10cSrcweir {
281cdf0e10cSrcweir }
282cdf0e10cSrcweir 
283cdf0e10cSrcweir //---------------------------------------------------------------------
CreateChildContext(sal_uInt16 _nPrefix,const::rtl::OUString & _rLocalName,const Reference<sax::XAttributeList> & _rxAttrList)284cdf0e10cSrcweir SvXMLImportContext* OPropertyImport::CreateChildContext(sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
285cdf0e10cSrcweir 	const Reference< sax::XAttributeList >& _rxAttrList)
286cdf0e10cSrcweir {
287cdf0e10cSrcweir 	if( token::IsXMLToken( _rLocalName, token::XML_PROPERTIES) )
288cdf0e10cSrcweir 	{
289cdf0e10cSrcweir 		return new OPropertyElementsContext( m_rContext.getGlobalContext(),
290cdf0e10cSrcweir 											 _nPrefix, _rLocalName, this);
291cdf0e10cSrcweir 	}
292cdf0e10cSrcweir 	else
293cdf0e10cSrcweir 	{
294cdf0e10cSrcweir 		OSL_ENSURE(sal_False,
295cdf0e10cSrcweir 				::rtl::OString("OPropertyImport::CreateChildContext: unknown sub element (only \"properties\" is recognized, but it is ")
296cdf0e10cSrcweir 			+=	::rtl::OString(_rLocalName.getStr(), _rLocalName.getLength(), RTL_TEXTENCODING_ASCII_US)
297cdf0e10cSrcweir 			+=	::rtl::OString(")!"));
298cdf0e10cSrcweir 		return SvXMLImportContext::CreateChildContext(_nPrefix, _rLocalName, _rxAttrList);
299cdf0e10cSrcweir 	}
300cdf0e10cSrcweir }
301cdf0e10cSrcweir 
302cdf0e10cSrcweir //---------------------------------------------------------------------
StartElement(const Reference<sax::XAttributeList> & _rxAttrList)303cdf0e10cSrcweir void OPropertyImport::StartElement(const Reference< sax::XAttributeList >& _rxAttrList)
304cdf0e10cSrcweir {
305cdf0e10cSrcweir 	OSL_ENSURE(_rxAttrList.is(), "OPropertyImport::StartElement: invalid attribute list!");
306cdf0e10cSrcweir 	const sal_Int32 nAttributeCount = _rxAttrList->getLength();
307cdf0e10cSrcweir 
308cdf0e10cSrcweir 	// assume the 'worst' case: all attributes describe properties. This should save our property array
309cdf0e10cSrcweir 	// some reallocs
310cdf0e10cSrcweir 	m_aValues.reserve(nAttributeCount);
311cdf0e10cSrcweir 
312cdf0e10cSrcweir     const SvXMLNamespaceMap& rMap = m_rContext.getGlobalContext().GetNamespaceMap();
313cdf0e10cSrcweir 	sal_uInt16 nNamespace;
314cdf0e10cSrcweir 	::rtl::OUString sLocalName;
315cdf0e10cSrcweir 	for (sal_Int16 i=0; i<nAttributeCount; ++i)
316cdf0e10cSrcweir 	{
317cdf0e10cSrcweir 		nNamespace = rMap.GetKeyByAttrName(_rxAttrList->getNameByIndex(i), &sLocalName);
318cdf0e10cSrcweir 		handleAttribute(nNamespace, sLocalName, _rxAttrList->getValueByIndex(i));
319cdf0e10cSrcweir 
320cdf0e10cSrcweir 		if (m_bTrackAttributes)
321cdf0e10cSrcweir 			m_aEncounteredAttributes.insert(sLocalName);
322cdf0e10cSrcweir 	}
323cdf0e10cSrcweir 
324cdf0e10cSrcweir 	// TODO: create PropertyValues for all the attributes which were not present, because they were implied
325cdf0e10cSrcweir     // this is necessary as soon as we have properties where the XML default is different from the property
326cdf0e10cSrcweir     // default
327cdf0e10cSrcweir }
328cdf0e10cSrcweir 
329cdf0e10cSrcweir //---------------------------------------------------------------------
encounteredAttribute(const::rtl::OUString & _rAttributeName) const330cdf0e10cSrcweir sal_Bool OPropertyImport::encounteredAttribute(const ::rtl::OUString& _rAttributeName) const
331cdf0e10cSrcweir {
332cdf0e10cSrcweir 	OSL_ENSURE(m_bTrackAttributes, "OPropertyImport::encounteredAttribute: attribute tracking not enabled!");
333cdf0e10cSrcweir 	return m_aEncounteredAttributes.end() != m_aEncounteredAttributes.find(_rAttributeName);
334cdf0e10cSrcweir }
335cdf0e10cSrcweir 
336cdf0e10cSrcweir //---------------------------------------------------------------------
Characters(const::rtl::OUString & _rChars)337cdf0e10cSrcweir void OPropertyImport::Characters(const ::rtl::OUString&
338cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0
339cdf0e10cSrcweir _rChars
340cdf0e10cSrcweir #endif
341cdf0e10cSrcweir )
342cdf0e10cSrcweir {
343cdf0e10cSrcweir 	// ignore them (should be whitespaces only)
344cdf0e10cSrcweir 	OSL_ENSURE(0 == _rChars.trim().getLength(), "OPropertyImport::Characters: non-whitespace characters!");
345cdf0e10cSrcweir }
346cdf0e10cSrcweir 
347cdf0e10cSrcweir //---------------------------------------------------------------------
handleAttribute(sal_uInt16,const::rtl::OUString & _rLocalName,const::rtl::OUString & _rValue)348cdf0e10cSrcweir bool OPropertyImport::handleAttribute(sal_uInt16 /*_nNamespaceKey*/, const ::rtl::OUString& _rLocalName, const ::rtl::OUString& _rValue)
349cdf0e10cSrcweir {
350cdf0e10cSrcweir 	const OAttribute2Property::AttributeAssignment* pProperty = m_rContext.getAttributeMap().getAttributeTranslation(_rLocalName);
351cdf0e10cSrcweir 	if (pProperty)
352cdf0e10cSrcweir 	{
353cdf0e10cSrcweir 		// create and store a new PropertyValue
354cdf0e10cSrcweir 		PropertyValue aNewValue;
355cdf0e10cSrcweir 		aNewValue.Name = pProperty->sPropertyName;
356cdf0e10cSrcweir 
357cdf0e10cSrcweir 		// convert the value string into the target type
358cdf0e10cSrcweir 		aNewValue.Value = PropertyConversion::convertString(m_rContext.getGlobalContext(), pProperty->aPropertyType, _rValue, pProperty->pEnumMap, pProperty->bInverseSemantics);
359cdf0e10cSrcweir 		implPushBackPropertyValue( aNewValue );
360cdf0e10cSrcweir         return true;
361cdf0e10cSrcweir 	}
362cdf0e10cSrcweir 	if (!token::IsXMLToken(_rLocalName, token::XML_TYPE))  // xlink:type is valid but ignored for <form:form>
363cdf0e10cSrcweir     {
364cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0
365cdf0e10cSrcweir         ::rtl::OString sMessage( "OPropertyImport::handleAttribute: Can't handle the following:\n" );
366cdf0e10cSrcweir         sMessage += ::rtl::OString( "  Attribute name: " );
367cdf0e10cSrcweir         sMessage += ::rtl::OString( _rLocalName.getStr(), _rLocalName.getLength(), osl_getThreadTextEncoding() );
368cdf0e10cSrcweir         sMessage += ::rtl::OString( "\n  value: " );
369cdf0e10cSrcweir         sMessage += ::rtl::OString( _rValue.getStr(), _rValue.getLength(), osl_getThreadTextEncoding() );
370cdf0e10cSrcweir         OSL_ENSURE( sal_False, sMessage.getStr() );
371cdf0e10cSrcweir #endif
372cdf0e10cSrcweir         return false;
373cdf0e10cSrcweir     }
374cdf0e10cSrcweir     return true;
375cdf0e10cSrcweir }
376cdf0e10cSrcweir 
377cdf0e10cSrcweir //=====================================================================
378cdf0e10cSrcweir //= OPropertyElementsContext
379cdf0e10cSrcweir //=====================================================================
380cdf0e10cSrcweir //---------------------------------------------------------------------
OPropertyElementsContext(SvXMLImport & _rImport,sal_uInt16 _nPrefix,const::rtl::OUString & _rName,const OPropertyImportRef & _rPropertyImporter)381cdf0e10cSrcweir OPropertyElementsContext::OPropertyElementsContext(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
382cdf0e10cSrcweir 		const OPropertyImportRef& _rPropertyImporter)
383cdf0e10cSrcweir 	:SvXMLImportContext(_rImport, _nPrefix, _rName)
384cdf0e10cSrcweir 	,m_xPropertyImporter(_rPropertyImporter)
385cdf0e10cSrcweir {
386cdf0e10cSrcweir }
387cdf0e10cSrcweir 
388cdf0e10cSrcweir //---------------------------------------------------------------------
CreateChildContext(sal_uInt16 _nPrefix,const::rtl::OUString & _rLocalName,const Reference<sax::XAttributeList> &)389cdf0e10cSrcweir SvXMLImportContext* OPropertyElementsContext::CreateChildContext(sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
390cdf0e10cSrcweir 	const Reference< sax::XAttributeList >&)
391cdf0e10cSrcweir {
392cdf0e10cSrcweir 	if( token::IsXMLToken( _rLocalName, token::XML_PROPERTY ) )
393cdf0e10cSrcweir 	{
394cdf0e10cSrcweir 		return new OSinglePropertyContext(GetImport(), _nPrefix, _rLocalName, m_xPropertyImporter);
395cdf0e10cSrcweir 	}
396cdf0e10cSrcweir 	else if( token::IsXMLToken( _rLocalName, token::XML_LIST_PROPERTY ) )
397cdf0e10cSrcweir 	{
398cdf0e10cSrcweir 		return new OListPropertyContext( GetImport(), _nPrefix, _rLocalName, m_xPropertyImporter );
399cdf0e10cSrcweir 	}
400cdf0e10cSrcweir 	else
401cdf0e10cSrcweir 	{
402cdf0e10cSrcweir 		OSL_ENSURE(sal_False,
403cdf0e10cSrcweir 				::rtl::OString("OPropertyElementsContext::CreateChildContext: unknown child element (\"")
404cdf0e10cSrcweir 			+=	::rtl::OString(_rLocalName.getStr(), _rLocalName.getLength(), RTL_TEXTENCODING_ASCII_US)
405cdf0e10cSrcweir 			+=	::rtl::OString("\")!"));
406cdf0e10cSrcweir 		return new SvXMLImportContext(GetImport(), _nPrefix, _rLocalName);
407cdf0e10cSrcweir 	}
408cdf0e10cSrcweir }
409cdf0e10cSrcweir 
410cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0
411cdf0e10cSrcweir 	//---------------------------------------------------------------------
StartElement(const Reference<sax::XAttributeList> & _rxAttrList)412cdf0e10cSrcweir 	void OPropertyElementsContext::StartElement(const Reference< sax::XAttributeList >& _rxAttrList)
413cdf0e10cSrcweir 	{
414cdf0e10cSrcweir 		OSL_ENSURE(0 == _rxAttrList->getLength(), "OPropertyElementsContext::StartElement: the form:properties element should not have attributes!");
415cdf0e10cSrcweir 		SvXMLImportContext::StartElement(_rxAttrList);
416cdf0e10cSrcweir 	}
417cdf0e10cSrcweir 
418cdf0e10cSrcweir 	//---------------------------------------------------------------------
Characters(const::rtl::OUString & _rChars)419cdf0e10cSrcweir 	void OPropertyElementsContext::Characters(const ::rtl::OUString& _rChars)
420cdf0e10cSrcweir 	{
421cdf0e10cSrcweir 		OSL_ENSURE(0 == _rChars.trim(), "OPropertyElementsContext::Characters: non-whitespace characters detected!");
422cdf0e10cSrcweir 		SvXMLImportContext::Characters(_rChars);
423cdf0e10cSrcweir 	}
424cdf0e10cSrcweir 
425cdf0e10cSrcweir #endif
426cdf0e10cSrcweir 
427cdf0e10cSrcweir //=====================================================================
428cdf0e10cSrcweir //= OSinglePropertyContext
429cdf0e10cSrcweir //=====================================================================
430cdf0e10cSrcweir //---------------------------------------------------------------------
OSinglePropertyContext(SvXMLImport & _rImport,sal_uInt16 _nPrefix,const::rtl::OUString & _rName,const OPropertyImportRef & _rPropertyImporter)431cdf0e10cSrcweir OSinglePropertyContext::OSinglePropertyContext(SvXMLImport& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
432cdf0e10cSrcweir 		const OPropertyImportRef& _rPropertyImporter)
433cdf0e10cSrcweir 	:SvXMLImportContext(_rImport, _nPrefix, _rName)
434cdf0e10cSrcweir 	,m_xPropertyImporter(_rPropertyImporter)
435cdf0e10cSrcweir {
436cdf0e10cSrcweir }
437cdf0e10cSrcweir 
438cdf0e10cSrcweir //---------------------------------------------------------------------
CreateChildContext(sal_uInt16 _nPrefix,const::rtl::OUString & _rLocalName,const Reference<sax::XAttributeList> &)439cdf0e10cSrcweir SvXMLImportContext* OSinglePropertyContext::CreateChildContext(sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName,
440cdf0e10cSrcweir 		const Reference< sax::XAttributeList >&)
441cdf0e10cSrcweir {
442cdf0e10cSrcweir 	OSL_ENSURE(sal_False,
443cdf0e10cSrcweir 			::rtl::OString("OSinglePropertyContext::CreateChildContext: unknown child element (\"")
444cdf0e10cSrcweir 		+=	::rtl::OString(_rLocalName.getStr(), _rLocalName.getLength(), RTL_TEXTENCODING_ASCII_US)
445cdf0e10cSrcweir 		+=	::rtl::OString("\")!"));
446cdf0e10cSrcweir 	return new SvXMLImportContext(GetImport(), _nPrefix, _rLocalName);
447cdf0e10cSrcweir }
448cdf0e10cSrcweir 
449cdf0e10cSrcweir //---------------------------------------------------------------------
StartElement(const Reference<sax::XAttributeList> & _rxAttrList)450cdf0e10cSrcweir void OSinglePropertyContext::StartElement(const Reference< sax::XAttributeList >& _rxAttrList)
451cdf0e10cSrcweir {
452cdf0e10cSrcweir 	::com::sun::star::beans::PropertyValue aPropValue;		// the property the instance imports currently
453cdf0e10cSrcweir 	::com::sun::star::uno::Type	aPropType;			// the type of the property the instance imports currently
454cdf0e10cSrcweir 
455cdf0e10cSrcweir 	::rtl::OUString sType, sValue;
456cdf0e10cSrcweir     const SvXMLNamespaceMap& rMap = GetImport().GetNamespaceMap();
457cdf0e10cSrcweir 	const sal_Int16 nAttrCount = _rxAttrList.is() ? _rxAttrList->getLength() : 0;
458cdf0e10cSrcweir 	for( sal_Int16 i=0; i < nAttrCount; i++ )
459cdf0e10cSrcweir 	{
460cdf0e10cSrcweir 		const ::rtl::OUString& rAttrName = _rxAttrList->getNameByIndex( i );
461cdf0e10cSrcweir 		//const ::rtl::OUString& rValue = _rxAttrList->getValueByIndex( i );
462cdf0e10cSrcweir 
463cdf0e10cSrcweir 		::rtl::OUString aLocalName;
464cdf0e10cSrcweir 		sal_uInt16 nPrefix =
465cdf0e10cSrcweir 			rMap.GetKeyByAttrName( rAttrName,
466cdf0e10cSrcweir 															&aLocalName );
467cdf0e10cSrcweir 		if( XML_NAMESPACE_FORM == nPrefix )
468cdf0e10cSrcweir 		{
469cdf0e10cSrcweir 			if( token::IsXMLToken( aLocalName, token::XML_PROPERTY_NAME ) )
470cdf0e10cSrcweir 				aPropValue.Name = _rxAttrList->getValueByIndex( i );
471cdf0e10cSrcweir 
472cdf0e10cSrcweir 		}
473cdf0e10cSrcweir 		else if( XML_NAMESPACE_OFFICE == nPrefix )
474cdf0e10cSrcweir 		{
475cdf0e10cSrcweir 			if( token::IsXMLToken( aLocalName, token::XML_VALUE_TYPE ) )
476cdf0e10cSrcweir 				sType = _rxAttrList->getValueByIndex( i );
477cdf0e10cSrcweir 			else if( token::IsXMLToken( aLocalName,
478cdf0e10cSrcweir 										token::XML_VALUE ) ||
479cdf0e10cSrcweir 				   	 token::IsXMLToken( aLocalName,
480cdf0e10cSrcweir 										token::XML_BOOLEAN_VALUE ) ||
481cdf0e10cSrcweir 					 token::IsXMLToken( aLocalName,
482cdf0e10cSrcweir 										token::XML_STRING_VALUE ) )
483cdf0e10cSrcweir 				sValue = _rxAttrList->getValueByIndex( i );
484cdf0e10cSrcweir 		}
485cdf0e10cSrcweir 	}
486cdf0e10cSrcweir 
487cdf0e10cSrcweir 	// the name of the property
488cdf0e10cSrcweir 	OSL_ENSURE(aPropValue.Name.getLength(), "OSinglePropertyContext::StartElement: invalid property name!");
489cdf0e10cSrcweir 
490cdf0e10cSrcweir 	// needs to be translated into a ::com::sun::star::uno::Type
491cdf0e10cSrcweir     aPropType = PropertyConversion::xmlTypeToUnoType( sType );
492cdf0e10cSrcweir 	if( TypeClass_VOID == aPropType.getTypeClass() )
493cdf0e10cSrcweir 	{
494cdf0e10cSrcweir 		aPropValue.Value = Any();
495cdf0e10cSrcweir 	}
496cdf0e10cSrcweir 	else
497cdf0e10cSrcweir 	{
498cdf0e10cSrcweir 		aPropValue.Value =
499cdf0e10cSrcweir 			PropertyConversion::convertString(GetImport(), aPropType,
500cdf0e10cSrcweir 										   sValue);
501cdf0e10cSrcweir 	}
502cdf0e10cSrcweir 
503cdf0e10cSrcweir 	// now that we finally have our property value, add it to our parent object
504cdf0e10cSrcweir 	if( aPropValue.Name.getLength() )
505cdf0e10cSrcweir 		m_xPropertyImporter->implPushBackGenericPropertyValue(aPropValue);
506cdf0e10cSrcweir }
507cdf0e10cSrcweir 
508cdf0e10cSrcweir //=====================================================================
509cdf0e10cSrcweir //= OListPropertyContext
510cdf0e10cSrcweir //=====================================================================
511cdf0e10cSrcweir //---------------------------------------------------------------------
OListPropertyContext(SvXMLImport & _rImport,sal_uInt16 _nPrefix,const::rtl::OUString & _rName,const OPropertyImportRef & _rPropertyImporter)512cdf0e10cSrcweir OListPropertyContext::OListPropertyContext( SvXMLImport& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName,
513cdf0e10cSrcweir     const OPropertyImportRef& _rPropertyImporter )
514cdf0e10cSrcweir     :SvXMLImportContext( _rImport, _nPrefix, _rName )
515cdf0e10cSrcweir     ,m_xPropertyImporter( _rPropertyImporter )
516cdf0e10cSrcweir {
517cdf0e10cSrcweir }
518cdf0e10cSrcweir 
519cdf0e10cSrcweir //---------------------------------------------------------------------
StartElement(const Reference<sax::XAttributeList> & _rxAttrList)520cdf0e10cSrcweir void OListPropertyContext::StartElement( const Reference< sax::XAttributeList >& _rxAttrList )
521cdf0e10cSrcweir {
522cdf0e10cSrcweir 	sal_Int32 nAttributeCount = _rxAttrList->getLength();
523cdf0e10cSrcweir 
524cdf0e10cSrcweir 	sal_uInt16 nNamespace;
525cdf0e10cSrcweir 	::rtl::OUString sAttributeName;
526cdf0e10cSrcweir     const SvXMLNamespaceMap& rMap = GetImport().GetNamespaceMap();
527cdf0e10cSrcweir 	for ( sal_Int16 i = 0; i < nAttributeCount; ++i )
528cdf0e10cSrcweir 	{
529cdf0e10cSrcweir 		nNamespace = rMap.GetKeyByAttrName( _rxAttrList->getNameByIndex( i ), &sAttributeName );
530cdf0e10cSrcweir 		if  (   ( XML_NAMESPACE_FORM == nNamespace )
531cdf0e10cSrcweir             &&  ( token::IsXMLToken( sAttributeName, token::XML_PROPERTY_NAME ) )
532cdf0e10cSrcweir             )
533cdf0e10cSrcweir         {
534cdf0e10cSrcweir             m_sPropertyName = _rxAttrList->getValueByIndex( i );
535cdf0e10cSrcweir         }
536cdf0e10cSrcweir         else if (   ( XML_NAMESPACE_OFFICE == nNamespace )
537cdf0e10cSrcweir                 &&  ( token::IsXMLToken( sAttributeName, token::XML_VALUE_TYPE ) )
538cdf0e10cSrcweir                 )
539cdf0e10cSrcweir         {
540cdf0e10cSrcweir             m_sPropertyType = _rxAttrList->getValueByIndex( i );
541cdf0e10cSrcweir         }
542cdf0e10cSrcweir         else
543cdf0e10cSrcweir         {
544cdf0e10cSrcweir 		    OSL_ENSURE( false,
545cdf0e10cSrcweir 				    ::rtl::OString( "OListPropertyContext::StartElement: unknown child element (\"")
546cdf0e10cSrcweir 			    +=	::rtl::OString( sAttributeName.getStr(), sAttributeName.getLength(), RTL_TEXTENCODING_ASCII_US )
547cdf0e10cSrcweir 			    +=	::rtl::OString( "\")!" ) );
548cdf0e10cSrcweir         }
549cdf0e10cSrcweir 	}
550cdf0e10cSrcweir }
551cdf0e10cSrcweir 
552cdf0e10cSrcweir //---------------------------------------------------------------------
EndElement()553cdf0e10cSrcweir void OListPropertyContext::EndElement()
554cdf0e10cSrcweir {
555cdf0e10cSrcweir     OSL_ENSURE( m_sPropertyName.getLength() && m_sPropertyType.getLength(),
556cdf0e10cSrcweir         "OListPropertyContext::EndElement: no property name or type!" );
557cdf0e10cSrcweir 
558cdf0e10cSrcweir     if ( !m_sPropertyName.getLength() || !m_sPropertyType.getLength() )
559cdf0e10cSrcweir         return;
560cdf0e10cSrcweir 
561cdf0e10cSrcweir     Sequence< Any > aListElements( m_aListValues.size() );
562cdf0e10cSrcweir     Any* pListElement = aListElements.getArray();
563cdf0e10cSrcweir     com::sun::star::uno::Type aType = PropertyConversion::xmlTypeToUnoType( m_sPropertyType );
564cdf0e10cSrcweir     for (   ::std::vector< ::rtl::OUString >::const_iterator values = m_aListValues.begin();
565cdf0e10cSrcweir             values != m_aListValues.end();
566cdf0e10cSrcweir             ++values, ++pListElement
567cdf0e10cSrcweir         )
568cdf0e10cSrcweir     {
569cdf0e10cSrcweir         *pListElement = PropertyConversion::convertString( GetImport(), aType, *values );
570cdf0e10cSrcweir     }
571cdf0e10cSrcweir 
572cdf0e10cSrcweir     PropertyValue aSequenceValue;
573cdf0e10cSrcweir     aSequenceValue.Name = m_sPropertyName;
574cdf0e10cSrcweir     aSequenceValue.Value <<= aListElements;
575cdf0e10cSrcweir 
576cdf0e10cSrcweir     m_xPropertyImporter->implPushBackGenericPropertyValue( aSequenceValue );
577cdf0e10cSrcweir }
578cdf0e10cSrcweir 
579cdf0e10cSrcweir //---------------------------------------------------------------------
CreateChildContext(sal_uInt16 _nPrefix,const::rtl::OUString & _rLocalName,const Reference<sax::XAttributeList> &)580cdf0e10cSrcweir SvXMLImportContext* OListPropertyContext::CreateChildContext( sal_uInt16 _nPrefix, const ::rtl::OUString& _rLocalName, const Reference< sax::XAttributeList >& /*_rxAttrList*/ )
581cdf0e10cSrcweir {
582cdf0e10cSrcweir 	if ( token::IsXMLToken( _rLocalName, token::XML_LIST_VALUE ) )
583cdf0e10cSrcweir 	{
584cdf0e10cSrcweir         m_aListValues.resize( m_aListValues.size() + 1 );
585cdf0e10cSrcweir 		return new OListValueContext( GetImport(), _nPrefix, _rLocalName, *m_aListValues.rbegin() );
586cdf0e10cSrcweir 	}
587cdf0e10cSrcweir 	else
588cdf0e10cSrcweir 	{
589cdf0e10cSrcweir 		OSL_ENSURE( sal_False,
590cdf0e10cSrcweir 				::rtl::OString("OListPropertyContext::CreateChildContext: unknown child element (\"")
591cdf0e10cSrcweir 			+=	::rtl::OString(_rLocalName.getStr(), _rLocalName.getLength(), RTL_TEXTENCODING_ASCII_US)
592cdf0e10cSrcweir 			+=	::rtl::OString("\")!"));
593cdf0e10cSrcweir 		return new SvXMLImportContext( GetImport(), _nPrefix, _rLocalName );
594cdf0e10cSrcweir 	}
595cdf0e10cSrcweir }
596cdf0e10cSrcweir 
597cdf0e10cSrcweir //=====================================================================
598cdf0e10cSrcweir //= OListValueContext
599cdf0e10cSrcweir //=====================================================================
600cdf0e10cSrcweir //---------------------------------------------------------------------
OListValueContext(SvXMLImport & _rImport,sal_uInt16 _nPrefix,const::rtl::OUString & _rName,::rtl::OUString & _rListValueHolder)601cdf0e10cSrcweir OListValueContext::OListValueContext( SvXMLImport& _rImport, sal_uInt16 _nPrefix, const ::rtl::OUString& _rName, ::rtl::OUString& _rListValueHolder )
602cdf0e10cSrcweir     :SvXMLImportContext( _rImport, _nPrefix, _rName )
603cdf0e10cSrcweir     ,m_rListValueHolder( _rListValueHolder )
604cdf0e10cSrcweir {
605cdf0e10cSrcweir }
606cdf0e10cSrcweir 
607cdf0e10cSrcweir //---------------------------------------------------------------------
StartElement(const Reference<sax::XAttributeList> & _rxAttrList)608cdf0e10cSrcweir void OListValueContext::StartElement( const Reference< sax::XAttributeList >& _rxAttrList )
609cdf0e10cSrcweir {
610cdf0e10cSrcweir 	const sal_Int32 nAttributeCount = _rxAttrList->getLength();
611cdf0e10cSrcweir 
612cdf0e10cSrcweir 	sal_uInt16 nNamespace;
613cdf0e10cSrcweir 	::rtl::OUString sAttributeName;
614cdf0e10cSrcweir     const SvXMLNamespaceMap& rMap = GetImport().GetNamespaceMap();
615cdf0e10cSrcweir 	for ( sal_Int16 i = 0; i < nAttributeCount; ++i )
616cdf0e10cSrcweir 	{
617cdf0e10cSrcweir 		nNamespace = rMap.GetKeyByAttrName( _rxAttrList->getNameByIndex( i ), &sAttributeName );
618cdf0e10cSrcweir         if ( XML_NAMESPACE_OFFICE == nNamespace )
619cdf0e10cSrcweir         {
620cdf0e10cSrcweir             if  (   token::IsXMLToken( sAttributeName, token::XML_VALUE )
621cdf0e10cSrcweir                ||   token::IsXMLToken( sAttributeName, token::XML_STRING_VALUE )
622cdf0e10cSrcweir                ||   token::IsXMLToken( sAttributeName, token::XML_BOOLEAN_VALUE )
623cdf0e10cSrcweir                 )
624cdf0e10cSrcweir             {
625cdf0e10cSrcweir                 m_rListValueHolder = _rxAttrList->getValueByIndex( i );
626cdf0e10cSrcweir                 continue;
627cdf0e10cSrcweir             }
628cdf0e10cSrcweir         }
629cdf0e10cSrcweir 
630cdf0e10cSrcweir 		OSL_ENSURE( false,
631cdf0e10cSrcweir 				::rtl::OString( "OListValueContext::StartElement: unknown child element (\"")
632cdf0e10cSrcweir 			+=	::rtl::OString( sAttributeName.getStr(), sAttributeName.getLength(), RTL_TEXTENCODING_ASCII_US )
633cdf0e10cSrcweir 			+=	::rtl::OString( "\")!" ) );
634cdf0e10cSrcweir 	}
635cdf0e10cSrcweir }
636cdf0e10cSrcweir 
637cdf0e10cSrcweir //.........................................................................
638cdf0e10cSrcweir }	// namespace xmloff
639cdf0e10cSrcweir //.........................................................................
640cdf0e10cSrcweir 
641