update dev300-m58
[ooovba.git] / xmlscript / source / xmldlg_imexp / xmldlg_impmodels.cxx
blob5571c66508ece4698c7473a98b0653ad54120682
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmldlg_impmodels.cxx,v $
10 * $Revision: 1.44 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_xmlscript.hxx"
33 #include "imp_share.hxx"
34 #include <com/sun/star/form/binding/XBindableValue.hpp>
35 #include <com/sun/star/form/binding/XValueBinding.hpp>
36 #include <com/sun/star/form/binding/XListEntrySink.hpp>
37 #include <com/sun/star/beans/NamedValue.hpp>
38 #include <com/sun/star/table/CellAddress.hpp>
39 #include <com/sun/star/table/CellRangeAddress.hpp>
40 #include <com/sun/star/beans/XPropertySet.hpp>
41 #include <com/sun/star/beans/XPropertyState.hpp>
42 #include <com/sun/star/document/XStorageBasedDocument.hpp>
43 #include <com/sun/star/document/XGraphicObjectResolver.hpp>
44 #include <com/sun/star/script/XVBACompat.hpp>
46 #include <comphelper/componentcontext.hxx>
47 #include <comphelper/processfactory.hxx>
48 using namespace ::com::sun::star;
49 using namespace ::com::sun::star::uno;
50 using ::rtl::OUString;
52 namespace xmlscript
54 Reference< xml::input::XElement > MultiPage::startChildElement(
55 sal_Int32 nUid, OUString const & rLocalName,
56 Reference< xml::input::XAttributes > const & xAttributes )
57 throw (xml::sax::SAXException, RuntimeException)
59 // event
60 rtl::OUString _label = rtl::OUString::createFromAscii("foo");
61 if (_pImport->isEventElement( nUid, rLocalName ))
63 return new EventElement(
64 nUid, rLocalName, xAttributes, this, _pImport );
66 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("title") ))
68 getStringAttr( &_label,
69 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
70 xAttributes,
71 _pImport->XMLNS_DIALOGS_UID );
73 return new ElementBase(
74 _pImport->XMLNS_DIALOGS_UID,
75 rLocalName, xAttributes, this, _pImport );
77 else
80 throw xml::sax::SAXException(
81 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
82 Reference< XInterface >(), Any() );
85 //__________________________________________________________________________________________________
87 void MultiPage::endElement()
88 throw (xml::sax::SAXException, RuntimeException)
90 ControlImportContext ctx(
91 _pImport, getControlId( _xAttributes ),
92 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) );
93 // OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) );
94 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
96 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
97 if (xStyle.is())
99 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
100 pStyle->importTextColorStyle( xControlModel );
101 pStyle->importTextLineColorStyle( xControlModel );
102 pStyle->importFontStyle( xControlModel );
105 ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
106 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ),
107 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
108 _xAttributes );
109 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ),
110 OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
111 _xAttributes );
112 ctx.importEvents( _events );
113 // avoid ring-reference:
114 // vector< event elements > holding event elements holding this (via _pParent)
115 _events.clear();
118 // #FIXME cut'n'pasted from xmloff/source/core/xmlimp.cxx:1251
119 // of course we need to find a common home for this helper
121 bool IsPackageURL( const ::rtl::OUString& rURL )
123 // Some quick tests: Some may rely on the package structure!
124 sal_Int32 nLen = rURL.getLength();
125 if( (nLen > 0 && '/' == rURL[0]) )
126 // RFC2396 net_path or abs_path
127 return false;
128 else if( nLen > 1 && '.' == rURL[0] )
130 if( '.' == rURL[1] )
131 // ../: We are never going up one level, so we know
132 // it's not an external URI
133 return false;
134 else if( '/' == rURL[1] )
135 // we are remaining on a level, so it's an package URI
136 return true;
139 // Now check for a RFC2396 schema
140 sal_Int32 nPos = 1;
141 while( nPos < nLen )
143 switch( rURL[nPos] )
145 case '/':
146 // a relative path segement
147 return true;
148 case ':':
149 // a schema
150 return false;
151 default:
152 break;
153 // we don't care about any other characters
155 ++nPos;
158 return true;
161 void importBindableAndListRangeBits( DialogImport* _pImport, const rtl::OUString sLinkedCell, const rtl::OUString & sCellRange, ControlImportContext& ctx )
163 Reference< lang::XMultiServiceFactory > xFac( _pImport->getDocOwner(), UNO_QUERY );
164 if ( xFac.is() && ( sLinkedCell.getLength() || sCellRange.getLength() ) )
166 // Set up Celllink
167 if ( sLinkedCell.getLength() )
169 Reference< form::binding::XBindableValue > xBindable( ctx.getControlModel(), uno::UNO_QUERY );
170 Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
171 if ( xBindable.is() && xConvertor.is() )
173 table::CellAddress aAddress;
174 xConvertor->setPropertyValue( OUSTR( "PersistentRepresentation" ), uno::makeAny( sLinkedCell ) );
175 xConvertor->getPropertyValue( OUSTR( "Address" ) ) >>= aAddress;
176 beans::NamedValue aArg1;
177 aArg1.Name = OUSTR("BoundCell");
178 aArg1.Value <<= aAddress;
180 uno::Sequence< uno::Any > aArgs(1);
181 aArgs[ 0 ] <<= aArg1;
183 uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( OUSTR("com.sun.star.table.CellValueBinding" ), aArgs ), uno::UNO_QUERY );
184 xBindable->setValueBinding( xBinding );
188 // Set up CelllRange
189 if ( sCellRange.getLength() )
191 Reference< form::binding::XListEntrySink > xListEntrySink( ctx.getControlModel(), uno::UNO_QUERY );
192 Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
193 if ( xListEntrySink.is() && xConvertor.is() )
195 table::CellRangeAddress aAddress;
196 xConvertor->setPropertyValue( OUSTR( "PersistentRepresentation" ), uno::makeAny( sCellRange ) );
197 xConvertor->getPropertyValue( OUSTR( "Address" ) ) >>= aAddress;
198 beans::NamedValue aArg1;
199 aArg1.Name = OUSTR("CellRange");
200 aArg1.Value <<= aAddress;
202 uno::Sequence< uno::Any > aArgs(1);
203 aArgs[ 0 ] <<= aArg1;
205 uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( OUSTR("com.sun.star.table.CellRangeListSource" ), aArgs ), uno::UNO_QUERY );
206 xListEntrySink->setListEntrySource( xSource );
213 sal_Bool isVBACompatModeOn( DialogImport* _pImport )
215 sal_Bool bVBAMode = sal_False;
216 Reference< script::XVBACompat > xVBACompat( _pImport->getScriptLibraryContainer(), UNO_QUERY );
217 if( xVBACompat.is() )
219 bVBAMode = xVBACompat->getVBACompatModeOn();
221 return bVBAMode;
224 // progessmeter
225 //__________________________________________________________________________________________________
226 Reference< xml::input::XElement > ProgressBarElement::startChildElement(
227 sal_Int32 nUid, OUString const & rLocalName,
228 Reference< xml::input::XAttributes > const & xAttributes )
229 throw (xml::sax::SAXException, RuntimeException)
231 // event
232 if (_pImport->isEventElement( nUid, rLocalName ))
234 return new EventElement(
235 nUid, rLocalName, xAttributes, this, _pImport );
237 else
239 throw xml::sax::SAXException(
240 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
241 Reference< XInterface >(), Any() );
244 //__________________________________________________________________________________________________
245 void ProgressBarElement::endElement()
246 throw (xml::sax::SAXException, RuntimeException)
248 ControlImportContext ctx(
249 _pImport, getControlId( _xAttributes ),
250 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) );
252 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
253 if (xStyle.is())
255 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
256 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
257 pStyle->importBackgroundColorStyle( xControlModel );
258 pStyle->importBorderStyle( xControlModel );
259 pStyle->importFillColorStyle( xControlModel );
262 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
263 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ),
264 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
265 _xAttributes );
266 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMin") ),
267 OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
268 _xAttributes );
269 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ),
270 OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
271 _xAttributes );
272 ctx.importEvents( _events );
273 // avoid ring-reference:
274 // vector< event elements > holding event elements holding this (via _pParent)
275 _events.clear();
278 //##################################################################################################
280 // scrollbar
281 //__________________________________________________________________________________________________
282 Reference< xml::input::XElement > ScrollBarElement::startChildElement(
283 sal_Int32 nUid, OUString const & rLocalName,
284 Reference< xml::input::XAttributes > const & xAttributes )
285 throw (xml::sax::SAXException, RuntimeException)
287 // event
288 if (_pImport->isEventElement( nUid, rLocalName ))
290 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
292 else
294 throw xml::sax::SAXException(
295 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
296 Reference< XInterface >(), Any() );
299 //__________________________________________________________________________________________________
300 void ScrollBarElement::endElement()
301 throw (xml::sax::SAXException, RuntimeException)
303 OUString sService( OUSTR("com.sun.star.awt.UnoControlScrollBarModel") );
304 // we should probably limit this to vba mode also ( leave for now )
305 if ( isVBACompatModeOn( _pImport ) )
306 sService = OUSTR("com.sun.star.form.component.ScrollBar");
308 OUString sLinkedCell;
311 sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
313 catch( Exception& /*e*/ )
317 ControlImportContext ctx(
318 _pImport, getControlId( _xAttributes ),
319 sService );
321 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
322 if (xStyle.is())
324 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
325 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
326 pStyle->importBackgroundColorStyle( xControlModel );
327 pStyle->importBorderStyle( xControlModel );
330 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
331 ctx.importOrientationProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
332 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
333 _xAttributes );
334 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("BlockIncrement") ),
335 OUString( RTL_CONSTASCII_USTRINGPARAM("pageincrement") ),
336 _xAttributes );
337 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineIncrement") ),
338 OUString( RTL_CONSTASCII_USTRINGPARAM("increment") ),
339 _xAttributes );
340 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScrollValue") ),
341 OUString( RTL_CONSTASCII_USTRINGPARAM("curpos") ),
342 _xAttributes );
343 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMax") ),
344 OUString( RTL_CONSTASCII_USTRINGPARAM("maxpos") ),
345 _xAttributes );
346 ctx.importLongProperty( OUSTR("ScrollValueMin"), OUSTR("minpos"),
347 _xAttributes );
348 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VisibleSize") ),
349 OUString( RTL_CONSTASCII_USTRINGPARAM("visible-size") ),
350 _xAttributes );
351 ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
352 _xAttributes );
353 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
354 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
355 _xAttributes );
356 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LiveScroll") ),
357 OUString( RTL_CONSTASCII_USTRINGPARAM("live-scroll") ),
358 _xAttributes );
359 ctx.importHexLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
360 OUString( RTL_CONSTASCII_USTRINGPARAM("symbol-color") ),
361 _xAttributes );
363 // import cell-link
364 OUString sCellRange;
365 importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
367 ctx.importEvents( _events );
368 // avoid ring-reference:
369 // vector< event elements > holding event elements holding this (via _pParent)
370 _events.clear();
373 //##################################################################################################
375 // spinbutton
376 //__________________________________________________________________________________________________
377 Reference< xml::input::XElement > SpinButtonElement::startChildElement(
378 sal_Int32 nUid, OUString const & rLocalName,
379 Reference< xml::input::XAttributes > const & xAttributes )
380 throw (xml::sax::SAXException, RuntimeException)
382 // event
383 if (_pImport->isEventElement( nUid, rLocalName ))
385 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
387 else
389 throw xml::sax::SAXException(
390 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
391 Reference< XInterface >(), Any() );
394 //__________________________________________________________________________________________________
395 void SpinButtonElement::endElement()
396 throw (xml::sax::SAXException, RuntimeException)
398 OUString sLinkedCell;
401 sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
403 catch( Exception& /*e*/ )
407 ControlImportContext ctx(
408 _pImport, getControlId( _xAttributes ),
409 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.SpinButton") ) );
411 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
412 if (xStyle.is())
414 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
415 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
416 pStyle->importBackgroundColorStyle( xControlModel );
417 pStyle->importBorderStyle( xControlModel );
420 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
421 ctx.importOrientationProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
422 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
423 _xAttributes );
424 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinIncrement") ),
425 OUString( RTL_CONSTASCII_USTRINGPARAM("increment") ),
426 _xAttributes );
427 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ),
428 OUString( RTL_CONSTASCII_USTRINGPARAM("curval") ),
429 _xAttributes );
430 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ),
431 OUString( RTL_CONSTASCII_USTRINGPARAM("maxval") ),
432 _xAttributes );
433 ctx.importLongProperty( OUSTR("SpinValueMin"), OUSTR("minval"),
434 _xAttributes );
435 ctx.importLongProperty( OUSTR("Repeat"), OUSTR("repeat"),
436 _xAttributes );
437 ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat-delay"),
438 _xAttributes );
439 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
440 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
441 _xAttributes );
442 ctx.importHexLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
443 OUString( RTL_CONSTASCII_USTRINGPARAM("symbol-color") ),
444 _xAttributes );
445 // import cell-link
446 OUString sCellRange;
447 importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
449 ctx.importEvents( _events );
450 // avoid ring-reference:
451 // vector< event elements > holding event elements holding this (via _pParent)
452 _events.clear();
455 //##################################################################################################
457 // fixedline
458 //__________________________________________________________________________________________________
459 Reference< xml::input::XElement > FixedLineElement::startChildElement(
460 sal_Int32 nUid, OUString const & rLocalName,
461 Reference< xml::input::XAttributes > const & xAttributes )
462 throw (xml::sax::SAXException, RuntimeException)
464 // event
465 if (_pImport->isEventElement( nUid, rLocalName ))
467 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
469 else
471 throw xml::sax::SAXException(
472 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
473 Reference< XInterface >(), Any() );
476 //__________________________________________________________________________________________________
477 void FixedLineElement::endElement()
478 throw (xml::sax::SAXException, RuntimeException)
480 ControlImportContext ctx(
481 _pImport, getControlId( _xAttributes ),
482 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel") ) );
484 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
485 if (xStyle.is())
487 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
488 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
489 pStyle->importTextColorStyle( xControlModel );
490 pStyle->importTextLineColorStyle( xControlModel );
491 pStyle->importFontStyle( xControlModel );
494 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
495 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
496 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
497 _xAttributes );
498 ctx.importOrientationProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
499 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
500 _xAttributes );
501 ctx.importEvents( _events );
502 // avoid ring-reference:
503 // vector< event elements > holding event elements holding this (via _pParent)
504 _events.clear();
507 //##################################################################################################
509 // patternfield
510 //__________________________________________________________________________________________________
511 Reference< xml::input::XElement > PatternFieldElement::startChildElement(
512 sal_Int32 nUid, OUString const & rLocalName,
513 Reference< xml::input::XAttributes > const & xAttributes )
514 throw (xml::sax::SAXException, RuntimeException)
516 // event
517 if (_pImport->isEventElement( nUid, rLocalName ))
519 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
521 else
523 throw xml::sax::SAXException(
524 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
525 Reference< XInterface >(), Any() );
528 //__________________________________________________________________________________________________
529 void PatternFieldElement::endElement()
530 throw (xml::sax::SAXException, RuntimeException)
532 ControlImportContext ctx(
533 _pImport, getControlId( _xAttributes ),
534 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlPatternFieldModel") ) );
536 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
537 if (xStyle.is())
539 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
540 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
541 pStyle->importBackgroundColorStyle( xControlModel );
542 pStyle->importTextColorStyle( xControlModel );
543 pStyle->importTextLineColorStyle( xControlModel );
544 pStyle->importBorderStyle( xControlModel );
545 pStyle->importFontStyle( xControlModel );
548 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
549 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
550 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
551 _xAttributes );
552 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
553 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
554 _xAttributes );
555 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
556 OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ),
557 _xAttributes );
558 ctx.importBooleanProperty(
559 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
560 _xAttributes );
561 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
562 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
563 _xAttributes );
564 ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
565 OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ),
566 _xAttributes );
567 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EditMask") ),
568 OUString( RTL_CONSTASCII_USTRINGPARAM("edit-mask") ),
569 _xAttributes );
570 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LiteralMask") ),
571 OUString( RTL_CONSTASCII_USTRINGPARAM("literal-mask") ),
572 _xAttributes );
573 ctx.importEvents( _events );
574 // avoid ring-reference:
575 // vector< event elements > holding event elements holding this (via _pParent)
576 _events.clear();
579 //##################################################################################################
581 // formattedfield
582 //__________________________________________________________________________________________________
583 Reference< xml::input::XElement > FormattedFieldElement::startChildElement(
584 sal_Int32 nUid, OUString const & rLocalName,
585 Reference< xml::input::XAttributes > const & xAttributes )
586 throw (xml::sax::SAXException, RuntimeException)
588 // event
589 if (_pImport->isEventElement( nUid, rLocalName ))
591 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
593 else
595 throw xml::sax::SAXException(
596 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
597 Reference< XInterface >(), Any() );
600 //__________________________________________________________________________________________________
601 void FormattedFieldElement::endElement()
602 throw (xml::sax::SAXException, RuntimeException)
604 ControlImportContext ctx(
605 _pImport, getControlId( _xAttributes ),
606 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFormattedFieldModel") ) );
608 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
609 if (xStyle.is())
611 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
612 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
613 pStyle->importBackgroundColorStyle( xControlModel );
614 pStyle->importTextColorStyle( xControlModel );
615 pStyle->importTextLineColorStyle( xControlModel );
616 pStyle->importBorderStyle( xControlModel );
617 pStyle->importFontStyle( xControlModel );
620 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
621 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
622 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
623 _xAttributes );
624 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
625 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
626 _xAttributes );
627 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
628 OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ),
629 _xAttributes );
630 ctx.importBooleanProperty(
631 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
632 _xAttributes );
633 ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
634 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
635 _xAttributes );
636 ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveMin") ),
637 OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
638 _xAttributes );
639 ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveMax") ),
640 OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
641 _xAttributes );
642 ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveValue") ),
643 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
644 _xAttributes );
645 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
646 OUString( RTL_CONSTASCII_USTRINGPARAM("text") ),
647 _xAttributes );
648 ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
649 OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ),
650 _xAttributes );
651 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
652 OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
653 _xAttributes );
654 if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
655 _xAttributes ))
656 ctx.getControlModel()->setPropertyValue(
657 OUSTR("Repeat"), makeAny(true) );
659 OUString sDefault(
660 _xAttributes->getValueByUidName(
661 _pImport->XMLNS_DIALOGS_UID,
662 OUString( RTL_CONSTASCII_USTRINGPARAM("value-default") ) ) );
663 if (sDefault.getLength())
665 double d = sDefault.toDouble();
666 if (d != 0.0 ||
667 sDefault.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("0") ) ||
668 sDefault.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("0.0") ))
670 ctx.getControlModel()->setPropertyValue(
671 OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveDefault") ),
672 makeAny( d ) );
674 else // treat as string
676 ctx.getControlModel()->setPropertyValue(
677 OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveDefault") ),
678 makeAny( sDefault ) );
682 // format spec
683 ctx.getControlModel()->setPropertyValue(
684 OUString( RTL_CONSTASCII_USTRINGPARAM("FormatsSupplier") ),
685 makeAny( _pImport->getNumberFormatsSupplier() ) );
687 OUString sFormat(
688 _xAttributes->getValueByUidName(
689 _pImport->XMLNS_DIALOGS_UID,
690 OUString( RTL_CONSTASCII_USTRINGPARAM("format-code") ) ) );
691 if (sFormat.getLength())
693 lang::Locale locale;
695 OUString sLocale(
696 _xAttributes->getValueByUidName(
697 _pImport->XMLNS_DIALOGS_UID,
698 OUString( RTL_CONSTASCII_USTRINGPARAM("format-locale") ) ) );
699 if (sLocale.getLength())
701 // split locale
702 sal_Int32 semi0 = sLocale.indexOf( ';' );
703 if (semi0 < 0) // no semi at all, just try language
705 locale.Language = sLocale;
707 else
709 sal_Int32 semi1 = sLocale.indexOf( ';', semi0 +1 );
710 if (semi1 > semi0) // language;country;variant
712 locale.Language = sLocale.copy( 0, semi0 );
713 locale.Country = sLocale.copy( semi0 +1, semi1 - semi0 -1 );
714 locale.Variant = sLocale.copy( semi1 +1 );
716 else // try language;country
718 locale.Language = sLocale.copy( 0, semi0 );
719 locale.Country = sLocale.copy( semi0 +1 );
726 Reference< util::XNumberFormats > xFormats(
727 _pImport->getNumberFormatsSupplier()->getNumberFormats() );
728 sal_Int32 nKey = xFormats->queryKey( sFormat, locale, sal_True );
729 if (-1 == nKey)
731 nKey = xFormats->addNew( sFormat, locale );
733 ctx.getControlModel()->setPropertyValue(
734 OUString( RTL_CONSTASCII_USTRINGPARAM("FormatKey") ), makeAny( nKey ) );
736 catch (util::MalformedNumberFormatException & exc)
738 OSL_ENSURE( 0, "### util::MalformedNumberFormatException occured!" );
739 // rethrow
740 throw xml::sax::SAXException( exc.Message, Reference< XInterface >(), Any() );
743 ctx.importBooleanProperty(
744 OUString( RTL_CONSTASCII_USTRINGPARAM("TreatAsNumber") ),
745 OUString( RTL_CONSTASCII_USTRINGPARAM("treat-as-number") ),
746 _xAttributes );
747 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
748 OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
749 _xAttributes );
751 ctx.importEvents( _events );
752 // avoid ring-reference:
753 // vector< event elements > holding event elements holding this (via _pParent)
754 _events.clear();
757 //##################################################################################################
759 // timefield
760 //__________________________________________________________________________________________________
761 Reference< xml::input::XElement > TimeFieldElement::startChildElement(
762 sal_Int32 nUid, OUString const & rLocalName,
763 Reference< xml::input::XAttributes > const & xAttributes )
764 throw (xml::sax::SAXException, RuntimeException)
766 // event
767 if (_pImport->isEventElement( nUid, rLocalName ))
769 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
771 else
773 throw xml::sax::SAXException(
774 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
775 Reference< XInterface >(), Any() );
778 //__________________________________________________________________________________________________
779 void TimeFieldElement::endElement()
780 throw (xml::sax::SAXException, RuntimeException)
782 ControlImportContext ctx(
783 _pImport, getControlId( _xAttributes ),
784 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlTimeFieldModel") ) );
786 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
787 if (xStyle.is())
789 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
790 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
791 pStyle->importBackgroundColorStyle( xControlModel );
792 pStyle->importTextColorStyle( xControlModel );
793 pStyle->importTextLineColorStyle( xControlModel );
794 pStyle->importBorderStyle( xControlModel );
795 pStyle->importFontStyle( xControlModel );
798 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
799 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
800 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
801 _xAttributes );
802 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
803 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
804 _xAttributes );
805 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
806 OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ),
807 _xAttributes );
808 ctx.importBooleanProperty(
809 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
810 _xAttributes );
811 ctx.importTimeFormatProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeFormat") ),
812 OUString( RTL_CONSTASCII_USTRINGPARAM("time-format") ),
813 _xAttributes );
814 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Time") ),
815 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
816 _xAttributes );
817 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeMin") ),
818 OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
819 _xAttributes );
820 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeMax") ),
821 OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
822 _xAttributes );
823 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
824 OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
825 _xAttributes );
826 if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
827 _xAttributes ))
828 ctx.getControlModel()->setPropertyValue(
829 OUSTR("Repeat"), makeAny(true) );
830 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
831 OUString( RTL_CONSTASCII_USTRINGPARAM("text") ),
832 _xAttributes );
833 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
834 OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
835 _xAttributes );
837 ctx.importEvents( _events );
838 // avoid ring-reference:
839 // vector< event elements > holding event elements holding this (via _pParent)
840 _events.clear();
843 //##################################################################################################
845 // numericfield
846 //__________________________________________________________________________________________________
847 Reference< xml::input::XElement > NumericFieldElement::startChildElement(
848 sal_Int32 nUid, OUString const & rLocalName,
849 Reference< xml::input::XAttributes > const & xAttributes )
850 throw (xml::sax::SAXException, RuntimeException)
852 // event
853 if (_pImport->isEventElement( nUid, rLocalName ))
855 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
857 else
859 throw xml::sax::SAXException(
860 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
861 Reference< XInterface >(), Any() );
864 //__________________________________________________________________________________________________
865 void NumericFieldElement::endElement()
866 throw (xml::sax::SAXException, RuntimeException)
868 ControlImportContext ctx(
869 _pImport, getControlId( _xAttributes ),
870 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlNumericFieldModel") ) );
872 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
873 if (xStyle.is())
875 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
876 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
877 pStyle->importBackgroundColorStyle( xControlModel );
878 pStyle->importTextColorStyle( xControlModel );
879 pStyle->importTextLineColorStyle( xControlModel );
880 pStyle->importBorderStyle( xControlModel );
881 pStyle->importFontStyle( xControlModel );
884 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
885 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
886 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
887 _xAttributes );
888 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
889 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
890 _xAttributes );
891 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
892 OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ),
893 _xAttributes );
894 ctx.importBooleanProperty(
895 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
896 _xAttributes );
897 ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DecimalAccuracy") ),
898 OUString( RTL_CONSTASCII_USTRINGPARAM("decimal-accuracy") ),
899 _xAttributes );
900 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowThousandsSeparator") ),
901 OUString( RTL_CONSTASCII_USTRINGPARAM("thousands-separator") ),
902 _xAttributes );
903 ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Value") ),
904 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
905 _xAttributes );
906 ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMin") ),
907 OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
908 _xAttributes );
909 ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMax") ),
910 OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
911 _xAttributes );
912 ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueStep") ),
913 OUString( RTL_CONSTASCII_USTRINGPARAM("value-step") ),
914 _xAttributes );
915 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
916 OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
917 _xAttributes );
918 if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
919 _xAttributes ))
920 ctx.getControlModel()->setPropertyValue(
921 OUSTR("Repeat"), makeAny(true) );
922 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
923 OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
924 _xAttributes );
925 ctx.importEvents( _events );
926 // avoid ring-reference:
927 // vector< event elements > holding event elements holding this (via _pParent)
928 _events.clear();
931 //##################################################################################################
933 // datefield
934 //__________________________________________________________________________________________________
935 Reference< xml::input::XElement > DateFieldElement::startChildElement(
936 sal_Int32 nUid, OUString const & rLocalName,
937 Reference< xml::input::XAttributes > const & xAttributes )
938 throw (xml::sax::SAXException, RuntimeException)
940 // event
941 if (_pImport->isEventElement( nUid, rLocalName ))
943 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
945 else
947 throw xml::sax::SAXException(
948 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
949 Reference< XInterface >(), Any() );
952 //__________________________________________________________________________________________________
953 void DateFieldElement::endElement()
954 throw (xml::sax::SAXException, RuntimeException)
956 ControlImportContext ctx(
957 _pImport, getControlId( _xAttributes ),
958 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDateFieldModel") ) );
960 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
961 if (xStyle.is())
963 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
964 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
965 pStyle->importBackgroundColorStyle( xControlModel );
966 pStyle->importTextColorStyle( xControlModel );
967 pStyle->importTextLineColorStyle( xControlModel );
968 pStyle->importBorderStyle( xControlModel );
969 pStyle->importFontStyle( xControlModel );
972 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
973 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
974 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
975 _xAttributes );
976 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
977 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
978 _xAttributes );
979 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
980 OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ),
981 _xAttributes );
982 ctx.importBooleanProperty(
983 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
984 _xAttributes );
985 ctx.importDateFormatProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateFormat") ),
986 OUString( RTL_CONSTASCII_USTRINGPARAM("date-format") ),
987 _xAttributes );
988 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateShowCentury") ),
989 OUString( RTL_CONSTASCII_USTRINGPARAM("show-century") ),
990 _xAttributes );
991 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Date") ),
992 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
993 _xAttributes );
994 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateMin") ),
995 OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
996 _xAttributes );
997 ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateMax") ),
998 OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
999 _xAttributes );
1000 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
1001 OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
1002 _xAttributes );
1003 if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
1004 _xAttributes ))
1005 ctx.getControlModel()->setPropertyValue(
1006 OUSTR("Repeat"), makeAny(true) );
1007 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
1008 OUString( RTL_CONSTASCII_USTRINGPARAM("dropdown") ),
1009 _xAttributes );
1010 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
1011 OUString( RTL_CONSTASCII_USTRINGPARAM("text") ),
1012 _xAttributes );
1013 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
1014 OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
1015 _xAttributes );
1016 ctx.importEvents( _events );
1017 // avoid ring-reference:
1018 // vector< event elements > holding event elements holding this (via _pParent)
1019 _events.clear();
1022 //##################################################################################################
1024 // currencyfield
1025 //__________________________________________________________________________________________________
1026 Reference< xml::input::XElement > CurrencyFieldElement::startChildElement(
1027 sal_Int32 nUid, OUString const & rLocalName,
1028 Reference< xml::input::XAttributes > const & xAttributes )
1029 throw (xml::sax::SAXException, RuntimeException)
1031 // event
1032 if (_pImport->isEventElement( nUid, rLocalName ))
1034 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1036 else
1038 throw xml::sax::SAXException(
1039 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1040 Reference< XInterface >(), Any() );
1043 //__________________________________________________________________________________________________
1044 void CurrencyFieldElement::endElement()
1045 throw (xml::sax::SAXException, RuntimeException)
1047 ControlImportContext ctx(
1048 _pImport, getControlId( _xAttributes ),
1049 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCurrencyFieldModel") ) );
1051 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1052 if (xStyle.is())
1054 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1055 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1056 pStyle->importBackgroundColorStyle( xControlModel );
1057 pStyle->importTextColorStyle( xControlModel );
1058 pStyle->importTextLineColorStyle( xControlModel );
1059 pStyle->importBorderStyle( xControlModel );
1060 pStyle->importFontStyle( xControlModel );
1063 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1064 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1065 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1066 _xAttributes );
1067 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
1068 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
1069 _xAttributes );
1070 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
1071 OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ),
1072 _xAttributes );
1073 ctx.importBooleanProperty(
1074 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
1075 _xAttributes );
1076 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("CurrencySymbol") ),
1077 OUString( RTL_CONSTASCII_USTRINGPARAM("currency-symbol") ),
1078 _xAttributes );
1079 ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DecimalAccuracy") ),
1080 OUString( RTL_CONSTASCII_USTRINGPARAM("decimal-accuracy") ),
1081 _xAttributes );
1082 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowThousandsSeparator") ),
1083 OUString( RTL_CONSTASCII_USTRINGPARAM("thousands-separator") ),
1084 _xAttributes );
1085 ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Value") ),
1086 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1087 _xAttributes );
1088 ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMin") ),
1089 OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
1090 _xAttributes );
1091 ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMax") ),
1092 OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
1093 _xAttributes );
1094 ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueStep") ),
1095 OUString( RTL_CONSTASCII_USTRINGPARAM("value-step") ),
1096 _xAttributes );
1097 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
1098 OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
1099 _xAttributes );
1100 if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
1101 _xAttributes ))
1102 ctx.getControlModel()->setPropertyValue(
1103 OUSTR("Repeat"), makeAny(true) );
1104 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("PrependCurrencySymbol") ),
1105 OUString( RTL_CONSTASCII_USTRINGPARAM("prepend-symbol") ),
1106 _xAttributes );
1107 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
1108 OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
1109 _xAttributes );
1110 ctx.importEvents( _events );
1111 // avoid ring-reference:
1112 // vector< event elements > holding event elements holding this (via _pParent)
1113 _events.clear();
1116 //##################################################################################################
1118 // filecontrol
1119 //__________________________________________________________________________________________________
1120 Reference< xml::input::XElement > FileControlElement::startChildElement(
1121 sal_Int32 nUid, OUString const & rLocalName,
1122 Reference< xml::input::XAttributes > const & xAttributes )
1123 throw (xml::sax::SAXException, RuntimeException)
1125 // event
1126 if (_pImport->isEventElement( nUid, rLocalName ))
1128 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1130 else
1132 throw xml::sax::SAXException(
1133 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1134 Reference< XInterface >(), Any() );
1137 //__________________________________________________________________________________________________
1138 void FileControlElement::endElement()
1139 throw (xml::sax::SAXException, RuntimeException)
1141 ControlImportContext ctx(
1142 _pImport, getControlId( _xAttributes ),
1143 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFileControlModel") ) );
1145 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1146 if (xStyle.is())
1148 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1149 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1150 pStyle->importBackgroundColorStyle( xControlModel );
1151 pStyle->importTextColorStyle( xControlModel );
1152 pStyle->importTextLineColorStyle( xControlModel );
1153 pStyle->importBorderStyle( xControlModel );
1154 pStyle->importFontStyle( xControlModel );
1157 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1158 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1159 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1160 _xAttributes );
1161 ctx.importBooleanProperty(
1162 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
1163 _xAttributes );
1164 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
1165 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1166 _xAttributes );
1167 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
1168 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
1169 _xAttributes );
1170 ctx.importEvents( _events );
1171 // avoid ring-reference:
1172 // vector< event elements > holding event elements holding this (via _pParent)
1173 _events.clear();
1175 //##################################################################################################
1177 // treecontrol
1178 //__________________________________________________________________________________________________
1179 Reference< xml::input::XElement > TreeControlElement::startChildElement(
1180 sal_Int32 nUid, OUString const & rLocalName,
1181 Reference< xml::input::XAttributes > const & xAttributes )
1182 throw (xml::sax::SAXException, RuntimeException)
1184 // event
1185 if (_pImport->isEventElement( nUid, rLocalName ))
1187 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1189 else
1191 throw xml::sax::SAXException(
1192 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1193 Reference< XInterface >(), Any() );
1196 //__________________________________________________________________________________________________
1197 void TreeControlElement::endElement()
1198 throw (xml::sax::SAXException, RuntimeException)
1200 ControlImportContext ctx(
1201 _pImport, getControlId( _xAttributes ),
1202 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.tree.TreeControlModel") ) );
1204 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1205 if (xStyle.is())
1207 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1208 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1209 pStyle->importBackgroundColorStyle( xControlModel );
1210 pStyle->importBorderStyle( xControlModel );
1213 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1214 ctx.importSelectionTypeProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectionType") ),
1215 OUString( RTL_CONSTASCII_USTRINGPARAM("selectiontype") ),
1216 _xAttributes );
1217 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("RootDisplayed") ),
1218 OUString( RTL_CONSTASCII_USTRINGPARAM("rootdisplayed") ),
1219 _xAttributes );
1220 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsHandles") ),
1221 OUString( RTL_CONSTASCII_USTRINGPARAM("showshandles") ),
1222 _xAttributes );
1223 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsRootHandles") ),
1224 OUString( RTL_CONSTASCII_USTRINGPARAM("showsroothandles") ),
1225 _xAttributes );
1226 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Editable") ),
1227 OUString( RTL_CONSTASCII_USTRINGPARAM("editable") ),
1228 _xAttributes );
1229 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("RowHeight") ),
1230 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
1231 _xAttributes );
1232 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("InvokesStopNodeEditing") ),
1233 OUString( RTL_CONSTASCII_USTRINGPARAM("invokesstopnodeediting") ),
1234 _xAttributes );
1236 ctx.importEvents( _events );
1237 // avoid ring-reference:
1238 // vector< event elements > holding event elements holding this (via _pParent)
1239 _events.clear();
1242 //##################################################################################################
1244 // imagecontrol
1245 //__________________________________________________________________________________________________
1246 Reference< xml::input::XElement > ImageControlElement::startChildElement(
1247 sal_Int32 nUid, OUString const & rLocalName,
1248 Reference< xml::input::XAttributes > const & xAttributes )
1249 throw (xml::sax::SAXException, RuntimeException)
1251 // event
1252 if (_pImport->isEventElement( nUid, rLocalName ))
1254 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1256 else
1258 throw xml::sax::SAXException(
1259 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1260 Reference< XInterface >(), Any() );
1263 //__________________________________________________________________________________________________
1264 void ImageControlElement::endElement()
1265 throw (xml::sax::SAXException, RuntimeException)
1267 ControlImportContext ctx(
1268 _pImport, getControlId( _xAttributes ),
1269 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) );
1271 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1272 if (xStyle.is())
1274 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1275 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1276 pStyle->importBackgroundColorStyle( xControlModel );
1277 pStyle->importBorderStyle( xControlModel );
1280 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1281 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
1282 OUString( RTL_CONSTASCII_USTRINGPARAM("scale-image") ),
1283 _xAttributes );
1284 rtl::OUString sURL = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "src" ) );
1285 Reference< document::XStorageBasedDocument > xDocStorage( _pImport->getDocOwner(), UNO_QUERY );
1287 if ( xDocStorage.is() && IsPackageURL( sURL ) )
1289 uno::Sequence< Any > aArgs( 1 );
1290 aArgs[ 0 ] <<= xDocStorage->getDocumentStorage();
1292 ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
1293 uno::Reference< document::XGraphicObjectResolver > xGraphicResolver;
1294 aContext.createComponentWithArguments( OUSTR( "com.sun.star.comp.Svx.GraphicImportHelper" ), aArgs, xGraphicResolver );
1296 if ( xGraphicResolver.is() )
1298 rtl::OUString aTmp( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) );
1299 aTmp += sURL;
1300 sURL = xGraphicResolver->resolveGraphicObjectURL( aTmp );
1301 Reference< beans::XPropertySet > xProps( ctx.getControlModel(), UNO_QUERY );
1302 // we must set the url while the graphic object ( held by the resolver is in scope )
1303 if ( xProps.is() )
1304 xProps->setPropertyValue( OUSTR("ImageURL"), makeAny( sURL ) );
1308 else if ( sURL.getLength() > 0 )
1310 Reference< beans::XPropertySet > xProps( ctx.getControlModel(), UNO_QUERY );
1311 if ( xProps.is() )
1312 xProps->setPropertyValue( OUSTR("ImageURL"), makeAny( sURL ) );
1315 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1316 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1317 _xAttributes );
1318 ctx.importEvents( _events );
1319 // avoid ring-reference:
1320 // vector< event elements > holding event elements holding this (via _pParent)
1321 _events.clear();
1324 //##################################################################################################
1326 // textfield
1327 //__________________________________________________________________________________________________
1328 Reference< xml::input::XElement > TextElement::startChildElement(
1329 sal_Int32 nUid, OUString const & rLocalName,
1330 Reference< xml::input::XAttributes > const & xAttributes )
1331 throw (xml::sax::SAXException, RuntimeException)
1333 // event
1334 if (_pImport->isEventElement( nUid, rLocalName ))
1336 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1338 else
1340 throw xml::sax::SAXException(
1341 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1342 Reference< XInterface >(), Any() );
1345 //__________________________________________________________________________________________________
1346 void TextElement::endElement()
1347 throw (xml::sax::SAXException, RuntimeException)
1349 ControlImportContext ctx(
1350 _pImport, getControlId( _xAttributes ),
1351 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) );
1353 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1354 if (xStyle.is())
1356 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1357 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1358 pStyle->importBackgroundColorStyle( xControlModel );
1359 pStyle->importTextColorStyle( xControlModel );
1360 pStyle->importTextLineColorStyle( xControlModel );
1361 pStyle->importBorderStyle( xControlModel );
1362 pStyle->importFontStyle( xControlModel );
1365 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1366 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1367 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1368 _xAttributes );
1369 ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1370 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1371 _xAttributes );
1372 ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
1373 OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
1374 _xAttributes );
1375 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1376 OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1377 _xAttributes );
1378 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1379 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1380 _xAttributes );
1381 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("NoLabel") ),
1382 OUString( RTL_CONSTASCII_USTRINGPARAM("nolabel") ),
1383 _xAttributes );
1384 ctx.importEvents( _events );
1385 // avoid ring-reference:
1386 // vector< event elements > holding event elements holding this (via _pParent)
1387 _events.clear();
1390 //##################################################################################################
1391 // FixedHyperLink
1392 //__________________________________________________________________________________________________
1393 Reference< xml::input::XElement > FixedHyperLinkElement::startChildElement(
1394 sal_Int32 nUid, OUString const & rLocalName,
1395 Reference< xml::input::XAttributes > const & xAttributes )
1396 throw (xml::sax::SAXException, RuntimeException)
1398 // event
1399 if (_pImport->isEventElement( nUid, rLocalName ))
1401 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1403 else
1405 throw xml::sax::SAXException(
1406 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1407 Reference< XInterface >(), Any() );
1410 //__________________________________________________________________________________________________
1411 void FixedHyperLinkElement::endElement()
1412 throw (xml::sax::SAXException, RuntimeException)
1414 ControlImportContext ctx(
1415 _pImport, getControlId( _xAttributes ),
1416 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedHyperlinkModel") ) );
1418 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1419 if (xStyle.is())
1421 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1422 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1423 pStyle->importBackgroundColorStyle( xControlModel );
1424 pStyle->importTextColorStyle( xControlModel );
1425 pStyle->importTextLineColorStyle( xControlModel );
1426 pStyle->importBorderStyle( xControlModel );
1427 pStyle->importFontStyle( xControlModel );
1430 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1431 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1432 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1433 _xAttributes );
1434 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("URL") ),
1435 OUString( RTL_CONSTASCII_USTRINGPARAM("url") ),
1436 _xAttributes );
1437 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Description") ),
1438 OUString( RTL_CONSTASCII_USTRINGPARAM("description") ),
1439 _xAttributes );
1441 ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1442 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1443 _xAttributes );
1444 ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
1445 OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
1446 _xAttributes );
1447 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1448 OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1449 _xAttributes );
1450 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1451 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1452 _xAttributes );
1453 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("NoLabel") ),
1454 OUString( RTL_CONSTASCII_USTRINGPARAM("nolabel") ),
1455 _xAttributes );
1456 ctx.importEvents( _events );
1457 // avoid ring-reference:
1458 // vector< event elements > holding event elements holding this (via _pParent)
1459 _events.clear();
1462 //##################################################################################################
1464 // edit
1465 //__________________________________________________________________________________________________
1466 Reference< xml::input::XElement > TextFieldElement::startChildElement(
1467 sal_Int32 nUid, OUString const & rLocalName,
1468 Reference< xml::input::XAttributes > const & xAttributes )
1469 throw (xml::sax::SAXException, RuntimeException)
1471 // event
1472 if (_pImport->isEventElement( nUid, rLocalName ))
1474 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1476 else
1478 throw xml::sax::SAXException(
1479 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1480 Reference< XInterface >(), Any() );
1483 //__________________________________________________________________________________________________
1484 void TextFieldElement::endElement()
1485 throw (xml::sax::SAXException, RuntimeException)
1487 ControlImportContext ctx(
1488 _pImport, getControlId( _xAttributes ),
1489 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) );
1490 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1492 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1493 if (xStyle.is())
1495 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1496 pStyle->importBackgroundColorStyle( xControlModel );
1497 pStyle->importTextColorStyle( xControlModel );
1498 pStyle->importTextLineColorStyle( xControlModel );
1499 pStyle->importBorderStyle( xControlModel );
1500 pStyle->importFontStyle( xControlModel );
1503 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1504 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1505 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1506 _xAttributes );
1507 ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1508 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1509 _xAttributes );
1510 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("HardLineBreaks") ),
1511 OUString( RTL_CONSTASCII_USTRINGPARAM("hard-linebreaks") ),
1512 _xAttributes );
1513 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("HScroll") ),
1514 OUString( RTL_CONSTASCII_USTRINGPARAM("hscroll") ),
1515 _xAttributes );
1516 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VScroll") ),
1517 OUString( RTL_CONSTASCII_USTRINGPARAM("vscroll") ),
1518 _xAttributes );
1519 ctx.importBooleanProperty(
1520 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
1521 _xAttributes );
1522 ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
1523 OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ),
1524 _xAttributes );
1525 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1526 OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1527 _xAttributes );
1528 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
1529 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
1530 _xAttributes );
1531 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
1532 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1533 _xAttributes );
1534 ctx.importLineEndFormatProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineEndFormat") ),
1535 OUString( RTL_CONSTASCII_USTRINGPARAM("lineend-format") ),
1536 _xAttributes );
1537 OUString aValue;
1538 if (getStringAttr( &aValue,
1539 OUString( RTL_CONSTASCII_USTRINGPARAM("echochar") ),
1540 _xAttributes,
1541 _pImport->XMLNS_DIALOGS_UID ) &&
1542 aValue.getLength() > 0)
1544 OSL_ENSURE( aValue.getLength() == 1, "### more than one character given for echochar!" );
1545 sal_Int16 nChar = (sal_Int16)aValue[ 0 ];
1546 xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("EchoChar") ),
1547 makeAny( nChar ) );
1550 ctx.importEvents( _events );
1551 // avoid ring-reference:
1552 // vector< event elements > holding event elements holding this (via _pParent)
1553 _events.clear();
1556 //##################################################################################################
1558 // titledbox
1559 //__________________________________________________________________________________________________
1560 Reference< xml::input::XElement > TitledBoxElement::startChildElement(
1561 sal_Int32 nUid, OUString const & rLocalName,
1562 Reference< xml::input::XAttributes > const & xAttributes )
1563 throw (xml::sax::SAXException, RuntimeException)
1565 // event
1566 if (_pImport->isEventElement( nUid, rLocalName ))
1568 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1570 else if (_pImport->XMLNS_DIALOGS_UID != nUid)
1572 throw xml::sax::SAXException(
1573 OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
1574 Reference< XInterface >(), Any() );
1576 // title
1577 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("title") ))
1579 getStringAttr( &_label,
1580 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1581 xAttributes,
1582 _pImport->XMLNS_DIALOGS_UID );
1584 return new ElementBase(
1585 _pImport->XMLNS_DIALOGS_UID,
1586 rLocalName, xAttributes, this, _pImport );
1588 // radio
1589 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("radio") ))
1591 // dont create radios here, => titledbox must be inserted first due to radio grouping,
1592 // possible predecessors!
1593 Reference< xml::input::XElement > xRet(
1594 new RadioElement( rLocalName, xAttributes, this, _pImport ) );
1595 _radios.push_back( xRet );
1596 return xRet;
1598 // event
1599 else if (_pImport->isEventElement( nUid, rLocalName ))
1601 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1603 else
1605 return BulletinBoardElement::startChildElement( nUid, rLocalName, xAttributes );
1608 //__________________________________________________________________________________________________
1609 void TitledBoxElement::endElement()
1610 throw (xml::sax::SAXException, RuntimeException)
1613 ControlImportContext ctx(
1614 _pImport, getControlId( _xAttributes ),
1615 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) );
1616 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1618 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1619 if (xStyle.is())
1621 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1622 pStyle->importTextColorStyle( xControlModel );
1623 pStyle->importTextLineColorStyle( xControlModel );
1624 pStyle->importFontStyle( xControlModel );
1627 ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
1629 if (_label.getLength())
1631 xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1632 makeAny( _label ) );
1635 ctx.importEvents( _events );
1636 // avoid ring-reference:
1637 // vector< event elements > holding event elements holding this (via _pParent)
1638 _events.clear();
1641 // create radios AFTER group box!
1642 for ( size_t nPos = 0; nPos < _radios.size(); ++nPos )
1644 Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
1645 Reference< xml::input::XAttributes > xAttributes(
1646 xRadio->getAttributes() );
1647 OUString sLinkedCell;
1648 OUString sCellRange;
1649 OUString sService( OUSTR("com.sun.star.awt.UnoControlRadioButtonModel") );
1652 sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
1653 // we should probably limit this to vba mode also ( leave for now )
1654 if ( isVBACompatModeOn( _pImport ) )
1655 sService = OUSTR("com.sun.star.form.component.RadioButton");
1657 catch( Exception& /*e*/ )
1662 ControlImportContext ctx(
1663 _pImport, getControlId( xAttributes ),
1664 sService );
1665 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1667 Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
1668 if (xStyle.is())
1670 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1671 pStyle->importBackgroundColorStyle( xControlModel );
1672 pStyle->importTextColorStyle( xControlModel );
1673 pStyle->importTextLineColorStyle( xControlModel );
1674 pStyle->importFontStyle( xControlModel );
1675 pStyle->importVisualEffectStyle( xControlModel );
1678 ctx.importDefaults( _nBasePosX, _nBasePosY, xAttributes );
1679 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1680 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1681 xAttributes );
1682 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1683 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1684 xAttributes );
1685 ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1686 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1687 xAttributes );
1688 ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
1689 OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
1690 xAttributes );
1691 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
1692 OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
1693 xAttributes );
1694 ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
1695 OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
1696 xAttributes );
1697 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1698 OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1699 xAttributes );
1700 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ),
1701 OUString( RTL_CONSTASCII_USTRINGPARAM("group-name") ),
1702 xAttributes );
1704 sal_Int16 nVal = 0;
1705 sal_Bool bChecked = sal_False;
1706 if (getBoolAttr( &bChecked,
1707 OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ),
1708 xAttributes,
1709 _pImport->XMLNS_DIALOGS_UID ) &&
1710 bChecked)
1712 nVal = 1;
1714 xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
1715 makeAny( nVal ) );
1716 importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
1717 ::std::vector< Reference< xml::input::XElement > > * radioEvents =
1718 static_cast< RadioElement * >( xRadio.get() )->getEvents();
1719 ctx.importEvents( *radioEvents );
1720 // avoid ring-reference:
1721 // vector< event elements > holding event elements holding this (via _pParent)
1722 radioEvents->clear();
1724 // avoid ring-reference:
1725 // vector< radio elements > holding radio elements holding this (via _pParent)
1726 _radios.clear();
1729 //##################################################################################################
1731 // radio
1732 //__________________________________________________________________________________________________
1733 Reference< xml::input::XElement > RadioElement::startChildElement(
1734 sal_Int32 nUid, OUString const & rLocalName,
1735 Reference< xml::input::XAttributes > const & xAttributes )
1736 throw (xml::sax::SAXException, RuntimeException)
1738 // event
1739 if (_pImport->isEventElement( nUid, rLocalName ))
1741 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1743 else
1745 throw xml::sax::SAXException(
1746 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1747 Reference< XInterface >(), Any() );
1751 //##################################################################################################
1753 // radiogroup
1754 //__________________________________________________________________________________________________
1755 Reference< xml::input::XElement > RadioGroupElement::startChildElement(
1756 sal_Int32 nUid, OUString const & rLocalName,
1757 Reference< xml::input::XAttributes > const & xAttributes )
1758 throw (xml::sax::SAXException, RuntimeException)
1760 if (_pImport->XMLNS_DIALOGS_UID != nUid)
1762 throw xml::sax::SAXException(
1763 OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
1764 Reference< XInterface >(), Any() );
1766 // radio
1767 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("radio") ))
1769 // dont create radios here, => titledbox must be inserted first due to radio grouping,
1770 // possible predecessors!
1771 Reference< xml::input::XElement > xRet(
1772 new RadioElement( rLocalName, xAttributes, this, _pImport ) );
1773 _radios.push_back( xRet );
1774 return xRet;
1776 else
1778 throw xml::sax::SAXException(
1779 OUString( RTL_CONSTASCII_USTRINGPARAM("expected radio element!") ),
1780 Reference< XInterface >(), Any() );
1783 //__________________________________________________________________________________________________
1784 void RadioGroupElement::endElement()
1785 throw (xml::sax::SAXException, RuntimeException)
1787 for ( size_t nPos = 0; nPos < _radios.size(); ++nPos )
1789 Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
1790 Reference< xml::input::XAttributes > xAttributes(
1791 xRadio->getAttributes() );
1792 OUString sLinkedCell;
1793 OUString sCellRange;
1794 OUString sService( OUSTR("com.sun.star.awt.UnoControlRadioButtonModel") );
1797 sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
1798 // we should probably limit this to vba mode also ( leave for now )
1799 if ( isVBACompatModeOn( _pImport ) )
1800 sService = OUSTR("com.sun.star.form.component.RadioButton");
1802 catch( Exception& /*e*/ )
1806 ControlImportContext ctx(
1807 _pImport, getControlId( xAttributes ),
1808 sService );
1809 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1811 Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
1812 if (xStyle.is())
1814 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1815 pStyle->importBackgroundColorStyle( xControlModel );
1816 pStyle->importTextColorStyle( xControlModel );
1817 pStyle->importTextLineColorStyle( xControlModel );
1818 pStyle->importFontStyle( xControlModel );
1819 pStyle->importVisualEffectStyle( xControlModel );
1822 ctx.importDefaults( _nBasePosX, _nBasePosY, xAttributes );
1823 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1824 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1825 xAttributes );
1826 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1827 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1828 xAttributes );
1829 ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1830 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1831 xAttributes );
1832 ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
1833 OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
1834 xAttributes );
1835 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
1836 OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
1837 xAttributes );
1838 ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
1839 OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
1840 xAttributes );
1841 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1842 OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1843 xAttributes );
1844 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ),
1845 OUString( RTL_CONSTASCII_USTRINGPARAM("group-name") ),
1846 xAttributes );
1847 sal_Int16 nVal = 0;
1848 sal_Bool bChecked = sal_False;
1849 if (getBoolAttr( &bChecked,
1850 OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ),
1851 xAttributes,
1852 _pImport->XMLNS_DIALOGS_UID ) &&
1853 bChecked)
1855 nVal = 1;
1857 xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
1858 makeAny( nVal ) );
1860 importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
1861 ::std::vector< Reference< xml::input::XElement > > * radioEvents =
1862 static_cast< RadioElement * >( xRadio.get() )->getEvents();
1863 ctx.importEvents( *radioEvents );
1864 // avoid ring-reference:
1865 // vector< event elements > holding event elements holding this (via _pParent)
1866 radioEvents->clear();
1868 // avoid ring-reference:
1869 // vector< radio elements > holding radio elements holding this (via _pParent)
1870 _radios.clear();
1873 //##################################################################################################
1875 // menupopup
1876 //__________________________________________________________________________________________________
1877 Reference< xml::input::XElement > MenuPopupElement::startChildElement(
1878 sal_Int32 nUid, OUString const & rLocalName,
1879 Reference< xml::input::XAttributes > const & xAttributes )
1880 throw (xml::sax::SAXException, RuntimeException)
1882 if (_pImport->XMLNS_DIALOGS_UID != nUid)
1884 throw xml::sax::SAXException(
1885 OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
1886 Reference< XInterface >(), Any() );
1888 // menuitem
1889 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menuitem") ))
1891 OUString aValue(
1892 xAttributes->getValueByUidName(
1893 _pImport->XMLNS_DIALOGS_UID,
1894 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ) ) );
1895 OSL_ENSURE( aValue.getLength(), "### menuitem has no value?" );
1896 if (aValue.getLength())
1898 _itemValues.push_back( aValue );
1900 OUString aSel(
1901 xAttributes->getValueByUidName(
1902 _pImport->XMLNS_DIALOGS_UID,
1903 OUString( RTL_CONSTASCII_USTRINGPARAM("selected") ) ) );
1904 if (aSel.getLength() && aSel.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("true") ))
1906 _itemSelected.push_back(
1907 static_cast<sal_Int16>(_itemValues.size()) -1 );
1910 return new ElementBase(
1911 _pImport->XMLNS_DIALOGS_UID,
1912 rLocalName, xAttributes, this, _pImport );
1914 else
1916 throw xml::sax::SAXException(
1917 OUString( RTL_CONSTASCII_USTRINGPARAM("expected menuitem!") ),
1918 Reference< XInterface >(), Any() );
1921 //__________________________________________________________________________________________________
1922 Sequence< OUString > MenuPopupElement::getItemValues()
1924 Sequence< OUString > aRet( _itemValues.size() );
1925 OUString * pRet = aRet.getArray();
1926 for ( size_t nPos = _itemValues.size(); nPos--; )
1928 pRet[ nPos ] = _itemValues[ nPos ];
1930 return aRet;
1932 //__________________________________________________________________________________________________
1933 Sequence< sal_Int16 > MenuPopupElement::getSelectedItems()
1935 Sequence< sal_Int16 > aRet( _itemSelected.size() );
1936 sal_Int16 * pRet = aRet.getArray();
1937 for ( size_t nPos = _itemSelected.size(); nPos--; )
1939 pRet[ nPos ] = _itemSelected[ nPos ];
1941 return aRet;
1944 //##################################################################################################
1946 // menulist
1947 //__________________________________________________________________________________________________
1948 Reference< xml::input::XElement > MenuListElement::startChildElement(
1949 sal_Int32 nUid, OUString const & rLocalName,
1950 Reference< xml::input::XAttributes > const & xAttributes )
1951 throw (xml::sax::SAXException, RuntimeException)
1953 // event
1954 if (_pImport->isEventElement( nUid, rLocalName ))
1956 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1958 else if (_pImport->XMLNS_DIALOGS_UID != nUid)
1960 throw xml::sax::SAXException(
1961 OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
1962 Reference< XInterface >(), Any() );
1964 // menupopup
1965 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menupopup") ))
1967 _popup = new MenuPopupElement( rLocalName, xAttributes, this, _pImport );
1968 return _popup;
1970 else
1972 throw xml::sax::SAXException(
1973 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event or menupopup element!") ),
1974 Reference< XInterface >(), Any() );
1977 //__________________________________________________________________________________________________
1978 void MenuListElement::endElement()
1979 throw (xml::sax::SAXException, RuntimeException)
1981 OUString sLinkedCell;
1982 OUString sCellRange;
1983 OUString sListBoxService( OUSTR("com.sun.star.awt.UnoControlListBoxModel") );
1985 // we should probably limit this to vba mode also ( leave for now )
1986 if ( isVBACompatModeOn( _pImport ) )
1987 sListBoxService = OUSTR("com.sun.star.form.component.ListBox");
1991 sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
1992 sCellRange = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "source-cell-range" ) );
1994 catch( Exception& /*e*/ )
1997 ControlImportContext ctx(
1998 _pImport, getControlId( _xAttributes ),
1999 //OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) );
2000 sListBoxService );
2001 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
2003 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
2004 if (xStyle.is())
2006 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
2007 pStyle->importBackgroundColorStyle( xControlModel );
2008 pStyle->importTextColorStyle( xControlModel );
2009 pStyle->importTextLineColorStyle( xControlModel );
2010 pStyle->importBorderStyle( xControlModel );
2011 pStyle->importFontStyle( xControlModel );
2014 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
2015 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
2016 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
2017 _xAttributes );
2018 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiSelection") ),
2019 OUString( RTL_CONSTASCII_USTRINGPARAM("multiselection") ),
2020 _xAttributes );
2021 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
2022 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
2023 _xAttributes );
2024 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
2025 OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
2026 _xAttributes );
2027 ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
2028 OUString( RTL_CONSTASCII_USTRINGPARAM("linecount") ),
2029 _xAttributes );
2030 ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
2031 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
2032 _xAttributes );
2033 // import cell-link and cell source range
2034 importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
2035 if (_popup.is())
2037 MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
2038 if ( !sCellRange.getLength() )
2039 xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
2040 makeAny( p->getItemValues() ) );
2041 if ( !sLinkedCell.getLength() )
2042 xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ),
2043 makeAny( p->getSelectedItems() ) );
2045 ctx.importEvents( _events );
2046 // avoid ring-reference:
2047 // vector< event elements > holding event elements holding this (via _pParent)
2048 _events.clear();
2051 //##################################################################################################
2053 // combobox
2054 //__________________________________________________________________________________________________
2055 Reference< xml::input::XElement > ComboBoxElement::startChildElement(
2056 sal_Int32 nUid, OUString const & rLocalName,
2057 Reference< xml::input::XAttributes > const & xAttributes )
2058 throw (xml::sax::SAXException, RuntimeException)
2060 // event
2061 if (_pImport->isEventElement( nUid, rLocalName ))
2063 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
2065 else if (_pImport->XMLNS_DIALOGS_UID != nUid)
2067 throw xml::sax::SAXException(
2068 OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
2069 Reference< XInterface >(), Any() );
2071 // menupopup
2072 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menupopup") ))
2074 _popup = new MenuPopupElement( rLocalName, xAttributes, this, _pImport );
2075 return _popup;
2077 else
2079 throw xml::sax::SAXException(
2080 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event or menupopup element!") ),
2081 Reference< XInterface >(), Any() );
2084 //__________________________________________________________________________________________________
2085 void ComboBoxElement::endElement()
2086 throw (xml::sax::SAXException, RuntimeException)
2088 OUString sService( OUSTR("com.sun.star.awt.UnoControlComboBoxModel") );
2090 // we should probably limit this to vba mode also ( leave for now )
2091 if ( isVBACompatModeOn( _pImport ) )
2092 sService = OUSTR("com.sun.star.form.component.ComboBox");
2094 OUString sLinkedCell;
2095 OUString sCellRange;
2098 sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
2099 sCellRange = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "source-cell-range" ) );
2101 catch( Exception& /*e*/ )
2105 ControlImportContext ctx(
2106 _pImport, getControlId( _xAttributes ),
2107 sService );
2108 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
2110 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
2111 if (xStyle.is())
2113 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
2114 pStyle->importBackgroundColorStyle( xControlModel );
2115 pStyle->importTextColorStyle( xControlModel );
2116 pStyle->importTextLineColorStyle( xControlModel );
2117 pStyle->importBorderStyle( xControlModel );
2118 pStyle->importFontStyle( xControlModel );
2121 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
2122 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
2123 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
2124 _xAttributes );
2125 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
2126 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
2127 _xAttributes );
2128 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Autocomplete") ),
2129 OUString( RTL_CONSTASCII_USTRINGPARAM("autocomplete") ),
2130 _xAttributes );
2131 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
2132 OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
2133 _xAttributes );
2134 ctx.importBooleanProperty(
2135 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
2136 _xAttributes );
2137 ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
2138 OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ),
2139 _xAttributes );
2140 ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
2141 OUString( RTL_CONSTASCII_USTRINGPARAM("linecount") ),
2142 _xAttributes );
2143 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
2144 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
2145 _xAttributes );
2146 ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
2147 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
2148 _xAttributes );
2149 // import cell-link and cell source range
2150 importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
2152 if (_popup.is() && !sCellRange.getLength() )
2154 MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
2155 xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
2156 makeAny( p->getItemValues() ) );
2159 ctx.importEvents( _events );
2160 // avoid ring-reference:
2161 // vector< event elements > holding event elements holding this (via _pParent)
2162 _events.clear();
2165 //##################################################################################################
2167 // checkbox
2168 //__________________________________________________________________________________________________
2169 Reference< xml::input::XElement > CheckBoxElement::startChildElement(
2170 sal_Int32 nUid, OUString const & rLocalName,
2171 Reference< xml::input::XAttributes > const & xAttributes )
2172 throw (xml::sax::SAXException, RuntimeException)
2174 // event
2175 if (_pImport->isEventElement( nUid, rLocalName ))
2177 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
2179 else
2181 throw xml::sax::SAXException(
2182 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
2183 Reference< XInterface >(), Any() );
2186 //__________________________________________________________________________________________________
2187 void CheckBoxElement::endElement()
2188 throw (xml::sax::SAXException, RuntimeException)
2190 ControlImportContext ctx(
2191 _pImport, getControlId( _xAttributes ),
2192 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) );
2193 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
2195 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
2196 if (xStyle.is())
2198 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
2199 pStyle->importBackgroundColorStyle( xControlModel );
2200 pStyle->importTextColorStyle( xControlModel );
2201 pStyle->importTextLineColorStyle( xControlModel );
2202 pStyle->importFontStyle( xControlModel );
2203 pStyle->importVisualEffectStyle( xControlModel );
2206 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
2207 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
2208 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
2209 _xAttributes );
2210 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
2211 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
2212 _xAttributes );
2213 ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
2214 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
2215 _xAttributes );
2216 ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
2217 OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
2218 _xAttributes );
2219 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
2220 OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
2221 _xAttributes );
2222 ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
2223 OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
2224 _xAttributes );
2225 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
2226 OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
2227 _xAttributes );
2230 sal_Bool bTriState = sal_False;
2231 if (getBoolAttr( &bTriState,
2232 OUString( RTL_CONSTASCII_USTRINGPARAM("tristate") ),
2233 _xAttributes,
2234 _pImport->XMLNS_DIALOGS_UID ))
2236 xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("TriState") ),
2237 makeAny( bTriState ) );
2239 sal_Bool bChecked = sal_False;
2240 if (getBoolAttr( &bChecked,
2241 OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ),
2242 _xAttributes,
2243 _pImport->XMLNS_DIALOGS_UID ))
2245 // has "checked" attribute
2246 sal_Int16 nVal = (bChecked ? 1 : 0);
2247 xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
2248 makeAny( nVal ) );
2250 else
2252 sal_Int16 nVal = (bTriState ? 2 : 0); // if tristate set, but checked omitted => dont know!
2253 xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
2254 makeAny( nVal ) );
2257 ctx.importEvents( _events );
2258 // avoid ring-reference:
2259 // vector< event elements > holding event elements holding this (via _pParent)
2260 _events.clear();
2263 //##################################################################################################
2265 // button
2266 //__________________________________________________________________________________________________
2267 Reference< xml::input::XElement > ButtonElement::startChildElement(
2268 sal_Int32 nUid, OUString const & rLocalName,
2269 Reference< xml::input::XAttributes > const & xAttributes )
2270 throw (xml::sax::SAXException, RuntimeException)
2272 // event
2273 if (_pImport->isEventElement( nUid, rLocalName ))
2275 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
2277 else
2279 throw xml::sax::SAXException(
2280 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
2281 Reference< XInterface >(), Any() );
2284 //__________________________________________________________________________________________________
2285 void ButtonElement::endElement()
2286 throw (xml::sax::SAXException, RuntimeException)
2288 ControlImportContext ctx(
2289 _pImport, getControlId( _xAttributes ),
2290 OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) );
2292 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
2293 if (xStyle.is())
2295 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
2296 Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
2297 pStyle->importBackgroundColorStyle( xControlModel );
2298 pStyle->importTextColorStyle( xControlModel );
2299 pStyle->importTextLineColorStyle( xControlModel );
2300 pStyle->importFontStyle( xControlModel );
2303 ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
2304 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
2305 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
2306 _xAttributes );
2307 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
2308 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
2309 _xAttributes );
2310 ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
2311 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
2312 _xAttributes );
2313 ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
2314 OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
2315 _xAttributes );
2316 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultButton") ),
2317 OUString( RTL_CONSTASCII_USTRINGPARAM("default") ),
2318 _xAttributes );
2319 ctx.importButtonTypeProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("PushButtonType") ),
2320 OUString( RTL_CONSTASCII_USTRINGPARAM("button-type") ),
2321 _xAttributes );
2322 ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
2323 OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
2324 _xAttributes );
2325 ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
2326 OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
2327 _xAttributes );
2328 ctx.importImageAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageAlign") ),
2329 OUString( RTL_CONSTASCII_USTRINGPARAM("image-align") ),
2330 _xAttributes );
2331 if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
2332 _xAttributes ))
2333 ctx.getControlModel()->setPropertyValue(
2334 OUSTR("Repeat"), makeAny(true) );
2335 sal_Int32 toggled = 0;
2336 if (getLongAttr( &toggled, OUSTR("toggled"), _xAttributes,
2337 _pImport->XMLNS_DIALOGS_UID ) && toggled == 1)
2338 ctx.getControlModel()->setPropertyValue(OUSTR("Toggle"), makeAny(true));
2339 ctx.importBooleanProperty( OUSTR("FocusOnClick"), OUSTR("grab-focus"),
2340 _xAttributes );
2341 ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
2342 OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
2343 _xAttributes );
2344 // State
2345 sal_Bool bChecked = sal_False;
2346 if (getBoolAttr(
2347 &bChecked,
2348 OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ),
2349 _xAttributes,
2350 _pImport->XMLNS_DIALOGS_UID ) &&
2351 bChecked)
2353 sal_Int16 nVal = 1;
2354 ctx.getControlModel()->setPropertyValue(
2355 OUString( RTL_CONSTASCII_USTRINGPARAM("State") ), makeAny( nVal ) );
2358 ctx.importEvents( _events );
2359 // avoid ring-reference:
2360 // vector< event elements > holding event elements holding this (via _pParent)
2361 _events.clear();
2364 //##################################################################################################
2366 // bulletinboard
2367 //__________________________________________________________________________________________________
2368 Reference< xml::input::XElement > BulletinBoardElement::startChildElement(
2369 sal_Int32 nUid, OUString const & rLocalName,
2370 Reference< xml::input::XAttributes > const & xAttributes )
2371 throw (xml::sax::SAXException, RuntimeException)
2373 if (_pImport->XMLNS_DIALOGS_UID != nUid)
2375 throw xml::sax::SAXException(
2376 OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
2377 Reference< XInterface >(), Any() );
2379 // button
2380 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("button") ))
2382 return new ButtonElement( rLocalName, xAttributes, this, _pImport );
2384 // checkbox
2385 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("checkbox") ))
2387 return new CheckBoxElement( rLocalName, xAttributes, this, _pImport );
2389 // combobox
2390 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("combobox") ))
2392 return new ComboBoxElement( rLocalName, xAttributes, this, _pImport );
2394 // listbox
2395 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menulist") ))
2397 return new MenuListElement( rLocalName, xAttributes, this, _pImport );
2399 // radiogroup
2400 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("radiogroup") ))
2402 return new RadioGroupElement( rLocalName, xAttributes, this, _pImport );
2404 // titledbox
2405 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("titledbox") ))
2407 return new TitledBoxElement( rLocalName, xAttributes, this, _pImport );
2409 // text
2410 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("text") ))
2412 return new TextElement( rLocalName, xAttributes, this, _pImport );
2414 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("linklabel") ))
2416 return new FixedHyperLinkElement( rLocalName, xAttributes, this, _pImport );
2418 // textfield
2419 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("textfield") ))
2421 return new TextFieldElement( rLocalName, xAttributes, this, _pImport );
2423 // img
2424 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("img") ))
2426 return new ImageControlElement( rLocalName, xAttributes, this, _pImport );
2428 // filecontrol
2429 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("filecontrol") ))
2431 return new FileControlElement( rLocalName, xAttributes, this, _pImport );
2433 // treecontrol
2434 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("treecontrol") ))
2436 return new TreeControlElement( rLocalName, xAttributes, this, _pImport );
2438 // currencyfield
2439 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("currencyfield") ))
2441 return new CurrencyFieldElement( rLocalName, xAttributes, this, _pImport );
2443 // datefield
2444 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("datefield") ))
2446 return new DateFieldElement( rLocalName, xAttributes, this, _pImport );
2448 // datefield
2449 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("numericfield") ))
2451 return new NumericFieldElement( rLocalName, xAttributes, this, _pImport );
2453 // timefield
2454 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("timefield") ))
2456 return new TimeFieldElement( rLocalName, xAttributes, this, _pImport );
2458 // patternfield
2459 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("patternfield") ))
2461 return new PatternFieldElement( rLocalName, xAttributes, this, _pImport );
2463 // formattedfield
2464 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("formattedfield") ))
2466 return new FormattedFieldElement( rLocalName, xAttributes, this, _pImport );
2468 // fixedline
2469 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("fixedline") ))
2471 return new FixedLineElement( rLocalName, xAttributes, this, _pImport );
2473 // scrollbar
2474 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("scrollbar") ))
2476 return new ScrollBarElement( rLocalName, xAttributes, this, _pImport );
2478 // spinbutton
2479 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("spinbutton") ) && isVBACompatModeOn( _pImport ) )
2481 return new SpinButtonElement( rLocalName, xAttributes, this, _pImport );
2483 // progressmeter
2484 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("progressmeter") ))
2486 return new ProgressBarElement( rLocalName, xAttributes, this, _pImport );
2488 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("multipage") ))
2490 return new MultiPage( rLocalName, xAttributes, this, _pImport );
2492 // bulletinboard
2493 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") ))
2495 return new BulletinBoardElement( rLocalName, xAttributes, this, _pImport );
2497 else
2499 throw xml::sax::SAXException(
2500 OUString( RTL_CONSTASCII_USTRINGPARAM("expected styles, bulletinboard or bulletinboard element, not: ") ) + rLocalName,
2501 Reference< XInterface >(), Any() );
2504 //__________________________________________________________________________________________________
2505 BulletinBoardElement::BulletinBoardElement(
2506 OUString const & rLocalName,
2507 Reference< xml::input::XAttributes > const & xAttributes,
2508 ElementBase * pParent, DialogImport * pImport )
2509 SAL_THROW( () )
2510 : ControlElement( rLocalName, xAttributes, pParent, pImport )
2512 OUString aValue(
2513 _xAttributes->getValueByUidName(
2514 _pImport->XMLNS_DIALOGS_UID,
2515 OUString( RTL_CONSTASCII_USTRINGPARAM("left") ) ) );
2516 if (aValue.getLength())
2518 _nBasePosX += toInt32( aValue );
2520 aValue = _xAttributes->getValueByUidName(
2521 _pImport->XMLNS_DIALOGS_UID,
2522 OUString( RTL_CONSTASCII_USTRINGPARAM("top") ) );
2523 if (aValue.getLength())
2525 _nBasePosY += toInt32( aValue );
2529 //##################################################################################################
2531 // style
2532 //__________________________________________________________________________________________________
2533 Reference< xml::input::XElement > StyleElement::startChildElement(
2534 sal_Int32 /*nUid*/, OUString const & /*rLocalName*/,
2535 Reference< xml::input::XAttributes > const & /*xAttributes*/ )
2536 throw (xml::sax::SAXException, RuntimeException)
2538 throw xml::sax::SAXException(
2539 OUString( RTL_CONSTASCII_USTRINGPARAM("unexpected sub elements of style!") ),
2540 Reference< XInterface >(), Any() );
2542 //__________________________________________________________________________________________________
2543 void StyleElement::endElement()
2544 throw (xml::sax::SAXException, RuntimeException)
2546 Reference< xml::input::XAttributes > xStyle;
2547 OUString aStyleId(
2548 _xAttributes->getValueByUidName(
2549 _pImport->XMLNS_DIALOGS_UID,
2550 OUString( RTL_CONSTASCII_USTRINGPARAM("style-id") ) ) );
2551 if (aStyleId.getLength())
2553 _pImport->addStyle( aStyleId, this );
2555 else
2557 throw xml::sax::SAXException(
2558 OUString( RTL_CONSTASCII_USTRINGPARAM("missing style-id attribute!") ),
2559 Reference< XInterface >(), Any() );
2563 //##################################################################################################
2565 // styles
2566 //__________________________________________________________________________________________________
2567 Reference< xml::input::XElement > StylesElement::startChildElement(
2568 sal_Int32 nUid, OUString const & rLocalName,
2569 Reference< xml::input::XAttributes > const & xAttributes )
2570 throw (xml::sax::SAXException, RuntimeException)
2572 if (_pImport->XMLNS_DIALOGS_UID != nUid)
2574 throw xml::sax::SAXException(
2575 OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
2576 Reference< XInterface >(), Any() );
2578 // style
2579 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("style") ))
2581 return new StyleElement( rLocalName, xAttributes, this, _pImport );
2583 else
2585 throw xml::sax::SAXException(
2586 OUString( RTL_CONSTASCII_USTRINGPARAM("expected style element!") ),
2587 Reference< XInterface >(), Any() );
2591 //##################################################################################################
2593 // window
2594 //__________________________________________________________________________________________________
2595 Reference< xml::input::XElement > WindowElement::startChildElement(
2596 sal_Int32 nUid, OUString const & rLocalName,
2597 Reference< xml::input::XAttributes > const & xAttributes )
2598 throw (xml::sax::SAXException, RuntimeException)
2600 // event
2601 if (_pImport->isEventElement( nUid, rLocalName ))
2603 return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
2605 else if (_pImport->XMLNS_DIALOGS_UID != nUid)
2607 throw xml::sax::SAXException(
2608 OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
2609 Reference< XInterface >(), Any() );
2611 // styles
2612 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("styles") ))
2614 return new StylesElement( rLocalName, xAttributes, this, _pImport );
2616 // bulletinboard
2617 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") ))
2619 return new BulletinBoardElement( rLocalName, xAttributes, this, _pImport );
2621 else
2623 throw xml::sax::SAXException(
2624 OUString( RTL_CONSTASCII_USTRINGPARAM("expected styles ot bulletinboard element!") ),
2625 Reference< XInterface >(), Any() );
2628 //__________________________________________________________________________________________________
2629 void WindowElement::endElement()
2630 throw (xml::sax::SAXException, RuntimeException)
2632 Reference< beans::XPropertySet > xProps(
2633 _pImport->_xDialogModel, UNO_QUERY_THROW );
2634 ImportContext ctx( _pImport, xProps, getControlId( _xAttributes ) );
2636 Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
2637 if (xStyle.is())
2639 StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
2640 pStyle->importBackgroundColorStyle( xProps );
2641 pStyle->importTextColorStyle( xProps );
2642 pStyle->importTextLineColorStyle( xProps );
2643 pStyle->importFontStyle( xProps );
2646 ctx.importDefaults( 0, 0, _xAttributes, false );
2647 ctx.importBooleanProperty(
2648 OUString( RTL_CONSTASCII_USTRINGPARAM("Closeable") ),
2649 OUString( RTL_CONSTASCII_USTRINGPARAM("closeable") ),
2650 _xAttributes );
2651 ctx.importBooleanProperty(
2652 OUString( RTL_CONSTASCII_USTRINGPARAM("Moveable") ),
2653 OUString( RTL_CONSTASCII_USTRINGPARAM("moveable") ),
2654 _xAttributes );
2655 ctx.importBooleanProperty(
2656 OUString( RTL_CONSTASCII_USTRINGPARAM("Sizeable") ),
2657 OUString( RTL_CONSTASCII_USTRINGPARAM("resizeable") ),
2658 _xAttributes );
2659 ctx.importStringProperty(
2660 OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ),
2661 OUString( RTL_CONSTASCII_USTRINGPARAM("title") ),
2662 _xAttributes );
2663 ctx.importBooleanProperty(
2664 OUString( RTL_CONSTASCII_USTRINGPARAM("Decoration") ),
2665 OUString( RTL_CONSTASCII_USTRINGPARAM("withtitlebar") ),
2666 _xAttributes );
2667 ctx.importStringProperty(
2668 OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
2669 OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
2670 _xAttributes );
2671 ctx.importEvents( _events );
2672 // avoid ring-reference:
2673 // vector< event elements > holding event elements holding this (via _pParent)
2674 _events.clear();