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