1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmldlg_impmodels.cxx,v $
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
;
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
)
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") ),
71 _pImport
->XMLNS_DIALOGS_UID
);
73 return new ElementBase(
74 _pImport
->XMLNS_DIALOGS_UID
,
75 rLocalName
, xAttributes
, this, _pImport
);
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
) );
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") ),
109 ctx
.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ),
110 OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
112 ctx
.importEvents( _events
);
113 // avoid ring-reference:
114 // vector< event elements > holding event elements holding this (via _pParent)
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
128 else if( nLen
> 1 && '.' == rURL
[0] )
131 // ../: We are never going up one level, so we know
132 // it's not an external URI
134 else if( '/' == rURL
[1] )
135 // we are remaining on a level, so it's an package URI
139 // Now check for a RFC2396 schema
146 // a relative path segement
153 // we don't care about any other characters
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() ) )
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
);
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();
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
)
232 if (_pImport
->isEventElement( nUid
, rLocalName
))
234 return new EventElement(
235 nUid
, rLocalName
, xAttributes
, this, _pImport
);
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
) );
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") ),
266 ctx
.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMin") ),
267 OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
269 ctx
.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ),
270 OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
272 ctx
.importEvents( _events
);
273 // avoid ring-reference:
274 // vector< event elements > holding event elements holding this (via _pParent)
278 //##################################################################################################
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
)
288 if (_pImport
->isEventElement( nUid
, rLocalName
))
290 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
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
),
321 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
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") ),
334 ctx
.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("BlockIncrement") ),
335 OUString( RTL_CONSTASCII_USTRINGPARAM("pageincrement") ),
337 ctx
.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineIncrement") ),
338 OUString( RTL_CONSTASCII_USTRINGPARAM("increment") ),
340 ctx
.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScrollValue") ),
341 OUString( RTL_CONSTASCII_USTRINGPARAM("curpos") ),
343 ctx
.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMax") ),
344 OUString( RTL_CONSTASCII_USTRINGPARAM("maxpos") ),
346 ctx
.importLongProperty( OUSTR("ScrollValueMin"), OUSTR("minpos"),
348 ctx
.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VisibleSize") ),
349 OUString( RTL_CONSTASCII_USTRINGPARAM("visible-size") ),
351 ctx
.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
353 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
354 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
356 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LiveScroll") ),
357 OUString( RTL_CONSTASCII_USTRINGPARAM("live-scroll") ),
359 ctx
.importHexLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
360 OUString( RTL_CONSTASCII_USTRINGPARAM("symbol-color") ),
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)
373 //##################################################################################################
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
)
383 if (_pImport
->isEventElement( nUid
, rLocalName
))
385 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
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
) );
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") ),
424 ctx
.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinIncrement") ),
425 OUString( RTL_CONSTASCII_USTRINGPARAM("increment") ),
427 ctx
.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ),
428 OUString( RTL_CONSTASCII_USTRINGPARAM("curval") ),
430 ctx
.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ),
431 OUString( RTL_CONSTASCII_USTRINGPARAM("maxval") ),
433 ctx
.importLongProperty( OUSTR("SpinValueMin"), OUSTR("minval"),
435 ctx
.importLongProperty( OUSTR("Repeat"), OUSTR("repeat"),
437 ctx
.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat-delay"),
439 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
440 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
442 ctx
.importHexLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
443 OUString( RTL_CONSTASCII_USTRINGPARAM("symbol-color") ),
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)
455 //##################################################################################################
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
)
465 if (_pImport
->isEventElement( nUid
, rLocalName
))
467 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
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
) );
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") ),
498 ctx
.importOrientationProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
499 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
501 ctx
.importEvents( _events
);
502 // avoid ring-reference:
503 // vector< event elements > holding event elements holding this (via _pParent)
507 //##################################################################################################
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
)
517 if (_pImport
->isEventElement( nUid
, rLocalName
))
519 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
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
) );
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") ),
552 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
553 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
555 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
556 OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ),
558 ctx
.importBooleanProperty(
559 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
561 ctx
.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
562 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
564 ctx
.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
565 OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ),
567 ctx
.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EditMask") ),
568 OUString( RTL_CONSTASCII_USTRINGPARAM("edit-mask") ),
570 ctx
.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LiteralMask") ),
571 OUString( RTL_CONSTASCII_USTRINGPARAM("literal-mask") ),
573 ctx
.importEvents( _events
);
574 // avoid ring-reference:
575 // vector< event elements > holding event elements holding this (via _pParent)
579 //##################################################################################################
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
)
589 if (_pImport
->isEventElement( nUid
, rLocalName
))
591 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
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
) );
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") ),
624 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
625 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
627 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
628 OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ),
630 ctx
.importBooleanProperty(
631 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
633 ctx
.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
634 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
636 ctx
.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveMin") ),
637 OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
639 ctx
.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveMax") ),
640 OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
642 ctx
.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveValue") ),
643 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
645 ctx
.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
646 OUString( RTL_CONSTASCII_USTRINGPARAM("text") ),
648 ctx
.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
649 OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ),
651 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
652 OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
654 if (ctx
.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
656 ctx
.getControlModel()->setPropertyValue(
657 OUSTR("Repeat"), makeAny(true) );
660 _xAttributes
->getValueByUidName(
661 _pImport
->XMLNS_DIALOGS_UID
,
662 OUString( RTL_CONSTASCII_USTRINGPARAM("value-default") ) ) );
663 if (sDefault
.getLength())
665 double d
= sDefault
.toDouble();
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") ),
674 else // treat as string
676 ctx
.getControlModel()->setPropertyValue(
677 OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveDefault") ),
678 makeAny( sDefault
) );
683 ctx
.getControlModel()->setPropertyValue(
684 OUString( RTL_CONSTASCII_USTRINGPARAM("FormatsSupplier") ),
685 makeAny( _pImport
->getNumberFormatsSupplier() ) );
688 _xAttributes
->getValueByUidName(
689 _pImport
->XMLNS_DIALOGS_UID
,
690 OUString( RTL_CONSTASCII_USTRINGPARAM("format-code") ) ) );
691 if (sFormat
.getLength())
696 _xAttributes
->getValueByUidName(
697 _pImport
->XMLNS_DIALOGS_UID
,
698 OUString( RTL_CONSTASCII_USTRINGPARAM("format-locale") ) ) );
699 if (sLocale
.getLength())
702 sal_Int32 semi0
= sLocale
.indexOf( ';' );
703 if (semi0
< 0) // no semi at all, just try language
705 locale
.Language
= sLocale
;
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
);
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!" );
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") ),
747 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
748 OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
751 ctx
.importEvents( _events
);
752 // avoid ring-reference:
753 // vector< event elements > holding event elements holding this (via _pParent)
757 //##################################################################################################
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
)
767 if (_pImport
->isEventElement( nUid
, rLocalName
))
769 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
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
) );
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") ),
802 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
803 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
805 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
806 OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ),
808 ctx
.importBooleanProperty(
809 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
811 ctx
.importTimeFormatProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeFormat") ),
812 OUString( RTL_CONSTASCII_USTRINGPARAM("time-format") ),
814 ctx
.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Time") ),
815 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
817 ctx
.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeMin") ),
818 OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
820 ctx
.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeMax") ),
821 OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
823 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
824 OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
826 if (ctx
.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
828 ctx
.getControlModel()->setPropertyValue(
829 OUSTR("Repeat"), makeAny(true) );
830 ctx
.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
831 OUString( RTL_CONSTASCII_USTRINGPARAM("text") ),
833 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
834 OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
837 ctx
.importEvents( _events
);
838 // avoid ring-reference:
839 // vector< event elements > holding event elements holding this (via _pParent)
843 //##################################################################################################
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
)
853 if (_pImport
->isEventElement( nUid
, rLocalName
))
855 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
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
) );
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") ),
888 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
889 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
891 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
892 OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ),
894 ctx
.importBooleanProperty(
895 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
897 ctx
.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DecimalAccuracy") ),
898 OUString( RTL_CONSTASCII_USTRINGPARAM("decimal-accuracy") ),
900 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowThousandsSeparator") ),
901 OUString( RTL_CONSTASCII_USTRINGPARAM("thousands-separator") ),
903 ctx
.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Value") ),
904 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
906 ctx
.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMin") ),
907 OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
909 ctx
.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMax") ),
910 OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
912 ctx
.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueStep") ),
913 OUString( RTL_CONSTASCII_USTRINGPARAM("value-step") ),
915 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
916 OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
918 if (ctx
.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
920 ctx
.getControlModel()->setPropertyValue(
921 OUSTR("Repeat"), makeAny(true) );
922 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
923 OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
925 ctx
.importEvents( _events
);
926 // avoid ring-reference:
927 // vector< event elements > holding event elements holding this (via _pParent)
931 //##################################################################################################
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
)
941 if (_pImport
->isEventElement( nUid
, rLocalName
))
943 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
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
) );
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") ),
976 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
977 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
979 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
980 OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ),
982 ctx
.importBooleanProperty(
983 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
985 ctx
.importDateFormatProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateFormat") ),
986 OUString( RTL_CONSTASCII_USTRINGPARAM("date-format") ),
988 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateShowCentury") ),
989 OUString( RTL_CONSTASCII_USTRINGPARAM("show-century") ),
991 ctx
.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Date") ),
992 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
994 ctx
.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateMin") ),
995 OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
997 ctx
.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateMax") ),
998 OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
1000 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
1001 OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
1003 if (ctx
.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
1005 ctx
.getControlModel()->setPropertyValue(
1006 OUSTR("Repeat"), makeAny(true) );
1007 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
1008 OUString( RTL_CONSTASCII_USTRINGPARAM("dropdown") ),
1010 ctx
.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
1011 OUString( RTL_CONSTASCII_USTRINGPARAM("text") ),
1013 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
1014 OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
1016 ctx
.importEvents( _events
);
1017 // avoid ring-reference:
1018 // vector< event elements > holding event elements holding this (via _pParent)
1022 //##################################################################################################
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
)
1032 if (_pImport
->isEventElement( nUid
, rLocalName
))
1034 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
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
) );
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") ),
1067 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
1068 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
1070 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
1071 OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ),
1073 ctx
.importBooleanProperty(
1074 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
1076 ctx
.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("CurrencySymbol") ),
1077 OUString( RTL_CONSTASCII_USTRINGPARAM("currency-symbol") ),
1079 ctx
.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DecimalAccuracy") ),
1080 OUString( RTL_CONSTASCII_USTRINGPARAM("decimal-accuracy") ),
1082 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowThousandsSeparator") ),
1083 OUString( RTL_CONSTASCII_USTRINGPARAM("thousands-separator") ),
1085 ctx
.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Value") ),
1086 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1088 ctx
.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMin") ),
1089 OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
1091 ctx
.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMax") ),
1092 OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
1094 ctx
.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueStep") ),
1095 OUString( RTL_CONSTASCII_USTRINGPARAM("value-step") ),
1097 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
1098 OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
1100 if (ctx
.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
1102 ctx
.getControlModel()->setPropertyValue(
1103 OUSTR("Repeat"), makeAny(true) );
1104 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("PrependCurrencySymbol") ),
1105 OUString( RTL_CONSTASCII_USTRINGPARAM("prepend-symbol") ),
1107 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
1108 OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
1110 ctx
.importEvents( _events
);
1111 // avoid ring-reference:
1112 // vector< event elements > holding event elements holding this (via _pParent)
1116 //##################################################################################################
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
)
1126 if (_pImport
->isEventElement( nUid
, rLocalName
))
1128 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
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
) );
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") ),
1161 ctx
.importBooleanProperty(
1162 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
1164 ctx
.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
1165 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1167 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
1168 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
1170 ctx
.importEvents( _events
);
1171 // avoid ring-reference:
1172 // vector< event elements > holding event elements holding this (via _pParent)
1175 //##################################################################################################
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
)
1185 if (_pImport
->isEventElement( nUid
, rLocalName
))
1187 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
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
) );
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") ),
1217 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("RootDisplayed") ),
1218 OUString( RTL_CONSTASCII_USTRINGPARAM("rootdisplayed") ),
1220 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsHandles") ),
1221 OUString( RTL_CONSTASCII_USTRINGPARAM("showshandles") ),
1223 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsRootHandles") ),
1224 OUString( RTL_CONSTASCII_USTRINGPARAM("showsroothandles") ),
1226 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Editable") ),
1227 OUString( RTL_CONSTASCII_USTRINGPARAM("editable") ),
1229 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("RowHeight") ),
1230 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
1232 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("InvokesStopNodeEditing") ),
1233 OUString( RTL_CONSTASCII_USTRINGPARAM("invokesstopnodeediting") ),
1236 ctx
.importEvents( _events
);
1237 // avoid ring-reference:
1238 // vector< event elements > holding event elements holding this (via _pParent)
1242 //##################################################################################################
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
)
1252 if (_pImport
->isEventElement( nUid
, rLocalName
))
1254 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
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
) );
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") ),
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:" ) );
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 )
1304 xProps
->setPropertyValue( OUSTR("ImageURL"), makeAny( sURL
) );
1308 else if ( sURL
.getLength() > 0 )
1310 Reference
< beans::XPropertySet
> xProps( ctx
.getControlModel(), UNO_QUERY
);
1312 xProps
->setPropertyValue( OUSTR("ImageURL"), makeAny( sURL
) );
1315 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1316 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1318 ctx
.importEvents( _events
);
1319 // avoid ring-reference:
1320 // vector< event elements > holding event elements holding this (via _pParent)
1324 //##################################################################################################
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
)
1334 if (_pImport
->isEventElement( nUid
, rLocalName
))
1336 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
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
) );
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") ),
1369 ctx
.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1370 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1372 ctx
.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
1373 OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
1375 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1376 OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1378 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1379 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1381 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("NoLabel") ),
1382 OUString( RTL_CONSTASCII_USTRINGPARAM("nolabel") ),
1384 ctx
.importEvents( _events
);
1385 // avoid ring-reference:
1386 // vector< event elements > holding event elements holding this (via _pParent)
1390 //##################################################################################################
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
)
1399 if (_pImport
->isEventElement( nUid
, rLocalName
))
1401 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
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
) );
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") ),
1434 ctx
.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("URL") ),
1435 OUString( RTL_CONSTASCII_USTRINGPARAM("url") ),
1437 ctx
.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Description") ),
1438 OUString( RTL_CONSTASCII_USTRINGPARAM("description") ),
1441 ctx
.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1442 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1444 ctx
.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
1445 OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
1447 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1448 OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1450 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1451 OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1453 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("NoLabel") ),
1454 OUString( RTL_CONSTASCII_USTRINGPARAM("nolabel") ),
1456 ctx
.importEvents( _events
);
1457 // avoid ring-reference:
1458 // vector< event elements > holding event elements holding this (via _pParent)
1462 //##################################################################################################
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
)
1472 if (_pImport
->isEventElement( nUid
, rLocalName
))
1474 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
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
) );
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") ),
1507 ctx
.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1508 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1510 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("HardLineBreaks") ),
1511 OUString( RTL_CONSTASCII_USTRINGPARAM("hard-linebreaks") ),
1513 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("HScroll") ),
1514 OUString( RTL_CONSTASCII_USTRINGPARAM("hscroll") ),
1516 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VScroll") ),
1517 OUString( RTL_CONSTASCII_USTRINGPARAM("vscroll") ),
1519 ctx
.importBooleanProperty(
1520 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
1522 ctx
.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
1523 OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ),
1525 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1526 OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1528 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
1529 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
1531 ctx
.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
1532 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1534 ctx
.importLineEndFormatProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineEndFormat") ),
1535 OUString( RTL_CONSTASCII_USTRINGPARAM("lineend-format") ),
1538 if (getStringAttr( &aValue
,
1539 OUString( RTL_CONSTASCII_USTRINGPARAM("echochar") ),
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") ),
1550 ctx
.importEvents( _events
);
1551 // avoid ring-reference:
1552 // vector< event elements > holding event elements holding this (via _pParent)
1556 //##################################################################################################
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
)
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() );
1577 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("title") ))
1579 getStringAttr( &_label
,
1580 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1582 _pImport
->XMLNS_DIALOGS_UID
);
1584 return new ElementBase(
1585 _pImport
->XMLNS_DIALOGS_UID
,
1586 rLocalName
, xAttributes
, this, _pImport
);
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
);
1599 else if (_pImport
->isEventElement( nUid
, rLocalName
))
1601 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
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
) );
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)
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
),
1665 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
1667 Reference
< xml::input::XElement
> xStyle( getStyle( xAttributes
) );
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") ),
1682 ctx
.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1683 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1685 ctx
.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1686 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1688 ctx
.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
1689 OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
1691 ctx
.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
1692 OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
1694 ctx
.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
1695 OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
1697 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1698 OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1700 ctx
.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ),
1701 OUString( RTL_CONSTASCII_USTRINGPARAM("group-name") ),
1705 sal_Bool bChecked
= sal_False
;
1706 if (getBoolAttr( &bChecked
,
1707 OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ),
1709 _pImport
->XMLNS_DIALOGS_UID
) &&
1714 xControlModel
->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
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)
1729 //##################################################################################################
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
)
1739 if (_pImport
->isEventElement( nUid
, rLocalName
))
1741 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
1745 throw xml::sax::SAXException(
1746 OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1747 Reference
< XInterface
>(), Any() );
1751 //##################################################################################################
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() );
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
);
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
),
1809 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
1811 Reference
< xml::input::XElement
> xStyle( getStyle( xAttributes
) );
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") ),
1826 ctx
.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1827 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1829 ctx
.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1830 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1832 ctx
.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
1833 OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
1835 ctx
.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
1836 OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
1838 ctx
.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
1839 OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
1841 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1842 OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1844 ctx
.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ),
1845 OUString( RTL_CONSTASCII_USTRINGPARAM("group-name") ),
1848 sal_Bool bChecked
= sal_False
;
1849 if (getBoolAttr( &bChecked
,
1850 OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ),
1852 _pImport
->XMLNS_DIALOGS_UID
) &&
1857 xControlModel
->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
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)
1873 //##################################################################################################
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() );
1889 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menuitem") ))
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
);
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
);
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
];
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
];
1944 //##################################################################################################
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
)
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() );
1965 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menupopup") ))
1967 _popup
= new MenuPopupElement( rLocalName
, xAttributes
, this, _pImport
);
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") ) );
2001 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
2003 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
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") ),
2018 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiSelection") ),
2019 OUString( RTL_CONSTASCII_USTRINGPARAM("multiselection") ),
2021 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
2022 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
2024 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
2025 OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
2027 ctx
.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
2028 OUString( RTL_CONSTASCII_USTRINGPARAM("linecount") ),
2030 ctx
.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
2031 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
2033 // import cell-link and cell source range
2034 importBindableAndListRangeBits( _pImport
, sLinkedCell
, sCellRange
, ctx
);
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)
2051 //##################################################################################################
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
)
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() );
2072 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menupopup") ))
2074 _popup
= new MenuPopupElement( rLocalName
, xAttributes
, this, _pImport
);
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
),
2108 Reference
< beans::XPropertySet
> xControlModel( ctx
.getControlModel() );
2110 Reference
< xml::input::XElement
> xStyle( getStyle( _xAttributes
) );
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") ),
2125 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
2126 OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
2128 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Autocomplete") ),
2129 OUString( RTL_CONSTASCII_USTRINGPARAM("autocomplete") ),
2131 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
2132 OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
2134 ctx
.importBooleanProperty(
2135 OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
2137 ctx
.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
2138 OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ),
2140 ctx
.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
2141 OUString( RTL_CONSTASCII_USTRINGPARAM("linecount") ),
2143 ctx
.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
2144 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
2146 ctx
.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
2147 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
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)
2165 //##################################################################################################
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
)
2175 if (_pImport
->isEventElement( nUid
, rLocalName
))
2177 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
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
) );
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") ),
2210 ctx
.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
2211 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
2213 ctx
.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
2214 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
2216 ctx
.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
2217 OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
2219 ctx
.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
2220 OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
2222 ctx
.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
2223 OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
2225 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
2226 OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
2230 sal_Bool bTriState
= sal_False
;
2231 if (getBoolAttr( &bTriState
,
2232 OUString( RTL_CONSTASCII_USTRINGPARAM("tristate") ),
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") ),
2243 _pImport
->XMLNS_DIALOGS_UID
))
2245 // has "checked" attribute
2246 sal_Int16 nVal
= (bChecked
? 1 : 0);
2247 xControlModel
->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
2252 sal_Int16 nVal
= (bTriState
? 2 : 0); // if tristate set, but checked omitted => dont know!
2253 xControlModel
->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
2257 ctx
.importEvents( _events
);
2258 // avoid ring-reference:
2259 // vector< event elements > holding event elements holding this (via _pParent)
2263 //##################################################################################################
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
)
2273 if (_pImport
->isEventElement( nUid
, rLocalName
))
2275 return new EventElement( nUid
, rLocalName
, xAttributes
, this, _pImport
);
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
) );
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") ),
2307 ctx
.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
2308 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
2310 ctx
.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
2311 OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
2313 ctx
.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
2314 OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
2316 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultButton") ),
2317 OUString( RTL_CONSTASCII_USTRINGPARAM("default") ),
2319 ctx
.importButtonTypeProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("PushButtonType") ),
2320 OUString( RTL_CONSTASCII_USTRINGPARAM("button-type") ),
2322 ctx
.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
2323 OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
2325 ctx
.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
2326 OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
2328 ctx
.importImageAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageAlign") ),
2329 OUString( RTL_CONSTASCII_USTRINGPARAM("image-align") ),
2331 if (ctx
.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
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"),
2341 ctx
.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
2342 OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
2345 sal_Bool bChecked
= sal_False
;
2348 OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ),
2350 _pImport
->XMLNS_DIALOGS_UID
) &&
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)
2364 //##################################################################################################
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() );
2380 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("button") ))
2382 return new ButtonElement( rLocalName
, xAttributes
, this, _pImport
);
2385 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("checkbox") ))
2387 return new CheckBoxElement( rLocalName
, xAttributes
, this, _pImport
);
2390 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("combobox") ))
2392 return new ComboBoxElement( rLocalName
, xAttributes
, this, _pImport
);
2395 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menulist") ))
2397 return new MenuListElement( rLocalName
, xAttributes
, this, _pImport
);
2400 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("radiogroup") ))
2402 return new RadioGroupElement( rLocalName
, xAttributes
, this, _pImport
);
2405 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("titledbox") ))
2407 return new TitledBoxElement( rLocalName
, xAttributes
, this, _pImport
);
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
);
2419 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("textfield") ))
2421 return new TextFieldElement( rLocalName
, xAttributes
, this, _pImport
);
2424 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("img") ))
2426 return new ImageControlElement( rLocalName
, xAttributes
, this, _pImport
);
2429 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("filecontrol") ))
2431 return new FileControlElement( rLocalName
, xAttributes
, this, _pImport
);
2434 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("treecontrol") ))
2436 return new TreeControlElement( rLocalName
, xAttributes
, this, _pImport
);
2439 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("currencyfield") ))
2441 return new CurrencyFieldElement( rLocalName
, xAttributes
, this, _pImport
);
2444 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("datefield") ))
2446 return new DateFieldElement( rLocalName
, xAttributes
, this, _pImport
);
2449 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("numericfield") ))
2451 return new NumericFieldElement( rLocalName
, xAttributes
, this, _pImport
);
2454 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("timefield") ))
2456 return new TimeFieldElement( rLocalName
, xAttributes
, this, _pImport
);
2459 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("patternfield") ))
2461 return new PatternFieldElement( rLocalName
, xAttributes
, this, _pImport
);
2464 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("formattedfield") ))
2466 return new FormattedFieldElement( rLocalName
, xAttributes
, this, _pImport
);
2469 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("fixedline") ))
2471 return new FixedLineElement( rLocalName
, xAttributes
, this, _pImport
);
2474 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("scrollbar") ))
2476 return new ScrollBarElement( rLocalName
, xAttributes
, this, _pImport
);
2479 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("spinbutton") ) && isVBACompatModeOn( _pImport
) )
2481 return new SpinButtonElement( rLocalName
, xAttributes
, this, _pImport
);
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
);
2493 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") ))
2495 return new BulletinBoardElement( rLocalName
, xAttributes
, this, _pImport
);
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
)
2510 : ControlElement( rLocalName
, xAttributes
, pParent
, pImport
)
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 //##################################################################################################
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
;
2548 _xAttributes
->getValueByUidName(
2549 _pImport
->XMLNS_DIALOGS_UID
,
2550 OUString( RTL_CONSTASCII_USTRINGPARAM("style-id") ) ) );
2551 if (aStyleId
.getLength())
2553 _pImport
->addStyle( aStyleId
, this );
2557 throw xml::sax::SAXException(
2558 OUString( RTL_CONSTASCII_USTRINGPARAM("missing style-id attribute!") ),
2559 Reference
< XInterface
>(), Any() );
2563 //##################################################################################################
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() );
2579 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("style") ))
2581 return new StyleElement( rLocalName
, xAttributes
, this, _pImport
);
2585 throw xml::sax::SAXException(
2586 OUString( RTL_CONSTASCII_USTRINGPARAM("expected style element!") ),
2587 Reference
< XInterface
>(), Any() );
2591 //##################################################################################################
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
)
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() );
2612 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("styles") ))
2614 return new StylesElement( rLocalName
, xAttributes
, this, _pImport
);
2617 else if (rLocalName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") ))
2619 return new BulletinBoardElement( rLocalName
, xAttributes
, this, _pImport
);
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
) );
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") ),
2651 ctx
.importBooleanProperty(
2652 OUString( RTL_CONSTASCII_USTRINGPARAM("Moveable") ),
2653 OUString( RTL_CONSTASCII_USTRINGPARAM("moveable") ),
2655 ctx
.importBooleanProperty(
2656 OUString( RTL_CONSTASCII_USTRINGPARAM("Sizeable") ),
2657 OUString( RTL_CONSTASCII_USTRINGPARAM("resizeable") ),
2659 ctx
.importStringProperty(
2660 OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ),
2661 OUString( RTL_CONSTASCII_USTRINGPARAM("title") ),
2663 ctx
.importBooleanProperty(
2664 OUString( RTL_CONSTASCII_USTRINGPARAM("Decoration") ),
2665 OUString( RTL_CONSTASCII_USTRINGPARAM("withtitlebar") ),
2667 ctx
.importStringProperty(
2668 OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
2669 OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
2671 ctx
.importEvents( _events
);
2672 // avoid ring-reference:
2673 // vector< event elements > holding event elements holding this (via _pParent)