Branch data 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( rtl::OUString( "com.sun.star.awt.UnoFrameModel" ) ), UNO_QUERY );
49 : : // event
50 [ # # ]: 0 : if (_pImport->isEventElement( nUid, rLocalName ))
51 : : {
52 : : return new EventElement(
53 [ # # ][ # # ]: 0 : nUid, rLocalName, xAttributes, this, _pImport );
54 : : }
55 [ # # ]: 0 : else if ( rLocalName == "bulletinboard" )
56 : : {
57 : : // Create new DialogImport for this container
58 [ # # ]: 0 : DialogImport* pFrameImport = new DialogImport( *_pImport );
59 : 0 : pFrameImport->_xDialogModel = m_xContainer;
60 [ # # ][ # # ]: 0 : return new BulletinBoardElement( rLocalName, xAttributes, this, pFrameImport );
61 : : }
62 [ # # ]: 0 : else if ( rLocalName == "title" )
63 : : {
64 : : getStringAttr( &_label,
65 : : OUString( "value" ),
66 : : xAttributes,
67 [ # # ]: 0 : _pImport->XMLNS_DIALOGS_UID );
68 : :
69 : : return new ElementBase(
70 : : _pImport->XMLNS_DIALOGS_UID,
71 [ # # ][ # # ]: 0 : rLocalName, xAttributes, this, _pImport );
72 : : }
73 : : else
74 : : {
75 : : OSL_TRACE("****** ARGGGGG!!!! **********");
76 : : throw xml::sax::SAXException(
77 : : OUString( "expected event element!" ),
78 [ # # ]: 0 : Reference< XInterface >(), Any() );
79 : : }
80 : : }
81 : : //__________________________________________________________________________________________________
82 : :
83 : 0 : void Frame::endElement()
84 : : throw (xml::sax::SAXException, RuntimeException)
85 : : {
86 [ # # ]: 0 : if ( !m_xContainer.is() )
87 [ # # ][ # # ]: 0 : m_xContainer.set( _pImport->_xDialogModelFactory->createInstance( rtl::OUString( "com.sun.star.awt.UnoFrameModel" ) ), UNO_QUERY );
[ # # ]
88 [ # # ]: 0 : Reference< beans::XPropertySet > xProps( m_xContainer, UNO_QUERY_THROW );
89 : : // _pImport is what we need to add to ( e.g. the dialog in this case )
90 [ # # ][ # # ]: 0 : ControlImportContext ctx( _pImport, xProps, getControlId( _xAttributes ) );
91 : :
92 [ # # ]: 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
93 : :
94 [ # # ]: 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
95 [ # # ]: 0 : if (xStyle.is())
96 : : {
97 [ # # ][ # # ]: 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
98 [ # # ]: 0 : pStyle->importTextColorStyle( xControlModel );
99 [ # # ]: 0 : pStyle->importTextLineColorStyle( xControlModel );
100 [ # # ]: 0 : pStyle->importFontStyle( xControlModel );
101 : : }
102 : :
103 [ # # ]: 0 : ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
104 [ # # ]: 0 : if (!_label.isEmpty())
105 : : {
106 [ # # ]: 0 : xControlModel->setPropertyValue( OUString( "Label" ),
107 [ # # ][ # # ]: 0 : makeAny( _label ) );
108 : : }
109 [ # # ]: 0 : ctx.importEvents( _events );
110 : : // avoid ring-reference:
111 : : // vector< event elements > holding event elements holding this (via _pParent)
112 [ # # ]: 0 : _events.clear();
113 : 0 : }
114 : :
115 : : //===
116 : 0 : Reference< xml::input::XElement > MultiPage::startChildElement(
117 : : sal_Int32 nUid, OUString const & rLocalName,
118 : : Reference< xml::input::XAttributes > const & xAttributes )
119 : : throw (xml::sax::SAXException, RuntimeException)
120 : : {
121 : : // event
122 [ # # ]: 0 : if (_pImport->isEventElement( nUid, rLocalName ))
123 : : {
124 : : return new EventElement(
125 [ # # ][ # # ]: 0 : nUid, rLocalName, xAttributes, this, _pImport );
126 : : }
127 [ # # ]: 0 : else if ( rLocalName == "bulletinboard" )
128 : : {
129 : : // Create new DialogImport for this container
130 : :
131 [ # # ]: 0 : DialogImport* pMultiPageImport = new DialogImport( *_pImport );
132 : 0 : pMultiPageImport->_xDialogModel = m_xContainer;
133 [ # # ][ # # ]: 0 : return new BulletinBoardElement( rLocalName, xAttributes, this, pMultiPageImport );
134 : : }
135 : : else
136 : : {
137 : :
138 : : throw xml::sax::SAXException(
139 : : OUString( "expected event element!" ),
140 [ # # ]: 0 : Reference< XInterface >(), Any() );
141 : : }
142 : : }
143 : : //__________________________________________________________________________________________________
144 : :
145 : 0 : void MultiPage::endElement()
146 : : throw (xml::sax::SAXException, RuntimeException)
147 : : {
148 [ # # ]: 0 : Reference< beans::XPropertySet > xProps( m_xContainer, UNO_QUERY_THROW );
149 : : // _pImport is what we need to add to ( e.g. the dialog in this case )
150 [ # # ][ # # ]: 0 : ControlImportContext ctx( _pImport, xProps, getControlId( _xAttributes ));
151 : :
152 [ # # ]: 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
153 : :
154 [ # # ]: 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
155 [ # # ]: 0 : if (xStyle.is())
156 : : {
157 [ # # ][ # # ]: 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
158 [ # # ]: 0 : pStyle->importTextColorStyle( xControlModel );
159 [ # # ]: 0 : pStyle->importTextLineColorStyle( xControlModel );
160 [ # # ]: 0 : pStyle->importFontStyle( xControlModel );
161 [ # # ]: 0 : pStyle->importBackgroundColorStyle( xControlModel );
162 : : }
163 : :
164 [ # # ]: 0 : ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
165 : : ctx.importLongProperty( OUString( "MultiPageValue" ),
166 : : OUString( "value" ),
167 [ # # ]: 0 : _xAttributes );
168 : : ctx.importBooleanProperty(
169 : : OUString( "Decoration" ),
170 : : OUString( "withtabs" ),
171 [ # # ]: 0 : _xAttributes );
172 [ # # ]: 0 : ctx.importEvents( _events );
173 : : // avoid ring-reference:
174 : : // vector< event elements > holding event elements holding this (via _pParent)
175 [ # # ]: 0 : _events.clear();
176 : 0 : }
177 : :
178 : 0 : Reference< xml::input::XElement > Page::startChildElement(
179 : : sal_Int32 nUid, OUString const & rLocalName,
180 : : Reference< xml::input::XAttributes > const & xAttributes )
181 : : throw (xml::sax::SAXException, RuntimeException)
182 : : {
183 : : // event
184 [ # # ]: 0 : if (_pImport->isEventElement( nUid, rLocalName ))
185 : : {
186 : : return new EventElement(
187 [ # # ][ # # ]: 0 : nUid, rLocalName, xAttributes, this, _pImport );
188 : : }
189 [ # # ]: 0 : else if ( rLocalName == "bulletinboard" )
190 : : {
191 : :
192 [ # # ]: 0 : DialogImport* pPageImport = new DialogImport( *_pImport );
193 : 0 : pPageImport->_xDialogModel = m_xContainer;
194 [ # # ][ # # ]: 0 : return new BulletinBoardElement( rLocalName, xAttributes, this, pPageImport );
195 : : }
196 : : else
197 : : {
198 : :
199 : : throw xml::sax::SAXException(
200 : : OUString( "expected event element!" ),
201 [ # # ]: 0 : Reference< XInterface >(), Any() );
202 : : }
203 : : }
204 : : //__________________________________________________________________________________________________
205 : :
206 : 0 : void Page::endElement()
207 : : throw (xml::sax::SAXException, RuntimeException)
208 : : {
209 [ # # ]: 0 : Reference< beans::XPropertySet > xProps( m_xContainer, UNO_QUERY_THROW );
210 : :
211 [ # # ][ # # ]: 0 : ControlImportContext ctx( _pImport, xProps, getControlId( _xAttributes ));
212 : :
213 [ # # ]: 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
214 : :
215 [ # # ]: 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
216 [ # # ]: 0 : if (xStyle.is())
217 : : {
218 [ # # ][ # # ]: 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
219 [ # # ]: 0 : pStyle->importTextColorStyle( xControlModel );
220 [ # # ]: 0 : pStyle->importTextLineColorStyle( xControlModel );
221 [ # # ]: 0 : pStyle->importFontStyle( xControlModel );
222 [ # # ]: 0 : pStyle->importBackgroundColorStyle( xControlModel );
223 : : }
224 : :
225 [ # # ]: 0 : ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
226 [ # # ]: 0 : ctx.importStringProperty( OUString( "Title" ), OUString( "title" ), _xAttributes );
227 [ # # ]: 0 : ctx.importEvents( _events );
228 : : // avoid ring-reference:
229 : : // vector< event elements > holding event elements holding this (via _pParent)
230 [ # # ]: 0 : _events.clear();
231 : 0 : }
232 : :
233 : : // progessmeter
234 : : //__________________________________________________________________________________________________
235 : 0 : Reference< xml::input::XElement > ProgressBarElement::startChildElement(
236 : : sal_Int32 nUid, OUString const & rLocalName,
237 : : Reference< xml::input::XAttributes > const & xAttributes )
238 : : throw (xml::sax::SAXException, RuntimeException)
239 : : {
240 : : // event
241 [ # # ]: 0 : if (_pImport->isEventElement( nUid, rLocalName ))
242 : : {
243 : : return new EventElement(
244 [ # # ][ # # ]: 0 : nUid, rLocalName, xAttributes, this, _pImport );
245 : : }
246 : : else
247 : : {
248 : : throw xml::sax::SAXException(
249 : : OUString( "expected event element!" ),
250 [ # # ]: 0 : Reference< XInterface >(), Any() );
251 : : }
252 : : }
253 : : //__________________________________________________________________________________________________
254 : 0 : void ProgressBarElement::endElement()
255 : : throw (xml::sax::SAXException, RuntimeException)
256 : : {
257 : : ControlImportContext ctx(
258 : : _pImport, getControlId( _xAttributes ),
259 [ # # ][ # # ]: 0 : OUString( "com.sun.star.awt.UnoControlProgressBarModel" ) );
260 : :
261 [ # # ]: 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
262 [ # # ]: 0 : if (xStyle.is())
263 : : {
264 [ # # ][ # # ]: 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
265 [ # # ]: 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
266 [ # # ]: 0 : pStyle->importBackgroundColorStyle( xControlModel );
267 [ # # ]: 0 : pStyle->importBorderStyle( xControlModel );
268 [ # # ]: 0 : pStyle->importFillColorStyle( xControlModel );
269 : : }
270 : :
271 [ # # ]: 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
272 : : ctx.importLongProperty( OUString( "ProgressValue" ),
273 : : OUString( "value" ),
274 [ # # ]: 0 : _xAttributes );
275 : : ctx.importLongProperty( OUString( "ProgressValueMin" ),
276 : : OUString( "value-min" ),
277 [ # # ]: 0 : _xAttributes );
278 : : ctx.importLongProperty( OUString( "ProgressValueMax" ),
279 : : OUString( "value-max" ),
280 [ # # ]: 0 : _xAttributes );
281 [ # # ]: 0 : ctx.importEvents( _events );
282 : : // avoid ring-reference:
283 : : // vector< event elements > holding event elements holding this (via _pParent)
284 [ # # ]: 0 : _events.clear();
285 : 0 : }
286 : :
287 : : //##################################################################################################
288 : :
289 : : // scrollbar
290 : : //__________________________________________________________________________________________________
291 : 0 : Reference< xml::input::XElement > ScrollBarElement::startChildElement(
292 : : sal_Int32 nUid, OUString const & rLocalName,
293 : : Reference< xml::input::XAttributes > const & xAttributes )
294 : : throw (xml::sax::SAXException, RuntimeException)
295 : : {
296 : : // event
297 [ # # ]: 0 : if (_pImport->isEventElement( nUid, rLocalName ))
298 : : {
299 [ # # ][ # # ]: 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
300 : : }
301 : : else
302 : : {
303 : : throw xml::sax::SAXException(
304 : : OUString( "expected event element!" ),
305 [ # # ]: 0 : Reference< XInterface >(), Any() );
306 : : }
307 : : }
308 : : //__________________________________________________________________________________________________
309 : 0 : void ScrollBarElement::endElement()
310 : : throw (xml::sax::SAXException, RuntimeException)
311 : : {
312 : : ControlImportContext ctx(
313 : : _pImport, getControlId( _xAttributes ),
314 [ # # ][ # # ]: 0 : getControlModelName( OUString( "com.sun.star.awt.UnoControlScrollBarModel" ), _xAttributes ) );
[ # # ]
315 : :
316 [ # # ]: 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
317 [ # # ]: 0 : if (xStyle.is())
318 : : {
319 [ # # ][ # # ]: 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
320 [ # # ]: 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
321 [ # # ]: 0 : pStyle->importBackgroundColorStyle( xControlModel );
322 [ # # ]: 0 : pStyle->importBorderStyle( xControlModel );
323 : : }
324 : :
325 [ # # ]: 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
326 : : ctx.importOrientationProperty( OUString( "Orientation" ),
327 : : OUString( "align" ),
328 [ # # ]: 0 : _xAttributes );
329 : : ctx.importLongProperty( OUString( "BlockIncrement" ),
330 : : OUString( "pageincrement" ),
331 [ # # ]: 0 : _xAttributes );
332 : : ctx.importLongProperty( OUString( "LineIncrement" ),
333 : : OUString( "increment" ),
334 [ # # ]: 0 : _xAttributes );
335 : : ctx.importLongProperty( OUString( "ScrollValue" ),
336 : : OUString( "curpos" ),
337 [ # # ]: 0 : _xAttributes );
338 : : ctx.importLongProperty( OUString( "ScrollValueMax" ),
339 : : OUString( "maxpos" ),
340 [ # # ]: 0 : _xAttributes );
341 : : ctx.importLongProperty( OUSTR("ScrollValueMin"), OUSTR("minpos"),
342 [ # # ][ # # ]: 0 : _xAttributes );
[ # # ]
343 : : ctx.importLongProperty( OUString( "VisibleSize" ),
344 : : OUString( "visible-size" ),
345 [ # # ]: 0 : _xAttributes );
346 : : ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
347 [ # # ][ # # ]: 0 : _xAttributes );
[ # # ]
348 : : ctx.importBooleanProperty( OUString( "Tabstop" ),
349 : : OUString( "tabstop" ),
350 [ # # ]: 0 : _xAttributes );
351 : : ctx.importBooleanProperty( OUString( "LiveScroll" ),
352 : : OUString( "live-scroll" ),
353 [ # # ]: 0 : _xAttributes );
354 : : ctx.importHexLongProperty( OUString( "SymbolColor" ),
355 : : OUString( "symbol-color" ),
356 [ # # ]: 0 : _xAttributes );
357 : :
358 [ # # ][ # # ]: 0 : ctx.importDataAwareProperty( OUSTR("linked-cell" ), _xAttributes );
359 [ # # ]: 0 : ctx.importEvents( _events );
360 : : // avoid ring-reference:
361 : : // vector< event elements > holding event elements holding this (via _pParent)
362 [ # # ]: 0 : _events.clear();
363 : 0 : }
364 : :
365 : : //##################################################################################################
366 : :
367 : : // spinbutton
368 : : //__________________________________________________________________________________________________
369 : 0 : Reference< xml::input::XElement > SpinButtonElement::startChildElement(
370 : : sal_Int32 nUid, OUString const & rLocalName,
371 : : Reference< xml::input::XAttributes > const & xAttributes )
372 : : throw (xml::sax::SAXException, RuntimeException)
373 : : {
374 : : // event
375 [ # # ]: 0 : if (_pImport->isEventElement( nUid, rLocalName ))
376 : : {
377 [ # # ][ # # ]: 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
378 : : }
379 : : else
380 : : {
381 : : throw xml::sax::SAXException(
382 : : OUString( "expected event element!" ),
383 [ # # ]: 0 : Reference< XInterface >(), Any() );
384 : : }
385 : : }
386 : : //__________________________________________________________________________________________________
387 : 0 : void SpinButtonElement::endElement()
388 : : throw (xml::sax::SAXException, RuntimeException)
389 : : {
390 : : ControlImportContext ctx(
391 : : _pImport, getControlId( _xAttributes ),
392 [ # # ][ # # ]: 0 : getControlModelName( OUString( "com.sun.star.awt.UnoControlSpinButtonModel" ), _xAttributes ) );
[ # # ]
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->importBackgroundColorStyle( xControlModel );
400 [ # # ]: 0 : pStyle->importBorderStyle( xControlModel );
401 : : }
402 : :
403 [ # # ]: 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
404 : : ctx.importOrientationProperty( OUString( "Orientation" ),
405 : : OUString( "align" ),
406 [ # # ]: 0 : _xAttributes );
407 : : ctx.importLongProperty( OUString( "SpinIncrement" ),
408 : : OUString( "increment" ),
409 [ # # ]: 0 : _xAttributes );
410 : : ctx.importLongProperty( OUString( "SpinValue" ),
411 [ # # ]: 0 : OUString( "curval" ),_xAttributes );
412 : : ctx.importLongProperty( OUString( "SpinValueMax" ),
413 [ # # ]: 0 : OUString( "maxval" ), _xAttributes );
414 : : ctx.importLongProperty( OUSTR("SpinValueMin"), OUSTR("minval"),
415 [ # # ][ # # ]: 0 : _xAttributes );
[ # # ]
416 [ # # ][ # # ]: 0 : ctx.importLongProperty( OUSTR("Repeat"), OUSTR("repeat"), _xAttributes );
[ # # ]
417 : : ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat-delay"),
418 [ # # ][ # # ]: 0 : _xAttributes );
[ # # ]
419 : : ctx.importBooleanProperty( OUString( "Tabstop" ),
420 [ # # ]: 0 : OUString( "tabstop" ), _xAttributes );
421 : : ctx.importHexLongProperty( OUString( "SymbolColor" ),
422 [ # # ]: 0 : OUString( "symbol-color" ), _xAttributes );
423 [ # # ][ # # ]: 0 : ctx.importDataAwareProperty( OUSTR("linked-cell" ), _xAttributes );
424 [ # # ]: 0 : ctx.importEvents( _events );
425 : : // avoid ring-reference:
426 : : // vector< event elements > holding event elements holding this (via _pParent)
427 [ # # ]: 0 : _events.clear();
428 : 0 : }
429 : :
430 : : //##################################################################################################
431 : :
432 : : // fixedline
433 : : //__________________________________________________________________________________________________
434 : 0 : Reference< xml::input::XElement > FixedLineElement::startChildElement(
435 : : sal_Int32 nUid, OUString const & rLocalName,
436 : : Reference< xml::input::XAttributes > const & xAttributes )
437 : : throw (xml::sax::SAXException, RuntimeException)
438 : : {
439 : : // event
440 [ # # ]: 0 : if (_pImport->isEventElement( nUid, rLocalName ))
441 : : {
442 [ # # ][ # # ]: 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
443 : : }
444 : : else
445 : : {
446 : : throw xml::sax::SAXException(
447 : : OUString( "expected event element!" ),
448 [ # # ]: 0 : Reference< XInterface >(), Any() );
449 : : }
450 : : }
451 : : //__________________________________________________________________________________________________
452 : 0 : void FixedLineElement::endElement()
453 : : throw (xml::sax::SAXException, RuntimeException)
454 : : {
455 : : ControlImportContext ctx(
456 : : _pImport, getControlId( _xAttributes ),
457 [ # # ][ # # ]: 0 : OUString( "com.sun.star.awt.UnoControlFixedLineModel" ) );
458 : :
459 [ # # ]: 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
460 [ # # ]: 0 : if (xStyle.is())
461 : : {
462 [ # # ][ # # ]: 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
463 [ # # ]: 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
464 [ # # ]: 0 : pStyle->importTextColorStyle( xControlModel );
465 [ # # ]: 0 : pStyle->importTextLineColorStyle( xControlModel );
466 [ # # ]: 0 : pStyle->importFontStyle( xControlModel );
467 : : }
468 : :
469 [ # # ]: 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
470 : : ctx.importStringProperty( OUString( "Label" ),
471 : : OUString( "value" ),
472 [ # # ]: 0 : _xAttributes );
473 : : ctx.importOrientationProperty( OUString( "Orientation" ),
474 : : OUString( "align" ),
475 [ # # ]: 0 : _xAttributes );
476 [ # # ]: 0 : ctx.importEvents( _events );
477 : : // avoid ring-reference:
478 : : // vector< event elements > holding event elements holding this (via _pParent)
479 [ # # ]: 0 : _events.clear();
480 : 0 : }
481 : :
482 : : //##################################################################################################
483 : :
484 : : // patternfield
485 : : //__________________________________________________________________________________________________
486 : 0 : Reference< xml::input::XElement > PatternFieldElement::startChildElement(
487 : : sal_Int32 nUid, OUString const & rLocalName,
488 : : Reference< xml::input::XAttributes > const & xAttributes )
489 : : throw (xml::sax::SAXException, RuntimeException)
490 : : {
491 : : // event
492 [ # # ]: 0 : if (_pImport->isEventElement( nUid, rLocalName ))
493 : : {
494 [ # # ][ # # ]: 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
495 : : }
496 : : else
497 : : {
498 : : throw xml::sax::SAXException(
499 : : OUString( "expected event element!" ),
500 [ # # ]: 0 : Reference< XInterface >(), Any() );
501 : : }
502 : : }
503 : : //__________________________________________________________________________________________________
504 : 0 : void PatternFieldElement::endElement()
505 : : throw (xml::sax::SAXException, RuntimeException)
506 : : {
507 : : ControlImportContext ctx(
508 : : _pImport, getControlId( _xAttributes ),
509 [ # # ][ # # ]: 0 : OUString( "com.sun.star.awt.UnoControlPatternFieldModel" ) );
510 : :
511 [ # # ]: 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
512 [ # # ]: 0 : if (xStyle.is())
513 : : {
514 [ # # ][ # # ]: 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
515 [ # # ]: 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
516 [ # # ]: 0 : pStyle->importBackgroundColorStyle( xControlModel );
517 [ # # ]: 0 : pStyle->importTextColorStyle( xControlModel );
518 [ # # ]: 0 : pStyle->importTextLineColorStyle( xControlModel );
519 [ # # ]: 0 : pStyle->importBorderStyle( xControlModel );
520 [ # # ]: 0 : pStyle->importFontStyle( xControlModel );
521 : : }
522 : :
523 [ # # ]: 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
524 : : ctx.importBooleanProperty( OUString( "Tabstop" ),
525 : : OUString( "tabstop" ),
526 [ # # ]: 0 : _xAttributes );
527 : : ctx.importBooleanProperty( OUString( "ReadOnly" ),
528 : : OUString( "readonly" ),
529 [ # # ]: 0 : _xAttributes );
530 : : ctx.importBooleanProperty( OUString( "StrictFormat" ),
531 : : OUString( "strict-format" ),
532 [ # # ]: 0 : _xAttributes );
533 : : ctx.importBooleanProperty(
534 : : OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
535 [ # # ][ # # ]: 0 : _xAttributes );
[ # # ]
536 : : ctx.importStringProperty( OUString( "Text" ),
537 : : OUString( "value" ),
538 [ # # ]: 0 : _xAttributes );
539 : : ctx.importShortProperty( OUString( "MaxTextLen" ),
540 : : OUString( "maxlength" ),
541 [ # # ]: 0 : _xAttributes );
542 : : ctx.importStringProperty( OUString( "EditMask" ),
543 : : OUString( "edit-mask" ),
544 [ # # ]: 0 : _xAttributes );
545 : : ctx.importStringProperty( OUString( "LiteralMask" ),
546 : : OUString( "literal-mask" ),
547 [ # # ]: 0 : _xAttributes );
548 [ # # ]: 0 : ctx.importEvents( _events );
549 : : // avoid ring-reference:
550 : : // vector< event elements > holding event elements holding this (via _pParent)
551 [ # # ]: 0 : _events.clear();
552 : 0 : }
553 : :
554 : : //##################################################################################################
555 : :
556 : : // formattedfield
557 : : //__________________________________________________________________________________________________
558 : 0 : Reference< xml::input::XElement > FormattedFieldElement::startChildElement(
559 : : sal_Int32 nUid, OUString const & rLocalName,
560 : : Reference< xml::input::XAttributes > const & xAttributes )
561 : : throw (xml::sax::SAXException, RuntimeException)
562 : : {
563 : : // event
564 [ # # ]: 0 : if (_pImport->isEventElement( nUid, rLocalName ))
565 : : {
566 [ # # ][ # # ]: 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
567 : : }
568 : : else
569 : : {
570 : : throw xml::sax::SAXException(
571 : : OUString( "expected event element!" ),
572 [ # # ]: 0 : Reference< XInterface >(), Any() );
573 : : }
574 : : }
575 : : //__________________________________________________________________________________________________
576 : 0 : void FormattedFieldElement::endElement()
577 : : throw (xml::sax::SAXException, RuntimeException)
578 : : {
579 : : ControlImportContext ctx(
580 : : _pImport, getControlId( _xAttributes ),
581 [ # # ][ # # ]: 0 : OUString( "com.sun.star.awt.UnoControlFormattedFieldModel" ) );
582 : :
583 [ # # ]: 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
584 [ # # ]: 0 : if (xStyle.is())
585 : : {
586 [ # # ][ # # ]: 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
587 [ # # ]: 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
588 [ # # ]: 0 : pStyle->importBackgroundColorStyle( xControlModel );
589 [ # # ]: 0 : pStyle->importTextColorStyle( xControlModel );
590 [ # # ]: 0 : pStyle->importTextLineColorStyle( xControlModel );
591 [ # # ]: 0 : pStyle->importBorderStyle( xControlModel );
592 [ # # ]: 0 : pStyle->importFontStyle( xControlModel );
593 : : }
594 : :
595 [ # # ]: 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
596 : : ctx.importBooleanProperty( OUString( "Tabstop" ),
597 : : OUString( "tabstop" ),
598 [ # # ]: 0 : _xAttributes );
599 : : ctx.importBooleanProperty( OUString( "ReadOnly" ),
600 : : OUString( "readonly" ),
601 [ # # ]: 0 : _xAttributes );
602 : : ctx.importBooleanProperty( OUString( "StrictFormat" ),
603 : : OUString( "strict-format" ),
604 [ # # ]: 0 : _xAttributes );
605 : : ctx.importBooleanProperty(
606 : : OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
607 [ # # ][ # # ]: 0 : _xAttributes );
[ # # ]
608 : : ctx.importAlignProperty( OUString( "Align" ),
609 : : OUString( "align" ),
610 [ # # ]: 0 : _xAttributes );
611 : : ctx.importDoubleProperty( OUString( "EffectiveMin" ),
612 : : OUString( "value-min" ),
613 [ # # ]: 0 : _xAttributes );
614 : : ctx.importDoubleProperty( OUString( "EffectiveMax" ),
615 : : OUString( "value-max" ),
616 [ # # ]: 0 : _xAttributes );
617 : : ctx.importDoubleProperty( OUString( "EffectiveValue" ),
618 : : OUString( "value" ),
619 [ # # ]: 0 : _xAttributes );
620 : : ctx.importStringProperty( OUString( "Text" ),
621 : : OUString( "text" ),
622 [ # # ]: 0 : _xAttributes );
623 : : ctx.importShortProperty( OUString( "MaxTextLen" ),
624 : : OUString( "maxlength" ),
625 [ # # ]: 0 : _xAttributes );
626 : : ctx.importBooleanProperty( OUString( "Spin" ),
627 : : OUString( "spin" ),
628 [ # # ]: 0 : _xAttributes );
629 [ # # # # ]: 0 : if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
630 [ # # ][ # # ]: 0 : _xAttributes ))
631 [ # # ][ # # ]: 0 : ctx.getControlModel()->setPropertyValue(
632 [ # # ][ # # ]: 0 : OUSTR("Repeat"), makeAny(true) );
[ # # ]
633 : :
634 : : OUString sDefault(
635 [ # # ]: 0 : _xAttributes->getValueByUidName(
636 : : _pImport->XMLNS_DIALOGS_UID,
637 [ # # ]: 0 : OUString( "value-default" ) ) );
638 [ # # ]: 0 : if (!sDefault.isEmpty())
639 : : {
640 : 0 : double d = sDefault.toDouble();
641 [ # # ][ # # : 0 : if (d != 0.0 ||
# # # # ]
642 : 0 : sDefault.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("0") ) ||
643 : 0 : sDefault.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("0.0") ))
644 : : {
645 [ # # ][ # # ]: 0 : ctx.getControlModel()->setPropertyValue(
646 : : OUString( "EffectiveDefault" ),
647 [ # # ][ # # ]: 0 : makeAny( d ) );
648 : : }
649 : : else // treat as string
650 : : {
651 [ # # ][ # # ]: 0 : ctx.getControlModel()->setPropertyValue(
652 : : OUString( "EffectiveDefault" ),
653 [ # # ][ # # ]: 0 : makeAny( sDefault ) );
654 : : }
655 : : }
656 : :
657 : : // format spec
658 [ # # ][ # # ]: 0 : ctx.getControlModel()->setPropertyValue(
659 : : OUString( "FormatsSupplier" ),
660 [ # # ][ # # ]: 0 : makeAny( _pImport->getNumberFormatsSupplier() ) );
[ # # ]
661 : :
662 : : OUString sFormat(
663 [ # # ]: 0 : _xAttributes->getValueByUidName(
664 : : _pImport->XMLNS_DIALOGS_UID,
665 [ # # ]: 0 : OUString( "format-code" ) ) );
666 [ # # ]: 0 : if (!sFormat.isEmpty())
667 : : {
668 : 0 : lang::Locale locale;
669 : :
670 : : OUString sLocale(
671 [ # # ]: 0 : _xAttributes->getValueByUidName(
672 : : _pImport->XMLNS_DIALOGS_UID,
673 [ # # ]: 0 : OUString( "format-locale" ) ) );
674 [ # # ]: 0 : if (!sLocale.isEmpty())
675 : : {
676 : : // split locale
677 : 0 : sal_Int32 semi0 = sLocale.indexOf( ';' );
678 [ # # ]: 0 : if (semi0 < 0) // no semi at all, just try language
679 : : {
680 : 0 : locale.Language = sLocale;
681 : : }
682 : : else
683 : : {
684 : 0 : sal_Int32 semi1 = sLocale.indexOf( ';', semi0 +1 );
685 [ # # ]: 0 : if (semi1 > semi0) // language;country;variant
686 : : {
687 : 0 : locale.Language = sLocale.copy( 0, semi0 );
688 : 0 : locale.Country = sLocale.copy( semi0 +1, semi1 - semi0 -1 );
689 : 0 : locale.Variant = sLocale.copy( semi1 +1 );
690 : : }
691 : : else // try language;country
692 : : {
693 : 0 : locale.Language = sLocale.copy( 0, semi0 );
694 : 0 : locale.Country = sLocale.copy( semi0 +1 );
695 : : }
696 : : }
697 : : }
698 : :
699 : : try
700 : : {
701 : : Reference< util::XNumberFormats > xFormats(
702 [ # # ][ # # ]: 0 : _pImport->getNumberFormatsSupplier()->getNumberFormats() );
[ # # ]
703 [ # # ][ # # ]: 0 : sal_Int32 nKey = xFormats->queryKey( sFormat, locale, sal_True );
704 [ # # ]: 0 : if (-1 == nKey)
705 : : {
706 [ # # ][ # # ]: 0 : nKey = xFormats->addNew( sFormat, locale );
707 : : }
708 [ # # ][ # # ]: 0 : ctx.getControlModel()->setPropertyValue(
709 [ # # ][ # # ]: 0 : OUString( "FormatKey" ), makeAny( nKey ) );
710 : : }
711 [ # # ]: 0 : catch (const util::MalformedNumberFormatException & exc)
712 : : {
713 : : OSL_FAIL( "### util::MalformedNumberFormatException occurred!" );
714 : : // rethrow
715 [ # # ]: 0 : throw xml::sax::SAXException( exc.Message, Reference< XInterface >(), Any() );
716 : 0 : }
717 : : }
718 : : ctx.importBooleanProperty(
719 : : OUString( "TreatAsNumber" ),
720 : : OUString( "treat-as-number" ),
721 [ # # ]: 0 : _xAttributes );
722 : : ctx.importBooleanProperty( OUString( "EnforceFormat" ),
723 : : OUString( "enforce-format" ),
724 [ # # ]: 0 : _xAttributes );
725 : :
726 [ # # ][ # # ]: 0 : ctx.importDataAwareProperty( OUSTR("linked-cell" ), _xAttributes );
727 [ # # ]: 0 : ctx.importEvents( _events );
728 : : // avoid ring-reference:
729 : : // vector< event elements > holding event elements holding this (via _pParent)
730 [ # # ]: 0 : _events.clear();
731 : 0 : }
732 : :
733 : : //##################################################################################################
734 : :
735 : : // timefield
736 : : //__________________________________________________________________________________________________
737 : 0 : Reference< xml::input::XElement > TimeFieldElement::startChildElement(
738 : : sal_Int32 nUid, OUString const & rLocalName,
739 : : Reference< xml::input::XAttributes > const & xAttributes )
740 : : throw (xml::sax::SAXException, RuntimeException)
741 : : {
742 : : // event
743 [ # # ]: 0 : if (_pImport->isEventElement( nUid, rLocalName ))
744 : : {
745 [ # # ][ # # ]: 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
746 : : }
747 : : else
748 : : {
749 : : throw xml::sax::SAXException(
750 : : OUString( "expected event element!" ),
751 [ # # ]: 0 : Reference< XInterface >(), Any() );
752 : : }
753 : : }
754 : : //__________________________________________________________________________________________________
755 : 0 : void TimeFieldElement::endElement()
756 : : throw (xml::sax::SAXException, RuntimeException)
757 : : {
758 : : ControlImportContext ctx(
759 : : _pImport, getControlId( _xAttributes ),
760 [ # # ][ # # ]: 0 : OUString( "com.sun.star.awt.UnoControlTimeFieldModel" ) );
761 : :
762 [ # # ]: 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
763 [ # # ]: 0 : if (xStyle.is())
764 : : {
765 [ # # ][ # # ]: 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
766 [ # # ]: 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
767 [ # # ]: 0 : pStyle->importBackgroundColorStyle( xControlModel );
768 [ # # ]: 0 : pStyle->importTextColorStyle( xControlModel );
769 [ # # ]: 0 : pStyle->importTextLineColorStyle( xControlModel );
770 [ # # ]: 0 : pStyle->importBorderStyle( xControlModel );
771 [ # # ]: 0 : pStyle->importFontStyle( xControlModel );
772 : : }
773 : :
774 [ # # ]: 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
775 : : ctx.importBooleanProperty( OUString( "Tabstop" ),
776 : : OUString( "tabstop" ),
777 [ # # ]: 0 : _xAttributes );
778 : : ctx.importBooleanProperty( OUString( "ReadOnly" ),
779 : : OUString( "readonly" ),
780 [ # # ]: 0 : _xAttributes );
781 : : ctx.importBooleanProperty( OUString( "StrictFormat" ),
782 : : OUString( "strict-format" ),
783 [ # # ]: 0 : _xAttributes );
784 : : ctx.importBooleanProperty(
785 : : OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
786 [ # # ][ # # ]: 0 : _xAttributes );
[ # # ]
787 : : ctx.importTimeFormatProperty( OUString( "TimeFormat" ),
788 : : OUString( "time-format" ),
789 [ # # ]: 0 : _xAttributes );
790 : : ctx.importLongProperty( OUString( "Time" ),
791 : : OUString( "value" ),
792 [ # # ]: 0 : _xAttributes );
793 : : ctx.importLongProperty( OUString( "TimeMin" ),
794 : : OUString( "value-min" ),
795 [ # # ]: 0 : _xAttributes );
796 : : ctx.importLongProperty( OUString( "TimeMax" ),
797 : : OUString( "value-max" ),
798 [ # # ]: 0 : _xAttributes );
799 : : ctx.importBooleanProperty( OUString( "Spin" ),
800 : : OUString( "spin" ),
801 [ # # ]: 0 : _xAttributes );
802 [ # # # # ]: 0 : if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
803 [ # # ][ # # ]: 0 : _xAttributes ))
804 [ # # ][ # # ]: 0 : ctx.getControlModel()->setPropertyValue(
805 [ # # ][ # # ]: 0 : OUSTR("Repeat"), makeAny(true) );
[ # # ]
806 : : ctx.importStringProperty( OUString( "Text" ),
807 : : OUString( "text" ),
808 [ # # ]: 0 : _xAttributes );
809 : : ctx.importBooleanProperty( OUString( "EnforceFormat" ),
810 : : OUString( "enforce-format" ),
811 [ # # ]: 0 : _xAttributes );
812 : :
813 [ # # ]: 0 : ctx.importEvents( _events );
814 : : // avoid ring-reference:
815 : : // vector< event elements > holding event elements holding this (via _pParent)
816 [ # # ]: 0 : _events.clear();
817 : 0 : }
818 : :
819 : : //##################################################################################################
820 : :
821 : : // numericfield
822 : : //__________________________________________________________________________________________________
823 : 0 : Reference< xml::input::XElement > NumericFieldElement::startChildElement(
824 : : sal_Int32 nUid, OUString const & rLocalName,
825 : : Reference< xml::input::XAttributes > const & xAttributes )
826 : : throw (xml::sax::SAXException, RuntimeException)
827 : : {
828 : : // event
829 [ # # ]: 0 : if (_pImport->isEventElement( nUid, rLocalName ))
830 : : {
831 [ # # ][ # # ]: 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
832 : : }
833 : : else
834 : : {
835 : : throw xml::sax::SAXException(
836 : : OUString( "expected event element!" ),
837 [ # # ]: 0 : Reference< XInterface >(), Any() );
838 : : }
839 : : }
840 : : //__________________________________________________________________________________________________
841 : 0 : void NumericFieldElement::endElement()
842 : : throw (xml::sax::SAXException, RuntimeException)
843 : : {
844 : : ControlImportContext ctx(
845 : : _pImport, getControlId( _xAttributes ),
846 [ # # ][ # # ]: 0 : OUString( "com.sun.star.awt.UnoControlNumericFieldModel" ) );
847 : :
848 [ # # ]: 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
849 [ # # ]: 0 : if (xStyle.is())
850 : : {
851 [ # # ][ # # ]: 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
852 [ # # ]: 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
853 [ # # ]: 0 : pStyle->importBackgroundColorStyle( xControlModel );
854 [ # # ]: 0 : pStyle->importTextColorStyle( xControlModel );
855 [ # # ]: 0 : pStyle->importTextLineColorStyle( xControlModel );
856 [ # # ]: 0 : pStyle->importBorderStyle( xControlModel );
857 [ # # ]: 0 : pStyle->importFontStyle( xControlModel );
858 : : }
859 : :
860 [ # # ]: 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
861 : : ctx.importBooleanProperty( OUString( "Tabstop" ),
862 : : OUString( "tabstop" ),
863 [ # # ]: 0 : _xAttributes );
864 : : ctx.importBooleanProperty( OUString( "ReadOnly" ),
865 : : OUString( "readonly" ),
866 [ # # ]: 0 : _xAttributes );
867 : : ctx.importBooleanProperty( OUString( "StrictFormat" ),
868 : : OUString( "strict-format" ),
869 [ # # ]: 0 : _xAttributes );
870 : : ctx.importBooleanProperty(
871 : : OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
872 [ # # ][ # # ]: 0 : _xAttributes );
[ # # ]
873 : : ctx.importShortProperty( OUString( "DecimalAccuracy" ),
874 : : OUString( "decimal-accuracy" ),
875 [ # # ]: 0 : _xAttributes );
876 : : ctx.importBooleanProperty( OUString( "ShowThousandsSeparator" ),
877 : : OUString( "thousands-separator" ),
878 [ # # ]: 0 : _xAttributes );
879 : : ctx.importDoubleProperty( OUString( "Value" ),
880 : : OUString( "value" ),
881 [ # # ]: 0 : _xAttributes );
882 : : ctx.importDoubleProperty( OUString( "ValueMin" ),
883 : : OUString( "value-min" ),
884 [ # # ]: 0 : _xAttributes );
885 : : ctx.importDoubleProperty( OUString( "ValueMax" ),
886 : : OUString( "value-max" ),
887 [ # # ]: 0 : _xAttributes );
888 : : ctx.importDoubleProperty( OUString( "ValueStep" ),
889 : : OUString( "value-step" ),
890 [ # # ]: 0 : _xAttributes );
891 : : ctx.importBooleanProperty( OUString( "Spin" ),
892 : : OUString( "spin" ),
893 [ # # ]: 0 : _xAttributes );
894 [ # # # # ]: 0 : if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
895 [ # # ][ # # ]: 0 : _xAttributes ))
896 [ # # ][ # # ]: 0 : ctx.getControlModel()->setPropertyValue(
897 [ # # ][ # # ]: 0 : OUSTR("Repeat"), makeAny(true) );
[ # # ]
898 : : ctx.importBooleanProperty( OUString( "EnforceFormat" ),
899 : : OUString( "enforce-format" ),
900 [ # # ]: 0 : _xAttributes );
901 [ # # ]: 0 : ctx.importEvents( _events );
902 : : // avoid ring-reference:
903 : : // vector< event elements > holding event elements holding this (via _pParent)
904 [ # # ]: 0 : _events.clear();
905 : 0 : }
906 : :
907 : : //##################################################################################################
908 : :
909 : : // datefield
910 : : //__________________________________________________________________________________________________
911 : 0 : Reference< xml::input::XElement > DateFieldElement::startChildElement(
912 : : sal_Int32 nUid, OUString const & rLocalName,
913 : : Reference< xml::input::XAttributes > const & xAttributes )
914 : : throw (xml::sax::SAXException, RuntimeException)
915 : : {
916 : : // event
917 [ # # ]: 0 : if (_pImport->isEventElement( nUid, rLocalName ))
918 : : {
919 [ # # ][ # # ]: 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
920 : : }
921 : : else
922 : : {
923 : : throw xml::sax::SAXException(
924 : : OUString( "expected event element!" ),
925 [ # # ]: 0 : Reference< XInterface >(), Any() );
926 : : }
927 : : }
928 : : //__________________________________________________________________________________________________
929 : 0 : void DateFieldElement::endElement()
930 : : throw (xml::sax::SAXException, RuntimeException)
931 : : {
932 : : ControlImportContext ctx(
933 : : _pImport, getControlId( _xAttributes ),
934 [ # # ][ # # ]: 0 : OUString( "com.sun.star.awt.UnoControlDateFieldModel" ) );
935 : :
936 [ # # ]: 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
937 [ # # ]: 0 : if (xStyle.is())
938 : : {
939 [ # # ][ # # ]: 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
940 [ # # ]: 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
941 [ # # ]: 0 : pStyle->importBackgroundColorStyle( xControlModel );
942 [ # # ]: 0 : pStyle->importTextColorStyle( xControlModel );
943 [ # # ]: 0 : pStyle->importTextLineColorStyle( xControlModel );
944 [ # # ]: 0 : pStyle->importBorderStyle( xControlModel );
945 [ # # ]: 0 : pStyle->importFontStyle( xControlModel );
946 : : }
947 : :
948 [ # # ]: 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
949 : : ctx.importBooleanProperty( OUString( "Tabstop" ),
950 : : OUString( "tabstop" ),
951 [ # # ]: 0 : _xAttributes );
952 : : ctx.importBooleanProperty( OUString( "ReadOnly" ),
953 : : OUString( "readonly" ),
954 [ # # ]: 0 : _xAttributes );
955 : : ctx.importBooleanProperty( OUString( "StrictFormat" ),
956 : : OUString( "strict-format" ),
957 [ # # ]: 0 : _xAttributes );
958 : : ctx.importBooleanProperty(
959 : : OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
960 [ # # ][ # # ]: 0 : _xAttributes );
[ # # ]
961 : : ctx.importDateFormatProperty( OUString( "DateFormat" ),
962 : : OUString( "date-format" ),
963 [ # # ]: 0 : _xAttributes );
964 : : ctx.importBooleanProperty( OUString( "DateShowCentury" ),
965 : : OUString( "show-century" ),
966 [ # # ]: 0 : _xAttributes );
967 : : ctx.importLongProperty( OUString( "Date" ),
968 : : OUString( "value" ),
969 [ # # ]: 0 : _xAttributes );
970 : : ctx.importLongProperty( OUString( "DateMin" ),
971 : : OUString( "value-min" ),
972 [ # # ]: 0 : _xAttributes );
973 : : ctx.importLongProperty( OUString( "DateMax" ),
974 : : OUString( "value-max" ),
975 [ # # ]: 0 : _xAttributes );
976 : : ctx.importBooleanProperty( OUString( "Spin" ),
977 : : OUString( "spin" ),
978 [ # # ]: 0 : _xAttributes );
979 [ # # # # ]: 0 : if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
980 [ # # ][ # # ]: 0 : _xAttributes ))
981 [ # # ][ # # ]: 0 : ctx.getControlModel()->setPropertyValue(
982 [ # # ][ # # ]: 0 : OUSTR("Repeat"), makeAny(true) );
[ # # ]
983 : : ctx.importBooleanProperty( OUString( "Dropdown" ),
984 : : OUString( "dropdown" ),
985 [ # # ]: 0 : _xAttributes );
986 : : ctx.importStringProperty( OUString( "Text" ),
987 : : OUString( "text" ),
988 [ # # ]: 0 : _xAttributes );
989 : : ctx.importBooleanProperty( OUString( "EnforceFormat" ),
990 : : OUString( "enforce-format" ),
991 [ # # ]: 0 : _xAttributes );
992 [ # # ]: 0 : ctx.importEvents( _events );
993 : : // avoid ring-reference:
994 : : // vector< event elements > holding event elements holding this (via _pParent)
995 [ # # ]: 0 : _events.clear();
996 : 0 : }
997 : :
998 : : //##################################################################################################
999 : :
1000 : : // currencyfield
1001 : : //__________________________________________________________________________________________________
1002 : 0 : Reference< xml::input::XElement > CurrencyFieldElement::startChildElement(
1003 : : sal_Int32 nUid, OUString const & rLocalName,
1004 : : Reference< xml::input::XAttributes > const & xAttributes )
1005 : : throw (xml::sax::SAXException, RuntimeException)
1006 : : {
1007 : : // event
1008 [ # # ]: 0 : if (_pImport->isEventElement( nUid, rLocalName ))
1009 : : {
1010 [ # # ][ # # ]: 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1011 : : }
1012 : : else
1013 : : {
1014 : : throw xml::sax::SAXException(
1015 : : OUString( "expected event element!" ),
1016 [ # # ]: 0 : Reference< XInterface >(), Any() );
1017 : : }
1018 : : }
1019 : : //__________________________________________________________________________________________________
1020 : 0 : void CurrencyFieldElement::endElement()
1021 : : throw (xml::sax::SAXException, RuntimeException)
1022 : : {
1023 : : ControlImportContext ctx(
1024 : : _pImport, getControlId( _xAttributes ),
1025 [ # # ][ # # ]: 0 : OUString( "com.sun.star.awt.UnoControlCurrencyFieldModel" ) );
1026 : :
1027 [ # # ]: 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1028 [ # # ]: 0 : if (xStyle.is())
1029 : : {
1030 [ # # ][ # # ]: 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1031 [ # # ]: 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1032 [ # # ]: 0 : pStyle->importBackgroundColorStyle( xControlModel );
1033 [ # # ]: 0 : pStyle->importTextColorStyle( xControlModel );
1034 [ # # ]: 0 : pStyle->importTextLineColorStyle( xControlModel );
1035 [ # # ]: 0 : pStyle->importBorderStyle( xControlModel );
1036 [ # # ]: 0 : pStyle->importFontStyle( xControlModel );
1037 : : }
1038 : :
1039 [ # # ]: 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1040 : : ctx.importBooleanProperty( OUString( "Tabstop" ),
1041 : : OUString( "tabstop" ),
1042 [ # # ]: 0 : _xAttributes );
1043 : : ctx.importBooleanProperty( OUString( "ReadOnly" ),
1044 : : OUString( "readonly" ),
1045 [ # # ]: 0 : _xAttributes );
1046 : : ctx.importBooleanProperty( OUString( "StrictFormat" ),
1047 : : OUString( "strict-format" ),
1048 [ # # ]: 0 : _xAttributes );
1049 : : ctx.importBooleanProperty(
1050 : : OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
1051 [ # # ][ # # ]: 0 : _xAttributes );
[ # # ]
1052 : : ctx.importStringProperty( OUString( "CurrencySymbol" ),
1053 : : OUString( "currency-symbol" ),
1054 [ # # ]: 0 : _xAttributes );
1055 : : ctx.importShortProperty( OUString( "DecimalAccuracy" ),
1056 : : OUString( "decimal-accuracy" ),
1057 [ # # ]: 0 : _xAttributes );
1058 : : ctx.importBooleanProperty( OUString( "ShowThousandsSeparator" ),
1059 : : OUString( "thousands-separator" ),
1060 [ # # ]: 0 : _xAttributes );
1061 : : ctx.importDoubleProperty( OUString( "Value" ),
1062 : : OUString( "value" ),
1063 [ # # ]: 0 : _xAttributes );
1064 : : ctx.importDoubleProperty( OUString( "ValueMin" ),
1065 : : OUString( "value-min" ),
1066 [ # # ]: 0 : _xAttributes );
1067 : : ctx.importDoubleProperty( OUString( "ValueMax" ),
1068 : : OUString( "value-max" ),
1069 [ # # ]: 0 : _xAttributes );
1070 : : ctx.importDoubleProperty( OUString( "ValueStep" ),
1071 : : OUString( "value-step" ),
1072 [ # # ]: 0 : _xAttributes );
1073 : : ctx.importBooleanProperty( OUString( "Spin" ),
1074 : : OUString( "spin" ),
1075 [ # # ]: 0 : _xAttributes );
1076 [ # # # # ]: 0 : if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
1077 [ # # ][ # # ]: 0 : _xAttributes ))
1078 [ # # ][ # # ]: 0 : ctx.getControlModel()->setPropertyValue(
1079 [ # # ][ # # ]: 0 : OUSTR("Repeat"), makeAny(true) );
[ # # ]
1080 : : ctx.importBooleanProperty( OUString( "PrependCurrencySymbol" ),
1081 : : OUString( "prepend-symbol" ),
1082 [ # # ]: 0 : _xAttributes );
1083 : : ctx.importBooleanProperty( OUString( "EnforceFormat" ),
1084 : : OUString( "enforce-format" ),
1085 [ # # ]: 0 : _xAttributes );
1086 [ # # ]: 0 : ctx.importEvents( _events );
1087 : : // avoid ring-reference:
1088 : : // vector< event elements > holding event elements holding this (via _pParent)
1089 [ # # ]: 0 : _events.clear();
1090 : 0 : }
1091 : :
1092 : : //##################################################################################################
1093 : :
1094 : : // filecontrol
1095 : : //__________________________________________________________________________________________________
1096 : 0 : Reference< xml::input::XElement > FileControlElement::startChildElement(
1097 : : sal_Int32 nUid, OUString const & rLocalName,
1098 : : Reference< xml::input::XAttributes > const & xAttributes )
1099 : : throw (xml::sax::SAXException, RuntimeException)
1100 : : {
1101 : : // event
1102 [ # # ]: 0 : if (_pImport->isEventElement( nUid, rLocalName ))
1103 : : {
1104 [ # # ][ # # ]: 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1105 : : }
1106 : : else
1107 : : {
1108 : : throw xml::sax::SAXException(
1109 : : OUString( "expected event element!" ),
1110 [ # # ]: 0 : Reference< XInterface >(), Any() );
1111 : : }
1112 : : }
1113 : : //__________________________________________________________________________________________________
1114 : 0 : void FileControlElement::endElement()
1115 : : throw (xml::sax::SAXException, RuntimeException)
1116 : : {
1117 : : ControlImportContext ctx(
1118 : : _pImport, getControlId( _xAttributes ),
1119 [ # # ][ # # ]: 0 : OUString( "com.sun.star.awt.UnoControlFileControlModel" ) );
1120 : :
1121 [ # # ]: 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1122 [ # # ]: 0 : if (xStyle.is())
1123 : : {
1124 [ # # ][ # # ]: 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1125 [ # # ]: 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1126 [ # # ]: 0 : pStyle->importBackgroundColorStyle( xControlModel );
1127 [ # # ]: 0 : pStyle->importTextColorStyle( xControlModel );
1128 [ # # ]: 0 : pStyle->importTextLineColorStyle( xControlModel );
1129 [ # # ]: 0 : pStyle->importBorderStyle( xControlModel );
1130 [ # # ]: 0 : pStyle->importFontStyle( xControlModel );
1131 : : }
1132 : :
1133 [ # # ]: 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1134 : : ctx.importBooleanProperty( OUString( "Tabstop" ),
1135 : : OUString( "tabstop" ),
1136 [ # # ]: 0 : _xAttributes );
1137 : : ctx.importBooleanProperty(
1138 : : OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
1139 [ # # ][ # # ]: 0 : _xAttributes );
[ # # ]
1140 : : ctx.importStringProperty( OUString( "Text" ),
1141 : : OUString( "value" ),
1142 [ # # ]: 0 : _xAttributes );
1143 : : ctx.importBooleanProperty( OUString( "ReadOnly" ),
1144 : : OUString( "readonly" ),
1145 [ # # ]: 0 : _xAttributes );
1146 [ # # ]: 0 : ctx.importEvents( _events );
1147 : : // avoid ring-reference:
1148 : : // vector< event elements > holding event elements holding this (via _pParent)
1149 [ # # ]: 0 : _events.clear();
1150 : 0 : }
1151 : : //##################################################################################################
1152 : :
1153 : : // treecontrol
1154 : : //__________________________________________________________________________________________________
1155 : 0 : Reference< xml::input::XElement > TreeControlElement::startChildElement(
1156 : : sal_Int32 nUid, OUString const & rLocalName,
1157 : : Reference< xml::input::XAttributes > const & xAttributes )
1158 : : throw (xml::sax::SAXException, RuntimeException)
1159 : : {
1160 : : // event
1161 [ # # ]: 0 : if (_pImport->isEventElement( nUid, rLocalName ))
1162 : : {
1163 [ # # ][ # # ]: 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1164 : : }
1165 : : else
1166 : : {
1167 : : throw xml::sax::SAXException(
1168 : : OUString( "expected event element!" ),
1169 [ # # ]: 0 : Reference< XInterface >(), Any() );
1170 : : }
1171 : : }
1172 : : //__________________________________________________________________________________________________
1173 : 0 : void TreeControlElement::endElement()
1174 : : throw (xml::sax::SAXException, RuntimeException)
1175 : : {
1176 : : ControlImportContext ctx(
1177 : : _pImport, getControlId( _xAttributes ),
1178 [ # # ][ # # ]: 0 : OUString( "com.sun.star.awt.tree.TreeControlModel" ) );
1179 : :
1180 [ # # ]: 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1181 [ # # ]: 0 : if (xStyle.is())
1182 : : {
1183 [ # # ][ # # ]: 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1184 [ # # ]: 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1185 [ # # ]: 0 : pStyle->importBackgroundColorStyle( xControlModel );
1186 [ # # ]: 0 : pStyle->importBorderStyle( xControlModel );
1187 : : }
1188 : :
1189 [ # # ]: 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1190 : : ctx.importBooleanProperty( OUString( "Tabstop" ),
1191 : : OUString( "tabstop" ),
1192 [ # # ]: 0 : _xAttributes );
1193 : : ctx.importSelectionTypeProperty( OUString( "SelectionType" ),
1194 : : OUString( "selectiontype" ),
1195 [ # # ]: 0 : _xAttributes );
1196 : : ctx.importBooleanProperty( OUString( "RootDisplayed" ),
1197 : : OUString( "rootdisplayed" ),
1198 [ # # ]: 0 : _xAttributes );
1199 : : ctx.importBooleanProperty( OUString( "ShowsHandles" ),
1200 : : OUString( "showshandles" ),
1201 [ # # ]: 0 : _xAttributes );
1202 : : ctx.importBooleanProperty( OUString( "ShowsRootHandles" ),
1203 : : OUString( "showsroothandles" ),
1204 [ # # ]: 0 : _xAttributes );
1205 : : ctx.importBooleanProperty( OUString( "Editable" ),
1206 : : OUString( "editable" ),
1207 [ # # ]: 0 : _xAttributes );
1208 : : ctx.importBooleanProperty( OUString( "RowHeight" ),
1209 : : OUString( "readonly" ),
1210 [ # # ]: 0 : _xAttributes );
1211 : : ctx.importBooleanProperty( OUString( "InvokesStopNodeEditing" ),
1212 : : OUString( "invokesstopnodeediting" ),
1213 [ # # ]: 0 : _xAttributes );
1214 : :
1215 [ # # ]: 0 : ctx.importEvents( _events );
1216 : : // avoid ring-reference:
1217 : : // vector< event elements > holding event elements holding this (via _pParent)
1218 [ # # ]: 0 : _events.clear();
1219 : 0 : }
1220 : :
1221 : : //##################################################################################################
1222 : :
1223 : : // imagecontrol
1224 : : //__________________________________________________________________________________________________
1225 : 0 : Reference< xml::input::XElement > ImageControlElement::startChildElement(
1226 : : sal_Int32 nUid, OUString const & rLocalName,
1227 : : Reference< xml::input::XAttributes > const & xAttributes )
1228 : : throw (xml::sax::SAXException, RuntimeException)
1229 : : {
1230 : : // event
1231 [ # # ]: 0 : if (_pImport->isEventElement( nUid, rLocalName ))
1232 : : {
1233 [ # # ][ # # ]: 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1234 : : }
1235 : : else
1236 : : {
1237 : : throw xml::sax::SAXException(
1238 : : OUString( "expected event element!" ),
1239 [ # # ]: 0 : Reference< XInterface >(), Any() );
1240 : : }
1241 : : }
1242 : : //__________________________________________________________________________________________________
1243 : 0 : void ImageControlElement::endElement()
1244 : : throw (xml::sax::SAXException, RuntimeException)
1245 : : {
1246 : : ControlImportContext ctx(
1247 : : _pImport, getControlId( _xAttributes ),
1248 [ # # ][ # # ]: 0 : OUString( "com.sun.star.awt.UnoControlImageControlModel" ) );
1249 : :
1250 [ # # ]: 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1251 [ # # ]: 0 : if (xStyle.is())
1252 : : {
1253 [ # # ][ # # ]: 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1254 [ # # ]: 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1255 [ # # ]: 0 : pStyle->importBackgroundColorStyle( xControlModel );
1256 [ # # ]: 0 : pStyle->importBorderStyle( xControlModel );
1257 : : }
1258 : :
1259 [ # # ]: 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1260 : : ctx.importBooleanProperty( OUString( "ScaleImage" ),
1261 : : OUString( "scale-image" ),
1262 [ # # ]: 0 : _xAttributes );
1263 [ # # ][ # # ]: 0 : rtl::OUString sURL = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "src" ) );
[ # # ]
1264 [ # # ][ # # ]: 0 : Reference< document::XStorageBasedDocument > xDocStorage( _pImport->getDocOwner(), UNO_QUERY );
1265 : :
1266 [ # # ][ # # ]: 0 : ctx.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "src" ), _xAttributes );
[ # # ]
1267 : : ctx.importBooleanProperty( OUString( "Tabstop" ),
1268 : : OUString( "tabstop" ),
1269 [ # # ]: 0 : _xAttributes );
1270 [ # # ]: 0 : ctx.importEvents( _events );
1271 : : // avoid ring-reference:
1272 : : // vector< event elements > holding event elements holding this (via _pParent)
1273 [ # # ]: 0 : _events.clear();
1274 : 0 : }
1275 : :
1276 : : //##################################################################################################
1277 : :
1278 : : // textfield
1279 : : //__________________________________________________________________________________________________
1280 : 0 : Reference< xml::input::XElement > TextElement::startChildElement(
1281 : : sal_Int32 nUid, OUString const & rLocalName,
1282 : : Reference< xml::input::XAttributes > const & xAttributes )
1283 : : throw (xml::sax::SAXException, RuntimeException)
1284 : : {
1285 : : // event
1286 [ # # ]: 0 : if (_pImport->isEventElement( nUid, rLocalName ))
1287 : : {
1288 [ # # ][ # # ]: 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1289 : : }
1290 : : else
1291 : : {
1292 : : throw xml::sax::SAXException(
1293 : : OUString( "expected event element!" ),
1294 [ # # ]: 0 : Reference< XInterface >(), Any() );
1295 : : }
1296 : : }
1297 : : //__________________________________________________________________________________________________
1298 : 0 : void TextElement::endElement()
1299 : : throw (xml::sax::SAXException, RuntimeException)
1300 : : {
1301 : : ControlImportContext ctx(
1302 : : _pImport, getControlId( _xAttributes ),
1303 [ # # ][ # # ]: 0 : OUString( "com.sun.star.awt.UnoControlFixedTextModel" ) );
1304 : :
1305 [ # # ]: 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1306 [ # # ]: 0 : if (xStyle.is())
1307 : : {
1308 [ # # ][ # # ]: 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1309 [ # # ]: 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1310 [ # # ]: 0 : pStyle->importBackgroundColorStyle( xControlModel );
1311 [ # # ]: 0 : pStyle->importTextColorStyle( xControlModel );
1312 [ # # ]: 0 : pStyle->importTextLineColorStyle( xControlModel );
1313 [ # # ]: 0 : pStyle->importBorderStyle( xControlModel );
1314 [ # # ]: 0 : pStyle->importFontStyle( xControlModel );
1315 : : }
1316 : :
1317 [ # # ]: 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1318 : : ctx.importStringProperty( OUString( "Label" ),
1319 : : OUString( "value" ),
1320 [ # # ]: 0 : _xAttributes );
1321 : : ctx.importAlignProperty( OUString( "Align" ),
1322 : : OUString( "align" ),
1323 [ # # ]: 0 : _xAttributes );
1324 : : ctx.importVerticalAlignProperty( OUString( "VerticalAlign" ),
1325 : : OUString( "valign" ),
1326 [ # # ]: 0 : _xAttributes );
1327 : : ctx.importBooleanProperty( OUString( "MultiLine" ),
1328 : : OUString( "multiline" ),
1329 [ # # ]: 0 : _xAttributes );
1330 : : ctx.importBooleanProperty( OUString( "Tabstop" ),
1331 : : OUString( "tabstop" ),
1332 [ # # ]: 0 : _xAttributes );
1333 : : ctx.importBooleanProperty( OUString( "NoLabel" ),
1334 : : OUString( "nolabel" ),
1335 [ # # ]: 0 : _xAttributes );
1336 [ # # ]: 0 : ctx.importEvents( _events );
1337 : : // avoid ring-reference:
1338 : : // vector< event elements > holding event elements holding this (via _pParent)
1339 [ # # ]: 0 : _events.clear();
1340 : 0 : }
1341 : :
1342 : : //##################################################################################################
1343 : : // FixedHyperLink
1344 : : //__________________________________________________________________________________________________
1345 : 0 : Reference< xml::input::XElement > FixedHyperLinkElement::startChildElement(
1346 : : sal_Int32 nUid, OUString const & rLocalName,
1347 : : Reference< xml::input::XAttributes > const & xAttributes )
1348 : : throw (xml::sax::SAXException, RuntimeException)
1349 : : {
1350 : : // event
1351 [ # # ]: 0 : if (_pImport->isEventElement( nUid, rLocalName ))
1352 : : {
1353 [ # # ][ # # ]: 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1354 : : }
1355 : : else
1356 : : {
1357 : : throw xml::sax::SAXException(
1358 : : OUString( "expected event element!" ),
1359 [ # # ]: 0 : Reference< XInterface >(), Any() );
1360 : : }
1361 : : }
1362 : : //__________________________________________________________________________________________________
1363 : 0 : void FixedHyperLinkElement::endElement()
1364 : : throw (xml::sax::SAXException, RuntimeException)
1365 : : {
1366 : : ControlImportContext ctx(
1367 : : _pImport, getControlId( _xAttributes ),
1368 [ # # ][ # # ]: 0 : OUString( "com.sun.star.awt.UnoControlFixedHyperlinkModel" ) );
1369 : :
1370 [ # # ]: 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1371 [ # # ]: 0 : if (xStyle.is())
1372 : : {
1373 [ # # ][ # # ]: 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1374 [ # # ]: 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1375 [ # # ]: 0 : pStyle->importBackgroundColorStyle( xControlModel );
1376 [ # # ]: 0 : pStyle->importTextColorStyle( xControlModel );
1377 [ # # ]: 0 : pStyle->importTextLineColorStyle( xControlModel );
1378 [ # # ]: 0 : pStyle->importBorderStyle( xControlModel );
1379 [ # # ]: 0 : pStyle->importFontStyle( xControlModel );
1380 : : }
1381 : :
1382 [ # # ]: 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1383 : : ctx.importStringProperty( OUString( "Label" ),
1384 : : OUString( "value" ),
1385 [ # # ]: 0 : _xAttributes );
1386 : : ctx.importStringProperty( OUString( "URL" ),
1387 : : OUString( "url" ),
1388 [ # # ]: 0 : _xAttributes );
1389 : : ctx.importStringProperty( OUString( "Description" ),
1390 : : OUString( "description" ),
1391 [ # # ]: 0 : _xAttributes );
1392 : :
1393 : : ctx.importAlignProperty( OUString( "Align" ),
1394 : : OUString( "align" ),
1395 [ # # ]: 0 : _xAttributes );
1396 : : ctx.importVerticalAlignProperty( OUString( "VerticalAlign" ),
1397 : : OUString( "valign" ),
1398 [ # # ]: 0 : _xAttributes );
1399 : : ctx.importBooleanProperty( OUString( "MultiLine" ),
1400 : : OUString( "multiline" ),
1401 [ # # ]: 0 : _xAttributes );
1402 : : ctx.importBooleanProperty( OUString( "Tabstop" ),
1403 : : OUString( "tabstop" ),
1404 [ # # ]: 0 : _xAttributes );
1405 : : ctx.importBooleanProperty( OUString( "NoLabel" ),
1406 : : OUString( "nolabel" ),
1407 [ # # ]: 0 : _xAttributes );
1408 [ # # ]: 0 : ctx.importEvents( _events );
1409 : : // avoid ring-reference:
1410 : : // vector< event elements > holding event elements holding this (via _pParent)
1411 [ # # ]: 0 : _events.clear();
1412 : 0 : }
1413 : :
1414 : : //##################################################################################################
1415 : :
1416 : : // edit
1417 : : //__________________________________________________________________________________________________
1418 : 0 : Reference< xml::input::XElement > TextFieldElement::startChildElement(
1419 : : sal_Int32 nUid, OUString const & rLocalName,
1420 : : Reference< xml::input::XAttributes > const & xAttributes )
1421 : : throw (xml::sax::SAXException, RuntimeException)
1422 : : {
1423 : : // event
1424 [ # # ]: 0 : if (_pImport->isEventElement( nUid, rLocalName ))
1425 : : {
1426 [ # # ][ # # ]: 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1427 : : }
1428 : : else
1429 : : {
1430 : : throw xml::sax::SAXException(
1431 : : OUString( "expected event element!" ),
1432 [ # # ]: 0 : Reference< XInterface >(), Any() );
1433 : : }
1434 : : }
1435 : : //__________________________________________________________________________________________________
1436 : 0 : void TextFieldElement::endElement()
1437 : : throw (xml::sax::SAXException, RuntimeException)
1438 : : {
1439 : : ControlImportContext ctx(
1440 : : _pImport, getControlId( _xAttributes ),
1441 [ # # ][ # # ]: 0 : OUString( "com.sun.star.awt.UnoControlEditModel" ) );
1442 [ # # ]: 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1443 : :
1444 [ # # ]: 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1445 [ # # ]: 0 : if (xStyle.is())
1446 : : {
1447 [ # # ][ # # ]: 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1448 [ # # ]: 0 : pStyle->importBackgroundColorStyle( xControlModel );
1449 [ # # ]: 0 : pStyle->importTextColorStyle( xControlModel );
1450 [ # # ]: 0 : pStyle->importTextLineColorStyle( xControlModel );
1451 [ # # ]: 0 : pStyle->importBorderStyle( xControlModel );
1452 [ # # ]: 0 : pStyle->importFontStyle( xControlModel );
1453 : : }
1454 : :
1455 [ # # ]: 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1456 : : ctx.importBooleanProperty( OUString( "Tabstop" ),
1457 : : OUString( "tabstop" ),
1458 [ # # ]: 0 : _xAttributes );
1459 : : ctx.importAlignProperty( OUString( "Align" ),
1460 : : OUString( "align" ),
1461 [ # # ]: 0 : _xAttributes );
1462 : : ctx.importBooleanProperty( OUString( "HardLineBreaks" ),
1463 : : OUString( "hard-linebreaks" ),
1464 [ # # ]: 0 : _xAttributes );
1465 : : ctx.importBooleanProperty( OUString( "HScroll" ),
1466 : : OUString( "hscroll" ),
1467 [ # # ]: 0 : _xAttributes );
1468 : : ctx.importBooleanProperty( OUString( "VScroll" ),
1469 : : OUString( "vscroll" ),
1470 [ # # ]: 0 : _xAttributes );
1471 : : ctx.importBooleanProperty(
1472 : : OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
1473 [ # # ][ # # ]: 0 : _xAttributes );
[ # # ]
1474 : : ctx.importShortProperty( OUString( "MaxTextLen" ),
1475 : : OUString( "maxlength" ),
1476 [ # # ]: 0 : _xAttributes );
1477 : : ctx.importBooleanProperty( OUString( "MultiLine" ),
1478 : : OUString( "multiline" ),
1479 [ # # ]: 0 : _xAttributes );
1480 : : ctx.importBooleanProperty( OUString( "ReadOnly" ),
1481 : : OUString( "readonly" ),
1482 [ # # ]: 0 : _xAttributes );
1483 : : ctx.importStringProperty( OUString( "Text" ),
1484 : : OUString( "value" ),
1485 [ # # ]: 0 : _xAttributes );
1486 : : ctx.importLineEndFormatProperty( OUString( "LineEndFormat" ),
1487 : : OUString( "lineend-format" ),
1488 [ # # ]: 0 : _xAttributes );
1489 : 0 : OUString aValue;
1490 [ # # # # ]: 0 : if (getStringAttr( &aValue,
[ # # ]
1491 : : OUString( "echochar" ),
1492 : : _xAttributes,
1493 [ # # ][ # # ]: 0 : _pImport->XMLNS_DIALOGS_UID ) &&
[ # # # # ]
[ # # ]
1494 : 0 : !aValue.isEmpty() )
1495 : : {
1496 : : OSL_ENSURE( aValue.getLength() == 1, "### more than one character given for echochar!" );
1497 : 0 : sal_Int16 nChar = (sal_Int16)aValue[ 0 ];
1498 [ # # ]: 0 : xControlModel->setPropertyValue( OUString( "EchoChar" ),
1499 [ # # ][ # # ]: 0 : makeAny( nChar ) );
1500 : : }
1501 : :
1502 [ # # ]: 0 : ctx.importEvents( _events );
1503 : : // avoid ring-reference:
1504 : : // vector< event elements > holding event elements holding this (via _pParent)
1505 [ # # ]: 0 : _events.clear();
1506 : 0 : }
1507 : :
1508 : : //##################################################################################################
1509 : :
1510 : : // titledbox
1511 : : //__________________________________________________________________________________________________
1512 : 0 : Reference< xml::input::XElement > TitledBoxElement::startChildElement(
1513 : : sal_Int32 nUid, OUString const & rLocalName,
1514 : : Reference< xml::input::XAttributes > const & xAttributes )
1515 : : throw (xml::sax::SAXException, RuntimeException)
1516 : : {
1517 : : // event
1518 [ # # ]: 0 : if (_pImport->isEventElement( nUid, rLocalName ))
1519 : : {
1520 [ # # ][ # # ]: 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1521 : : }
1522 [ # # ]: 0 : else if (_pImport->XMLNS_DIALOGS_UID != nUid)
1523 : : {
1524 : : throw xml::sax::SAXException(
1525 : : OUString( "illegal namespace!" ),
1526 [ # # ]: 0 : Reference< XInterface >(), Any() );
1527 : : }
1528 : : // title
1529 [ # # ]: 0 : else if ( rLocalName == "title" )
1530 : : {
1531 : : getStringAttr( &_label,
1532 : : OUString( "value" ),
1533 : : xAttributes,
1534 [ # # ]: 0 : _pImport->XMLNS_DIALOGS_UID );
1535 : :
1536 : : return new ElementBase(
1537 : : _pImport->XMLNS_DIALOGS_UID,
1538 [ # # ][ # # ]: 0 : rLocalName, xAttributes, this, _pImport );
1539 : : }
1540 : : // radio
1541 [ # # ]: 0 : else if ( rLocalName == "radio" )
1542 : : {
1543 : : // dont create radios here, => titledbox must be inserted first due to radio grouping,
1544 : : // possible predecessors!
1545 : : Reference< xml::input::XElement > xRet(
1546 [ # # ][ # # ]: 0 : new RadioElement( rLocalName, xAttributes, this, _pImport ) );
[ # # ]
1547 [ # # ]: 0 : _radios.push_back( xRet );
1548 : 0 : return xRet;
1549 : : }
1550 : : // event
1551 [ # # ]: 0 : else if (_pImport->isEventElement( nUid, rLocalName ))
1552 : : {
1553 [ # # ][ # # ]: 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1554 : : }
1555 : : else
1556 : : {
1557 : 0 : return BulletinBoardElement::startChildElement( nUid, rLocalName, xAttributes );
1558 : : }
1559 : : }
1560 : : //__________________________________________________________________________________________________
1561 : 0 : void TitledBoxElement::endElement()
1562 : : throw (xml::sax::SAXException, RuntimeException)
1563 : : {
1564 : : {
1565 : : ControlImportContext ctx(
1566 : : _pImport, getControlId( _xAttributes ),
1567 [ # # ][ # # ]: 0 : OUString( "com.sun.star.awt.UnoControlGroupBoxModel" ) );
1568 [ # # ]: 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1569 : :
1570 [ # # ]: 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1571 [ # # ]: 0 : if (xStyle.is())
1572 : : {
1573 [ # # ][ # # ]: 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1574 [ # # ]: 0 : pStyle->importTextColorStyle( xControlModel );
1575 [ # # ]: 0 : pStyle->importTextLineColorStyle( xControlModel );
1576 [ # # ]: 0 : pStyle->importFontStyle( xControlModel );
1577 : : }
1578 : :
1579 [ # # ]: 0 : ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
1580 : :
1581 [ # # ]: 0 : if (!_label.isEmpty())
1582 : : {
1583 [ # # ]: 0 : xControlModel->setPropertyValue( OUString( "Label" ),
1584 [ # # ][ # # ]: 0 : makeAny( _label ) );
1585 : : }
1586 : :
1587 [ # # ]: 0 : ctx.importEvents( _events );
1588 : : // avoid ring-reference:
1589 : : // vector< event elements > holding event elements holding this (via _pParent)
1590 [ # # ]: 0 : _events.clear();
1591 : : }
1592 : :
1593 : : // create radios AFTER group box!
1594 [ # # ]: 0 : for ( size_t nPos = 0; nPos < _radios.size(); ++nPos )
1595 : : {
1596 : 0 : Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
1597 : : Reference< xml::input::XAttributes > xAttributes(
1598 [ # # ][ # # ]: 0 : xRadio->getAttributes() );
1599 : :
1600 : : ControlImportContext ctx(
1601 : : _pImport, getControlId( xAttributes ),
1602 [ # # ][ # # ]: 0 : getControlModelName( OUString( "com.sun.star.awt.UnoControlRadioButtonModel" ), xAttributes ) );
[ # # ]
1603 [ # # ]: 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1604 : :
1605 [ # # ]: 0 : Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
1606 [ # # ]: 0 : if (xStyle.is())
1607 : : {
1608 [ # # ][ # # ]: 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1609 [ # # ]: 0 : pStyle->importBackgroundColorStyle( xControlModel );
1610 [ # # ]: 0 : pStyle->importTextColorStyle( xControlModel );
1611 [ # # ]: 0 : pStyle->importTextLineColorStyle( xControlModel );
1612 [ # # ]: 0 : pStyle->importFontStyle( xControlModel );
1613 [ # # ]: 0 : pStyle->importVisualEffectStyle( xControlModel );
1614 : : }
1615 : :
1616 [ # # ]: 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, xAttributes );
1617 : : ctx.importBooleanProperty( OUString( "Tabstop" ),
1618 : : OUString( "tabstop" ),
1619 [ # # ]: 0 : xAttributes );
1620 : : ctx.importStringProperty( OUString( "Label" ),
1621 : : OUString( "value" ),
1622 [ # # ]: 0 : xAttributes );
1623 : : ctx.importAlignProperty( OUString( "Align" ),
1624 : : OUString( "align" ),
1625 [ # # ]: 0 : xAttributes );
1626 : : ctx.importVerticalAlignProperty( OUString( "VerticalAlign" ),
1627 : : OUString( "valign" ),
1628 [ # # ]: 0 : xAttributes );
1629 [ # # ][ # # ]: 0 : ctx.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "image-src" ), _xAttributes );
[ # # ]
1630 : : ctx.importImagePositionProperty( OUString( "ImagePosition" ),
1631 : : OUString( "image-position" ),
1632 [ # # ]: 0 : xAttributes );
1633 : : ctx.importBooleanProperty( OUString( "MultiLine" ),
1634 : : OUString( "multiline" ),
1635 [ # # ]: 0 : xAttributes );
1636 : : ctx.importStringProperty( OUString( "GroupName" ),
1637 : : OUString( "group-name" ),
1638 [ # # ]: 0 : xAttributes );
1639 : :
1640 : 0 : sal_Int16 nVal = 0;
1641 : 0 : sal_Bool bChecked = sal_False;
1642 [ # # ][ # # ]: 0 : if (getBoolAttr( &bChecked,
[ # # ]
1643 : : OUString( "checked" ),
1644 : : xAttributes,
1645 [ # # ][ # # ]: 0 : _pImport->XMLNS_DIALOGS_UID ) &&
[ # # # # ]
[ # # ]
1646 : : bChecked)
1647 : : {
1648 : 0 : nVal = 1;
1649 : : }
1650 [ # # ]: 0 : xControlModel->setPropertyValue( OUString( "State" ),
1651 [ # # ][ # # ]: 0 : makeAny( nVal ) );
1652 [ # # ][ # # ]: 0 : ctx.importDataAwareProperty( OUSTR("linked-cell" ), xAttributes );
1653 : : ::std::vector< Reference< xml::input::XElement > > * radioEvents =
1654 [ # # ][ # # ]: 0 : static_cast< RadioElement * >( xRadio.get() )->getEvents();
1655 [ # # ]: 0 : ctx.importEvents( *radioEvents );
1656 : : // avoid ring-reference:
1657 : : // vector< event elements > holding event elements holding this (via _pParent)
1658 : 0 : radioEvents->clear();
1659 [ # # ]: 0 : }
1660 : : // avoid ring-reference:
1661 : : // vector< radio elements > holding radio elements holding this (via _pParent)
1662 : 0 : _radios.clear();
1663 : 0 : }
1664 : :
1665 : : //##################################################################################################
1666 : :
1667 : : // radio
1668 : : //__________________________________________________________________________________________________
1669 : 0 : Reference< xml::input::XElement > RadioElement::startChildElement(
1670 : : sal_Int32 nUid, OUString const & rLocalName,
1671 : : Reference< xml::input::XAttributes > const & xAttributes )
1672 : : throw (xml::sax::SAXException, RuntimeException)
1673 : : {
1674 : : // event
1675 [ # # ]: 0 : if (_pImport->isEventElement( nUid, rLocalName ))
1676 : : {
1677 [ # # ][ # # ]: 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1678 : : }
1679 : : else
1680 : : {
1681 : : throw xml::sax::SAXException(
1682 : : OUString( "expected event element!" ),
1683 [ # # ]: 0 : Reference< XInterface >(), Any() );
1684 : : }
1685 : : }
1686 : :
1687 : : //##################################################################################################
1688 : :
1689 : : // radiogroup
1690 : : //__________________________________________________________________________________________________
1691 : 0 : Reference< xml::input::XElement > RadioGroupElement::startChildElement(
1692 : : sal_Int32 nUid, OUString const & rLocalName,
1693 : : Reference< xml::input::XAttributes > const & xAttributes )
1694 : : throw (xml::sax::SAXException, RuntimeException)
1695 : : {
1696 [ # # ]: 0 : if (_pImport->XMLNS_DIALOGS_UID != nUid)
1697 : : {
1698 : : throw xml::sax::SAXException(
1699 : : OUString( "illegal namespace!" ),
1700 [ # # ]: 0 : Reference< XInterface >(), Any() );
1701 : : }
1702 : : // radio
1703 [ # # ]: 0 : else if ( rLocalName == "radio" )
1704 : : {
1705 : : // dont create radios here, => titledbox must be inserted first due to radio grouping,
1706 : : // possible predecessors!
1707 : : Reference< xml::input::XElement > xRet(
1708 [ # # ][ # # ]: 0 : new RadioElement( rLocalName, xAttributes, this, _pImport ) );
[ # # ]
1709 [ # # ]: 0 : _radios.push_back( xRet );
1710 : 0 : return xRet;
1711 : : }
1712 : : else
1713 : : {
1714 : : throw xml::sax::SAXException(
1715 : : OUString( "expected radio element!" ),
1716 [ # # ]: 0 : Reference< XInterface >(), Any() );
1717 : : }
1718 : : }
1719 : : //__________________________________________________________________________________________________
1720 : 0 : void RadioGroupElement::endElement()
1721 : : throw (xml::sax::SAXException, RuntimeException)
1722 : : {
1723 [ # # ]: 0 : for ( size_t nPos = 0; nPos < _radios.size(); ++nPos )
1724 : : {
1725 : 0 : Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
1726 : : Reference< xml::input::XAttributes > xAttributes(
1727 [ # # ][ # # ]: 0 : xRadio->getAttributes() );
1728 : :
1729 : : ControlImportContext ctx(
1730 : : _pImport, getControlId( xAttributes ),
1731 [ # # ][ # # ]: 0 : getControlModelName( OUString( "com.sun.star.awt.UnoControlRadioButtonModel" ), xAttributes ) );
[ # # ]
1732 [ # # ]: 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1733 : :
1734 [ # # ]: 0 : Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
1735 [ # # ]: 0 : if (xStyle.is())
1736 : : {
1737 [ # # ][ # # ]: 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1738 [ # # ]: 0 : pStyle->importBackgroundColorStyle( xControlModel );
1739 [ # # ]: 0 : pStyle->importTextColorStyle( xControlModel );
1740 [ # # ]: 0 : pStyle->importTextLineColorStyle( xControlModel );
1741 [ # # ]: 0 : pStyle->importFontStyle( xControlModel );
1742 [ # # ]: 0 : pStyle->importVisualEffectStyle( xControlModel );
1743 : : }
1744 : :
1745 [ # # ]: 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, xAttributes );
1746 : : ctx.importBooleanProperty( OUString( "Tabstop" ),
1747 : : OUString( "tabstop" ),
1748 [ # # ]: 0 : xAttributes );
1749 : : ctx.importStringProperty( OUString( "Label" ),
1750 : : OUString( "value" ),
1751 [ # # ]: 0 : xAttributes );
1752 : : ctx.importAlignProperty( OUString( "Align" ),
1753 : : OUString( "align" ),
1754 [ # # ]: 0 : xAttributes );
1755 : : ctx.importVerticalAlignProperty( OUString( "VerticalAlign" ),
1756 : : OUString( "valign" ),
1757 [ # # ]: 0 : xAttributes );
1758 [ # # ][ # # ]: 0 : ctx.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "image-src" ), xAttributes );
[ # # ]
1759 : : ctx.importImagePositionProperty( OUString( "ImagePosition" ),
1760 : : OUString( "image-position" ),
1761 [ # # ]: 0 : xAttributes );
1762 : : ctx.importBooleanProperty( OUString( "MultiLine" ),
1763 : : OUString( "multiline" ),
1764 [ # # ]: 0 : xAttributes );
1765 : : ctx.importStringProperty( OUString( "GroupName" ),
1766 : : OUString( "group-name" ),
1767 [ # # ]: 0 : xAttributes );
1768 : 0 : sal_Int16 nVal = 0;
1769 : 0 : sal_Bool bChecked = sal_False;
1770 [ # # ][ # # ]: 0 : if (getBoolAttr( &bChecked,
[ # # ]
1771 : : OUString( "checked" ),
1772 : : xAttributes,
1773 [ # # ][ # # ]: 0 : _pImport->XMLNS_DIALOGS_UID ) &&
[ # # # # ]
[ # # ]
1774 : : bChecked)
1775 : : {
1776 : 0 : nVal = 1;
1777 : : }
1778 [ # # ]: 0 : xControlModel->setPropertyValue( OUString( "State" ),
1779 [ # # ][ # # ]: 0 : makeAny( nVal ) );
1780 : :
1781 [ # # ][ # # ]: 0 : ctx.importDataAwareProperty( OUSTR("linked-cell" ), xAttributes );
1782 : :
1783 : : ::std::vector< Reference< xml::input::XElement > > * radioEvents =
1784 [ # # ][ # # ]: 0 : static_cast< RadioElement * >( xRadio.get() )->getEvents();
1785 [ # # ]: 0 : ctx.importEvents( *radioEvents );
1786 : : // avoid ring-reference:
1787 : : // vector< event elements > holding event elements holding this (via _pParent)
1788 : 0 : radioEvents->clear();
1789 [ # # ]: 0 : }
1790 : : // avoid ring-reference:
1791 : : // vector< radio elements > holding radio elements holding this (via _pParent)
1792 : 0 : _radios.clear();
1793 : 0 : }
1794 : :
1795 : : //##################################################################################################
1796 : :
1797 : : // menupopup
1798 : : //__________________________________________________________________________________________________
1799 : 0 : Reference< xml::input::XElement > MenuPopupElement::startChildElement(
1800 : : sal_Int32 nUid, OUString const & rLocalName,
1801 : : Reference< xml::input::XAttributes > const & xAttributes )
1802 : : throw (xml::sax::SAXException, RuntimeException)
1803 : : {
1804 [ # # ]: 0 : if (_pImport->XMLNS_DIALOGS_UID != nUid)
1805 : : {
1806 : : throw xml::sax::SAXException(
1807 : : OUString( "illegal namespace!" ),
1808 [ # # ]: 0 : Reference< XInterface >(), Any() );
1809 : : }
1810 : : // menuitem
1811 [ # # ]: 0 : else if ( rLocalName == "menuitem" )
1812 : : {
1813 : : OUString aValue(
1814 [ # # ]: 0 : xAttributes->getValueByUidName(
1815 : : _pImport->XMLNS_DIALOGS_UID,
1816 [ # # ]: 0 : OUString( "value" ) ) );
1817 : : OSL_ENSURE( !aValue.isEmpty(), "### menuitem has no value?" );
1818 [ # # ]: 0 : if (!aValue.isEmpty())
1819 : : {
1820 [ # # ]: 0 : _itemValues.push_back( aValue );
1821 : :
1822 : : OUString aSel(
1823 [ # # ]: 0 : xAttributes->getValueByUidName(
1824 : : _pImport->XMLNS_DIALOGS_UID,
1825 [ # # ]: 0 : OUString( "selected" ) ) );
1826 [ # # ][ # # ]: 0 : if (!aSel.isEmpty() && aSel.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("true") ))
[ # # ]
1827 : : {
1828 : : _itemSelected.push_back(
1829 [ # # ]: 0 : static_cast<sal_Int16>(_itemValues.size()) -1 );
1830 : 0 : }
1831 : : }
1832 : : return new ElementBase(
1833 : : _pImport->XMLNS_DIALOGS_UID,
1834 [ # # ][ # # ]: 0 : rLocalName, xAttributes, this, _pImport );
[ # # ]
1835 : : }
1836 : : else
1837 : : {
1838 : : throw xml::sax::SAXException(
1839 : : OUString( "expected menuitem!" ),
1840 [ # # ]: 0 : Reference< XInterface >(), Any() );
1841 : : }
1842 : : }
1843 : : //__________________________________________________________________________________________________
1844 : 0 : Sequence< OUString > MenuPopupElement::getItemValues()
1845 : : {
1846 : 0 : Sequence< OUString > aRet( _itemValues.size() );
1847 [ # # ]: 0 : OUString * pRet = aRet.getArray();
1848 [ # # ]: 0 : for ( size_t nPos = _itemValues.size(); nPos--; )
1849 : : {
1850 : 0 : pRet[ nPos ] = _itemValues[ nPos ];
1851 : : }
1852 : 0 : return aRet;
1853 : : }
1854 : : //__________________________________________________________________________________________________
1855 : 0 : Sequence< sal_Int16 > MenuPopupElement::getSelectedItems()
1856 : : {
1857 : 0 : Sequence< sal_Int16 > aRet( _itemSelected.size() );
1858 [ # # ]: 0 : sal_Int16 * pRet = aRet.getArray();
1859 [ # # ]: 0 : for ( size_t nPos = _itemSelected.size(); nPos--; )
1860 : : {
1861 [ # # ]: 0 : pRet[ nPos ] = _itemSelected[ nPos ];
1862 : : }
1863 : 0 : return aRet;
1864 : : }
1865 : :
1866 : : //##################################################################################################
1867 : :
1868 : : // menulist
1869 : : //__________________________________________________________________________________________________
1870 : 0 : Reference< xml::input::XElement > MenuListElement::startChildElement(
1871 : : sal_Int32 nUid, OUString const & rLocalName,
1872 : : Reference< xml::input::XAttributes > const & xAttributes )
1873 : : throw (xml::sax::SAXException, RuntimeException)
1874 : : {
1875 : : // event
1876 [ # # ]: 0 : if (_pImport->isEventElement( nUid, rLocalName ))
1877 : : {
1878 [ # # ][ # # ]: 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1879 : : }
1880 [ # # ]: 0 : else if (_pImport->XMLNS_DIALOGS_UID != nUid)
1881 : : {
1882 : : throw xml::sax::SAXException(
1883 : : OUString( "illegal namespace!" ),
1884 [ # # ]: 0 : Reference< XInterface >(), Any() );
1885 : : }
1886 : : // menupopup
1887 [ # # ]: 0 : else if ( rLocalName == "menupopup" )
1888 : : {
1889 [ # # ][ # # ]: 0 : _popup = new MenuPopupElement( rLocalName, xAttributes, this, _pImport );
1890 : 0 : return _popup;
1891 : : }
1892 : : else
1893 : : {
1894 : : throw xml::sax::SAXException(
1895 : : OUString( "expected event or menupopup element!" ),
1896 [ # # ]: 0 : Reference< XInterface >(), Any() );
1897 : : }
1898 : : }
1899 : : //__________________________________________________________________________________________________
1900 : 0 : void MenuListElement::endElement()
1901 : : throw (xml::sax::SAXException, RuntimeException)
1902 : : {
1903 : : ControlImportContext ctx(
1904 : : _pImport, getControlId( _xAttributes ),
1905 : :
1906 [ # # ][ # # ]: 0 : getControlModelName( OUString( "com.sun.star.awt.UnoControlListBoxModel" ), _xAttributes ) );
[ # # ]
1907 [ # # ]: 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1908 : :
1909 [ # # ]: 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1910 [ # # ]: 0 : if (xStyle.is())
1911 : : {
1912 [ # # ][ # # ]: 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1913 [ # # ]: 0 : pStyle->importBackgroundColorStyle( xControlModel );
1914 [ # # ]: 0 : pStyle->importTextColorStyle( xControlModel );
1915 [ # # ]: 0 : pStyle->importTextLineColorStyle( xControlModel );
1916 [ # # ]: 0 : pStyle->importBorderStyle( xControlModel );
1917 [ # # ]: 0 : pStyle->importFontStyle( xControlModel );
1918 : : }
1919 : :
1920 [ # # ]: 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1921 : : ctx.importBooleanProperty( OUString( "Tabstop" ),
1922 : : OUString( "tabstop" ),
1923 [ # # ]: 0 : _xAttributes );
1924 : : ctx.importBooleanProperty( OUString( "MultiSelection" ),
1925 : : OUString( "multiselection" ),
1926 [ # # ]: 0 : _xAttributes );
1927 : : ctx.importBooleanProperty( OUString( "ReadOnly" ),
1928 : : OUString( "readonly" ),
1929 [ # # ]: 0 : _xAttributes );
1930 : : ctx.importBooleanProperty( OUString( "Dropdown" ),
1931 : : OUString( "spin" ),
1932 [ # # ]: 0 : _xAttributes );
1933 : : ctx.importShortProperty( OUString( "LineCount" ),
1934 : : OUString( "linecount" ),
1935 [ # # ]: 0 : _xAttributes );
1936 : : ctx.importAlignProperty( OUString( "Align" ),
1937 : : OUString( "align" ),
1938 [ # # ]: 0 : _xAttributes );
1939 [ # # ][ # # ]: 0 : bool bHasLinkedCell = ctx.importDataAwareProperty( OUSTR("linked-cell" ), _xAttributes );
1940 [ # # ][ # # ]: 0 : bool bHasSrcRange = ctx.importDataAwareProperty( OUSTR("source-cell-range" ), _xAttributes );
1941 [ # # ]: 0 : if (_popup.is())
1942 : : {
1943 [ # # ][ # # ]: 0 : MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
1944 [ # # ]: 0 : if ( !bHasSrcRange )
1945 [ # # ][ # # ]: 0 : xControlModel->setPropertyValue( OUString( "StringItemList" ), makeAny( p->getItemValues() ) );
[ # # ][ # # ]
[ # # ]
1946 [ # # ]: 0 : if ( !bHasLinkedCell )
1947 [ # # ][ # # ]: 0 : xControlModel->setPropertyValue( OUString( "SelectedItems" ), makeAny( p->getSelectedItems() ) );
[ # # ][ # # ]
[ # # ]
1948 : :
1949 : : }
1950 [ # # ]: 0 : ctx.importEvents( _events );
1951 : : // avoid ring-reference:
1952 : : // vector< event elements > holding event elements holding this (via _pParent)
1953 [ # # ]: 0 : _events.clear();
1954 : 0 : }
1955 : :
1956 : : //##################################################################################################
1957 : :
1958 : : // combobox
1959 : : //__________________________________________________________________________________________________
1960 : 0 : Reference< xml::input::XElement > ComboBoxElement::startChildElement(
1961 : : sal_Int32 nUid, OUString const & rLocalName,
1962 : : Reference< xml::input::XAttributes > const & xAttributes )
1963 : : throw (xml::sax::SAXException, RuntimeException)
1964 : : {
1965 : : // event
1966 [ # # ]: 0 : if (_pImport->isEventElement( nUid, rLocalName ))
1967 : : {
1968 [ # # ][ # # ]: 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1969 : : }
1970 [ # # ]: 0 : else if (_pImport->XMLNS_DIALOGS_UID != nUid)
1971 : : {
1972 : : throw xml::sax::SAXException(
1973 : : OUString( "illegal namespace!" ),
1974 [ # # ]: 0 : Reference< XInterface >(), Any() );
1975 : : }
1976 : : // menupopup
1977 [ # # ]: 0 : else if ( rLocalName == "menupopup" )
1978 : : {
1979 [ # # ][ # # ]: 0 : _popup = new MenuPopupElement( rLocalName, xAttributes, this, _pImport );
1980 : 0 : return _popup;
1981 : : }
1982 : : else
1983 : : {
1984 : : throw xml::sax::SAXException(
1985 : : OUString( "expected event or menupopup element!" ),
1986 [ # # ]: 0 : Reference< XInterface >(), Any() );
1987 : : }
1988 : : }
1989 : : //__________________________________________________________________________________________________
1990 : 0 : void ComboBoxElement::endElement()
1991 : : throw (xml::sax::SAXException, RuntimeException)
1992 : : {
1993 : : ControlImportContext ctx(
1994 : : _pImport, getControlId( _xAttributes ),
1995 [ # # ][ # # ]: 0 : getControlModelName( OUString( "com.sun.star.awt.UnoControlComboBoxModel" ), _xAttributes ) );
[ # # ]
1996 [ # # ]: 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1997 : :
1998 [ # # ]: 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1999 [ # # ]: 0 : if (xStyle.is())
2000 : : {
2001 [ # # ][ # # ]: 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
2002 [ # # ]: 0 : pStyle->importBackgroundColorStyle( xControlModel );
2003 [ # # ]: 0 : pStyle->importTextColorStyle( xControlModel );
2004 [ # # ]: 0 : pStyle->importTextLineColorStyle( xControlModel );
2005 [ # # ]: 0 : pStyle->importBorderStyle( xControlModel );
2006 [ # # ]: 0 : pStyle->importFontStyle( xControlModel );
2007 : : }
2008 : :
2009 [ # # ]: 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
2010 : : ctx.importBooleanProperty( OUString( "Tabstop" ),
2011 : : OUString( "tabstop" ),
2012 [ # # ]: 0 : _xAttributes );
2013 : : ctx.importBooleanProperty( OUString( "ReadOnly" ),
2014 : : OUString( "readonly" ),
2015 [ # # ]: 0 : _xAttributes );
2016 : : ctx.importBooleanProperty( OUString( "Autocomplete" ),
2017 : : OUString( "autocomplete" ),
2018 [ # # ]: 0 : _xAttributes );
2019 : : ctx.importBooleanProperty( OUString( "Dropdown" ),
2020 : : OUString( "spin" ),
2021 [ # # ]: 0 : _xAttributes );
2022 : : ctx.importBooleanProperty(
2023 : : OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
2024 [ # # ][ # # ]: 0 : _xAttributes );
[ # # ]
2025 : : ctx.importShortProperty( OUString( "MaxTextLen" ),
2026 : : OUString( "maxlength" ),
2027 [ # # ]: 0 : _xAttributes );
2028 : : ctx.importShortProperty( OUString( "LineCount" ),
2029 : : OUString( "linecount" ),
2030 [ # # ]: 0 : _xAttributes );
2031 : : ctx.importStringProperty( OUString( "Text" ),
2032 : : OUString( "value" ),
2033 [ # # ]: 0 : _xAttributes );
2034 : : ctx.importAlignProperty( OUString( "Align" ),
2035 : : OUString( "align" ),
2036 [ # # ]: 0 : _xAttributes );
2037 [ # # ][ # # ]: 0 : ctx.importDataAwareProperty( OUSTR("linked-cell" ), _xAttributes );
2038 [ # # ][ # # ]: 0 : bool bHasSrcRange = ctx.importDataAwareProperty( OUSTR("source-cell-range" ), _xAttributes );
2039 [ # # ][ # # ]: 0 : if (_popup.is() && !bHasSrcRange )
[ # # ]
2040 : : {
2041 [ # # ][ # # ]: 0 : MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
2042 [ # # ]: 0 : xControlModel->setPropertyValue( OUString( "StringItemList" ),
2043 [ # # ][ # # ]: 0 : makeAny( p->getItemValues() ) );
[ # # ][ # # ]
2044 : : }
2045 : :
2046 [ # # ]: 0 : ctx.importEvents( _events );
2047 : : // avoid ring-reference:
2048 : : // vector< event elements > holding event elements holding this (via _pParent)
2049 [ # # ]: 0 : _events.clear();
2050 : 0 : }
2051 : :
2052 : : //##################################################################################################
2053 : :
2054 : : // checkbox
2055 : : //__________________________________________________________________________________________________
2056 : 0 : Reference< xml::input::XElement > CheckBoxElement::startChildElement(
2057 : : sal_Int32 nUid, OUString const & rLocalName,
2058 : : Reference< xml::input::XAttributes > const & xAttributes )
2059 : : throw (xml::sax::SAXException, RuntimeException)
2060 : : {
2061 : : // event
2062 [ # # ]: 0 : if (_pImport->isEventElement( nUid, rLocalName ))
2063 : : {
2064 [ # # ][ # # ]: 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
2065 : : }
2066 : : else
2067 : : {
2068 : : throw xml::sax::SAXException(
2069 : : OUString( "expected event element!" ),
2070 [ # # ]: 0 : Reference< XInterface >(), Any() );
2071 : : }
2072 : : }
2073 : : //__________________________________________________________________________________________________
2074 : 0 : void CheckBoxElement::endElement()
2075 : : throw (xml::sax::SAXException, RuntimeException)
2076 : : {
2077 : : ControlImportContext ctx(
2078 : : _pImport, getControlId( _xAttributes ),
2079 [ # # ][ # # ]: 0 : OUString( "com.sun.star.awt.UnoControlCheckBoxModel" ) );
2080 [ # # ]: 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
2081 : :
2082 [ # # ]: 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
2083 [ # # ]: 0 : if (xStyle.is())
2084 : : {
2085 [ # # ][ # # ]: 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
2086 [ # # ]: 0 : pStyle->importBackgroundColorStyle( xControlModel );
2087 [ # # ]: 0 : pStyle->importTextColorStyle( xControlModel );
2088 [ # # ]: 0 : pStyle->importTextLineColorStyle( xControlModel );
2089 [ # # ]: 0 : pStyle->importFontStyle( xControlModel );
2090 [ # # ]: 0 : pStyle->importVisualEffectStyle( xControlModel );
2091 : : }
2092 : :
2093 [ # # ]: 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
2094 : : ctx.importBooleanProperty( OUString( "Tabstop" ),
2095 : : OUString( "tabstop" ),
2096 [ # # ]: 0 : _xAttributes );
2097 : : ctx.importStringProperty( OUString( "Label" ),
2098 : : OUString( "value" ),
2099 [ # # ]: 0 : _xAttributes );
2100 : : ctx.importAlignProperty( OUString( "Align" ),
2101 : : OUString( "align" ),
2102 [ # # ]: 0 : _xAttributes );
2103 : : ctx.importVerticalAlignProperty( OUString( "VerticalAlign" ),
2104 : : OUString( "valign" ),
2105 [ # # ]: 0 : _xAttributes );
2106 [ # # ][ # # ]: 0 : ctx.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "image-src" ), _xAttributes );
[ # # ]
2107 : : ctx.importImagePositionProperty( OUString( "ImagePosition" ),
2108 : : OUString( "image-position" ),
2109 [ # # ]: 0 : _xAttributes );
2110 : : ctx.importBooleanProperty( OUString( "MultiLine" ),
2111 : : OUString( "multiline" ),
2112 [ # # ]: 0 : _xAttributes );
2113 : :
2114 : :
2115 : 0 : sal_Bool bTriState = sal_False;
2116 [ # # # # ]: 0 : if (getBoolAttr( &bTriState,
2117 : : OUString( "tristate" ),
2118 : : _xAttributes,
2119 : 0 : _pImport->XMLNS_DIALOGS_UID ))
2120 : : {
2121 [ # # ]: 0 : xControlModel->setPropertyValue( OUString( "TriState" ),
2122 [ # # ][ # # ]: 0 : makeAny( bTriState ) );
2123 : : }
2124 : 0 : sal_Bool bChecked = sal_False;
2125 [ # # # # ]: 0 : if (getBoolAttr( &bChecked,
2126 : : OUString( "checked" ),
2127 : : _xAttributes,
2128 : 0 : _pImport->XMLNS_DIALOGS_UID ))
2129 : : {
2130 : : // has "checked" attribute
2131 [ # # ]: 0 : sal_Int16 nVal = (bChecked ? 1 : 0);
2132 [ # # ]: 0 : xControlModel->setPropertyValue( OUString( "State" ),
2133 [ # # ][ # # ]: 0 : makeAny( nVal ) );
2134 : : }
2135 : : else
2136 : : {
2137 [ # # ]: 0 : sal_Int16 nVal = (bTriState ? 2 : 0); // if tristate set, but checked omitted => dont know!
2138 [ # # ]: 0 : xControlModel->setPropertyValue( OUString( "State" ),
2139 [ # # ][ # # ]: 0 : makeAny( nVal ) );
2140 : : }
2141 : :
2142 [ # # ]: 0 : ctx.importEvents( _events );
2143 : : // avoid ring-reference:
2144 : : // vector< event elements > holding event elements holding this (via _pParent)
2145 [ # # ]: 0 : _events.clear();
2146 : 0 : }
2147 : :
2148 : : //##################################################################################################
2149 : :
2150 : : // button
2151 : : //__________________________________________________________________________________________________
2152 : 0 : Reference< xml::input::XElement > ButtonElement::startChildElement(
2153 : : sal_Int32 nUid, OUString const & rLocalName,
2154 : : Reference< xml::input::XAttributes > const & xAttributes )
2155 : : throw (xml::sax::SAXException, RuntimeException)
2156 : : {
2157 : : // event
2158 [ # # ]: 0 : if (_pImport->isEventElement( nUid, rLocalName ))
2159 : : {
2160 [ # # ][ # # ]: 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
2161 : : }
2162 : : else
2163 : : {
2164 : : throw xml::sax::SAXException(
2165 : : OUString( "expected event element!" ),
2166 [ # # ]: 0 : Reference< XInterface >(), Any() );
2167 : : }
2168 : : }
2169 : : //__________________________________________________________________________________________________
2170 : 0 : void ButtonElement::endElement()
2171 : : throw (xml::sax::SAXException, RuntimeException)
2172 : : {
2173 : : ControlImportContext ctx(
2174 : : _pImport, getControlId( _xAttributes ),
2175 [ # # ][ # # ]: 0 : OUString( "com.sun.star.awt.UnoControlButtonModel" ) );
2176 : :
2177 [ # # ]: 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
2178 [ # # ]: 0 : if (xStyle.is())
2179 : : {
2180 [ # # ][ # # ]: 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
2181 [ # # ]: 0 : Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
2182 [ # # ]: 0 : pStyle->importBackgroundColorStyle( xControlModel );
2183 [ # # ]: 0 : pStyle->importTextColorStyle( xControlModel );
2184 [ # # ]: 0 : pStyle->importTextLineColorStyle( xControlModel );
2185 [ # # ]: 0 : pStyle->importFontStyle( xControlModel );
2186 : : }
2187 : :
2188 [ # # ]: 0 : ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
2189 : : ctx.importBooleanProperty( OUString( "Tabstop" ),
2190 : : OUString( "tabstop" ),
2191 [ # # ]: 0 : _xAttributes );
2192 : : ctx.importStringProperty( OUString( "Label" ),
2193 : : OUString( "value" ),
2194 [ # # ]: 0 : _xAttributes );
2195 : : ctx.importAlignProperty( OUString( "Align" ),
2196 : : OUString( "align" ),
2197 [ # # ]: 0 : _xAttributes );
2198 : : ctx.importVerticalAlignProperty( OUString( "VerticalAlign" ),
2199 : : OUString( "valign" ),
2200 [ # # ]: 0 : _xAttributes );
2201 : : ctx.importBooleanProperty( OUString( "DefaultButton" ),
2202 : : OUString( "default" ),
2203 [ # # ]: 0 : _xAttributes );
2204 : : ctx.importButtonTypeProperty( OUString( "PushButtonType" ),
2205 : : OUString( "button-type" ),
2206 [ # # ]: 0 : _xAttributes );
2207 [ # # ][ # # ]: 0 : ctx.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "image-src" ), _xAttributes );
[ # # ]
2208 : : ctx.importImagePositionProperty( OUString( "ImagePosition" ),
2209 : : OUString( "image-position" ),
2210 [ # # ]: 0 : _xAttributes );
2211 : : ctx.importImageAlignProperty( OUString( "ImageAlign" ),
2212 : : OUString( "image-align" ),
2213 [ # # ]: 0 : _xAttributes );
2214 [ # # # # ]: 0 : if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
2215 [ # # ][ # # ]: 0 : _xAttributes ))
2216 [ # # ][ # # ]: 0 : ctx.getControlModel()->setPropertyValue(
2217 [ # # ][ # # ]: 0 : OUSTR("Repeat"), makeAny(true) );
[ # # ]
2218 : 0 : sal_Int32 toggled = 0;
2219 [ # # ][ # # ]: 0 : if (getLongAttr( &toggled, OUSTR("toggled"), _xAttributes,
[ # # ]
2220 [ # # ][ # # ]: 0 : _pImport->XMLNS_DIALOGS_UID ) && toggled == 1)
[ # # ][ # # ]
2221 [ # # ][ # # ]: 0 : ctx.getControlModel()->setPropertyValue(OUSTR("Toggle"), makeAny(true));
[ # # ][ # # ]
[ # # ]
2222 : : ctx.importBooleanProperty( OUSTR("FocusOnClick"), OUSTR("grab-focus"),
2223 [ # # ][ # # ]: 0 : _xAttributes );
[ # # ]
2224 : : ctx.importBooleanProperty( OUString( "MultiLine" ),
2225 : : OUString( "multiline" ),
2226 [ # # ]: 0 : _xAttributes );
2227 : : // State
2228 : 0 : sal_Bool bChecked = sal_False;
2229 [ # # ][ # # ]: 0 : if (getBoolAttr(
[ # # ]
2230 : : &bChecked,
2231 : : OUString( "checked" ),
2232 : : _xAttributes,
2233 [ # # ][ # # ]: 0 : _pImport->XMLNS_DIALOGS_UID ) &&
[ # # # # ]
[ # # ]
2234 : : bChecked)
2235 : : {
2236 : 0 : sal_Int16 nVal = 1;
2237 [ # # ][ # # ]: 0 : ctx.getControlModel()->setPropertyValue(
2238 [ # # ][ # # ]: 0 : OUString( "State" ), makeAny( nVal ) );
2239 : : }
2240 : :
2241 [ # # ]: 0 : ctx.importEvents( _events );
2242 : : // avoid ring-reference:
2243 : : // vector< event elements > holding event elements holding this (via _pParent)
2244 [ # # ]: 0 : _events.clear();
2245 : 0 : }
2246 : :
2247 : : //##################################################################################################
2248 : :
2249 : : // bulletinboard
2250 : : //__________________________________________________________________________________________________
2251 : 0 : Reference< xml::input::XElement > BulletinBoardElement::startChildElement(
2252 : : sal_Int32 nUid, OUString const & rLocalName,
2253 : : Reference< xml::input::XAttributes > const & xAttributes )
2254 : : throw (xml::sax::SAXException, RuntimeException)
2255 : : {
2256 [ # # ]: 0 : if (_pImport->XMLNS_DIALOGS_UID != nUid)
2257 : : {
2258 : : throw xml::sax::SAXException(
2259 : : OUString( "illegal namespace!" ),
2260 [ # # ]: 0 : Reference< XInterface >(), Any() );
2261 : : }
2262 : : // button
2263 [ # # ]: 0 : else if ( rLocalName == "button" )
2264 : : {
2265 [ # # ][ # # ]: 0 : return new ButtonElement( rLocalName, xAttributes, this, _pImport );
2266 : : }
2267 : : // checkbox
2268 [ # # ]: 0 : else if ( rLocalName == "checkbox" )
2269 : : {
2270 [ # # ][ # # ]: 0 : return new CheckBoxElement( rLocalName, xAttributes, this, _pImport );
2271 : : }
2272 : : // combobox
2273 [ # # ]: 0 : else if ( rLocalName == "combobox" )
2274 : : {
2275 [ # # ][ # # ]: 0 : return new ComboBoxElement( rLocalName, xAttributes, this, _pImport );
2276 : : }
2277 : : // listbox
2278 [ # # ]: 0 : else if ( rLocalName == "menulist" )
2279 : : {
2280 [ # # ][ # # ]: 0 : return new MenuListElement( rLocalName, xAttributes, this, _pImport );
2281 : : }
2282 : : // radiogroup
2283 [ # # ]: 0 : else if ( rLocalName == "radiogroup" )
2284 : : {
2285 [ # # ][ # # ]: 0 : return new RadioGroupElement( rLocalName, xAttributes, this, _pImport );
2286 : : }
2287 : : // titledbox
2288 [ # # ]: 0 : else if ( rLocalName == "titledbox" )
2289 : : {
2290 [ # # ][ # # ]: 0 : return new TitledBoxElement( rLocalName, xAttributes, this, _pImport );
2291 : : }
2292 : : // text
2293 [ # # ]: 0 : else if ( rLocalName == "text" )
2294 : : {
2295 [ # # ][ # # ]: 0 : return new TextElement( rLocalName, xAttributes, this, _pImport );
2296 : : }
2297 [ # # ]: 0 : else if ( rLocalName == "linklabel" )
2298 : : {
2299 [ # # ][ # # ]: 0 : return new FixedHyperLinkElement( rLocalName, xAttributes, this, _pImport );
2300 : : }
2301 : : // textfield
2302 [ # # ]: 0 : else if ( rLocalName == "textfield" )
2303 : : {
2304 [ # # ][ # # ]: 0 : return new TextFieldElement( rLocalName, xAttributes, this, _pImport );
2305 : : }
2306 : : // img
2307 [ # # ]: 0 : else if ( rLocalName == "img" )
2308 : : {
2309 [ # # ][ # # ]: 0 : return new ImageControlElement( rLocalName, xAttributes, this, _pImport );
2310 : : }
2311 : : // filecontrol
2312 [ # # ]: 0 : else if ( rLocalName == "filecontrol" )
2313 : : {
2314 [ # # ][ # # ]: 0 : return new FileControlElement( rLocalName, xAttributes, this, _pImport );
2315 : : }
2316 : : // treecontrol
2317 [ # # ]: 0 : else if ( rLocalName == "treecontrol" )
2318 : : {
2319 [ # # ][ # # ]: 0 : return new TreeControlElement( rLocalName, xAttributes, this, _pImport );
2320 : : }
2321 : : // currencyfield
2322 [ # # ]: 0 : else if ( rLocalName == "currencyfield" )
2323 : : {
2324 [ # # ][ # # ]: 0 : return new CurrencyFieldElement( rLocalName, xAttributes, this, _pImport );
2325 : : }
2326 : : // datefield
2327 [ # # ]: 0 : else if ( rLocalName == "datefield" )
2328 : : {
2329 [ # # ][ # # ]: 0 : return new DateFieldElement( rLocalName, xAttributes, this, _pImport );
2330 : : }
2331 : : // datefield
2332 [ # # ]: 0 : else if ( rLocalName == "numericfield" )
2333 : : {
2334 [ # # ][ # # ]: 0 : return new NumericFieldElement( rLocalName, xAttributes, this, _pImport );
2335 : : }
2336 : : // timefield
2337 [ # # ]: 0 : else if ( rLocalName == "timefield" )
2338 : : {
2339 [ # # ][ # # ]: 0 : return new TimeFieldElement( rLocalName, xAttributes, this, _pImport );
2340 : : }
2341 : : // patternfield
2342 [ # # ]: 0 : else if ( rLocalName == "patternfield" )
2343 : : {
2344 [ # # ][ # # ]: 0 : return new PatternFieldElement( rLocalName, xAttributes, this, _pImport );
2345 : : }
2346 : : // formattedfield
2347 [ # # ]: 0 : else if ( rLocalName == "formattedfield" )
2348 : : {
2349 [ # # ][ # # ]: 0 : return new FormattedFieldElement( rLocalName, xAttributes, this, _pImport );
2350 : : }
2351 : : // fixedline
2352 [ # # ]: 0 : else if ( rLocalName == "fixedline" )
2353 : : {
2354 [ # # ][ # # ]: 0 : return new FixedLineElement( rLocalName, xAttributes, this, _pImport );
2355 : : }
2356 : : // scrollbar
2357 [ # # ]: 0 : else if ( rLocalName == "scrollbar" )
2358 : : {
2359 [ # # ][ # # ]: 0 : return new ScrollBarElement( rLocalName, xAttributes, this, _pImport );
2360 : : }
2361 : : // spinbutton
2362 [ # # ]: 0 : else if ( rLocalName == "spinbutton" )
2363 : : {
2364 [ # # ][ # # ]: 0 : return new SpinButtonElement( rLocalName, xAttributes, this, _pImport );
2365 : : }
2366 : : // progressmeter
2367 [ # # ]: 0 : else if ( rLocalName == "progressmeter" )
2368 : : {
2369 [ # # ][ # # ]: 0 : return new ProgressBarElement( rLocalName, xAttributes, this, _pImport );
2370 : : }
2371 [ # # ]: 0 : else if ( rLocalName == "multipage" )
2372 : : {
2373 [ # # ][ # # ]: 0 : return new MultiPage( rLocalName, xAttributes, this, _pImport );
2374 : : }
2375 [ # # ]: 0 : else if ( rLocalName == "frame" )
2376 : : {
2377 [ # # ][ # # ]: 0 : return new Frame( rLocalName, xAttributes, this, _pImport );
2378 : : }
2379 [ # # ]: 0 : else if ( rLocalName == "page" )
2380 : : {
2381 [ # # ][ # # ]: 0 : return new Page( rLocalName, xAttributes, this, _pImport );
2382 : : }
2383 : : // bulletinboard
2384 [ # # ]: 0 : else if ( rLocalName == "bulletinboard" )
2385 : : {
2386 [ # # ][ # # ]: 0 : return new BulletinBoardElement( rLocalName, xAttributes, this, _pImport );
2387 : : }
2388 : : else
2389 : : {
2390 : : throw xml::sax::SAXException(
2391 : : OUString( "expected styles, bulletinboard or bulletinboard element, not: " ) + rLocalName,
2392 [ # # ]: 0 : Reference< XInterface >(), Any() );
2393 : : }
2394 : : }
2395 : : //__________________________________________________________________________________________________
2396 : 0 : BulletinBoardElement::BulletinBoardElement(
2397 : : OUString const & rLocalName,
2398 : : Reference< xml::input::XAttributes > const & xAttributes,
2399 : : ElementBase * pParent, DialogImport * pImport )
2400 : : SAL_THROW(())
2401 : 0 : : ControlElement( rLocalName, xAttributes, pParent, pImport )
2402 : : {
2403 : : OUString aValue(
2404 [ # # ]: 0 : _xAttributes->getValueByUidName(
2405 : : _pImport->XMLNS_DIALOGS_UID,
2406 [ # # ]: 0 : OUString( "left" ) ) );
2407 [ # # ]: 0 : if (!aValue.isEmpty())
2408 : : {
2409 : 0 : _nBasePosX += toInt32( aValue );
2410 : : }
2411 [ # # ]: 0 : aValue = _xAttributes->getValueByUidName(
2412 : : _pImport->XMLNS_DIALOGS_UID,
2413 [ # # ]: 0 : OUString( "top" ) );
2414 [ # # ]: 0 : if (!aValue.isEmpty())
2415 : : {
2416 : 0 : _nBasePosY += toInt32( aValue );
2417 : 0 : }
2418 : 0 : }
2419 : :
2420 : : //##################################################################################################
2421 : :
2422 : : // style
2423 : : //__________________________________________________________________________________________________
2424 : 0 : Reference< xml::input::XElement > StyleElement::startChildElement(
2425 : : sal_Int32 /*nUid*/, OUString const & /*rLocalName*/,
2426 : : Reference< xml::input::XAttributes > const & /*xAttributes*/ )
2427 : : throw (xml::sax::SAXException, RuntimeException)
2428 : : {
2429 : : throw xml::sax::SAXException(
2430 : : OUString( "unexpected sub elements of style!" ),
2431 [ # # ]: 0 : Reference< XInterface >(), Any() );
2432 : : }
2433 : : //__________________________________________________________________________________________________
2434 : 0 : void StyleElement::endElement()
2435 : : throw (xml::sax::SAXException, RuntimeException)
2436 : : {
2437 : 0 : Reference< xml::input::XAttributes > xStyle;
2438 : : OUString aStyleId(
2439 [ # # ]: 0 : _xAttributes->getValueByUidName(
2440 : : _pImport->XMLNS_DIALOGS_UID,
2441 [ # # ]: 0 : OUString( "style-id" ) ) );
2442 [ # # ]: 0 : if (!aStyleId.isEmpty())
2443 : : {
2444 [ # # ][ # # ]: 0 : _pImport->addStyle( aStyleId, this );
2445 : : }
2446 : : else
2447 : : {
2448 : : throw xml::sax::SAXException(
2449 : : OUString( "missing style-id attribute!" ),
2450 [ # # ]: 0 : Reference< XInterface >(), Any() );
2451 : 0 : }
2452 : 0 : }
2453 : :
2454 : : //##################################################################################################
2455 : :
2456 : : // styles
2457 : : //__________________________________________________________________________________________________
2458 : 0 : Reference< xml::input::XElement > StylesElement::startChildElement(
2459 : : sal_Int32 nUid, OUString const & rLocalName,
2460 : : Reference< xml::input::XAttributes > const & xAttributes )
2461 : : throw (xml::sax::SAXException, RuntimeException)
2462 : : {
2463 [ # # ]: 0 : if (_pImport->XMLNS_DIALOGS_UID != nUid)
2464 : : {
2465 : : throw xml::sax::SAXException(
2466 : : OUString( "illegal namespace!" ),
2467 [ # # ]: 0 : Reference< XInterface >(), Any() );
2468 : : }
2469 : : // style
2470 [ # # ]: 0 : else if ( rLocalName == "style" )
2471 : : {
2472 [ # # ][ # # ]: 0 : return new StyleElement( rLocalName, xAttributes, this, _pImport );
2473 : : }
2474 : : else
2475 : : {
2476 : : throw xml::sax::SAXException(
2477 : : OUString( "expected style element!" ),
2478 [ # # ]: 0 : Reference< XInterface >(), Any() );
2479 : : }
2480 : : }
2481 : :
2482 : : //##################################################################################################
2483 : :
2484 : : // window
2485 : : //__________________________________________________________________________________________________
2486 : 0 : Reference< xml::input::XElement > WindowElement::startChildElement(
2487 : : sal_Int32 nUid, OUString const & rLocalName,
2488 : : Reference< xml::input::XAttributes > const & xAttributes )
2489 : : throw (xml::sax::SAXException, RuntimeException)
2490 : : {
2491 : : // event
2492 [ # # ]: 0 : if (_pImport->isEventElement( nUid, rLocalName ))
2493 : : {
2494 [ # # ][ # # ]: 0 : return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
2495 : : }
2496 [ # # ]: 0 : else if (_pImport->XMLNS_DIALOGS_UID != nUid)
2497 : : {
2498 : : throw xml::sax::SAXException(
2499 : : OUString( "illegal namespace!" ),
2500 [ # # ]: 0 : Reference< XInterface >(), Any() );
2501 : : }
2502 : : // styles
2503 [ # # ]: 0 : else if ( rLocalName == "styles" )
2504 : : {
2505 [ # # ][ # # ]: 0 : return new StylesElement( rLocalName, xAttributes, this, _pImport );
2506 : : }
2507 : : // bulletinboard
2508 [ # # ]: 0 : else if ( rLocalName == "bulletinboard" )
2509 : : {
2510 [ # # ][ # # ]: 0 : return new BulletinBoardElement( rLocalName, xAttributes, this, _pImport );
2511 : : }
2512 : : else
2513 : : {
2514 : : throw xml::sax::SAXException(
2515 : : OUString( "expected styles ot bulletinboard element!" ),
2516 [ # # ]: 0 : Reference< XInterface >(), Any() );
2517 : : }
2518 : : }
2519 : : //__________________________________________________________________________________________________
2520 : 0 : void WindowElement::endElement()
2521 : : throw (xml::sax::SAXException, RuntimeException)
2522 : : {
2523 : : Reference< beans::XPropertySet > xProps(
2524 [ # # ]: 0 : _pImport->_xDialogModel, UNO_QUERY_THROW );
2525 [ # # ][ # # ]: 0 : ImportContext ctx( _pImport, xProps, getControlId( _xAttributes ) );
2526 : :
2527 [ # # ]: 0 : Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
2528 [ # # ]: 0 : if (xStyle.is())
2529 : : {
2530 [ # # ][ # # ]: 0 : StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
2531 [ # # ]: 0 : pStyle->importBackgroundColorStyle( xProps );
2532 [ # # ]: 0 : pStyle->importTextColorStyle( xProps );
2533 [ # # ]: 0 : pStyle->importTextLineColorStyle( xProps );
2534 [ # # ]: 0 : pStyle->importFontStyle( xProps );
2535 : : }
2536 : :
2537 [ # # ]: 0 : ctx.importDefaults( 0, 0, _xAttributes, false );
2538 : : ctx.importBooleanProperty(
2539 : : OUString( "Closeable" ),
2540 : : OUString( "closeable" ),
2541 [ # # ]: 0 : _xAttributes );
2542 : : ctx.importBooleanProperty(
2543 : : OUString( "Moveable" ),
2544 : : OUString( "moveable" ),
2545 [ # # ]: 0 : _xAttributes );
2546 : : ctx.importBooleanProperty(
2547 : : OUString( "Sizeable" ),
2548 : : OUString( "resizeable" ),
2549 [ # # ]: 0 : _xAttributes );
2550 : : ctx.importStringProperty(
2551 : : OUString( "Title" ),
2552 : : OUString( "title" ),
2553 [ # # ]: 0 : _xAttributes );
2554 : : ctx.importBooleanProperty(
2555 : : OUString( "Decoration" ),
2556 : : OUString( "withtitlebar" ),
2557 [ # # ]: 0 : _xAttributes );
2558 [ # # ][ # # ]: 0 : ctx.importImageURLProperty( OUSTR( "ImageURL" ), OUSTR( "image-src" ), _xAttributes );
[ # # ]
2559 [ # # ]: 0 : ctx.importEvents( _events );
2560 : : // avoid ring-reference:
2561 : : // vector< event elements > holding event elements holding this (via _pParent)
2562 [ # # ]: 0 : _events.clear();
2563 : 0 : }
2564 : :
2565 : : }
2566 : :
2567 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|