1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include "imp_share.hxx"
30 #include <com/sun/star/form/binding/XBindableValue.hpp>
31 #include <com/sun/star/form/binding/XValueBinding.hpp>
32 #include <com/sun/star/form/binding/XListEntrySink.hpp>
33 #include <com/sun/star/beans/NamedValue.hpp>
34 #include <com/sun/star/table/CellAddress.hpp>
35 #include <com/sun/star/table/CellRangeAddress.hpp>
36 #include <com/sun/star/beans/XPropertySet.hpp>
37 #include <com/sun/star/beans/XPropertyState.hpp>
38 #include <com/sun/star/document/XStorageBasedDocument.hpp>
39 #include <com/sun/star/document/XGraphicObjectResolver.hpp>
40 #include <com/sun/star/script/vba/XVBACompatibility.hpp>
42 #include <comphelper/componentcontext.hxx>
43 #include <comphelper/processfactory.hxx>
44 using namespace ::com::sun::star
;
45 using namespace ::com::sun::star::uno
;
46 using ::rtl::OUString
;
51 Reference
< xml::input::XElement
> Frame::startChildElement(
52 sal_Int32 nUid
, OUString
const & rLocalName
,
53 Reference
< xml::input::XAttributes
> const & xAttributes
)
54 throw (xml::sax::SAXException
, RuntimeException
)
56 if ( !m_xContainer
.is() )
57 m_xContainer
.set( _pImport
->_xDialogModelFactory
->createInstance( rtl::OUString( "com.sun.star.awt.UnoFrameModel" ) ), UNO_QUERY
);
59 if (_pImport
->isEventElement( nUid
, rLocalName
))
61 return new EventElement(
62 nUid
, rLocalName
, xAttributes
, this, _pImport
);
64 else if ( rLocalName
== "bulletinboard" )
66 // Create new DialogImport for this container
67 DialogImport
* pFrameImport
= new DialogImport( *_pImport
);
68 pFrameImport
->_xDialogModel
= m_xContainer
;
69 return new BulletinBoardElement( rLocalName
, xAttributes
, this, pFrameImport
);
71 else if ( rLocalName
== "title" )
73 getStringAttr( &_label
,
76 _pImport
->XMLNS_DIALOGS_UID
);
78 return new ElementBase(
79 _pImport
->XMLNS_DIALOGS_UID
,
80 rLocalName
, xAttributes
, this, _pImport
);
84 OSL_TRACE("****** ARGGGGG!!!! **********");
85 throw xml::sax::SAXException(
86 OUString( "expected event element!" ),
87 Reference
< XInterface
>(), Any() );
90 //__________________________________________________________________________________________________
92 void Frame::endElement()
93 throw (xml::sax::SAXException
, RuntimeException
)
95 if ( !m_xContainer
.is() )
96 m_xContainer
.set( _pImport
->_xDialogModelFactory
->createInstance( rtl::OUString( "com.sun.star.awt.UnoFrameModel" ) ), UNO_QUERY
);
97 Reference
< beans::XPropertySet
> xProps( m_xContainer
, UNO_QUERY_THROW
);
98 // _pImport is what we need to add to ( e.g. the dialog in this case )
99 ControlImportContext
ctx( _pImport
, xProps
, getControlId( _xAttributes
) );
101 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
103 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
106 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
107 pStyle
->importTextColorStyle( xControlModel
);
108 pStyle
->importTextLineColorStyle( xControlModel
);
109 pStyle
->importFontStyle( xControlModel
);
112 ctx
.importDefaults( 0, 0, _xAttributes
); // inherited from BulletinBoardElement
113 if (!_label
.isEmpty())
115 xControlModel
->setPropertyValue( OUString( "Label" ),
118 ctx
.importEvents( _events
);
119 // avoid ring-reference:
120 // vector< event elements > holding event elements holding this (via _pParent)
125 Reference
< xml::input::XElement
> MultiPage::startChildElement(
126 sal_Int32 nUid
, OUString
const & rLocalName
,
127 Reference
< xml::input::XAttributes
> const & xAttributes
)
128 throw (xml::sax::SAXException
, RuntimeException
)
131 if (_pImport
->isEventElement( nUid
, rLocalName
))
133 return new EventElement(
134 nUid
, rLocalName
, xAttributes
, this, _pImport
);
136 else if ( rLocalName
== "bulletinboard" )
138 // Create new DialogImport for this container
140 DialogImport
* pMultiPageImport
= new DialogImport( *_pImport
);
141 pMultiPageImport
->_xDialogModel
= m_xContainer
;
142 return new BulletinBoardElement( rLocalName
, xAttributes
, this, pMultiPageImport
);
147 throw xml::sax::SAXException(
148 OUString( "expected event element!" ),
149 Reference
< XInterface
>(), Any() );
152 //__________________________________________________________________________________________________
154 void MultiPage::endElement()
155 throw (xml::sax::SAXException
, RuntimeException
)
157 Reference
< beans::XPropertySet
> xProps( m_xContainer
, UNO_QUERY_THROW
);
158 // _pImport is what we need to add to ( e.g. the dialog in this case )
159 ControlImportContext
ctx( _pImport
, xProps
, getControlId( _xAttributes
));
161 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
163 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
166 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
167 pStyle
->importTextColorStyle( xControlModel
);
168 pStyle
->importTextLineColorStyle( xControlModel
);
169 pStyle
->importFontStyle( xControlModel
);
170 pStyle
->importBackgroundColorStyle( xControlModel
);
173 ctx
.importDefaults( 0, 0, _xAttributes
); // inherited from BulletinBoardElement
174 ctx
.importLongProperty( OUString( "MultiPageValue" ),
177 ctx
.importBooleanProperty(
178 OUString( "Decoration" ),
179 OUString( "withtabs" ),
181 ctx
.importEvents( _events
);
182 // avoid ring-reference:
183 // vector< event elements > holding event elements holding this (via _pParent)
187 Reference
< xml::input::XElement
> Page::startChildElement(
188 sal_Int32 nUid
, OUString
const & rLocalName
,
189 Reference
< xml::input::XAttributes
> const & xAttributes
)
190 throw (xml::sax::SAXException
, RuntimeException
)
193 if (_pImport
->isEventElement( nUid
, rLocalName
))
195 return new EventElement(
196 nUid
, rLocalName
, xAttributes
, this, _pImport
);
198 else if ( rLocalName
== "bulletinboard" )
201 DialogImport
* pPageImport
= new DialogImport( *_pImport
);
202 pPageImport
->_xDialogModel
= m_xContainer
;
203 return new BulletinBoardElement( rLocalName
, xAttributes
, this, pPageImport
);
208 throw xml::sax::SAXException(
209 OUString( "expected event element!" ),
210 Reference
< XInterface
>(), Any() );
213 //__________________________________________________________________________________________________
215 void Page::endElement()
216 throw (xml::sax::SAXException
, RuntimeException
)
218 Reference
< beans::XPropertySet
> xProps( m_xContainer
, UNO_QUERY_THROW
);
220 ControlImportContext
ctx( _pImport
, xProps
, getControlId( _xAttributes
));
222 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
224 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
227 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
228 pStyle
->importTextColorStyle( xControlModel
);
229 pStyle
->importTextLineColorStyle( xControlModel
);
230 pStyle
->importFontStyle( xControlModel
);
231 pStyle
->importBackgroundColorStyle( xControlModel
);
234 ctx
.importDefaults( 0, 0, _xAttributes
); // inherited from BulletinBoardElement
235 ctx
.importStringProperty( OUString( "Title" ), OUString( "title" ), _xAttributes
);
236 ctx
.importEvents( _events
);
237 // avoid ring-reference:
238 // vector< event elements > holding event elements holding this (via _pParent)
243 //__________________________________________________________________________________________________
244 Reference
< xml::input::XElement
> ProgressBarElement::startChildElement(
245 sal_Int32 nUid
, OUString
const & rLocalName
,
246 Reference
< xml::input::XAttributes
> const & xAttributes
)
247 throw (xml::sax::SAXException
, RuntimeException
)
250 if (_pImport
->isEventElement( nUid
, rLocalName
))
252 return new EventElement(
253 nUid
, rLocalName
, xAttributes
, this, _pImport
);
257 throw xml::sax::SAXException(
258 OUString( "expected event element!" ),
259 Reference
< XInterface
>(), Any() );
262 //__________________________________________________________________________________________________
263 void ProgressBarElement::endElement()
264 throw (xml::sax::SAXException
, RuntimeException
)
266 ControlImportContext
ctx(
267 _pImport
, getControlId( _xAttributes
),
268 OUString( "com.sun.star.awt.UnoControlProgressBarModel" ) );
270 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
273 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
274 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
275 pStyle
->importBackgroundColorStyle( xControlModel
);
276 pStyle
->importBorderStyle( xControlModel
);
277 pStyle
->importFillColorStyle( xControlModel
);
280 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
281 ctx
.importLongProperty( OUString( "ProgressValue" ),
284 ctx
.importLongProperty( OUString( "ProgressValueMin" ),
285 OUString( "value-min" ),
287 ctx
.importLongProperty( OUString( "ProgressValueMax" ),
288 OUString( "value-max" ),
290 ctx
.importEvents( _events
);
291 // avoid ring-reference:
292 // vector< event elements > holding event elements holding this (via _pParent)
296 //##################################################################################################
299 //__________________________________________________________________________________________________
300 Reference
< xml::input::XElement
> ScrollBarElement::startChildElement(
301 sal_Int32 nUid
, OUString
const & rLocalName
,
302 Reference
< xml::input::XAttributes
> const & xAttributes
)
303 throw (xml::sax::SAXException
, RuntimeException
)
306 if (_pImport
->isEventElement( nUid
, rLocalName
))
308 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
312 throw xml::sax::SAXException(
313 OUString( "expected event element!" ),
314 Reference
< XInterface
>(), Any() );
317 //__________________________________________________________________________________________________
318 void ScrollBarElement::endElement()
319 throw (xml::sax::SAXException
, RuntimeException
)
321 ControlImportContext
ctx(
322 _pImport
, getControlId( _xAttributes
),
323 getControlModelName( OUString( "com.sun.star.awt.UnoControlScrollBarModel" ), _xAttributes
) );
325 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
328 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
329 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
330 pStyle
->importBackgroundColorStyle( xControlModel
);
331 pStyle
->importBorderStyle( xControlModel
);
334 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
335 ctx
.importOrientationProperty( OUString( "Orientation" ),
338 ctx
.importLongProperty( OUString( "BlockIncrement" ),
339 OUString( "pageincrement" ),
341 ctx
.importLongProperty( OUString( "LineIncrement" ),
342 OUString( "increment" ),
344 ctx
.importLongProperty( OUString( "ScrollValue" ),
345 OUString( "curpos" ),
347 ctx
.importLongProperty( OUString( "ScrollValueMax" ),
348 OUString( "maxpos" ),
350 ctx
.importLongProperty( OUSTR("ScrollValueMin"), OUSTR("minpos"),
352 ctx
.importLongProperty( OUString( "VisibleSize" ),
353 OUString( "visible-size" ),
355 ctx
.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
357 ctx
.importBooleanProperty( OUString( "Tabstop" ),
358 OUString( "tabstop" ),
360 ctx
.importBooleanProperty( OUString( "LiveScroll" ),
361 OUString( "live-scroll" ),
363 ctx
.importHexLongProperty( OUString( "SymbolColor" ),
364 OUString( "symbol-color" ),
367 ctx
.importDataAwareProperty( OUSTR("linked-cell" ), _xAttributes
);
368 ctx
.importEvents( _events
);
369 // avoid ring-reference:
370 // vector< event elements > holding event elements holding this (via _pParent)
374 //##################################################################################################
377 //__________________________________________________________________________________________________
378 Reference
< xml::input::XElement
> SpinButtonElement::startChildElement(
379 sal_Int32 nUid
, OUString
const & rLocalName
,
380 Reference
< xml::input::XAttributes
> const & xAttributes
)
381 throw (xml::sax::SAXException
, RuntimeException
)
384 if (_pImport
->isEventElement( nUid
, rLocalName
))
386 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
390 throw xml::sax::SAXException(
391 OUString( "expected event element!" ),
392 Reference
< XInterface
>(), Any() );
395 //__________________________________________________________________________________________________
396 void SpinButtonElement::endElement()
397 throw (xml::sax::SAXException
, RuntimeException
)
399 ControlImportContext
ctx(
400 _pImport
, getControlId( _xAttributes
),
401 getControlModelName( OUString( "com.sun.star.awt.UnoControlSpinButtonModel" ), _xAttributes
) );
403 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
406 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
407 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
408 pStyle
->importBackgroundColorStyle( xControlModel
);
409 pStyle
->importBorderStyle( xControlModel
);
412 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
413 ctx
.importOrientationProperty( OUString( "Orientation" ),
416 ctx
.importLongProperty( OUString( "SpinIncrement" ),
417 OUString( "increment" ),
419 ctx
.importLongProperty( OUString( "SpinValue" ),
420 OUString( "curval" ),_xAttributes
);
421 ctx
.importLongProperty( OUString( "SpinValueMax" ),
422 OUString( "maxval" ), _xAttributes
);
423 ctx
.importLongProperty( OUSTR("SpinValueMin"), OUSTR("minval"),
425 ctx
.importLongProperty( OUSTR("Repeat"), OUSTR("repeat"), _xAttributes
);
426 ctx
.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat-delay"),
428 ctx
.importBooleanProperty( OUString( "Tabstop" ),
429 OUString( "tabstop" ), _xAttributes
);
430 ctx
.importHexLongProperty( OUString( "SymbolColor" ),
431 OUString( "symbol-color" ), _xAttributes
);
432 ctx
.importDataAwareProperty( OUSTR("linked-cell" ), _xAttributes
);
433 ctx
.importEvents( _events
);
434 // avoid ring-reference:
435 // vector< event elements > holding event elements holding this (via _pParent)
439 //##################################################################################################
442 //__________________________________________________________________________________________________
443 Reference
< xml::input::XElement
> FixedLineElement::startChildElement(
444 sal_Int32 nUid
, OUString
const & rLocalName
,
445 Reference
< xml::input::XAttributes
> const & xAttributes
)
446 throw (xml::sax::SAXException
, RuntimeException
)
449 if (_pImport
->isEventElement( nUid
, rLocalName
))
451 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
455 throw xml::sax::SAXException(
456 OUString( "expected event element!" ),
457 Reference
< XInterface
>(), Any() );
460 //__________________________________________________________________________________________________
461 void FixedLineElement::endElement()
462 throw (xml::sax::SAXException
, RuntimeException
)
464 ControlImportContext
ctx(
465 _pImport
, getControlId( _xAttributes
),
466 OUString( "com.sun.star.awt.UnoControlFixedLineModel" ) );
468 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
471 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
472 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
473 pStyle
->importTextColorStyle( xControlModel
);
474 pStyle
->importTextLineColorStyle( xControlModel
);
475 pStyle
->importFontStyle( xControlModel
);
478 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
479 ctx
.importStringProperty( OUString( "Label" ),
482 ctx
.importOrientationProperty( OUString( "Orientation" ),
485 ctx
.importEvents( _events
);
486 // avoid ring-reference:
487 // vector< event elements > holding event elements holding this (via _pParent)
491 //##################################################################################################
494 //__________________________________________________________________________________________________
495 Reference
< xml::input::XElement
> PatternFieldElement::startChildElement(
496 sal_Int32 nUid
, OUString
const & rLocalName
,
497 Reference
< xml::input::XAttributes
> const & xAttributes
)
498 throw (xml::sax::SAXException
, RuntimeException
)
501 if (_pImport
->isEventElement( nUid
, rLocalName
))
503 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
507 throw xml::sax::SAXException(
508 OUString( "expected event element!" ),
509 Reference
< XInterface
>(), Any() );
512 //__________________________________________________________________________________________________
513 void PatternFieldElement::endElement()
514 throw (xml::sax::SAXException
, RuntimeException
)
516 ControlImportContext
ctx(
517 _pImport
, getControlId( _xAttributes
),
518 OUString( "com.sun.star.awt.UnoControlPatternFieldModel" ) );
520 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
523 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
524 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
525 pStyle
->importBackgroundColorStyle( xControlModel
);
526 pStyle
->importTextColorStyle( xControlModel
);
527 pStyle
->importTextLineColorStyle( xControlModel
);
528 pStyle
->importBorderStyle( xControlModel
);
529 pStyle
->importFontStyle( xControlModel
);
532 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
533 ctx
.importBooleanProperty( OUString( "Tabstop" ),
534 OUString( "tabstop" ),
536 ctx
.importBooleanProperty( OUString( "ReadOnly" ),
537 OUString( "readonly" ),
539 ctx
.importBooleanProperty( OUString( "StrictFormat" ),
540 OUString( "strict-format" ),
542 ctx
.importBooleanProperty(
543 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
545 ctx
.importStringProperty( OUString( "Text" ),
548 ctx
.importShortProperty( OUString( "MaxTextLen" ),
549 OUString( "maxlength" ),
551 ctx
.importStringProperty( OUString( "EditMask" ),
552 OUString( "edit-mask" ),
554 ctx
.importStringProperty( OUString( "LiteralMask" ),
555 OUString( "literal-mask" ),
557 ctx
.importEvents( _events
);
558 // avoid ring-reference:
559 // vector< event elements > holding event elements holding this (via _pParent)
563 //##################################################################################################
566 //__________________________________________________________________________________________________
567 Reference
< xml::input::XElement
> FormattedFieldElement::startChildElement(
568 sal_Int32 nUid
, OUString
const & rLocalName
,
569 Reference
< xml::input::XAttributes
> const & xAttributes
)
570 throw (xml::sax::SAXException
, RuntimeException
)
573 if (_pImport
->isEventElement( nUid
, rLocalName
))
575 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
579 throw xml::sax::SAXException(
580 OUString( "expected event element!" ),
581 Reference
< XInterface
>(), Any() );
584 //__________________________________________________________________________________________________
585 void FormattedFieldElement::endElement()
586 throw (xml::sax::SAXException
, RuntimeException
)
588 ControlImportContext
ctx(
589 _pImport
, getControlId( _xAttributes
),
590 OUString( "com.sun.star.awt.UnoControlFormattedFieldModel" ) );
592 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
595 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
596 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
597 pStyle
->importBackgroundColorStyle( xControlModel
);
598 pStyle
->importTextColorStyle( xControlModel
);
599 pStyle
->importTextLineColorStyle( xControlModel
);
600 pStyle
->importBorderStyle( xControlModel
);
601 pStyle
->importFontStyle( xControlModel
);
604 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
605 ctx
.importBooleanProperty( OUString( "Tabstop" ),
606 OUString( "tabstop" ),
608 ctx
.importBooleanProperty( OUString( "ReadOnly" ),
609 OUString( "readonly" ),
611 ctx
.importBooleanProperty( OUString( "StrictFormat" ),
612 OUString( "strict-format" ),
614 ctx
.importBooleanProperty(
615 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
617 ctx
.importAlignProperty( OUString( "Align" ),
620 ctx
.importDoubleProperty( OUString( "EffectiveMin" ),
621 OUString( "value-min" ),
623 ctx
.importDoubleProperty( OUString( "EffectiveMax" ),
624 OUString( "value-max" ),
626 ctx
.importDoubleProperty( OUString( "EffectiveValue" ),
629 ctx
.importStringProperty( OUString( "Text" ),
632 ctx
.importShortProperty( OUString( "MaxTextLen" ),
633 OUString( "maxlength" ),
635 ctx
.importBooleanProperty( OUString( "Spin" ),
638 if (ctx
.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
640 ctx
.getControlModel()->setPropertyValue(
641 OUSTR("Repeat"), makeAny(true) );
644 _xAttributes
->getValueByUidName(
645 _pImport
->XMLNS_DIALOGS_UID
,
646 OUString( "value-default" ) ) );
647 if (!sDefault
.isEmpty())
649 double d
= sDefault
.toDouble();
651 sDefault
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("0") ) ||
652 sDefault
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("0.0") ))
654 ctx
.getControlModel()->setPropertyValue(
655 OUString( "EffectiveDefault" ),
658 else // treat as string
660 ctx
.getControlModel()->setPropertyValue(
661 OUString( "EffectiveDefault" ),
662 makeAny( sDefault
) );
667 ctx
.getControlModel()->setPropertyValue(
668 OUString( "FormatsSupplier" ),
669 makeAny( _pImport
->getNumberFormatsSupplier() ) );
672 _xAttributes
->getValueByUidName(
673 _pImport
->XMLNS_DIALOGS_UID
,
674 OUString( "format-code" ) ) );
675 if (!sFormat
.isEmpty())
680 _xAttributes
->getValueByUidName(
681 _pImport
->XMLNS_DIALOGS_UID
,
682 OUString( "format-locale" ) ) );
683 if (!sLocale
.isEmpty())
686 sal_Int32 semi0
= sLocale
.indexOf( ';' );
687 if (semi0
< 0) // no semi at all, just try language
689 locale
.Language
= sLocale
;
693 sal_Int32 semi1
= sLocale
.indexOf( ';', semi0
+1 );
694 if (semi1
> semi0
) // language;country;variant
696 locale
.Language
= sLocale
.copy( 0, semi0
);
697 locale
.Country
= sLocale
.copy( semi0
+1, semi1
- semi0
-1 );
698 locale
.Variant
= sLocale
.copy( semi1
+1 );
700 else // try language;country
702 locale
.Language
= sLocale
.copy( 0, semi0
);
703 locale
.Country
= sLocale
.copy( semi0
+1 );
710 Reference
< util::XNumberFormats
> xFormats(
711 _pImport
->getNumberFormatsSupplier()->getNumberFormats() );
712 sal_Int32 nKey
= xFormats
->queryKey( sFormat
, locale
, sal_True
);
715 nKey
= xFormats
->addNew( sFormat
, locale
);
717 ctx
.getControlModel()->setPropertyValue(
718 OUString( "FormatKey" ), makeAny( nKey
) );
720 catch (const util::MalformedNumberFormatException
& exc
)
722 OSL_FAIL( "### util::MalformedNumberFormatException occurred!" );
724 throw xml::sax::SAXException( exc
.Message
, Reference
< XInterface
>(), Any() );
727 ctx
.importBooleanProperty(
728 OUString( "TreatAsNumber" ),
729 OUString( "treat-as-number" ),
731 ctx
.importBooleanProperty( OUString( "EnforceFormat" ),
732 OUString( "enforce-format" ),
735 ctx
.importDataAwareProperty( OUSTR("linked-cell" ), _xAttributes
);
736 ctx
.importEvents( _events
);
737 // avoid ring-reference:
738 // vector< event elements > holding event elements holding this (via _pParent)
742 //##################################################################################################
745 //__________________________________________________________________________________________________
746 Reference
< xml::input::XElement
> TimeFieldElement::startChildElement(
747 sal_Int32 nUid
, OUString
const & rLocalName
,
748 Reference
< xml::input::XAttributes
> const & xAttributes
)
749 throw (xml::sax::SAXException
, RuntimeException
)
752 if (_pImport
->isEventElement( nUid
, rLocalName
))
754 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
758 throw xml::sax::SAXException(
759 OUString( "expected event element!" ),
760 Reference
< XInterface
>(), Any() );
763 //__________________________________________________________________________________________________
764 void TimeFieldElement::endElement()
765 throw (xml::sax::SAXException
, RuntimeException
)
767 ControlImportContext
ctx(
768 _pImport
, getControlId( _xAttributes
),
769 OUString( "com.sun.star.awt.UnoControlTimeFieldModel" ) );
771 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
774 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
775 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
776 pStyle
->importBackgroundColorStyle( xControlModel
);
777 pStyle
->importTextColorStyle( xControlModel
);
778 pStyle
->importTextLineColorStyle( xControlModel
);
779 pStyle
->importBorderStyle( xControlModel
);
780 pStyle
->importFontStyle( xControlModel
);
783 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
784 ctx
.importBooleanProperty( OUString( "Tabstop" ),
785 OUString( "tabstop" ),
787 ctx
.importBooleanProperty( OUString( "ReadOnly" ),
788 OUString( "readonly" ),
790 ctx
.importBooleanProperty( OUString( "StrictFormat" ),
791 OUString( "strict-format" ),
793 ctx
.importBooleanProperty(
794 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
796 ctx
.importTimeFormatProperty( OUString( "TimeFormat" ),
797 OUString( "time-format" ),
799 ctx
.importLongProperty( OUString( "Time" ),
802 ctx
.importLongProperty( OUString( "TimeMin" ),
803 OUString( "value-min" ),
805 ctx
.importLongProperty( OUString( "TimeMax" ),
806 OUString( "value-max" ),
808 ctx
.importBooleanProperty( OUString( "Spin" ),
811 if (ctx
.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
813 ctx
.getControlModel()->setPropertyValue(
814 OUSTR("Repeat"), makeAny(true) );
815 ctx
.importStringProperty( OUString( "Text" ),
818 ctx
.importBooleanProperty( OUString( "EnforceFormat" ),
819 OUString( "enforce-format" ),
822 ctx
.importEvents( _events
);
823 // avoid ring-reference:
824 // vector< event elements > holding event elements holding this (via _pParent)
828 //##################################################################################################
831 //__________________________________________________________________________________________________
832 Reference
< xml::input::XElement
> NumericFieldElement::startChildElement(
833 sal_Int32 nUid
, OUString
const & rLocalName
,
834 Reference
< xml::input::XAttributes
> const & xAttributes
)
835 throw (xml::sax::SAXException
, RuntimeException
)
838 if (_pImport
->isEventElement( nUid
, rLocalName
))
840 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
844 throw xml::sax::SAXException(
845 OUString( "expected event element!" ),
846 Reference
< XInterface
>(), Any() );
849 //__________________________________________________________________________________________________
850 void NumericFieldElement::endElement()
851 throw (xml::sax::SAXException
, RuntimeException
)
853 ControlImportContext
ctx(
854 _pImport
, getControlId( _xAttributes
),
855 OUString( "com.sun.star.awt.UnoControlNumericFieldModel" ) );
857 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
860 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
861 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
862 pStyle
->importBackgroundColorStyle( xControlModel
);
863 pStyle
->importTextColorStyle( xControlModel
);
864 pStyle
->importTextLineColorStyle( xControlModel
);
865 pStyle
->importBorderStyle( xControlModel
);
866 pStyle
->importFontStyle( xControlModel
);
869 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
870 ctx
.importBooleanProperty( OUString( "Tabstop" ),
871 OUString( "tabstop" ),
873 ctx
.importBooleanProperty( OUString( "ReadOnly" ),
874 OUString( "readonly" ),
876 ctx
.importBooleanProperty( OUString( "StrictFormat" ),
877 OUString( "strict-format" ),
879 ctx
.importBooleanProperty(
880 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
882 ctx
.importShortProperty( OUString( "DecimalAccuracy" ),
883 OUString( "decimal-accuracy" ),
885 ctx
.importBooleanProperty( OUString( "ShowThousandsSeparator" ),
886 OUString( "thousands-separator" ),
888 ctx
.importDoubleProperty( OUString( "Value" ),
891 ctx
.importDoubleProperty( OUString( "ValueMin" ),
892 OUString( "value-min" ),
894 ctx
.importDoubleProperty( OUString( "ValueMax" ),
895 OUString( "value-max" ),
897 ctx
.importDoubleProperty( OUString( "ValueStep" ),
898 OUString( "value-step" ),
900 ctx
.importBooleanProperty( OUString( "Spin" ),
903 if (ctx
.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
905 ctx
.getControlModel()->setPropertyValue(
906 OUSTR("Repeat"), makeAny(true) );
907 ctx
.importBooleanProperty( OUString( "EnforceFormat" ),
908 OUString( "enforce-format" ),
910 ctx
.importEvents( _events
);
911 // avoid ring-reference:
912 // vector< event elements > holding event elements holding this (via _pParent)
916 //##################################################################################################
919 //__________________________________________________________________________________________________
920 Reference
< xml::input::XElement
> DateFieldElement::startChildElement(
921 sal_Int32 nUid
, OUString
const & rLocalName
,
922 Reference
< xml::input::XAttributes
> const & xAttributes
)
923 throw (xml::sax::SAXException
, RuntimeException
)
926 if (_pImport
->isEventElement( nUid
, rLocalName
))
928 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
932 throw xml::sax::SAXException(
933 OUString( "expected event element!" ),
934 Reference
< XInterface
>(), Any() );
937 //__________________________________________________________________________________________________
938 void DateFieldElement::endElement()
939 throw (xml::sax::SAXException
, RuntimeException
)
941 ControlImportContext
ctx(
942 _pImport
, getControlId( _xAttributes
),
943 OUString( "com.sun.star.awt.UnoControlDateFieldModel" ) );
945 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
948 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
949 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
950 pStyle
->importBackgroundColorStyle( xControlModel
);
951 pStyle
->importTextColorStyle( xControlModel
);
952 pStyle
->importTextLineColorStyle( xControlModel
);
953 pStyle
->importBorderStyle( xControlModel
);
954 pStyle
->importFontStyle( xControlModel
);
957 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
958 ctx
.importBooleanProperty( OUString( "Tabstop" ),
959 OUString( "tabstop" ),
961 ctx
.importBooleanProperty( OUString( "ReadOnly" ),
962 OUString( "readonly" ),
964 ctx
.importBooleanProperty( OUString( "StrictFormat" ),
965 OUString( "strict-format" ),
967 ctx
.importBooleanProperty(
968 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
970 ctx
.importDateFormatProperty( OUString( "DateFormat" ),
971 OUString( "date-format" ),
973 ctx
.importBooleanProperty( OUString( "DateShowCentury" ),
974 OUString( "show-century" ),
976 ctx
.importLongProperty( OUString( "Date" ),
979 ctx
.importLongProperty( OUString( "DateMin" ),
980 OUString( "value-min" ),
982 ctx
.importLongProperty( OUString( "DateMax" ),
983 OUString( "value-max" ),
985 ctx
.importBooleanProperty( OUString( "Spin" ),
988 if (ctx
.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
990 ctx
.getControlModel()->setPropertyValue(
991 OUSTR("Repeat"), makeAny(true) );
992 ctx
.importBooleanProperty( OUString( "Dropdown" ),
993 OUString( "dropdown" ),
995 ctx
.importStringProperty( OUString( "Text" ),
998 ctx
.importBooleanProperty( OUString( "EnforceFormat" ),
999 OUString( "enforce-format" ),
1001 ctx
.importEvents( _events
);
1002 // avoid ring-reference:
1003 // vector< event elements > holding event elements holding this (via _pParent)
1007 //##################################################################################################
1010 //__________________________________________________________________________________________________
1011 Reference
< xml::input::XElement
> CurrencyFieldElement::startChildElement(
1012 sal_Int32 nUid
, OUString
const & rLocalName
,
1013 Reference
< xml::input::XAttributes
> const & xAttributes
)
1014 throw (xml::sax::SAXException
, RuntimeException
)
1017 if (_pImport
->isEventElement( nUid
, rLocalName
))
1019 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
1023 throw xml::sax::SAXException(
1024 OUString( "expected event element!" ),
1025 Reference
< XInterface
>(), Any() );
1028 //__________________________________________________________________________________________________
1029 void CurrencyFieldElement::endElement()
1030 throw (xml::sax::SAXException
, RuntimeException
)
1032 ControlImportContext
ctx(
1033 _pImport
, getControlId( _xAttributes
),
1034 OUString( "com.sun.star.awt.UnoControlCurrencyFieldModel" ) );
1036 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
1039 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
1040 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
1041 pStyle
->importBackgroundColorStyle( xControlModel
);
1042 pStyle
->importTextColorStyle( xControlModel
);
1043 pStyle
->importTextLineColorStyle( xControlModel
);
1044 pStyle
->importBorderStyle( xControlModel
);
1045 pStyle
->importFontStyle( xControlModel
);
1048 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
1049 ctx
.importBooleanProperty( OUString( "Tabstop" ),
1050 OUString( "tabstop" ),
1052 ctx
.importBooleanProperty( OUString( "ReadOnly" ),
1053 OUString( "readonly" ),
1055 ctx
.importBooleanProperty( OUString( "StrictFormat" ),
1056 OUString( "strict-format" ),
1058 ctx
.importBooleanProperty(
1059 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
1061 ctx
.importStringProperty( OUString( "CurrencySymbol" ),
1062 OUString( "currency-symbol" ),
1064 ctx
.importShortProperty( OUString( "DecimalAccuracy" ),
1065 OUString( "decimal-accuracy" ),
1067 ctx
.importBooleanProperty( OUString( "ShowThousandsSeparator" ),
1068 OUString( "thousands-separator" ),
1070 ctx
.importDoubleProperty( OUString( "Value" ),
1071 OUString( "value" ),
1073 ctx
.importDoubleProperty( OUString( "ValueMin" ),
1074 OUString( "value-min" ),
1076 ctx
.importDoubleProperty( OUString( "ValueMax" ),
1077 OUString( "value-max" ),
1079 ctx
.importDoubleProperty( OUString( "ValueStep" ),
1080 OUString( "value-step" ),
1082 ctx
.importBooleanProperty( OUString( "Spin" ),
1085 if (ctx
.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
1087 ctx
.getControlModel()->setPropertyValue(
1088 OUSTR("Repeat"), makeAny(true) );
1089 ctx
.importBooleanProperty( OUString( "PrependCurrencySymbol" ),
1090 OUString( "prepend-symbol" ),
1092 ctx
.importBooleanProperty( OUString( "EnforceFormat" ),
1093 OUString( "enforce-format" ),
1095 ctx
.importEvents( _events
);
1096 // avoid ring-reference:
1097 // vector< event elements > holding event elements holding this (via _pParent)
1101 //##################################################################################################
1104 //__________________________________________________________________________________________________
1105 Reference
< xml::input::XElement
> FileControlElement::startChildElement(
1106 sal_Int32 nUid
, OUString
const & rLocalName
,
1107 Reference
< xml::input::XAttributes
> const & xAttributes
)
1108 throw (xml::sax::SAXException
, RuntimeException
)
1111 if (_pImport
->isEventElement( nUid
, rLocalName
))
1113 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
1117 throw xml::sax::SAXException(
1118 OUString( "expected event element!" ),
1119 Reference
< XInterface
>(), Any() );
1122 //__________________________________________________________________________________________________
1123 void FileControlElement::endElement()
1124 throw (xml::sax::SAXException
, RuntimeException
)
1126 ControlImportContext
ctx(
1127 _pImport
, getControlId( _xAttributes
),
1128 OUString( "com.sun.star.awt.UnoControlFileControlModel" ) );
1130 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
1133 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
1134 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
1135 pStyle
->importBackgroundColorStyle( xControlModel
);
1136 pStyle
->importTextColorStyle( xControlModel
);
1137 pStyle
->importTextLineColorStyle( xControlModel
);
1138 pStyle
->importBorderStyle( xControlModel
);
1139 pStyle
->importFontStyle( xControlModel
);
1142 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
1143 ctx
.importBooleanProperty( OUString( "Tabstop" ),
1144 OUString( "tabstop" ),
1146 ctx
.importBooleanProperty(
1147 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
1149 ctx
.importStringProperty( OUString( "Text" ),
1150 OUString( "value" ),
1152 ctx
.importBooleanProperty( OUString( "ReadOnly" ),
1153 OUString( "readonly" ),
1155 ctx
.importEvents( _events
);
1156 // avoid ring-reference:
1157 // vector< event elements > holding event elements holding this (via _pParent)
1160 //##################################################################################################
1163 //__________________________________________________________________________________________________
1164 Reference
< xml::input::XElement
> TreeControlElement::startChildElement(
1165 sal_Int32 nUid
, OUString
const & rLocalName
,
1166 Reference
< xml::input::XAttributes
> const & xAttributes
)
1167 throw (xml::sax::SAXException
, RuntimeException
)
1170 if (_pImport
->isEventElement( nUid
, rLocalName
))
1172 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
1176 throw xml::sax::SAXException(
1177 OUString( "expected event element!" ),
1178 Reference
< XInterface
>(), Any() );
1181 //__________________________________________________________________________________________________
1182 void TreeControlElement::endElement()
1183 throw (xml::sax::SAXException
, RuntimeException
)
1185 ControlImportContext
ctx(
1186 _pImport
, getControlId( _xAttributes
),
1187 OUString( "com.sun.star.awt.tree.TreeControlModel" ) );
1189 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
1192 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
1193 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
1194 pStyle
->importBackgroundColorStyle( xControlModel
);
1195 pStyle
->importBorderStyle( xControlModel
);
1198 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
1199 ctx
.importBooleanProperty( OUString( "Tabstop" ),
1200 OUString( "tabstop" ),
1202 ctx
.importSelectionTypeProperty( OUString( "SelectionType" ),
1203 OUString( "selectiontype" ),
1205 ctx
.importBooleanProperty( OUString( "RootDisplayed" ),
1206 OUString( "rootdisplayed" ),
1208 ctx
.importBooleanProperty( OUString( "ShowsHandles" ),
1209 OUString( "showshandles" ),
1211 ctx
.importBooleanProperty( OUString( "ShowsRootHandles" ),
1212 OUString( "showsroothandles" ),
1214 ctx
.importBooleanProperty( OUString( "Editable" ),
1215 OUString( "editable" ),
1217 ctx
.importBooleanProperty( OUString( "RowHeight" ),
1218 OUString( "readonly" ),
1220 ctx
.importBooleanProperty( OUString( "InvokesStopNodeEditing" ),
1221 OUString( "invokesstopnodeediting" ),
1224 ctx
.importEvents( _events
);
1225 // avoid ring-reference:
1226 // vector< event elements > holding event elements holding this (via _pParent)
1230 //##################################################################################################
1233 //__________________________________________________________________________________________________
1234 Reference
< xml::input::XElement
> ImageControlElement::startChildElement(
1235 sal_Int32 nUid
, OUString
const & rLocalName
,
1236 Reference
< xml::input::XAttributes
> const & xAttributes
)
1237 throw (xml::sax::SAXException
, RuntimeException
)
1240 if (_pImport
->isEventElement( nUid
, rLocalName
))
1242 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
1246 throw xml::sax::SAXException(
1247 OUString( "expected event element!" ),
1248 Reference
< XInterface
>(), Any() );
1251 //__________________________________________________________________________________________________
1252 void ImageControlElement::endElement()
1253 throw (xml::sax::SAXException
, RuntimeException
)
1255 ControlImportContext
ctx(
1256 _pImport
, getControlId( _xAttributes
),
1257 OUString( "com.sun.star.awt.UnoControlImageControlModel" ) );
1259 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
1262 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
1263 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
1264 pStyle
->importBackgroundColorStyle( xControlModel
);
1265 pStyle
->importBorderStyle( xControlModel
);
1268 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
1269 ctx
.importBooleanProperty( OUString( "ScaleImage" ),
1270 OUString( "scale-image" ),
1272 rtl::OUString sURL
= _xAttributes
->getValueByUidName( _pImport
->XMLNS_DIALOGS_UID
, OUSTR( "src" ) );
1273 Reference
< document::XStorageBasedDocument
> xDocStorage( _pImport
->getDocOwner(), UNO_QUERY
);
1275 ctx
.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "src" ), _xAttributes
);
1276 ctx
.importBooleanProperty( OUString( "Tabstop" ),
1277 OUString( "tabstop" ),
1279 ctx
.importEvents( _events
);
1280 // avoid ring-reference:
1281 // vector< event elements > holding event elements holding this (via _pParent)
1285 //##################################################################################################
1288 //__________________________________________________________________________________________________
1289 Reference
< xml::input::XElement
> TextElement::startChildElement(
1290 sal_Int32 nUid
, OUString
const & rLocalName
,
1291 Reference
< xml::input::XAttributes
> const & xAttributes
)
1292 throw (xml::sax::SAXException
, RuntimeException
)
1295 if (_pImport
->isEventElement( nUid
, rLocalName
))
1297 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
1301 throw xml::sax::SAXException(
1302 OUString( "expected event element!" ),
1303 Reference
< XInterface
>(), Any() );
1306 //__________________________________________________________________________________________________
1307 void TextElement::endElement()
1308 throw (xml::sax::SAXException
, RuntimeException
)
1310 ControlImportContext
ctx(
1311 _pImport
, getControlId( _xAttributes
),
1312 OUString( "com.sun.star.awt.UnoControlFixedTextModel" ) );
1314 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
1317 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
1318 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
1319 pStyle
->importBackgroundColorStyle( xControlModel
);
1320 pStyle
->importTextColorStyle( xControlModel
);
1321 pStyle
->importTextLineColorStyle( xControlModel
);
1322 pStyle
->importBorderStyle( xControlModel
);
1323 pStyle
->importFontStyle( xControlModel
);
1326 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
1327 ctx
.importStringProperty( OUString( "Label" ),
1328 OUString( "value" ),
1330 ctx
.importAlignProperty( OUString( "Align" ),
1331 OUString( "align" ),
1333 ctx
.importVerticalAlignProperty( OUString( "VerticalAlign" ),
1334 OUString( "valign" ),
1336 ctx
.importBooleanProperty( OUString( "MultiLine" ),
1337 OUString( "multiline" ),
1339 ctx
.importBooleanProperty( OUString( "Tabstop" ),
1340 OUString( "tabstop" ),
1342 ctx
.importBooleanProperty( OUString( "NoLabel" ),
1343 OUString( "nolabel" ),
1345 ctx
.importEvents( _events
);
1346 // avoid ring-reference:
1347 // vector< event elements > holding event elements holding this (via _pParent)
1351 //##################################################################################################
1353 //__________________________________________________________________________________________________
1354 Reference
< xml::input::XElement
> FixedHyperLinkElement::startChildElement(
1355 sal_Int32 nUid
, OUString
const & rLocalName
,
1356 Reference
< xml::input::XAttributes
> const & xAttributes
)
1357 throw (xml::sax::SAXException
, RuntimeException
)
1360 if (_pImport
->isEventElement( nUid
, rLocalName
))
1362 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
1366 throw xml::sax::SAXException(
1367 OUString( "expected event element!" ),
1368 Reference
< XInterface
>(), Any() );
1371 //__________________________________________________________________________________________________
1372 void FixedHyperLinkElement::endElement()
1373 throw (xml::sax::SAXException
, RuntimeException
)
1375 ControlImportContext
ctx(
1376 _pImport
, getControlId( _xAttributes
),
1377 OUString( "com.sun.star.awt.UnoControlFixedHyperlinkModel" ) );
1379 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
1382 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
1383 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
1384 pStyle
->importBackgroundColorStyle( xControlModel
);
1385 pStyle
->importTextColorStyle( xControlModel
);
1386 pStyle
->importTextLineColorStyle( xControlModel
);
1387 pStyle
->importBorderStyle( xControlModel
);
1388 pStyle
->importFontStyle( xControlModel
);
1391 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
1392 ctx
.importStringProperty( OUString( "Label" ),
1393 OUString( "value" ),
1395 ctx
.importStringProperty( OUString( "URL" ),
1398 ctx
.importStringProperty( OUString( "Description" ),
1399 OUString( "description" ),
1402 ctx
.importAlignProperty( OUString( "Align" ),
1403 OUString( "align" ),
1405 ctx
.importVerticalAlignProperty( OUString( "VerticalAlign" ),
1406 OUString( "valign" ),
1408 ctx
.importBooleanProperty( OUString( "MultiLine" ),
1409 OUString( "multiline" ),
1411 ctx
.importBooleanProperty( OUString( "Tabstop" ),
1412 OUString( "tabstop" ),
1414 ctx
.importBooleanProperty( OUString( "NoLabel" ),
1415 OUString( "nolabel" ),
1417 ctx
.importEvents( _events
);
1418 // avoid ring-reference:
1419 // vector< event elements > holding event elements holding this (via _pParent)
1423 //##################################################################################################
1426 //__________________________________________________________________________________________________
1427 Reference
< xml::input::XElement
> TextFieldElement::startChildElement(
1428 sal_Int32 nUid
, OUString
const & rLocalName
,
1429 Reference
< xml::input::XAttributes
> const & xAttributes
)
1430 throw (xml::sax::SAXException
, RuntimeException
)
1433 if (_pImport
->isEventElement( nUid
, rLocalName
))
1435 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
1439 throw xml::sax::SAXException(
1440 OUString( "expected event element!" ),
1441 Reference
< XInterface
>(), Any() );
1444 //__________________________________________________________________________________________________
1445 void TextFieldElement::endElement()
1446 throw (xml::sax::SAXException
, RuntimeException
)
1448 ControlImportContext
ctx(
1449 _pImport
, getControlId( _xAttributes
),
1450 OUString( "com.sun.star.awt.UnoControlEditModel" ) );
1451 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
1453 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
1456 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
1457 pStyle
->importBackgroundColorStyle( xControlModel
);
1458 pStyle
->importTextColorStyle( xControlModel
);
1459 pStyle
->importTextLineColorStyle( xControlModel
);
1460 pStyle
->importBorderStyle( xControlModel
);
1461 pStyle
->importFontStyle( xControlModel
);
1464 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
1465 ctx
.importBooleanProperty( OUString( "Tabstop" ),
1466 OUString( "tabstop" ),
1468 ctx
.importAlignProperty( OUString( "Align" ),
1469 OUString( "align" ),
1471 ctx
.importBooleanProperty( OUString( "HardLineBreaks" ),
1472 OUString( "hard-linebreaks" ),
1474 ctx
.importBooleanProperty( OUString( "HScroll" ),
1475 OUString( "hscroll" ),
1477 ctx
.importBooleanProperty( OUString( "VScroll" ),
1478 OUString( "vscroll" ),
1480 ctx
.importBooleanProperty(
1481 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
1483 ctx
.importShortProperty( OUString( "MaxTextLen" ),
1484 OUString( "maxlength" ),
1486 ctx
.importBooleanProperty( OUString( "MultiLine" ),
1487 OUString( "multiline" ),
1489 ctx
.importBooleanProperty( OUString( "ReadOnly" ),
1490 OUString( "readonly" ),
1492 ctx
.importStringProperty( OUString( "Text" ),
1493 OUString( "value" ),
1495 ctx
.importLineEndFormatProperty( OUString( "LineEndFormat" ),
1496 OUString( "lineend-format" ),
1499 if (getStringAttr( &aValue
,
1500 OUString( "echochar" ),
1502 _pImport
->XMLNS_DIALOGS_UID
) &&
1505 OSL_ENSURE( aValue
.getLength() == 1, "### more than one character given for echochar!" );
1506 sal_Int16 nChar
= (sal_Int16
)aValue
[ 0 ];
1507 xControlModel
->setPropertyValue( OUString( "EchoChar" ),
1511 ctx
.importEvents( _events
);
1512 // avoid ring-reference:
1513 // vector< event elements > holding event elements holding this (via _pParent)
1517 //##################################################################################################
1520 //__________________________________________________________________________________________________
1521 Reference
< xml::input::XElement
> TitledBoxElement::startChildElement(
1522 sal_Int32 nUid
, OUString
const & rLocalName
,
1523 Reference
< xml::input::XAttributes
> const & xAttributes
)
1524 throw (xml::sax::SAXException
, RuntimeException
)
1527 if (_pImport
->isEventElement( nUid
, rLocalName
))
1529 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
1531 else if (_pImport
->XMLNS_DIALOGS_UID
!= nUid
)
1533 throw xml::sax::SAXException(
1534 OUString( "illegal namespace!" ),
1535 Reference
< XInterface
>(), Any() );
1538 else if ( rLocalName
== "title" )
1540 getStringAttr( &_label
,
1541 OUString( "value" ),
1543 _pImport
->XMLNS_DIALOGS_UID
);
1545 return new ElementBase(
1546 _pImport
->XMLNS_DIALOGS_UID
,
1547 rLocalName
, xAttributes
, this, _pImport
);
1550 else if ( rLocalName
== "radio" )
1552 // dont create radios here, => titledbox must be inserted first due to radio grouping,
1553 // possible predecessors!
1554 Reference
< xml::input::XElement
> xRet(
1555 new RadioElement( rLocalName
, xAttributes
, this, _pImport
) );
1556 _radios
.push_back( xRet
);
1560 else if (_pImport
->isEventElement( nUid
, rLocalName
))
1562 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
1566 return BulletinBoardElement::startChildElement( nUid
, rLocalName
, xAttributes
);
1569 //__________________________________________________________________________________________________
1570 void TitledBoxElement::endElement()
1571 throw (xml::sax::SAXException
, RuntimeException
)
1574 ControlImportContext
ctx(
1575 _pImport
, getControlId( _xAttributes
),
1576 OUString( "com.sun.star.awt.UnoControlGroupBoxModel" ) );
1577 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
1579 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
1582 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
1583 pStyle
->importTextColorStyle( xControlModel
);
1584 pStyle
->importTextLineColorStyle( xControlModel
);
1585 pStyle
->importFontStyle( xControlModel
);
1588 ctx
.importDefaults( 0, 0, _xAttributes
); // inherited from BulletinBoardElement
1590 if (!_label
.isEmpty())
1592 xControlModel
->setPropertyValue( OUString( "Label" ),
1593 makeAny( _label
) );
1596 ctx
.importEvents( _events
);
1597 // avoid ring-reference:
1598 // vector< event elements > holding event elements holding this (via _pParent)
1602 // create radios AFTER group box!
1603 for ( size_t nPos
= 0; nPos
< _radios
.size(); ++nPos
)
1605 Reference
< xml::input::XElement
> xRadio( _radios
[ nPos
] );
1606 Reference
< xml::input::XAttributes
> xAttributes(
1607 xRadio
->getAttributes() );
1609 ControlImportContext
ctx(
1610 _pImport
, getControlId( xAttributes
),
1611 getControlModelName( OUString( "com.sun.star.awt.UnoControlRadioButtonModel" ), xAttributes
) );
1612 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
1614 Reference
< xml::input::XElement
> xStyle( getStyle( xAttributes
) );
1617 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
1618 pStyle
->importBackgroundColorStyle( xControlModel
);
1619 pStyle
->importTextColorStyle( xControlModel
);
1620 pStyle
->importTextLineColorStyle( xControlModel
);
1621 pStyle
->importFontStyle( xControlModel
);
1622 pStyle
->importVisualEffectStyle( xControlModel
);
1625 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, xAttributes
);
1626 ctx
.importBooleanProperty( OUString( "Tabstop" ),
1627 OUString( "tabstop" ),
1629 ctx
.importStringProperty( OUString( "Label" ),
1630 OUString( "value" ),
1632 ctx
.importAlignProperty( OUString( "Align" ),
1633 OUString( "align" ),
1635 ctx
.importVerticalAlignProperty( OUString( "VerticalAlign" ),
1636 OUString( "valign" ),
1638 ctx
.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "image-src" ), _xAttributes
);
1639 ctx
.importImagePositionProperty( OUString( "ImagePosition" ),
1640 OUString( "image-position" ),
1642 ctx
.importBooleanProperty( OUString( "MultiLine" ),
1643 OUString( "multiline" ),
1645 ctx
.importStringProperty( OUString( "GroupName" ),
1646 OUString( "group-name" ),
1650 sal_Bool bChecked
= sal_False
;
1651 if (getBoolAttr( &bChecked
,
1652 OUString( "checked" ),
1654 _pImport
->XMLNS_DIALOGS_UID
) &&
1659 xControlModel
->setPropertyValue( OUString( "State" ),
1661 ctx
.importDataAwareProperty( OUSTR("linked-cell" ), xAttributes
);
1662 ::std::vector
< Reference
< xml::input::XElement
> > * radioEvents
=
1663 static_cast< RadioElement
* >( xRadio
.get() )->getEvents();
1664 ctx
.importEvents( *radioEvents
);
1665 // avoid ring-reference:
1666 // vector< event elements > holding event elements holding this (via _pParent)
1667 radioEvents
->clear();
1669 // avoid ring-reference:
1670 // vector< radio elements > holding radio elements holding this (via _pParent)
1674 //##################################################################################################
1677 //__________________________________________________________________________________________________
1678 Reference
< xml::input::XElement
> RadioElement::startChildElement(
1679 sal_Int32 nUid
, OUString
const & rLocalName
,
1680 Reference
< xml::input::XAttributes
> const & xAttributes
)
1681 throw (xml::sax::SAXException
, RuntimeException
)
1684 if (_pImport
->isEventElement( nUid
, rLocalName
))
1686 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
1690 throw xml::sax::SAXException(
1691 OUString( "expected event element!" ),
1692 Reference
< XInterface
>(), Any() );
1696 //##################################################################################################
1699 //__________________________________________________________________________________________________
1700 Reference
< xml::input::XElement
> RadioGroupElement::startChildElement(
1701 sal_Int32 nUid
, OUString
const & rLocalName
,
1702 Reference
< xml::input::XAttributes
> const & xAttributes
)
1703 throw (xml::sax::SAXException
, RuntimeException
)
1705 if (_pImport
->XMLNS_DIALOGS_UID
!= nUid
)
1707 throw xml::sax::SAXException(
1708 OUString( "illegal namespace!" ),
1709 Reference
< XInterface
>(), Any() );
1712 else if ( rLocalName
== "radio" )
1714 // dont create radios here, => titledbox must be inserted first due to radio grouping,
1715 // possible predecessors!
1716 Reference
< xml::input::XElement
> xRet(
1717 new RadioElement( rLocalName
, xAttributes
, this, _pImport
) );
1718 _radios
.push_back( xRet
);
1723 throw xml::sax::SAXException(
1724 OUString( "expected radio element!" ),
1725 Reference
< XInterface
>(), Any() );
1728 //__________________________________________________________________________________________________
1729 void RadioGroupElement::endElement()
1730 throw (xml::sax::SAXException
, RuntimeException
)
1732 for ( size_t nPos
= 0; nPos
< _radios
.size(); ++nPos
)
1734 Reference
< xml::input::XElement
> xRadio( _radios
[ nPos
] );
1735 Reference
< xml::input::XAttributes
> xAttributes(
1736 xRadio
->getAttributes() );
1738 ControlImportContext
ctx(
1739 _pImport
, getControlId( xAttributes
),
1740 getControlModelName( OUString( "com.sun.star.awt.UnoControlRadioButtonModel" ), xAttributes
) );
1741 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
1743 Reference
< xml::input::XElement
> xStyle( getStyle( xAttributes
) );
1746 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
1747 pStyle
->importBackgroundColorStyle( xControlModel
);
1748 pStyle
->importTextColorStyle( xControlModel
);
1749 pStyle
->importTextLineColorStyle( xControlModel
);
1750 pStyle
->importFontStyle( xControlModel
);
1751 pStyle
->importVisualEffectStyle( xControlModel
);
1754 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, xAttributes
);
1755 ctx
.importBooleanProperty( OUString( "Tabstop" ),
1756 OUString( "tabstop" ),
1758 ctx
.importStringProperty( OUString( "Label" ),
1759 OUString( "value" ),
1761 ctx
.importAlignProperty( OUString( "Align" ),
1762 OUString( "align" ),
1764 ctx
.importVerticalAlignProperty( OUString( "VerticalAlign" ),
1765 OUString( "valign" ),
1767 ctx
.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "image-src" ), xAttributes
);
1768 ctx
.importImagePositionProperty( OUString( "ImagePosition" ),
1769 OUString( "image-position" ),
1771 ctx
.importBooleanProperty( OUString( "MultiLine" ),
1772 OUString( "multiline" ),
1774 ctx
.importStringProperty( OUString( "GroupName" ),
1775 OUString( "group-name" ),
1778 sal_Bool bChecked
= sal_False
;
1779 if (getBoolAttr( &bChecked
,
1780 OUString( "checked" ),
1782 _pImport
->XMLNS_DIALOGS_UID
) &&
1787 xControlModel
->setPropertyValue( OUString( "State" ),
1790 ctx
.importDataAwareProperty( OUSTR("linked-cell" ), xAttributes
);
1792 ::std::vector
< Reference
< xml::input::XElement
> > * radioEvents
=
1793 static_cast< RadioElement
* >( xRadio
.get() )->getEvents();
1794 ctx
.importEvents( *radioEvents
);
1795 // avoid ring-reference:
1796 // vector< event elements > holding event elements holding this (via _pParent)
1797 radioEvents
->clear();
1799 // avoid ring-reference:
1800 // vector< radio elements > holding radio elements holding this (via _pParent)
1804 //##################################################################################################
1807 //__________________________________________________________________________________________________
1808 Reference
< xml::input::XElement
> MenuPopupElement::startChildElement(
1809 sal_Int32 nUid
, OUString
const & rLocalName
,
1810 Reference
< xml::input::XAttributes
> const & xAttributes
)
1811 throw (xml::sax::SAXException
, RuntimeException
)
1813 if (_pImport
->XMLNS_DIALOGS_UID
!= nUid
)
1815 throw xml::sax::SAXException(
1816 OUString( "illegal namespace!" ),
1817 Reference
< XInterface
>(), Any() );
1820 else if ( rLocalName
== "menuitem" )
1823 xAttributes
->getValueByUidName(
1824 _pImport
->XMLNS_DIALOGS_UID
,
1825 OUString( "value" ) ) );
1826 OSL_ENSURE( !aValue
.isEmpty(), "### menuitem has no value?" );
1827 if (!aValue
.isEmpty())
1829 _itemValues
.push_back( aValue
);
1832 xAttributes
->getValueByUidName(
1833 _pImport
->XMLNS_DIALOGS_UID
,
1834 OUString( "selected" ) ) );
1835 if (!aSel
.isEmpty() && aSel
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("true") ))
1837 _itemSelected
.push_back(
1838 static_cast<sal_Int16
>(_itemValues
.size()) -1 );
1841 return new ElementBase(
1842 _pImport
->XMLNS_DIALOGS_UID
,
1843 rLocalName
, xAttributes
, this, _pImport
);
1847 throw xml::sax::SAXException(
1848 OUString( "expected menuitem!" ),
1849 Reference
< XInterface
>(), Any() );
1852 //__________________________________________________________________________________________________
1853 Sequence
< OUString
> MenuPopupElement::getItemValues()
1855 Sequence
< OUString
> aRet( _itemValues
.size() );
1856 OUString
* pRet
= aRet
.getArray();
1857 for ( size_t nPos
= _itemValues
.size(); nPos
--; )
1859 pRet
[ nPos
] = _itemValues
[ nPos
];
1863 //__________________________________________________________________________________________________
1864 Sequence
< sal_Int16
> MenuPopupElement::getSelectedItems()
1866 Sequence
< sal_Int16
> aRet( _itemSelected
.size() );
1867 sal_Int16
* pRet
= aRet
.getArray();
1868 for ( size_t nPos
= _itemSelected
.size(); nPos
--; )
1870 pRet
[ nPos
] = _itemSelected
[ nPos
];
1875 //##################################################################################################
1878 //__________________________________________________________________________________________________
1879 Reference
< xml::input::XElement
> MenuListElement::startChildElement(
1880 sal_Int32 nUid
, OUString
const & rLocalName
,
1881 Reference
< xml::input::XAttributes
> const & xAttributes
)
1882 throw (xml::sax::SAXException
, RuntimeException
)
1885 if (_pImport
->isEventElement( nUid
, rLocalName
))
1887 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
1889 else if (_pImport
->XMLNS_DIALOGS_UID
!= nUid
)
1891 throw xml::sax::SAXException(
1892 OUString( "illegal namespace!" ),
1893 Reference
< XInterface
>(), Any() );
1896 else if ( rLocalName
== "menupopup" )
1898 _popup
= new MenuPopupElement( rLocalName
, xAttributes
, this, _pImport
);
1903 throw xml::sax::SAXException(
1904 OUString( "expected event or menupopup element!" ),
1905 Reference
< XInterface
>(), Any() );
1908 //__________________________________________________________________________________________________
1909 void MenuListElement::endElement()
1910 throw (xml::sax::SAXException
, RuntimeException
)
1912 ControlImportContext
ctx(
1913 _pImport
, getControlId( _xAttributes
),
1915 getControlModelName( OUString( "com.sun.star.awt.UnoControlListBoxModel" ), _xAttributes
) );
1916 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
1918 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
1921 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
1922 pStyle
->importBackgroundColorStyle( xControlModel
);
1923 pStyle
->importTextColorStyle( xControlModel
);
1924 pStyle
->importTextLineColorStyle( xControlModel
);
1925 pStyle
->importBorderStyle( xControlModel
);
1926 pStyle
->importFontStyle( xControlModel
);
1929 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
1930 ctx
.importBooleanProperty( OUString( "Tabstop" ),
1931 OUString( "tabstop" ),
1933 ctx
.importBooleanProperty( OUString( "MultiSelection" ),
1934 OUString( "multiselection" ),
1936 ctx
.importBooleanProperty( OUString( "ReadOnly" ),
1937 OUString( "readonly" ),
1939 ctx
.importBooleanProperty( OUString( "Dropdown" ),
1942 ctx
.importShortProperty( OUString( "LineCount" ),
1943 OUString( "linecount" ),
1945 ctx
.importAlignProperty( OUString( "Align" ),
1946 OUString( "align" ),
1948 bool bHasLinkedCell
= ctx
.importDataAwareProperty( OUSTR("linked-cell" ), _xAttributes
);
1949 bool bHasSrcRange
= ctx
.importDataAwareProperty( OUSTR("source-cell-range" ), _xAttributes
);
1952 MenuPopupElement
* p
= static_cast< MenuPopupElement
* >( _popup
.get() );
1953 if ( !bHasSrcRange
)
1954 xControlModel
->setPropertyValue( OUString( "StringItemList" ), makeAny( p
->getItemValues() ) );
1955 if ( !bHasLinkedCell
)
1956 xControlModel
->setPropertyValue( OUString( "SelectedItems" ), makeAny( p
->getSelectedItems() ) );
1959 ctx
.importEvents( _events
);
1960 // avoid ring-reference:
1961 // vector< event elements > holding event elements holding this (via _pParent)
1965 //##################################################################################################
1968 //__________________________________________________________________________________________________
1969 Reference
< xml::input::XElement
> ComboBoxElement::startChildElement(
1970 sal_Int32 nUid
, OUString
const & rLocalName
,
1971 Reference
< xml::input::XAttributes
> const & xAttributes
)
1972 throw (xml::sax::SAXException
, RuntimeException
)
1975 if (_pImport
->isEventElement( nUid
, rLocalName
))
1977 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
1979 else if (_pImport
->XMLNS_DIALOGS_UID
!= nUid
)
1981 throw xml::sax::SAXException(
1982 OUString( "illegal namespace!" ),
1983 Reference
< XInterface
>(), Any() );
1986 else if ( rLocalName
== "menupopup" )
1988 _popup
= new MenuPopupElement( rLocalName
, xAttributes
, this, _pImport
);
1993 throw xml::sax::SAXException(
1994 OUString( "expected event or menupopup element!" ),
1995 Reference
< XInterface
>(), Any() );
1998 //__________________________________________________________________________________________________
1999 void ComboBoxElement::endElement()
2000 throw (xml::sax::SAXException
, RuntimeException
)
2002 ControlImportContext
ctx(
2003 _pImport
, getControlId( _xAttributes
),
2004 getControlModelName( OUString( "com.sun.star.awt.UnoControlComboBoxModel" ), _xAttributes
) );
2005 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
2007 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
2010 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
2011 pStyle
->importBackgroundColorStyle( xControlModel
);
2012 pStyle
->importTextColorStyle( xControlModel
);
2013 pStyle
->importTextLineColorStyle( xControlModel
);
2014 pStyle
->importBorderStyle( xControlModel
);
2015 pStyle
->importFontStyle( xControlModel
);
2018 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
2019 ctx
.importBooleanProperty( OUString( "Tabstop" ),
2020 OUString( "tabstop" ),
2022 ctx
.importBooleanProperty( OUString( "ReadOnly" ),
2023 OUString( "readonly" ),
2025 ctx
.importBooleanProperty( OUString( "Autocomplete" ),
2026 OUString( "autocomplete" ),
2028 ctx
.importBooleanProperty( OUString( "Dropdown" ),
2031 ctx
.importBooleanProperty(
2032 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
2034 ctx
.importShortProperty( OUString( "MaxTextLen" ),
2035 OUString( "maxlength" ),
2037 ctx
.importShortProperty( OUString( "LineCount" ),
2038 OUString( "linecount" ),
2040 ctx
.importStringProperty( OUString( "Text" ),
2041 OUString( "value" ),
2043 ctx
.importAlignProperty( OUString( "Align" ),
2044 OUString( "align" ),
2046 ctx
.importDataAwareProperty( OUSTR("linked-cell" ), _xAttributes
);
2047 bool bHasSrcRange
= ctx
.importDataAwareProperty( OUSTR("source-cell-range" ), _xAttributes
);
2048 if (_popup
.is() && !bHasSrcRange
)
2050 MenuPopupElement
* p
= static_cast< MenuPopupElement
* >( _popup
.get() );
2051 xControlModel
->setPropertyValue( OUString( "StringItemList" ),
2052 makeAny( p
->getItemValues() ) );
2055 ctx
.importEvents( _events
);
2056 // avoid ring-reference:
2057 // vector< event elements > holding event elements holding this (via _pParent)
2061 //##################################################################################################
2064 //__________________________________________________________________________________________________
2065 Reference
< xml::input::XElement
> CheckBoxElement::startChildElement(
2066 sal_Int32 nUid
, OUString
const & rLocalName
,
2067 Reference
< xml::input::XAttributes
> const & xAttributes
)
2068 throw (xml::sax::SAXException
, RuntimeException
)
2071 if (_pImport
->isEventElement( nUid
, rLocalName
))
2073 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
2077 throw xml::sax::SAXException(
2078 OUString( "expected event element!" ),
2079 Reference
< XInterface
>(), Any() );
2082 //__________________________________________________________________________________________________
2083 void CheckBoxElement::endElement()
2084 throw (xml::sax::SAXException
, RuntimeException
)
2086 ControlImportContext
ctx(
2087 _pImport
, getControlId( _xAttributes
),
2088 OUString( "com.sun.star.awt.UnoControlCheckBoxModel" ) );
2089 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
2091 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
2094 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
2095 pStyle
->importBackgroundColorStyle( xControlModel
);
2096 pStyle
->importTextColorStyle( xControlModel
);
2097 pStyle
->importTextLineColorStyle( xControlModel
);
2098 pStyle
->importFontStyle( xControlModel
);
2099 pStyle
->importVisualEffectStyle( xControlModel
);
2102 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
2103 ctx
.importBooleanProperty( OUString( "Tabstop" ),
2104 OUString( "tabstop" ),
2106 ctx
.importStringProperty( OUString( "Label" ),
2107 OUString( "value" ),
2109 ctx
.importAlignProperty( OUString( "Align" ),
2110 OUString( "align" ),
2112 ctx
.importVerticalAlignProperty( OUString( "VerticalAlign" ),
2113 OUString( "valign" ),
2115 ctx
.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "image-src" ), _xAttributes
);
2116 ctx
.importImagePositionProperty( OUString( "ImagePosition" ),
2117 OUString( "image-position" ),
2119 ctx
.importBooleanProperty( OUString( "MultiLine" ),
2120 OUString( "multiline" ),
2124 sal_Bool bTriState
= sal_False
;
2125 if (getBoolAttr( &bTriState
,
2126 OUString( "tristate" ),
2128 _pImport
->XMLNS_DIALOGS_UID
))
2130 xControlModel
->setPropertyValue( OUString( "TriState" ),
2131 makeAny( bTriState
) );
2133 sal_Bool bChecked
= sal_False
;
2134 if (getBoolAttr( &bChecked
,
2135 OUString( "checked" ),
2137 _pImport
->XMLNS_DIALOGS_UID
))
2139 // has "checked" attribute
2140 sal_Int16 nVal
= (bChecked
? 1 : 0);
2141 xControlModel
->setPropertyValue( OUString( "State" ),
2146 sal_Int16 nVal
= (bTriState
? 2 : 0); // if tristate set, but checked omitted => dont know!
2147 xControlModel
->setPropertyValue( OUString( "State" ),
2151 ctx
.importEvents( _events
);
2152 // avoid ring-reference:
2153 // vector< event elements > holding event elements holding this (via _pParent)
2157 //##################################################################################################
2160 //__________________________________________________________________________________________________
2161 Reference
< xml::input::XElement
> ButtonElement::startChildElement(
2162 sal_Int32 nUid
, OUString
const & rLocalName
,
2163 Reference
< xml::input::XAttributes
> const & xAttributes
)
2164 throw (xml::sax::SAXException
, RuntimeException
)
2167 if (_pImport
->isEventElement( nUid
, rLocalName
))
2169 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
2173 throw xml::sax::SAXException(
2174 OUString( "expected event element!" ),
2175 Reference
< XInterface
>(), Any() );
2178 //__________________________________________________________________________________________________
2179 void ButtonElement::endElement()
2180 throw (xml::sax::SAXException
, RuntimeException
)
2182 ControlImportContext
ctx(
2183 _pImport
, getControlId( _xAttributes
),
2184 OUString( "com.sun.star.awt.UnoControlButtonModel" ) );
2186 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
2189 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
2190 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
2191 pStyle
->importBackgroundColorStyle( xControlModel
);
2192 pStyle
->importTextColorStyle( xControlModel
);
2193 pStyle
->importTextLineColorStyle( xControlModel
);
2194 pStyle
->importFontStyle( xControlModel
);
2197 ctx
.importDefaults( _nBasePosX
, _nBasePosY
, _xAttributes
);
2198 ctx
.importBooleanProperty( OUString( "Tabstop" ),
2199 OUString( "tabstop" ),
2201 ctx
.importStringProperty( OUString( "Label" ),
2202 OUString( "value" ),
2204 ctx
.importAlignProperty( OUString( "Align" ),
2205 OUString( "align" ),
2207 ctx
.importVerticalAlignProperty( OUString( "VerticalAlign" ),
2208 OUString( "valign" ),
2210 ctx
.importBooleanProperty( OUString( "DefaultButton" ),
2211 OUString( "default" ),
2213 ctx
.importButtonTypeProperty( OUString( "PushButtonType" ),
2214 OUString( "button-type" ),
2216 ctx
.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "image-src" ), _xAttributes
);
2217 ctx
.importImagePositionProperty( OUString( "ImagePosition" ),
2218 OUString( "image-position" ),
2220 ctx
.importImageAlignProperty( OUString( "ImageAlign" ),
2221 OUString( "image-align" ),
2223 if (ctx
.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
2225 ctx
.getControlModel()->setPropertyValue(
2226 OUSTR("Repeat"), makeAny(true) );
2227 sal_Int32 toggled
= 0;
2228 if (getLongAttr( &toggled
, OUSTR("toggled"), _xAttributes
,
2229 _pImport
->XMLNS_DIALOGS_UID
) && toggled
== 1)
2230 ctx
.getControlModel()->setPropertyValue(OUSTR("Toggle"), makeAny(true));
2231 ctx
.importBooleanProperty( OUSTR("FocusOnClick"), OUSTR("grab-focus"),
2233 ctx
.importBooleanProperty( OUString( "MultiLine" ),
2234 OUString( "multiline" ),
2237 sal_Bool bChecked
= sal_False
;
2240 OUString( "checked" ),
2242 _pImport
->XMLNS_DIALOGS_UID
) &&
2246 ctx
.getControlModel()->setPropertyValue(
2247 OUString( "State" ), makeAny( nVal
) );
2250 ctx
.importEvents( _events
);
2251 // avoid ring-reference:
2252 // vector< event elements > holding event elements holding this (via _pParent)
2256 //##################################################################################################
2259 //__________________________________________________________________________________________________
2260 Reference
< xml::input::XElement
> BulletinBoardElement::startChildElement(
2261 sal_Int32 nUid
, OUString
const & rLocalName
,
2262 Reference
< xml::input::XAttributes
> const & xAttributes
)
2263 throw (xml::sax::SAXException
, RuntimeException
)
2265 if (_pImport
->XMLNS_DIALOGS_UID
!= nUid
)
2267 throw xml::sax::SAXException(
2268 OUString( "illegal namespace!" ),
2269 Reference
< XInterface
>(), Any() );
2272 else if ( rLocalName
== "button" )
2274 return new ButtonElement( rLocalName
, xAttributes
, this, _pImport
);
2277 else if ( rLocalName
== "checkbox" )
2279 return new CheckBoxElement( rLocalName
, xAttributes
, this, _pImport
);
2282 else if ( rLocalName
== "combobox" )
2284 return new ComboBoxElement( rLocalName
, xAttributes
, this, _pImport
);
2287 else if ( rLocalName
== "menulist" )
2289 return new MenuListElement( rLocalName
, xAttributes
, this, _pImport
);
2292 else if ( rLocalName
== "radiogroup" )
2294 return new RadioGroupElement( rLocalName
, xAttributes
, this, _pImport
);
2297 else if ( rLocalName
== "titledbox" )
2299 return new TitledBoxElement( rLocalName
, xAttributes
, this, _pImport
);
2302 else if ( rLocalName
== "text" )
2304 return new TextElement( rLocalName
, xAttributes
, this, _pImport
);
2306 else if ( rLocalName
== "linklabel" )
2308 return new FixedHyperLinkElement( rLocalName
, xAttributes
, this, _pImport
);
2311 else if ( rLocalName
== "textfield" )
2313 return new TextFieldElement( rLocalName
, xAttributes
, this, _pImport
);
2316 else if ( rLocalName
== "img" )
2318 return new ImageControlElement( rLocalName
, xAttributes
, this, _pImport
);
2321 else if ( rLocalName
== "filecontrol" )
2323 return new FileControlElement( rLocalName
, xAttributes
, this, _pImport
);
2326 else if ( rLocalName
== "treecontrol" )
2328 return new TreeControlElement( rLocalName
, xAttributes
, this, _pImport
);
2331 else if ( rLocalName
== "currencyfield" )
2333 return new CurrencyFieldElement( rLocalName
, xAttributes
, this, _pImport
);
2336 else if ( rLocalName
== "datefield" )
2338 return new DateFieldElement( rLocalName
, xAttributes
, this, _pImport
);
2341 else if ( rLocalName
== "numericfield" )
2343 return new NumericFieldElement( rLocalName
, xAttributes
, this, _pImport
);
2346 else if ( rLocalName
== "timefield" )
2348 return new TimeFieldElement( rLocalName
, xAttributes
, this, _pImport
);
2351 else if ( rLocalName
== "patternfield" )
2353 return new PatternFieldElement( rLocalName
, xAttributes
, this, _pImport
);
2356 else if ( rLocalName
== "formattedfield" )
2358 return new FormattedFieldElement( rLocalName
, xAttributes
, this, _pImport
);
2361 else if ( rLocalName
== "fixedline" )
2363 return new FixedLineElement( rLocalName
, xAttributes
, this, _pImport
);
2366 else if ( rLocalName
== "scrollbar" )
2368 return new ScrollBarElement( rLocalName
, xAttributes
, this, _pImport
);
2371 else if ( rLocalName
== "spinbutton" )
2373 return new SpinButtonElement( rLocalName
, xAttributes
, this, _pImport
);
2376 else if ( rLocalName
== "progressmeter" )
2378 return new ProgressBarElement( rLocalName
, xAttributes
, this, _pImport
);
2380 else if ( rLocalName
== "multipage" )
2382 return new MultiPage( rLocalName
, xAttributes
, this, _pImport
);
2384 else if ( rLocalName
== "frame" )
2386 return new Frame( rLocalName
, xAttributes
, this, _pImport
);
2388 else if ( rLocalName
== "page" )
2390 return new Page( rLocalName
, xAttributes
, this, _pImport
);
2393 else if ( rLocalName
== "bulletinboard" )
2395 return new BulletinBoardElement( rLocalName
, xAttributes
, this, _pImport
);
2399 throw xml::sax::SAXException(
2400 OUString( "expected styles, bulletinboard or bulletinboard element, not: " ) + rLocalName
,
2401 Reference
< XInterface
>(), Any() );
2404 //__________________________________________________________________________________________________
2405 BulletinBoardElement::BulletinBoardElement(
2406 OUString
const & rLocalName
,
2407 Reference
< xml::input::XAttributes
> const & xAttributes
,
2408 ElementBase
* pParent
, DialogImport
* pImport
)
2410 : ControlElement( rLocalName
, xAttributes
, pParent
, pImport
)
2413 _xAttributes
->getValueByUidName(
2414 _pImport
->XMLNS_DIALOGS_UID
,
2415 OUString( "left" ) ) );
2416 if (!aValue
.isEmpty())
2418 _nBasePosX
+= toInt32( aValue
);
2420 aValue
= _xAttributes
->getValueByUidName(
2421 _pImport
->XMLNS_DIALOGS_UID
,
2422 OUString( "top" ) );
2423 if (!aValue
.isEmpty())
2425 _nBasePosY
+= toInt32( aValue
);
2429 //##################################################################################################
2432 //__________________________________________________________________________________________________
2433 Reference
< xml::input::XElement
> StyleElement::startChildElement(
2434 sal_Int32
/*nUid*/, OUString
const & /*rLocalName*/,
2435 Reference
< xml::input::XAttributes
> const & /*xAttributes*/ )
2436 throw (xml::sax::SAXException
, RuntimeException
)
2438 throw xml::sax::SAXException(
2439 OUString( "unexpected sub elements of style!" ),
2440 Reference
< XInterface
>(), Any() );
2442 //__________________________________________________________________________________________________
2443 void StyleElement::endElement()
2444 throw (xml::sax::SAXException
, RuntimeException
)
2446 Reference
< xml::input::XAttributes
> xStyle
;
2448 _xAttributes
->getValueByUidName(
2449 _pImport
->XMLNS_DIALOGS_UID
,
2450 OUString( "style-id" ) ) );
2451 if (!aStyleId
.isEmpty())
2453 _pImport
->addStyle( aStyleId
, this );
2457 throw xml::sax::SAXException(
2458 OUString( "missing style-id attribute!" ),
2459 Reference
< XInterface
>(), Any() );
2463 //##################################################################################################
2466 //__________________________________________________________________________________________________
2467 Reference
< xml::input::XElement
> StylesElement::startChildElement(
2468 sal_Int32 nUid
, OUString
const & rLocalName
,
2469 Reference
< xml::input::XAttributes
> const & xAttributes
)
2470 throw (xml::sax::SAXException
, RuntimeException
)
2472 if (_pImport
->XMLNS_DIALOGS_UID
!= nUid
)
2474 throw xml::sax::SAXException(
2475 OUString( "illegal namespace!" ),
2476 Reference
< XInterface
>(), Any() );
2479 else if ( rLocalName
== "style" )
2481 return new StyleElement( rLocalName
, xAttributes
, this, _pImport
);
2485 throw xml::sax::SAXException(
2486 OUString( "expected style element!" ),
2487 Reference
< XInterface
>(), Any() );
2491 //##################################################################################################
2494 //__________________________________________________________________________________________________
2495 Reference
< xml::input::XElement
> WindowElement::startChildElement(
2496 sal_Int32 nUid
, OUString
const & rLocalName
,
2497 Reference
< xml::input::XAttributes
> const & xAttributes
)
2498 throw (xml::sax::SAXException
, RuntimeException
)
2501 if (_pImport
->isEventElement( nUid
, rLocalName
))
2503 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
2505 else if (_pImport
->XMLNS_DIALOGS_UID
!= nUid
)
2507 throw xml::sax::SAXException(
2508 OUString( "illegal namespace!" ),
2509 Reference
< XInterface
>(), Any() );
2512 else if ( rLocalName
== "styles" )
2514 return new StylesElement( rLocalName
, xAttributes
, this, _pImport
);
2517 else if ( rLocalName
== "bulletinboard" )
2519 return new BulletinBoardElement( rLocalName
, xAttributes
, this, _pImport
);
2523 throw xml::sax::SAXException(
2524 OUString( "expected styles ot bulletinboard element!" ),
2525 Reference
< XInterface
>(), Any() );
2528 //__________________________________________________________________________________________________
2529 void WindowElement::endElement()
2530 throw (xml::sax::SAXException
, RuntimeException
)
2532 Reference
< beans::XPropertySet
> xProps(
2533 _pImport
->_xDialogModel
, UNO_QUERY_THROW
);
2534 ImportContext
ctx( _pImport
, xProps
, getControlId( _xAttributes
) );
2536 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
2539 StyleElement
* pStyle
= static_cast< StyleElement
* >( xStyle
.get () );
2540 pStyle
->importBackgroundColorStyle( xProps
);
2541 pStyle
->importTextColorStyle( xProps
);
2542 pStyle
->importTextLineColorStyle( xProps
);
2543 pStyle
->importFontStyle( xProps
);
2546 ctx
.importDefaults( 0, 0, _xAttributes
, false );
2547 ctx
.importBooleanProperty(
2548 OUString( "Closeable" ),
2549 OUString( "closeable" ),
2551 ctx
.importBooleanProperty(
2552 OUString( "Moveable" ),
2553 OUString( "moveable" ),
2555 ctx
.importBooleanProperty(
2556 OUString( "Sizeable" ),
2557 OUString( "resizeable" ),
2559 ctx
.importStringProperty(
2560 OUString( "Title" ),
2561 OUString( "title" ),
2563 ctx
.importBooleanProperty(
2564 OUString( "Decoration" ),
2565 OUString( "withtitlebar" ),
2567 ctx
.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "image-src" ), _xAttributes
);
2568 ctx
.importEvents( _events
);
2569 // avoid ring-reference:
2570 // vector< event elements > holding event elements holding this (via _pParent)
2576 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */