Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / xmlscript / source / xmldlg_imexp / xmldlg_expmodels.cxx
blobfec77d042c9c997a5cf04de9ee14397029e63d5c
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/lang/XServiceInfo.hpp>
30 #include <o3tl/any.hxx>
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 readImageOrGraphicAttr(XMLNS_DIALOGS_PREFIX ":image-src");
190 readImagePositionAttr( "ImagePosition", XMLNS_DIALOGS_PREFIX ":image-position" );
191 readImageAlignAttr( "ImageAlign", XMLNS_DIALOGS_PREFIX ":image-align" );
193 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
194 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
196 if (extract_throw<bool>( _xProps->getPropertyValue( "Toggle" ) ))
197 addAttribute( XMLNS_DIALOGS_PREFIX ":toggled", "1" );
199 readBoolAttr( "FocusOnClick", XMLNS_DIALOGS_PREFIX ":grab-focus" );
200 readBoolAttr( "MultiLine",XMLNS_DIALOGS_PREFIX ":multiline" );
202 // State
203 sal_Int16 nState = 0;
204 if (readProp( "State" ) >>= nState)
206 switch (nState)
208 case 0:
209 addAttribute( XMLNS_DIALOGS_PREFIX ":checked", "false" );
210 break;
211 case 1:
212 addAttribute( XMLNS_DIALOGS_PREFIX ":checked", "true" );
213 break;
214 default:
215 OSL_FAIL( "### unexpected radio state!" );
216 break;
220 readEvents();
223 void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles )
225 // collect styles
226 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 | 0x40 );
227 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
228 aStyle._set |= 0x1;
229 if (readProp( "TextColor" ) >>= aStyle._textColor)
230 aStyle._set |= 0x2;
231 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
232 aStyle._set |= 0x20;
233 if (readFontProps( this, aStyle ))
234 aStyle._set |= 0x8;
235 if (readProp( "VisualEffect" ) >>= aStyle._visualEffect)
236 aStyle._set |= 0x40;
237 if (aStyle._set)
239 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
242 // collect elements
243 readDefaults();
244 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
245 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX ":value" );
246 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
247 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
248 readImageOrGraphicAttr(XMLNS_DIALOGS_PREFIX ":image-src");
249 readImagePositionAttr( "ImagePosition", XMLNS_DIALOGS_PREFIX ":image-position" );
250 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX ":multiline" );
252 bool bTriState = false;
253 if ((readProp( "TriState" ) >>= bTriState) && bTriState)
255 addAttribute( XMLNS_DIALOGS_PREFIX ":tristate", "true" );
257 sal_Int16 nState = 0;
258 if (_xProps->getPropertyValue( "State" ) >>= nState)
260 switch (nState)
262 case 0:
263 addAttribute( XMLNS_DIALOGS_PREFIX ":checked", "false" );
264 break;
265 case 1:
266 addAttribute( XMLNS_DIALOGS_PREFIX ":checked", "true" );
267 break;
268 case 2: // tristate=true exported, checked omitted => don't know!
269 OSL_ENSURE( bTriState, "### detected tristate value, but TriState is not set!" );
270 break;
271 default:
272 OSL_FAIL( "### unexpected checkbox state!" );
273 break;
276 readEvents();
279 void ElementDescriptor::readComboBoxModel( StyleBag * all_styles )
281 // collect styles
282 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
283 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
284 aStyle._set |= 0x1;
285 if (readProp( "TextColor" ) >>= aStyle._textColor)
286 aStyle._set |= 0x2;
287 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
288 aStyle._set |= 0x20;
289 if (readBorderProps( this, aStyle ))
290 aStyle._set |= 0x4;
291 if (readFontProps( this, aStyle ))
292 aStyle._set |= 0x8;
293 if (aStyle._set)
295 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
298 // collect elements
299 readDefaults();
300 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
301 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":value" );
302 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
303 readBoolAttr( "Autocomplete", XMLNS_DIALOGS_PREFIX ":autocomplete" );
304 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
305 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
306 readBoolAttr( "Dropdown", XMLNS_DIALOGS_PREFIX ":spin" );
307 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX ":maxlength" );
308 readShortAttr( "LineCount", XMLNS_DIALOGS_PREFIX ":linecount" );
309 // Cell Range, Ref Cell etc.
310 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
311 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":source-cell-range" );
313 // string item list
314 Sequence< OUString > itemValues;
315 if ((readProp( "StringItemList" ) >>= itemValues) && itemValues.getLength() > 0)
317 ElementDescriptor * popup = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menupopup", _xDocument );
319 OUString const * pItemValues = itemValues.getConstArray();
320 for ( sal_Int32 nPos = 0; nPos < itemValues.getLength(); ++nPos )
322 ElementDescriptor * item = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menuitem", _xDocument );
323 item->addAttribute( XMLNS_DIALOGS_PREFIX ":value", pItemValues[ nPos ] );
324 popup->addSubElement( item );
327 addSubElement( popup );
329 readEvents();
332 void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
334 // collect styles
335 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
336 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
337 aStyle._set |= 0x1;
338 if (readProp( "TextColor" ) >>= aStyle._textColor)
339 aStyle._set |= 0x2;
340 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
341 aStyle._set |= 0x20;
342 if (readBorderProps( this, aStyle ))
343 aStyle._set |= 0x4;
344 if (readFontProps( this, aStyle ))
345 aStyle._set |= 0x8;
346 if (aStyle._set)
348 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
351 // collect elements
352 readDefaults();
353 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
354 readBoolAttr( "MultiSelection", XMLNS_DIALOGS_PREFIX ":multiselection" );
355 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
356 readBoolAttr( "Dropdown", XMLNS_DIALOGS_PREFIX ":spin" );
357 readShortAttr( "LineCount", XMLNS_DIALOGS_PREFIX ":linecount" );
358 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
359 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
360 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":source-cell-range" );
361 // string item list
362 Sequence< OUString > itemValues;
363 if ((readProp( "StringItemList" ) >>= itemValues) && itemValues.getLength() > 0)
365 ElementDescriptor * popup = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menupopup", _xDocument );
367 OUString const * pItemValues = itemValues.getConstArray();
368 sal_Int32 nPos;
369 for ( nPos = 0; nPos < itemValues.getLength(); ++nPos )
371 ElementDescriptor * item = new ElementDescriptor(_xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menuitem", _xDocument );
372 item->addAttribute( XMLNS_DIALOGS_PREFIX ":value", pItemValues[ nPos ] );
373 popup->addSubElement( item );
376 Sequence< sal_Int16 > selected;
377 if (readProp( "SelectedItems" ) >>= selected)
379 sal_Int16 const * pSelected = selected.getConstArray();
380 for ( nPos = selected.getLength(); nPos--; )
382 ElementDescriptor * item = static_cast< ElementDescriptor * >(
383 popup->getSubElement( pSelected[ nPos ] ).get() );
384 item->addAttribute( XMLNS_DIALOGS_PREFIX ":selected", "true" );
388 addSubElement( popup );
390 readEvents();
393 void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles )
395 // collect styles
396 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 | 0x40 );
397 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
398 aStyle._set |= 0x1;
399 if (readProp( "TextColor" ) >>= aStyle._textColor)
400 aStyle._set |= 0x2;
401 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
402 aStyle._set |= 0x20;
403 if (readFontProps( this, aStyle ))
404 aStyle._set |= 0x8;
405 if (readProp( "VisualEffect" ) >>= aStyle._visualEffect)
406 aStyle._set |= 0x40;
407 if (aStyle._set)
409 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id" , all_styles->getStyleId( aStyle ) );
412 // collect elements
413 readDefaults();
414 readBoolAttr("Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
415 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX ":value" );
416 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
417 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
418 readImageOrGraphicAttr(XMLNS_DIALOGS_PREFIX ":image-src");
419 readImagePositionAttr( "ImagePosition", XMLNS_DIALOGS_PREFIX ":image-position" );
420 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX ":multiline" );
421 readStringAttr( "GroupName", XMLNS_DIALOGS_PREFIX ":group-name" );
423 sal_Int16 nState = 0;
424 if (readProp( "State" ) >>= nState)
426 switch (nState)
428 case 0:
429 addAttribute(XMLNS_DIALOGS_PREFIX ":checked", "false" );
430 break;
431 case 1:
432 addAttribute( XMLNS_DIALOGS_PREFIX ":checked", "true" );
433 break;
434 default:
435 OSL_FAIL( "### unexpected radio state!" );
436 break;
439 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
440 readEvents();
443 void ElementDescriptor::readGroupBoxModel( StyleBag * all_styles )
445 // collect styles
446 Style aStyle( 0x2 | 0x8 | 0x20 );
447 if (readProp( "TextColor" ) >>= aStyle._textColor)
448 aStyle._set |= 0x2;
449 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
450 aStyle._set |= 0x20;
451 if (readFontProps( this, aStyle ))
452 aStyle._set |= 0x8;
453 if (aStyle._set)
455 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
458 // collect elements
459 readDefaults();
461 OUString aTitle;
462 if (readProp( "Label" ) >>= aTitle)
464 ElementDescriptor * title = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":title", _xDocument );
465 title->addAttribute( XMLNS_DIALOGS_PREFIX ":value", aTitle );
466 addSubElement( title );
469 readEvents();
472 void ElementDescriptor::readFixedTextModel( StyleBag * all_styles )
474 // collect styles
475 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
476 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
477 aStyle._set |= 0x1;
478 if (readProp( "TextColor" ) >>= aStyle._textColor)
479 aStyle._set |= 0x2;
480 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
481 aStyle._set |= 0x20;
482 if (readBorderProps( this, aStyle ))
483 aStyle._set |= 0x4;
484 if (readFontProps( this, aStyle ))
485 aStyle._set |= 0x8;
486 if (aStyle._set)
488 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
491 // collect elements
492 readDefaults();
493 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX ":value" );
494 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
495 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
496 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX ":multiline" );
497 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
498 readBoolAttr( "NoLabel", XMLNS_DIALOGS_PREFIX ":nolabel" );
499 readEvents();
502 void ElementDescriptor::readFixedHyperLinkModel( StyleBag * all_styles )
504 // collect styles
505 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
506 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
507 aStyle._set |= 0x1;
508 if (readProp( "TextColor" ) >>= aStyle._textColor)
509 aStyle._set |= 0x2;
510 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
511 aStyle._set |= 0x20;
512 if (readBorderProps( this, aStyle ))
513 aStyle._set |= 0x4;
514 if (readFontProps( this, aStyle ))
515 aStyle._set |= 0x8;
516 if (aStyle._set)
518 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
521 // collect elements
522 readDefaults();
523 readStringAttr( "Label",XMLNS_DIALOGS_PREFIX ":value" );
524 readStringAttr( "URL", XMLNS_DIALOGS_PREFIX ":url" );
525 readStringAttr( "Description", XMLNS_DIALOGS_PREFIX ":description" );
526 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
527 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
528 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX ":multiline" );
529 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
530 readBoolAttr( "NoLabel", XMLNS_DIALOGS_PREFIX ":nolabel" );
531 readEvents();
534 void ElementDescriptor::readEditModel( StyleBag * all_styles )
536 // collect styles
537 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
538 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
539 aStyle._set |= 0x1;
540 if (readProp( "TextColor" ) >>= aStyle._textColor)
541 aStyle._set |= 0x2;
542 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
543 aStyle._set |= 0x20;
544 if (readBorderProps( this, aStyle ))
545 aStyle._set |= 0x4;
546 if (readFontProps( this, aStyle ))
547 aStyle._set |= 0x8;
548 if (aStyle._set)
550 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
553 // collect elements
554 readDefaults();
555 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
556 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
557 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
558 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
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 = static_cast<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 readImageOrGraphicAttr(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 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
755 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
756 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
757 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
758 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
759 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
760 readShortAttr( "DecimalAccuracy", XMLNS_DIALOGS_PREFIX ":decimal-accuracy" );
761 readBoolAttr( "ShowThousandsSeparator", XMLNS_DIALOGS_PREFIX ":thousands-separator" );
762 readDoubleAttr( "Value", XMLNS_DIALOGS_PREFIX ":value" );
763 readDoubleAttr( "ValueMin", XMLNS_DIALOGS_PREFIX ":value-min" );
764 readDoubleAttr( "ValueMax", XMLNS_DIALOGS_PREFIX ":value-max" );
765 readDoubleAttr( "ValueStep", XMLNS_DIALOGS_PREFIX ":value-step" );
766 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX ":spin" );
767 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
768 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
769 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX ":enforce-format" );
770 readEvents();
773 void ElementDescriptor::readTimeFieldModel( StyleBag * all_styles )
775 // collect styles
776 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
777 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
778 aStyle._set |= 0x1;
779 if (readProp( "TextColor" ) >>= aStyle._textColor)
780 aStyle._set |= 0x2;
781 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
782 aStyle._set |= 0x20;
783 if (readBorderProps( this, aStyle ))
784 aStyle._set |= 0x4;
785 if (readFontProps( this, aStyle ))
786 aStyle._set |= 0x8;
787 if (aStyle._set)
789 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
792 // collect elements
793 readDefaults();
794 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop");
795 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
796 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
797 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
798 readTimeFormatAttr( "TimeFormat", XMLNS_DIALOGS_PREFIX ":time-format" );
799 readTimeAttr( "Time", XMLNS_DIALOGS_PREFIX ":value" );
800 readTimeAttr( "TimeMin", XMLNS_DIALOGS_PREFIX ":value-min" );
801 readTimeAttr( "TimeMax", XMLNS_DIALOGS_PREFIX ":value-max" );
802 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX ":spin" );
803 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
804 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
805 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":text" );
806 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX ":enforce-format" );
807 readEvents();
810 void ElementDescriptor::readPatternFieldModel( StyleBag * all_styles )
812 // collect styles
813 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
814 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
815 aStyle._set |= 0x1;
816 if (readProp( "TextColor" ) >>= aStyle._textColor)
817 aStyle._set |= 0x2;
818 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
819 aStyle._set |= 0x20;
820 if (readBorderProps( this, aStyle ))
821 aStyle._set |= 0x4;
822 if (readFontProps( this, aStyle ))
823 aStyle._set |= 0x8;
824 if (aStyle._set)
826 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
829 // collect elements
830 readDefaults();
831 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
832 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
833 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
834 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
835 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":value" );
836 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX ":maxlength" );
837 readStringAttr( "EditMask", XMLNS_DIALOGS_PREFIX ":edit-mask" );
838 readStringAttr( "LiteralMask", XMLNS_DIALOGS_PREFIX ":literal-mask" );
839 readEvents();
842 void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles )
844 // collect styles
845 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
846 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
847 aStyle._set |= 0x1;
848 if (readProp( "TextColor" ) >>= aStyle._textColor)
849 aStyle._set |= 0x2;
850 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
851 aStyle._set |= 0x20;
852 if (readBorderProps( this, aStyle ))
853 aStyle._set |= 0x4;
854 if (readFontProps( this, aStyle ))
855 aStyle._set |= 0x8;
856 if (aStyle._set)
858 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
861 // collect elements
862 readDefaults();
863 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
864 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
865 readBoolAttr( "HideInactiveSelection",XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
866 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
867 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":text" );
868 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
869 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX ":maxlength" );
870 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX ":spin" );
871 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
872 readLongAttr( "RepeatDelay",XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
874 Any a( readProp( "EffectiveDefault" ) );
875 switch (a.getValueTypeClass())
877 case TypeClass_DOUBLE:
878 addAttribute( XMLNS_DIALOGS_PREFIX ":value-default", OUString::number( *o3tl::forceAccess<double>(a) ) );
879 break;
880 case TypeClass_STRING:
881 addAttribute( XMLNS_DIALOGS_PREFIX ":value-default", *o3tl::forceAccess<OUString>(a) );
882 break;
883 default:
884 break;
886 readDoubleAttr( "EffectiveMin", XMLNS_DIALOGS_PREFIX ":value-min" );
887 readDoubleAttr( "EffectiveMax", XMLNS_DIALOGS_PREFIX ":value-max" );
888 readDoubleAttr( "EffectiveValue", XMLNS_DIALOGS_PREFIX ":value" );
890 // format spec
891 sal_Int32 nKey = 0;
892 if (readProp( "FormatKey" ) >>= nKey)
894 Reference< util::XNumberFormatsSupplier > xSupplier;
895 if (readProp( "FormatsSupplier" ) >>= xSupplier)
897 addNumberFormatAttr(
898 xSupplier->getNumberFormats()->getByKey( nKey ) );
901 readBoolAttr( "TreatAsNumber", XMLNS_DIALOGS_PREFIX ":treat-as-number" );
902 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX ":enforce-format" );
904 readEvents();
907 void ElementDescriptor::readSpinButtonModel( StyleBag * all_styles )
909 // collect styles
910 Style aStyle( 0x1 | 0x4 );
911 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
912 aStyle._set |= 0x1;
913 if (readBorderProps( this, aStyle ))
914 aStyle._set |= 0x4;
915 if (aStyle._set)
917 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
920 // collect elements
921 readDefaults();
922 readOrientationAttr( "Orientation", XMLNS_DIALOGS_PREFIX ":align" );
923 readLongAttr( "SpinIncrement", XMLNS_DIALOGS_PREFIX ":increment" );
924 readLongAttr( "SpinValue", XMLNS_DIALOGS_PREFIX ":curval" );
925 readLongAttr( "SpinValueMax", XMLNS_DIALOGS_PREFIX ":maxval" );
926 readLongAttr( "SpinValueMin", XMLNS_DIALOGS_PREFIX ":minval" );
927 readLongAttr( "Repeat", XMLNS_DIALOGS_PREFIX ":repeat" );
928 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat-delay" );
929 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
930 readHexLongAttr( "SymbolColor", XMLNS_DIALOGS_PREFIX ":symbol-color" );
931 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
932 readEvents();
935 void ElementDescriptor::readFixedLineModel( StyleBag * all_styles )
937 // collect styles
938 Style aStyle( 0x2 | 0x8 | 0x20 );
939 if (readProp( "TextColor" ) >>= aStyle._textColor)
940 aStyle._set |= 0x2;
941 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
942 aStyle._set |= 0x20;
943 if (readFontProps( this, aStyle ))
944 aStyle._set |= 0x8;
945 if (aStyle._set)
947 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
950 // collect elements
951 readDefaults();
952 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX ":value" );
953 readOrientationAttr( "Orientation", XMLNS_DIALOGS_PREFIX ":align" );
954 readEvents();
957 void ElementDescriptor::readProgressBarModel( StyleBag * all_styles )
959 // collect styles
960 Style aStyle( 0x1 | 0x4 | 0x10 );
961 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
962 aStyle._set |= 0x1;
963 if (readBorderProps( this, aStyle ))
964 aStyle._set |= 0x4;
965 if (readProp( "FillColor" ) >>= aStyle._descr)
966 aStyle._set |= 0x10;
967 if (aStyle._set)
969 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
972 // collect elements
973 readDefaults();
974 readLongAttr( "ProgressValue", XMLNS_DIALOGS_PREFIX ":value" );
975 readLongAttr( "ProgressValueMin", XMLNS_DIALOGS_PREFIX ":value-min" );
976 readLongAttr( "ProgressValueMax", XMLNS_DIALOGS_PREFIX ":value-max" );
977 readEvents();
980 void ElementDescriptor::readScrollBarModel( StyleBag * all_styles )
982 // collect styles
983 Style aStyle( 0x1 | 0x4 );
984 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
985 aStyle._set |= 0x1;
986 if (readBorderProps( this, aStyle ))
987 aStyle._set |= 0x4;
988 if (aStyle._set)
990 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
993 // collect elements
994 readDefaults();
995 readOrientationAttr( "Orientation", XMLNS_DIALOGS_PREFIX ":align" );
996 readLongAttr( "BlockIncrement", XMLNS_DIALOGS_PREFIX ":pageincrement" );
997 readLongAttr( "LineIncrement", XMLNS_DIALOGS_PREFIX ":increment" );
998 readLongAttr( "ScrollValue", XMLNS_DIALOGS_PREFIX ":curpos" );
999 readLongAttr( "ScrollValueMax", XMLNS_DIALOGS_PREFIX ":maxpos" );
1000 readLongAttr( "ScrollValueMin", XMLNS_DIALOGS_PREFIX ":minpos" );
1001 readLongAttr( "VisibleSize", XMLNS_DIALOGS_PREFIX ":visible-size" );
1002 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat" );
1003 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
1004 readBoolAttr( "LiveScroll", XMLNS_DIALOGS_PREFIX ":live-scroll" );
1005 readHexLongAttr( "SymbolColor", XMLNS_DIALOGS_PREFIX ":symbol-color" );
1006 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
1007 readEvents();
1010 void ElementDescriptor::readDialogModel( StyleBag * all_styles )
1012 // collect elements
1013 addAttribute( "xmlns:" XMLNS_DIALOGS_PREFIX, XMLNS_DIALOGS_URI );
1014 addAttribute( "xmlns:" XMLNS_SCRIPT_PREFIX, XMLNS_SCRIPT_URI );
1016 // collect styles
1017 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
1018 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
1019 aStyle._set |= 0x1;
1020 if (readProp( "TextColor" ) >>= aStyle._textColor)
1021 aStyle._set |= 0x2;
1022 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
1023 aStyle._set |= 0x20;
1024 if (readFontProps( this, aStyle ))
1025 aStyle._set |= 0x8;
1026 if (aStyle._set)
1028 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
1031 // collect elements
1032 readDefaults( false, false );
1033 readBoolAttr("Closeable", XMLNS_DIALOGS_PREFIX ":closeable" );
1034 readBoolAttr( "Moveable", XMLNS_DIALOGS_PREFIX ":moveable" );
1035 readBoolAttr( "Sizeable", XMLNS_DIALOGS_PREFIX ":resizeable" );
1036 readStringAttr( "Title", XMLNS_DIALOGS_PREFIX ":title" );
1038 readScrollableSettings();
1039 Any aDecorationAny( _xProps->getPropertyValue( "Decoration" ) );
1040 bool bDecoration = false;
1041 if ( (aDecorationAny >>= bDecoration) && !bDecoration )
1042 addAttribute( XMLNS_DIALOGS_PREFIX ":withtitlebar", "false" );
1043 readImageOrGraphicAttr(XMLNS_DIALOGS_PREFIX ":image-src");
1044 readEvents();
1047 void ElementDescriptor::readBullitinBoard( StyleBag * all_styles )
1049 // collect elements
1050 ::std::vector< ElementDescriptor* > all_elements;
1051 // read out all props
1052 Reference< container::XNameContainer > xDialogModel( _xProps, UNO_QUERY );
1053 if ( !xDialogModel.is() )
1054 return; // #TODO throw???
1055 Sequence< OUString > aElements( xDialogModel->getElementNames() );
1056 OUString const * pElements = aElements.getConstArray();
1058 ElementDescriptor * pRadioGroup = nullptr;
1060 sal_Int32 nPos;
1061 for ( nPos = 0; nPos < aElements.getLength(); ++nPos )
1063 Any aControlModel( xDialogModel->getByName( pElements[ nPos ] ) );
1064 Reference< beans::XPropertySet > xProps;
1065 OSL_VERIFY( aControlModel >>= xProps );
1066 if (! xProps.is())
1067 continue;
1068 Reference< beans::XPropertyState > xPropState( xProps, UNO_QUERY );
1069 OSL_ENSURE( xPropState.is(), "no XPropertyState!" );
1070 if (! xPropState.is())
1071 continue;
1072 Reference< lang::XServiceInfo > xServiceInfo( xProps, UNO_QUERY );
1073 OSL_ENSURE( xServiceInfo.is(), "no XServiceInfo!" );
1074 if (! xServiceInfo.is())
1075 continue;
1077 ElementDescriptor * pElem = nullptr;
1079 // group up radio buttons
1080 if ( xServiceInfo->supportsService( "com.sun.star.awt.UnoControlRadioButtonModel" ) )
1082 if (! pRadioGroup) // open radiogroup
1084 pRadioGroup = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":radiogroup", _xDocument );
1085 all_elements.push_back( pRadioGroup );
1088 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":radio", _xDocument );
1089 pElem->readRadioButtonModel( all_styles );
1090 pRadioGroup->addSubElement( pElem );
1092 else // no radio
1094 pRadioGroup = nullptr; // close radiogroup
1096 if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlButtonModel" ) )
1098 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":button", _xDocument );
1099 pElem->readButtonModel( all_styles );
1101 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlCheckBoxModel" ) )
1103 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":checkbox", _xDocument );
1104 pElem->readCheckBoxModel( all_styles );
1106 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlComboBoxModel" ) )
1108 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":combobox", _xDocument );
1109 pElem->readComboBoxModel( all_styles );
1111 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlListBoxModel" ) )
1113 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":menulist", _xDocument );
1114 pElem->readListBoxModel( all_styles );
1116 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlGroupBoxModel" ) )
1118 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":titledbox", _xDocument );
1119 pElem->readGroupBoxModel( all_styles );
1121 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoMultiPageModel" ) )
1123 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":multipage", _xDocument );
1124 pElem->readMultiPageModel( all_styles );
1126 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoFrameModel" ) )
1128 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":frame", _xDocument );
1129 pElem->readFrameModel( all_styles );
1131 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoPageModel" ) )
1133 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":page", _xDocument );
1134 pElem->readPageModel( all_styles );
1136 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlFixedTextModel" ) )
1138 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":text", _xDocument );
1139 pElem->readFixedTextModel( all_styles );
1141 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlEditModel" ) )
1143 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":textfield", _xDocument );
1144 pElem->readEditModel( all_styles );
1146 // FixedHyperLink
1147 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlFixedHyperlinkModel" ) )
1149 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":linklabel", _xDocument );
1150 pElem->readFixedHyperLinkModel( all_styles );
1152 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlImageControlModel" ) )
1154 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":img", _xDocument );
1155 pElem->readImageControlModel( all_styles );
1157 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlFileControlModel" ) )
1159 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":filecontrol", _xDocument );
1160 pElem->readFileControlModel( all_styles );
1162 else if (xServiceInfo->supportsService( "com.sun.star.awt.tree.TreeControlModel" ) )
1164 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":treecontrol", _xDocument );
1165 pElem->readTreeControlModel( all_styles );
1167 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlCurrencyFieldModel" ) )
1169 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":currencyfield", _xDocument );
1170 pElem->readCurrencyFieldModel( all_styles );
1172 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlDateFieldModel" ) )
1174 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":datefield", _xDocument );
1175 pElem->readDateFieldModel( all_styles );
1177 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlNumericFieldModel" ) )
1179 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":numericfield", _xDocument );
1180 pElem->readNumericFieldModel( all_styles );
1182 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlTimeFieldModel" ) )
1184 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":timefield", _xDocument);
1185 pElem->readTimeFieldModel( all_styles );
1187 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlPatternFieldModel" ) )
1189 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":patternfield", _xDocument );
1190 pElem->readPatternFieldModel( all_styles );
1192 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlFormattedFieldModel" ) )
1194 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":formattedfield", _xDocument );
1195 pElem->readFormattedFieldModel( all_styles );
1197 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlFixedLineModel" ) )
1199 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":fixedline", _xDocument );
1200 pElem->readFixedLineModel( all_styles );
1202 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlScrollBarModel" ) )
1204 pElem = new ElementDescriptor(xProps, xPropState, XMLNS_DIALOGS_PREFIX ":scrollbar", _xDocument );
1205 pElem->readScrollBarModel( all_styles );
1207 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlSpinButtonModel" ) )
1209 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":spinbutton", _xDocument );
1210 pElem->readSpinButtonModel( all_styles );
1212 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlProgressBarModel" ) )
1214 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":progressmeter", _xDocument );
1215 pElem->readProgressBarModel( all_styles );
1218 if (pElem)
1220 all_elements.push_back( pElem );
1222 else
1224 OSL_FAIL( "unknown control type!" );
1225 continue;
1229 if (! all_elements.empty())
1231 for (ElementDescriptor* p : all_elements)
1233 addSubElement( p );
1240 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */