bump product version to 4.1.6.2
[LibreOffice.git] / xmlscript / source / xmldlg_imexp / xmldlg_impmodels.cxx
blob1f9b3e1d8cb887e5ca0e3aac169d6884ebc6adc5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "imp_share.hxx"
21 #include <com/sun/star/form/binding/XBindableValue.hpp>
22 #include <com/sun/star/form/binding/XValueBinding.hpp>
23 #include <com/sun/star/form/binding/XListEntrySink.hpp>
24 #include <com/sun/star/beans/NamedValue.hpp>
25 #include <com/sun/star/table/CellAddress.hpp>
26 #include <com/sun/star/table/CellRangeAddress.hpp>
27 #include <com/sun/star/beans/XPropertySet.hpp>
28 #include <com/sun/star/beans/XPropertyState.hpp>
29 #include <com/sun/star/document/XStorageBasedDocument.hpp>
30 #include <com/sun/star/document/XGraphicObjectResolver.hpp>
31 #include <com/sun/star/script/vba/XVBACompatibility.hpp>
33 #include <comphelper/componentcontext.hxx>
34 #include <comphelper/processfactory.hxx>
35 using namespace ::com::sun::star;
36 using namespace ::com::sun::star::uno;
38 namespace xmlscript
41 Reference< xml::input::XElement > Frame::startChildElement(
42 sal_Int32 nUid, OUString const & rLocalName,
43 Reference< xml::input::XAttributes > const & xAttributes )
44 throw (xml::sax::SAXException, RuntimeException)
46 if ( !m_xContainer.is() )
47 m_xContainer.set( _pImport->_xDialogModelFactory->createInstance( "com.sun.star.awt.UnoFrameModel" ), UNO_QUERY );
48 // event
49 if (_pImport->isEventElement( nUid, rLocalName ))
51 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
53 else if ( rLocalName == "bulletinboard" )
55 // Create new DialogImport for this container
56 DialogImport* pFrameImport = new DialogImport( *_pImport );
57 pFrameImport->_xDialogModel = m_xContainer;
58 return new BulletinBoardElement( rLocalName, xAttributes, this, pFrameImport );
60 else if ( rLocalName == "title" )
62 getStringAttr( &_label, "value", xAttributes, _pImport->XMLNS_DIALOGS_UID );
64 return new ElementBase( _pImport->XMLNS_DIALOGS_UID, rLocalName, xAttributes, this, _pImport );
66 else
68 SAL_INFO("xmlscript.xmldlg","****** ARGGGGG!!!! **********");
69 throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() );
72 //__________________________________________________________________________________________________
74 void Frame::endElement()
75 throw (xml::sax::SAXException, RuntimeException)
77 if ( !m_xContainer.is() )
78 m_xContainer.set( _pImport->_xDialogModelFactory->createInstance( "com.sun.star.awt.UnoFrameModel" ), UNO_QUERY );
79 Reference< beans::XPropertySet > xProps( m_xContainer, UNO_QUERY_THROW );
80 // _pImport is what we need to add to ( e.g. the dialog in this case )
81 ControlImportContext ctx( _pImport, xProps, getControlId( _xAttributes ) );
83 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
85 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
86 if (xStyle.is())
88 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
89 pStyle->importTextColorStyle( xControlModel );
90 pStyle->importTextLineColorStyle( xControlModel );
91 pStyle->importFontStyle( xControlModel );
94 ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
95 if (!_label.isEmpty())
97 xControlModel->setPropertyValue( "Label" , makeAny( _label ) );
99 #ifdef SCROLLABLEFRAME
100 ctx.importScollableSettings( _xAttributes );
101 #endif
102 ctx.importEvents( _events );
103 // avoid ring-reference:
104 // vector< event elements > holding event elements holding this (via _pParent)
105 _events.clear();
108 //===
109 Reference< xml::input::XElement > MultiPage::startChildElement(
110 sal_Int32 nUid, OUString const & rLocalName,
111 Reference< xml::input::XAttributes > const & xAttributes )
112 throw (xml::sax::SAXException, RuntimeException)
114 // event
115 if (_pImport->isEventElement( nUid, rLocalName ))
117 return new EventElement(
118 nUid, rLocalName, xAttributes, this, _pImport );
120 else if ( rLocalName == "bulletinboard" )
122 // Create new DialogImport for this container
124 DialogImport* pMultiPageImport = new DialogImport( *_pImport );
125 pMultiPageImport->_xDialogModel = m_xContainer;
126 return new BulletinBoardElement( rLocalName, xAttributes, this, pMultiPageImport );
128 else
131 throw xml::sax::SAXException( "expected event element!", Reference< XInterface >(), Any() );
134 //__________________________________________________________________________________________________
136 void MultiPage::endElement()
137 throw (xml::sax::SAXException, RuntimeException)
139 Reference< beans::XPropertySet > xProps( m_xContainer, UNO_QUERY_THROW );
140 // _pImport is what we need to add to ( e.g. the dialog in this case )
141 ControlImportContext ctx( _pImport, xProps, getControlId( _xAttributes ));
143 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
145 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
146 if (xStyle.is())
148 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
149 pStyle->importTextColorStyle( xControlModel );
150 pStyle->importTextLineColorStyle( xControlModel );
151 pStyle->importFontStyle( xControlModel );
152 pStyle->importBackgroundColorStyle( xControlModel );
155 ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
156 ctx.importLongProperty("MultiPageValue" , "value", _xAttributes );
157 ctx.importBooleanProperty( "Decoration", "withtabs", _xAttributes) ;
158 ctx.importEvents( _events );
159 // avoid ring-reference:
160 // vector< event elements > holding event elements holding this (via _pParent)
161 _events.clear();
164 Reference< xml::input::XElement > Page::startChildElement(
165 sal_Int32 nUid, OUString const & rLocalName,
166 Reference< xml::input::XAttributes > const & xAttributes )
167 throw (xml::sax::SAXException, RuntimeException)
169 // event
170 if (_pImport->isEventElement( nUid, rLocalName ))
172 return new EventElement(
173 nUid, rLocalName, xAttributes, this, _pImport );
175 else if ( rLocalName == "bulletinboard" )
178 DialogImport* pPageImport = new DialogImport( *_pImport );
179 pPageImport->_xDialogModel = m_xContainer;
180 return new BulletinBoardElement( rLocalName, xAttributes, this, pPageImport );
182 else
185 throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() );
188 //__________________________________________________________________________________________________
190 void Page::endElement()
191 throw (xml::sax::SAXException, RuntimeException)
193 Reference< beans::XPropertySet > xProps( m_xContainer, UNO_QUERY_THROW );
195 ControlImportContext ctx( _pImport, xProps, getControlId( _xAttributes ));
197 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
199 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
200 if (xStyle.is())
202 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
203 pStyle->importTextColorStyle( xControlModel );
204 pStyle->importTextLineColorStyle( xControlModel );
205 pStyle->importFontStyle( xControlModel );
206 pStyle->importBackgroundColorStyle( xControlModel );
209 ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
210 ctx.importStringProperty( OUString( "Title" ), OUString( "title" ), _xAttributes );
211 ctx.importEvents( _events );
212 // avoid ring-reference:
213 // vector< event elements > holding event elements holding this (via _pParent)
214 _events.clear();
217 // progessmeter
218 //__________________________________________________________________________________________________
219 Reference< xml::input::XElement > ProgressBarElement::startChildElement(
220 sal_Int32 nUid, OUString const & rLocalName,
221 Reference< xml::input::XAttributes > const & xAttributes )
222 throw (xml::sax::SAXException, RuntimeException)
224 // event
225 if (_pImport->isEventElement( nUid, rLocalName ))
227 return new EventElement(
228 nUid, rLocalName, xAttributes, this, _pImport );
230 else
232 throw xml::sax::SAXException(
233 OUString( "expected event element!" ),
234 Reference< XInterface >(), Any() );
237 //__________________________________________________________________________________________________
238 void ProgressBarElement::endElement()
239 throw (xml::sax::SAXException, RuntimeException)
241 ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlProgressBarModel" );
243 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
244 if (xStyle.is())
246 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
247 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
248 pStyle->importBackgroundColorStyle( xControlModel );
249 pStyle->importBorderStyle( xControlModel );
250 pStyle->importFillColorStyle( xControlModel );
253 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
254 ctx.importLongProperty( "ProgressValue", "value", _xAttributes );
255 ctx.importLongProperty( "ProgressValueMin", "value-min", _xAttributes );
256 ctx.importLongProperty( "ProgressValueMax", "value-max", _xAttributes );
257 ctx.importEvents( _events );
258 // avoid ring-reference:
259 // vector< event elements > holding event elements holding this (via _pParent)
260 _events.clear();
263 //##################################################################################################
265 // scrollbar
266 //__________________________________________________________________________________________________
267 Reference< xml::input::XElement > ScrollBarElement::startChildElement(
268 sal_Int32 nUid, OUString const & rLocalName,
269 Reference< xml::input::XAttributes > const & xAttributes )
270 throw (xml::sax::SAXException, RuntimeException)
272 // event
273 if (_pImport->isEventElement( nUid, rLocalName ))
275 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
277 else
279 throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() );
282 //__________________________________________________________________________________________________
283 void ScrollBarElement::endElement()
284 throw (xml::sax::SAXException, RuntimeException)
286 ControlImportContext ctx( _pImport, getControlId( _xAttributes ), getControlModelName( "com.sun.star.awt.UnoControlScrollBarModel" , _xAttributes ) );
288 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
289 if (xStyle.is())
291 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
292 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
293 pStyle->importBackgroundColorStyle( xControlModel );
294 pStyle->importBorderStyle( xControlModel );
297 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
298 ctx.importOrientationProperty( "Orientation" , "align", _xAttributes );
299 ctx.importLongProperty( "BlockIncrement" , "pageincrement" , _xAttributes );
300 ctx.importLongProperty( "LineIncrement" , "increment" , _xAttributes );
301 ctx.importLongProperty( "ScrollValue" ,"curpos", _xAttributes );
302 ctx.importLongProperty( "ScrollValueMax" , "maxpos" , _xAttributes );
303 ctx.importLongProperty( "ScrollValueMin","minpos", _xAttributes );
304 ctx.importLongProperty( "VisibleSize", "visible-size", _xAttributes );
305 ctx.importLongProperty( "RepeatDelay", "repeat", _xAttributes );
306 ctx.importBooleanProperty( "Tabstop", "tabstop" , _xAttributes );
307 ctx.importBooleanProperty( "LiveScroll", "live-scroll", _xAttributes );
308 ctx.importHexLongProperty( "SymbolColor", "symbol-color", _xAttributes );
310 ctx.importDataAwareProperty( "linked-cell" , _xAttributes );
311 ctx.importEvents( _events );
312 // avoid ring-reference:
313 // vector< event elements > holding event elements holding this (via _pParent)
314 _events.clear();
317 //##################################################################################################
319 // spinbutton
320 //__________________________________________________________________________________________________
321 Reference< xml::input::XElement > SpinButtonElement::startChildElement(
322 sal_Int32 nUid, OUString const & rLocalName,
323 Reference< xml::input::XAttributes > const & xAttributes )
324 throw (xml::sax::SAXException, RuntimeException)
326 // event
327 if (_pImport->isEventElement( nUid, rLocalName ))
329 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
331 else
333 throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() );
336 //__________________________________________________________________________________________________
337 void SpinButtonElement::endElement()
338 throw (xml::sax::SAXException, RuntimeException)
340 ControlImportContext ctx( _pImport, getControlId( _xAttributes ), getControlModelName( "com.sun.star.awt.UnoControlSpinButtonModel", _xAttributes ) );
342 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
343 if (xStyle.is())
345 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
346 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
347 pStyle->importBackgroundColorStyle( xControlModel );
348 pStyle->importBorderStyle( xControlModel );
351 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
352 ctx.importOrientationProperty( "Orientation", "align", _xAttributes );
353 ctx.importLongProperty("SpinIncrement", "increment", _xAttributes );
354 ctx.importLongProperty("SpinValue", "curval" ,_xAttributes );
355 ctx.importLongProperty("SpinValueMax", "maxval", _xAttributes );
356 ctx.importLongProperty( "SpinValueMin","minval",_xAttributes );
357 ctx.importLongProperty( "Repeat", "repeat", _xAttributes );
358 ctx.importLongProperty( "RepeatDelay", "repeat-delay",_xAttributes );
359 ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
360 ctx.importHexLongProperty( "SymbolColor", "symbol-color" , _xAttributes );
361 ctx.importDataAwareProperty( "linked-cell" , _xAttributes );
362 ctx.importEvents( _events );
363 // avoid ring-reference:
364 // vector< event elements > holding event elements holding this (via _pParent)
365 _events.clear();
368 //##################################################################################################
370 // fixedline
371 //__________________________________________________________________________________________________
372 Reference< xml::input::XElement > FixedLineElement::startChildElement(
373 sal_Int32 nUid, OUString const & rLocalName,
374 Reference< xml::input::XAttributes > const & xAttributes )
375 throw (xml::sax::SAXException, RuntimeException)
377 // event
378 if (_pImport->isEventElement( nUid, rLocalName ))
380 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
382 else
384 throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() );
387 //__________________________________________________________________________________________________
388 void FixedLineElement::endElement()
389 throw (xml::sax::SAXException, RuntimeException)
391 ControlImportContext ctx(_pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlFixedLineModel" );
393 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
394 if (xStyle.is())
396 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
397 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
398 pStyle->importTextColorStyle( xControlModel );
399 pStyle->importTextLineColorStyle( xControlModel );
400 pStyle->importFontStyle( xControlModel );
403 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
404 ctx.importStringProperty( "Label", "value", _xAttributes );
405 ctx.importOrientationProperty( "Orientation", "align", _xAttributes );
406 ctx.importEvents( _events );
407 // avoid ring-reference:
408 // vector< event elements > holding event elements holding this (via _pParent)
409 _events.clear();
412 //##################################################################################################
414 // patternfield
415 //__________________________________________________________________________________________________
416 Reference< xml::input::XElement > PatternFieldElement::startChildElement(
417 sal_Int32 nUid, OUString const & rLocalName,
418 Reference< xml::input::XAttributes > const & xAttributes )
419 throw (xml::sax::SAXException, RuntimeException)
421 // event
422 if (_pImport->isEventElement( nUid, rLocalName ))
424 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
426 else
428 throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() );
431 //__________________________________________________________________________________________________
432 void PatternFieldElement::endElement()
433 throw (xml::sax::SAXException, RuntimeException)
435 ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlPatternFieldModel" );
437 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
438 if (xStyle.is())
440 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
441 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
442 pStyle->importBackgroundColorStyle( xControlModel );
443 pStyle->importTextColorStyle( xControlModel );
444 pStyle->importTextLineColorStyle( xControlModel );
445 pStyle->importBorderStyle( xControlModel );
446 pStyle->importFontStyle( xControlModel );
449 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
450 ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
451 ctx.importBooleanProperty( "ReadOnly", "readonly" , _xAttributes );
452 ctx.importBooleanProperty( "StrictFormat", "strict-format", _xAttributes );
453 ctx.importBooleanProperty( "HideInactiveSelection", "hide-inactive-selection", _xAttributes );
454 ctx.importStringProperty( "Text", "value", _xAttributes );
455 ctx.importShortProperty( "MaxTextLen", "maxlength", _xAttributes );
456 ctx.importStringProperty( "EditMask", "edit-mask", _xAttributes );
457 ctx.importStringProperty( "LiteralMask", "literal-mask", _xAttributes );
458 ctx.importEvents( _events );
459 // avoid ring-reference:
460 // vector< event elements > holding event elements holding this (via _pParent)
461 _events.clear();
464 //##################################################################################################
466 // formattedfield
467 //__________________________________________________________________________________________________
468 Reference< xml::input::XElement > FormattedFieldElement::startChildElement(
469 sal_Int32 nUid, OUString const & rLocalName,
470 Reference< xml::input::XAttributes > const & xAttributes )
471 throw (xml::sax::SAXException, RuntimeException)
473 // event
474 if (_pImport->isEventElement( nUid, rLocalName ))
476 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
478 else
480 throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() );
483 //__________________________________________________________________________________________________
484 void FormattedFieldElement::endElement()
485 throw (xml::sax::SAXException, RuntimeException)
487 ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlFormattedFieldModel" );
489 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
490 if (xStyle.is())
492 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
493 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
494 pStyle->importBackgroundColorStyle( xControlModel );
495 pStyle->importTextColorStyle( xControlModel );
496 pStyle->importTextLineColorStyle( xControlModel );
497 pStyle->importBorderStyle( xControlModel );
498 pStyle->importFontStyle( xControlModel );
501 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
502 ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
503 ctx.importBooleanProperty( "ReadOnly", "readonly" , _xAttributes );
504 ctx.importBooleanProperty( "StrictFormat", "strict-format" , _xAttributes );
505 ctx.importBooleanProperty( "HideInactiveSelection", "hide-inactive-selection", _xAttributes );
506 ctx.importAlignProperty( "Align" , "align" , _xAttributes );
507 ctx.importDoubleProperty( "EffectiveMin", "value-min" , _xAttributes );
508 ctx.importDoubleProperty( "EffectiveMax", "value-max", _xAttributes);
509 ctx.importDoubleProperty( "EffectiveValue", "value", _xAttributes );
510 ctx.importStringProperty( "Text", "text", _xAttributes );
511 ctx.importShortProperty( "MaxTextLen", "maxlength", _xAttributes );
512 ctx.importBooleanProperty( "Spin", "spin", _xAttributes );
513 if (ctx.importLongProperty( "RepeatDelay", "repeat", _xAttributes ))
514 ctx.getControlModel()->setPropertyValue( "Repeat" , makeAny(true) );
516 OUString sDefault(_xAttributes->getValueByUidName(_pImport->XMLNS_DIALOGS_UID, "value-default") );
517 if (!sDefault.isEmpty())
519 double d = sDefault.toDouble();
520 if (d != 0.0 || sDefault == "0" || sDefault == "0.0" )
522 ctx.getControlModel()->setPropertyValue( "EffectiveDefault", makeAny( d ) );
524 else // treat as string
526 ctx.getControlModel()->setPropertyValue( "EffectiveDefault", makeAny( sDefault ) );
530 // format spec
531 ctx.getControlModel()->setPropertyValue("FormatsSupplier", makeAny( _pImport->getNumberFormatsSupplier() ) );
533 OUString sFormat( _xAttributes->getValueByUidName(_pImport->XMLNS_DIALOGS_UID, "format-code" ) );
534 if (!sFormat.isEmpty())
536 lang::Locale locale;
538 OUString sLocale( _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, "format-locale" ) );
539 if (!sLocale.isEmpty())
541 // split locale
542 sal_Int32 semi0 = sLocale.indexOf( ';' );
543 if (semi0 < 0) // no semi at all, just try language
545 locale.Language = sLocale;
547 else
549 sal_Int32 semi1 = sLocale.indexOf( ';', semi0 +1 );
550 if (semi1 > semi0) // language;country;variant
552 locale.Language = sLocale.copy( 0, semi0 );
553 locale.Country = sLocale.copy( semi0 +1, semi1 - semi0 -1 );
554 locale.Variant = sLocale.copy( semi1 +1 );
556 else // try language;country
558 locale.Language = sLocale.copy( 0, semi0 );
559 locale.Country = sLocale.copy( semi0 +1 );
566 Reference< util::XNumberFormats > xFormats(
567 _pImport->getNumberFormatsSupplier()->getNumberFormats() );
568 sal_Int32 nKey = xFormats->queryKey( sFormat, locale, sal_True );
569 if (-1 == nKey)
571 nKey = xFormats->addNew( sFormat, locale );
573 ctx.getControlModel()->setPropertyValue("FormatKey", makeAny( nKey ) );
575 catch (const util::MalformedNumberFormatException & exc)
577 SAL_WARN( "xmlscript.xmldlg", "### util::MalformedNumberFormatException occurred!" );
578 // rethrow
579 throw xml::sax::SAXException( exc.Message, Reference< XInterface >(), Any() );
582 ctx.importBooleanProperty("TreatAsNumber", "treat-as-number" , _xAttributes );
583 ctx.importBooleanProperty("EnforceFormat", "enforce-format", _xAttributes );
585 ctx.importDataAwareProperty( "linked-cell" , _xAttributes );
586 ctx.importEvents( _events );
587 // avoid ring-reference:
588 // vector< event elements > holding event elements holding this (via _pParent)
589 _events.clear();
592 //##################################################################################################
594 // timefield
595 //__________________________________________________________________________________________________
596 Reference< xml::input::XElement > TimeFieldElement::startChildElement(
597 sal_Int32 nUid, OUString const & rLocalName,
598 Reference< xml::input::XAttributes > const & xAttributes )
599 throw (xml::sax::SAXException, RuntimeException)
601 // event
602 if (_pImport->isEventElement( nUid, rLocalName ))
604 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
606 else
608 throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() );
611 //__________________________________________________________________________________________________
612 void TimeFieldElement::endElement()
613 throw (xml::sax::SAXException, RuntimeException)
615 ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlTimeFieldModel" );
617 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
618 if (xStyle.is())
620 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
621 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
622 pStyle->importBackgroundColorStyle( xControlModel );
623 pStyle->importTextColorStyle( xControlModel );
624 pStyle->importTextLineColorStyle( xControlModel );
625 pStyle->importBorderStyle( xControlModel );
626 pStyle->importFontStyle( xControlModel );
629 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
630 ctx.importBooleanProperty("Tabstop", "tabstop", _xAttributes );
631 ctx.importBooleanProperty("ReadOnly", "readonly", _xAttributes );
632 ctx.importBooleanProperty( "StrictFormat", "strict-format", _xAttributes );
633 ctx.importBooleanProperty("HideInactiveSelection","hide-inactive-selection", _xAttributes );
634 ctx.importTimeFormatProperty( "TimeFormat", "time-format", _xAttributes );
635 ctx.importTimeProperty( "Time", "value", _xAttributes );
636 ctx.importTimeProperty( "TimeMin", "value-min", _xAttributes );
637 ctx.importTimeProperty( "TimeMax", "value-max", _xAttributes );
638 ctx.importBooleanProperty( "Spin", "spin", _xAttributes );
639 if (ctx.importLongProperty( "RepeatDelay", "repeat", _xAttributes ))
640 ctx.getControlModel()->setPropertyValue("Repeat", makeAny(true) );
641 ctx.importStringProperty( "Text", "text" , _xAttributes );
642 ctx.importBooleanProperty( "EnforceFormat", "enforce-format" , _xAttributes );
644 ctx.importEvents( _events );
645 // avoid ring-reference:
646 // vector< event elements > holding event elements holding this (via _pParent)
647 _events.clear();
650 //##################################################################################################
652 // numericfield
653 //__________________________________________________________________________________________________
654 Reference< xml::input::XElement > NumericFieldElement::startChildElement(
655 sal_Int32 nUid, OUString const & rLocalName,
656 Reference< xml::input::XAttributes > const & xAttributes )
657 throw (xml::sax::SAXException, RuntimeException)
659 // event
660 if (_pImport->isEventElement( nUid, rLocalName ))
662 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
664 else
666 throw xml::sax::SAXException( "expected event element!", Reference< XInterface >(), Any() );
669 //__________________________________________________________________________________________________
670 void NumericFieldElement::endElement()
671 throw (xml::sax::SAXException, RuntimeException)
673 ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlNumericFieldModel" );
675 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
676 if (xStyle.is())
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 );
687 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
688 ctx.importBooleanProperty( "Tabstop","tabstop",_xAttributes );
689 ctx.importBooleanProperty( "ReadOnly", "readonly",_xAttributes );
690 ctx.importBooleanProperty( "StrictFormat", "strict-format", _xAttributes );
691 ctx.importBooleanProperty( "HideInactiveSelection", "hide-inactive-selection", _xAttributes );
692 ctx.importShortProperty( "DecimalAccuracy", "decimal-accuracy", _xAttributes );
693 ctx.importBooleanProperty( "ShowThousandsSeparator", "thousands-separator", _xAttributes );
694 ctx.importDoubleProperty( "Value", "value", _xAttributes );
695 ctx.importDoubleProperty( "ValueMin", "value-min", _xAttributes );
696 ctx.importDoubleProperty( "ValueMax", "value-max", _xAttributes );
697 ctx.importDoubleProperty( "ValueStep", "value-step", _xAttributes );
698 ctx.importBooleanProperty( "Spin", "spin", _xAttributes );
699 if (ctx.importLongProperty( "RepeatDelay", "repeat", _xAttributes ))
700 ctx.getControlModel()->setPropertyValue("Repeat", makeAny(true) );
701 ctx.importBooleanProperty( "EnforceFormat", "enforce-format", _xAttributes );
702 ctx.importEvents( _events );
703 // avoid ring-reference:
704 // vector< event elements > holding event elements holding this (via _pParent)
705 _events.clear();
708 //##################################################################################################
710 // datefield
711 //__________________________________________________________________________________________________
712 Reference< xml::input::XElement > DateFieldElement::startChildElement(
713 sal_Int32 nUid, OUString const & rLocalName,
714 Reference< xml::input::XAttributes > const & xAttributes )
715 throw (xml::sax::SAXException, RuntimeException)
717 // event
718 if (_pImport->isEventElement( nUid, rLocalName ))
720 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
722 else
724 throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() );
727 //__________________________________________________________________________________________________
728 void DateFieldElement::endElement()
729 throw (xml::sax::SAXException, RuntimeException)
731 ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlDateFieldModel" );
733 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
734 if (xStyle.is())
736 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
737 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
738 pStyle->importBackgroundColorStyle( xControlModel );
739 pStyle->importTextColorStyle( xControlModel );
740 pStyle->importTextLineColorStyle( xControlModel );
741 pStyle->importBorderStyle( xControlModel );
742 pStyle->importFontStyle( xControlModel );
745 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
746 ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
747 ctx.importBooleanProperty( "ReadOnly", "readonly", _xAttributes );
748 ctx.importBooleanProperty( "StrictFormat", "strict-format", _xAttributes );
749 ctx.importBooleanProperty( "HideInactiveSelection", "hide-inactive-selection", _xAttributes );
750 ctx.importDateFormatProperty( "DateFormat", "date-format", _xAttributes );
751 ctx.importBooleanProperty( "DateShowCentury", "show-century", _xAttributes );
752 ctx.importDateProperty( "Date", "value", _xAttributes );
753 ctx.importDateProperty( "DateMin", "value-min", _xAttributes );
754 ctx.importDateProperty( "DateMax", "value-max", _xAttributes );
755 ctx.importBooleanProperty( "Spin", "spin", _xAttributes );
756 if (ctx.importLongProperty( "RepeatDelay", "repeat", _xAttributes ))
757 ctx.getControlModel()->setPropertyValue( "Repeat", makeAny(true) );
758 ctx.importBooleanProperty( "Dropdown", "dropdown", _xAttributes );
759 ctx.importStringProperty( "Text", "text", _xAttributes );
760 ctx.importBooleanProperty( "EnforceFormat", "enforce-format", _xAttributes );
761 ctx.importEvents( _events );
762 // avoid ring-reference:
763 // vector< event elements > holding event elements holding this (via _pParent)
764 _events.clear();
767 //##################################################################################################
769 // currencyfield
770 //__________________________________________________________________________________________________
771 Reference< xml::input::XElement > CurrencyFieldElement::startChildElement(
772 sal_Int32 nUid, OUString const & rLocalName,
773 Reference< xml::input::XAttributes > const & xAttributes )
774 throw (xml::sax::SAXException, RuntimeException)
776 // event
777 if (_pImport->isEventElement( nUid, rLocalName ))
779 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
781 else
783 throw xml::sax::SAXException( "expected event element!" , Reference< XInterface >(), Any() );
786 //__________________________________________________________________________________________________
787 void CurrencyFieldElement::endElement()
788 throw (xml::sax::SAXException, RuntimeException)
790 ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlCurrencyFieldModel" );
792 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
793 if (xStyle.is())
795 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
796 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
797 pStyle->importBackgroundColorStyle( xControlModel );
798 pStyle->importTextColorStyle( xControlModel );
799 pStyle->importTextLineColorStyle( xControlModel );
800 pStyle->importBorderStyle( xControlModel );
801 pStyle->importFontStyle( xControlModel );
804 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
805 ctx.importBooleanProperty("Tabstop", "tabstop", _xAttributes );
806 ctx.importBooleanProperty( "ReadOnly", "readonly" , _xAttributes );
807 ctx.importBooleanProperty( "StrictFormat", "strict-format", _xAttributes );
808 ctx.importBooleanProperty( "HideInactiveSelection", "hide-inactive-selection", _xAttributes );
809 ctx.importStringProperty( "CurrencySymbol", "currency-symbol", _xAttributes );
810 ctx.importShortProperty( "DecimalAccuracy", "decimal-accuracy", _xAttributes );
811 ctx.importBooleanProperty( "ShowThousandsSeparator", "thousands-separator", _xAttributes );
812 ctx.importDoubleProperty( "Value", "value", _xAttributes );
813 ctx.importDoubleProperty( "ValueMin", "value-min", _xAttributes );
814 ctx.importDoubleProperty( "ValueMax", "value-max", _xAttributes );
815 ctx.importDoubleProperty( "ValueStep", "value-step", _xAttributes );
816 ctx.importBooleanProperty( "Spin", "spin", _xAttributes );
817 if (ctx.importLongProperty( "RepeatDelay", "repeat", _xAttributes ))
818 ctx.getControlModel()->setPropertyValue( "Repeat", makeAny(true) );
819 ctx.importBooleanProperty( "PrependCurrencySymbol", "prepend-symbol", _xAttributes );
820 ctx.importBooleanProperty( "EnforceFormat", "enforce-format", _xAttributes );
821 ctx.importEvents( _events );
822 // avoid ring-reference:
823 // vector< event elements > holding event elements holding this (via _pParent)
824 _events.clear();
827 //##################################################################################################
829 // filecontrol
830 //__________________________________________________________________________________________________
831 Reference< xml::input::XElement > FileControlElement::startChildElement(
832 sal_Int32 nUid, OUString const & rLocalName,
833 Reference< xml::input::XAttributes > const & xAttributes )
834 throw (xml::sax::SAXException, RuntimeException)
836 // event
837 if (_pImport->isEventElement( nUid, rLocalName ))
839 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
841 else
843 throw xml::sax::SAXException( "expected event element!", Reference< XInterface >(), Any() );
846 //__________________________________________________________________________________________________
847 void FileControlElement::endElement()
848 throw (xml::sax::SAXException, RuntimeException)
850 ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlFileControlModel" );
852 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
853 if (xStyle.is())
855 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
856 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
857 pStyle->importBackgroundColorStyle( xControlModel );
858 pStyle->importTextColorStyle( xControlModel );
859 pStyle->importTextLineColorStyle( xControlModel );
860 pStyle->importBorderStyle( xControlModel );
861 pStyle->importFontStyle( xControlModel );
864 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
865 ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
866 ctx.importBooleanProperty("HideInactiveSelection","hide-inactive-selection", _xAttributes );
867 ctx.importStringProperty( "Text", "value", _xAttributes );
868 ctx.importBooleanProperty( "ReadOnly", "readonly", _xAttributes );
869 ctx.importEvents( _events );
870 // avoid ring-reference:
871 // vector< event elements > holding event elements holding this (via _pParent)
872 _events.clear();
874 //##################################################################################################
876 // treecontrol
877 //__________________________________________________________________________________________________
878 Reference< xml::input::XElement > TreeControlElement::startChildElement(
879 sal_Int32 nUid, OUString const & rLocalName,
880 Reference< xml::input::XAttributes > const & xAttributes )
881 throw (xml::sax::SAXException, RuntimeException)
883 // event
884 if (_pImport->isEventElement( nUid, rLocalName ))
886 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
888 else
890 throw xml::sax::SAXException( "expected event element!", Reference< XInterface >(), Any() );
893 //__________________________________________________________________________________________________
894 void TreeControlElement::endElement()
895 throw (xml::sax::SAXException, RuntimeException)
897 ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.tree.TreeControlModel" );
899 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
900 if (xStyle.is())
902 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
903 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
904 pStyle->importBackgroundColorStyle( xControlModel );
905 pStyle->importBorderStyle( xControlModel );
908 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
909 ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
910 ctx.importSelectionTypeProperty( "SelectionType", "selectiontype", _xAttributes );
911 ctx.importBooleanProperty( "RootDisplayed", "rootdisplayed", _xAttributes );
912 ctx.importBooleanProperty( "ShowsHandles", "showshandles", _xAttributes );
913 ctx.importBooleanProperty( "ShowsRootHandles", "showsroothandles" ,_xAttributes );
914 ctx.importBooleanProperty( "Editable", "editable", _xAttributes );
915 ctx.importBooleanProperty( "RowHeight", "readonly", _xAttributes );
916 ctx.importBooleanProperty( "InvokesStopNodeEditing", "invokesstopnodeediting", _xAttributes );
918 ctx.importEvents( _events );
919 // avoid ring-reference:
920 // vector< event elements > holding event elements holding this (via _pParent)
921 _events.clear();
924 //##################################################################################################
926 // imagecontrol
927 //__________________________________________________________________________________________________
928 Reference< xml::input::XElement > ImageControlElement::startChildElement(
929 sal_Int32 nUid, OUString const & rLocalName,
930 Reference< xml::input::XAttributes > const & xAttributes )
931 throw (xml::sax::SAXException, RuntimeException)
933 // event
934 if (_pImport->isEventElement( nUid, rLocalName ))
936 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
938 else
940 throw xml::sax::SAXException( "expected event element!" , Reference< XInterface >(), Any() );
943 //__________________________________________________________________________________________________
944 void ImageControlElement::endElement()
945 throw (xml::sax::SAXException, RuntimeException)
947 ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlImageControlModel" );
949 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
950 if (xStyle.is())
952 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
953 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
954 pStyle->importBackgroundColorStyle( xControlModel );
955 pStyle->importBorderStyle( xControlModel );
958 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
959 ctx.importBooleanProperty( "ScaleImage", "scale-image", _xAttributes );
960 Reference< document::XStorageBasedDocument > xDocStorage( _pImport->getDocOwner(), UNO_QUERY );
962 ctx.importImageURLProperty( "ImageURL" , "src" , _xAttributes );
963 ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
964 ctx.importEvents( _events );
965 // avoid ring-reference:
966 // vector< event elements > holding event elements holding this (via _pParent)
967 _events.clear();
970 //##################################################################################################
972 // textfield
973 //__________________________________________________________________________________________________
974 Reference< xml::input::XElement > TextElement::startChildElement(
975 sal_Int32 nUid, OUString const & rLocalName,
976 Reference< xml::input::XAttributes > const & xAttributes )
977 throw (xml::sax::SAXException, RuntimeException)
979 // event
980 if (_pImport->isEventElement( nUid, rLocalName ))
982 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
984 else
986 throw xml::sax::SAXException( "expected event element!", Reference< XInterface >(), Any() );
989 //__________________________________________________________________________________________________
990 void TextElement::endElement()
991 throw (xml::sax::SAXException, RuntimeException)
993 ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlFixedTextModel" );
995 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
996 if (xStyle.is())
998 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
999 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1000 pStyle->importBackgroundColorStyle( xControlModel );
1001 pStyle->importTextColorStyle( xControlModel );
1002 pStyle->importTextLineColorStyle( xControlModel );
1003 pStyle->importBorderStyle( xControlModel );
1004 pStyle->importFontStyle( xControlModel );
1007 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1008 ctx.importStringProperty( "Label", "value", _xAttributes );
1009 ctx.importAlignProperty( "Align", "align", _xAttributes );
1010 ctx.importVerticalAlignProperty( "VerticalAlign", "valign", _xAttributes );
1011 ctx.importBooleanProperty( "MultiLine", "multiline" ,_xAttributes );
1012 ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
1013 ctx.importBooleanProperty( "NoLabel", "nolabel", _xAttributes );
1014 ctx.importEvents( _events );
1015 // avoid ring-reference:
1016 // vector< event elements > holding event elements holding this (via _pParent)
1017 _events.clear();
1020 //##################################################################################################
1021 // FixedHyperLink
1022 //__________________________________________________________________________________________________
1023 Reference< xml::input::XElement > FixedHyperLinkElement::startChildElement(
1024 sal_Int32 nUid, OUString const & rLocalName,
1025 Reference< xml::input::XAttributes > const & xAttributes )
1026 throw (xml::sax::SAXException, RuntimeException)
1028 // event
1029 if (_pImport->isEventElement( nUid, rLocalName ))
1031 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1033 else
1035 throw xml::sax::SAXException( "expected event element!" , Reference< XInterface >(), Any() );
1038 //__________________________________________________________________________________________________
1039 void FixedHyperLinkElement::endElement()
1040 throw (xml::sax::SAXException, RuntimeException)
1042 ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlFixedHyperlinkModel" );
1044 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1045 if (xStyle.is())
1047 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1048 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1049 pStyle->importBackgroundColorStyle( xControlModel );
1050 pStyle->importTextColorStyle( xControlModel );
1051 pStyle->importTextLineColorStyle( xControlModel );
1052 pStyle->importBorderStyle( xControlModel );
1053 pStyle->importFontStyle( xControlModel );
1056 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1057 ctx.importStringProperty( "Label", "value", _xAttributes );
1058 ctx.importStringProperty( "URL", "url", _xAttributes );
1059 ctx.importStringProperty( "Description", "description", _xAttributes );
1061 ctx.importAlignProperty( "Align", "align" ,_xAttributes );
1062 ctx.importVerticalAlignProperty( "VerticalAlign", "valign", _xAttributes );
1063 ctx.importBooleanProperty( "MultiLine", "multiline", _xAttributes );
1064 ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
1065 ctx.importBooleanProperty( "NoLabel", "nolabel", _xAttributes );
1066 ctx.importEvents( _events );
1067 // avoid ring-reference:
1068 // vector< event elements > holding event elements holding this (via _pParent)
1069 _events.clear();
1072 //##################################################################################################
1074 // edit
1075 //__________________________________________________________________________________________________
1076 Reference< xml::input::XElement > TextFieldElement::startChildElement(
1077 sal_Int32 nUid, OUString const & rLocalName,
1078 Reference< xml::input::XAttributes > const & xAttributes )
1079 throw (xml::sax::SAXException, RuntimeException)
1081 // event
1082 if (_pImport->isEventElement( nUid, rLocalName ))
1084 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1086 else
1088 throw xml::sax::SAXException( "expected event element!", Reference< XInterface >(), Any() );
1091 //__________________________________________________________________________________________________
1092 void TextFieldElement::endElement()
1093 throw (xml::sax::SAXException, RuntimeException)
1095 ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlEditModel" );
1096 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1098 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1099 if (xStyle.is())
1101 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1102 pStyle->importBackgroundColorStyle( xControlModel );
1103 pStyle->importTextColorStyle( xControlModel );
1104 pStyle->importTextLineColorStyle( xControlModel );
1105 pStyle->importBorderStyle( xControlModel );
1106 pStyle->importFontStyle( xControlModel );
1109 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1110 ctx.importBooleanProperty("Tabstop", "tabstop", _xAttributes );
1111 ctx.importAlignProperty( "Align", "align", _xAttributes );
1112 ctx.importBooleanProperty( "HardLineBreaks", "hard-linebreaks", _xAttributes );
1113 ctx.importBooleanProperty( "HScroll", "hscroll" ,_xAttributes );
1114 ctx.importBooleanProperty( "VScroll", "vscroll", _xAttributes );
1115 ctx.importBooleanProperty("HideInactiveSelection", "hide-inactive-selection", _xAttributes );
1116 ctx.importShortProperty( "MaxTextLen", "maxlength", _xAttributes );
1117 ctx.importBooleanProperty( "MultiLine", "multiline", _xAttributes );
1118 ctx.importBooleanProperty( "ReadOnly", "readonly", _xAttributes );
1119 ctx.importStringProperty( "Text", "value", _xAttributes );
1120 ctx.importLineEndFormatProperty( "LineEndFormat", "lineend-format", _xAttributes );
1121 OUString aValue;
1122 if (getStringAttr( &aValue, "echochar", _xAttributes, _pImport->XMLNS_DIALOGS_UID ) && !aValue.isEmpty() )
1124 SAL_WARN_IF( aValue.getLength() != 1, "xmlscript.xmldlg", "### more than one character given for echochar!" );
1125 sal_Int16 nChar = (sal_Int16)aValue[ 0 ];
1126 xControlModel->setPropertyValue( "EchoChar", makeAny( nChar ) );
1129 ctx.importEvents( _events );
1130 // avoid ring-reference:
1131 // vector< event elements > holding event elements holding this (via _pParent)
1132 _events.clear();
1135 //##################################################################################################
1137 // titledbox
1138 //__________________________________________________________________________________________________
1139 Reference< xml::input::XElement > TitledBoxElement::startChildElement(
1140 sal_Int32 nUid, OUString const & rLocalName,
1141 Reference< xml::input::XAttributes > const & xAttributes )
1142 throw (xml::sax::SAXException, RuntimeException)
1144 // event
1145 if (_pImport->isEventElement( nUid, rLocalName ))
1147 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1149 else if (_pImport->XMLNS_DIALOGS_UID != nUid)
1151 throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() );
1153 // title
1154 else if ( rLocalName == "title" )
1156 getStringAttr( &_label, "value", xAttributes, _pImport->XMLNS_DIALOGS_UID );
1158 return new ElementBase( _pImport->XMLNS_DIALOGS_UID, rLocalName, xAttributes, this, _pImport );
1160 // radio
1161 else if ( rLocalName == "radio" )
1163 // dont create radios here, => titledbox must be inserted first due to radio grouping,
1164 // possible predecessors!
1165 Reference< xml::input::XElement > xRet(
1166 new RadioElement( rLocalName, xAttributes, this, _pImport ) );
1167 _radios.push_back( xRet );
1168 return xRet;
1170 // event
1171 else if (_pImport->isEventElement( nUid, rLocalName ))
1173 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1175 else
1177 return BulletinBoardElement::startChildElement( nUid, rLocalName, xAttributes );
1180 //__________________________________________________________________________________________________
1181 void TitledBoxElement::endElement()
1182 throw (xml::sax::SAXException, RuntimeException)
1185 ControlImportContext ctx(_pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlGroupBoxModel" );
1186 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1188 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1189 if (xStyle.is())
1191 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1192 pStyle->importTextColorStyle( xControlModel );
1193 pStyle->importTextLineColorStyle( xControlModel );
1194 pStyle->importFontStyle( xControlModel );
1197 ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
1199 if (!_label.isEmpty())
1201 xControlModel->setPropertyValue( "Label", makeAny( _label ) );
1204 ctx.importEvents( _events );
1205 // avoid ring-reference:
1206 // vector< event elements > holding event elements holding this (via _pParent)
1207 _events.clear();
1210 // create radios AFTER group box!
1211 for ( size_t nPos = 0; nPos < _radios.size(); ++nPos )
1213 Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
1214 Reference< xml::input::XAttributes > xAttributes( xRadio->getAttributes() );
1216 ControlImportContext ctx( _pImport, getControlId( xAttributes ), getControlModelName( "com.sun.star.awt.UnoControlRadioButtonModel", xAttributes ) );
1217 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1219 Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
1220 if (xStyle.is())
1222 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1223 pStyle->importBackgroundColorStyle( xControlModel );
1224 pStyle->importTextColorStyle( xControlModel );
1225 pStyle->importTextLineColorStyle( xControlModel );
1226 pStyle->importFontStyle( xControlModel );
1227 pStyle->importVisualEffectStyle( xControlModel );
1230 ctx.importDefaults( _nBasePosX, _nBasePosY, xAttributes );
1231 ctx.importBooleanProperty( "Tabstop", "tabstop", xAttributes );
1232 ctx.importStringProperty( "Label", "value", xAttributes );
1233 ctx.importAlignProperty( "Align", "align", xAttributes );
1234 ctx.importVerticalAlignProperty( "VerticalAlign", "valign", xAttributes );
1235 ctx.importImageURLProperty( "ImageURL" , "image-src" , _xAttributes );
1236 ctx.importImagePositionProperty( "ImagePosition", "image-position", xAttributes );
1237 ctx.importBooleanProperty( "MultiLine", "multiline", xAttributes );
1238 ctx.importStringProperty( "GroupName", "group-name", xAttributes );
1240 sal_Int16 nVal = 0;
1241 sal_Bool bChecked = sal_False;
1242 if (getBoolAttr( &bChecked, "checked", xAttributes, _pImport->XMLNS_DIALOGS_UID ) && bChecked)
1244 nVal = 1;
1246 xControlModel->setPropertyValue( "State", makeAny( nVal ) );
1247 ctx.importDataAwareProperty( "linked-cell" , xAttributes );
1248 ::std::vector< Reference< xml::input::XElement > > * radioEvents =
1249 static_cast< RadioElement * >( xRadio.get() )->getEvents();
1250 ctx.importEvents( *radioEvents );
1251 // avoid ring-reference:
1252 // vector< event elements > holding event elements holding this (via _pParent)
1253 radioEvents->clear();
1255 // avoid ring-reference:
1256 // vector< radio elements > holding radio elements holding this (via _pParent)
1257 _radios.clear();
1260 //##################################################################################################
1262 // radio
1263 //__________________________________________________________________________________________________
1264 Reference< xml::input::XElement > RadioElement::startChildElement(
1265 sal_Int32 nUid, OUString const & rLocalName,
1266 Reference< xml::input::XAttributes > const & xAttributes )
1267 throw (xml::sax::SAXException, RuntimeException)
1269 // event
1270 if (_pImport->isEventElement( nUid, rLocalName ))
1272 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1274 else
1276 throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() );
1280 //##################################################################################################
1282 // radiogroup
1283 //__________________________________________________________________________________________________
1284 Reference< xml::input::XElement > RadioGroupElement::startChildElement(
1285 sal_Int32 nUid, OUString const & rLocalName,
1286 Reference< xml::input::XAttributes > const & xAttributes )
1287 throw (xml::sax::SAXException, RuntimeException)
1289 if (_pImport->XMLNS_DIALOGS_UID != nUid)
1291 throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() );
1293 // radio
1294 else if ( rLocalName == "radio" )
1296 // dont create radios here, => titledbox must be inserted first due to radio grouping,
1297 // possible predecessors!
1298 Reference< xml::input::XElement > xRet(
1299 new RadioElement( rLocalName, xAttributes, this, _pImport ) );
1300 _radios.push_back( xRet );
1301 return xRet;
1303 else
1305 throw xml::sax::SAXException( "expected radio element!", Reference< XInterface >(), Any() );
1308 //__________________________________________________________________________________________________
1309 void RadioGroupElement::endElement()
1310 throw (xml::sax::SAXException, RuntimeException)
1312 for ( size_t nPos = 0; nPos < _radios.size(); ++nPos )
1314 Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
1315 Reference< xml::input::XAttributes > xAttributes(
1316 xRadio->getAttributes() );
1318 ControlImportContext ctx( _pImport, getControlId( xAttributes ), getControlModelName( "com.sun.star.awt.UnoControlRadioButtonModel", xAttributes ) );
1319 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1321 Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
1322 if (xStyle.is())
1324 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1325 pStyle->importBackgroundColorStyle( xControlModel );
1326 pStyle->importTextColorStyle( xControlModel );
1327 pStyle->importTextLineColorStyle( xControlModel );
1328 pStyle->importFontStyle( xControlModel );
1329 pStyle->importVisualEffectStyle( xControlModel );
1332 ctx.importDefaults( _nBasePosX, _nBasePosY, xAttributes );
1333 ctx.importBooleanProperty("Tabstop", "tabstop", xAttributes );
1334 ctx.importStringProperty( "Label", "value", xAttributes );
1335 ctx.importAlignProperty( "Align", "align", xAttributes );
1336 ctx.importVerticalAlignProperty( "VerticalAlign", "valign", xAttributes );
1337 ctx.importImageURLProperty( "ImageURL" , "image-src" , xAttributes );
1338 ctx.importImagePositionProperty( "ImagePosition", "image-position", xAttributes );
1339 ctx.importBooleanProperty( "MultiLine", "multiline", xAttributes );
1340 ctx.importStringProperty( "GroupName", "group-name", xAttributes );
1341 sal_Int16 nVal = 0;
1342 sal_Bool bChecked = sal_False;
1343 if (getBoolAttr( &bChecked, "checked", xAttributes, _pImport->XMLNS_DIALOGS_UID ) && bChecked)
1345 nVal = 1;
1347 xControlModel->setPropertyValue( "State", makeAny( nVal ) );
1349 ctx.importDataAwareProperty( "linked-cell", xAttributes );
1351 ::std::vector< Reference< xml::input::XElement > > * radioEvents =
1352 static_cast< RadioElement * >( xRadio.get() )->getEvents();
1353 ctx.importEvents( *radioEvents );
1354 // avoid ring-reference:
1355 // vector< event elements > holding event elements holding this (via _pParent)
1356 radioEvents->clear();
1358 // avoid ring-reference:
1359 // vector< radio elements > holding radio elements holding this (via _pParent)
1360 _radios.clear();
1363 //##################################################################################################
1365 // menupopup
1366 //__________________________________________________________________________________________________
1367 Reference< xml::input::XElement > MenuPopupElement::startChildElement(
1368 sal_Int32 nUid, OUString const & rLocalName,
1369 Reference< xml::input::XAttributes > const & xAttributes )
1370 throw (xml::sax::SAXException, RuntimeException)
1372 if (_pImport->XMLNS_DIALOGS_UID != nUid)
1374 throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() );
1376 // menuitem
1377 else if ( rLocalName == "menuitem" )
1379 OUString aValue( xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID,"value" ) );
1380 SAL_WARN_IF( aValue.isEmpty(), "xmlscript.xmldlg", "### menuitem has no value?" );
1381 if (!aValue.isEmpty())
1383 _itemValues.push_back( aValue );
1385 OUString aSel( xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, "selected" ) );
1386 if (!aSel.isEmpty() && aSel == "true")
1388 _itemSelected.push_back( static_cast<sal_Int16>(_itemValues.size()) -1 );
1391 return new ElementBase( _pImport->XMLNS_DIALOGS_UID, rLocalName, xAttributes, this, _pImport );
1393 else
1395 throw xml::sax::SAXException("expected menuitem!" , Reference< XInterface >(), Any() );
1398 //__________________________________________________________________________________________________
1399 Sequence< OUString > MenuPopupElement::getItemValues()
1401 Sequence< OUString > aRet( _itemValues.size() );
1402 OUString * pRet = aRet.getArray();
1403 for ( size_t nPos = _itemValues.size(); nPos--; )
1405 pRet[ nPos ] = _itemValues[ nPos ];
1407 return aRet;
1409 //__________________________________________________________________________________________________
1410 Sequence< sal_Int16 > MenuPopupElement::getSelectedItems()
1412 Sequence< sal_Int16 > aRet( _itemSelected.size() );
1413 sal_Int16 * pRet = aRet.getArray();
1414 for ( size_t nPos = _itemSelected.size(); nPos--; )
1416 pRet[ nPos ] = _itemSelected[ nPos ];
1418 return aRet;
1421 //##################################################################################################
1423 // menulist
1424 //__________________________________________________________________________________________________
1425 Reference< xml::input::XElement > MenuListElement::startChildElement(
1426 sal_Int32 nUid, OUString const & rLocalName,
1427 Reference< xml::input::XAttributes > const & xAttributes )
1428 throw (xml::sax::SAXException, RuntimeException)
1430 // event
1431 if (_pImport->isEventElement( nUid, rLocalName ))
1433 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1435 else if (_pImport->XMLNS_DIALOGS_UID != nUid)
1437 throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() );
1439 // menupopup
1440 else if ( rLocalName == "menupopup" )
1442 _popup = new MenuPopupElement( rLocalName, xAttributes, this, _pImport );
1443 return _popup;
1445 else
1447 throw xml::sax::SAXException( "expected event or menupopup element!", Reference< XInterface >(), Any() );
1450 //__________________________________________________________________________________________________
1451 void MenuListElement::endElement()
1452 throw (xml::sax::SAXException, RuntimeException)
1454 ControlImportContext ctx( _pImport, getControlId( _xAttributes ), getControlModelName( "com.sun.star.awt.UnoControlListBoxModel", _xAttributes ) );
1455 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1457 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1458 if (xStyle.is())
1460 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1461 pStyle->importBackgroundColorStyle( xControlModel );
1462 pStyle->importTextColorStyle( xControlModel );
1463 pStyle->importTextLineColorStyle( xControlModel );
1464 pStyle->importBorderStyle( xControlModel );
1465 pStyle->importFontStyle( xControlModel );
1468 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1469 ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
1470 ctx.importBooleanProperty( "MultiSelection", "multiselection", _xAttributes );
1471 ctx.importBooleanProperty( "ReadOnly", "readonly", _xAttributes );
1472 ctx.importBooleanProperty( "Dropdown", "spin", _xAttributes );
1473 ctx.importShortProperty( "LineCount", "linecount", _xAttributes );
1474 ctx.importAlignProperty( "Align", "align", _xAttributes );
1475 bool bHasLinkedCell = ctx.importDataAwareProperty( "linked-cell" , _xAttributes );
1476 bool bHasSrcRange = ctx.importDataAwareProperty( "source-cell-range" , _xAttributes );
1477 if (_popup.is())
1479 MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
1480 if ( !bHasSrcRange )
1481 xControlModel->setPropertyValue( "StringItemList", makeAny( p->getItemValues() ) );
1482 if ( !bHasLinkedCell )
1483 xControlModel->setPropertyValue( "SelectedItems", makeAny( p->getSelectedItems() ) );
1486 ctx.importEvents( _events );
1487 // avoid ring-reference:
1488 // vector< event elements > holding event elements holding this (via _pParent)
1489 _events.clear();
1492 //##################################################################################################
1494 // combobox
1495 //__________________________________________________________________________________________________
1496 Reference< xml::input::XElement > ComboBoxElement::startChildElement(
1497 sal_Int32 nUid, OUString const & rLocalName,
1498 Reference< xml::input::XAttributes > const & xAttributes )
1499 throw (xml::sax::SAXException, RuntimeException)
1501 // event
1502 if (_pImport->isEventElement( nUid, rLocalName ))
1504 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1506 else if (_pImport->XMLNS_DIALOGS_UID != nUid)
1508 throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() );
1510 // menupopup
1511 else if ( rLocalName == "menupopup" )
1513 _popup = new MenuPopupElement( rLocalName, xAttributes, this, _pImport );
1514 return _popup;
1516 else
1518 throw xml::sax::SAXException( "expected event or menupopup element!", Reference< XInterface >(), Any() );
1521 //__________________________________________________________________________________________________
1522 void ComboBoxElement::endElement()
1523 throw (xml::sax::SAXException, RuntimeException)
1525 ControlImportContext ctx( _pImport, getControlId( _xAttributes ), getControlModelName( "com.sun.star.awt.UnoControlComboBoxModel", _xAttributes ) );
1526 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1528 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1529 if (xStyle.is())
1531 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1532 pStyle->importBackgroundColorStyle( xControlModel );
1533 pStyle->importTextColorStyle( xControlModel );
1534 pStyle->importTextLineColorStyle( xControlModel );
1535 pStyle->importBorderStyle( xControlModel );
1536 pStyle->importFontStyle( xControlModel );
1539 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1540 ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
1541 ctx.importBooleanProperty( "ReadOnly", "readonly", _xAttributes );
1542 ctx.importBooleanProperty( "Autocomplete", "autocomplete", _xAttributes );
1543 ctx.importBooleanProperty( "Dropdown", "spin", _xAttributes );
1544 ctx.importBooleanProperty( "HideInactiveSelection", "hide-inactive-selection", _xAttributes );
1545 ctx.importShortProperty( "MaxTextLen", "maxlength" ,_xAttributes );
1546 ctx.importShortProperty( "LineCount", "linecount" ,_xAttributes );
1547 ctx.importStringProperty( "Text", "value", _xAttributes );
1548 ctx.importAlignProperty( "Align", "align", _xAttributes );
1549 ctx.importDataAwareProperty( "linked-cell" , _xAttributes );
1550 bool bHasSrcRange = ctx.importDataAwareProperty( "source-cell-range" , _xAttributes );
1551 if (_popup.is() && !bHasSrcRange )
1553 MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
1554 xControlModel->setPropertyValue( "StringItemList", makeAny( p->getItemValues() ) );
1557 ctx.importEvents( _events );
1558 // avoid ring-reference:
1559 // vector< event elements > holding event elements holding this (via _pParent)
1560 _events.clear();
1563 //##################################################################################################
1565 // checkbox
1566 //__________________________________________________________________________________________________
1567 Reference< xml::input::XElement > CheckBoxElement::startChildElement(
1568 sal_Int32 nUid, OUString const & rLocalName,
1569 Reference< xml::input::XAttributes > const & xAttributes )
1570 throw (xml::sax::SAXException, RuntimeException)
1572 // event
1573 if (_pImport->isEventElement( nUid, rLocalName ))
1575 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1577 else
1579 throw xml::sax::SAXException( "expected event element!", Reference< XInterface >(), Any() );
1582 //__________________________________________________________________________________________________
1583 void CheckBoxElement::endElement()
1584 throw (xml::sax::SAXException, RuntimeException)
1586 ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlCheckBoxModel" );
1587 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1589 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1590 if (xStyle.is())
1592 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1593 pStyle->importBackgroundColorStyle( xControlModel );
1594 pStyle->importTextColorStyle( xControlModel );
1595 pStyle->importTextLineColorStyle( xControlModel );
1596 pStyle->importFontStyle( xControlModel );
1597 pStyle->importVisualEffectStyle( xControlModel );
1600 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1601 ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
1602 ctx.importStringProperty( "Label", "value", _xAttributes );
1603 ctx.importAlignProperty( "Align", "align", _xAttributes );
1604 ctx.importVerticalAlignProperty( "VerticalAlign", "valign", _xAttributes );
1605 ctx.importImageURLProperty( "ImageURL" , "image-src" , _xAttributes );
1606 ctx.importImagePositionProperty( "ImagePosition", "image-position", _xAttributes );
1607 ctx.importBooleanProperty( "MultiLine", "multiline", _xAttributes );
1610 sal_Bool bTriState = sal_False;
1611 if (getBoolAttr( &bTriState, "tristate", _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
1613 xControlModel->setPropertyValue( "TriState", makeAny( bTriState ) );
1615 sal_Bool bChecked = sal_False;
1616 if (getBoolAttr( &bChecked, "checked", _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
1618 // has "checked" attribute
1619 sal_Int16 nVal = (bChecked ? 1 : 0);
1620 xControlModel->setPropertyValue( "State", makeAny( nVal ) );
1622 else
1624 sal_Int16 nVal = (bTriState ? 2 : 0); // if tristate set, but checked omitted => dont know!
1625 xControlModel->setPropertyValue( "State", makeAny( nVal ) );
1628 ctx.importEvents( _events );
1629 // avoid ring-reference:
1630 // vector< event elements > holding event elements holding this (via _pParent)
1631 _events.clear();
1634 //##################################################################################################
1636 // button
1637 //__________________________________________________________________________________________________
1638 Reference< xml::input::XElement > ButtonElement::startChildElement(
1639 sal_Int32 nUid, OUString const & rLocalName,
1640 Reference< xml::input::XAttributes > const & xAttributes )
1641 throw (xml::sax::SAXException, RuntimeException)
1643 // event
1644 if (_pImport->isEventElement( nUid, rLocalName ))
1646 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1648 else
1650 throw xml::sax::SAXException( "expected event element!", Reference< XInterface >(), Any() );
1653 //__________________________________________________________________________________________________
1654 void ButtonElement::endElement()
1655 throw (xml::sax::SAXException, RuntimeException)
1657 ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlButtonModel" );
1659 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1660 if (xStyle.is())
1662 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1663 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1664 pStyle->importBackgroundColorStyle( xControlModel );
1665 pStyle->importTextColorStyle( xControlModel );
1666 pStyle->importTextLineColorStyle( xControlModel );
1667 pStyle->importFontStyle( xControlModel );
1670 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1671 ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
1672 ctx.importStringProperty( "Label", "value", _xAttributes );
1673 ctx.importAlignProperty( "Align", "align", _xAttributes );
1674 ctx.importVerticalAlignProperty( "VerticalAlign", "valign", _xAttributes );
1675 ctx.importBooleanProperty( "DefaultButton", "default", _xAttributes );
1676 ctx.importButtonTypeProperty( "PushButtonType", "button-type", _xAttributes );
1677 ctx.importImageURLProperty( "ImageURL" , "image-src" , _xAttributes );
1678 ctx.importImagePositionProperty( "ImagePosition", "image-position", _xAttributes );
1679 ctx.importImageAlignProperty( "ImageAlign", "image-align", _xAttributes );
1680 if (ctx.importLongProperty( "RepeatDelay", "repeat", _xAttributes ))
1681 ctx.getControlModel()->setPropertyValue( "Repeat", makeAny(true) );
1682 sal_Int32 toggled = 0;
1683 if (getLongAttr( &toggled, "toggled", _xAttributes, _pImport->XMLNS_DIALOGS_UID ) && toggled == 1)
1684 ctx.getControlModel()->setPropertyValue( "Toggle" , makeAny(true));
1685 ctx.importBooleanProperty( "FocusOnClick", "grab-focus", _xAttributes );
1686 ctx.importBooleanProperty( "MultiLine", "multiline", _xAttributes );
1687 // State
1688 sal_Bool bChecked = sal_False;
1689 if (getBoolAttr( &bChecked, "checked", _xAttributes, _pImport->XMLNS_DIALOGS_UID ) && bChecked)
1691 sal_Int16 nVal = 1;
1692 ctx.getControlModel()->setPropertyValue( "State" , makeAny( nVal ) );
1695 ctx.importEvents( _events );
1696 // avoid ring-reference:
1697 // vector< event elements > holding event elements holding this (via _pParent)
1698 _events.clear();
1701 //##################################################################################################
1703 // bulletinboard
1704 //__________________________________________________________________________________________________
1705 Reference< xml::input::XElement > BulletinBoardElement::startChildElement(
1706 sal_Int32 nUid, OUString const & rLocalName,
1707 Reference< xml::input::XAttributes > const & xAttributes )
1708 throw (xml::sax::SAXException, RuntimeException)
1710 if (_pImport->XMLNS_DIALOGS_UID != nUid)
1712 throw xml::sax::SAXException("illegal namespace!", Reference< XInterface >(), Any() );
1714 // button
1715 else if ( rLocalName == "button" )
1717 return new ButtonElement( rLocalName, xAttributes, this, _pImport );
1719 // checkbox
1720 else if ( rLocalName == "checkbox" )
1722 return new CheckBoxElement( rLocalName, xAttributes, this, _pImport );
1724 // combobox
1725 else if ( rLocalName == "combobox" )
1727 return new ComboBoxElement( rLocalName, xAttributes, this, _pImport );
1729 // listbox
1730 else if ( rLocalName == "menulist" )
1732 return new MenuListElement( rLocalName, xAttributes, this, _pImport );
1734 // radiogroup
1735 else if ( rLocalName == "radiogroup" )
1737 return new RadioGroupElement( rLocalName, xAttributes, this, _pImport );
1739 // titledbox
1740 else if ( rLocalName == "titledbox" )
1742 return new TitledBoxElement( rLocalName, xAttributes, this, _pImport );
1744 // text
1745 else if ( rLocalName == "text" )
1747 return new TextElement( rLocalName, xAttributes, this, _pImport );
1749 else if ( rLocalName == "linklabel" )
1751 return new FixedHyperLinkElement( rLocalName, xAttributes, this, _pImport );
1753 // textfield
1754 else if ( rLocalName == "textfield" )
1756 return new TextFieldElement( rLocalName, xAttributes, this, _pImport );
1758 // img
1759 else if ( rLocalName == "img" )
1761 return new ImageControlElement( rLocalName, xAttributes, this, _pImport );
1763 // filecontrol
1764 else if ( rLocalName == "filecontrol" )
1766 return new FileControlElement( rLocalName, xAttributes, this, _pImport );
1768 // treecontrol
1769 else if ( rLocalName == "treecontrol" )
1771 return new TreeControlElement( rLocalName, xAttributes, this, _pImport );
1773 // currencyfield
1774 else if ( rLocalName == "currencyfield" )
1776 return new CurrencyFieldElement( rLocalName, xAttributes, this, _pImport );
1778 // datefield
1779 else if ( rLocalName == "datefield" )
1781 return new DateFieldElement( rLocalName, xAttributes, this, _pImport );
1783 // datefield
1784 else if ( rLocalName == "numericfield" )
1786 return new NumericFieldElement( rLocalName, xAttributes, this, _pImport );
1788 // timefield
1789 else if ( rLocalName == "timefield" )
1791 return new TimeFieldElement( rLocalName, xAttributes, this, _pImport );
1793 // patternfield
1794 else if ( rLocalName == "patternfield" )
1796 return new PatternFieldElement( rLocalName, xAttributes, this, _pImport );
1798 // formattedfield
1799 else if ( rLocalName == "formattedfield" )
1801 return new FormattedFieldElement( rLocalName, xAttributes, this, _pImport );
1803 // fixedline
1804 else if ( rLocalName == "fixedline" )
1806 return new FixedLineElement( rLocalName, xAttributes, this, _pImport );
1808 // scrollbar
1809 else if ( rLocalName == "scrollbar" )
1811 return new ScrollBarElement( rLocalName, xAttributes, this, _pImport );
1813 // spinbutton
1814 else if ( rLocalName == "spinbutton" )
1816 return new SpinButtonElement( rLocalName, xAttributes, this, _pImport );
1818 // progressmeter
1819 else if ( rLocalName == "progressmeter" )
1821 return new ProgressBarElement( rLocalName, xAttributes, this, _pImport );
1823 else if ( rLocalName == "multipage" )
1825 return new MultiPage( rLocalName, xAttributes, this, _pImport );
1827 else if ( rLocalName == "frame" )
1829 return new Frame( rLocalName, xAttributes, this, _pImport );
1831 else if ( rLocalName == "page" )
1833 return new Page( rLocalName, xAttributes, this, _pImport );
1835 // bulletinboard
1836 else if ( rLocalName == "bulletinboard" )
1838 return new BulletinBoardElement( rLocalName, xAttributes, this, _pImport );
1840 else
1842 throw xml::sax::SAXException( "expected styles, bulletinboard or bulletinboard element, not: " + rLocalName, Reference< XInterface >(), Any() );
1845 //__________________________________________________________________________________________________
1846 BulletinBoardElement::BulletinBoardElement(
1847 OUString const & rLocalName,
1848 Reference< xml::input::XAttributes > const & xAttributes,
1849 ElementBase * pParent, DialogImport * pImport )
1850 SAL_THROW(())
1851 : ControlElement( rLocalName, xAttributes, pParent, pImport )
1853 OUString aValue( _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, "left" ) );
1854 if (!aValue.isEmpty())
1856 _nBasePosX += toInt32( aValue );
1858 aValue = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, "top" );
1859 if (!aValue.isEmpty())
1861 _nBasePosY += toInt32( aValue );
1865 //##################################################################################################
1867 // style
1868 //__________________________________________________________________________________________________
1869 Reference< xml::input::XElement > StyleElement::startChildElement(
1870 sal_Int32 /*nUid*/, OUString const & /*rLocalName*/,
1871 Reference< xml::input::XAttributes > const & /*xAttributes*/ )
1872 throw (xml::sax::SAXException, RuntimeException)
1874 throw xml::sax::SAXException( "unexpected sub elements of style!", Reference< XInterface >(), Any() );
1876 //__________________________________________________________________________________________________
1877 void StyleElement::endElement()
1878 throw (xml::sax::SAXException, RuntimeException)
1880 Reference< xml::input::XAttributes > xStyle;
1881 OUString aStyleId( _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, "style-id" ) );
1882 if (!aStyleId.isEmpty())
1884 _pImport->addStyle( aStyleId, this );
1886 else
1888 throw xml::sax::SAXException( "missing style-id attribute!", Reference< XInterface >(), Any() );
1892 //##################################################################################################
1894 // styles
1895 //__________________________________________________________________________________________________
1896 Reference< xml::input::XElement > StylesElement::startChildElement(
1897 sal_Int32 nUid, OUString const & rLocalName,
1898 Reference< xml::input::XAttributes > const & xAttributes )
1899 throw (xml::sax::SAXException, RuntimeException)
1901 if (_pImport->XMLNS_DIALOGS_UID != nUid)
1903 throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() );
1905 // style
1906 else if ( rLocalName == "style" )
1908 return new StyleElement( rLocalName, xAttributes, this, _pImport );
1910 else
1912 throw xml::sax::SAXException( "expected style element!", Reference< XInterface >(), Any() );
1916 //##################################################################################################
1918 // window
1919 //__________________________________________________________________________________________________
1920 Reference< xml::input::XElement > WindowElement::startChildElement(
1921 sal_Int32 nUid, OUString const & rLocalName,
1922 Reference< xml::input::XAttributes > const & xAttributes )
1923 throw (xml::sax::SAXException, RuntimeException)
1925 // event
1926 if (_pImport->isEventElement( nUid, rLocalName ))
1928 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1930 else if (_pImport->XMLNS_DIALOGS_UID != nUid)
1932 throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() );
1934 // styles
1935 else if ( rLocalName == "styles" )
1937 return new StylesElement( rLocalName, xAttributes, this, _pImport );
1939 // bulletinboard
1940 else if ( rLocalName == "bulletinboard" )
1942 return new BulletinBoardElement( rLocalName, xAttributes, this, _pImport );
1944 else
1946 throw xml::sax::SAXException( "expected styles ot bulletinboard element!", Reference< XInterface >(), Any() );
1949 //__________________________________________________________________________________________________
1950 void WindowElement::endElement()
1951 throw (xml::sax::SAXException, RuntimeException)
1953 Reference< beans::XPropertySet > xProps(
1954 _pImport->_xDialogModel, UNO_QUERY_THROW );
1955 ImportContext ctx( _pImport, xProps, getControlId( _xAttributes ) );
1957 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1958 if (xStyle.is())
1960 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1961 pStyle->importBackgroundColorStyle( xProps );
1962 pStyle->importTextColorStyle( xProps );
1963 pStyle->importTextLineColorStyle( xProps );
1964 pStyle->importFontStyle( xProps );
1967 ctx.importDefaults( 0, 0, _xAttributes, false );
1968 ctx.importBooleanProperty( "Closeable", "closeable", _xAttributes );
1969 ctx.importBooleanProperty( "Moveable", "moveable", _xAttributes );
1970 ctx.importBooleanProperty("Sizeable", "resizeable", _xAttributes );
1971 ctx.importStringProperty("Title", "title", _xAttributes );
1972 ctx.importBooleanProperty("Decoration", "withtitlebar", _xAttributes );
1973 ctx.importImageURLProperty( "ImageURL" , "image-src" , _xAttributes );
1974 ctx.importScollableSettings( _xAttributes );
1975 ctx.importEvents( _events );
1976 // avoid ring-reference:
1977 // vector< event elements > holding event elements holding this (via _pParent)
1978 _events.clear();
1983 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */