Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "imp_share.hxx"
21 : #include <com/sun/star/form/binding/XBindableValue.hpp>
22 : #include <com/sun/star/form/binding/XValueBinding.hpp>
23 : #include <com/sun/star/form/binding/XListEntrySink.hpp>
24 : #include <com/sun/star/beans/NamedValue.hpp>
25 : #include <com/sun/star/table/CellAddress.hpp>
26 : #include <com/sun/star/table/CellRangeAddress.hpp>
27 : #include <com/sun/star/beans/XPropertySet.hpp>
28 : #include <com/sun/star/beans/XPropertyState.hpp>
29 : #include <com/sun/star/document/XStorageBasedDocument.hpp>
30 : #include <com/sun/star/document/XGraphicObjectResolver.hpp>
31 : #include <com/sun/star/script/vba/XVBACompatibility.hpp>
32 :
33 : #include <comphelper/componentcontext.hxx>
34 : #include <comphelper/processfactory.hxx>
35 : using namespace ::com::sun::star;
36 : using namespace ::com::sun::star::uno;
37 : using ::rtl::OUString;
38 :
39 : namespace xmlscript
40 : {
41 :
42 0 : Reference< xml::input::XElement > Frame::startChildElement(
43 : sal_Int32 nUid, OUString const & rLocalName,
44 : Reference< xml::input::XAttributes > const & xAttributes )
45 : throw (xml::sax::SAXException, RuntimeException)
46 : {
47 0 : if ( !m_xContainer.is() )
48 0 : m_xContainer.set( _pImport->_xDialogModelFactory->createInstance( "com.sun.star.awt.UnoFrameModel" ), UNO_QUERY );
49 : // event
50 0 : if (_pImport->isEventElement( nUid, rLocalName ))
51 : {
52 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
53 : }
54 0 : else if ( rLocalName == "bulletinboard" )
55 : {
56 : // Create new DialogImport for this container
57 0 : DialogImport* pFrameImport = new DialogImport( *_pImport );
58 0 : pFrameImport->_xDialogModel = m_xContainer;
59 0 : return new BulletinBoardElement( rLocalName, xAttributes, this, pFrameImport );
60 : }
61 0 : else if ( rLocalName == "title" )
62 : {
63 0 : getStringAttr( &_label, "value", xAttributes, _pImport->XMLNS_DIALOGS_UID );
64 :
65 0 : return new ElementBase( _pImport->XMLNS_DIALOGS_UID, rLocalName, xAttributes, this, _pImport );
66 : }
67 : else
68 : {
69 : OSL_TRACE("****** ARGGGGG!!!! **********");
70 0 : throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() );
71 : }
72 : }
73 : //__________________________________________________________________________________________________
74 :
75 0 : void Frame::endElement()
76 : throw (xml::sax::SAXException, RuntimeException)
77 : {
78 0 : if ( !m_xContainer.is() )
79 0 : m_xContainer.set( _pImport->_xDialogModelFactory->createInstance( "com.sun.star.awt.UnoFrameModel" ), UNO_QUERY );
80 0 : Reference< beans::XPropertySet > xProps( m_xContainer, UNO_QUERY_THROW );
81 : // _pImport is what we need to add to ( e.g. the dialog in this case )
82 0 : ControlImportContext ctx( _pImport, xProps, getControlId( _xAttributes ) );
83 :
84 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
85 :
86 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
87 0 : if (xStyle.is())
88 : {
89 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
90 0 : pStyle->importTextColorStyle( xControlModel );
91 0 : pStyle->importTextLineColorStyle( xControlModel );
92 0 : pStyle->importFontStyle( xControlModel );
93 : }
94 :
95 0 : ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
96 0 : if (!_label.isEmpty())
97 : {
98 0 : xControlModel->setPropertyValue( "Label" , makeAny( _label ) );
99 : }
100 : #if SCROLLABLEFRAME
101 : ctx.importScollableSettings( _xAttributes );
102 : #endif
103 0 : ctx.importEvents( _events );
104 : // avoid ring-reference:
105 : // vector< event elements > holding event elements holding this (via _pParent)
106 0 : _events.clear();
107 0 : }
108 :
109 : //===
110 0 : Reference< xml::input::XElement > MultiPage::startChildElement(
111 : sal_Int32 nUid, OUString const & rLocalName,
112 : Reference< xml::input::XAttributes > const & xAttributes )
113 : throw (xml::sax::SAXException, RuntimeException)
114 : {
115 : // event
116 0 : if (_pImport->isEventElement( nUid, rLocalName ))
117 : {
118 : return new EventElement(
119 0 : nUid, rLocalName, xAttributes, this, _pImport );
120 : }
121 0 : else if ( rLocalName == "bulletinboard" )
122 : {
123 : // Create new DialogImport for this container
124 :
125 0 : DialogImport* pMultiPageImport = new DialogImport( *_pImport );
126 0 : pMultiPageImport->_xDialogModel = m_xContainer;
127 0 : return new BulletinBoardElement( rLocalName, xAttributes, this, pMultiPageImport );
128 : }
129 : else
130 : {
131 :
132 0 : throw xml::sax::SAXException( "expected event element!", Reference< XInterface >(), Any() );
133 : }
134 : }
135 : //__________________________________________________________________________________________________
136 :
137 0 : void MultiPage::endElement()
138 : throw (xml::sax::SAXException, RuntimeException)
139 : {
140 0 : Reference< beans::XPropertySet > xProps( m_xContainer, UNO_QUERY_THROW );
141 : // _pImport is what we need to add to ( e.g. the dialog in this case )
142 0 : ControlImportContext ctx( _pImport, xProps, getControlId( _xAttributes ));
143 :
144 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
145 :
146 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
147 0 : if (xStyle.is())
148 : {
149 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
150 0 : pStyle->importTextColorStyle( xControlModel );
151 0 : pStyle->importTextLineColorStyle( xControlModel );
152 0 : pStyle->importFontStyle( xControlModel );
153 0 : pStyle->importBackgroundColorStyle( xControlModel );
154 : }
155 :
156 0 : ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
157 0 : ctx.importLongProperty("MultiPageValue" , "value", _xAttributes );
158 0 : ctx.importBooleanProperty( "Decoration", "withtabs", _xAttributes) ;
159 0 : ctx.importEvents( _events );
160 : // avoid ring-reference:
161 : // vector< event elements > holding event elements holding this (via _pParent)
162 0 : _events.clear();
163 0 : }
164 :
165 0 : Reference< xml::input::XElement > Page::startChildElement(
166 : sal_Int32 nUid, OUString const & rLocalName,
167 : Reference< xml::input::XAttributes > const & xAttributes )
168 : throw (xml::sax::SAXException, RuntimeException)
169 : {
170 : // event
171 0 : if (_pImport->isEventElement( nUid, rLocalName ))
172 : {
173 : return new EventElement(
174 0 : nUid, rLocalName, xAttributes, this, _pImport );
175 : }
176 0 : else if ( rLocalName == "bulletinboard" )
177 : {
178 :
179 0 : DialogImport* pPageImport = new DialogImport( *_pImport );
180 0 : pPageImport->_xDialogModel = m_xContainer;
181 0 : return new BulletinBoardElement( rLocalName, xAttributes, this, pPageImport );
182 : }
183 : else
184 : {
185 :
186 0 : throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() );
187 : }
188 : }
189 : //__________________________________________________________________________________________________
190 :
191 0 : void Page::endElement()
192 : throw (xml::sax::SAXException, RuntimeException)
193 : {
194 0 : Reference< beans::XPropertySet > xProps( m_xContainer, UNO_QUERY_THROW );
195 :
196 0 : ControlImportContext ctx( _pImport, xProps, getControlId( _xAttributes ));
197 :
198 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
199 :
200 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
201 0 : if (xStyle.is())
202 : {
203 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
204 0 : pStyle->importTextColorStyle( xControlModel );
205 0 : pStyle->importTextLineColorStyle( xControlModel );
206 0 : pStyle->importFontStyle( xControlModel );
207 0 : pStyle->importBackgroundColorStyle( xControlModel );
208 : }
209 :
210 0 : ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
211 0 : ctx.importStringProperty( OUString( "Title" ), OUString( "title" ), _xAttributes );
212 0 : ctx.importEvents( _events );
213 : // avoid ring-reference:
214 : // vector< event elements > holding event elements holding this (via _pParent)
215 0 : _events.clear();
216 0 : }
217 :
218 : // progessmeter
219 : //__________________________________________________________________________________________________
220 0 : Reference< xml::input::XElement > ProgressBarElement::startChildElement(
221 : sal_Int32 nUid, OUString const & rLocalName,
222 : Reference< xml::input::XAttributes > const & xAttributes )
223 : throw (xml::sax::SAXException, RuntimeException)
224 : {
225 : // event
226 0 : if (_pImport->isEventElement( nUid, rLocalName ))
227 : {
228 : return new EventElement(
229 0 : nUid, rLocalName, xAttributes, this, _pImport );
230 : }
231 : else
232 : {
233 : throw xml::sax::SAXException(
234 : OUString( "expected event element!" ),
235 0 : Reference< XInterface >(), Any() );
236 : }
237 : }
238 : //__________________________________________________________________________________________________
239 0 : void ProgressBarElement::endElement()
240 : throw (xml::sax::SAXException, RuntimeException)
241 : {
242 0 : ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlProgressBarModel" );
243 :
244 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
245 0 : if (xStyle.is())
246 : {
247 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
248 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
249 0 : pStyle->importBackgroundColorStyle( xControlModel );
250 0 : pStyle->importBorderStyle( xControlModel );
251 0 : pStyle->importFillColorStyle( xControlModel );
252 : }
253 :
254 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
255 0 : ctx.importLongProperty( "ProgressValue", "value", _xAttributes );
256 0 : ctx.importLongProperty( "ProgressValueMin", "value-min", _xAttributes );
257 0 : ctx.importLongProperty( "ProgressValueMax", "value-max", _xAttributes );
258 0 : ctx.importEvents( _events );
259 : // avoid ring-reference:
260 : // vector< event elements > holding event elements holding this (via _pParent)
261 0 : _events.clear();
262 0 : }
263 :
264 : //##################################################################################################
265 :
266 : // scrollbar
267 : //__________________________________________________________________________________________________
268 0 : Reference< xml::input::XElement > ScrollBarElement::startChildElement(
269 : sal_Int32 nUid, OUString const & rLocalName,
270 : Reference< xml::input::XAttributes > const & xAttributes )
271 : throw (xml::sax::SAXException, RuntimeException)
272 : {
273 : // event
274 0 : if (_pImport->isEventElement( nUid, rLocalName ))
275 : {
276 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
277 : }
278 : else
279 : {
280 0 : throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() );
281 : }
282 : }
283 : //__________________________________________________________________________________________________
284 0 : void ScrollBarElement::endElement()
285 : throw (xml::sax::SAXException, RuntimeException)
286 : {
287 0 : ControlImportContext ctx( _pImport, getControlId( _xAttributes ), getControlModelName( "com.sun.star.awt.UnoControlScrollBarModel" , _xAttributes ) );
288 :
289 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
290 0 : if (xStyle.is())
291 : {
292 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
293 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
294 0 : pStyle->importBackgroundColorStyle( xControlModel );
295 0 : pStyle->importBorderStyle( xControlModel );
296 : }
297 :
298 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
299 0 : ctx.importOrientationProperty( "Orientation" , "align", _xAttributes );
300 0 : ctx.importLongProperty( "BlockIncrement" , "pageincrement" , _xAttributes );
301 0 : ctx.importLongProperty( "LineIncrement" , "increment" , _xAttributes );
302 0 : ctx.importLongProperty( "ScrollValue" ,"curpos", _xAttributes );
303 0 : ctx.importLongProperty( "ScrollValueMax" , "maxpos" , _xAttributes );
304 0 : ctx.importLongProperty( "ScrollValueMin","minpos", _xAttributes );
305 0 : ctx.importLongProperty( "VisibleSize", "visible-size", _xAttributes );
306 0 : ctx.importLongProperty( "RepeatDelay", "repeat", _xAttributes );
307 0 : ctx.importBooleanProperty( "Tabstop", "tabstop" , _xAttributes );
308 0 : ctx.importBooleanProperty( "LiveScroll", "live-scroll", _xAttributes );
309 0 : ctx.importHexLongProperty( "SymbolColor", "symbol-color", _xAttributes );
310 :
311 0 : ctx.importDataAwareProperty( "linked-cell" , _xAttributes );
312 0 : ctx.importEvents( _events );
313 : // avoid ring-reference:
314 : // vector< event elements > holding event elements holding this (via _pParent)
315 0 : _events.clear();
316 0 : }
317 :
318 : //##################################################################################################
319 :
320 : // spinbutton
321 : //__________________________________________________________________________________________________
322 0 : Reference< xml::input::XElement > SpinButtonElement::startChildElement(
323 : sal_Int32 nUid, OUString const & rLocalName,
324 : Reference< xml::input::XAttributes > const & xAttributes )
325 : throw (xml::sax::SAXException, RuntimeException)
326 : {
327 : // event
328 0 : if (_pImport->isEventElement( nUid, rLocalName ))
329 : {
330 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
331 : }
332 : else
333 : {
334 0 : throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() );
335 : }
336 : }
337 : //__________________________________________________________________________________________________
338 0 : void SpinButtonElement::endElement()
339 : throw (xml::sax::SAXException, RuntimeException)
340 : {
341 0 : ControlImportContext ctx( _pImport, getControlId( _xAttributes ), getControlModelName( "com.sun.star.awt.UnoControlSpinButtonModel", _xAttributes ) );
342 :
343 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
344 0 : if (xStyle.is())
345 : {
346 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
347 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
348 0 : pStyle->importBackgroundColorStyle( xControlModel );
349 0 : pStyle->importBorderStyle( xControlModel );
350 : }
351 :
352 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
353 0 : ctx.importOrientationProperty( "Orientation", "align", _xAttributes );
354 0 : ctx.importLongProperty("SpinIncrement", "increment", _xAttributes );
355 0 : ctx.importLongProperty("SpinValue", "curval" ,_xAttributes );
356 0 : ctx.importLongProperty("SpinValueMax", "maxval", _xAttributes );
357 0 : ctx.importLongProperty( "SpinValueMin","minval",_xAttributes );
358 0 : ctx.importLongProperty( "Repeat", "repeat", _xAttributes );
359 0 : ctx.importLongProperty( "RepeatDelay", "repeat-delay",_xAttributes );
360 0 : ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
361 0 : ctx.importHexLongProperty( "SymbolColor", "symbol-color" , _xAttributes );
362 0 : ctx.importDataAwareProperty( "linked-cell" , _xAttributes );
363 0 : ctx.importEvents( _events );
364 : // avoid ring-reference:
365 : // vector< event elements > holding event elements holding this (via _pParent)
366 0 : _events.clear();
367 0 : }
368 :
369 : //##################################################################################################
370 :
371 : // fixedline
372 : //__________________________________________________________________________________________________
373 0 : Reference< xml::input::XElement > FixedLineElement::startChildElement(
374 : sal_Int32 nUid, OUString const & rLocalName,
375 : Reference< xml::input::XAttributes > const & xAttributes )
376 : throw (xml::sax::SAXException, RuntimeException)
377 : {
378 : // event
379 0 : if (_pImport->isEventElement( nUid, rLocalName ))
380 : {
381 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
382 : }
383 : else
384 : {
385 0 : throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() );
386 : }
387 : }
388 : //__________________________________________________________________________________________________
389 0 : void FixedLineElement::endElement()
390 : throw (xml::sax::SAXException, RuntimeException)
391 : {
392 0 : ControlImportContext ctx(_pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlFixedLineModel" );
393 :
394 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
395 0 : if (xStyle.is())
396 : {
397 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
398 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
399 0 : pStyle->importTextColorStyle( xControlModel );
400 0 : pStyle->importTextLineColorStyle( xControlModel );
401 0 : pStyle->importFontStyle( xControlModel );
402 : }
403 :
404 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
405 0 : ctx.importStringProperty( "Label", "value", _xAttributes );
406 0 : ctx.importOrientationProperty( "Orientation", "align", _xAttributes );
407 0 : ctx.importEvents( _events );
408 : // avoid ring-reference:
409 : // vector< event elements > holding event elements holding this (via _pParent)
410 0 : _events.clear();
411 0 : }
412 :
413 : //##################################################################################################
414 :
415 : // patternfield
416 : //__________________________________________________________________________________________________
417 0 : Reference< xml::input::XElement > PatternFieldElement::startChildElement(
418 : sal_Int32 nUid, OUString const & rLocalName,
419 : Reference< xml::input::XAttributes > const & xAttributes )
420 : throw (xml::sax::SAXException, RuntimeException)
421 : {
422 : // event
423 0 : if (_pImport->isEventElement( nUid, rLocalName ))
424 : {
425 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
426 : }
427 : else
428 : {
429 0 : throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() );
430 : }
431 : }
432 : //__________________________________________________________________________________________________
433 0 : void PatternFieldElement::endElement()
434 : throw (xml::sax::SAXException, RuntimeException)
435 : {
436 0 : ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlPatternFieldModel" );
437 :
438 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
439 0 : if (xStyle.is())
440 : {
441 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
442 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
443 0 : pStyle->importBackgroundColorStyle( xControlModel );
444 0 : pStyle->importTextColorStyle( xControlModel );
445 0 : pStyle->importTextLineColorStyle( xControlModel );
446 0 : pStyle->importBorderStyle( xControlModel );
447 0 : pStyle->importFontStyle( xControlModel );
448 : }
449 :
450 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
451 0 : ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
452 0 : ctx.importBooleanProperty( "ReadOnly", "readonly" , _xAttributes );
453 0 : ctx.importBooleanProperty( "StrictFormat", "strict-format", _xAttributes );
454 0 : ctx.importBooleanProperty( "HideInactiveSelection", "hide-inactive-selection", _xAttributes );
455 0 : ctx.importStringProperty( "Text", "value", _xAttributes );
456 0 : ctx.importShortProperty( "MaxTextLen", "maxlength", _xAttributes );
457 0 : ctx.importStringProperty( "EditMask", "edit-mask", _xAttributes );
458 0 : ctx.importStringProperty( "LiteralMask", "literal-mask", _xAttributes );
459 0 : ctx.importEvents( _events );
460 : // avoid ring-reference:
461 : // vector< event elements > holding event elements holding this (via _pParent)
462 0 : _events.clear();
463 0 : }
464 :
465 : //##################################################################################################
466 :
467 : // formattedfield
468 : //__________________________________________________________________________________________________
469 0 : Reference< xml::input::XElement > FormattedFieldElement::startChildElement(
470 : sal_Int32 nUid, OUString const & rLocalName,
471 : Reference< xml::input::XAttributes > const & xAttributes )
472 : throw (xml::sax::SAXException, RuntimeException)
473 : {
474 : // event
475 0 : if (_pImport->isEventElement( nUid, rLocalName ))
476 : {
477 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
478 : }
479 : else
480 : {
481 0 : throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() );
482 : }
483 : }
484 : //__________________________________________________________________________________________________
485 0 : void FormattedFieldElement::endElement()
486 : throw (xml::sax::SAXException, RuntimeException)
487 : {
488 0 : ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlFormattedFieldModel" );
489 :
490 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
491 0 : if (xStyle.is())
492 : {
493 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
494 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
495 0 : pStyle->importBackgroundColorStyle( xControlModel );
496 0 : pStyle->importTextColorStyle( xControlModel );
497 0 : pStyle->importTextLineColorStyle( xControlModel );
498 0 : pStyle->importBorderStyle( xControlModel );
499 0 : pStyle->importFontStyle( xControlModel );
500 : }
501 :
502 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
503 0 : ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
504 0 : ctx.importBooleanProperty( "ReadOnly", "readonly" , _xAttributes );
505 0 : ctx.importBooleanProperty( "StrictFormat", "strict-format" , _xAttributes );
506 0 : ctx.importBooleanProperty( "HideInactiveSelection", "hide-inactive-selection", _xAttributes );
507 0 : ctx.importAlignProperty( "Align" , "align" , _xAttributes );
508 0 : ctx.importDoubleProperty( "EffectiveMin", "value-min" , _xAttributes );
509 0 : ctx.importDoubleProperty( "EffectiveMax", "value-max", _xAttributes);
510 0 : ctx.importDoubleProperty( "EffectiveValue", "value", _xAttributes );
511 0 : ctx.importStringProperty( "Text", "text", _xAttributes );
512 0 : ctx.importShortProperty( "MaxTextLen", "maxlength", _xAttributes );
513 0 : ctx.importBooleanProperty( "Spin", "spin", _xAttributes );
514 0 : if (ctx.importLongProperty( "RepeatDelay", "repeat", _xAttributes ))
515 0 : ctx.getControlModel()->setPropertyValue( "Repeat" , makeAny(true) );
516 :
517 0 : OUString sDefault(_xAttributes->getValueByUidName(_pImport->XMLNS_DIALOGS_UID, "value-default") );
518 0 : if (!sDefault.isEmpty())
519 : {
520 0 : double d = sDefault.toDouble();
521 0 : if (d != 0.0 || sDefault == "0" || sDefault == "0.0" )
522 : {
523 0 : ctx.getControlModel()->setPropertyValue( "EffectiveDefault", makeAny( d ) );
524 : }
525 : else // treat as string
526 : {
527 0 : ctx.getControlModel()->setPropertyValue( "EffectiveDefault", makeAny( sDefault ) );
528 : }
529 : }
530 :
531 : // format spec
532 0 : ctx.getControlModel()->setPropertyValue("FormatsSupplier", makeAny( _pImport->getNumberFormatsSupplier() ) );
533 :
534 0 : OUString sFormat( _xAttributes->getValueByUidName(_pImport->XMLNS_DIALOGS_UID, "format-code" ) );
535 0 : if (!sFormat.isEmpty())
536 : {
537 0 : lang::Locale locale;
538 :
539 0 : OUString sLocale( _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, "format-locale" ) );
540 0 : if (!sLocale.isEmpty())
541 : {
542 : // split locale
543 0 : sal_Int32 semi0 = sLocale.indexOf( ';' );
544 0 : if (semi0 < 0) // no semi at all, just try language
545 : {
546 0 : locale.Language = sLocale;
547 : }
548 : else
549 : {
550 0 : sal_Int32 semi1 = sLocale.indexOf( ';', semi0 +1 );
551 0 : if (semi1 > semi0) // language;country;variant
552 : {
553 0 : locale.Language = sLocale.copy( 0, semi0 );
554 0 : locale.Country = sLocale.copy( semi0 +1, semi1 - semi0 -1 );
555 0 : locale.Variant = sLocale.copy( semi1 +1 );
556 : }
557 : else // try language;country
558 : {
559 0 : locale.Language = sLocale.copy( 0, semi0 );
560 0 : locale.Country = sLocale.copy( semi0 +1 );
561 : }
562 : }
563 : }
564 :
565 : try
566 : {
567 : Reference< util::XNumberFormats > xFormats(
568 0 : _pImport->getNumberFormatsSupplier()->getNumberFormats() );
569 0 : sal_Int32 nKey = xFormats->queryKey( sFormat, locale, sal_True );
570 0 : if (-1 == nKey)
571 : {
572 0 : nKey = xFormats->addNew( sFormat, locale );
573 : }
574 0 : ctx.getControlModel()->setPropertyValue("FormatKey", makeAny( nKey ) );
575 : }
576 0 : catch (const util::MalformedNumberFormatException & exc)
577 : {
578 : OSL_FAIL( "### util::MalformedNumberFormatException occurred!" );
579 : // rethrow
580 0 : throw xml::sax::SAXException( exc.Message, Reference< XInterface >(), Any() );
581 0 : }
582 : }
583 0 : ctx.importBooleanProperty("TreatAsNumber", "treat-as-number" , _xAttributes );
584 0 : ctx.importBooleanProperty("EnforceFormat", "enforce-format", _xAttributes );
585 :
586 0 : ctx.importDataAwareProperty( "linked-cell" , _xAttributes );
587 0 : ctx.importEvents( _events );
588 : // avoid ring-reference:
589 : // vector< event elements > holding event elements holding this (via _pParent)
590 0 : _events.clear();
591 0 : }
592 :
593 : //##################################################################################################
594 :
595 : // timefield
596 : //__________________________________________________________________________________________________
597 0 : Reference< xml::input::XElement > TimeFieldElement::startChildElement(
598 : sal_Int32 nUid, OUString const & rLocalName,
599 : Reference< xml::input::XAttributes > const & xAttributes )
600 : throw (xml::sax::SAXException, RuntimeException)
601 : {
602 : // event
603 0 : if (_pImport->isEventElement( nUid, rLocalName ))
604 : {
605 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
606 : }
607 : else
608 : {
609 0 : throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() );
610 : }
611 : }
612 : //__________________________________________________________________________________________________
613 0 : void TimeFieldElement::endElement()
614 : throw (xml::sax::SAXException, RuntimeException)
615 : {
616 0 : ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlTimeFieldModel" );
617 :
618 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
619 0 : if (xStyle.is())
620 : {
621 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
622 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
623 0 : pStyle->importBackgroundColorStyle( xControlModel );
624 0 : pStyle->importTextColorStyle( xControlModel );
625 0 : pStyle->importTextLineColorStyle( xControlModel );
626 0 : pStyle->importBorderStyle( xControlModel );
627 0 : pStyle->importFontStyle( xControlModel );
628 : }
629 :
630 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
631 0 : ctx.importBooleanProperty("Tabstop", "tabstop", _xAttributes );
632 0 : ctx.importBooleanProperty("ReadOnly", "readonly", _xAttributes );
633 0 : ctx.importBooleanProperty( "StrictFormat", "strict-format", _xAttributes );
634 0 : ctx.importBooleanProperty("HideInactiveSelection","hide-inactive-selection", _xAttributes );
635 0 : ctx.importTimeFormatProperty( "TimeFormat", "time-format", _xAttributes );
636 0 : ctx.importLongProperty( "Time", "value", _xAttributes );
637 0 : ctx.importLongProperty( "TimeMin", "value-min", _xAttributes );
638 0 : ctx.importLongProperty( "TimeMax", "value-max", _xAttributes );
639 0 : ctx.importBooleanProperty( "Spin", "spin", _xAttributes );
640 0 : if (ctx.importLongProperty( "RepeatDelay", "repeat", _xAttributes ))
641 0 : ctx.getControlModel()->setPropertyValue("Repeat", makeAny(true) );
642 0 : ctx.importStringProperty( "Text", "text" , _xAttributes );
643 0 : ctx.importBooleanProperty( "EnforceFormat", "enforce-format" , _xAttributes );
644 :
645 0 : ctx.importEvents( _events );
646 : // avoid ring-reference:
647 : // vector< event elements > holding event elements holding this (via _pParent)
648 0 : _events.clear();
649 0 : }
650 :
651 : //##################################################################################################
652 :
653 : // numericfield
654 : //__________________________________________________________________________________________________
655 0 : Reference< xml::input::XElement > NumericFieldElement::startChildElement(
656 : sal_Int32 nUid, OUString const & rLocalName,
657 : Reference< xml::input::XAttributes > const & xAttributes )
658 : throw (xml::sax::SAXException, RuntimeException)
659 : {
660 : // event
661 0 : if (_pImport->isEventElement( nUid, rLocalName ))
662 : {
663 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
664 : }
665 : else
666 : {
667 0 : throw xml::sax::SAXException( "expected event element!", Reference< XInterface >(), Any() );
668 : }
669 : }
670 : //__________________________________________________________________________________________________
671 0 : void NumericFieldElement::endElement()
672 : throw (xml::sax::SAXException, RuntimeException)
673 : {
674 0 : ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlNumericFieldModel" );
675 :
676 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
677 0 : if (xStyle.is())
678 : {
679 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
680 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
681 0 : pStyle->importBackgroundColorStyle( xControlModel );
682 0 : pStyle->importTextColorStyle( xControlModel );
683 0 : pStyle->importTextLineColorStyle( xControlModel );
684 0 : pStyle->importBorderStyle( xControlModel );
685 0 : pStyle->importFontStyle( xControlModel );
686 : }
687 :
688 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
689 0 : ctx.importBooleanProperty( "Tabstop","tabstop",_xAttributes );
690 0 : ctx.importBooleanProperty( "ReadOnly", "readonly",_xAttributes );
691 0 : ctx.importBooleanProperty( "StrictFormat", "strict-format", _xAttributes );
692 0 : ctx.importBooleanProperty( "HideInactiveSelection", "hide-inactive-selection", _xAttributes );
693 0 : ctx.importShortProperty( "DecimalAccuracy", "decimal-accuracy", _xAttributes );
694 0 : ctx.importBooleanProperty( "ShowThousandsSeparator", "thousands-separator", _xAttributes );
695 0 : ctx.importDoubleProperty( "Value", "value", _xAttributes );
696 0 : ctx.importDoubleProperty( "ValueMin", "value-min", _xAttributes );
697 0 : ctx.importDoubleProperty( "ValueMax", "value-max", _xAttributes );
698 0 : ctx.importDoubleProperty( "ValueStep", "value-step", _xAttributes );
699 0 : ctx.importBooleanProperty( "Spin", "spin", _xAttributes );
700 0 : if (ctx.importLongProperty( "RepeatDelay", "repeat", _xAttributes ))
701 0 : ctx.getControlModel()->setPropertyValue("Repeat", makeAny(true) );
702 0 : ctx.importBooleanProperty( "EnforceFormat", "enforce-format", _xAttributes );
703 0 : ctx.importEvents( _events );
704 : // avoid ring-reference:
705 : // vector< event elements > holding event elements holding this (via _pParent)
706 0 : _events.clear();
707 0 : }
708 :
709 : //##################################################################################################
710 :
711 : // datefield
712 : //__________________________________________________________________________________________________
713 0 : Reference< xml::input::XElement > DateFieldElement::startChildElement(
714 : sal_Int32 nUid, OUString const & rLocalName,
715 : Reference< xml::input::XAttributes > const & xAttributes )
716 : throw (xml::sax::SAXException, RuntimeException)
717 : {
718 : // event
719 0 : if (_pImport->isEventElement( nUid, rLocalName ))
720 : {
721 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
722 : }
723 : else
724 : {
725 0 : throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() );
726 : }
727 : }
728 : //__________________________________________________________________________________________________
729 0 : void DateFieldElement::endElement()
730 : throw (xml::sax::SAXException, RuntimeException)
731 : {
732 0 : ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlDateFieldModel" );
733 :
734 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
735 0 : if (xStyle.is())
736 : {
737 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
738 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
739 0 : pStyle->importBackgroundColorStyle( xControlModel );
740 0 : pStyle->importTextColorStyle( xControlModel );
741 0 : pStyle->importTextLineColorStyle( xControlModel );
742 0 : pStyle->importBorderStyle( xControlModel );
743 0 : pStyle->importFontStyle( xControlModel );
744 : }
745 :
746 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
747 0 : ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
748 0 : ctx.importBooleanProperty( "ReadOnly", "readonly", _xAttributes );
749 0 : ctx.importBooleanProperty( "StrictFormat", "strict-format", _xAttributes );
750 0 : ctx.importBooleanProperty( "HideInactiveSelection", "hide-inactive-selection", _xAttributes );
751 0 : ctx.importDateFormatProperty( "DateFormat", "date-format", _xAttributes );
752 0 : ctx.importBooleanProperty( "DateShowCentury", "show-century", _xAttributes );
753 0 : ctx.importLongProperty( "Date", "value", _xAttributes );
754 0 : ctx.importLongProperty( "DateMin", "value-min", _xAttributes );
755 0 : ctx.importLongProperty( "DateMax", "value-max", _xAttributes );
756 0 : ctx.importBooleanProperty( "Spin", "spin", _xAttributes );
757 0 : if (ctx.importLongProperty( "RepeatDelay", "repeat", _xAttributes ))
758 0 : ctx.getControlModel()->setPropertyValue( "Repeat", makeAny(true) );
759 0 : ctx.importBooleanProperty( "Dropdown", "dropdown", _xAttributes );
760 0 : ctx.importStringProperty( "Text", "text", _xAttributes );
761 0 : ctx.importBooleanProperty( "EnforceFormat", "enforce-format", _xAttributes );
762 0 : ctx.importEvents( _events );
763 : // avoid ring-reference:
764 : // vector< event elements > holding event elements holding this (via _pParent)
765 0 : _events.clear();
766 0 : }
767 :
768 : //##################################################################################################
769 :
770 : // currencyfield
771 : //__________________________________________________________________________________________________
772 0 : Reference< xml::input::XElement > CurrencyFieldElement::startChildElement(
773 : sal_Int32 nUid, OUString const & rLocalName,
774 : Reference< xml::input::XAttributes > const & xAttributes )
775 : throw (xml::sax::SAXException, RuntimeException)
776 : {
777 : // event
778 0 : if (_pImport->isEventElement( nUid, rLocalName ))
779 : {
780 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
781 : }
782 : else
783 : {
784 0 : throw xml::sax::SAXException( "expected event element!" , Reference< XInterface >(), Any() );
785 : }
786 : }
787 : //__________________________________________________________________________________________________
788 0 : void CurrencyFieldElement::endElement()
789 : throw (xml::sax::SAXException, RuntimeException)
790 : {
791 0 : ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlCurrencyFieldModel" );
792 :
793 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
794 0 : if (xStyle.is())
795 : {
796 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
797 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
798 0 : pStyle->importBackgroundColorStyle( xControlModel );
799 0 : pStyle->importTextColorStyle( xControlModel );
800 0 : pStyle->importTextLineColorStyle( xControlModel );
801 0 : pStyle->importBorderStyle( xControlModel );
802 0 : pStyle->importFontStyle( xControlModel );
803 : }
804 :
805 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
806 0 : ctx.importBooleanProperty("Tabstop", "tabstop", _xAttributes );
807 0 : ctx.importBooleanProperty( "ReadOnly", "readonly" , _xAttributes );
808 0 : ctx.importBooleanProperty( "StrictFormat", "strict-format", _xAttributes );
809 0 : ctx.importBooleanProperty( "HideInactiveSelection", "hide-inactive-selection", _xAttributes );
810 0 : ctx.importStringProperty( "CurrencySymbol", "currency-symbol", _xAttributes );
811 0 : ctx.importShortProperty( "DecimalAccuracy", "decimal-accuracy", _xAttributes );
812 0 : ctx.importBooleanProperty( "ShowThousandsSeparator", "thousands-separator", _xAttributes );
813 0 : ctx.importDoubleProperty( "Value", "value", _xAttributes );
814 0 : ctx.importDoubleProperty( "ValueMin", "value-min", _xAttributes );
815 0 : ctx.importDoubleProperty( "ValueMax", "value-max", _xAttributes );
816 0 : ctx.importDoubleProperty( "ValueStep", "value-step", _xAttributes );
817 0 : ctx.importBooleanProperty( "Spin", "spin", _xAttributes );
818 0 : if (ctx.importLongProperty( "RepeatDelay", "repeat", _xAttributes ))
819 0 : ctx.getControlModel()->setPropertyValue( "Repeat", makeAny(true) );
820 0 : ctx.importBooleanProperty( "PrependCurrencySymbol", "prepend-symbol", _xAttributes );
821 0 : ctx.importBooleanProperty( "EnforceFormat", "enforce-format", _xAttributes );
822 0 : ctx.importEvents( _events );
823 : // avoid ring-reference:
824 : // vector< event elements > holding event elements holding this (via _pParent)
825 0 : _events.clear();
826 0 : }
827 :
828 : //##################################################################################################
829 :
830 : // filecontrol
831 : //__________________________________________________________________________________________________
832 0 : Reference< xml::input::XElement > FileControlElement::startChildElement(
833 : sal_Int32 nUid, OUString const & rLocalName,
834 : Reference< xml::input::XAttributes > const & xAttributes )
835 : throw (xml::sax::SAXException, RuntimeException)
836 : {
837 : // event
838 0 : if (_pImport->isEventElement( nUid, rLocalName ))
839 : {
840 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
841 : }
842 : else
843 : {
844 0 : throw xml::sax::SAXException( "expected event element!", Reference< XInterface >(), Any() );
845 : }
846 : }
847 : //__________________________________________________________________________________________________
848 0 : void FileControlElement::endElement()
849 : throw (xml::sax::SAXException, RuntimeException)
850 : {
851 0 : ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlFileControlModel" );
852 :
853 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
854 0 : if (xStyle.is())
855 : {
856 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
857 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
858 0 : pStyle->importBackgroundColorStyle( xControlModel );
859 0 : pStyle->importTextColorStyle( xControlModel );
860 0 : pStyle->importTextLineColorStyle( xControlModel );
861 0 : pStyle->importBorderStyle( xControlModel );
862 0 : pStyle->importFontStyle( xControlModel );
863 : }
864 :
865 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
866 0 : ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
867 0 : ctx.importBooleanProperty("HideInactiveSelection","hide-inactive-selection", _xAttributes );
868 0 : ctx.importStringProperty( "Text", "value", _xAttributes );
869 0 : ctx.importBooleanProperty( "ReadOnly", "readonly", _xAttributes );
870 0 : ctx.importEvents( _events );
871 : // avoid ring-reference:
872 : // vector< event elements > holding event elements holding this (via _pParent)
873 0 : _events.clear();
874 0 : }
875 : //##################################################################################################
876 :
877 : // treecontrol
878 : //__________________________________________________________________________________________________
879 0 : Reference< xml::input::XElement > TreeControlElement::startChildElement(
880 : sal_Int32 nUid, OUString const & rLocalName,
881 : Reference< xml::input::XAttributes > const & xAttributes )
882 : throw (xml::sax::SAXException, RuntimeException)
883 : {
884 : // event
885 0 : if (_pImport->isEventElement( nUid, rLocalName ))
886 : {
887 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
888 : }
889 : else
890 : {
891 0 : throw xml::sax::SAXException( "expected event element!", Reference< XInterface >(), Any() );
892 : }
893 : }
894 : //__________________________________________________________________________________________________
895 0 : void TreeControlElement::endElement()
896 : throw (xml::sax::SAXException, RuntimeException)
897 : {
898 0 : ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.tree.TreeControlModel" );
899 :
900 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
901 0 : if (xStyle.is())
902 : {
903 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
904 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
905 0 : pStyle->importBackgroundColorStyle( xControlModel );
906 0 : pStyle->importBorderStyle( xControlModel );
907 : }
908 :
909 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
910 0 : ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
911 0 : ctx.importSelectionTypeProperty( "SelectionType", "selectiontype", _xAttributes );
912 0 : ctx.importBooleanProperty( "RootDisplayed", "rootdisplayed", _xAttributes );
913 0 : ctx.importBooleanProperty( "ShowsHandles", "showshandles", _xAttributes );
914 0 : ctx.importBooleanProperty( "ShowsRootHandles", "showsroothandles" ,_xAttributes );
915 0 : ctx.importBooleanProperty( "Editable", "editable", _xAttributes );
916 0 : ctx.importBooleanProperty( "RowHeight", "readonly", _xAttributes );
917 0 : ctx.importBooleanProperty( "InvokesStopNodeEditing", "invokesstopnodeediting", _xAttributes );
918 :
919 0 : ctx.importEvents( _events );
920 : // avoid ring-reference:
921 : // vector< event elements > holding event elements holding this (via _pParent)
922 0 : _events.clear();
923 0 : }
924 :
925 : //##################################################################################################
926 :
927 : // imagecontrol
928 : //__________________________________________________________________________________________________
929 0 : Reference< xml::input::XElement > ImageControlElement::startChildElement(
930 : sal_Int32 nUid, OUString const & rLocalName,
931 : Reference< xml::input::XAttributes > const & xAttributes )
932 : throw (xml::sax::SAXException, RuntimeException)
933 : {
934 : // event
935 0 : if (_pImport->isEventElement( nUid, rLocalName ))
936 : {
937 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
938 : }
939 : else
940 : {
941 0 : throw xml::sax::SAXException( "expected event element!" , Reference< XInterface >(), Any() );
942 : }
943 : }
944 : //__________________________________________________________________________________________________
945 0 : void ImageControlElement::endElement()
946 : throw (xml::sax::SAXException, RuntimeException)
947 : {
948 0 : ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlImageControlModel" );
949 :
950 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
951 0 : if (xStyle.is())
952 : {
953 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
954 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
955 0 : pStyle->importBackgroundColorStyle( xControlModel );
956 0 : pStyle->importBorderStyle( xControlModel );
957 : }
958 :
959 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
960 0 : ctx.importBooleanProperty( "ScaleImage", "scale-image", _xAttributes );
961 0 : OUString sURL = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, "src" );
962 0 : Reference< document::XStorageBasedDocument > xDocStorage( _pImport->getDocOwner(), UNO_QUERY );
963 :
964 0 : ctx.importImageURLProperty( "ImageURL" , "src" , _xAttributes );
965 0 : ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
966 0 : ctx.importEvents( _events );
967 : // avoid ring-reference:
968 : // vector< event elements > holding event elements holding this (via _pParent)
969 0 : _events.clear();
970 0 : }
971 :
972 : //##################################################################################################
973 :
974 : // textfield
975 : //__________________________________________________________________________________________________
976 0 : Reference< xml::input::XElement > TextElement::startChildElement(
977 : sal_Int32 nUid, OUString const & rLocalName,
978 : Reference< xml::input::XAttributes > const & xAttributes )
979 : throw (xml::sax::SAXException, RuntimeException)
980 : {
981 : // event
982 0 : if (_pImport->isEventElement( nUid, rLocalName ))
983 : {
984 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
985 : }
986 : else
987 : {
988 0 : throw xml::sax::SAXException( "expected event element!", Reference< XInterface >(), Any() );
989 : }
990 : }
991 : //__________________________________________________________________________________________________
992 0 : void TextElement::endElement()
993 : throw (xml::sax::SAXException, RuntimeException)
994 : {
995 0 : ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlFixedTextModel" );
996 :
997 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
998 0 : if (xStyle.is())
999 : {
1000 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1001 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1002 0 : pStyle->importBackgroundColorStyle( xControlModel );
1003 0 : pStyle->importTextColorStyle( xControlModel );
1004 0 : pStyle->importTextLineColorStyle( xControlModel );
1005 0 : pStyle->importBorderStyle( xControlModel );
1006 0 : pStyle->importFontStyle( xControlModel );
1007 : }
1008 :
1009 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1010 0 : ctx.importStringProperty( "Label", "value", _xAttributes );
1011 0 : ctx.importAlignProperty( "Align", "align", _xAttributes );
1012 0 : ctx.importVerticalAlignProperty( "VerticalAlign", "valign", _xAttributes );
1013 0 : ctx.importBooleanProperty( "MultiLine", "multiline" ,_xAttributes );
1014 0 : ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
1015 0 : ctx.importBooleanProperty( "NoLabel", "nolabel", _xAttributes );
1016 0 : ctx.importEvents( _events );
1017 : // avoid ring-reference:
1018 : // vector< event elements > holding event elements holding this (via _pParent)
1019 0 : _events.clear();
1020 0 : }
1021 :
1022 : //##################################################################################################
1023 : // FixedHyperLink
1024 : //__________________________________________________________________________________________________
1025 0 : Reference< xml::input::XElement > FixedHyperLinkElement::startChildElement(
1026 : sal_Int32 nUid, OUString const & rLocalName,
1027 : Reference< xml::input::XAttributes > const & xAttributes )
1028 : throw (xml::sax::SAXException, RuntimeException)
1029 : {
1030 : // event
1031 0 : if (_pImport->isEventElement( nUid, rLocalName ))
1032 : {
1033 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1034 : }
1035 : else
1036 : {
1037 0 : throw xml::sax::SAXException( "expected event element!" , Reference< XInterface >(), Any() );
1038 : }
1039 : }
1040 : //__________________________________________________________________________________________________
1041 0 : void FixedHyperLinkElement::endElement()
1042 : throw (xml::sax::SAXException, RuntimeException)
1043 : {
1044 0 : ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlFixedHyperlinkModel" );
1045 :
1046 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1047 0 : if (xStyle.is())
1048 : {
1049 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1050 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1051 0 : pStyle->importBackgroundColorStyle( xControlModel );
1052 0 : pStyle->importTextColorStyle( xControlModel );
1053 0 : pStyle->importTextLineColorStyle( xControlModel );
1054 0 : pStyle->importBorderStyle( xControlModel );
1055 0 : pStyle->importFontStyle( xControlModel );
1056 : }
1057 :
1058 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1059 0 : ctx.importStringProperty( "Label", "value", _xAttributes );
1060 0 : ctx.importStringProperty( "URL", "url", _xAttributes );
1061 0 : ctx.importStringProperty( "Description", "description", _xAttributes );
1062 :
1063 0 : ctx.importAlignProperty( "Align", "align" ,_xAttributes );
1064 0 : ctx.importVerticalAlignProperty( "VerticalAlign", "valign", _xAttributes );
1065 0 : ctx.importBooleanProperty( "MultiLine", "multiline", _xAttributes );
1066 0 : ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
1067 0 : ctx.importBooleanProperty( "NoLabel", "nolabel", _xAttributes );
1068 0 : ctx.importEvents( _events );
1069 : // avoid ring-reference:
1070 : // vector< event elements > holding event elements holding this (via _pParent)
1071 0 : _events.clear();
1072 0 : }
1073 :
1074 : //##################################################################################################
1075 :
1076 : // edit
1077 : //__________________________________________________________________________________________________
1078 0 : Reference< xml::input::XElement > TextFieldElement::startChildElement(
1079 : sal_Int32 nUid, OUString const & rLocalName,
1080 : Reference< xml::input::XAttributes > const & xAttributes )
1081 : throw (xml::sax::SAXException, RuntimeException)
1082 : {
1083 : // event
1084 0 : if (_pImport->isEventElement( nUid, rLocalName ))
1085 : {
1086 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1087 : }
1088 : else
1089 : {
1090 0 : throw xml::sax::SAXException( "expected event element!", Reference< XInterface >(), Any() );
1091 : }
1092 : }
1093 : //__________________________________________________________________________________________________
1094 0 : void TextFieldElement::endElement()
1095 : throw (xml::sax::SAXException, RuntimeException)
1096 : {
1097 0 : ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlEditModel" );
1098 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1099 :
1100 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1101 0 : if (xStyle.is())
1102 : {
1103 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1104 0 : pStyle->importBackgroundColorStyle( xControlModel );
1105 0 : pStyle->importTextColorStyle( xControlModel );
1106 0 : pStyle->importTextLineColorStyle( xControlModel );
1107 0 : pStyle->importBorderStyle( xControlModel );
1108 0 : pStyle->importFontStyle( xControlModel );
1109 : }
1110 :
1111 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1112 0 : ctx.importBooleanProperty("Tabstop", "tabstop", _xAttributes );
1113 0 : ctx.importAlignProperty( "Align", "align", _xAttributes );
1114 0 : ctx.importBooleanProperty( "HardLineBreaks", "hard-linebreaks", _xAttributes );
1115 0 : ctx.importBooleanProperty( "HScroll", "hscroll" ,_xAttributes );
1116 0 : ctx.importBooleanProperty( "VScroll", "vscroll", _xAttributes );
1117 0 : ctx.importBooleanProperty("HideInactiveSelection", "hide-inactive-selection", _xAttributes );
1118 0 : ctx.importShortProperty( "MaxTextLen", "maxlength", _xAttributes );
1119 0 : ctx.importBooleanProperty( "MultiLine", "multiline", _xAttributes );
1120 0 : ctx.importBooleanProperty( "ReadOnly", "readonly", _xAttributes );
1121 0 : ctx.importStringProperty( "Text", "value", _xAttributes );
1122 0 : ctx.importLineEndFormatProperty( "LineEndFormat", "lineend-format", _xAttributes );
1123 0 : OUString aValue;
1124 0 : if (getStringAttr( &aValue, "echochar", _xAttributes, _pImport->XMLNS_DIALOGS_UID ) && !aValue.isEmpty() )
1125 : {
1126 : OSL_ENSURE( aValue.getLength() == 1, "### more than one character given for echochar!" );
1127 0 : sal_Int16 nChar = (sal_Int16)aValue[ 0 ];
1128 0 : xControlModel->setPropertyValue( "EchoChar", makeAny( nChar ) );
1129 : }
1130 :
1131 0 : ctx.importEvents( _events );
1132 : // avoid ring-reference:
1133 : // vector< event elements > holding event elements holding this (via _pParent)
1134 0 : _events.clear();
1135 0 : }
1136 :
1137 : //##################################################################################################
1138 :
1139 : // titledbox
1140 : //__________________________________________________________________________________________________
1141 0 : Reference< xml::input::XElement > TitledBoxElement::startChildElement(
1142 : sal_Int32 nUid, OUString const & rLocalName,
1143 : Reference< xml::input::XAttributes > const & xAttributes )
1144 : throw (xml::sax::SAXException, RuntimeException)
1145 : {
1146 : // event
1147 0 : if (_pImport->isEventElement( nUid, rLocalName ))
1148 : {
1149 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1150 : }
1151 0 : else if (_pImport->XMLNS_DIALOGS_UID != nUid)
1152 : {
1153 0 : throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() );
1154 : }
1155 : // title
1156 0 : else if ( rLocalName == "title" )
1157 : {
1158 0 : getStringAttr( &_label, "value", xAttributes, _pImport->XMLNS_DIALOGS_UID );
1159 :
1160 0 : return new ElementBase( _pImport->XMLNS_DIALOGS_UID, rLocalName, xAttributes, this, _pImport );
1161 : }
1162 : // radio
1163 0 : else if ( rLocalName == "radio" )
1164 : {
1165 : // dont create radios here, => titledbox must be inserted first due to radio grouping,
1166 : // possible predecessors!
1167 : Reference< xml::input::XElement > xRet(
1168 0 : new RadioElement( rLocalName, xAttributes, this, _pImport ) );
1169 0 : _radios.push_back( xRet );
1170 0 : return xRet;
1171 : }
1172 : // event
1173 0 : else if (_pImport->isEventElement( nUid, rLocalName ))
1174 : {
1175 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1176 : }
1177 : else
1178 : {
1179 0 : return BulletinBoardElement::startChildElement( nUid, rLocalName, xAttributes );
1180 : }
1181 : }
1182 : //__________________________________________________________________________________________________
1183 0 : void TitledBoxElement::endElement()
1184 : throw (xml::sax::SAXException, RuntimeException)
1185 : {
1186 : {
1187 0 : ControlImportContext ctx(_pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlGroupBoxModel" );
1188 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1189 :
1190 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1191 0 : if (xStyle.is())
1192 : {
1193 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1194 0 : pStyle->importTextColorStyle( xControlModel );
1195 0 : pStyle->importTextLineColorStyle( xControlModel );
1196 0 : pStyle->importFontStyle( xControlModel );
1197 : }
1198 :
1199 0 : ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
1200 :
1201 0 : if (!_label.isEmpty())
1202 : {
1203 0 : xControlModel->setPropertyValue( "Label", makeAny( _label ) );
1204 : }
1205 :
1206 0 : ctx.importEvents( _events );
1207 : // avoid ring-reference:
1208 : // vector< event elements > holding event elements holding this (via _pParent)
1209 0 : _events.clear();
1210 : }
1211 :
1212 : // create radios AFTER group box!
1213 0 : for ( size_t nPos = 0; nPos < _radios.size(); ++nPos )
1214 : {
1215 0 : Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
1216 0 : Reference< xml::input::XAttributes > xAttributes( xRadio->getAttributes() );
1217 :
1218 0 : ControlImportContext ctx( _pImport, getControlId( xAttributes ), getControlModelName( "com.sun.star.awt.UnoControlRadioButtonModel", xAttributes ) );
1219 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1220 :
1221 0 : Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
1222 0 : if (xStyle.is())
1223 : {
1224 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1225 0 : pStyle->importBackgroundColorStyle( xControlModel );
1226 0 : pStyle->importTextColorStyle( xControlModel );
1227 0 : pStyle->importTextLineColorStyle( xControlModel );
1228 0 : pStyle->importFontStyle( xControlModel );
1229 0 : pStyle->importVisualEffectStyle( xControlModel );
1230 : }
1231 :
1232 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, xAttributes );
1233 0 : ctx.importBooleanProperty( "Tabstop", "tabstop", xAttributes );
1234 0 : ctx.importStringProperty( "Label", "value", xAttributes );
1235 0 : ctx.importAlignProperty( "Align", "align", xAttributes );
1236 0 : ctx.importVerticalAlignProperty( "VerticalAlign", "valign", xAttributes );
1237 0 : ctx.importImageURLProperty( "ImageURL" , "image-src" , _xAttributes );
1238 0 : ctx.importImagePositionProperty( "ImagePosition", "image-position", xAttributes );
1239 0 : ctx.importBooleanProperty( "MultiLine", "multiline", xAttributes );
1240 0 : ctx.importStringProperty( "GroupName", "group-name", xAttributes );
1241 :
1242 0 : sal_Int16 nVal = 0;
1243 0 : sal_Bool bChecked = sal_False;
1244 0 : if (getBoolAttr( &bChecked, "checked", xAttributes, _pImport->XMLNS_DIALOGS_UID ) && bChecked)
1245 : {
1246 0 : nVal = 1;
1247 : }
1248 0 : xControlModel->setPropertyValue( "State", makeAny( nVal ) );
1249 0 : ctx.importDataAwareProperty( "linked-cell" , xAttributes );
1250 : ::std::vector< Reference< xml::input::XElement > > * radioEvents =
1251 0 : static_cast< RadioElement * >( xRadio.get() )->getEvents();
1252 0 : ctx.importEvents( *radioEvents );
1253 : // avoid ring-reference:
1254 : // vector< event elements > holding event elements holding this (via _pParent)
1255 0 : radioEvents->clear();
1256 0 : }
1257 : // avoid ring-reference:
1258 : // vector< radio elements > holding radio elements holding this (via _pParent)
1259 0 : _radios.clear();
1260 0 : }
1261 :
1262 : //##################################################################################################
1263 :
1264 : // radio
1265 : //__________________________________________________________________________________________________
1266 0 : Reference< xml::input::XElement > RadioElement::startChildElement(
1267 : sal_Int32 nUid, OUString const & rLocalName,
1268 : Reference< xml::input::XAttributes > const & xAttributes )
1269 : throw (xml::sax::SAXException, RuntimeException)
1270 : {
1271 : // event
1272 0 : if (_pImport->isEventElement( nUid, rLocalName ))
1273 : {
1274 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1275 : }
1276 : else
1277 : {
1278 0 : throw xml::sax::SAXException("expected event element!", Reference< XInterface >(), Any() );
1279 : }
1280 : }
1281 :
1282 : //##################################################################################################
1283 :
1284 : // radiogroup
1285 : //__________________________________________________________________________________________________
1286 0 : Reference< xml::input::XElement > RadioGroupElement::startChildElement(
1287 : sal_Int32 nUid, OUString const & rLocalName,
1288 : Reference< xml::input::XAttributes > const & xAttributes )
1289 : throw (xml::sax::SAXException, RuntimeException)
1290 : {
1291 0 : if (_pImport->XMLNS_DIALOGS_UID != nUid)
1292 : {
1293 0 : throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() );
1294 : }
1295 : // radio
1296 0 : else if ( rLocalName == "radio" )
1297 : {
1298 : // dont create radios here, => titledbox must be inserted first due to radio grouping,
1299 : // possible predecessors!
1300 : Reference< xml::input::XElement > xRet(
1301 0 : new RadioElement( rLocalName, xAttributes, this, _pImport ) );
1302 0 : _radios.push_back( xRet );
1303 0 : return xRet;
1304 : }
1305 : else
1306 : {
1307 0 : throw xml::sax::SAXException( "expected radio element!", Reference< XInterface >(), Any() );
1308 : }
1309 : }
1310 : //__________________________________________________________________________________________________
1311 0 : void RadioGroupElement::endElement()
1312 : throw (xml::sax::SAXException, RuntimeException)
1313 : {
1314 0 : for ( size_t nPos = 0; nPos < _radios.size(); ++nPos )
1315 : {
1316 0 : Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
1317 : Reference< xml::input::XAttributes > xAttributes(
1318 0 : xRadio->getAttributes() );
1319 :
1320 0 : ControlImportContext ctx( _pImport, getControlId( xAttributes ), getControlModelName( "com.sun.star.awt.UnoControlRadioButtonModel", xAttributes ) );
1321 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1322 :
1323 0 : Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
1324 0 : if (xStyle.is())
1325 : {
1326 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1327 0 : pStyle->importBackgroundColorStyle( xControlModel );
1328 0 : pStyle->importTextColorStyle( xControlModel );
1329 0 : pStyle->importTextLineColorStyle( xControlModel );
1330 0 : pStyle->importFontStyle( xControlModel );
1331 0 : pStyle->importVisualEffectStyle( xControlModel );
1332 : }
1333 :
1334 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, xAttributes );
1335 0 : ctx.importBooleanProperty("Tabstop", "tabstop", xAttributes );
1336 0 : ctx.importStringProperty( "Label", "value", xAttributes );
1337 0 : ctx.importAlignProperty( "Align", "align", xAttributes );
1338 0 : ctx.importVerticalAlignProperty( "VerticalAlign", "valign", xAttributes );
1339 0 : ctx.importImageURLProperty( "ImageURL" , "image-src" , xAttributes );
1340 0 : ctx.importImagePositionProperty( "ImagePosition", "image-position", xAttributes );
1341 0 : ctx.importBooleanProperty( "MultiLine", "multiline", xAttributes );
1342 0 : ctx.importStringProperty( "GroupName", "group-name", xAttributes );
1343 0 : sal_Int16 nVal = 0;
1344 0 : sal_Bool bChecked = sal_False;
1345 0 : if (getBoolAttr( &bChecked, "checked", xAttributes, _pImport->XMLNS_DIALOGS_UID ) && bChecked)
1346 : {
1347 0 : nVal = 1;
1348 : }
1349 0 : xControlModel->setPropertyValue( "State", makeAny( nVal ) );
1350 :
1351 0 : ctx.importDataAwareProperty( "linked-cell", xAttributes );
1352 :
1353 : ::std::vector< Reference< xml::input::XElement > > * radioEvents =
1354 0 : static_cast< RadioElement * >( xRadio.get() )->getEvents();
1355 0 : ctx.importEvents( *radioEvents );
1356 : // avoid ring-reference:
1357 : // vector< event elements > holding event elements holding this (via _pParent)
1358 0 : radioEvents->clear();
1359 0 : }
1360 : // avoid ring-reference:
1361 : // vector< radio elements > holding radio elements holding this (via _pParent)
1362 0 : _radios.clear();
1363 0 : }
1364 :
1365 : //##################################################################################################
1366 :
1367 : // menupopup
1368 : //__________________________________________________________________________________________________
1369 0 : Reference< xml::input::XElement > MenuPopupElement::startChildElement(
1370 : sal_Int32 nUid, OUString const & rLocalName,
1371 : Reference< xml::input::XAttributes > const & xAttributes )
1372 : throw (xml::sax::SAXException, RuntimeException)
1373 : {
1374 0 : if (_pImport->XMLNS_DIALOGS_UID != nUid)
1375 : {
1376 0 : throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() );
1377 : }
1378 : // menuitem
1379 0 : else if ( rLocalName == "menuitem" )
1380 : {
1381 0 : OUString aValue( xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID,"value" ) );
1382 : OSL_ENSURE( !aValue.isEmpty(), "### menuitem has no value?" );
1383 0 : if (!aValue.isEmpty())
1384 : {
1385 0 : _itemValues.push_back( aValue );
1386 :
1387 0 : OUString aSel( xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, "selected" ) );
1388 0 : if (!aSel.isEmpty() && aSel == "true")
1389 : {
1390 0 : _itemSelected.push_back( static_cast<sal_Int16>(_itemValues.size()) -1 );
1391 0 : }
1392 : }
1393 0 : return new ElementBase( _pImport->XMLNS_DIALOGS_UID, rLocalName, xAttributes, this, _pImport );
1394 : }
1395 : else
1396 : {
1397 0 : throw xml::sax::SAXException("expected menuitem!" , Reference< XInterface >(), Any() );
1398 : }
1399 : }
1400 : //__________________________________________________________________________________________________
1401 0 : Sequence< OUString > MenuPopupElement::getItemValues()
1402 : {
1403 0 : Sequence< OUString > aRet( _itemValues.size() );
1404 0 : OUString * pRet = aRet.getArray();
1405 0 : for ( size_t nPos = _itemValues.size(); nPos--; )
1406 : {
1407 0 : pRet[ nPos ] = _itemValues[ nPos ];
1408 : }
1409 0 : return aRet;
1410 : }
1411 : //__________________________________________________________________________________________________
1412 0 : Sequence< sal_Int16 > MenuPopupElement::getSelectedItems()
1413 : {
1414 0 : Sequence< sal_Int16 > aRet( _itemSelected.size() );
1415 0 : sal_Int16 * pRet = aRet.getArray();
1416 0 : for ( size_t nPos = _itemSelected.size(); nPos--; )
1417 : {
1418 0 : pRet[ nPos ] = _itemSelected[ nPos ];
1419 : }
1420 0 : return aRet;
1421 : }
1422 :
1423 : //##################################################################################################
1424 :
1425 : // menulist
1426 : //__________________________________________________________________________________________________
1427 0 : Reference< xml::input::XElement > MenuListElement::startChildElement(
1428 : sal_Int32 nUid, OUString const & rLocalName,
1429 : Reference< xml::input::XAttributes > const & xAttributes )
1430 : throw (xml::sax::SAXException, RuntimeException)
1431 : {
1432 : // event
1433 0 : if (_pImport->isEventElement( nUid, rLocalName ))
1434 : {
1435 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1436 : }
1437 0 : else if (_pImport->XMLNS_DIALOGS_UID != nUid)
1438 : {
1439 0 : throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() );
1440 : }
1441 : // menupopup
1442 0 : else if ( rLocalName == "menupopup" )
1443 : {
1444 0 : _popup = new MenuPopupElement( rLocalName, xAttributes, this, _pImport );
1445 0 : return _popup;
1446 : }
1447 : else
1448 : {
1449 0 : throw xml::sax::SAXException( "expected event or menupopup element!", Reference< XInterface >(), Any() );
1450 : }
1451 : }
1452 : //__________________________________________________________________________________________________
1453 0 : void MenuListElement::endElement()
1454 : throw (xml::sax::SAXException, RuntimeException)
1455 : {
1456 0 : ControlImportContext ctx( _pImport, getControlId( _xAttributes ), getControlModelName( "com.sun.star.awt.UnoControlListBoxModel", _xAttributes ) );
1457 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1458 :
1459 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1460 0 : if (xStyle.is())
1461 : {
1462 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1463 0 : pStyle->importBackgroundColorStyle( xControlModel );
1464 0 : pStyle->importTextColorStyle( xControlModel );
1465 0 : pStyle->importTextLineColorStyle( xControlModel );
1466 0 : pStyle->importBorderStyle( xControlModel );
1467 0 : pStyle->importFontStyle( xControlModel );
1468 : }
1469 :
1470 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1471 0 : ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
1472 0 : ctx.importBooleanProperty( "MultiSelection", "multiselection", _xAttributes );
1473 0 : ctx.importBooleanProperty( "ReadOnly", "readonly", _xAttributes );
1474 0 : ctx.importBooleanProperty( "Dropdown", "spin", _xAttributes );
1475 0 : ctx.importShortProperty( "LineCount", "linecount", _xAttributes );
1476 0 : ctx.importAlignProperty( "Align", "align", _xAttributes );
1477 0 : bool bHasLinkedCell = ctx.importDataAwareProperty( "linked-cell" , _xAttributes );
1478 0 : bool bHasSrcRange = ctx.importDataAwareProperty( "source-cell-range" , _xAttributes );
1479 0 : if (_popup.is())
1480 : {
1481 0 : MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
1482 0 : if ( !bHasSrcRange )
1483 0 : xControlModel->setPropertyValue( "StringItemList", makeAny( p->getItemValues() ) );
1484 0 : if ( !bHasLinkedCell )
1485 0 : xControlModel->setPropertyValue( "SelectedItems", makeAny( p->getSelectedItems() ) );
1486 :
1487 : }
1488 0 : ctx.importEvents( _events );
1489 : // avoid ring-reference:
1490 : // vector< event elements > holding event elements holding this (via _pParent)
1491 0 : _events.clear();
1492 0 : }
1493 :
1494 : //##################################################################################################
1495 :
1496 : // combobox
1497 : //__________________________________________________________________________________________________
1498 0 : Reference< xml::input::XElement > ComboBoxElement::startChildElement(
1499 : sal_Int32 nUid, OUString const & rLocalName,
1500 : Reference< xml::input::XAttributes > const & xAttributes )
1501 : throw (xml::sax::SAXException, RuntimeException)
1502 : {
1503 : // event
1504 0 : if (_pImport->isEventElement( nUid, rLocalName ))
1505 : {
1506 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1507 : }
1508 0 : else if (_pImport->XMLNS_DIALOGS_UID != nUid)
1509 : {
1510 0 : throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() );
1511 : }
1512 : // menupopup
1513 0 : else if ( rLocalName == "menupopup" )
1514 : {
1515 0 : _popup = new MenuPopupElement( rLocalName, xAttributes, this, _pImport );
1516 0 : return _popup;
1517 : }
1518 : else
1519 : {
1520 0 : throw xml::sax::SAXException( "expected event or menupopup element!", Reference< XInterface >(), Any() );
1521 : }
1522 : }
1523 : //__________________________________________________________________________________________________
1524 0 : void ComboBoxElement::endElement()
1525 : throw (xml::sax::SAXException, RuntimeException)
1526 : {
1527 0 : ControlImportContext ctx( _pImport, getControlId( _xAttributes ), getControlModelName( "com.sun.star.awt.UnoControlComboBoxModel", _xAttributes ) );
1528 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1529 :
1530 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1531 0 : if (xStyle.is())
1532 : {
1533 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1534 0 : pStyle->importBackgroundColorStyle( xControlModel );
1535 0 : pStyle->importTextColorStyle( xControlModel );
1536 0 : pStyle->importTextLineColorStyle( xControlModel );
1537 0 : pStyle->importBorderStyle( xControlModel );
1538 0 : pStyle->importFontStyle( xControlModel );
1539 : }
1540 :
1541 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1542 0 : ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
1543 0 : ctx.importBooleanProperty( "ReadOnly", "readonly", _xAttributes );
1544 0 : ctx.importBooleanProperty( "Autocomplete", "autocomplete", _xAttributes );
1545 0 : ctx.importBooleanProperty( "Dropdown", "spin", _xAttributes );
1546 0 : ctx.importBooleanProperty( "HideInactiveSelection", "hide-inactive-selection", _xAttributes );
1547 0 : ctx.importShortProperty( "MaxTextLen", "maxlength" ,_xAttributes );
1548 0 : ctx.importShortProperty( "LineCount", "linecount" ,_xAttributes );
1549 0 : ctx.importStringProperty( "Text", "value", _xAttributes );
1550 0 : ctx.importAlignProperty( "Align", "align", _xAttributes );
1551 0 : ctx.importDataAwareProperty( "linked-cell" , _xAttributes );
1552 0 : bool bHasSrcRange = ctx.importDataAwareProperty( "source-cell-range" , _xAttributes );
1553 0 : if (_popup.is() && !bHasSrcRange )
1554 : {
1555 0 : MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
1556 0 : xControlModel->setPropertyValue( "StringItemList", makeAny( p->getItemValues() ) );
1557 : }
1558 :
1559 0 : ctx.importEvents( _events );
1560 : // avoid ring-reference:
1561 : // vector< event elements > holding event elements holding this (via _pParent)
1562 0 : _events.clear();
1563 0 : }
1564 :
1565 : //##################################################################################################
1566 :
1567 : // checkbox
1568 : //__________________________________________________________________________________________________
1569 0 : Reference< xml::input::XElement > CheckBoxElement::startChildElement(
1570 : sal_Int32 nUid, OUString const & rLocalName,
1571 : Reference< xml::input::XAttributes > const & xAttributes )
1572 : throw (xml::sax::SAXException, RuntimeException)
1573 : {
1574 : // event
1575 0 : if (_pImport->isEventElement( nUid, rLocalName ))
1576 : {
1577 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1578 : }
1579 : else
1580 : {
1581 0 : throw xml::sax::SAXException( "expected event element!", Reference< XInterface >(), Any() );
1582 : }
1583 : }
1584 : //__________________________________________________________________________________________________
1585 0 : void CheckBoxElement::endElement()
1586 : throw (xml::sax::SAXException, RuntimeException)
1587 : {
1588 0 : ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlCheckBoxModel" );
1589 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1590 :
1591 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1592 0 : if (xStyle.is())
1593 : {
1594 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1595 0 : pStyle->importBackgroundColorStyle( xControlModel );
1596 0 : pStyle->importTextColorStyle( xControlModel );
1597 0 : pStyle->importTextLineColorStyle( xControlModel );
1598 0 : pStyle->importFontStyle( xControlModel );
1599 0 : pStyle->importVisualEffectStyle( xControlModel );
1600 : }
1601 :
1602 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1603 0 : ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
1604 0 : ctx.importStringProperty( "Label", "value", _xAttributes );
1605 0 : ctx.importAlignProperty( "Align", "align", _xAttributes );
1606 0 : ctx.importVerticalAlignProperty( "VerticalAlign", "valign", _xAttributes );
1607 0 : ctx.importImageURLProperty( "ImageURL" , "image-src" , _xAttributes );
1608 0 : ctx.importImagePositionProperty( "ImagePosition", "image-position", _xAttributes );
1609 0 : ctx.importBooleanProperty( "MultiLine", "multiline", _xAttributes );
1610 :
1611 :
1612 0 : sal_Bool bTriState = sal_False;
1613 0 : if (getBoolAttr( &bTriState, "tristate", _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
1614 : {
1615 0 : xControlModel->setPropertyValue( "TriState", makeAny( bTriState ) );
1616 : }
1617 0 : sal_Bool bChecked = sal_False;
1618 0 : if (getBoolAttr( &bChecked, "checked", _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
1619 : {
1620 : // has "checked" attribute
1621 0 : sal_Int16 nVal = (bChecked ? 1 : 0);
1622 0 : xControlModel->setPropertyValue( "State", makeAny( nVal ) );
1623 : }
1624 : else
1625 : {
1626 0 : sal_Int16 nVal = (bTriState ? 2 : 0); // if tristate set, but checked omitted => dont know!
1627 0 : xControlModel->setPropertyValue( "State", makeAny( nVal ) );
1628 : }
1629 :
1630 0 : ctx.importEvents( _events );
1631 : // avoid ring-reference:
1632 : // vector< event elements > holding event elements holding this (via _pParent)
1633 0 : _events.clear();
1634 0 : }
1635 :
1636 : //##################################################################################################
1637 :
1638 : // button
1639 : //__________________________________________________________________________________________________
1640 0 : Reference< xml::input::XElement > ButtonElement::startChildElement(
1641 : sal_Int32 nUid, OUString const & rLocalName,
1642 : Reference< xml::input::XAttributes > const & xAttributes )
1643 : throw (xml::sax::SAXException, RuntimeException)
1644 : {
1645 : // event
1646 0 : if (_pImport->isEventElement( nUid, rLocalName ))
1647 : {
1648 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1649 : }
1650 : else
1651 : {
1652 0 : throw xml::sax::SAXException( "expected event element!", Reference< XInterface >(), Any() );
1653 : }
1654 : }
1655 : //__________________________________________________________________________________________________
1656 0 : void ButtonElement::endElement()
1657 : throw (xml::sax::SAXException, RuntimeException)
1658 : {
1659 0 : ControlImportContext ctx( _pImport, getControlId( _xAttributes ), "com.sun.star.awt.UnoControlButtonModel" );
1660 :
1661 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1662 0 : if (xStyle.is())
1663 : {
1664 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1665 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1666 0 : pStyle->importBackgroundColorStyle( xControlModel );
1667 0 : pStyle->importTextColorStyle( xControlModel );
1668 0 : pStyle->importTextLineColorStyle( xControlModel );
1669 0 : pStyle->importFontStyle( xControlModel );
1670 : }
1671 :
1672 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1673 0 : ctx.importBooleanProperty( "Tabstop", "tabstop", _xAttributes );
1674 0 : ctx.importStringProperty( "Label", "value", _xAttributes );
1675 0 : ctx.importAlignProperty( "Align", "align", _xAttributes );
1676 0 : ctx.importVerticalAlignProperty( "VerticalAlign", "valign", _xAttributes );
1677 0 : ctx.importBooleanProperty( "DefaultButton", "default", _xAttributes );
1678 0 : ctx.importButtonTypeProperty( "PushButtonType", "button-type", _xAttributes );
1679 0 : ctx.importImageURLProperty( "ImageURL" , "image-src" , _xAttributes );
1680 0 : ctx.importImagePositionProperty( "ImagePosition", "image-position", _xAttributes );
1681 0 : ctx.importImageAlignProperty( "ImageAlign", "image-align", _xAttributes );
1682 0 : if (ctx.importLongProperty( "RepeatDelay", "repeat", _xAttributes ))
1683 0 : ctx.getControlModel()->setPropertyValue( "Repeat", makeAny(true) );
1684 0 : sal_Int32 toggled = 0;
1685 0 : if (getLongAttr( &toggled, "toggled", _xAttributes, _pImport->XMLNS_DIALOGS_UID ) && toggled == 1)
1686 0 : ctx.getControlModel()->setPropertyValue( "Toggle" , makeAny(true));
1687 0 : ctx.importBooleanProperty( "FocusOnClick", "grab-focus", _xAttributes );
1688 0 : ctx.importBooleanProperty( "MultiLine", "multiline", _xAttributes );
1689 : // State
1690 0 : sal_Bool bChecked = sal_False;
1691 0 : if (getBoolAttr( &bChecked, "checked", _xAttributes, _pImport->XMLNS_DIALOGS_UID ) && bChecked)
1692 : {
1693 0 : sal_Int16 nVal = 1;
1694 0 : ctx.getControlModel()->setPropertyValue( "State" , makeAny( nVal ) );
1695 : }
1696 :
1697 0 : ctx.importEvents( _events );
1698 : // avoid ring-reference:
1699 : // vector< event elements > holding event elements holding this (via _pParent)
1700 0 : _events.clear();
1701 0 : }
1702 :
1703 : //##################################################################################################
1704 :
1705 : // bulletinboard
1706 : //__________________________________________________________________________________________________
1707 0 : Reference< xml::input::XElement > BulletinBoardElement::startChildElement(
1708 : sal_Int32 nUid, OUString const & rLocalName,
1709 : Reference< xml::input::XAttributes > const & xAttributes )
1710 : throw (xml::sax::SAXException, RuntimeException)
1711 : {
1712 0 : if (_pImport->XMLNS_DIALOGS_UID != nUid)
1713 : {
1714 0 : throw xml::sax::SAXException("illegal namespace!", Reference< XInterface >(), Any() );
1715 : }
1716 : // button
1717 0 : else if ( rLocalName == "button" )
1718 : {
1719 0 : return new ButtonElement( rLocalName, xAttributes, this, _pImport );
1720 : }
1721 : // checkbox
1722 0 : else if ( rLocalName == "checkbox" )
1723 : {
1724 0 : return new CheckBoxElement( rLocalName, xAttributes, this, _pImport );
1725 : }
1726 : // combobox
1727 0 : else if ( rLocalName == "combobox" )
1728 : {
1729 0 : return new ComboBoxElement( rLocalName, xAttributes, this, _pImport );
1730 : }
1731 : // listbox
1732 0 : else if ( rLocalName == "menulist" )
1733 : {
1734 0 : return new MenuListElement( rLocalName, xAttributes, this, _pImport );
1735 : }
1736 : // radiogroup
1737 0 : else if ( rLocalName == "radiogroup" )
1738 : {
1739 0 : return new RadioGroupElement( rLocalName, xAttributes, this, _pImport );
1740 : }
1741 : // titledbox
1742 0 : else if ( rLocalName == "titledbox" )
1743 : {
1744 0 : return new TitledBoxElement( rLocalName, xAttributes, this, _pImport );
1745 : }
1746 : // text
1747 0 : else if ( rLocalName == "text" )
1748 : {
1749 0 : return new TextElement( rLocalName, xAttributes, this, _pImport );
1750 : }
1751 0 : else if ( rLocalName == "linklabel" )
1752 : {
1753 0 : return new FixedHyperLinkElement( rLocalName, xAttributes, this, _pImport );
1754 : }
1755 : // textfield
1756 0 : else if ( rLocalName == "textfield" )
1757 : {
1758 0 : return new TextFieldElement( rLocalName, xAttributes, this, _pImport );
1759 : }
1760 : // img
1761 0 : else if ( rLocalName == "img" )
1762 : {
1763 0 : return new ImageControlElement( rLocalName, xAttributes, this, _pImport );
1764 : }
1765 : // filecontrol
1766 0 : else if ( rLocalName == "filecontrol" )
1767 : {
1768 0 : return new FileControlElement( rLocalName, xAttributes, this, _pImport );
1769 : }
1770 : // treecontrol
1771 0 : else if ( rLocalName == "treecontrol" )
1772 : {
1773 0 : return new TreeControlElement( rLocalName, xAttributes, this, _pImport );
1774 : }
1775 : // currencyfield
1776 0 : else if ( rLocalName == "currencyfield" )
1777 : {
1778 0 : return new CurrencyFieldElement( rLocalName, xAttributes, this, _pImport );
1779 : }
1780 : // datefield
1781 0 : else if ( rLocalName == "datefield" )
1782 : {
1783 0 : return new DateFieldElement( rLocalName, xAttributes, this, _pImport );
1784 : }
1785 : // datefield
1786 0 : else if ( rLocalName == "numericfield" )
1787 : {
1788 0 : return new NumericFieldElement( rLocalName, xAttributes, this, _pImport );
1789 : }
1790 : // timefield
1791 0 : else if ( rLocalName == "timefield" )
1792 : {
1793 0 : return new TimeFieldElement( rLocalName, xAttributes, this, _pImport );
1794 : }
1795 : // patternfield
1796 0 : else if ( rLocalName == "patternfield" )
1797 : {
1798 0 : return new PatternFieldElement( rLocalName, xAttributes, this, _pImport );
1799 : }
1800 : // formattedfield
1801 0 : else if ( rLocalName == "formattedfield" )
1802 : {
1803 0 : return new FormattedFieldElement( rLocalName, xAttributes, this, _pImport );
1804 : }
1805 : // fixedline
1806 0 : else if ( rLocalName == "fixedline" )
1807 : {
1808 0 : return new FixedLineElement( rLocalName, xAttributes, this, _pImport );
1809 : }
1810 : // scrollbar
1811 0 : else if ( rLocalName == "scrollbar" )
1812 : {
1813 0 : return new ScrollBarElement( rLocalName, xAttributes, this, _pImport );
1814 : }
1815 : // spinbutton
1816 0 : else if ( rLocalName == "spinbutton" )
1817 : {
1818 0 : return new SpinButtonElement( rLocalName, xAttributes, this, _pImport );
1819 : }
1820 : // progressmeter
1821 0 : else if ( rLocalName == "progressmeter" )
1822 : {
1823 0 : return new ProgressBarElement( rLocalName, xAttributes, this, _pImport );
1824 : }
1825 0 : else if ( rLocalName == "multipage" )
1826 : {
1827 0 : return new MultiPage( rLocalName, xAttributes, this, _pImport );
1828 : }
1829 0 : else if ( rLocalName == "frame" )
1830 : {
1831 0 : return new Frame( rLocalName, xAttributes, this, _pImport );
1832 : }
1833 0 : else if ( rLocalName == "page" )
1834 : {
1835 0 : return new Page( rLocalName, xAttributes, this, _pImport );
1836 : }
1837 : // bulletinboard
1838 0 : else if ( rLocalName == "bulletinboard" )
1839 : {
1840 0 : return new BulletinBoardElement( rLocalName, xAttributes, this, _pImport );
1841 : }
1842 : else
1843 : {
1844 0 : throw xml::sax::SAXException( "expected styles, bulletinboard or bulletinboard element, not: " + rLocalName, Reference< XInterface >(), Any() );
1845 : }
1846 : }
1847 : //__________________________________________________________________________________________________
1848 0 : BulletinBoardElement::BulletinBoardElement(
1849 : OUString const & rLocalName,
1850 : Reference< xml::input::XAttributes > const & xAttributes,
1851 : ElementBase * pParent, DialogImport * pImport )
1852 : SAL_THROW(())
1853 0 : : ControlElement( rLocalName, xAttributes, pParent, pImport )
1854 : {
1855 0 : OUString aValue( _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, "left" ) );
1856 0 : if (!aValue.isEmpty())
1857 : {
1858 0 : _nBasePosX += toInt32( aValue );
1859 : }
1860 0 : aValue = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, "top" );
1861 0 : if (!aValue.isEmpty())
1862 : {
1863 0 : _nBasePosY += toInt32( aValue );
1864 0 : }
1865 0 : }
1866 :
1867 : //##################################################################################################
1868 :
1869 : // style
1870 : //__________________________________________________________________________________________________
1871 0 : Reference< xml::input::XElement > StyleElement::startChildElement(
1872 : sal_Int32 /*nUid*/, OUString const & /*rLocalName*/,
1873 : Reference< xml::input::XAttributes > const & /*xAttributes*/ )
1874 : throw (xml::sax::SAXException, RuntimeException)
1875 : {
1876 0 : throw xml::sax::SAXException( "unexpected sub elements of style!", Reference< XInterface >(), Any() );
1877 : }
1878 : //__________________________________________________________________________________________________
1879 0 : void StyleElement::endElement()
1880 : throw (xml::sax::SAXException, RuntimeException)
1881 : {
1882 0 : Reference< xml::input::XAttributes > xStyle;
1883 0 : OUString aStyleId( _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, "style-id" ) );
1884 0 : if (!aStyleId.isEmpty())
1885 : {
1886 0 : _pImport->addStyle( aStyleId, this );
1887 : }
1888 : else
1889 : {
1890 0 : throw xml::sax::SAXException( "missing style-id attribute!", Reference< XInterface >(), Any() );
1891 0 : }
1892 0 : }
1893 :
1894 : //##################################################################################################
1895 :
1896 : // styles
1897 : //__________________________________________________________________________________________________
1898 0 : Reference< xml::input::XElement > StylesElement::startChildElement(
1899 : sal_Int32 nUid, OUString const & rLocalName,
1900 : Reference< xml::input::XAttributes > const & xAttributes )
1901 : throw (xml::sax::SAXException, RuntimeException)
1902 : {
1903 0 : if (_pImport->XMLNS_DIALOGS_UID != nUid)
1904 : {
1905 0 : throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() );
1906 : }
1907 : // style
1908 0 : else if ( rLocalName == "style" )
1909 : {
1910 0 : return new StyleElement( rLocalName, xAttributes, this, _pImport );
1911 : }
1912 : else
1913 : {
1914 0 : throw xml::sax::SAXException( "expected style element!", Reference< XInterface >(), Any() );
1915 : }
1916 : }
1917 :
1918 : //##################################################################################################
1919 :
1920 : // window
1921 : //__________________________________________________________________________________________________
1922 0 : Reference< xml::input::XElement > WindowElement::startChildElement(
1923 : sal_Int32 nUid, OUString const & rLocalName,
1924 : Reference< xml::input::XAttributes > const & xAttributes )
1925 : throw (xml::sax::SAXException, RuntimeException)
1926 : {
1927 : // event
1928 0 : if (_pImport->isEventElement( nUid, rLocalName ))
1929 : {
1930 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1931 : }
1932 0 : else if (_pImport->XMLNS_DIALOGS_UID != nUid)
1933 : {
1934 0 : throw xml::sax::SAXException( "illegal namespace!", Reference< XInterface >(), Any() );
1935 : }
1936 : // styles
1937 0 : else if ( rLocalName == "styles" )
1938 : {
1939 0 : return new StylesElement( rLocalName, xAttributes, this, _pImport );
1940 : }
1941 : // bulletinboard
1942 0 : else if ( rLocalName == "bulletinboard" )
1943 : {
1944 0 : return new BulletinBoardElement( rLocalName, xAttributes, this, _pImport );
1945 : }
1946 : else
1947 : {
1948 0 : throw xml::sax::SAXException( "expected styles ot bulletinboard element!", Reference< XInterface >(), Any() );
1949 : }
1950 : }
1951 : //__________________________________________________________________________________________________
1952 0 : void WindowElement::endElement()
1953 : throw (xml::sax::SAXException, RuntimeException)
1954 : {
1955 : Reference< beans::XPropertySet > xProps(
1956 0 : _pImport->_xDialogModel, UNO_QUERY_THROW );
1957 0 : ImportContext ctx( _pImport, xProps, getControlId( _xAttributes ) );
1958 :
1959 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1960 0 : if (xStyle.is())
1961 : {
1962 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1963 0 : pStyle->importBackgroundColorStyle( xProps );
1964 0 : pStyle->importTextColorStyle( xProps );
1965 0 : pStyle->importTextLineColorStyle( xProps );
1966 0 : pStyle->importFontStyle( xProps );
1967 : }
1968 :
1969 0 : ctx.importDefaults( 0, 0, _xAttributes, false );
1970 0 : ctx.importBooleanProperty( "Closeable", "closeable", _xAttributes );
1971 0 : ctx.importBooleanProperty( "Moveable", "moveable", _xAttributes );
1972 0 : ctx.importBooleanProperty("Sizeable", "resizeable", _xAttributes );
1973 0 : ctx.importStringProperty("Title", "title", _xAttributes );
1974 0 : ctx.importBooleanProperty("Decoration", "withtitlebar", _xAttributes );
1975 0 : ctx.importImageURLProperty( "ImageURL" , "image-src" , _xAttributes );
1976 0 : ctx.importScollableSettings( _xAttributes );
1977 0 : ctx.importEvents( _events );
1978 : // avoid ring-reference:
1979 : // vector< event elements > holding event elements holding this (via _pParent)
1980 0 : _events.clear();
1981 0 : }
1982 :
1983 : }
1984 :
1985 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|