1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_xmlscript.hxx"
26 #include "imp_share.hxx"
27 
28 #include <com/sun/star/beans/XPropertySet.hpp>
29 #include <com/sun/star/beans/XPropertyState.hpp>
30 
31 
32 using namespace ::com::sun::star;
33 using namespace ::com::sun::star::uno;
34 using ::rtl::OUString;
35 
36 namespace xmlscript
37 {
38 
39 // progessmeter
40 //__________________________________________________________________________________________________
41 Reference< xml::input::XElement > ProgressBarElement::startChildElement(
42 	sal_Int32 nUid, OUString const & rLocalName,
43 	Reference< xml::input::XAttributes > const & xAttributes )
44 	throw (xml::sax::SAXException, RuntimeException)
45 {
46 	// event
47     if (_pImport->isEventElement( nUid, rLocalName ))
48 	{
49 		return new EventElement(
50             nUid, rLocalName, xAttributes, this, _pImport );
51 	}
52 	else
53 	{
54 		throw xml::sax::SAXException(
55 			OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
56 			Reference< XInterface >(), Any() );
57 	}
58 }
59 //__________________________________________________________________________________________________
60 void ProgressBarElement::endElement()
61 	throw (xml::sax::SAXException, RuntimeException)
62 {
63 	ControlImportContext ctx(
64 		_pImport, getControlId( _xAttributes ),
65 		OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) );
66 
67 	Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
68 	if (xStyle.is())
69 	{
70 		StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
71 		Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
72 		pStyle->importBackgroundColorStyle( xControlModel );
73 		pStyle->importBorderStyle( xControlModel );
74 		pStyle->importFillColorStyle( xControlModel );
75 	}
76 
77 	ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
78 	ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ),
79                             OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
80                             _xAttributes );
81 	ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMin") ),
82                             OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
83                             _xAttributes );
84 	ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ),
85                             OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
86                             _xAttributes );
87 	ctx.importEvents( _events );
88     // avoid ring-reference:
89     // vector< event elements > holding event elements holding this (via _pParent)
90     _events.clear();
91 }
92 
93 //##################################################################################################
94 
95 // scrollbar
96 //__________________________________________________________________________________________________
97 Reference< xml::input::XElement > ScrollBarElement::startChildElement(
98 	sal_Int32 nUid, OUString const & rLocalName,
99 	Reference< xml::input::XAttributes > const & xAttributes )
100 	throw (xml::sax::SAXException, RuntimeException)
101 {
102 	// event
103     if (_pImport->isEventElement( nUid, rLocalName ))
104 	{
105 		return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
106 	}
107 	else
108 	{
109 		throw xml::sax::SAXException(
110 			OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
111 			Reference< XInterface >(), Any() );
112 	}
113 }
114 //__________________________________________________________________________________________________
115 void ScrollBarElement::endElement()
116 	throw (xml::sax::SAXException, RuntimeException)
117 {
118 	ControlImportContext ctx(
119 		_pImport, getControlId( _xAttributes ),
120 		OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) );
121 
122 	Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
123 	if (xStyle.is())
124 	{
125 		StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
126 		Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
127         pStyle->importBackgroundColorStyle( xControlModel );
128 		pStyle->importBorderStyle( xControlModel );
129 	}
130 
131 	ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
132 	ctx.importOrientationProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
133                                    OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
134                                    _xAttributes );
135 	ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("BlockIncrement") ),
136                             OUString( RTL_CONSTASCII_USTRINGPARAM("pageincrement") ),
137                             _xAttributes );
138 	ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineIncrement") ),
139                             OUString( RTL_CONSTASCII_USTRINGPARAM("increment") ),
140                             _xAttributes );
141 	ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScrollValue") ),
142                             OUString( RTL_CONSTASCII_USTRINGPARAM("curpos") ),
143                             _xAttributes );
144 	ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMax") ),
145                             OUString( RTL_CONSTASCII_USTRINGPARAM("maxpos") ),
146                             _xAttributes );
147 	ctx.importLongProperty( OUSTR("ScrollValueMin"), OUSTR("minpos"),
148                             _xAttributes );
149 	ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VisibleSize") ),
150                             OUString( RTL_CONSTASCII_USTRINGPARAM("visible-size") ),
151                             _xAttributes );
152 	ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
153                             _xAttributes );
154     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
155                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
156                                _xAttributes );
157     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LiveScroll") ),
158                                OUString( RTL_CONSTASCII_USTRINGPARAM("live-scroll") ),
159                                _xAttributes );
160     ctx.importHexLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
161                                OUString( RTL_CONSTASCII_USTRINGPARAM("symbol-color") ),
162                                _xAttributes );
163 
164 	ctx.importEvents( _events );
165     // avoid ring-reference:
166     // vector< event elements > holding event elements holding this (via _pParent)
167     _events.clear();
168 }
169 
170 //##################################################################################################
171 
172 // fixedline
173 //__________________________________________________________________________________________________
174 Reference< xml::input::XElement > FixedLineElement::startChildElement(
175 	sal_Int32 nUid, OUString const & rLocalName,
176 	Reference< xml::input::XAttributes > const & xAttributes )
177 	throw (xml::sax::SAXException, RuntimeException)
178 {
179 	// event
180     if (_pImport->isEventElement( nUid, rLocalName ))
181 	{
182 		return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
183 	}
184 	else
185 	{
186 		throw xml::sax::SAXException(
187 			OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
188 			Reference< XInterface >(), Any() );
189 	}
190 }
191 //__________________________________________________________________________________________________
192 void FixedLineElement::endElement()
193 	throw (xml::sax::SAXException, RuntimeException)
194 {
195 	ControlImportContext ctx(
196 		_pImport, getControlId( _xAttributes ),
197 		OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel") ) );
198 
199 	Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
200 	if (xStyle.is())
201 	{
202 		StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
203 		Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
204 		pStyle->importTextColorStyle( xControlModel );
205 		pStyle->importTextLineColorStyle( xControlModel );
206 		pStyle->importFontStyle( xControlModel );
207 	}
208 
209 	ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
210     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
211 							  OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
212 							  _xAttributes );
213 	ctx.importOrientationProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
214                                    OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
215                                    _xAttributes );
216 	ctx.importEvents( _events );
217     // avoid ring-reference:
218     // vector< event elements > holding event elements holding this (via _pParent)
219     _events.clear();
220 }
221 
222 //##################################################################################################
223 
224 // patternfield
225 //__________________________________________________________________________________________________
226 Reference< xml::input::XElement > PatternFieldElement::startChildElement(
227 	sal_Int32 nUid, OUString const & rLocalName,
228 	Reference< xml::input::XAttributes > const & xAttributes )
229 	throw (xml::sax::SAXException, RuntimeException)
230 {
231 	// event
232     if (_pImport->isEventElement( nUid, rLocalName ))
233 	{
234 		return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
235 	}
236 	else
237 	{
238 		throw xml::sax::SAXException(
239 			OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
240 			Reference< XInterface >(), Any() );
241 	}
242 }
243 //__________________________________________________________________________________________________
244 void PatternFieldElement::endElement()
245 	throw (xml::sax::SAXException, RuntimeException)
246 {
247 	ControlImportContext ctx(
248 		_pImport, getControlId( _xAttributes ),
249 		OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlPatternFieldModel") ) );
250 
251 	Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
252 	if (xStyle.is())
253 	{
254 		StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
255 		Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
256 		pStyle->importBackgroundColorStyle( xControlModel );
257 		pStyle->importTextColorStyle( xControlModel );
258 		pStyle->importTextLineColorStyle( xControlModel );
259 		pStyle->importBorderStyle( xControlModel );
260 		pStyle->importFontStyle( xControlModel );
261 	}
262 
263 	ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
264 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
265 							   OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
266 							   _xAttributes );
267 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
268 							   OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
269 							   _xAttributes );
270 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
271 							   OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ),
272 							   _xAttributes );
273 	ctx.importBooleanProperty(
274         OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
275         _xAttributes );
276 	ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
277 							  OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
278 							  _xAttributes );
279 	ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
280 							 OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ),
281 							 _xAttributes );
282 	ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EditMask") ),
283 							  OUString( RTL_CONSTASCII_USTRINGPARAM("edit-mask") ),
284 							  _xAttributes );
285 	ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LiteralMask") ),
286 							  OUString( RTL_CONSTASCII_USTRINGPARAM("literal-mask") ),
287 							  _xAttributes );
288 	ctx.importEvents( _events );
289     // avoid ring-reference:
290     // vector< event elements > holding event elements holding this (via _pParent)
291     _events.clear();
292 }
293 
294 //##################################################################################################
295 
296 // formattedfield
297 //__________________________________________________________________________________________________
298 Reference< xml::input::XElement > FormattedFieldElement::startChildElement(
299 	sal_Int32 nUid, OUString const & rLocalName,
300 	Reference< xml::input::XAttributes > const & xAttributes )
301 	throw (xml::sax::SAXException, RuntimeException)
302 {
303 	// event
304     if (_pImport->isEventElement( nUid, rLocalName ))
305 	{
306 		return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
307 	}
308 	else
309 	{
310 		throw xml::sax::SAXException(
311 			OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
312 			Reference< XInterface >(), Any() );
313 	}
314 }
315 //__________________________________________________________________________________________________
316 void FormattedFieldElement::endElement()
317 	throw (xml::sax::SAXException, RuntimeException)
318 {
319 	ControlImportContext ctx(
320 		_pImport, getControlId( _xAttributes ),
321 		OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFormattedFieldModel") ) );
322 
323 	Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
324 	if (xStyle.is())
325 	{
326 		StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
327 		Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
328 		pStyle->importBackgroundColorStyle( xControlModel );
329 		pStyle->importTextColorStyle( xControlModel );
330 		pStyle->importTextLineColorStyle( xControlModel );
331 		pStyle->importBorderStyle( xControlModel );
332 		pStyle->importFontStyle( xControlModel );
333 	}
334 
335 	ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
336 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
337 							   OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
338 							   _xAttributes );
339 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
340 							   OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
341 							   _xAttributes );
342 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
343 							   OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ),
344 							   _xAttributes );
345 	ctx.importBooleanProperty(
346         OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
347         _xAttributes );
348 	ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
349                              OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
350                              _xAttributes );
351 	ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveMin") ),
352                               OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
353                               _xAttributes );
354 	ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveMax") ),
355                               OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
356                               _xAttributes );
357 	ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveValue") ),
358                               OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
359                               _xAttributes );
360 	ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
361 							  OUString( RTL_CONSTASCII_USTRINGPARAM("text") ),
362 							  _xAttributes );
363 	ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
364 							 OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ),
365 							 _xAttributes );
366 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
367 							   OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
368 							   _xAttributes );
369 	if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
370                                 _xAttributes ))
371 		ctx.getControlModel()->setPropertyValue(
372             OUSTR("Repeat"), makeAny(true) );
373 
374     OUString sDefault(
375         _xAttributes->getValueByUidName(
376             _pImport->XMLNS_DIALOGS_UID,
377             OUString( RTL_CONSTASCII_USTRINGPARAM("value-default") ) ) );
378     if (sDefault.getLength())
379     {
380         double d = sDefault.toDouble();
381         if (d != 0.0 ||
382             sDefault.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("0") ) ||
383             sDefault.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("0.0") ))
384         {
385             ctx.getControlModel()->setPropertyValue(
386                 OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveDefault") ),
387                 makeAny( d ) );
388         }
389         else // treat as string
390         {
391             ctx.getControlModel()->setPropertyValue(
392                 OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveDefault") ),
393                 makeAny( sDefault ) );
394         }
395     }
396 
397     // format spec
398     ctx.getControlModel()->setPropertyValue(
399         OUString( RTL_CONSTASCII_USTRINGPARAM("FormatsSupplier") ),
400         makeAny( _pImport->getNumberFormatsSupplier() ) );
401 
402     OUString sFormat(
403         _xAttributes->getValueByUidName(
404             _pImport->XMLNS_DIALOGS_UID,
405             OUString( RTL_CONSTASCII_USTRINGPARAM("format-code") ) ) );
406     if (sFormat.getLength())
407     {
408         lang::Locale locale;
409 
410         OUString sLocale(
411             _xAttributes->getValueByUidName(
412                 _pImport->XMLNS_DIALOGS_UID,
413                 OUString( RTL_CONSTASCII_USTRINGPARAM("format-locale") ) ) );
414         if (sLocale.getLength())
415         {
416             // split locale
417             sal_Int32 semi0 = sLocale.indexOf( ';' );
418             if (semi0 < 0) // no semi at all, just try language
419             {
420                 locale.Language = sLocale;
421             }
422             else
423             {
424                 sal_Int32 semi1 = sLocale.indexOf( ';', semi0 +1 );
425                 if (semi1 > semi0) // language;country;variant
426                 {
427                     locale.Language = sLocale.copy( 0, semi0 );
428                     locale.Country = sLocale.copy( semi0 +1, semi1 - semi0 -1 );
429                     locale.Variant = sLocale.copy( semi1 +1 );
430                 }
431                 else // try language;country
432                 {
433                     locale.Language = sLocale.copy( 0, semi0 );
434                     locale.Country = sLocale.copy( semi0 +1 );
435                 }
436             }
437         }
438 
439         try
440         {
441             Reference< util::XNumberFormats > xFormats(
442                 _pImport->getNumberFormatsSupplier()->getNumberFormats() );
443             sal_Int32 nKey = xFormats->queryKey( sFormat, locale, sal_True );
444             if (-1 == nKey)
445             {
446                 nKey = xFormats->addNew( sFormat, locale );
447             }
448             ctx.getControlModel()->setPropertyValue(
449                 OUString( RTL_CONSTASCII_USTRINGPARAM("FormatKey") ), makeAny( nKey ) );
450         }
451         catch (util::MalformedNumberFormatException & exc)
452         {
453             OSL_ENSURE( 0, "### util::MalformedNumberFormatException occured!" );
454             // rethrow
455             throw xml::sax::SAXException( exc.Message, Reference< XInterface >(), Any() );
456         }
457     }
458 	ctx.importBooleanProperty(
459         OUString( RTL_CONSTASCII_USTRINGPARAM("TreatAsNumber") ),
460         OUString( RTL_CONSTASCII_USTRINGPARAM("treat-as-number") ),
461         _xAttributes );
462     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
463                                OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
464                                _xAttributes );
465 
466 	ctx.importEvents( _events );
467     // avoid ring-reference:
468     // vector< event elements > holding event elements holding this (via _pParent)
469     _events.clear();
470 }
471 
472 //##################################################################################################
473 
474 // timefield
475 //__________________________________________________________________________________________________
476 Reference< xml::input::XElement > TimeFieldElement::startChildElement(
477 	sal_Int32 nUid, OUString const & rLocalName,
478 	Reference< xml::input::XAttributes > const & xAttributes )
479 	throw (xml::sax::SAXException, RuntimeException)
480 {
481 	// event
482     if (_pImport->isEventElement( nUid, rLocalName ))
483 	{
484 		return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
485 	}
486 	else
487 	{
488 		throw xml::sax::SAXException(
489 			OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
490 			Reference< XInterface >(), Any() );
491 	}
492 }
493 //__________________________________________________________________________________________________
494 void TimeFieldElement::endElement()
495 	throw (xml::sax::SAXException, RuntimeException)
496 {
497 	ControlImportContext ctx(
498 		_pImport, getControlId( _xAttributes ),
499 		OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlTimeFieldModel") ) );
500 
501 	Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
502 	if (xStyle.is())
503 	{
504 		StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
505 		Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
506 		pStyle->importBackgroundColorStyle( xControlModel );
507 		pStyle->importTextColorStyle( xControlModel );
508 		pStyle->importTextLineColorStyle( xControlModel );
509 		pStyle->importBorderStyle( xControlModel );
510 		pStyle->importFontStyle( xControlModel );
511 	}
512 
513 	ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
514 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
515 							   OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
516 							   _xAttributes );
517 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
518 							   OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
519 							   _xAttributes );
520 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
521 							   OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ),
522 							   _xAttributes );
523 	ctx.importBooleanProperty(
524         OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
525         _xAttributes );
526 	ctx.importTimeFormatProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeFormat") ),
527 								  OUString( RTL_CONSTASCII_USTRINGPARAM("time-format") ),
528 								  _xAttributes );
529 	ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Time") ),
530 							OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
531 							_xAttributes );
532 	ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeMin") ),
533 							OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
534 							_xAttributes );
535 	ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeMax") ),
536 							OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
537 							_xAttributes );
538 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
539 							   OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
540 							   _xAttributes );
541 	if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
542                                 _xAttributes ))
543 		ctx.getControlModel()->setPropertyValue(
544             OUSTR("Repeat"), makeAny(true) );
545     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
546                               OUString( RTL_CONSTASCII_USTRINGPARAM("text") ),
547                               _xAttributes );
548     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
549                                OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
550                                _xAttributes );
551 
552 	ctx.importEvents( _events );
553     // avoid ring-reference:
554     // vector< event elements > holding event elements holding this (via _pParent)
555     _events.clear();
556 }
557 
558 //##################################################################################################
559 
560 // numericfield
561 //__________________________________________________________________________________________________
562 Reference< xml::input::XElement > NumericFieldElement::startChildElement(
563 	sal_Int32 nUid, OUString const & rLocalName,
564 	Reference< xml::input::XAttributes > const & xAttributes )
565 	throw (xml::sax::SAXException, RuntimeException)
566 {
567 	// event
568     if (_pImport->isEventElement( nUid, rLocalName ))
569 	{
570 		return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
571 	}
572 	else
573 	{
574 		throw xml::sax::SAXException(
575 			OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
576 			Reference< XInterface >(), Any() );
577 	}
578 }
579 //__________________________________________________________________________________________________
580 void NumericFieldElement::endElement()
581 	throw (xml::sax::SAXException, RuntimeException)
582 {
583 	ControlImportContext ctx(
584 		_pImport, getControlId( _xAttributes ),
585 		OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlNumericFieldModel") ) );
586 
587 	Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
588 	if (xStyle.is())
589 	{
590 		StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
591 		Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
592 		pStyle->importBackgroundColorStyle( xControlModel );
593 		pStyle->importTextColorStyle( xControlModel );
594 		pStyle->importTextLineColorStyle( xControlModel );
595 		pStyle->importBorderStyle( xControlModel );
596 		pStyle->importFontStyle( xControlModel );
597 	}
598 
599 	ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
600 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
601 							   OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
602 							   _xAttributes );
603 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
604 							   OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
605 							   _xAttributes );
606 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
607 							   OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ),
608 							   _xAttributes );
609 	ctx.importBooleanProperty(
610         OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
611         _xAttributes );
612 	ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DecimalAccuracy") ),
613 							   OUString( RTL_CONSTASCII_USTRINGPARAM("decimal-accuracy") ),
614 							   _xAttributes );
615 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowThousandsSeparator") ),
616 							   OUString( RTL_CONSTASCII_USTRINGPARAM("thousands-separator") ),
617 							   _xAttributes );
618 	ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Value") ),
619 							  OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
620 							  _xAttributes );
621 	ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMin") ),
622 							  OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
623 							  _xAttributes );
624 	ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMax") ),
625 							  OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
626 							  _xAttributes );
627 	ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueStep") ),
628 							  OUString( RTL_CONSTASCII_USTRINGPARAM("value-step") ),
629 							  _xAttributes );
630 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
631 							   OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
632 							   _xAttributes );
633 	if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
634                                 _xAttributes ))
635 		ctx.getControlModel()->setPropertyValue(
636             OUSTR("Repeat"), makeAny(true) );
637     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
638                                OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
639                                _xAttributes );
640 	ctx.importEvents( _events );
641     // avoid ring-reference:
642     // vector< event elements > holding event elements holding this (via _pParent)
643     _events.clear();
644 }
645 
646 //##################################################################################################
647 
648 // datefield
649 //__________________________________________________________________________________________________
650 Reference< xml::input::XElement > DateFieldElement::startChildElement(
651 	sal_Int32 nUid, OUString const & rLocalName,
652 	Reference< xml::input::XAttributes > const & xAttributes )
653 	throw (xml::sax::SAXException, RuntimeException)
654 {
655 	// event
656     if (_pImport->isEventElement( nUid, rLocalName ))
657 	{
658 		return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
659 	}
660 	else
661 	{
662 		throw xml::sax::SAXException(
663 			OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
664 			Reference< XInterface >(), Any() );
665 	}
666 }
667 //__________________________________________________________________________________________________
668 void DateFieldElement::endElement()
669 	throw (xml::sax::SAXException, RuntimeException)
670 {
671 	ControlImportContext ctx(
672 		_pImport, getControlId( _xAttributes ),
673 		OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDateFieldModel") ) );
674 
675 	Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
676 	if (xStyle.is())
677 	{
678 		StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
679 		Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
680 		pStyle->importBackgroundColorStyle( xControlModel );
681 		pStyle->importTextColorStyle( xControlModel );
682 		pStyle->importTextLineColorStyle( xControlModel );
683 		pStyle->importBorderStyle( xControlModel );
684 		pStyle->importFontStyle( xControlModel );
685 	}
686 
687 	ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
688 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
689 							   OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
690 							   _xAttributes );
691 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
692 							   OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
693 							   _xAttributes );
694 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
695 							   OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ),
696 							   _xAttributes );
697 	ctx.importBooleanProperty(
698         OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
699         _xAttributes );
700 	ctx.importDateFormatProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateFormat") ),
701 								  OUString( RTL_CONSTASCII_USTRINGPARAM("date-format") ),
702 								  _xAttributes );
703 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateShowCentury") ),
704 							   OUString( RTL_CONSTASCII_USTRINGPARAM("show-century") ),
705 							   _xAttributes );
706 	ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Date") ),
707 							OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
708 							_xAttributes );
709 	ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateMin") ),
710 							OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
711 							_xAttributes );
712 	ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateMax") ),
713 							OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
714 							_xAttributes );
715 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
716 							   OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
717 							   _xAttributes );
718 	if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
719                                 _xAttributes ))
720 		ctx.getControlModel()->setPropertyValue(
721             OUSTR("Repeat"), makeAny(true) );
722 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
723 							   OUString( RTL_CONSTASCII_USTRINGPARAM("dropdown") ),
724 							   _xAttributes );
725     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
726                               OUString( RTL_CONSTASCII_USTRINGPARAM("text") ),
727                               _xAttributes );
728     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
729                                OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
730                                _xAttributes );
731 	ctx.importEvents( _events );
732     // avoid ring-reference:
733     // vector< event elements > holding event elements holding this (via _pParent)
734     _events.clear();
735 }
736 
737 //##################################################################################################
738 
739 // currencyfield
740 //__________________________________________________________________________________________________
741 Reference< xml::input::XElement > CurrencyFieldElement::startChildElement(
742 	sal_Int32 nUid, OUString const & rLocalName,
743 	Reference< xml::input::XAttributes > const & xAttributes )
744 	throw (xml::sax::SAXException, RuntimeException)
745 {
746 	// event
747     if (_pImport->isEventElement( nUid, rLocalName ))
748 	{
749 		return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
750 	}
751 	else
752 	{
753 		throw xml::sax::SAXException(
754 			OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
755 			Reference< XInterface >(), Any() );
756 	}
757 }
758 //__________________________________________________________________________________________________
759 void CurrencyFieldElement::endElement()
760 	throw (xml::sax::SAXException, RuntimeException)
761 {
762 	ControlImportContext ctx(
763 		_pImport, getControlId( _xAttributes ),
764 		OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCurrencyFieldModel") ) );
765 
766 	Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
767 	if (xStyle.is())
768 	{
769 		StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
770 		Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
771 		pStyle->importBackgroundColorStyle( xControlModel );
772 		pStyle->importTextColorStyle( xControlModel );
773 		pStyle->importTextLineColorStyle( xControlModel );
774 		pStyle->importBorderStyle( xControlModel );
775 		pStyle->importFontStyle( xControlModel );
776 	}
777 
778 	ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
779 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
780 							   OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
781 							   _xAttributes );
782 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
783 							   OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
784 							   _xAttributes );
785 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
786 							   OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ),
787 							   _xAttributes );
788 	ctx.importBooleanProperty(
789         OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
790         _xAttributes );
791 	ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("CurrencySymbol") ),
792 							  OUString( RTL_CONSTASCII_USTRINGPARAM("currency-symbol") ),
793 							  _xAttributes );
794 	ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DecimalAccuracy") ),
795 							   OUString( RTL_CONSTASCII_USTRINGPARAM("decimal-accuracy") ),
796 							   _xAttributes );
797 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowThousandsSeparator") ),
798 							   OUString( RTL_CONSTASCII_USTRINGPARAM("thousands-separator") ),
799 							   _xAttributes );
800 	ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Value") ),
801 							  OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
802 							  _xAttributes );
803 	ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMin") ),
804 							  OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
805 							  _xAttributes );
806 	ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMax") ),
807 							  OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
808 							  _xAttributes );
809 	ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueStep") ),
810 							  OUString( RTL_CONSTASCII_USTRINGPARAM("value-step") ),
811 							  _xAttributes );
812 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
813 							   OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
814 							   _xAttributes );
815 	if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
816                                 _xAttributes ))
817 		ctx.getControlModel()->setPropertyValue(
818             OUSTR("Repeat"), makeAny(true) );
819 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("PrependCurrencySymbol") ),
820 							   OUString( RTL_CONSTASCII_USTRINGPARAM("prepend-symbol") ),
821 							   _xAttributes );
822     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
823                                OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
824                                _xAttributes );
825 	ctx.importEvents( _events );
826     // avoid ring-reference:
827     // vector< event elements > holding event elements holding this (via _pParent)
828     _events.clear();
829 }
830 
831 //##################################################################################################
832 
833 // filecontrol
834 //__________________________________________________________________________________________________
835 Reference< xml::input::XElement > FileControlElement::startChildElement(
836 	sal_Int32 nUid, OUString const & rLocalName,
837 	Reference< xml::input::XAttributes > const & xAttributes )
838 	throw (xml::sax::SAXException, RuntimeException)
839 {
840 	// event
841     if (_pImport->isEventElement( nUid, rLocalName ))
842 	{
843 		return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
844 	}
845 	else
846 	{
847 		throw xml::sax::SAXException(
848 			OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
849 			Reference< XInterface >(), Any() );
850 	}
851 }
852 //__________________________________________________________________________________________________
853 void FileControlElement::endElement()
854 	throw (xml::sax::SAXException, RuntimeException)
855 {
856 	ControlImportContext ctx(
857 		_pImport, getControlId( _xAttributes ),
858 		OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFileControlModel") ) );
859 
860 	Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
861 	if (xStyle.is())
862 	{
863 		StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
864 		Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
865 		pStyle->importBackgroundColorStyle( xControlModel );
866 		pStyle->importTextColorStyle( xControlModel );
867 		pStyle->importTextLineColorStyle( xControlModel );
868 		pStyle->importBorderStyle( xControlModel );
869 		pStyle->importFontStyle( xControlModel );
870 	}
871 
872 	ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
873 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
874 							   OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
875 							   _xAttributes );
876 	ctx.importBooleanProperty(
877         OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
878         _xAttributes );
879 	ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
880 							  OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
881 							  _xAttributes );
882     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
883                                OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
884                                _xAttributes );
885 	ctx.importEvents( _events );
886     // avoid ring-reference:
887     // vector< event elements > holding event elements holding this (via _pParent)
888     _events.clear();
889 }
890 //##################################################################################################
891 
892 // treecontrol
893 //__________________________________________________________________________________________________
894 Reference< xml::input::XElement > TreeControlElement::startChildElement(
895 	sal_Int32 nUid, OUString const & rLocalName,
896 	Reference< xml::input::XAttributes > const & xAttributes )
897 	throw (xml::sax::SAXException, RuntimeException)
898 {
899 	// event
900     if (_pImport->isEventElement( nUid, rLocalName ))
901 	{
902 		return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
903 	}
904 	else
905 	{
906 		throw xml::sax::SAXException(
907 			OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
908 			Reference< XInterface >(), Any() );
909 	}
910 }
911 //__________________________________________________________________________________________________
912 void TreeControlElement::endElement()
913 	throw (xml::sax::SAXException, RuntimeException)
914 {
915 	ControlImportContext ctx(
916 		_pImport, getControlId( _xAttributes ),
917 		OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.tree.TreeControlModel") ) );
918 
919 	Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
920 	if (xStyle.is())
921 	{
922 		StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
923 		Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
924 		pStyle->importBackgroundColorStyle( xControlModel );
925 		pStyle->importBorderStyle( xControlModel );
926 	}
927 
928 	ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
929     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
930                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
931                                _xAttributes );
932 	ctx.importSelectionTypeProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectionType") ),
933 							  OUString( RTL_CONSTASCII_USTRINGPARAM("selectiontype") ),
934 							  _xAttributes );
935 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("RootDisplayed") ),
936 							   OUString( RTL_CONSTASCII_USTRINGPARAM("rootdisplayed") ),
937 							   _xAttributes );
938 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsHandles") ),
939 							   OUString( RTL_CONSTASCII_USTRINGPARAM("showshandles") ),
940 							   _xAttributes );
941     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsRootHandles") ),
942                                OUString( RTL_CONSTASCII_USTRINGPARAM("showsroothandles") ),
943                                _xAttributes );
944     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Editable") ),
945                                OUString( RTL_CONSTASCII_USTRINGPARAM("editable") ),
946                                _xAttributes );
947     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("RowHeight") ),
948                                OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
949                                _xAttributes );
950     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("InvokesStopNodeEditing") ),
951 							 OUString( RTL_CONSTASCII_USTRINGPARAM("invokesstopnodeediting") ),
952 							 _xAttributes );
953 
954 	ctx.importEvents( _events );
955     // avoid ring-reference:
956     // vector< event elements > holding event elements holding this (via _pParent)
957     _events.clear();
958 }
959 
960 //##################################################################################################
961 
962 // imagecontrol
963 //__________________________________________________________________________________________________
964 Reference< xml::input::XElement > ImageControlElement::startChildElement(
965 	sal_Int32 nUid, OUString const & rLocalName,
966 	Reference< xml::input::XAttributes > const & xAttributes )
967 	throw (xml::sax::SAXException, RuntimeException)
968 {
969 	// event
970     if (_pImport->isEventElement( nUid, rLocalName ))
971 	{
972 		return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
973 	}
974 	else
975 	{
976 		throw xml::sax::SAXException(
977 			OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
978 			Reference< XInterface >(), Any() );
979 	}
980 }
981 //__________________________________________________________________________________________________
982 void ImageControlElement::endElement()
983 	throw (xml::sax::SAXException, RuntimeException)
984 {
985 	ControlImportContext ctx(
986 		_pImport, getControlId( _xAttributes ),
987 		OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) );
988 
989 	Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
990 	if (xStyle.is())
991 	{
992 		StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
993 		Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
994 		pStyle->importBackgroundColorStyle( xControlModel );
995 		pStyle->importBorderStyle( xControlModel );
996 	}
997 
998 	ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
999 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
1000 							   OUString( RTL_CONSTASCII_USTRINGPARAM("scale-image") ),
1001 							   _xAttributes );
1002 	ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
1003 							  OUString( RTL_CONSTASCII_USTRINGPARAM("src") ),
1004 							  _xAttributes );
1005     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1006                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1007                                _xAttributes );
1008 	ctx.importEvents( _events );
1009     // avoid ring-reference:
1010     // vector< event elements > holding event elements holding this (via _pParent)
1011     _events.clear();
1012 }
1013 
1014 //##################################################################################################
1015 
1016 // textfield
1017 //__________________________________________________________________________________________________
1018 Reference< xml::input::XElement > TextElement::startChildElement(
1019 	sal_Int32 nUid, OUString const & rLocalName,
1020 	Reference< xml::input::XAttributes > const & xAttributes )
1021 	throw (xml::sax::SAXException, RuntimeException)
1022 {
1023 	// event
1024     if (_pImport->isEventElement( nUid, rLocalName ))
1025 	{
1026 		return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1027 	}
1028 	else
1029 	{
1030 		throw xml::sax::SAXException(
1031 			OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1032 			Reference< XInterface >(), Any() );
1033 	}
1034 }
1035 //__________________________________________________________________________________________________
1036 void TextElement::endElement()
1037 	throw (xml::sax::SAXException, RuntimeException)
1038 {
1039 	ControlImportContext ctx(
1040 		_pImport, getControlId( _xAttributes ),
1041 		OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) );
1042 
1043 	Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1044 	if (xStyle.is())
1045 	{
1046 		StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1047 		Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1048 		pStyle->importBackgroundColorStyle( xControlModel );
1049 		pStyle->importTextColorStyle( xControlModel );
1050 		pStyle->importTextLineColorStyle( xControlModel );
1051 		pStyle->importBorderStyle( xControlModel );
1052 		pStyle->importFontStyle( xControlModel );
1053 	}
1054 
1055 	ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1056 	ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1057 							  OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1058 							  _xAttributes );
1059 	ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1060 							 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1061 							 _xAttributes );
1062     ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
1063                                      OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
1064                                      _xAttributes );
1065 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1066 							   OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1067 							   _xAttributes );
1068 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1069 							   OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1070 							   _xAttributes );
1071 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("NoLabel") ),
1072 							   OUString( RTL_CONSTASCII_USTRINGPARAM("nolabel") ),
1073 							   _xAttributes );
1074 	ctx.importEvents( _events );
1075     // avoid ring-reference:
1076     // vector< event elements > holding event elements holding this (via _pParent)
1077     _events.clear();
1078 }
1079 
1080 //##################################################################################################
1081 // FixedHyperLink
1082 //__________________________________________________________________________________________________
1083 Reference< xml::input::XElement > FixedHyperLinkElement::startChildElement(
1084 	sal_Int32 nUid, OUString const & rLocalName,
1085 	Reference< xml::input::XAttributes > const & xAttributes )
1086 	throw (xml::sax::SAXException, RuntimeException)
1087 {
1088 	// event
1089     if (_pImport->isEventElement( nUid, rLocalName ))
1090 	{
1091 		return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1092 	}
1093 	else
1094 	{
1095 		throw xml::sax::SAXException(
1096 			OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1097 			Reference< XInterface >(), Any() );
1098 	}
1099 }
1100 //__________________________________________________________________________________________________
1101 void FixedHyperLinkElement::endElement()
1102 	throw (xml::sax::SAXException, RuntimeException)
1103 {
1104 	ControlImportContext ctx(
1105 		_pImport, getControlId( _xAttributes ),
1106 		OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedHyperlinkModel") ) );
1107 
1108 	Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1109 	if (xStyle.is())
1110 	{
1111 		StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1112 		Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1113 		pStyle->importBackgroundColorStyle( xControlModel );
1114 		pStyle->importTextColorStyle( xControlModel );
1115 		pStyle->importTextLineColorStyle( xControlModel );
1116 		pStyle->importBorderStyle( xControlModel );
1117 		pStyle->importFontStyle( xControlModel );
1118 	}
1119 
1120 	ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1121 	ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1122 							  OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1123 							  _xAttributes );
1124     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("URL") ),
1125 							  OUString( RTL_CONSTASCII_USTRINGPARAM("url") ),
1126 							  _xAttributes );
1127     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Description") ),
1128 							  OUString( RTL_CONSTASCII_USTRINGPARAM("description") ),
1129 							  _xAttributes );
1130 
1131 	ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1132 							 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1133 							 _xAttributes );
1134     ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
1135                                      OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
1136                                      _xAttributes );
1137 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1138 							   OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1139 							   _xAttributes );
1140 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1141 							   OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1142 							   _xAttributes );
1143 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("NoLabel") ),
1144 							   OUString( RTL_CONSTASCII_USTRINGPARAM("nolabel") ),
1145 							   _xAttributes );
1146 	ctx.importEvents( _events );
1147     // avoid ring-reference:
1148     // vector< event elements > holding event elements holding this (via _pParent)
1149     _events.clear();
1150 }
1151 
1152 //##################################################################################################
1153 
1154 // edit
1155 //__________________________________________________________________________________________________
1156 Reference< xml::input::XElement > TextFieldElement::startChildElement(
1157 	sal_Int32 nUid, OUString const & rLocalName,
1158 	Reference< xml::input::XAttributes > const & xAttributes )
1159 	throw (xml::sax::SAXException, RuntimeException)
1160 {
1161 	// event
1162     if (_pImport->isEventElement( nUid, rLocalName ))
1163 	{
1164 		return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1165 	}
1166 	else
1167 	{
1168 		throw xml::sax::SAXException(
1169 			OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1170 			Reference< XInterface >(), Any() );
1171 	}
1172 }
1173 //__________________________________________________________________________________________________
1174 void TextFieldElement::endElement()
1175 	throw (xml::sax::SAXException, RuntimeException)
1176 {
1177 	ControlImportContext ctx(
1178 		_pImport, getControlId( _xAttributes ),
1179 		OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) );
1180 	Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1181 
1182 	Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1183 	if (xStyle.is())
1184 	{
1185 		StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1186 		pStyle->importBackgroundColorStyle( xControlModel );
1187 		pStyle->importTextColorStyle( xControlModel );
1188 		pStyle->importTextLineColorStyle( xControlModel );
1189 		pStyle->importBorderStyle( xControlModel );
1190 		pStyle->importFontStyle( xControlModel );
1191 	}
1192 
1193 	ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1194 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1195 							   OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1196 							   _xAttributes );
1197 	ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1198 							 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1199 							 _xAttributes );
1200 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("HardLineBreaks") ),
1201 							   OUString( RTL_CONSTASCII_USTRINGPARAM("hard-linebreaks") ),
1202 							   _xAttributes );
1203 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("HScroll") ),
1204 							   OUString( RTL_CONSTASCII_USTRINGPARAM("hscroll") ),
1205 							   _xAttributes );
1206 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VScroll") ),
1207 							   OUString( RTL_CONSTASCII_USTRINGPARAM("vscroll") ),
1208 							   _xAttributes );
1209 	ctx.importBooleanProperty(
1210         OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
1211         _xAttributes );
1212 	ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
1213 							 OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ),
1214 							 _xAttributes );
1215 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1216 							   OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1217 							   _xAttributes );
1218 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
1219 							   OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
1220 							   _xAttributes );
1221 	ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
1222 								  OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1223 								  _xAttributes );
1224     ctx.importLineEndFormatProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineEndFormat") ),
1225                                      OUString( RTL_CONSTASCII_USTRINGPARAM("lineend-format") ),
1226                                      _xAttributes );
1227 	OUString aValue;
1228 	if (getStringAttr( &aValue,
1229                        OUString( RTL_CONSTASCII_USTRINGPARAM("echochar") ),
1230                        _xAttributes,
1231                        _pImport->XMLNS_DIALOGS_UID ) &&
1232 		aValue.getLength() > 0)
1233 	{
1234 		OSL_ENSURE( aValue.getLength() == 1, "### more than one character given for echochar!" );
1235 		sal_Int16 nChar = (sal_Int16)aValue[ 0 ];
1236 		xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("EchoChar") ),
1237 										 makeAny( nChar ) );
1238 	}
1239 
1240 	ctx.importEvents( _events );
1241     // avoid ring-reference:
1242     // vector< event elements > holding event elements holding this (via _pParent)
1243     _events.clear();
1244 }
1245 
1246 //##################################################################################################
1247 
1248 // titledbox
1249 //__________________________________________________________________________________________________
1250 Reference< xml::input::XElement > TitledBoxElement::startChildElement(
1251 	sal_Int32 nUid, OUString const & rLocalName,
1252 	Reference< xml::input::XAttributes > const & xAttributes )
1253 	throw (xml::sax::SAXException, RuntimeException)
1254 {
1255 	// event
1256     if (_pImport->isEventElement( nUid, rLocalName ))
1257 	{
1258 		return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1259 	}
1260 	else if (_pImport->XMLNS_DIALOGS_UID != nUid)
1261 	{
1262 		throw xml::sax::SAXException(
1263 			OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
1264 			Reference< XInterface >(), Any() );
1265 	}
1266 	// title
1267 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("title") ))
1268 	{
1269 		getStringAttr( &_label,
1270                        OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1271                        xAttributes,
1272                        _pImport->XMLNS_DIALOGS_UID );
1273 
1274 		return new ElementBase(
1275             _pImport->XMLNS_DIALOGS_UID,
1276             rLocalName, xAttributes, this, _pImport );
1277 	}
1278 	// radio
1279 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("radio") ))
1280 	{
1281 		// dont create radios here, => titledbox must be inserted first due to radio grouping,
1282 		// possible predecessors!
1283 		Reference< xml::input::XElement > xRet(
1284 			new RadioElement( rLocalName, xAttributes, this, _pImport ) );
1285 		_radios.push_back( xRet );
1286 		return xRet;
1287 	}
1288 	// event
1289     else if (_pImport->isEventElement( nUid, rLocalName ))
1290 	{
1291 		return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1292 	}
1293 	else
1294 	{
1295 		return BulletinBoardElement::startChildElement( nUid, rLocalName, xAttributes );
1296 	}
1297 }
1298 //__________________________________________________________________________________________________
1299 void TitledBoxElement::endElement()
1300 	throw (xml::sax::SAXException, RuntimeException)
1301 {
1302 	{
1303 	ControlImportContext ctx(
1304 		_pImport, getControlId( _xAttributes ),
1305 		OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) );
1306 	Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1307 
1308 	Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1309 	if (xStyle.is())
1310 	{
1311 		StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1312 		pStyle->importTextColorStyle( xControlModel );
1313 		pStyle->importTextLineColorStyle( xControlModel );
1314 		pStyle->importFontStyle( xControlModel );
1315 	}
1316 
1317 	ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
1318 
1319 	if (_label.getLength())
1320 	{
1321 		xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1322 										 makeAny( _label ) );
1323 	}
1324 
1325 	ctx.importEvents( _events );
1326     // avoid ring-reference:
1327     // vector< event elements > holding event elements holding this (via _pParent)
1328     _events.clear();
1329 	}
1330 
1331 	// create radios AFTER group box!
1332 	for ( size_t nPos = 0; nPos < _radios.size(); ++nPos )
1333 	{
1334 		Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
1335 		Reference< xml::input::XAttributes > xAttributes(
1336             xRadio->getAttributes() );
1337 
1338 		ControlImportContext ctx(
1339 			_pImport, getControlId( xAttributes ),
1340 			OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) );
1341 		Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1342 
1343 		Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
1344 		if (xStyle.is())
1345 		{
1346 			StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1347             pStyle->importBackgroundColorStyle( xControlModel );
1348 			pStyle->importTextColorStyle( xControlModel );
1349             pStyle->importTextLineColorStyle( xControlModel );
1350 			pStyle->importFontStyle( xControlModel );
1351 			pStyle->importVisualEffectStyle( xControlModel );
1352 		}
1353 
1354 		ctx.importDefaults( _nBasePosX, _nBasePosY, xAttributes );
1355 		ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1356 								   OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1357 								   xAttributes );
1358 		ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1359 								  OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1360 								  xAttributes );
1361         ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1362                                  OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1363                                  xAttributes );
1364         ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
1365                                          OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
1366                                          xAttributes );
1367         ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
1368                                   OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
1369                                   xAttributes );
1370         ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
1371                                          OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
1372                                          xAttributes );
1373         ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1374                                    OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1375                                    xAttributes );
1376 
1377 		sal_Int16 nVal = 0;
1378 		sal_Bool bChecked = sal_False;
1379 		if (getBoolAttr( &bChecked,
1380                          OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ),
1381                          xAttributes,
1382                          _pImport->XMLNS_DIALOGS_UID ) &&
1383 			bChecked)
1384 		{
1385 			nVal = 1;
1386 		}
1387 		xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
1388 										 makeAny( nVal ) );
1389 
1390         ::std::vector< Reference< xml::input::XElement > > * radioEvents =
1391             static_cast< RadioElement * >( xRadio.get() )->getEvents();
1392 		ctx.importEvents( *radioEvents );
1393         // avoid ring-reference:
1394         // vector< event elements > holding event elements holding this (via _pParent)
1395         radioEvents->clear();
1396 	}
1397     // avoid ring-reference:
1398     // vector< radio elements > holding radio elements holding this (via _pParent)
1399     _radios.clear();
1400 }
1401 
1402 //##################################################################################################
1403 
1404 // radio
1405 //__________________________________________________________________________________________________
1406 Reference< xml::input::XElement > RadioElement::startChildElement(
1407 	sal_Int32 nUid, OUString const & rLocalName,
1408 	Reference< xml::input::XAttributes > const & xAttributes )
1409 	throw (xml::sax::SAXException, RuntimeException)
1410 {
1411 	// event
1412     if (_pImport->isEventElement( nUid, rLocalName ))
1413 	{
1414 		return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1415 	}
1416 	else
1417 	{
1418 		throw xml::sax::SAXException(
1419 			OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1420 			Reference< XInterface >(), Any() );
1421 	}
1422 }
1423 
1424 //##################################################################################################
1425 
1426 // radiogroup
1427 //__________________________________________________________________________________________________
1428 Reference< xml::input::XElement > RadioGroupElement::startChildElement(
1429 	sal_Int32 nUid, OUString const & rLocalName,
1430 	Reference< xml::input::XAttributes > const & xAttributes )
1431 	throw (xml::sax::SAXException, RuntimeException)
1432 {
1433 	if (_pImport->XMLNS_DIALOGS_UID != nUid)
1434 	{
1435 		throw xml::sax::SAXException(
1436 			OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
1437 			Reference< XInterface >(), Any() );
1438 	}
1439 	// radio
1440 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("radio") ))
1441 	{
1442 		// dont create radios here, => titledbox must be inserted first due to radio grouping,
1443 		// possible predecessors!
1444 		Reference< xml::input::XElement > xRet(
1445 			new RadioElement( rLocalName, xAttributes, this, _pImport ) );
1446 		_radios.push_back( xRet );
1447 		return xRet;
1448 	}
1449 	else
1450 	{
1451 		throw xml::sax::SAXException(
1452 			OUString( RTL_CONSTASCII_USTRINGPARAM("expected radio element!") ),
1453 			Reference< XInterface >(), Any() );
1454 	}
1455 }
1456 //__________________________________________________________________________________________________
1457 void RadioGroupElement::endElement()
1458 	throw (xml::sax::SAXException, RuntimeException)
1459 {
1460 	for ( size_t nPos = 0; nPos < _radios.size(); ++nPos )
1461 	{
1462 		Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
1463 		Reference< xml::input::XAttributes > xAttributes(
1464             xRadio->getAttributes() );
1465 
1466 		ControlImportContext ctx(
1467 			_pImport, getControlId( xAttributes ),
1468 			OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) );
1469 		Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1470 
1471 		Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
1472 		if (xStyle.is())
1473 		{
1474 			StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1475             pStyle->importBackgroundColorStyle( xControlModel );
1476 			pStyle->importTextColorStyle( xControlModel );
1477             pStyle->importTextLineColorStyle( xControlModel );
1478 			pStyle->importFontStyle( xControlModel );
1479 			pStyle->importVisualEffectStyle( xControlModel );
1480 		}
1481 
1482 		ctx.importDefaults( _nBasePosX, _nBasePosY, xAttributes );
1483 		ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1484 								   OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1485 								   xAttributes );
1486 		ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1487 								  OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1488 								  xAttributes );
1489         ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1490                                  OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1491                                  xAttributes );
1492         ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
1493                                          OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
1494                                          xAttributes );
1495         ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
1496                                   OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
1497                                   xAttributes );
1498         ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
1499                                          OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
1500                                          xAttributes );
1501         ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1502                                    OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1503                                    xAttributes );
1504 		sal_Int16 nVal = 0;
1505 		sal_Bool bChecked = sal_False;
1506 		if (getBoolAttr( &bChecked,
1507                          OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ),
1508                          xAttributes,
1509                          _pImport->XMLNS_DIALOGS_UID ) &&
1510 			bChecked)
1511 		{
1512 			nVal = 1;
1513 		}
1514 		xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
1515 										 makeAny( nVal ) );
1516 
1517         ::std::vector< Reference< xml::input::XElement > > * radioEvents =
1518             static_cast< RadioElement * >( xRadio.get() )->getEvents();
1519 		ctx.importEvents( *radioEvents );
1520         // avoid ring-reference:
1521         // vector< event elements > holding event elements holding this (via _pParent)
1522         radioEvents->clear();
1523 	}
1524     // avoid ring-reference:
1525     // vector< radio elements > holding radio elements holding this (via _pParent)
1526     _radios.clear();
1527 }
1528 
1529 //##################################################################################################
1530 
1531 // menupopup
1532 //__________________________________________________________________________________________________
1533 Reference< xml::input::XElement > MenuPopupElement::startChildElement(
1534 	sal_Int32 nUid, OUString const & rLocalName,
1535 	Reference< xml::input::XAttributes > const & xAttributes )
1536 	throw (xml::sax::SAXException, RuntimeException)
1537 {
1538 	if (_pImport->XMLNS_DIALOGS_UID != nUid)
1539 	{
1540 		throw xml::sax::SAXException(
1541 			OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
1542 			Reference< XInterface >(), Any() );
1543 	}
1544 	// menuitem
1545 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menuitem") ))
1546 	{
1547 		OUString aValue(
1548             xAttributes->getValueByUidName(
1549                 _pImport->XMLNS_DIALOGS_UID,
1550                 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ) ) );
1551 		OSL_ENSURE( aValue.getLength(), "### menuitem has no value?" );
1552 		if (aValue.getLength())
1553 		{
1554 			_itemValues.push_back( aValue );
1555 
1556 			OUString aSel(
1557                 xAttributes->getValueByUidName(
1558                     _pImport->XMLNS_DIALOGS_UID,
1559                     OUString( RTL_CONSTASCII_USTRINGPARAM("selected") ) ) );
1560 			if (aSel.getLength() && aSel.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("true") ))
1561 			{
1562 				_itemSelected.push_back(
1563                     static_cast<sal_Int16>(_itemValues.size()) -1 );
1564 			}
1565 		}
1566 		return new ElementBase(
1567             _pImport->XMLNS_DIALOGS_UID,
1568             rLocalName, xAttributes, this, _pImport );
1569 	}
1570 	else
1571 	{
1572 		throw xml::sax::SAXException(
1573 			OUString( RTL_CONSTASCII_USTRINGPARAM("expected menuitem!") ),
1574 			Reference< XInterface >(), Any() );
1575 	}
1576 }
1577 //__________________________________________________________________________________________________
1578 Sequence< OUString > MenuPopupElement::getItemValues()
1579 {
1580 	Sequence< OUString > aRet( _itemValues.size() );
1581 	OUString * pRet = aRet.getArray();
1582 	for ( size_t nPos = _itemValues.size(); nPos--; )
1583 	{
1584 		pRet[ nPos ] = _itemValues[ nPos ];
1585 	}
1586 	return aRet;
1587 }
1588 //__________________________________________________________________________________________________
1589 Sequence< sal_Int16 > MenuPopupElement::getSelectedItems()
1590 {
1591 	Sequence< sal_Int16 > aRet( _itemSelected.size() );
1592 	sal_Int16 * pRet = aRet.getArray();
1593 	for ( size_t nPos = _itemSelected.size(); nPos--; )
1594 	{
1595 		pRet[ nPos ] = _itemSelected[ nPos ];
1596 	}
1597 	return aRet;
1598 }
1599 
1600 //##################################################################################################
1601 
1602 // menulist
1603 //__________________________________________________________________________________________________
1604 Reference< xml::input::XElement > MenuListElement::startChildElement(
1605 	sal_Int32 nUid, OUString const & rLocalName,
1606 	Reference< xml::input::XAttributes > const & xAttributes )
1607 	throw (xml::sax::SAXException, RuntimeException)
1608 {
1609 	// event
1610     if (_pImport->isEventElement( nUid, rLocalName ))
1611 	{
1612 		return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1613 	}
1614 	else if (_pImport->XMLNS_DIALOGS_UID != nUid)
1615 	{
1616 		throw xml::sax::SAXException(
1617 			OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
1618 			Reference< XInterface >(), Any() );
1619 	}
1620 	// menupopup
1621 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menupopup") ))
1622 	{
1623 		_popup = new MenuPopupElement( rLocalName, xAttributes, this, _pImport );
1624 		return _popup;
1625 	}
1626 	else
1627 	{
1628 		throw xml::sax::SAXException(
1629 			OUString( RTL_CONSTASCII_USTRINGPARAM("expected event or menupopup element!") ),
1630 			Reference< XInterface >(), Any() );
1631 	}
1632 }
1633 //__________________________________________________________________________________________________
1634 void MenuListElement::endElement()
1635 	throw (xml::sax::SAXException, RuntimeException)
1636 {
1637 	ControlImportContext ctx(
1638 		_pImport, getControlId( _xAttributes ),
1639 		OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) );
1640 	Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1641 
1642 	Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1643 	if (xStyle.is())
1644 	{
1645 		StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1646 		pStyle->importBackgroundColorStyle( xControlModel );
1647 		pStyle->importTextColorStyle( xControlModel );
1648 		pStyle->importTextLineColorStyle( xControlModel );
1649 		pStyle->importBorderStyle( xControlModel );
1650 		pStyle->importFontStyle( xControlModel );
1651 	}
1652 
1653 	ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1654 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1655 							   OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1656 							   _xAttributes );
1657 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiSelection") ),
1658 							   OUString( RTL_CONSTASCII_USTRINGPARAM("multiselection") ),
1659 							   _xAttributes );
1660 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
1661                                OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
1662                                _xAttributes );
1663 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
1664 							   OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
1665 							   _xAttributes );
1666 	ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
1667 							 OUString( RTL_CONSTASCII_USTRINGPARAM("linecount") ),
1668 							 _xAttributes );
1669 	ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1670                              OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1671                              _xAttributes );
1672 
1673 	if (_popup.is())
1674 	{
1675 		MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
1676 		xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
1677 										 makeAny( p->getItemValues() ) );
1678 		xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ),
1679 										 makeAny( p->getSelectedItems() ) );
1680 	}
1681 	ctx.importEvents( _events );
1682     // avoid ring-reference:
1683     // vector< event elements > holding event elements holding this (via _pParent)
1684     _events.clear();
1685 }
1686 
1687 //##################################################################################################
1688 
1689 // combobox
1690 //__________________________________________________________________________________________________
1691 Reference< xml::input::XElement > ComboBoxElement::startChildElement(
1692 	sal_Int32 nUid, OUString const & rLocalName,
1693 	Reference< xml::input::XAttributes > const & xAttributes )
1694 	throw (xml::sax::SAXException, RuntimeException)
1695 {
1696 	// event
1697     if (_pImport->isEventElement( nUid, rLocalName ))
1698 	{
1699 		return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1700 	}
1701 	else if (_pImport->XMLNS_DIALOGS_UID != nUid)
1702 	{
1703 		throw xml::sax::SAXException(
1704 			OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
1705 			Reference< XInterface >(), Any() );
1706 	}
1707 	// menupopup
1708 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menupopup") ))
1709 	{
1710 		_popup = new MenuPopupElement( rLocalName, xAttributes, this, _pImport );
1711 		return _popup;
1712 	}
1713 	else
1714 	{
1715 		throw xml::sax::SAXException(
1716 			OUString( RTL_CONSTASCII_USTRINGPARAM("expected event or menupopup element!") ),
1717 			Reference< XInterface >(), Any() );
1718 	}
1719 }
1720 //__________________________________________________________________________________________________
1721 void ComboBoxElement::endElement()
1722 	throw (xml::sax::SAXException, RuntimeException)
1723 {
1724 	ControlImportContext ctx(
1725 		_pImport, getControlId( _xAttributes ),
1726 		OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) );
1727 	Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1728 
1729 	Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1730 	if (xStyle.is())
1731 	{
1732 		StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1733 		pStyle->importBackgroundColorStyle( xControlModel );
1734 		pStyle->importTextColorStyle( xControlModel );
1735 		pStyle->importTextLineColorStyle( xControlModel );
1736 		pStyle->importBorderStyle( xControlModel );
1737 		pStyle->importFontStyle( xControlModel );
1738 	}
1739 
1740 	ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1741 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1742 							   OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1743 							   _xAttributes );
1744 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
1745 							   OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
1746 							   _xAttributes );
1747 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Autocomplete") ),
1748 							   OUString( RTL_CONSTASCII_USTRINGPARAM("autocomplete") ),
1749 							   _xAttributes );
1750 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
1751 							   OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
1752 							   _xAttributes );
1753 	ctx.importBooleanProperty(
1754         OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
1755         _xAttributes );
1756 	ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
1757 							 OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ),
1758 							 _xAttributes );
1759 	ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
1760 							 OUString( RTL_CONSTASCII_USTRINGPARAM("linecount") ),
1761 							 _xAttributes );
1762     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
1763                               OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1764                               _xAttributes );
1765 	ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1766                              OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1767                              _xAttributes );
1768 
1769 	if (_popup.is())
1770 	{
1771 		MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
1772 		xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
1773 										 makeAny( p->getItemValues() ) );
1774 	}
1775 
1776 	ctx.importEvents( _events );
1777     // avoid ring-reference:
1778     // vector< event elements > holding event elements holding this (via _pParent)
1779     _events.clear();
1780 }
1781 
1782 //##################################################################################################
1783 
1784 // checkbox
1785 //__________________________________________________________________________________________________
1786 Reference< xml::input::XElement > CheckBoxElement::startChildElement(
1787 	sal_Int32 nUid, OUString const & rLocalName,
1788 	Reference< xml::input::XAttributes > const & xAttributes )
1789 	throw (xml::sax::SAXException, RuntimeException)
1790 {
1791 	// event
1792     if (_pImport->isEventElement( nUid, rLocalName ))
1793 	{
1794 		return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1795 	}
1796 	else
1797 	{
1798 		throw xml::sax::SAXException(
1799 			OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1800 			Reference< XInterface >(), Any() );
1801 	}
1802 }
1803 //__________________________________________________________________________________________________
1804 void CheckBoxElement::endElement()
1805 	throw (xml::sax::SAXException, RuntimeException)
1806 {
1807 	ControlImportContext ctx(
1808 		_pImport, getControlId( _xAttributes ),
1809 		OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) );
1810 	Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1811 
1812 	Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1813 	if (xStyle.is())
1814 	{
1815 		StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1816         pStyle->importBackgroundColorStyle( xControlModel );
1817 		pStyle->importTextColorStyle( xControlModel );
1818 		pStyle->importTextLineColorStyle( xControlModel );
1819 		pStyle->importFontStyle( xControlModel );
1820 		pStyle->importVisualEffectStyle( xControlModel );
1821 	}
1822 
1823 	ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1824 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1825 							   OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1826 							   _xAttributes );
1827 	ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1828 							  OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1829 							  _xAttributes );
1830 	ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1831                              OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1832                              _xAttributes );
1833     ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
1834                                      OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
1835                                      _xAttributes );
1836 	ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
1837 							  OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
1838 							  _xAttributes );
1839     ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
1840                                      OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
1841                                      _xAttributes );
1842 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1843 							   OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1844 							   _xAttributes );
1845 
1846 
1847 	sal_Bool bTriState = sal_False;
1848 	if (getBoolAttr( &bTriState,
1849                      OUString( RTL_CONSTASCII_USTRINGPARAM("tristate") ),
1850                      _xAttributes,
1851                      _pImport->XMLNS_DIALOGS_UID ))
1852 	{
1853 		xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("TriState") ),
1854 										 makeAny( bTriState ) );
1855 	}
1856 	sal_Bool bChecked = sal_False;
1857 	if (getBoolAttr( &bChecked,
1858                      OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ),
1859                      _xAttributes,
1860                      _pImport->XMLNS_DIALOGS_UID ))
1861 	{
1862 		// has "checked" attribute
1863 		sal_Int16 nVal = (bChecked ? 1 : 0);
1864 		xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
1865 										 makeAny( nVal ) );
1866 	}
1867 	else
1868 	{
1869 		sal_Int16 nVal = (bTriState ? 2 : 0); // if tristate set, but checked omitted => dont know!
1870 		xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
1871 										 makeAny( nVal ) );
1872 	}
1873 
1874 	ctx.importEvents( _events );
1875     // avoid ring-reference:
1876     // vector< event elements > holding event elements holding this (via _pParent)
1877     _events.clear();
1878 }
1879 
1880 //##################################################################################################
1881 
1882 // button
1883 //__________________________________________________________________________________________________
1884 Reference< xml::input::XElement > ButtonElement::startChildElement(
1885 	sal_Int32 nUid, OUString const & rLocalName,
1886 	Reference< xml::input::XAttributes > const & xAttributes )
1887 	throw (xml::sax::SAXException, RuntimeException)
1888 {
1889 	// event
1890     if (_pImport->isEventElement( nUid, rLocalName ))
1891 	{
1892 		return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1893 	}
1894 	else
1895 	{
1896 		throw xml::sax::SAXException(
1897 			OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1898 			Reference< XInterface >(), Any() );
1899 	}
1900 }
1901 //__________________________________________________________________________________________________
1902 void ButtonElement::endElement()
1903 	throw (xml::sax::SAXException, RuntimeException)
1904 {
1905 	ControlImportContext ctx(
1906 		_pImport, getControlId( _xAttributes ),
1907 		OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) );
1908 
1909 	Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1910 	if (xStyle.is())
1911 	{
1912 		StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1913 		Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1914 		pStyle->importBackgroundColorStyle( xControlModel );
1915 		pStyle->importTextColorStyle( xControlModel );
1916 		pStyle->importTextLineColorStyle( xControlModel );
1917 		pStyle->importFontStyle( xControlModel );
1918 	}
1919 
1920 	ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1921 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1922 							   OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1923 							   _xAttributes );
1924 	ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1925 							  OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1926 							  _xAttributes );
1927 	ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1928                              OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1929                              _xAttributes );
1930     ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
1931                                      OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
1932                                      _xAttributes );
1933     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultButton") ),
1934 							   OUString( RTL_CONSTASCII_USTRINGPARAM("default") ),
1935 							   _xAttributes );
1936 	ctx.importButtonTypeProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("PushButtonType") ),
1937                                   OUString( RTL_CONSTASCII_USTRINGPARAM("button-type") ),
1938                                   _xAttributes );
1939 	ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
1940 							  OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
1941 							  _xAttributes );
1942     ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
1943                                      OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
1944                                      _xAttributes );
1945     ctx.importImageAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageAlign") ),
1946                                   OUString( RTL_CONSTASCII_USTRINGPARAM("image-align") ),
1947                                   _xAttributes );
1948     if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
1949                                 _xAttributes ))
1950 		ctx.getControlModel()->setPropertyValue(
1951             OUSTR("Repeat"), makeAny(true) );
1952     sal_Int32 toggled = 0;
1953     if (getLongAttr( &toggled, OUSTR("toggled"), _xAttributes,
1954                      _pImport->XMLNS_DIALOGS_UID ) && toggled == 1)
1955         ctx.getControlModel()->setPropertyValue(OUSTR("Toggle"), makeAny(true));
1956 	ctx.importBooleanProperty( OUSTR("FocusOnClick"), OUSTR("grab-focus"),
1957                                _xAttributes );
1958 	ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1959 							   OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1960 							   _xAttributes );
1961 	// State
1962     sal_Bool bChecked = sal_False;
1963     if (getBoolAttr(
1964             &bChecked,
1965             OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ),
1966             _xAttributes,
1967             _pImport->XMLNS_DIALOGS_UID ) &&
1968         bChecked)
1969     {
1970         sal_Int16 nVal = 1;
1971         ctx.getControlModel()->setPropertyValue(
1972             OUString( RTL_CONSTASCII_USTRINGPARAM("State") ), makeAny( nVal ) );
1973     }
1974 
1975 	ctx.importEvents( _events );
1976     // avoid ring-reference:
1977     // vector< event elements > holding event elements holding this (via _pParent)
1978     _events.clear();
1979 }
1980 
1981 //##################################################################################################
1982 
1983 // bulletinboard
1984 //__________________________________________________________________________________________________
1985 Reference< xml::input::XElement > BulletinBoardElement::startChildElement(
1986 	sal_Int32 nUid, OUString const & rLocalName,
1987 	Reference< xml::input::XAttributes > const & xAttributes )
1988 	throw (xml::sax::SAXException, RuntimeException)
1989 {
1990 	if (_pImport->XMLNS_DIALOGS_UID != nUid)
1991 	{
1992 		throw xml::sax::SAXException(
1993 			OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
1994 			Reference< XInterface >(), Any() );
1995 	}
1996 	// button
1997 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("button") ))
1998 	{
1999 		return new ButtonElement( rLocalName, xAttributes, this, _pImport );
2000 	}
2001 	// checkbox
2002 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("checkbox") ))
2003 	{
2004 		return new CheckBoxElement( rLocalName, xAttributes, this, _pImport );
2005 	}
2006 	// combobox
2007 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("combobox") ))
2008 	{
2009 		return new ComboBoxElement( rLocalName, xAttributes, this, _pImport );
2010 	}
2011 	// listbox
2012 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menulist") ))
2013 	{
2014 		return new MenuListElement( rLocalName, xAttributes, this, _pImport );
2015 	}
2016 	// radiogroup
2017 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("radiogroup") ))
2018 	{
2019 		return new RadioGroupElement( rLocalName, xAttributes, this, _pImport );
2020 	}
2021 	// titledbox
2022 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("titledbox") ))
2023 	{
2024 		return new TitledBoxElement( rLocalName, xAttributes, this, _pImport );
2025 	}
2026 	// text
2027 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("text") ))
2028 	{
2029 		return new TextElement( rLocalName, xAttributes, this, _pImport );
2030 	}
2031 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("linklabel") ))
2032 	{
2033 		return new FixedHyperLinkElement( rLocalName, xAttributes, this, _pImport );
2034 	}
2035 	// textfield
2036 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("textfield") ))
2037 	{
2038 		return new TextFieldElement( rLocalName, xAttributes, this, _pImport );
2039 	}
2040 	// img
2041 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("img") ))
2042 	{
2043 		return new ImageControlElement( rLocalName, xAttributes, this, _pImport );
2044 	}
2045 	// filecontrol
2046 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("filecontrol") ))
2047 	{
2048 		return new FileControlElement( rLocalName, xAttributes, this, _pImport );
2049 	}
2050 	// treecontrol
2051 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("treecontrol") ))
2052 	{
2053 		return new TreeControlElement( rLocalName, xAttributes, this, _pImport );
2054 	}
2055 	// currencyfield
2056 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("currencyfield") ))
2057 	{
2058 		return new CurrencyFieldElement( rLocalName, xAttributes, this, _pImport );
2059 	}
2060 	// datefield
2061 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("datefield") ))
2062 	{
2063 		return new DateFieldElement( rLocalName, xAttributes, this, _pImport );
2064 	}
2065 	// datefield
2066 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("numericfield") ))
2067 	{
2068 		return new NumericFieldElement( rLocalName, xAttributes, this, _pImport );
2069 	}
2070 	// timefield
2071 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("timefield") ))
2072 	{
2073 		return new TimeFieldElement( rLocalName, xAttributes, this, _pImport );
2074 	}
2075 	// patternfield
2076 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("patternfield") ))
2077 	{
2078 		return new PatternFieldElement( rLocalName, xAttributes, this, _pImport );
2079 	}
2080 	// formattedfield
2081 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("formattedfield") ))
2082 	{
2083 		return new FormattedFieldElement( rLocalName, xAttributes, this, _pImport );
2084 	}
2085 	// fixedline
2086 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("fixedline") ))
2087 	{
2088 		return new FixedLineElement( rLocalName, xAttributes, this, _pImport );
2089 	}
2090 	// scrollbar
2091 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("scrollbar") ))
2092 	{
2093 		return new ScrollBarElement( rLocalName, xAttributes, this, _pImport );
2094 	}
2095 	// progressmeter
2096 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("progressmeter") ))
2097 	{
2098 		return new ProgressBarElement( rLocalName, xAttributes, this, _pImport );
2099 	}
2100 	// bulletinboard
2101 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") ))
2102 	{
2103 		return new BulletinBoardElement( rLocalName, xAttributes, this, _pImport );
2104 	}
2105 	else
2106 	{
2107 		throw xml::sax::SAXException(
2108 			OUString( RTL_CONSTASCII_USTRINGPARAM("expected styles, bulletinboard or bulletinboard element, not: ") ) + rLocalName,
2109 			Reference< XInterface >(), Any() );
2110 	}
2111 }
2112 //__________________________________________________________________________________________________
2113 BulletinBoardElement::BulletinBoardElement(
2114 	OUString const & rLocalName,
2115 	Reference< xml::input::XAttributes > const & xAttributes,
2116 	ElementBase * pParent, DialogImport * pImport )
2117 	SAL_THROW( () )
2118 	: ControlElement( rLocalName, xAttributes, pParent, pImport )
2119 {
2120 	OUString aValue(
2121         _xAttributes->getValueByUidName(
2122             _pImport->XMLNS_DIALOGS_UID,
2123             OUString( RTL_CONSTASCII_USTRINGPARAM("left") ) ) );
2124 	if (aValue.getLength())
2125 	{
2126 		_nBasePosX += toInt32( aValue );
2127 	}
2128 	aValue = _xAttributes->getValueByUidName(
2129 		_pImport->XMLNS_DIALOGS_UID,
2130         OUString( RTL_CONSTASCII_USTRINGPARAM("top") ) );
2131 	if (aValue.getLength())
2132 	{
2133 		_nBasePosY += toInt32( aValue );
2134 	}
2135 }
2136 
2137 //##################################################################################################
2138 
2139 // style
2140 //__________________________________________________________________________________________________
2141 Reference< xml::input::XElement > StyleElement::startChildElement(
2142 	sal_Int32 /*nUid*/, OUString const & /*rLocalName*/,
2143 	Reference< xml::input::XAttributes > const & /*xAttributes*/ )
2144 	throw (xml::sax::SAXException, RuntimeException)
2145 {
2146 	throw xml::sax::SAXException(
2147 		OUString( RTL_CONSTASCII_USTRINGPARAM("unexpected sub elements of style!") ),
2148 		Reference< XInterface >(), Any() );
2149 }
2150 //__________________________________________________________________________________________________
2151 void StyleElement::endElement()
2152 	throw (xml::sax::SAXException, RuntimeException)
2153 {
2154 	Reference< xml::input::XAttributes > xStyle;
2155 	OUString aStyleId(
2156         _xAttributes->getValueByUidName(
2157             _pImport->XMLNS_DIALOGS_UID,
2158             OUString( RTL_CONSTASCII_USTRINGPARAM("style-id") ) ) );
2159 	if (aStyleId.getLength())
2160 	{
2161 		_pImport->addStyle( aStyleId, this );
2162 	}
2163 	else
2164 	{
2165 		throw xml::sax::SAXException(
2166 			OUString( RTL_CONSTASCII_USTRINGPARAM("missing style-id attribute!") ),
2167 			Reference< XInterface >(), Any() );
2168 	}
2169 }
2170 
2171 //##################################################################################################
2172 
2173 // styles
2174 //__________________________________________________________________________________________________
2175 Reference< xml::input::XElement > StylesElement::startChildElement(
2176 	sal_Int32 nUid, OUString const & rLocalName,
2177 	Reference< xml::input::XAttributes > const & xAttributes )
2178 	throw (xml::sax::SAXException, RuntimeException)
2179 {
2180 	if (_pImport->XMLNS_DIALOGS_UID != nUid)
2181 	{
2182 		throw xml::sax::SAXException(
2183 			OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
2184 			Reference< XInterface >(), Any() );
2185 	}
2186 	// style
2187 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("style") ))
2188 	{
2189 		return new StyleElement( rLocalName, xAttributes, this, _pImport );
2190 	}
2191 	else
2192 	{
2193 		throw xml::sax::SAXException(
2194 			OUString( RTL_CONSTASCII_USTRINGPARAM("expected style element!") ),
2195 			Reference< XInterface >(), Any() );
2196 	}
2197 }
2198 
2199 //##################################################################################################
2200 
2201 // window
2202 //__________________________________________________________________________________________________
2203 Reference< xml::input::XElement > WindowElement::startChildElement(
2204 	sal_Int32 nUid, OUString const & rLocalName,
2205 	Reference< xml::input::XAttributes > const & xAttributes )
2206 	throw (xml::sax::SAXException, RuntimeException)
2207 {
2208 	// event
2209     if (_pImport->isEventElement( nUid, rLocalName ))
2210 	{
2211 		return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
2212 	}
2213 	else if (_pImport->XMLNS_DIALOGS_UID != nUid)
2214 	{
2215 		throw xml::sax::SAXException(
2216 			OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
2217 			Reference< XInterface >(), Any() );
2218 	}
2219 	// styles
2220 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("styles") ))
2221 	{
2222 		return new StylesElement( rLocalName, xAttributes, this, _pImport );
2223 	}
2224 	// bulletinboard
2225 	else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") ))
2226 	{
2227 		return new BulletinBoardElement( rLocalName, xAttributes, this, _pImport );
2228 	}
2229 	else
2230 	{
2231 		throw xml::sax::SAXException(
2232 			OUString( RTL_CONSTASCII_USTRINGPARAM("expected styles ot bulletinboard element!") ),
2233 			Reference< XInterface >(), Any() );
2234 	}
2235 }
2236 //__________________________________________________________________________________________________
2237 void WindowElement::endElement()
2238 	throw (xml::sax::SAXException, RuntimeException)
2239 {
2240 	Reference< beans::XPropertySet > xProps(
2241         _pImport->_xDialogModel, UNO_QUERY_THROW );
2242 	ImportContext ctx( _pImport, xProps, getControlId( _xAttributes ) );
2243 
2244 	Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
2245 	if (xStyle.is())
2246 	{
2247 		StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
2248 		pStyle->importBackgroundColorStyle( xProps );
2249 		pStyle->importTextColorStyle( xProps );
2250 		pStyle->importTextLineColorStyle( xProps );
2251 		pStyle->importFontStyle( xProps );
2252 	}
2253 
2254 	ctx.importDefaults( 0, 0, _xAttributes, false );
2255 	ctx.importBooleanProperty(
2256         OUString( RTL_CONSTASCII_USTRINGPARAM("Closeable") ),
2257         OUString( RTL_CONSTASCII_USTRINGPARAM("closeable") ),
2258         _xAttributes );
2259 	ctx.importBooleanProperty(
2260         OUString( RTL_CONSTASCII_USTRINGPARAM("Moveable") ),
2261         OUString( RTL_CONSTASCII_USTRINGPARAM("moveable") ),
2262         _xAttributes );
2263 	ctx.importBooleanProperty(
2264         OUString( RTL_CONSTASCII_USTRINGPARAM("Sizeable") ),
2265         OUString( RTL_CONSTASCII_USTRINGPARAM("resizeable") ),
2266         _xAttributes );
2267 	ctx.importStringProperty(
2268         OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ),
2269         OUString( RTL_CONSTASCII_USTRINGPARAM("title") ),
2270         _xAttributes );
2271 	ctx.importBooleanProperty(
2272         OUString( RTL_CONSTASCII_USTRINGPARAM("Decoration") ),
2273         OUString( RTL_CONSTASCII_USTRINGPARAM("withtitlebar") ),
2274         _xAttributes );
2275 	ctx.importStringProperty(
2276 		OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
2277 		OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
2278 		_xAttributes );
2279 	ctx.importEvents( _events );
2280     // avoid ring-reference:
2281     // vector< event elements > holding event elements holding this (via _pParent)
2282     _events.clear();
2283 }
2284 
2285 }
2286