bump product version to 5.0.4.1
[LibreOffice.git] / xmlscript / source / xmldlg_imexp / xmldlg_expmodels.cxx
blob10d03ce7378a54f5eee9908235fbea4c1d2a3d7e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "exp_share.hxx"
22 #include <com/sun/star/form/binding/XListEntrySink.hpp>
23 #include <com/sun/star/form/binding/XBindableValue.hpp>
24 #include <com/sun/star/form/binding/XValueBinding.hpp>
25 #include <com/sun/star/table/CellAddress.hpp>
26 #include <com/sun/star/table/CellRangeAddress.hpp>
27 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
28 #include <com/sun/star/document/XStorageBasedDocument.hpp>
29 #include <com/sun/star/document/XGraphicObjectResolver.hpp>
30 #include <com/sun/star/lang/XServiceInfo.hpp>
32 using namespace ::com::sun::star;
33 using namespace ::com::sun::star::uno;
35 namespace xmlscript
38 static inline bool readBorderProps(
39 ElementDescriptor * element, Style & style )
41 if (element->readProp( &style._border, "Border" )) {
42 if (style._border == BORDER_SIMPLE /* simple */)
44 if (element->readProp( &style._borderColor, "BorderColor" ))
45 style._border = BORDER_SIMPLE_COLOR;
47 return true;
49 return false;
52 static inline bool readFontProps( ElementDescriptor * element, Style & style )
54 bool ret = element->readProp(
55 &style._descr, "FontDescriptor" );
56 ret |= element->readProp(
57 &style._fontEmphasisMark, "FontEmphasisMark" );
58 ret |= element->readProp(
59 &style._fontRelief, "FontRelief" );
60 return ret;
63 void ElementDescriptor::readMultiPageModel( StyleBag * all_styles )
65 // collect styles
66 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
67 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
68 aStyle._set |= 0x1;
69 if (readProp( "TextColor" ) >>= aStyle._textColor)
70 aStyle._set |= 0x2;
71 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
72 aStyle._set |= 0x20;
73 if (readFontProps( this, aStyle ))
74 aStyle._set |= 0x8;
75 if (aStyle._set)
77 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id" , all_styles->getStyleId( aStyle ) );
80 // collect elements
81 readDefaults();
82 readLongAttr( "MultiPageValue", XMLNS_DIALOGS_PREFIX ":value" );
83 Any aDecorationAny( _xProps->getPropertyValue( "Decoration" ) );
84 bool bDecoration = true;
85 if ( (aDecorationAny >>= bDecoration) && !bDecoration )
86 addAttribute( XMLNS_DIALOGS_PREFIX ":withtabs", "false" );
88 readEvents();
89 uno::Reference< container::XNameContainer > xPagesContainer( _xProps, uno::UNO_QUERY );
90 if ( xPagesContainer.is() && xPagesContainer->getElementNames().getLength() )
92 ElementDescriptor * pElem = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":bulletinboard", _xDocument );
93 pElem->readBullitinBoard( all_styles );
94 addSubElement( pElem );
98 void ElementDescriptor::readFrameModel( StyleBag * all_styles )
100 // collect styles
101 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
103 if (readProp( "TextColor" ) >>= aStyle._textColor)
104 aStyle._set |= 0x2;
105 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
106 aStyle._set |= 0x20;
107 if (readFontProps( this, aStyle ))
108 aStyle._set |= 0x8;
109 if (aStyle._set)
111 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
114 // collect elements
115 readDefaults();
116 OUString aTitle;
118 if ( readProp( "Label" ) >>= aTitle)
120 ElementDescriptor * title = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":title", _xDocument );
121 title->addAttribute( XMLNS_DIALOGS_PREFIX ":value", aTitle );
122 addSubElement( title );
124 uno::Reference< container::XNameContainer > xControlContainer( _xProps, uno::UNO_QUERY );
125 if ( xControlContainer.is() && xControlContainer->getElementNames().getLength() )
127 ElementDescriptor * pElem = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":bulletinboard", _xDocument );
128 pElem->readBullitinBoard( all_styles );
129 addSubElement( pElem );
131 readEvents();
134 void ElementDescriptor::readPageModel( StyleBag * all_styles )
136 // collect styles
137 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
138 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
139 aStyle._set |= 0x1;
140 if (readProp( "TextColor" ) >>= aStyle._textColor)
141 aStyle._set |= 0x2;
142 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
143 aStyle._set |= 0x20;
144 if (readFontProps( this, aStyle ))
145 aStyle._set |= 0x8;
146 if (aStyle._set)
148 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
151 // collect elements
152 readDefaults();
153 readStringAttr( "Title", XMLNS_DIALOGS_PREFIX ":title" );
154 uno::Reference< container::XNameContainer > xControlContainer( _xProps, uno::UNO_QUERY );
155 if ( xControlContainer.is() && xControlContainer->getElementNames().getLength() )
157 ElementDescriptor * pElem = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":bulletinboard", _xDocument );
158 pElem->readBullitinBoard( all_styles );
159 addSubElement( pElem );
161 readEvents();
164 void ElementDescriptor::readButtonModel( StyleBag * all_styles )
166 // collect styles
167 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
168 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
169 aStyle._set |= 0x1;
170 if (readProp( "TextColor" ) >>= aStyle._textColor)
171 aStyle._set |= 0x2;
172 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
173 aStyle._set |= 0x20;
174 if (readFontProps( this, aStyle ))
175 aStyle._set |= 0x8;
176 if (aStyle._set)
178 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
181 // collect elements
182 readDefaults();
183 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
184 readBoolAttr( "DefaultButton", XMLNS_DIALOGS_PREFIX ":default" );
185 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX ":value" );
186 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
187 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
188 readButtonTypeAttr( "PushButtonType", XMLNS_DIALOGS_PREFIX ":button-type" );
189 readImageURLAttr( "ImageURL", XMLNS_DIALOGS_PREFIX ":image-src" );
191 readImagePositionAttr( "ImagePosition", XMLNS_DIALOGS_PREFIX ":image-position" );
192 readImageAlignAttr( "ImageAlign", XMLNS_DIALOGS_PREFIX ":image-align" );
194 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
195 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
197 if (extract_throw<bool>( _xProps->getPropertyValue( "Toggle" ) ))
198 addAttribute( XMLNS_DIALOGS_PREFIX ":toggled", "1" );
200 readBoolAttr( "FocusOnClick", XMLNS_DIALOGS_PREFIX ":grab-focus" );
201 readBoolAttr( "MultiLine",XMLNS_DIALOGS_PREFIX ":multiline" );
203 // State
204 sal_Int16 nState = 0;
205 if (readProp( "State" ) >>= nState)
207 switch (nState)
209 case 0:
210 addAttribute( XMLNS_DIALOGS_PREFIX ":checked", "false" );
211 break;
212 case 1:
213 addAttribute( XMLNS_DIALOGS_PREFIX ":checked", "true" );
214 break;
215 default:
216 OSL_FAIL( "### unexpected radio state!" );
217 break;
221 readEvents();
224 void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles )
226 // collect styles
227 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 | 0x40 );
228 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
229 aStyle._set |= 0x1;
230 if (readProp( "TextColor" ) >>= aStyle._textColor)
231 aStyle._set |= 0x2;
232 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
233 aStyle._set |= 0x20;
234 if (readFontProps( this, aStyle ))
235 aStyle._set |= 0x8;
236 if (readProp( "VisualEffect" ) >>= aStyle._visualEffect)
237 aStyle._set |= 0x40;
238 if (aStyle._set)
240 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
243 // collect elements
244 readDefaults();
245 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
246 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX ":value" );
247 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
248 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
249 readImageURLAttr( "ImageURL", XMLNS_DIALOGS_PREFIX ":image-src" );
250 readImagePositionAttr( "ImagePosition", XMLNS_DIALOGS_PREFIX ":image-position" );
251 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX ":multiline" );
253 bool bTriState = false;
254 if ((readProp( "TriState" ) >>= bTriState) && bTriState)
256 addAttribute( XMLNS_DIALOGS_PREFIX ":tristate", "true" );
258 sal_Int16 nState = 0;
259 if (_xProps->getPropertyValue( "State" ) >>= nState)
261 switch (nState)
263 case 0:
264 addAttribute( XMLNS_DIALOGS_PREFIX ":checked", "false" );
265 break;
266 case 1:
267 addAttribute( XMLNS_DIALOGS_PREFIX ":checked", "true" );
268 break;
269 case 2: // tristate=true exported, checked omitted => dont know!
270 OSL_ENSURE( bTriState, "### detected tristate value, but TriState is not set!" );
271 break;
272 default:
273 OSL_FAIL( "### unexpected checkbox state!" );
274 break;
277 readEvents();
280 void ElementDescriptor::readComboBoxModel( StyleBag * all_styles )
282 // collect styles
283 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
284 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
285 aStyle._set |= 0x1;
286 if (readProp( "TextColor" ) >>= aStyle._textColor)
287 aStyle._set |= 0x2;
288 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
289 aStyle._set |= 0x20;
290 if (readBorderProps( this, aStyle ))
291 aStyle._set |= 0x4;
292 if (readFontProps( this, aStyle ))
293 aStyle._set |= 0x8;
294 if (aStyle._set)
296 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
299 // collect elements
300 readDefaults();
301 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
302 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":value" );
303 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
304 readBoolAttr( "Autocomplete", XMLNS_DIALOGS_PREFIX ":autocomplete" );
305 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
306 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
307 readBoolAttr( "Dropdown", XMLNS_DIALOGS_PREFIX ":spin" );
308 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX ":maxlength" );
309 readShortAttr( "LineCount", XMLNS_DIALOGS_PREFIX ":linecount" );
310 // Cell Range, Ref Cell etc.
311 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
312 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":source-cell-range" );
314 // string item list
315 Sequence< OUString > itemValues;
316 if ((readProp( "StringItemList" ) >>= itemValues) && itemValues.getLength() > 0)
318 ElementDescriptor * popup = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menupopup", _xDocument );
320 OUString const * pItemValues = itemValues.getConstArray();
321 for ( sal_Int32 nPos = 0; nPos < itemValues.getLength(); ++nPos )
323 ElementDescriptor * item = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menuitem", _xDocument );
324 item->addAttribute( XMLNS_DIALOGS_PREFIX ":value", pItemValues[ nPos ] );
325 popup->addSubElement( item );
328 addSubElement( popup );
330 readEvents();
333 void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
335 // collect styles
336 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
337 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
338 aStyle._set |= 0x1;
339 if (readProp( "TextColor" ) >>= aStyle._textColor)
340 aStyle._set |= 0x2;
341 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
342 aStyle._set |= 0x20;
343 if (readBorderProps( this, aStyle ))
344 aStyle._set |= 0x4;
345 if (readFontProps( this, aStyle ))
346 aStyle._set |= 0x8;
347 if (aStyle._set)
349 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
352 // collect elements
353 readDefaults();
354 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
355 readBoolAttr( "MultiSelection", XMLNS_DIALOGS_PREFIX ":multiselection" );
356 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
357 readBoolAttr( "Dropdown", XMLNS_DIALOGS_PREFIX ":spin" );
358 readShortAttr( "LineCount", XMLNS_DIALOGS_PREFIX ":linecount" );
359 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
360 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
361 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":source-cell-range" );
362 // string item list
363 Sequence< OUString > itemValues;
364 if ((readProp( "StringItemList" ) >>= itemValues) && itemValues.getLength() > 0)
366 ElementDescriptor * popup = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menupopup", _xDocument );
368 OUString const * pItemValues = itemValues.getConstArray();
369 sal_Int32 nPos;
370 for ( nPos = 0; nPos < itemValues.getLength(); ++nPos )
372 ElementDescriptor * item = new ElementDescriptor(_xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menuitem", _xDocument );
373 item->addAttribute( XMLNS_DIALOGS_PREFIX ":value", pItemValues[ nPos ] );
374 popup->addSubElement( item );
377 Sequence< sal_Int16 > selected;
378 if (readProp( "SelectedItems" ) >>= selected)
380 sal_Int16 const * pSelected = selected.getConstArray();
381 for ( nPos = selected.getLength(); nPos--; )
383 ElementDescriptor * item = static_cast< ElementDescriptor * >(
384 popup->getSubElement( pSelected[ nPos ] ).get() );
385 item->addAttribute( XMLNS_DIALOGS_PREFIX ":selected", "true" );
389 addSubElement( popup );
391 readEvents();
394 void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles )
396 // collect styles
397 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 | 0x40 );
398 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
399 aStyle._set |= 0x1;
400 if (readProp( "TextColor" ) >>= aStyle._textColor)
401 aStyle._set |= 0x2;
402 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
403 aStyle._set |= 0x20;
404 if (readFontProps( this, aStyle ))
405 aStyle._set |= 0x8;
406 if (readProp( "VisualEffect" ) >>= aStyle._visualEffect)
407 aStyle._set |= 0x40;
408 if (aStyle._set)
410 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id" , all_styles->getStyleId( aStyle ) );
413 // collect elements
414 readDefaults();
415 readBoolAttr("Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
416 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX ":value" );
417 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
418 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
419 readImageURLAttr( "ImageURL", XMLNS_DIALOGS_PREFIX ":image-src" );
420 readImagePositionAttr( "ImagePosition", XMLNS_DIALOGS_PREFIX ":image-position" );
421 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX ":multiline" );
422 readStringAttr( "GroupName", XMLNS_DIALOGS_PREFIX ":group-name" );
424 sal_Int16 nState = 0;
425 if (readProp( "State" ) >>= nState)
427 switch (nState)
429 case 0:
430 addAttribute(XMLNS_DIALOGS_PREFIX ":checked", "false" );
431 break;
432 case 1:
433 addAttribute( XMLNS_DIALOGS_PREFIX ":checked", "true" );
434 break;
435 default:
436 OSL_FAIL( "### unexpected radio state!" );
437 break;
440 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
441 readEvents();
444 void ElementDescriptor::readGroupBoxModel( StyleBag * all_styles )
446 // collect styles
447 Style aStyle( 0x2 | 0x8 | 0x20 );
448 if (readProp( "TextColor" ) >>= aStyle._textColor)
449 aStyle._set |= 0x2;
450 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
451 aStyle._set |= 0x20;
452 if (readFontProps( this, aStyle ))
453 aStyle._set |= 0x8;
454 if (aStyle._set)
456 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
459 // collect elements
460 readDefaults();
462 OUString aTitle;
463 if (readProp( "Label" ) >>= aTitle)
465 ElementDescriptor * title = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":title", _xDocument );
466 title->addAttribute( XMLNS_DIALOGS_PREFIX ":value", aTitle );
467 addSubElement( title );
470 readEvents();
473 void ElementDescriptor::readFixedTextModel( StyleBag * all_styles )
475 // collect styles
476 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
477 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
478 aStyle._set |= 0x1;
479 if (readProp( "TextColor" ) >>= aStyle._textColor)
480 aStyle._set |= 0x2;
481 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
482 aStyle._set |= 0x20;
483 if (readBorderProps( this, aStyle ))
484 aStyle._set |= 0x4;
485 if (readFontProps( this, aStyle ))
486 aStyle._set |= 0x8;
487 if (aStyle._set)
489 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
492 // collect elements
493 readDefaults();
494 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX ":value" );
495 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
496 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
497 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX ":multiline" );
498 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
499 readBoolAttr( "NoLabel", XMLNS_DIALOGS_PREFIX ":nolabel" );
500 readEvents();
503 void ElementDescriptor::readFixedHyperLinkModel( StyleBag * all_styles )
505 // collect styles
506 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
507 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
508 aStyle._set |= 0x1;
509 if (readProp( "TextColor" ) >>= aStyle._textColor)
510 aStyle._set |= 0x2;
511 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
512 aStyle._set |= 0x20;
513 if (readBorderProps( this, aStyle ))
514 aStyle._set |= 0x4;
515 if (readFontProps( this, aStyle ))
516 aStyle._set |= 0x8;
517 if (aStyle._set)
519 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
522 // collect elements
523 readDefaults();
524 readStringAttr( "Label",XMLNS_DIALOGS_PREFIX ":value" );
525 readStringAttr( "URL", XMLNS_DIALOGS_PREFIX ":url" );
526 readStringAttr( "Description", XMLNS_DIALOGS_PREFIX ":description" );
527 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
528 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
529 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX ":multiline" );
530 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
531 readBoolAttr( "NoLabel", XMLNS_DIALOGS_PREFIX ":nolabel" );
532 readEvents();
535 void ElementDescriptor::readEditModel( StyleBag * all_styles )
537 // collect styles
538 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
539 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
540 aStyle._set |= 0x1;
541 if (readProp( "TextColor" ) >>= aStyle._textColor)
542 aStyle._set |= 0x2;
543 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
544 aStyle._set |= 0x20;
545 if (readBorderProps( this, aStyle ))
546 aStyle._set |= 0x4;
547 if (readFontProps( this, aStyle ))
548 aStyle._set |= 0x8;
549 if (aStyle._set)
551 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
554 // collect elements
555 readDefaults();
556 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
557 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
558 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
559 readBoolAttr( "HardLineBreaks", XMLNS_DIALOGS_PREFIX ":hard-linebreaks" );
560 readBoolAttr( "HScroll", XMLNS_DIALOGS_PREFIX ":hscroll" );
561 readBoolAttr( "VScroll", XMLNS_DIALOGS_PREFIX ":vscroll" );
562 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX ":maxlength" );
563 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX ":multiline" );
564 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
565 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":value" );
566 readLineEndFormatAttr( "LineEndFormat", XMLNS_DIALOGS_PREFIX ":lineend-format" );
567 sal_Int16 nEcho = 0;
568 if (readProp( "EchoChar" ) >>= nEcho)
570 sal_Unicode cEcho = (sal_Unicode)nEcho;
571 addAttribute( XMLNS_DIALOGS_PREFIX ":echochar", OUString( &cEcho, 1 ) );
573 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
574 readEvents();
577 void ElementDescriptor::readImageControlModel( StyleBag * all_styles )
579 // collect styles
580 Style aStyle( 0x1 | 0x4 );
581 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
582 aStyle._set |= 0x1;
583 if (readBorderProps( this, aStyle ))
584 aStyle._set |= 0x4;
585 if (aStyle._set)
587 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
590 // collect elements
591 readDefaults();
592 readBoolAttr( "ScaleImage", XMLNS_DIALOGS_PREFIX ":scale-image" );
593 readImageScaleModeAttr( "ScaleMode", XMLNS_DIALOGS_PREFIX ":scale-mode" );
594 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
595 readImageURLAttr( "ImageURL", XMLNS_DIALOGS_PREFIX ":src" );
596 readEvents();
599 void ElementDescriptor::readFileControlModel( StyleBag * all_styles )
601 // collect styles
602 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
603 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
604 aStyle._set |= 0x1;
605 if (readProp( "TextColor" ) >>= aStyle._textColor)
606 aStyle._set |= 0x2;
607 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
608 aStyle._set |= 0x20;
609 if (readBorderProps( this, aStyle ))
610 aStyle._set |= 0x4;
611 if (readFontProps( this, aStyle ))
612 aStyle._set |= 0x8;
613 if (aStyle._set)
615 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
618 // collect elements
619 readDefaults();
620 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
621 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
622 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":value" );
623 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
624 readEvents();
627 void ElementDescriptor::readTreeControlModel( StyleBag * all_styles )
629 // collect styles
630 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
631 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
632 aStyle._set |= 0x1;
633 if (readBorderProps( this, aStyle ))
634 aStyle._set |= 0x4;
635 if (aStyle._set)
637 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
640 // collect elements
641 readDefaults();
642 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
643 readSelectionTypeAttr( "SelectionType", XMLNS_DIALOGS_PREFIX ":selectiontype" );
645 readBoolAttr( "RootDisplayed", XMLNS_DIALOGS_PREFIX ":rootdisplayed" );
646 readBoolAttr( "ShowsHandles", XMLNS_DIALOGS_PREFIX ":showshandles" );
647 readBoolAttr( "ShowsRootHandles", XMLNS_DIALOGS_PREFIX ":showsroothandles" );
648 readBoolAttr( "Editable", XMLNS_DIALOGS_PREFIX ":editable" );
649 readBoolAttr( "InvokesStopNodeEditing", XMLNS_DIALOGS_PREFIX ":invokesstopnodeediting" );
650 readLongAttr( "RowHeight", XMLNS_DIALOGS_PREFIX ":rowheight" );
651 readEvents();
654 void ElementDescriptor::readCurrencyFieldModel( StyleBag * all_styles )
656 // collect styles
657 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
658 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
659 aStyle._set |= 0x1;
660 if (readProp( "TextColor" ) >>= aStyle._textColor)
661 aStyle._set |= 0x2;
662 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
663 aStyle._set |= 0x20;
664 if (readBorderProps( this, aStyle ))
665 aStyle._set |= 0x4;
666 if (readFontProps( this, aStyle ))
667 aStyle._set |= 0x8;
668 if (aStyle._set)
670 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
673 // collect elements
674 readDefaults();
675 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
676 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
677 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
678 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
679 readStringAttr( "CurrencySymbol", XMLNS_DIALOGS_PREFIX ":currency-symbol" );
680 readShortAttr( "DecimalAccuracy", XMLNS_DIALOGS_PREFIX ":decimal-accuracy" );
681 readBoolAttr( "ShowThousandsSeparator", XMLNS_DIALOGS_PREFIX ":thousands-separator" );
682 readDoubleAttr( "Value", XMLNS_DIALOGS_PREFIX ":value" );
683 readDoubleAttr( "ValueMin", XMLNS_DIALOGS_PREFIX ":value-min" );
684 readDoubleAttr( "ValueMax", XMLNS_DIALOGS_PREFIX ":value-max" );
685 readDoubleAttr( "ValueStep", XMLNS_DIALOGS_PREFIX ":value-step" );
686 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX ":spin" );
687 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
688 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
689 readBoolAttr("PrependCurrencySymbol", XMLNS_DIALOGS_PREFIX ":prepend-symbol" );
690 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX ":enforce-format" );
691 readEvents();
694 void ElementDescriptor::readDateFieldModel( StyleBag * all_styles )
696 // collect styles
697 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
698 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
699 aStyle._set |= 0x1;
700 if (readProp( "TextColor" ) >>= aStyle._textColor)
701 aStyle._set |= 0x2;
702 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
703 aStyle._set |= 0x20;
704 if (readBorderProps( this, aStyle ))
705 aStyle._set |= 0x4;
706 if (readFontProps( this, aStyle ))
707 aStyle._set |= 0x8;
708 if (aStyle._set)
710 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
713 // collect elements
714 readDefaults();
715 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
716 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
717 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
718 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
719 readDateFormatAttr( "DateFormat", XMLNS_DIALOGS_PREFIX ":date-format" );
720 readBoolAttr( "DateShowCentury", XMLNS_DIALOGS_PREFIX ":show-century" );
721 readDateAttr( "Date", XMLNS_DIALOGS_PREFIX ":value" );
722 readDateAttr( "DateMin", XMLNS_DIALOGS_PREFIX ":value-min" );
723 readDateAttr( "DateMax", XMLNS_DIALOGS_PREFIX ":value-max" );
724 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX ":spin" );
725 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
726 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
727 readBoolAttr( "Dropdown", XMLNS_DIALOGS_PREFIX ":dropdown" );
728 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":text" );
729 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX ":enforce-format" );
730 readEvents();
733 void ElementDescriptor::readNumericFieldModel( StyleBag * all_styles )
735 // collect styles
736 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
737 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
738 aStyle._set |= 0x1;
739 if (readProp( "TextColor" ) >>= aStyle._textColor)
740 aStyle._set |= 0x2;
741 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
742 aStyle._set |= 0x20;
743 if (readBorderProps( this, aStyle ))
744 aStyle._set |= 0x4;
745 if (readFontProps( this, aStyle ))
746 aStyle._set |= 0x8;
747 if (aStyle._set)
749 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
752 // collect elements
753 readDefaults();
754 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
755 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
756 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
757 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
758 readShortAttr( "DecimalAccuracy", XMLNS_DIALOGS_PREFIX ":decimal-accuracy" );
759 readBoolAttr( "ShowThousandsSeparator", XMLNS_DIALOGS_PREFIX ":thousands-separator" );
760 readDoubleAttr( "Value", XMLNS_DIALOGS_PREFIX ":value" );
761 readDoubleAttr( "ValueMin", XMLNS_DIALOGS_PREFIX ":value-min" );
762 readDoubleAttr( "ValueMax", XMLNS_DIALOGS_PREFIX ":value-max" );
763 readDoubleAttr( "ValueStep", XMLNS_DIALOGS_PREFIX ":value-step" );
764 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX ":spin" );
765 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
766 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
767 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX ":enforce-format" );
768 readEvents();
771 void ElementDescriptor::readTimeFieldModel( StyleBag * all_styles )
773 // collect styles
774 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
775 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
776 aStyle._set |= 0x1;
777 if (readProp( "TextColor" ) >>= aStyle._textColor)
778 aStyle._set |= 0x2;
779 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
780 aStyle._set |= 0x20;
781 if (readBorderProps( this, aStyle ))
782 aStyle._set |= 0x4;
783 if (readFontProps( this, aStyle ))
784 aStyle._set |= 0x8;
785 if (aStyle._set)
787 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
790 // collect elements
791 readDefaults();
792 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop");
793 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
794 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
795 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
796 readTimeFormatAttr( "TimeFormat", XMLNS_DIALOGS_PREFIX ":time-format" );
797 readTimeAttr( "Time", XMLNS_DIALOGS_PREFIX ":value" );
798 readTimeAttr( "TimeMin", XMLNS_DIALOGS_PREFIX ":value-min" );
799 readTimeAttr( "TimeMax", XMLNS_DIALOGS_PREFIX ":value-max" );
800 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX ":spin" );
801 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
802 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
803 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":text" );
804 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX ":enforce-format" );
805 readEvents();
808 void ElementDescriptor::readPatternFieldModel( StyleBag * all_styles )
810 // collect styles
811 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
812 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
813 aStyle._set |= 0x1;
814 if (readProp( "TextColor" ) >>= aStyle._textColor)
815 aStyle._set |= 0x2;
816 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
817 aStyle._set |= 0x20;
818 if (readBorderProps( this, aStyle ))
819 aStyle._set |= 0x4;
820 if (readFontProps( this, aStyle ))
821 aStyle._set |= 0x8;
822 if (aStyle._set)
824 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
827 // collect elements
828 readDefaults();
829 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
830 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
831 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
832 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
833 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":value" );
834 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX ":maxlength" );
835 readStringAttr( "EditMask", XMLNS_DIALOGS_PREFIX ":edit-mask" );
836 readStringAttr( "LiteralMask", XMLNS_DIALOGS_PREFIX ":literal-mask" );
837 readEvents();
840 void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles )
842 // collect styles
843 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
844 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
845 aStyle._set |= 0x1;
846 if (readProp( "TextColor" ) >>= aStyle._textColor)
847 aStyle._set |= 0x2;
848 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
849 aStyle._set |= 0x20;
850 if (readBorderProps( this, aStyle ))
851 aStyle._set |= 0x4;
852 if (readFontProps( this, aStyle ))
853 aStyle._set |= 0x8;
854 if (aStyle._set)
856 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
859 // collect elements
860 readDefaults();
861 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
862 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
863 readBoolAttr( "HideInactiveSelection",XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
864 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
865 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":text" );
866 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
867 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX ":maxlength" );
868 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX ":spin" );
869 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
870 readLongAttr( "RepeatDelay",XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
872 Any a( readProp( "EffectiveDefault" ) );
873 switch (a.getValueTypeClass())
875 case TypeClass_DOUBLE:
876 addAttribute( XMLNS_DIALOGS_PREFIX ":value-default", OUString::number( *static_cast<double const *>(a.getValue()) ) );
877 break;
878 case TypeClass_STRING:
879 addAttribute( XMLNS_DIALOGS_PREFIX ":value-default", *static_cast<OUString const *>(a.getValue()) );
880 break;
881 default:
882 break;
884 readDoubleAttr( "EffectiveMin", XMLNS_DIALOGS_PREFIX ":value-min" );
885 readDoubleAttr( "EffectiveMax", XMLNS_DIALOGS_PREFIX ":value-max" );
886 readDoubleAttr( "EffectiveValue", XMLNS_DIALOGS_PREFIX ":value" );
888 // format spec
889 sal_Int32 nKey = 0;
890 if (readProp( "FormatKey" ) >>= nKey)
892 Reference< util::XNumberFormatsSupplier > xSupplier;
893 if (readProp( "FormatsSupplier" ) >>= xSupplier)
895 addNumberFormatAttr(
896 xSupplier->getNumberFormats()->getByKey( nKey ) );
899 readBoolAttr( "TreatAsNumber", XMLNS_DIALOGS_PREFIX ":treat-as-number" );
900 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX ":enforce-format" );
902 readEvents();
905 void ElementDescriptor::readSpinButtonModel( StyleBag * all_styles )
907 // collect styles
908 Style aStyle( 0x1 | 0x4 );
909 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
910 aStyle._set |= 0x1;
911 if (readBorderProps( this, aStyle ))
912 aStyle._set |= 0x4;
913 if (aStyle._set)
915 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
918 // collect elements
919 readDefaults();
920 readOrientationAttr( "Orientation", XMLNS_DIALOGS_PREFIX ":align" );
921 readLongAttr( "SpinIncrement", XMLNS_DIALOGS_PREFIX ":increment" );
922 readLongAttr( "SpinValue", XMLNS_DIALOGS_PREFIX ":curval" );
923 readLongAttr( "SpinValueMax", XMLNS_DIALOGS_PREFIX ":maxval" );
924 readLongAttr( "SpinValueMin", XMLNS_DIALOGS_PREFIX ":minval" );
925 readLongAttr( "Repeat", XMLNS_DIALOGS_PREFIX ":repeat" );
926 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat-delay" );
927 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
928 readHexLongAttr( "SymbolColor", XMLNS_DIALOGS_PREFIX ":symbol-color" );
929 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
930 readEvents();
933 void ElementDescriptor::readFixedLineModel( StyleBag * all_styles )
935 // collect styles
936 Style aStyle( 0x2 | 0x8 | 0x20 );
937 if (readProp( "TextColor" ) >>= aStyle._textColor)
938 aStyle._set |= 0x2;
939 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
940 aStyle._set |= 0x20;
941 if (readFontProps( this, aStyle ))
942 aStyle._set |= 0x8;
943 if (aStyle._set)
945 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
948 // collect elements
949 readDefaults();
950 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX ":value" );
951 readOrientationAttr( "Orientation", XMLNS_DIALOGS_PREFIX ":align" );
952 readEvents();
955 void ElementDescriptor::readProgressBarModel( StyleBag * all_styles )
957 // collect styles
958 Style aStyle( 0x1 | 0x4 | 0x10 );
959 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
960 aStyle._set |= 0x1;
961 if (readBorderProps( this, aStyle ))
962 aStyle._set |= 0x4;
963 if (readProp( "FillColor" ) >>= aStyle._descr)
964 aStyle._set |= 0x10;
965 if (aStyle._set)
967 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
970 // collect elements
971 readDefaults();
972 readLongAttr( "ProgressValue", XMLNS_DIALOGS_PREFIX ":value" );
973 readLongAttr( "ProgressValueMin", XMLNS_DIALOGS_PREFIX ":value-min" );
974 readLongAttr( "ProgressValueMax", XMLNS_DIALOGS_PREFIX ":value-max" );
975 readEvents();
978 void ElementDescriptor::readScrollBarModel( StyleBag * all_styles )
980 // collect styles
981 Style aStyle( 0x1 | 0x4 );
982 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
983 aStyle._set |= 0x1;
984 if (readBorderProps( this, aStyle ))
985 aStyle._set |= 0x4;
986 if (aStyle._set)
988 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
991 // collect elements
992 readDefaults();
993 readOrientationAttr( "Orientation", XMLNS_DIALOGS_PREFIX ":align" );
994 readLongAttr( "BlockIncrement", XMLNS_DIALOGS_PREFIX ":pageincrement" );
995 readLongAttr( "LineIncrement", XMLNS_DIALOGS_PREFIX ":increment" );
996 readLongAttr( "ScrollValue", XMLNS_DIALOGS_PREFIX ":curpos" );
997 readLongAttr( "ScrollValueMax", XMLNS_DIALOGS_PREFIX ":maxpos" );
998 readLongAttr( "ScrollValueMin", XMLNS_DIALOGS_PREFIX ":minpos" );
999 readLongAttr( "VisibleSize", XMLNS_DIALOGS_PREFIX ":visible-size" );
1000 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat" );
1001 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
1002 readBoolAttr( "LiveScroll", XMLNS_DIALOGS_PREFIX ":live-scroll" );
1003 readHexLongAttr( "SymbolColor", XMLNS_DIALOGS_PREFIX ":symbol-color" );
1004 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
1005 readEvents();
1008 void ElementDescriptor::readDialogModel( StyleBag * all_styles )
1010 // collect elements
1011 addAttribute( "xmlns:" XMLNS_DIALOGS_PREFIX, XMLNS_DIALOGS_URI );
1012 addAttribute( "xmlns:" XMLNS_SCRIPT_PREFIX, XMLNS_SCRIPT_URI );
1014 // collect styles
1015 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
1016 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
1017 aStyle._set |= 0x1;
1018 if (readProp( "TextColor" ) >>= aStyle._textColor)
1019 aStyle._set |= 0x2;
1020 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
1021 aStyle._set |= 0x20;
1022 if (readFontProps( this, aStyle ))
1023 aStyle._set |= 0x8;
1024 if (aStyle._set)
1026 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
1029 // collect elements
1030 readDefaults( false, false );
1031 readBoolAttr("Closeable", XMLNS_DIALOGS_PREFIX ":closeable" );
1032 readBoolAttr( "Moveable", XMLNS_DIALOGS_PREFIX ":moveable" );
1033 readBoolAttr( "Sizeable", XMLNS_DIALOGS_PREFIX ":resizeable" );
1034 readStringAttr( "Title", XMLNS_DIALOGS_PREFIX ":title" );
1036 readScrollableSettings();
1037 Any aDecorationAny( _xProps->getPropertyValue( "Decoration" ) );
1038 bool bDecoration = false;
1039 if ( (aDecorationAny >>= bDecoration) && !bDecoration )
1040 addAttribute( XMLNS_DIALOGS_PREFIX ":withtitlebar", "false" );
1041 readImageURLAttr( "ImageURL", XMLNS_DIALOGS_PREFIX ":image-src" );
1042 readEvents();
1045 void ElementDescriptor::readBullitinBoard( StyleBag * all_styles )
1047 // collect elements
1048 ::std::vector< ElementDescriptor* > all_elements;
1049 // read out all props
1050 Reference< container::XNameContainer > xDialogModel( _xProps, UNO_QUERY );
1051 if ( !xDialogModel.is() )
1052 return; // #TODO throw???
1053 Sequence< OUString > aElements( xDialogModel->getElementNames() );
1054 OUString const * pElements = aElements.getConstArray();
1056 ElementDescriptor * pRadioGroup = 0;
1058 sal_Int32 nPos;
1059 for ( nPos = 0; nPos < aElements.getLength(); ++nPos )
1061 Any aControlModel( xDialogModel->getByName( pElements[ nPos ] ) );
1062 Reference< beans::XPropertySet > xProps;
1063 OSL_VERIFY( aControlModel >>= xProps );
1064 if (! xProps.is())
1065 continue;
1066 Reference< beans::XPropertyState > xPropState( xProps, UNO_QUERY );
1067 OSL_ENSURE( xPropState.is(), "no XPropertyState!" );
1068 if (! xPropState.is())
1069 continue;
1070 Reference< lang::XServiceInfo > xServiceInfo( xProps, UNO_QUERY );
1071 OSL_ENSURE( xServiceInfo.is(), "no XServiceInfo!" );
1072 if (! xServiceInfo.is())
1073 continue;
1075 ElementDescriptor * pElem = 0;
1077 // group up radio buttons
1078 if ( xServiceInfo->supportsService( "com.sun.star.awt.UnoControlRadioButtonModel" ) )
1080 if (! pRadioGroup) // open radiogroup
1082 pRadioGroup = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":radiogroup", _xDocument );
1083 all_elements.push_back( pRadioGroup );
1086 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":radio", _xDocument );
1087 pElem->readRadioButtonModel( all_styles );
1088 pRadioGroup->addSubElement( pElem );
1090 else // no radio
1092 pRadioGroup = 0; // close radiogroup
1094 if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlButtonModel" ) )
1096 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":button", _xDocument );
1097 pElem->readButtonModel( all_styles );
1099 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlCheckBoxModel" ) )
1101 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":checkbox", _xDocument );
1102 pElem->readCheckBoxModel( all_styles );
1104 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlComboBoxModel" ) )
1106 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":combobox", _xDocument );
1107 pElem->readComboBoxModel( all_styles );
1109 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlListBoxModel" ) )
1111 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":menulist", _xDocument );
1112 pElem->readListBoxModel( all_styles );
1114 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlGroupBoxModel" ) )
1116 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":titledbox", _xDocument );
1117 pElem->readGroupBoxModel( all_styles );
1119 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoMultiPageModel" ) )
1121 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":multipage", _xDocument );
1122 pElem->readMultiPageModel( all_styles );
1124 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoFrameModel" ) )
1126 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":frame", _xDocument );
1127 pElem->readFrameModel( all_styles );
1129 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoPageModel" ) )
1131 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":page", _xDocument );
1132 pElem->readPageModel( all_styles );
1134 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlFixedTextModel" ) )
1136 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":text", _xDocument );
1137 pElem->readFixedTextModel( all_styles );
1139 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlEditModel" ) )
1141 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":textfield", _xDocument );
1142 pElem->readEditModel( all_styles );
1144 // FixedHyperLink
1145 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlFixedHyperlinkModel" ) )
1147 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":linklabel", _xDocument );
1148 pElem->readFixedHyperLinkModel( all_styles );
1150 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlImageControlModel" ) )
1152 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":img", _xDocument );
1153 pElem->readImageControlModel( all_styles );
1155 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlFileControlModel" ) )
1157 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":filecontrol", _xDocument );
1158 pElem->readFileControlModel( all_styles );
1160 else if (xServiceInfo->supportsService( "com.sun.star.awt.tree.TreeControlModel" ) )
1162 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":treecontrol", _xDocument );
1163 pElem->readTreeControlModel( all_styles );
1165 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlCurrencyFieldModel" ) )
1167 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":currencyfield", _xDocument );
1168 pElem->readCurrencyFieldModel( all_styles );
1170 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlDateFieldModel" ) )
1172 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":datefield", _xDocument );
1173 pElem->readDateFieldModel( all_styles );
1175 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlNumericFieldModel" ) )
1177 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":numericfield", _xDocument );
1178 pElem->readNumericFieldModel( all_styles );
1180 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlTimeFieldModel" ) )
1182 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":timefield", _xDocument);
1183 pElem->readTimeFieldModel( all_styles );
1185 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlPatternFieldModel" ) )
1187 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":patternfield", _xDocument );
1188 pElem->readPatternFieldModel( all_styles );
1190 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlFormattedFieldModel" ) )
1192 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":formattedfield", _xDocument );
1193 pElem->readFormattedFieldModel( all_styles );
1195 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlFixedLineModel" ) )
1197 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":fixedline", _xDocument );
1198 pElem->readFixedLineModel( all_styles );
1200 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlScrollBarModel" ) )
1202 pElem = new ElementDescriptor(xProps, xPropState, XMLNS_DIALOGS_PREFIX ":scrollbar", _xDocument );
1203 pElem->readScrollBarModel( all_styles );
1205 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlSpinButtonModel" ) )
1207 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":spinbutton", _xDocument );
1208 pElem->readSpinButtonModel( all_styles );
1210 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlProgressBarModel" ) )
1212 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":progressmeter", _xDocument );
1213 pElem->readProgressBarModel( all_styles );
1216 if (pElem)
1218 all_elements.push_back( pElem );
1220 else
1222 OSL_FAIL( "unknown control type!" );
1223 continue;
1227 if (! all_elements.empty())
1229 for ( std::size_t n = 0; n < all_elements.size(); ++n )
1231 addSubElement( all_elements[ n ] );
1238 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */