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