1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "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 <osl/diagnose.h>
34 #include <sal/log.hxx>
35 #include <comphelper/processfactory.hxx>
36 #include <i18nlangtag/languagetag.hxx>
38 using namespace ::com::sun::star
;
39 using namespace ::com::sun::star::uno
;
44 Reference
< xml::input::XElement
> Frame::startChildElement(
45 sal_Int32 nUid
, OUString
const & rLocalName
,
46 Reference
< xml::input::XAttributes
> const & xAttributes
)
47 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
49 if ( !m_xContainer
.is() )
50 m_xContainer
.set( _pImport
->_xDialogModelFactory
->createInstance( "com.sun.star.awt.UnoFrameModel" ), UNO_QUERY
);
52 if (_pImport
->isEventElement( nUid
, rLocalName
))
54 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
56 else if ( rLocalName
== "bulletinboard" )
58 // Create new DialogImport for this container
59 DialogImport
* pFrameImport
= new DialogImport( *_pImport
);
60 pFrameImport
->_xDialogModel
= m_xContainer
;
61 return new BulletinBoardElement( rLocalName
, xAttributes
, this, pFrameImport
);
63 else if ( rLocalName
== "title" )
65 getStringAttr( &_label
, "value", xAttributes
, _pImport
->XMLNS_DIALOGS_UID
);
67 return new ElementBase( _pImport
->XMLNS_DIALOGS_UID
, rLocalName
, xAttributes
, this, _pImport
);
71 SAL_INFO("xmlscript.xmldlg","****** ARGGGGG!!!! **********");
72 throw xml::sax::SAXException("expected event element!", Reference
< XInterface
>(), Any() );
76 void Frame::endElement()
77 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
79 if ( !m_xContainer
.is() )
80 m_xContainer
.set( _pImport
->_xDialogModelFactory
->createInstance( "com.sun.star.awt.UnoFrameModel" ), UNO_QUERY
);
81 Reference
< beans::XPropertySet
> xProps( m_xContainer
, UNO_QUERY_THROW
);
82 // _pImport is what we need to add to ( e.g. the dialog in this case )
83 ControlImportContext
ctx( _pImport
, xProps
, getControlId( _xAttributes
) );
85 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
87 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
90 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
91 pStyle
->importTextColorStyle( xControlModel
);
92 pStyle
->importTextLineColorStyle( xControlModel
);
93 pStyle
->importFontStyle( xControlModel
);
96 ctx
.importDefaults( 0, 0, _xAttributes
); // inherited from BulletinBoardElement
97 if (!_label
.isEmpty())
99 xControlModel
->setPropertyValue( "Label" , makeAny( _label
) );
101 ctx
.importEvents( _events
);
102 // avoid ring-reference:
103 // vector< event elements > holding event elements holding this (via _pParent)
110 Reference
< xml::input::XElement
> MultiPage::startChildElement(
111 sal_Int32 nUid
, OUString
const & rLocalName
,
112 Reference
< xml::input::XAttributes
> const & xAttributes
)
113 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
116 if (_pImport
->isEventElement( nUid
, rLocalName
))
118 return new EventElement(
119 nUid
, rLocalName
, xAttributes
, this, _pImport
);
121 else if ( rLocalName
== "bulletinboard" )
123 // Create new DialogImport for this container
125 DialogImport
* pMultiPageImport
= new DialogImport( *_pImport
);
126 pMultiPageImport
->_xDialogModel
= m_xContainer
;
127 return new BulletinBoardElement( rLocalName
, xAttributes
, this, pMultiPageImport
);
132 throw xml::sax::SAXException( "expected event element!", Reference
< XInterface
>(), Any() );
136 void MultiPage::endElement()
137 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
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
) );
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)
166 Reference
< xml::input::XElement
> Page::startChildElement(
167 sal_Int32 nUid
, OUString
const & rLocalName
,
168 Reference
< xml::input::XAttributes
> const & xAttributes
)
169 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
172 if (_pImport
->isEventElement( nUid
, rLocalName
))
174 return new EventElement(
175 nUid
, rLocalName
, xAttributes
, this, _pImport
);
177 else if ( rLocalName
== "bulletinboard" )
180 DialogImport
* pPageImport
= new DialogImport( *_pImport
);
181 pPageImport
->_xDialogModel
= m_xContainer
;
182 return new BulletinBoardElement( rLocalName
, xAttributes
, this, pPageImport
);
187 throw xml::sax::SAXException("expected event element!", Reference
< XInterface
>(), Any() );
191 void Page::endElement()
192 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
194 Reference
< beans::XPropertySet
> xProps( m_xContainer
, UNO_QUERY_THROW
);
196 ControlImportContext
ctx( _pImport
, xProps
, getControlId( _xAttributes
));
198 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
200 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
203 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
204 pStyle
->importTextColorStyle( xControlModel
);
205 pStyle
->importTextLineColorStyle( xControlModel
);
206 pStyle
->importFontStyle( xControlModel
);
207 pStyle
->importBackgroundColorStyle( xControlModel
);
210 ctx
.importDefaults( 0, 0, _xAttributes
); // inherited from BulletinBoardElement
211 ctx
.importStringProperty( OUString( "Title" ), OUString( "title" ), _xAttributes
);
212 ctx
.importEvents( _events
);
213 // avoid ring-reference:
214 // vector< event elements > holding event elements holding this (via _pParent)
221 Reference
< xml::input::XElement
> ProgressBarElement::startChildElement(
222 sal_Int32 nUid
, OUString
const & rLocalName
,
223 Reference
< xml::input::XAttributes
> const & xAttributes
)
224 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
227 if (_pImport
->isEventElement( nUid
, rLocalName
))
229 return new EventElement(
230 nUid
, rLocalName
, xAttributes
, this, _pImport
);
234 throw xml::sax::SAXException(
235 OUString( "expected event element!" ),
236 Reference
< XInterface
>(), Any() );
239 void ProgressBarElement::endElement()
240 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
242 ControlImportContext
ctx( _pImport
, getControlId( _xAttributes
), "com.sun.star.awt.UnoControlProgressBarModel" );
244 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
247 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
248 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
249 pStyle
->importBackgroundColorStyle( xControlModel
);
250 pStyle
->importBorderStyle( xControlModel
);
251 pStyle
->importFillColorStyle( xControlModel
);
254 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
255 ctx
.importLongProperty( "ProgressValue", "value", _xAttributes
);
256 ctx
.importLongProperty( "ProgressValueMin", "value-min", _xAttributes
);
257 ctx
.importLongProperty( "ProgressValueMax", "value-max", _xAttributes
);
258 ctx
.importEvents( _events
);
259 // avoid ring-reference:
260 // vector< event elements > holding event elements holding this (via _pParent)
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
, std::exception
)
273 if (_pImport
->isEventElement( nUid
, rLocalName
))
275 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
279 throw xml::sax::SAXException("expected event element!", Reference
< XInterface
>(), Any() );
282 void ScrollBarElement::endElement()
283 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
285 ControlImportContext
ctx( _pImport
, getControlId( _xAttributes
), getControlModelName( "com.sun.star.awt.UnoControlScrollBarModel" , _xAttributes
) );
287 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
290 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
291 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
292 pStyle
->importBackgroundColorStyle( xControlModel
);
293 pStyle
->importBorderStyle( xControlModel
);
296 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
297 ctx
.importOrientationProperty( "Orientation" , "align", _xAttributes
);
298 ctx
.importLongProperty( "BlockIncrement" , "pageincrement" , _xAttributes
);
299 ctx
.importLongProperty( "LineIncrement" , "increment" , _xAttributes
);
300 ctx
.importLongProperty( "ScrollValue" ,"curpos", _xAttributes
);
301 ctx
.importLongProperty( "ScrollValueMax" , "maxpos" , _xAttributes
);
302 ctx
.importLongProperty( "ScrollValueMin","minpos", _xAttributes
);
303 ctx
.importLongProperty( "VisibleSize", "visible-size", _xAttributes
);
304 ctx
.importLongProperty( "RepeatDelay", "repeat", _xAttributes
);
305 ctx
.importBooleanProperty( "Tabstop", "tabstop" , _xAttributes
);
306 ctx
.importBooleanProperty( "LiveScroll", "live-scroll", _xAttributes
);
307 ctx
.importHexLongProperty( "SymbolColor", "symbol-color", _xAttributes
);
309 ctx
.importDataAwareProperty( "linked-cell" , _xAttributes
);
310 ctx
.importEvents( _events
);
311 // avoid ring-reference:
312 // vector< event elements > holding event elements holding this (via _pParent)
319 Reference
< xml::input::XElement
> SpinButtonElement::startChildElement(
320 sal_Int32 nUid
, OUString
const & rLocalName
,
321 Reference
< xml::input::XAttributes
> const & xAttributes
)
322 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
325 if (_pImport
->isEventElement( nUid
, rLocalName
))
327 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
331 throw xml::sax::SAXException("expected event element!", Reference
< XInterface
>(), Any() );
335 void SpinButtonElement::endElement()
336 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
338 ControlImportContext
ctx( _pImport
, getControlId( _xAttributes
), getControlModelName( "com.sun.star.awt.UnoControlSpinButtonModel", _xAttributes
) );
340 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
343 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
344 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
345 pStyle
->importBackgroundColorStyle( xControlModel
);
346 pStyle
->importBorderStyle( xControlModel
);
349 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
350 ctx
.importOrientationProperty( "Orientation", "align", _xAttributes
);
351 ctx
.importLongProperty("SpinIncrement", "increment", _xAttributes
);
352 ctx
.importLongProperty("SpinValue", "curval" ,_xAttributes
);
353 ctx
.importLongProperty("SpinValueMax", "maxval", _xAttributes
);
354 ctx
.importLongProperty( "SpinValueMin","minval",_xAttributes
);
355 ctx
.importLongProperty( "Repeat", "repeat", _xAttributes
);
356 ctx
.importLongProperty( "RepeatDelay", "repeat-delay",_xAttributes
);
357 ctx
.importBooleanProperty( "Tabstop", "tabstop", _xAttributes
);
358 ctx
.importHexLongProperty( "SymbolColor", "symbol-color" , _xAttributes
);
359 ctx
.importDataAwareProperty( "linked-cell" , _xAttributes
);
360 ctx
.importEvents( _events
);
361 // avoid ring-reference:
362 // vector< event elements > holding event elements holding this (via _pParent)
369 Reference
< xml::input::XElement
> FixedLineElement::startChildElement(
370 sal_Int32 nUid
, OUString
const & rLocalName
,
371 Reference
< xml::input::XAttributes
> const & xAttributes
)
372 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
375 if (_pImport
->isEventElement( nUid
, rLocalName
))
377 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
381 throw xml::sax::SAXException("expected event element!", Reference
< XInterface
>(), Any() );
384 void FixedLineElement::endElement()
385 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
387 ControlImportContext
ctx(_pImport
, getControlId( _xAttributes
), "com.sun.star.awt.UnoControlFixedLineModel" );
389 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
392 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
393 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
394 pStyle
->importTextColorStyle( xControlModel
);
395 pStyle
->importTextLineColorStyle( xControlModel
);
396 pStyle
->importFontStyle( xControlModel
);
399 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
400 ctx
.importStringProperty( "Label", "value", _xAttributes
);
401 ctx
.importOrientationProperty( "Orientation", "align", _xAttributes
);
402 ctx
.importEvents( _events
);
403 // avoid ring-reference:
404 // vector< event elements > holding event elements holding this (via _pParent)
411 Reference
< xml::input::XElement
> PatternFieldElement::startChildElement(
412 sal_Int32 nUid
, OUString
const & rLocalName
,
413 Reference
< xml::input::XAttributes
> const & xAttributes
)
414 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
417 if (_pImport
->isEventElement( nUid
, rLocalName
))
419 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
423 throw xml::sax::SAXException("expected event element!", Reference
< XInterface
>(), Any() );
426 void PatternFieldElement::endElement()
427 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
429 ControlImportContext
ctx( _pImport
, getControlId( _xAttributes
), "com.sun.star.awt.UnoControlPatternFieldModel" );
431 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
434 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
435 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
436 pStyle
->importBackgroundColorStyle( xControlModel
);
437 pStyle
->importTextColorStyle( xControlModel
);
438 pStyle
->importTextLineColorStyle( xControlModel
);
439 pStyle
->importBorderStyle( xControlModel
);
440 pStyle
->importFontStyle( xControlModel
);
443 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
444 ctx
.importBooleanProperty( "Tabstop", "tabstop", _xAttributes
);
445 ctx
.importBooleanProperty( "ReadOnly", "readonly" , _xAttributes
);
446 ctx
.importBooleanProperty( "StrictFormat", "strict-format", _xAttributes
);
447 ctx
.importBooleanProperty( "HideInactiveSelection", "hide-inactive-selection", _xAttributes
);
448 ctx
.importStringProperty( "Text", "value", _xAttributes
);
449 ctx
.importShortProperty( "MaxTextLen", "maxlength", _xAttributes
);
450 ctx
.importStringProperty( "EditMask", "edit-mask", _xAttributes
);
451 ctx
.importStringProperty( "LiteralMask", "literal-mask", _xAttributes
);
452 ctx
.importEvents( _events
);
453 // avoid ring-reference:
454 // vector< event elements > holding event elements holding this (via _pParent)
461 Reference
< xml::input::XElement
> FormattedFieldElement::startChildElement(
462 sal_Int32 nUid
, OUString
const & rLocalName
,
463 Reference
< xml::input::XAttributes
> const & xAttributes
)
464 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
467 if (_pImport
->isEventElement( nUid
, rLocalName
))
469 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
473 throw xml::sax::SAXException("expected event element!", Reference
< XInterface
>(), Any() );
477 void FormattedFieldElement::endElement()
478 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
480 ControlImportContext
ctx( _pImport
, getControlId( _xAttributes
), "com.sun.star.awt.UnoControlFormattedFieldModel" );
482 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
485 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
486 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
487 pStyle
->importBackgroundColorStyle( xControlModel
);
488 pStyle
->importTextColorStyle( xControlModel
);
489 pStyle
->importTextLineColorStyle( xControlModel
);
490 pStyle
->importBorderStyle( xControlModel
);
491 pStyle
->importFontStyle( xControlModel
);
494 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
495 ctx
.importBooleanProperty( "Tabstop", "tabstop", _xAttributes
);
496 ctx
.importBooleanProperty( "ReadOnly", "readonly" , _xAttributes
);
497 ctx
.importBooleanProperty( "StrictFormat", "strict-format" , _xAttributes
);
498 ctx
.importBooleanProperty( "HideInactiveSelection", "hide-inactive-selection", _xAttributes
);
499 ctx
.importAlignProperty( "Align" , "align" , _xAttributes
);
500 ctx
.importDoubleProperty( "EffectiveMin", "value-min" , _xAttributes
);
501 ctx
.importDoubleProperty( "EffectiveMax", "value-max", _xAttributes
);
502 ctx
.importDoubleProperty( "EffectiveValue", "value", _xAttributes
);
503 ctx
.importStringProperty( "Text", "text", _xAttributes
);
504 ctx
.importShortProperty( "MaxTextLen", "maxlength", _xAttributes
);
505 ctx
.importBooleanProperty( "Spin", "spin", _xAttributes
);
506 if (ctx
.importLongProperty( "RepeatDelay", "repeat", _xAttributes
))
507 ctx
.getControlModel()->setPropertyValue( "Repeat" , makeAny(true) );
509 OUString
sDefault(_xAttributes
->getValueByUidName(_pImport
->XMLNS_DIALOGS_UID
, "value-default") );
510 if (!sDefault
.isEmpty())
512 double d
= sDefault
.toDouble();
513 if (d
!= 0.0 || sDefault
== "0" || sDefault
== "0.0" )
515 ctx
.getControlModel()->setPropertyValue( "EffectiveDefault", makeAny( d
) );
517 else // treat as string
519 ctx
.getControlModel()->setPropertyValue( "EffectiveDefault", makeAny( sDefault
) );
524 ctx
.getControlModel()->setPropertyValue("FormatsSupplier", makeAny( _pImport
->getNumberFormatsSupplier() ) );
526 OUString
sFormat( _xAttributes
->getValueByUidName(_pImport
->XMLNS_DIALOGS_UID
, "format-code" ) );
527 if (!sFormat
.isEmpty())
531 OUString
sLocale( _xAttributes
->getValueByUidName( _pImport
->XMLNS_DIALOGS_UID
, "format-locale" ) );
532 if (!sLocale
.isEmpty())
535 // Don't know what may have written what we read here, so parse all
536 // old style including the trailing ";Variant" if present.
537 sal_Int32 semi0
= sLocale
.indexOf( ';' );
538 if (semi0
< 0) // no semi at all, try new BCP47 or just language
540 locale
= LanguageTag::convertToLocale( sLocale
, false);
544 sal_Int32 semi1
= sLocale
.indexOf( ';', semi0
+1 );
545 if (semi1
> semi0
) // language;country;variant
547 SAL_WARN( "xmlscript.xmldlg", "format-locale with variant that is ignored: " << sLocale
);
548 locale
.Language
= sLocale
.copy( 0, semi0
);
549 locale
.Country
= sLocale
.copy( semi0
+1, semi1
- semi0
-1 );
550 // Ignore Variant that no one knows what it would be.
552 else // language;country
554 locale
.Language
= sLocale
.copy( 0, semi0
);
555 locale
.Country
= sLocale
.copy( semi0
+1 );
562 Reference
< util::XNumberFormats
> xFormats(
563 _pImport
->getNumberFormatsSupplier()->getNumberFormats() );
564 sal_Int32 nKey
= xFormats
->queryKey( sFormat
, locale
, sal_True
);
567 nKey
= xFormats
->addNew( sFormat
, locale
);
569 ctx
.getControlModel()->setPropertyValue("FormatKey", makeAny( nKey
) );
571 catch (const util::MalformedNumberFormatException
& exc
)
573 SAL_WARN( "xmlscript.xmldlg", "### util::MalformedNumberFormatException occurred!" );
575 throw xml::sax::SAXException( exc
.Message
, Reference
< XInterface
>(), Any() );
578 ctx
.importBooleanProperty("TreatAsNumber", "treat-as-number" , _xAttributes
);
579 ctx
.importBooleanProperty("EnforceFormat", "enforce-format", _xAttributes
);
581 ctx
.importDataAwareProperty( "linked-cell" , _xAttributes
);
582 ctx
.importEvents( _events
);
583 // avoid ring-reference:
584 // vector< event elements > holding event elements holding this (via _pParent)
591 Reference
< xml::input::XElement
> TimeFieldElement::startChildElement(
592 sal_Int32 nUid
, OUString
const & rLocalName
,
593 Reference
< xml::input::XAttributes
> const & xAttributes
)
594 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
597 if (_pImport
->isEventElement( nUid
, rLocalName
))
599 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
603 throw xml::sax::SAXException("expected event element!", Reference
< XInterface
>(), Any() );
606 void TimeFieldElement::endElement()
607 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
609 ControlImportContext
ctx( _pImport
, getControlId( _xAttributes
), "com.sun.star.awt.UnoControlTimeFieldModel" );
611 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
614 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
615 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
616 pStyle
->importBackgroundColorStyle( xControlModel
);
617 pStyle
->importTextColorStyle( xControlModel
);
618 pStyle
->importTextLineColorStyle( xControlModel
);
619 pStyle
->importBorderStyle( xControlModel
);
620 pStyle
->importFontStyle( xControlModel
);
623 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
624 ctx
.importBooleanProperty("Tabstop", "tabstop", _xAttributes
);
625 ctx
.importBooleanProperty("ReadOnly", "readonly", _xAttributes
);
626 ctx
.importBooleanProperty( "StrictFormat", "strict-format", _xAttributes
);
627 ctx
.importBooleanProperty("HideInactiveSelection","hide-inactive-selection", _xAttributes
);
628 ctx
.importTimeFormatProperty( "TimeFormat", "time-format", _xAttributes
);
629 ctx
.importTimeProperty( "Time", "value", _xAttributes
);
630 ctx
.importTimeProperty( "TimeMin", "value-min", _xAttributes
);
631 ctx
.importTimeProperty( "TimeMax", "value-max", _xAttributes
);
632 ctx
.importBooleanProperty( "Spin", "spin", _xAttributes
);
633 if (ctx
.importLongProperty( "RepeatDelay", "repeat", _xAttributes
))
634 ctx
.getControlModel()->setPropertyValue("Repeat", makeAny(true) );
635 ctx
.importStringProperty( "Text", "text" , _xAttributes
);
636 ctx
.importBooleanProperty( "EnforceFormat", "enforce-format" , _xAttributes
);
638 ctx
.importEvents( _events
);
639 // avoid ring-reference:
640 // vector< event elements > holding event elements holding this (via _pParent)
647 Reference
< xml::input::XElement
> NumericFieldElement::startChildElement(
648 sal_Int32 nUid
, OUString
const & rLocalName
,
649 Reference
< xml::input::XAttributes
> const & xAttributes
)
650 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
653 if (_pImport
->isEventElement( nUid
, rLocalName
))
655 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
659 throw xml::sax::SAXException( "expected event element!", Reference
< XInterface
>(), Any() );
662 void NumericFieldElement::endElement()
663 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
665 ControlImportContext
ctx( _pImport
, getControlId( _xAttributes
), "com.sun.star.awt.UnoControlNumericFieldModel" );
667 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
670 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
671 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
672 pStyle
->importBackgroundColorStyle( xControlModel
);
673 pStyle
->importTextColorStyle( xControlModel
);
674 pStyle
->importTextLineColorStyle( xControlModel
);
675 pStyle
->importBorderStyle( xControlModel
);
676 pStyle
->importFontStyle( xControlModel
);
679 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
680 ctx
.importBooleanProperty( "Tabstop","tabstop",_xAttributes
);
681 ctx
.importBooleanProperty( "ReadOnly", "readonly",_xAttributes
);
682 ctx
.importBooleanProperty( "StrictFormat", "strict-format", _xAttributes
);
683 ctx
.importBooleanProperty( "HideInactiveSelection", "hide-inactive-selection", _xAttributes
);
684 ctx
.importShortProperty( "DecimalAccuracy", "decimal-accuracy", _xAttributes
);
685 ctx
.importBooleanProperty( "ShowThousandsSeparator", "thousands-separator", _xAttributes
);
686 ctx
.importDoubleProperty( "Value", "value", _xAttributes
);
687 ctx
.importDoubleProperty( "ValueMin", "value-min", _xAttributes
);
688 ctx
.importDoubleProperty( "ValueMax", "value-max", _xAttributes
);
689 ctx
.importDoubleProperty( "ValueStep", "value-step", _xAttributes
);
690 ctx
.importBooleanProperty( "Spin", "spin", _xAttributes
);
691 if (ctx
.importLongProperty( "RepeatDelay", "repeat", _xAttributes
))
692 ctx
.getControlModel()->setPropertyValue("Repeat", makeAny(true) );
693 ctx
.importBooleanProperty( "EnforceFormat", "enforce-format", _xAttributes
);
694 ctx
.importEvents( _events
);
695 // avoid ring-reference:
696 // vector< event elements > holding event elements holding this (via _pParent)
703 Reference
< xml::input::XElement
> DateFieldElement::startChildElement(
704 sal_Int32 nUid
, OUString
const & rLocalName
,
705 Reference
< xml::input::XAttributes
> const & xAttributes
)
706 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
709 if (_pImport
->isEventElement( nUid
, rLocalName
))
711 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
715 throw xml::sax::SAXException("expected event element!", Reference
< XInterface
>(), Any() );
718 void DateFieldElement::endElement()
719 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
721 ControlImportContext
ctx( _pImport
, getControlId( _xAttributes
), "com.sun.star.awt.UnoControlDateFieldModel" );
723 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
726 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
727 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
728 pStyle
->importBackgroundColorStyle( xControlModel
);
729 pStyle
->importTextColorStyle( xControlModel
);
730 pStyle
->importTextLineColorStyle( xControlModel
);
731 pStyle
->importBorderStyle( xControlModel
);
732 pStyle
->importFontStyle( xControlModel
);
735 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
736 ctx
.importBooleanProperty( "Tabstop", "tabstop", _xAttributes
);
737 ctx
.importBooleanProperty( "ReadOnly", "readonly", _xAttributes
);
738 ctx
.importBooleanProperty( "StrictFormat", "strict-format", _xAttributes
);
739 ctx
.importBooleanProperty( "HideInactiveSelection", "hide-inactive-selection", _xAttributes
);
740 ctx
.importDateFormatProperty( "DateFormat", "date-format", _xAttributes
);
741 ctx
.importBooleanProperty( "DateShowCentury", "show-century", _xAttributes
);
742 ctx
.importDateProperty( "Date", "value", _xAttributes
);
743 ctx
.importDateProperty( "DateMin", "value-min", _xAttributes
);
744 ctx
.importDateProperty( "DateMax", "value-max", _xAttributes
);
745 ctx
.importBooleanProperty( "Spin", "spin", _xAttributes
);
746 if (ctx
.importLongProperty( "RepeatDelay", "repeat", _xAttributes
))
747 ctx
.getControlModel()->setPropertyValue( "Repeat", makeAny(true) );
748 ctx
.importBooleanProperty( "Dropdown", "dropdown", _xAttributes
);
749 ctx
.importStringProperty( "Text", "text", _xAttributes
);
750 ctx
.importBooleanProperty( "EnforceFormat", "enforce-format", _xAttributes
);
751 ctx
.importEvents( _events
);
752 // avoid ring-reference:
753 // vector< event elements > holding event elements holding this (via _pParent)
760 Reference
< xml::input::XElement
> CurrencyFieldElement::startChildElement(
761 sal_Int32 nUid
, OUString
const & rLocalName
,
762 Reference
< xml::input::XAttributes
> const & xAttributes
)
763 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
766 if (_pImport
->isEventElement( nUid
, rLocalName
))
768 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
772 throw xml::sax::SAXException( "expected event element!" , Reference
< XInterface
>(), Any() );
775 void CurrencyFieldElement::endElement()
776 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
778 ControlImportContext
ctx( _pImport
, getControlId( _xAttributes
), "com.sun.star.awt.UnoControlCurrencyFieldModel" );
780 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
783 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
784 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
785 pStyle
->importBackgroundColorStyle( xControlModel
);
786 pStyle
->importTextColorStyle( xControlModel
);
787 pStyle
->importTextLineColorStyle( xControlModel
);
788 pStyle
->importBorderStyle( xControlModel
);
789 pStyle
->importFontStyle( xControlModel
);
792 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
793 ctx
.importBooleanProperty("Tabstop", "tabstop", _xAttributes
);
794 ctx
.importBooleanProperty( "ReadOnly", "readonly" , _xAttributes
);
795 ctx
.importBooleanProperty( "StrictFormat", "strict-format", _xAttributes
);
796 ctx
.importBooleanProperty( "HideInactiveSelection", "hide-inactive-selection", _xAttributes
);
797 ctx
.importStringProperty( "CurrencySymbol", "currency-symbol", _xAttributes
);
798 ctx
.importShortProperty( "DecimalAccuracy", "decimal-accuracy", _xAttributes
);
799 ctx
.importBooleanProperty( "ShowThousandsSeparator", "thousands-separator", _xAttributes
);
800 ctx
.importDoubleProperty( "Value", "value", _xAttributes
);
801 ctx
.importDoubleProperty( "ValueMin", "value-min", _xAttributes
);
802 ctx
.importDoubleProperty( "ValueMax", "value-max", _xAttributes
);
803 ctx
.importDoubleProperty( "ValueStep", "value-step", _xAttributes
);
804 ctx
.importBooleanProperty( "Spin", "spin", _xAttributes
);
805 if (ctx
.importLongProperty( "RepeatDelay", "repeat", _xAttributes
))
806 ctx
.getControlModel()->setPropertyValue( "Repeat", makeAny(true) );
807 ctx
.importBooleanProperty( "PrependCurrencySymbol", "prepend-symbol", _xAttributes
);
808 ctx
.importBooleanProperty( "EnforceFormat", "enforce-format", _xAttributes
);
809 ctx
.importEvents( _events
);
810 // avoid ring-reference:
811 // vector< event elements > holding event elements holding this (via _pParent)
818 Reference
< xml::input::XElement
> FileControlElement::startChildElement(
819 sal_Int32 nUid
, OUString
const & rLocalName
,
820 Reference
< xml::input::XAttributes
> const & xAttributes
)
821 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
824 if (_pImport
->isEventElement( nUid
, rLocalName
))
826 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
830 throw xml::sax::SAXException( "expected event element!", Reference
< XInterface
>(), Any() );
833 void FileControlElement::endElement()
834 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
836 ControlImportContext
ctx( _pImport
, getControlId( _xAttributes
), "com.sun.star.awt.UnoControlFileControlModel" );
838 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
841 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
842 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
843 pStyle
->importBackgroundColorStyle( xControlModel
);
844 pStyle
->importTextColorStyle( xControlModel
);
845 pStyle
->importTextLineColorStyle( xControlModel
);
846 pStyle
->importBorderStyle( xControlModel
);
847 pStyle
->importFontStyle( xControlModel
);
850 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
851 ctx
.importBooleanProperty( "Tabstop", "tabstop", _xAttributes
);
852 ctx
.importBooleanProperty("HideInactiveSelection","hide-inactive-selection", _xAttributes
);
853 ctx
.importStringProperty( "Text", "value", _xAttributes
);
854 ctx
.importBooleanProperty( "ReadOnly", "readonly", _xAttributes
);
855 ctx
.importEvents( _events
);
856 // avoid ring-reference:
857 // vector< event elements > holding event elements holding this (via _pParent)
864 Reference
< xml::input::XElement
> TreeControlElement::startChildElement(
865 sal_Int32 nUid
, OUString
const & rLocalName
,
866 Reference
< xml::input::XAttributes
> const & xAttributes
)
867 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
870 if (_pImport
->isEventElement( nUid
, rLocalName
))
872 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
876 throw xml::sax::SAXException( "expected event element!", Reference
< XInterface
>(), Any() );
879 void TreeControlElement::endElement()
880 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
882 ControlImportContext
ctx( _pImport
, getControlId( _xAttributes
), "com.sun.star.awt.tree.TreeControlModel" );
884 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
887 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
888 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
889 pStyle
->importBackgroundColorStyle( xControlModel
);
890 pStyle
->importBorderStyle( xControlModel
);
893 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
894 ctx
.importBooleanProperty( "Tabstop", "tabstop", _xAttributes
);
895 ctx
.importSelectionTypeProperty( "SelectionType", "selectiontype", _xAttributes
);
896 ctx
.importBooleanProperty( "RootDisplayed", "rootdisplayed", _xAttributes
);
897 ctx
.importBooleanProperty( "ShowsHandles", "showshandles", _xAttributes
);
898 ctx
.importBooleanProperty( "ShowsRootHandles", "showsroothandles" ,_xAttributes
);
899 ctx
.importBooleanProperty( "Editable", "editable", _xAttributes
);
900 ctx
.importBooleanProperty( "RowHeight", "readonly", _xAttributes
);
901 ctx
.importBooleanProperty( "InvokesStopNodeEditing", "invokesstopnodeediting", _xAttributes
);
903 ctx
.importEvents( _events
);
904 // avoid ring-reference:
905 // vector< event elements > holding event elements holding this (via _pParent)
912 Reference
< xml::input::XElement
> ImageControlElement::startChildElement(
913 sal_Int32 nUid
, OUString
const & rLocalName
,
914 Reference
< xml::input::XAttributes
> const & xAttributes
)
915 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
918 if (_pImport
->isEventElement( nUid
, rLocalName
))
920 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
924 throw xml::sax::SAXException( "expected event element!" , Reference
< XInterface
>(), Any() );
928 void ImageControlElement::endElement()
929 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
931 ControlImportContext
ctx( _pImport
, getControlId( _xAttributes
), "com.sun.star.awt.UnoControlImageControlModel" );
933 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
936 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
937 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
938 pStyle
->importBackgroundColorStyle( xControlModel
);
939 pStyle
->importBorderStyle( xControlModel
);
942 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
943 ctx
.importBooleanProperty( "ScaleImage", "scale-image", _xAttributes
);
944 ctx
.importImageScaleModeProperty( "ScaleMode" , "scale-mode" , _xAttributes
);
945 ctx
.importImageURLProperty( "ImageURL" , "src" , _xAttributes
);
946 ctx
.importBooleanProperty( "Tabstop", "tabstop", _xAttributes
);
947 ctx
.importEvents( _events
);
948 // avoid ring-reference:
949 // vector< event elements > holding event elements holding this (via _pParent)
956 Reference
< xml::input::XElement
> TextElement::startChildElement(
957 sal_Int32 nUid
, OUString
const & rLocalName
,
958 Reference
< xml::input::XAttributes
> const & xAttributes
)
959 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
962 if (_pImport
->isEventElement( nUid
, rLocalName
))
964 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
968 throw xml::sax::SAXException( "expected event element!", Reference
< XInterface
>(), Any() );
972 void TextElement::endElement()
973 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
975 ControlImportContext
ctx( _pImport
, getControlId( _xAttributes
), "com.sun.star.awt.UnoControlFixedTextModel" );
977 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
980 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
981 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
982 pStyle
->importBackgroundColorStyle( xControlModel
);
983 pStyle
->importTextColorStyle( xControlModel
);
984 pStyle
->importTextLineColorStyle( xControlModel
);
985 pStyle
->importBorderStyle( xControlModel
);
986 pStyle
->importFontStyle( xControlModel
);
989 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
990 ctx
.importStringProperty( "Label", "value", _xAttributes
);
991 ctx
.importAlignProperty( "Align", "align", _xAttributes
);
992 ctx
.importVerticalAlignProperty( "VerticalAlign", "valign", _xAttributes
);
993 ctx
.importBooleanProperty( "MultiLine", "multiline" ,_xAttributes
);
994 ctx
.importBooleanProperty( "Tabstop", "tabstop", _xAttributes
);
995 ctx
.importBooleanProperty( "NoLabel", "nolabel", _xAttributes
);
996 ctx
.importEvents( _events
);
997 // avoid ring-reference:
998 // vector< event elements > holding event elements holding this (via _pParent)
1005 Reference
< xml::input::XElement
> FixedHyperLinkElement::startChildElement(
1006 sal_Int32 nUid
, OUString
const & rLocalName
,
1007 Reference
< xml::input::XAttributes
> const & xAttributes
)
1008 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
1011 if (_pImport
->isEventElement( nUid
, rLocalName
))
1013 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
1017 throw xml::sax::SAXException( "expected event element!" , Reference
< XInterface
>(), Any() );
1020 void FixedHyperLinkElement::endElement()
1021 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
1023 ControlImportContext
ctx( _pImport
, getControlId( _xAttributes
), "com.sun.star.awt.UnoControlFixedHyperlinkModel" );
1025 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
1028 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
1029 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
1030 pStyle
->importBackgroundColorStyle( xControlModel
);
1031 pStyle
->importTextColorStyle( xControlModel
);
1032 pStyle
->importTextLineColorStyle( xControlModel
);
1033 pStyle
->importBorderStyle( xControlModel
);
1034 pStyle
->importFontStyle( xControlModel
);
1037 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
1038 ctx
.importStringProperty( "Label", "value", _xAttributes
);
1039 ctx
.importStringProperty( "URL", "url", _xAttributes
);
1040 ctx
.importStringProperty( "Description", "description", _xAttributes
);
1042 ctx
.importAlignProperty( "Align", "align" ,_xAttributes
);
1043 ctx
.importVerticalAlignProperty( "VerticalAlign", "valign", _xAttributes
);
1044 ctx
.importBooleanProperty( "MultiLine", "multiline", _xAttributes
);
1045 ctx
.importBooleanProperty( "Tabstop", "tabstop", _xAttributes
);
1046 ctx
.importBooleanProperty( "NoLabel", "nolabel", _xAttributes
);
1047 ctx
.importEvents( _events
);
1048 // avoid ring-reference:
1049 // vector< event elements > holding event elements holding this (via _pParent)
1056 Reference
< xml::input::XElement
> TextFieldElement::startChildElement(
1057 sal_Int32 nUid
, OUString
const & rLocalName
,
1058 Reference
< xml::input::XAttributes
> const & xAttributes
)
1059 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
1062 if (_pImport
->isEventElement( nUid
, rLocalName
))
1064 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
1068 throw xml::sax::SAXException( "expected event element!", Reference
< XInterface
>(), Any() );
1071 void TextFieldElement::endElement()
1072 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
1074 ControlImportContext
ctx( _pImport
, getControlId( _xAttributes
), "com.sun.star.awt.UnoControlEditModel" );
1075 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
1077 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
1080 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
1081 pStyle
->importBackgroundColorStyle( xControlModel
);
1082 pStyle
->importTextColorStyle( xControlModel
);
1083 pStyle
->importTextLineColorStyle( xControlModel
);
1084 pStyle
->importBorderStyle( xControlModel
);
1085 pStyle
->importFontStyle( xControlModel
);
1088 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
1089 ctx
.importBooleanProperty("Tabstop", "tabstop", _xAttributes
);
1090 ctx
.importAlignProperty( "Align", "align", _xAttributes
);
1091 ctx
.importBooleanProperty( "HardLineBreaks", "hard-linebreaks", _xAttributes
);
1092 ctx
.importBooleanProperty( "HScroll", "hscroll" ,_xAttributes
);
1093 ctx
.importBooleanProperty( "VScroll", "vscroll", _xAttributes
);
1094 ctx
.importBooleanProperty("HideInactiveSelection", "hide-inactive-selection", _xAttributes
);
1095 ctx
.importShortProperty( "MaxTextLen", "maxlength", _xAttributes
);
1096 ctx
.importBooleanProperty( "MultiLine", "multiline", _xAttributes
);
1097 ctx
.importBooleanProperty( "ReadOnly", "readonly", _xAttributes
);
1098 ctx
.importStringProperty( "Text", "value", _xAttributes
);
1099 ctx
.importLineEndFormatProperty( "LineEndFormat", "lineend-format", _xAttributes
);
1101 if (getStringAttr( &aValue
, "echochar", _xAttributes
, _pImport
->XMLNS_DIALOGS_UID
) && !aValue
.isEmpty() )
1103 SAL_WARN_IF( aValue
.getLength() != 1, "xmlscript.xmldlg", "### more than one character given for echochar!" );
1104 sal_Int16 nChar
= 0;
1105 if(!aValue
.isEmpty())
1107 nChar
= (sal_Int16
)aValue
[ 0 ];
1109 xControlModel
->setPropertyValue( "EchoChar", makeAny( nChar
) );
1112 ctx
.importEvents( _events
);
1113 // avoid ring-reference:
1114 // vector< event elements > holding event elements holding this (via _pParent)
1121 Reference
< xml::input::XElement
> TitledBoxElement::startChildElement(
1122 sal_Int32 nUid
, OUString
const & rLocalName
,
1123 Reference
< xml::input::XAttributes
> const & xAttributes
)
1124 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
1127 if (_pImport
->isEventElement( nUid
, rLocalName
))
1129 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
1131 else if (_pImport
->XMLNS_DIALOGS_UID
!= nUid
)
1133 throw xml::sax::SAXException( "illegal namespace!", Reference
< XInterface
>(), Any() );
1136 else if ( rLocalName
== "title" )
1138 getStringAttr( &_label
, "value", xAttributes
, _pImport
->XMLNS_DIALOGS_UID
);
1140 return new ElementBase( _pImport
->XMLNS_DIALOGS_UID
, rLocalName
, xAttributes
, this, _pImport
);
1143 else if ( rLocalName
== "radio" )
1145 // dont create radios here, => titledbox must be inserted first due to radio grouping,
1146 // possible predecessors!
1147 Reference
< xml::input::XElement
> xRet(
1148 new RadioElement( rLocalName
, xAttributes
, this, _pImport
) );
1149 _radios
.push_back( xRet
);
1153 else if (_pImport
->isEventElement( nUid
, rLocalName
))
1155 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
1159 return BulletinBoardElement::startChildElement( nUid
, rLocalName
, xAttributes
);
1163 void TitledBoxElement::endElement()
1164 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
1167 ControlImportContext
ctx(_pImport
, getControlId( _xAttributes
), "com.sun.star.awt.UnoControlGroupBoxModel" );
1168 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
1170 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
1173 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
1174 pStyle
->importTextColorStyle( xControlModel
);
1175 pStyle
->importTextLineColorStyle( xControlModel
);
1176 pStyle
->importFontStyle( xControlModel
);
1179 ctx
.importDefaults( 0, 0, _xAttributes
); // inherited from BulletinBoardElement
1181 if (!_label
.isEmpty())
1183 xControlModel
->setPropertyValue( "Label", makeAny( _label
) );
1186 ctx
.importEvents( _events
);
1187 // avoid ring-reference:
1188 // vector< event elements > holding event elements holding this (via _pParent)
1194 // create radios AFTER group box!
1195 for ( size_t nPos
= 0; nPos
< _radios
.size(); ++nPos
)
1197 Reference
< xml::input::XElement
> xRadio( _radios
[ nPos
] );
1198 Reference
< xml::input::XAttributes
> xAttributes( xRadio
->getAttributes() );
1200 ControlImportContext
ctx( _pImport
, getControlId( xAttributes
), getControlModelName( "com.sun.star.awt.UnoControlRadioButtonModel", xAttributes
) );
1201 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
1203 Reference
< xml::input::XElement
> xStyle( getStyle( xAttributes
) );
1206 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
1207 pStyle
->importBackgroundColorStyle( xControlModel
);
1208 pStyle
->importTextColorStyle( xControlModel
);
1209 pStyle
->importTextLineColorStyle( xControlModel
);
1210 pStyle
->importFontStyle( xControlModel
);
1211 pStyle
->importVisualEffectStyle( xControlModel
);
1214 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, xAttributes
);
1215 ctx
.importBooleanProperty( "Tabstop", "tabstop", xAttributes
);
1216 ctx
.importStringProperty( "Label", "value", xAttributes
);
1217 ctx
.importAlignProperty( "Align", "align", xAttributes
);
1218 ctx
.importVerticalAlignProperty( "VerticalAlign", "valign", xAttributes
);
1219 ctx
.importImageURLProperty( "ImageURL" , "image-src" , _xAttributes
);
1220 ctx
.importImagePositionProperty( "ImagePosition", "image-position", xAttributes
);
1221 ctx
.importBooleanProperty( "MultiLine", "multiline", xAttributes
);
1222 ctx
.importStringProperty( "GroupName", "group-name", xAttributes
);
1225 sal_Bool bChecked
= sal_False
;
1226 if (getBoolAttr( &bChecked
, "checked", xAttributes
, _pImport
->XMLNS_DIALOGS_UID
) && bChecked
)
1230 xControlModel
->setPropertyValue( "State", makeAny( nVal
) );
1231 ctx
.importDataAwareProperty( "linked-cell" , xAttributes
);
1232 ::std::vector
< Reference
< xml::input::XElement
> > & radioEvents
=
1233 static_cast< RadioElement
* >( xRadio
.get() )->getEvents();
1234 ctx
.importEvents( radioEvents
);
1235 // avoid ring-reference:
1236 // vector< event elements > holding event elements holding this (via _pParent)
1237 radioEvents
.clear();
1241 // avoid ring-reference:
1242 // vector< radio elements > holding radio elements holding this (via _pParent)
1247 Reference
< xml::input::XElement
> RadioElement::startChildElement(
1248 sal_Int32 nUid
, OUString
const & rLocalName
,
1249 Reference
< xml::input::XAttributes
> const & xAttributes
)
1250 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
1253 if (_pImport
->isEventElement( nUid
, rLocalName
))
1255 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
1259 throw xml::sax::SAXException("expected event element!", Reference
< XInterface
>(), Any() );
1264 Reference
< xml::input::XElement
> RadioGroupElement::startChildElement(
1265 sal_Int32 nUid
, OUString
const & rLocalName
,
1266 Reference
< xml::input::XAttributes
> const & xAttributes
)
1267 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
1269 if (_pImport
->XMLNS_DIALOGS_UID
!= nUid
)
1271 throw xml::sax::SAXException( "illegal namespace!", Reference
< XInterface
>(), Any() );
1274 else if ( rLocalName
== "radio" )
1276 // dont create radios here, => titledbox must be inserted first due to radio grouping,
1277 // possible predecessors!
1278 Reference
< xml::input::XElement
> xRet(
1279 new RadioElement( rLocalName
, xAttributes
, this, _pImport
) );
1280 _radios
.push_back( xRet
);
1285 throw xml::sax::SAXException( "expected radio element!", Reference
< XInterface
>(), Any() );
1288 void RadioGroupElement::endElement()
1289 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
1291 for ( size_t nPos
= 0; nPos
< _radios
.size(); ++nPos
)
1293 Reference
< xml::input::XElement
> xRadio( _radios
[ nPos
] );
1294 Reference
< xml::input::XAttributes
> xAttributes(
1295 xRadio
->getAttributes() );
1297 ControlImportContext
ctx( _pImport
, getControlId( xAttributes
), getControlModelName( "com.sun.star.awt.UnoControlRadioButtonModel", xAttributes
) );
1298 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
1300 Reference
< xml::input::XElement
> xStyle( getStyle( xAttributes
) );
1303 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
1304 pStyle
->importBackgroundColorStyle( xControlModel
);
1305 pStyle
->importTextColorStyle( xControlModel
);
1306 pStyle
->importTextLineColorStyle( xControlModel
);
1307 pStyle
->importFontStyle( xControlModel
);
1308 pStyle
->importVisualEffectStyle( xControlModel
);
1311 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, xAttributes
);
1312 ctx
.importBooleanProperty("Tabstop", "tabstop", xAttributes
);
1313 ctx
.importStringProperty( "Label", "value", xAttributes
);
1314 ctx
.importAlignProperty( "Align", "align", xAttributes
);
1315 ctx
.importVerticalAlignProperty( "VerticalAlign", "valign", xAttributes
);
1316 ctx
.importImageURLProperty( "ImageURL" , "image-src" , xAttributes
);
1317 ctx
.importImagePositionProperty( "ImagePosition", "image-position", xAttributes
);
1318 ctx
.importBooleanProperty( "MultiLine", "multiline", xAttributes
);
1319 ctx
.importStringProperty( "GroupName", "group-name", xAttributes
);
1321 sal_Bool bChecked
= sal_False
;
1322 if (getBoolAttr( &bChecked
, "checked", xAttributes
, _pImport
->XMLNS_DIALOGS_UID
) && bChecked
)
1326 xControlModel
->setPropertyValue( "State", makeAny( nVal
) );
1328 ctx
.importDataAwareProperty( "linked-cell", xAttributes
);
1330 ::std::vector
< Reference
< xml::input::XElement
> > & radioEvents
=
1331 static_cast< RadioElement
* >( xRadio
.get() )->getEvents();
1332 ctx
.importEvents( radioEvents
);
1333 // avoid ring-reference:
1334 // vector< event elements > holding event elements holding this (via _pParent)
1335 radioEvents
.clear();
1339 // avoid ring-reference:
1340 // vector< radio elements > holding radio elements holding this (via _pParent)
1345 Reference
< xml::input::XElement
> MenuPopupElement::startChildElement(
1346 sal_Int32 nUid
, OUString
const & rLocalName
,
1347 Reference
< xml::input::XAttributes
> const & xAttributes
)
1348 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
1350 if (_pImport
->XMLNS_DIALOGS_UID
!= nUid
)
1352 throw xml::sax::SAXException( "illegal namespace!", Reference
< XInterface
>(), Any() );
1355 else if ( rLocalName
== "menuitem" )
1357 OUString
aValue( xAttributes
->getValueByUidName( _pImport
->XMLNS_DIALOGS_UID
,"value" ) );
1358 SAL_WARN_IF( aValue
.isEmpty(), "xmlscript.xmldlg", "### menuitem has no value?" );
1359 if (!aValue
.isEmpty())
1361 _itemValues
.push_back( aValue
);
1363 OUString
aSel( xAttributes
->getValueByUidName( _pImport
->XMLNS_DIALOGS_UID
, "selected" ) );
1364 if (!aSel
.isEmpty() && aSel
== "true")
1366 _itemSelected
.push_back( static_cast<sal_Int16
>(_itemValues
.size()) -1 );
1369 return new ElementBase( _pImport
->XMLNS_DIALOGS_UID
, rLocalName
, xAttributes
, this, _pImport
);
1373 throw xml::sax::SAXException("expected menuitem!" , Reference
< XInterface
>(), Any() );
1376 Sequence
< OUString
> MenuPopupElement::getItemValues()
1378 Sequence
< OUString
> aRet( _itemValues
.size() );
1379 OUString
* pRet
= aRet
.getArray();
1380 for ( size_t nPos
= _itemValues
.size(); nPos
--; )
1382 pRet
[ nPos
] = _itemValues
[ nPos
];
1386 Sequence
< sal_Int16
> MenuPopupElement::getSelectedItems()
1388 Sequence
< sal_Int16
> aRet( _itemSelected
.size() );
1389 sal_Int16
* pRet
= aRet
.getArray();
1390 for ( size_t nPos
= _itemSelected
.size(); nPos
--; )
1392 pRet
[ nPos
] = _itemSelected
[ nPos
];
1398 Reference
< xml::input::XElement
> MenuListElement::startChildElement(
1399 sal_Int32 nUid
, OUString
const & rLocalName
,
1400 Reference
< xml::input::XAttributes
> const & xAttributes
)
1401 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
1404 if (_pImport
->isEventElement( nUid
, rLocalName
))
1406 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
1408 else if (_pImport
->XMLNS_DIALOGS_UID
!= nUid
)
1410 throw xml::sax::SAXException( "illegal namespace!", Reference
< XInterface
>(), Any() );
1413 else if ( rLocalName
== "menupopup" )
1415 _popup
= new MenuPopupElement( rLocalName
, xAttributes
, this, _pImport
);
1420 throw xml::sax::SAXException( "expected event or menupopup element!", Reference
< XInterface
>(), Any() );
1424 void MenuListElement::endElement()
1425 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
1427 ControlImportContext
ctx( _pImport
, getControlId( _xAttributes
), getControlModelName( "com.sun.star.awt.UnoControlListBoxModel", _xAttributes
) );
1428 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
1430 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
1433 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
1434 pStyle
->importBackgroundColorStyle( xControlModel
);
1435 pStyle
->importTextColorStyle( xControlModel
);
1436 pStyle
->importTextLineColorStyle( xControlModel
);
1437 pStyle
->importBorderStyle( xControlModel
);
1438 pStyle
->importFontStyle( xControlModel
);
1441 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
1442 ctx
.importBooleanProperty( "Tabstop", "tabstop", _xAttributes
);
1443 ctx
.importBooleanProperty( "MultiSelection", "multiselection", _xAttributes
);
1444 ctx
.importBooleanProperty( "ReadOnly", "readonly", _xAttributes
);
1445 ctx
.importBooleanProperty( "Dropdown", "spin", _xAttributes
);
1446 ctx
.importShortProperty( "LineCount", "linecount", _xAttributes
);
1447 ctx
.importAlignProperty( "Align", "align", _xAttributes
);
1448 bool bHasLinkedCell
= ctx
.importDataAwareProperty( "linked-cell" , _xAttributes
);
1449 bool bHasSrcRange
= ctx
.importDataAwareProperty( "source-cell-range" , _xAttributes
);
1452 MenuPopupElement
* p
= static_cast< MenuPopupElement
* >( _popup
.get() );
1453 if ( !bHasSrcRange
)
1454 xControlModel
->setPropertyValue( "StringItemList", makeAny( p
->getItemValues() ) );
1455 if ( !bHasLinkedCell
)
1456 xControlModel
->setPropertyValue( "SelectedItems", makeAny( p
->getSelectedItems() ) );
1459 ctx
.importEvents( _events
);
1460 // avoid ring-reference:
1461 // vector< event elements > holding event elements holding this (via _pParent)
1468 Reference
< xml::input::XElement
> ComboBoxElement::startChildElement(
1469 sal_Int32 nUid
, OUString
const & rLocalName
,
1470 Reference
< xml::input::XAttributes
> const & xAttributes
)
1471 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
1474 if (_pImport
->isEventElement( nUid
, rLocalName
))
1476 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
1478 else if (_pImport
->XMLNS_DIALOGS_UID
!= nUid
)
1480 throw xml::sax::SAXException( "illegal namespace!", Reference
< XInterface
>(), Any() );
1483 else if ( rLocalName
== "menupopup" )
1485 _popup
= new MenuPopupElement( rLocalName
, xAttributes
, this, _pImport
);
1490 throw xml::sax::SAXException( "expected event or menupopup element!", Reference
< XInterface
>(), Any() );
1493 void ComboBoxElement::endElement()
1494 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
1496 ControlImportContext
ctx( _pImport
, getControlId( _xAttributes
), getControlModelName( "com.sun.star.awt.UnoControlComboBoxModel", _xAttributes
) );
1497 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
1499 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
1502 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
1503 pStyle
->importBackgroundColorStyle( xControlModel
);
1504 pStyle
->importTextColorStyle( xControlModel
);
1505 pStyle
->importTextLineColorStyle( xControlModel
);
1506 pStyle
->importBorderStyle( xControlModel
);
1507 pStyle
->importFontStyle( xControlModel
);
1510 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
1511 ctx
.importBooleanProperty( "Tabstop", "tabstop", _xAttributes
);
1512 ctx
.importBooleanProperty( "ReadOnly", "readonly", _xAttributes
);
1513 ctx
.importBooleanProperty( "Autocomplete", "autocomplete", _xAttributes
);
1514 ctx
.importBooleanProperty( "Dropdown", "spin", _xAttributes
);
1515 ctx
.importBooleanProperty( "HideInactiveSelection", "hide-inactive-selection", _xAttributes
);
1516 ctx
.importShortProperty( "MaxTextLen", "maxlength" ,_xAttributes
);
1517 ctx
.importShortProperty( "LineCount", "linecount" ,_xAttributes
);
1518 ctx
.importStringProperty( "Text", "value", _xAttributes
);
1519 ctx
.importAlignProperty( "Align", "align", _xAttributes
);
1520 ctx
.importDataAwareProperty( "linked-cell" , _xAttributes
);
1521 bool bHasSrcRange
= ctx
.importDataAwareProperty( "source-cell-range" , _xAttributes
);
1522 if (_popup
.is() && !bHasSrcRange
)
1524 MenuPopupElement
* p
= static_cast< MenuPopupElement
* >( _popup
.get() );
1525 xControlModel
->setPropertyValue( "StringItemList", makeAny( p
->getItemValues() ) );
1528 ctx
.importEvents( _events
);
1529 // avoid ring-reference:
1530 // vector< event elements > holding event elements holding this (via _pParent)
1537 Reference
< xml::input::XElement
> CheckBoxElement::startChildElement(
1538 sal_Int32 nUid
, OUString
const & rLocalName
,
1539 Reference
< xml::input::XAttributes
> const & xAttributes
)
1540 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
1543 if (_pImport
->isEventElement( nUid
, rLocalName
))
1545 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
1549 throw xml::sax::SAXException( "expected event element!", Reference
< XInterface
>(), Any() );
1552 void CheckBoxElement::endElement()
1553 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
1555 ControlImportContext
ctx( _pImport
, getControlId( _xAttributes
), "com.sun.star.awt.UnoControlCheckBoxModel" );
1556 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
1558 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
1561 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
1562 pStyle
->importBackgroundColorStyle( xControlModel
);
1563 pStyle
->importTextColorStyle( xControlModel
);
1564 pStyle
->importTextLineColorStyle( xControlModel
);
1565 pStyle
->importFontStyle( xControlModel
);
1566 pStyle
->importVisualEffectStyle( xControlModel
);
1569 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
1570 ctx
.importBooleanProperty( "Tabstop", "tabstop", _xAttributes
);
1571 ctx
.importStringProperty( "Label", "value", _xAttributes
);
1572 ctx
.importAlignProperty( "Align", "align", _xAttributes
);
1573 ctx
.importVerticalAlignProperty( "VerticalAlign", "valign", _xAttributes
);
1574 ctx
.importImageURLProperty( "ImageURL" , "image-src" , _xAttributes
);
1575 ctx
.importImagePositionProperty( "ImagePosition", "image-position", _xAttributes
);
1576 ctx
.importBooleanProperty( "MultiLine", "multiline", _xAttributes
);
1578 sal_Bool bTriState
= sal_False
;
1579 if (getBoolAttr( &bTriState
, "tristate", _xAttributes
, _pImport
->XMLNS_DIALOGS_UID
))
1581 xControlModel
->setPropertyValue( "TriState", makeAny( bTriState
) );
1583 sal_Bool bChecked
= sal_False
;
1584 if (getBoolAttr( &bChecked
, "checked", _xAttributes
, _pImport
->XMLNS_DIALOGS_UID
))
1586 // has "checked" attribute
1587 sal_Int16 nVal
= (bChecked
? 1 : 0);
1588 xControlModel
->setPropertyValue( "State", makeAny( nVal
) );
1592 sal_Int16 nVal
= (bTriState
? 2 : 0); // if tristate set, but checked omitted => dont know!
1593 xControlModel
->setPropertyValue( "State", makeAny( nVal
) );
1596 ctx
.importEvents( _events
);
1597 // avoid ring-reference:
1598 // vector< event elements > holding event elements holding this (via _pParent)
1605 Reference
< xml::input::XElement
> ButtonElement::startChildElement(
1606 sal_Int32 nUid
, OUString
const & rLocalName
,
1607 Reference
< xml::input::XAttributes
> const & xAttributes
)
1608 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
1611 if (_pImport
->isEventElement( nUid
, rLocalName
))
1613 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
1617 throw xml::sax::SAXException( "expected event element!", Reference
< XInterface
>(), Any() );
1621 void ButtonElement::endElement()
1622 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
1624 ControlImportContext
ctx( _pImport
, getControlId( _xAttributes
), "com.sun.star.awt.UnoControlButtonModel" );
1626 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
1629 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
1630 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
1631 pStyle
->importBackgroundColorStyle( xControlModel
);
1632 pStyle
->importTextColorStyle( xControlModel
);
1633 pStyle
->importTextLineColorStyle( xControlModel
);
1634 pStyle
->importFontStyle( xControlModel
);
1637 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
1638 ctx
.importBooleanProperty( "Tabstop", "tabstop", _xAttributes
);
1639 ctx
.importStringProperty( "Label", "value", _xAttributes
);
1640 ctx
.importAlignProperty( "Align", "align", _xAttributes
);
1641 ctx
.importVerticalAlignProperty( "VerticalAlign", "valign", _xAttributes
);
1642 ctx
.importBooleanProperty( "DefaultButton", "default", _xAttributes
);
1643 ctx
.importButtonTypeProperty( "PushButtonType", "button-type", _xAttributes
);
1644 ctx
.importImageURLProperty( "ImageURL" , "image-src" , _xAttributes
);
1645 ctx
.importImagePositionProperty( "ImagePosition", "image-position", _xAttributes
);
1646 ctx
.importImageAlignProperty( "ImageAlign", "image-align", _xAttributes
);
1647 if (ctx
.importLongProperty( "RepeatDelay", "repeat", _xAttributes
))
1648 ctx
.getControlModel()->setPropertyValue( "Repeat", makeAny(true) );
1649 sal_Int32 toggled
= 0;
1650 if (getLongAttr( &toggled
, "toggled", _xAttributes
, _pImport
->XMLNS_DIALOGS_UID
) && toggled
== 1)
1651 ctx
.getControlModel()->setPropertyValue( "Toggle" , makeAny(true));
1652 ctx
.importBooleanProperty( "FocusOnClick", "grab-focus", _xAttributes
);
1653 ctx
.importBooleanProperty( "MultiLine", "multiline", _xAttributes
);
1655 sal_Bool bChecked
= sal_False
;
1656 if (getBoolAttr( &bChecked
, "checked", _xAttributes
, _pImport
->XMLNS_DIALOGS_UID
) && bChecked
)
1659 ctx
.getControlModel()->setPropertyValue( "State" , makeAny( nVal
) );
1662 ctx
.importEvents( _events
);
1663 // avoid ring-reference:
1664 // vector< event elements > holding event elements holding this (via _pParent)
1671 Reference
< xml::input::XElement
> BulletinBoardElement::startChildElement(
1672 sal_Int32 nUid
, OUString
const & rLocalName
,
1673 Reference
< xml::input::XAttributes
> const & xAttributes
)
1674 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
1676 if (_pImport
->XMLNS_DIALOGS_UID
!= nUid
)
1678 throw xml::sax::SAXException("illegal namespace!", Reference
< XInterface
>(), Any() );
1681 else if ( rLocalName
== "button" )
1683 return new ButtonElement( rLocalName
, xAttributes
, this, _pImport
);
1686 else if ( rLocalName
== "checkbox" )
1688 return new CheckBoxElement( rLocalName
, xAttributes
, this, _pImport
);
1691 else if ( rLocalName
== "combobox" )
1693 return new ComboBoxElement( rLocalName
, xAttributes
, this, _pImport
);
1696 else if ( rLocalName
== "menulist" )
1698 return new MenuListElement( rLocalName
, xAttributes
, this, _pImport
);
1701 else if ( rLocalName
== "radiogroup" )
1703 return new RadioGroupElement( rLocalName
, xAttributes
, this, _pImport
);
1706 else if ( rLocalName
== "titledbox" )
1708 return new TitledBoxElement( rLocalName
, xAttributes
, this, _pImport
);
1711 else if ( rLocalName
== "text" )
1713 return new TextElement( rLocalName
, xAttributes
, this, _pImport
);
1715 else if ( rLocalName
== "linklabel" )
1717 return new FixedHyperLinkElement( rLocalName
, xAttributes
, this, _pImport
);
1720 else if ( rLocalName
== "textfield" )
1722 return new TextFieldElement( rLocalName
, xAttributes
, this, _pImport
);
1725 else if ( rLocalName
== "img" )
1727 return new ImageControlElement( rLocalName
, xAttributes
, this, _pImport
);
1730 else if ( rLocalName
== "filecontrol" )
1732 return new FileControlElement( rLocalName
, xAttributes
, this, _pImport
);
1735 else if ( rLocalName
== "treecontrol" )
1737 return new TreeControlElement( rLocalName
, xAttributes
, this, _pImport
);
1740 else if ( rLocalName
== "currencyfield" )
1742 return new CurrencyFieldElement( rLocalName
, xAttributes
, this, _pImport
);
1745 else if ( rLocalName
== "datefield" )
1747 return new DateFieldElement( rLocalName
, xAttributes
, this, _pImport
);
1750 else if ( rLocalName
== "numericfield" )
1752 return new NumericFieldElement( rLocalName
, xAttributes
, this, _pImport
);
1755 else if ( rLocalName
== "timefield" )
1757 return new TimeFieldElement( rLocalName
, xAttributes
, this, _pImport
);
1760 else if ( rLocalName
== "patternfield" )
1762 return new PatternFieldElement( rLocalName
, xAttributes
, this, _pImport
);
1765 else if ( rLocalName
== "formattedfield" )
1767 return new FormattedFieldElement( rLocalName
, xAttributes
, this, _pImport
);
1770 else if ( rLocalName
== "fixedline" )
1772 return new FixedLineElement( rLocalName
, xAttributes
, this, _pImport
);
1775 else if ( rLocalName
== "scrollbar" )
1777 return new ScrollBarElement( rLocalName
, xAttributes
, this, _pImport
);
1780 else if ( rLocalName
== "spinbutton" )
1782 return new SpinButtonElement( rLocalName
, xAttributes
, this, _pImport
);
1785 else if ( rLocalName
== "progressmeter" )
1787 return new ProgressBarElement( rLocalName
, xAttributes
, this, _pImport
);
1789 else if ( rLocalName
== "multipage" )
1791 return new MultiPage( rLocalName
, xAttributes
, this, _pImport
);
1793 else if ( rLocalName
== "frame" )
1795 return new Frame( rLocalName
, xAttributes
, this, _pImport
);
1797 else if ( rLocalName
== "page" )
1799 return new Page( rLocalName
, xAttributes
, this, _pImport
);
1802 else if ( rLocalName
== "bulletinboard" )
1804 return new BulletinBoardElement( rLocalName
, xAttributes
, this, _pImport
);
1808 throw xml::sax::SAXException( "expected styles, bulletinboard or bulletinboard element, not: " + rLocalName
, Reference
< XInterface
>(), Any() );
1812 BulletinBoardElement::BulletinBoardElement(
1813 OUString
const & rLocalName
,
1814 Reference
< xml::input::XAttributes
> const & xAttributes
,
1815 ElementBase
* pParent
, DialogImport
* pImport
)
1816 : ControlElement( rLocalName
, xAttributes
, pParent
, pImport
)
1818 OUString
aValue( _xAttributes
->getValueByUidName( _pImport
->XMLNS_DIALOGS_UID
, "left" ) );
1819 if (!aValue
.isEmpty())
1821 _nBasePosX
+= toInt32( aValue
);
1823 aValue
= _xAttributes
->getValueByUidName( _pImport
->XMLNS_DIALOGS_UID
, "top" );
1824 if (!aValue
.isEmpty())
1826 _nBasePosY
+= toInt32( aValue
);
1831 Reference
< xml::input::XElement
> StyleElement::startChildElement(
1832 sal_Int32
/*nUid*/, OUString
const & /*rLocalName*/,
1833 Reference
< xml::input::XAttributes
> const & /*xAttributes*/ )
1834 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
1836 throw xml::sax::SAXException( "unexpected sub elements of style!", Reference
< XInterface
>(), Any() );
1839 void StyleElement::endElement()
1840 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
1842 Reference
< xml::input::XAttributes
> xStyle
;
1843 OUString
aStyleId( _xAttributes
->getValueByUidName( _pImport
->XMLNS_DIALOGS_UID
, "style-id" ) );
1844 if (!aStyleId
.isEmpty())
1846 _pImport
->addStyle( aStyleId
, this );
1850 throw xml::sax::SAXException( "missing style-id attribute!", Reference
< XInterface
>(), Any() );
1855 Reference
< xml::input::XElement
> StylesElement::startChildElement(
1856 sal_Int32 nUid
, OUString
const & rLocalName
,
1857 Reference
< xml::input::XAttributes
> const & xAttributes
)
1858 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
1860 if (_pImport
->XMLNS_DIALOGS_UID
!= nUid
)
1862 throw xml::sax::SAXException( "illegal namespace!", Reference
< XInterface
>(), Any() );
1865 else if ( rLocalName
== "style" )
1867 return new StyleElement( rLocalName
, xAttributes
, this, _pImport
);
1871 throw xml::sax::SAXException( "expected style element!", Reference
< XInterface
>(), Any() );
1876 Reference
< xml::input::XElement
> WindowElement::startChildElement(
1877 sal_Int32 nUid
, OUString
const & rLocalName
,
1878 Reference
< xml::input::XAttributes
> const & xAttributes
)
1879 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
1882 if (_pImport
->isEventElement( nUid
, rLocalName
))
1884 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
1886 else if (_pImport
->XMLNS_DIALOGS_UID
!= nUid
)
1888 throw xml::sax::SAXException( "illegal namespace!", Reference
< XInterface
>(), Any() );
1891 else if ( rLocalName
== "styles" )
1893 return new StylesElement( rLocalName
, xAttributes
, this, _pImport
);
1896 else if ( rLocalName
== "bulletinboard" )
1898 return new BulletinBoardElement( rLocalName
, xAttributes
, this, _pImport
);
1902 throw xml::sax::SAXException( "expected styles ot bulletinboard element!", Reference
< XInterface
>(), Any() );
1906 void WindowElement::endElement()
1907 throw (xml::sax::SAXException
, RuntimeException
, std::exception
)
1909 Reference
< beans::XPropertySet
> xProps(
1910 _pImport
->_xDialogModel
, UNO_QUERY_THROW
);
1911 ImportContext
ctx( _pImport
, xProps
, getControlId( _xAttributes
) );
1913 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
1916 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
1917 pStyle
->importBackgroundColorStyle( xProps
);
1918 pStyle
->importTextColorStyle( xProps
);
1919 pStyle
->importTextLineColorStyle( xProps
);
1920 pStyle
->importFontStyle( xProps
);
1923 ctx
.importDefaults( 0, 0, _xAttributes
, false );
1924 ctx
.importBooleanProperty( "Closeable", "closeable", _xAttributes
);
1925 ctx
.importBooleanProperty( "Moveable", "moveable", _xAttributes
);
1926 ctx
.importBooleanProperty("Sizeable", "resizeable", _xAttributes
);
1927 ctx
.importStringProperty("Title", "title", _xAttributes
);
1928 ctx
.importBooleanProperty("Decoration", "withtitlebar", _xAttributes
);
1929 ctx
.importImageURLProperty( "ImageURL" , "image-src" , _xAttributes
);
1930 ctx
.importScollableSettings( _xAttributes
);
1931 ctx
.importEvents( _events
);
1932 // avoid ring-reference:
1933 // vector< event elements > holding event elements holding this (via _pParent)
1939 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */