update credits
[LibreOffice.git] / xmlscript / source / xmldlg_imexp / xmldlg_expmodels.cxx
blob0646be0cc824b137a1e3c8263c2e3def2f0fe18d
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 "common.hxx"
21 #include "exp_share.hxx"
22 #include <misc.hxx>
23 #include <xmlscript/xmlns.h>
25 #include <com/sun/star/container/XNameContainer.hpp>
26 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <o3tl/any.hxx>
30 using namespace ::com::sun::star;
31 using namespace ::com::sun::star::uno;
33 namespace xmlscript
36 static bool readBorderProps(
37 ElementDescriptor * element, Style & style )
39 if (element->readProp( &style._border, "Border" )) {
40 if (style._border == BORDER_SIMPLE /* simple */)
42 if (element->readProp( &style._borderColor, "BorderColor" ))
43 style._border = BORDER_SIMPLE_COLOR;
45 return true;
47 return false;
50 static bool readFontProps( ElementDescriptor * element, Style & style )
52 bool ret = element->readProp(
53 &style._descr, "FontDescriptor" );
54 ret |= element->readProp(
55 &style._fontEmphasisMark, "FontEmphasisMark" );
56 ret |= element->readProp(
57 &style._fontRelief, "FontRelief" );
58 return ret;
61 void ElementDescriptor::readMultiPageModel( StyleBag * all_styles )
63 // collect styles
64 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
65 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
66 aStyle._set |= 0x1;
67 if (readProp( "TextColor" ) >>= aStyle._textColor)
68 aStyle._set |= 0x2;
69 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
70 aStyle._set |= 0x20;
71 if (readFontProps( this, aStyle ))
72 aStyle._set |= 0x8;
73 if (aStyle._set)
75 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id" , all_styles->getStyleId( aStyle ) );
78 // collect elements
79 readDefaults();
80 readLongAttr( "MultiPageValue", XMLNS_DIALOGS_PREFIX ":value" );
81 Any aDecorationAny( _xProps->getPropertyValue( "Decoration" ) );
82 bool bDecoration = true;
83 if ( (aDecorationAny >>= bDecoration) && !bDecoration )
84 addAttribute( XMLNS_DIALOGS_PREFIX ":withtabs", "false" );
86 readEvents();
87 uno::Reference< container::XNameContainer > xPagesContainer( _xProps, uno::UNO_QUERY );
88 if ( xPagesContainer.is() && xPagesContainer->getElementNames().hasElements() )
90 ElementDescriptor * pElem = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":bulletinboard", _xDocument );
91 pElem->readBullitinBoard( all_styles );
92 addSubElement( pElem );
96 void ElementDescriptor::readFrameModel( StyleBag * all_styles )
98 // collect styles
99 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
101 if (readProp( "TextColor" ) >>= aStyle._textColor)
102 aStyle._set |= 0x2;
103 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
104 aStyle._set |= 0x20;
105 if (readFontProps( this, aStyle ))
106 aStyle._set |= 0x8;
107 if (aStyle._set)
109 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
112 // collect elements
113 readDefaults();
114 OUString aTitle;
116 if ( readProp( "Label" ) >>= aTitle)
118 ElementDescriptor * title = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":title", _xDocument );
119 title->addAttribute( XMLNS_DIALOGS_PREFIX ":value", aTitle );
120 addSubElement( title );
122 uno::Reference< container::XNameContainer > xControlContainer( _xProps, uno::UNO_QUERY );
123 if ( xControlContainer.is() && xControlContainer->getElementNames().hasElements() )
125 ElementDescriptor * pElem = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":bulletinboard", _xDocument );
126 pElem->readBullitinBoard( all_styles );
127 addSubElement( pElem );
129 readEvents();
132 void ElementDescriptor::readPageModel( StyleBag * all_styles )
134 // collect styles
135 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
136 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
137 aStyle._set |= 0x1;
138 if (readProp( "TextColor" ) >>= aStyle._textColor)
139 aStyle._set |= 0x2;
140 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
141 aStyle._set |= 0x20;
142 if (readFontProps( this, aStyle ))
143 aStyle._set |= 0x8;
144 if (aStyle._set)
146 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
149 // collect elements
150 readDefaults();
151 readStringAttr( "Title", XMLNS_DIALOGS_PREFIX ":title" );
152 uno::Reference< container::XNameContainer > xControlContainer( _xProps, uno::UNO_QUERY );
153 if ( xControlContainer.is() && xControlContainer->getElementNames().hasElements() )
155 ElementDescriptor * pElem = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":bulletinboard", _xDocument );
156 pElem->readBullitinBoard( all_styles );
157 addSubElement( pElem );
159 readEvents();
162 void ElementDescriptor::readButtonModel( StyleBag * all_styles )
164 // collect styles
165 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
166 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
167 aStyle._set |= 0x1;
168 if (readProp( "TextColor" ) >>= aStyle._textColor)
169 aStyle._set |= 0x2;
170 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
171 aStyle._set |= 0x20;
172 if (readFontProps( this, aStyle ))
173 aStyle._set |= 0x8;
174 if (aStyle._set)
176 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
179 // collect elements
180 readDefaults();
181 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
182 readBoolAttr( "DefaultButton", XMLNS_DIALOGS_PREFIX ":default" );
183 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX ":value" );
184 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
185 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
186 readButtonTypeAttr( "PushButtonType", XMLNS_DIALOGS_PREFIX ":button-type" );
187 readImageOrGraphicAttr(XMLNS_DIALOGS_PREFIX ":image-src");
188 readImagePositionAttr( "ImagePosition", XMLNS_DIALOGS_PREFIX ":image-position" );
189 readImageAlignAttr( "ImageAlign", XMLNS_DIALOGS_PREFIX ":image-align" );
191 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
192 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
194 if (extract_throw<bool>( _xProps->getPropertyValue( "Toggle" ) ))
195 addAttribute( XMLNS_DIALOGS_PREFIX ":toggled", "1" );
197 readBoolAttr( "FocusOnClick", XMLNS_DIALOGS_PREFIX ":grab-focus" );
198 readBoolAttr( "MultiLine",XMLNS_DIALOGS_PREFIX ":multiline" );
200 // State
201 sal_Int16 nState = 0;
202 if (readProp( "State" ) >>= nState)
204 switch (nState)
206 case 0:
207 addAttribute( XMLNS_DIALOGS_PREFIX ":checked", "false" );
208 break;
209 case 1:
210 addAttribute( XMLNS_DIALOGS_PREFIX ":checked", "true" );
211 break;
212 default:
213 OSL_FAIL( "### unexpected radio state!" );
214 break;
218 readEvents();
221 void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles )
223 // collect styles
224 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 | 0x40 );
225 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
226 aStyle._set |= 0x1;
227 if (readProp( "TextColor" ) >>= aStyle._textColor)
228 aStyle._set |= 0x2;
229 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
230 aStyle._set |= 0x20;
231 if (readFontProps( this, aStyle ))
232 aStyle._set |= 0x8;
233 if (readProp( "VisualEffect" ) >>= aStyle._visualEffect)
234 aStyle._set |= 0x40;
235 if (aStyle._set)
237 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
240 // collect elements
241 readDefaults();
242 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
243 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX ":value" );
244 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
245 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
246 readImageOrGraphicAttr(XMLNS_DIALOGS_PREFIX ":image-src");
247 readImagePositionAttr( "ImagePosition", XMLNS_DIALOGS_PREFIX ":image-position" );
248 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX ":multiline" );
250 bool bTriState = false;
251 if ((readProp( "TriState" ) >>= bTriState) && bTriState)
253 addAttribute( XMLNS_DIALOGS_PREFIX ":tristate", "true" );
255 sal_Int16 nState = 0;
256 if (_xProps->getPropertyValue( "State" ) >>= nState)
258 switch (nState)
260 case 0:
261 addAttribute( XMLNS_DIALOGS_PREFIX ":checked", "false" );
262 break;
263 case 1:
264 addAttribute( XMLNS_DIALOGS_PREFIX ":checked", "true" );
265 break;
266 case 2: // tristate=true exported, checked omitted => don't know!
267 OSL_ENSURE( bTriState, "### detected tristate value, but TriState is not set!" );
268 break;
269 default:
270 OSL_FAIL( "### unexpected checkbox state!" );
271 break;
274 readEvents();
277 void ElementDescriptor::readComboBoxModel( StyleBag * all_styles )
279 // collect styles
280 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
281 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
282 aStyle._set |= 0x1;
283 if (readProp( "TextColor" ) >>= aStyle._textColor)
284 aStyle._set |= 0x2;
285 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
286 aStyle._set |= 0x20;
287 if (readBorderProps( this, aStyle ))
288 aStyle._set |= 0x4;
289 if (readFontProps( this, aStyle ))
290 aStyle._set |= 0x8;
291 if (aStyle._set)
293 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
296 // collect elements
297 readDefaults();
298 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
299 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":value" );
300 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
301 readBoolAttr( "Autocomplete", XMLNS_DIALOGS_PREFIX ":autocomplete" );
302 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
303 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
304 readBoolAttr( "Dropdown", XMLNS_DIALOGS_PREFIX ":spin" );
305 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX ":maxlength" );
306 readShortAttr( "LineCount", XMLNS_DIALOGS_PREFIX ":linecount" );
307 // Cell Range, Ref Cell etc.
308 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
309 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":source-cell-range" );
311 // string item list
312 Sequence< OUString > itemValues;
313 if ((readProp( "StringItemList" ) >>= itemValues) && itemValues.hasElements())
315 ElementDescriptor * popup = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menupopup", _xDocument );
317 for ( const auto& rItemValue : std::as_const(itemValues) )
319 ElementDescriptor * item = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menuitem", _xDocument );
320 item->addAttribute( XMLNS_DIALOGS_PREFIX ":value", rItemValue );
321 popup->addSubElement( item );
324 addSubElement( popup );
326 readEvents();
329 void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
331 // collect styles
332 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
333 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
334 aStyle._set |= 0x1;
335 if (readProp( "TextColor" ) >>= aStyle._textColor)
336 aStyle._set |= 0x2;
337 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
338 aStyle._set |= 0x20;
339 if (readBorderProps( this, aStyle ))
340 aStyle._set |= 0x4;
341 if (readFontProps( this, aStyle ))
342 aStyle._set |= 0x8;
343 if (aStyle._set)
345 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
348 // collect elements
349 readDefaults();
350 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
351 readBoolAttr( "MultiSelection", XMLNS_DIALOGS_PREFIX ":multiselection" );
352 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
353 readBoolAttr( "Dropdown", XMLNS_DIALOGS_PREFIX ":spin" );
354 readShortAttr( "LineCount", XMLNS_DIALOGS_PREFIX ":linecount" );
355 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
356 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
357 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":source-cell-range" );
358 // string item list
359 Sequence< OUString > itemValues;
360 if ((readProp( "StringItemList" ) >>= itemValues) && itemValues.hasElements())
362 ElementDescriptor * popup = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menupopup", _xDocument );
364 for ( const auto& rItemValue : std::as_const(itemValues) )
366 ElementDescriptor * item = new ElementDescriptor(_xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menuitem", _xDocument );
367 item->addAttribute( XMLNS_DIALOGS_PREFIX ":value", rItemValue );
368 popup->addSubElement( item );
371 Sequence< sal_Int16 > selected;
372 if (readProp( "SelectedItems" ) >>= selected)
374 sal_Int16 const * pSelected = selected.getConstArray();
375 for ( sal_Int32 nPos = selected.getLength(); nPos--; )
377 ElementDescriptor * item = static_cast< ElementDescriptor * >(
378 popup->getSubElement( pSelected[ nPos ] ).get() );
379 item->addAttribute( XMLNS_DIALOGS_PREFIX ":selected", "true" );
383 addSubElement( popup );
385 readEvents();
388 void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles )
390 // collect styles
391 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 | 0x40 );
392 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
393 aStyle._set |= 0x1;
394 if (readProp( "TextColor" ) >>= aStyle._textColor)
395 aStyle._set |= 0x2;
396 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
397 aStyle._set |= 0x20;
398 if (readFontProps( this, aStyle ))
399 aStyle._set |= 0x8;
400 if (readProp( "VisualEffect" ) >>= aStyle._visualEffect)
401 aStyle._set |= 0x40;
402 if (aStyle._set)
404 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id" , all_styles->getStyleId( aStyle ) );
407 // collect elements
408 readDefaults();
409 readBoolAttr("Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
410 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX ":value" );
411 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
412 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
413 readImageOrGraphicAttr(XMLNS_DIALOGS_PREFIX ":image-src");
414 readImagePositionAttr( "ImagePosition", XMLNS_DIALOGS_PREFIX ":image-position" );
415 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX ":multiline" );
416 readStringAttr( "GroupName", XMLNS_DIALOGS_PREFIX ":group-name" );
418 sal_Int16 nState = 0;
419 if (readProp( "State" ) >>= nState)
421 switch (nState)
423 case 0:
424 addAttribute(XMLNS_DIALOGS_PREFIX ":checked", "false" );
425 break;
426 case 1:
427 addAttribute( XMLNS_DIALOGS_PREFIX ":checked", "true" );
428 break;
429 default:
430 OSL_FAIL( "### unexpected radio state!" );
431 break;
434 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
435 readEvents();
438 void ElementDescriptor::readGroupBoxModel( StyleBag * all_styles )
440 // collect styles
441 Style aStyle( 0x2 | 0x8 | 0x20 );
442 if (readProp( "TextColor" ) >>= aStyle._textColor)
443 aStyle._set |= 0x2;
444 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
445 aStyle._set |= 0x20;
446 if (readFontProps( this, aStyle ))
447 aStyle._set |= 0x8;
448 if (aStyle._set)
450 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
453 // collect elements
454 readDefaults();
456 OUString aTitle;
457 if (readProp( "Label" ) >>= aTitle)
459 ElementDescriptor * title = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":title", _xDocument );
460 title->addAttribute( XMLNS_DIALOGS_PREFIX ":value", aTitle );
461 addSubElement( title );
464 readEvents();
467 void ElementDescriptor::readFixedTextModel( StyleBag * all_styles )
469 // collect styles
470 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
471 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
472 aStyle._set |= 0x1;
473 if (readProp( "TextColor" ) >>= aStyle._textColor)
474 aStyle._set |= 0x2;
475 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
476 aStyle._set |= 0x20;
477 if (readBorderProps( this, aStyle ))
478 aStyle._set |= 0x4;
479 if (readFontProps( this, aStyle ))
480 aStyle._set |= 0x8;
481 if (aStyle._set)
483 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
486 // collect elements
487 readDefaults();
488 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX ":value" );
489 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
490 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
491 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX ":multiline" );
492 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
493 readBoolAttr( "NoLabel", XMLNS_DIALOGS_PREFIX ":nolabel" );
494 readEvents();
497 void ElementDescriptor::readFixedHyperLinkModel( StyleBag * all_styles )
499 // collect styles
500 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
501 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
502 aStyle._set |= 0x1;
503 if (readProp( "TextColor" ) >>= aStyle._textColor)
504 aStyle._set |= 0x2;
505 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
506 aStyle._set |= 0x20;
507 if (readBorderProps( this, aStyle ))
508 aStyle._set |= 0x4;
509 if (readFontProps( this, aStyle ))
510 aStyle._set |= 0x8;
511 if (aStyle._set)
513 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
516 // collect elements
517 readDefaults();
518 readStringAttr( "Label",XMLNS_DIALOGS_PREFIX ":value" );
519 readStringAttr( "URL", XMLNS_DIALOGS_PREFIX ":url" );
520 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
521 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
522 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX ":multiline" );
523 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
524 readBoolAttr( "NoLabel", XMLNS_DIALOGS_PREFIX ":nolabel" );
525 readEvents();
528 void ElementDescriptor::readEditModel( StyleBag * all_styles )
530 // collect styles
531 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
532 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
533 aStyle._set |= 0x1;
534 if (readProp( "TextColor" ) >>= aStyle._textColor)
535 aStyle._set |= 0x2;
536 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
537 aStyle._set |= 0x20;
538 if (readBorderProps( this, aStyle ))
539 aStyle._set |= 0x4;
540 if (readFontProps( this, aStyle ))
541 aStyle._set |= 0x8;
542 if (aStyle._set)
544 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
547 // collect elements
548 readDefaults();
549 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
550 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
551 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
552 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
553 readBoolAttr( "HardLineBreaks", XMLNS_DIALOGS_PREFIX ":hard-linebreaks" );
554 readBoolAttr( "HScroll", XMLNS_DIALOGS_PREFIX ":hscroll" );
555 readBoolAttr( "VScroll", XMLNS_DIALOGS_PREFIX ":vscroll" );
556 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX ":maxlength" );
557 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX ":multiline" );
558 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
559 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":value" );
560 readLineEndFormatAttr( "LineEndFormat", XMLNS_DIALOGS_PREFIX ":lineend-format" );
561 sal_Int16 nEcho = 0;
562 if (readProp( "EchoChar" ) >>= nEcho)
564 sal_Unicode cEcho = static_cast<sal_Unicode>(nEcho);
565 addAttribute( XMLNS_DIALOGS_PREFIX ":echochar", OUString( &cEcho, 1 ) );
567 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
568 readEvents();
571 void ElementDescriptor::readImageControlModel( StyleBag * all_styles )
573 // collect styles
574 Style aStyle( 0x1 | 0x4 );
575 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
576 aStyle._set |= 0x1;
577 if (readBorderProps( this, aStyle ))
578 aStyle._set |= 0x4;
579 if (aStyle._set)
581 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
584 // collect elements
585 readDefaults();
586 readBoolAttr( "ScaleImage", XMLNS_DIALOGS_PREFIX ":scale-image" );
587 readImageScaleModeAttr( "ScaleMode", XMLNS_DIALOGS_PREFIX ":scale-mode" );
588 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
589 readImageOrGraphicAttr(XMLNS_DIALOGS_PREFIX ":src");
590 readEvents();
593 void ElementDescriptor::readFileControlModel( StyleBag * all_styles )
595 // collect styles
596 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
597 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
598 aStyle._set |= 0x1;
599 if (readProp( "TextColor" ) >>= aStyle._textColor)
600 aStyle._set |= 0x2;
601 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
602 aStyle._set |= 0x20;
603 if (readBorderProps( this, aStyle ))
604 aStyle._set |= 0x4;
605 if (readFontProps( this, aStyle ))
606 aStyle._set |= 0x8;
607 if (aStyle._set)
609 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
612 // collect elements
613 readDefaults();
614 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
615 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
616 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":value" );
617 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
618 readEvents();
621 void ElementDescriptor::readTreeControlModel( StyleBag * all_styles )
623 // collect styles
624 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
625 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
626 aStyle._set |= 0x1;
627 if (readBorderProps( this, aStyle ))
628 aStyle._set |= 0x4;
629 if (aStyle._set)
631 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
634 // collect elements
635 readDefaults();
636 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
637 readSelectionTypeAttr( "SelectionType", XMLNS_DIALOGS_PREFIX ":selectiontype" );
639 readBoolAttr( "RootDisplayed", XMLNS_DIALOGS_PREFIX ":rootdisplayed" );
640 readBoolAttr( "ShowsHandles", XMLNS_DIALOGS_PREFIX ":showshandles" );
641 readBoolAttr( "ShowsRootHandles", XMLNS_DIALOGS_PREFIX ":showsroothandles" );
642 readBoolAttr( "Editable", XMLNS_DIALOGS_PREFIX ":editable" );
643 readBoolAttr( "InvokesStopNodeEditing", XMLNS_DIALOGS_PREFIX ":invokesstopnodeediting" );
644 readLongAttr( "RowHeight", XMLNS_DIALOGS_PREFIX ":rowheight" );
645 readEvents();
648 void ElementDescriptor::readCurrencyFieldModel( StyleBag * all_styles )
650 // collect styles
651 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
652 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
653 aStyle._set |= 0x1;
654 if (readProp( "TextColor" ) >>= aStyle._textColor)
655 aStyle._set |= 0x2;
656 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
657 aStyle._set |= 0x20;
658 if (readBorderProps( this, aStyle ))
659 aStyle._set |= 0x4;
660 if (readFontProps( this, aStyle ))
661 aStyle._set |= 0x8;
662 if (aStyle._set)
664 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
667 // collect elements
668 readDefaults();
669 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
670 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
671 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
672 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
673 readStringAttr( "CurrencySymbol", XMLNS_DIALOGS_PREFIX ":currency-symbol" );
674 readShortAttr( "DecimalAccuracy", XMLNS_DIALOGS_PREFIX ":decimal-accuracy" );
675 readBoolAttr( "ShowThousandsSeparator", XMLNS_DIALOGS_PREFIX ":thousands-separator" );
676 readDoubleAttr( "Value", XMLNS_DIALOGS_PREFIX ":value" );
677 readDoubleAttr( "ValueMin", XMLNS_DIALOGS_PREFIX ":value-min" );
678 readDoubleAttr( "ValueMax", XMLNS_DIALOGS_PREFIX ":value-max" );
679 readDoubleAttr( "ValueStep", XMLNS_DIALOGS_PREFIX ":value-step" );
680 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX ":spin" );
681 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
682 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
683 readBoolAttr("PrependCurrencySymbol", XMLNS_DIALOGS_PREFIX ":prepend-symbol" );
684 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX ":enforce-format" );
685 readEvents();
688 void ElementDescriptor::readDateFieldModel( StyleBag * all_styles )
690 // collect styles
691 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
692 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
693 aStyle._set |= 0x1;
694 if (readProp( "TextColor" ) >>= aStyle._textColor)
695 aStyle._set |= 0x2;
696 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
697 aStyle._set |= 0x20;
698 if (readBorderProps( this, aStyle ))
699 aStyle._set |= 0x4;
700 if (readFontProps( this, aStyle ))
701 aStyle._set |= 0x8;
702 if (aStyle._set)
704 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
707 // collect elements
708 readDefaults();
709 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
710 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
711 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
712 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
713 readDateFormatAttr( "DateFormat", XMLNS_DIALOGS_PREFIX ":date-format" );
714 readBoolAttr( "DateShowCentury", XMLNS_DIALOGS_PREFIX ":show-century" );
715 readDateAttr( "Date", XMLNS_DIALOGS_PREFIX ":value" );
716 readDateAttr( "DateMin", XMLNS_DIALOGS_PREFIX ":value-min" );
717 readDateAttr( "DateMax", XMLNS_DIALOGS_PREFIX ":value-max" );
718 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX ":spin" );
719 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
720 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
721 readBoolAttr( "Dropdown", XMLNS_DIALOGS_PREFIX ":dropdown" );
722 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":text" );
723 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX ":enforce-format" );
724 readEvents();
727 void ElementDescriptor::readNumericFieldModel( StyleBag * all_styles )
729 // collect styles
730 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
731 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
732 aStyle._set |= 0x1;
733 if (readProp( "TextColor" ) >>= aStyle._textColor)
734 aStyle._set |= 0x2;
735 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
736 aStyle._set |= 0x20;
737 if (readBorderProps( this, aStyle ))
738 aStyle._set |= 0x4;
739 if (readFontProps( this, aStyle ))
740 aStyle._set |= 0x8;
741 if (aStyle._set)
743 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
746 // collect elements
747 readDefaults();
748 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
749 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
750 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
751 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
752 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
753 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
754 readShortAttr( "DecimalAccuracy", XMLNS_DIALOGS_PREFIX ":decimal-accuracy" );
755 readBoolAttr( "ShowThousandsSeparator", XMLNS_DIALOGS_PREFIX ":thousands-separator" );
756 readDoubleAttr( "Value", XMLNS_DIALOGS_PREFIX ":value" );
757 readDoubleAttr( "ValueMin", XMLNS_DIALOGS_PREFIX ":value-min" );
758 readDoubleAttr( "ValueMax", XMLNS_DIALOGS_PREFIX ":value-max" );
759 readDoubleAttr( "ValueStep", XMLNS_DIALOGS_PREFIX ":value-step" );
760 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX ":spin" );
761 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
762 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
763 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX ":enforce-format" );
764 readEvents();
767 void ElementDescriptor::readTimeFieldModel( StyleBag * all_styles )
769 // collect styles
770 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
771 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
772 aStyle._set |= 0x1;
773 if (readProp( "TextColor" ) >>= aStyle._textColor)
774 aStyle._set |= 0x2;
775 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
776 aStyle._set |= 0x20;
777 if (readBorderProps( this, aStyle ))
778 aStyle._set |= 0x4;
779 if (readFontProps( this, aStyle ))
780 aStyle._set |= 0x8;
781 if (aStyle._set)
783 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
786 // collect elements
787 readDefaults();
788 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop");
789 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
790 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
791 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
792 readTimeFormatAttr( "TimeFormat", XMLNS_DIALOGS_PREFIX ":time-format" );
793 readTimeAttr( "Time", XMLNS_DIALOGS_PREFIX ":value" );
794 readTimeAttr( "TimeMin", XMLNS_DIALOGS_PREFIX ":value-min" );
795 readTimeAttr( "TimeMax", XMLNS_DIALOGS_PREFIX ":value-max" );
796 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX ":spin" );
797 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
798 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
799 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":text" );
800 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX ":enforce-format" );
801 readEvents();
804 void ElementDescriptor::readPatternFieldModel( StyleBag * all_styles )
806 // collect styles
807 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
808 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
809 aStyle._set |= 0x1;
810 if (readProp( "TextColor" ) >>= aStyle._textColor)
811 aStyle._set |= 0x2;
812 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
813 aStyle._set |= 0x20;
814 if (readBorderProps( this, aStyle ))
815 aStyle._set |= 0x4;
816 if (readFontProps( this, aStyle ))
817 aStyle._set |= 0x8;
818 if (aStyle._set)
820 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
823 // collect elements
824 readDefaults();
825 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
826 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
827 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
828 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
829 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":value" );
830 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX ":maxlength" );
831 readStringAttr( "EditMask", XMLNS_DIALOGS_PREFIX ":edit-mask" );
832 readStringAttr( "LiteralMask", XMLNS_DIALOGS_PREFIX ":literal-mask" );
833 readEvents();
836 void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles )
838 // collect styles
839 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
840 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
841 aStyle._set |= 0x1;
842 if (readProp( "TextColor" ) >>= aStyle._textColor)
843 aStyle._set |= 0x2;
844 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
845 aStyle._set |= 0x20;
846 if (readBorderProps( this, aStyle ))
847 aStyle._set |= 0x4;
848 if (readFontProps( this, aStyle ))
849 aStyle._set |= 0x8;
850 if (aStyle._set)
852 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
855 // collect elements
856 readDefaults();
857 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
858 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
859 readBoolAttr( "HideInactiveSelection",XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
860 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
861 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":text" );
862 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
863 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX ":maxlength" );
864 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX ":spin" );
865 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
866 readLongAttr( "RepeatDelay",XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
868 Any a( readProp( "EffectiveDefault" ) );
869 switch (a.getValueTypeClass())
871 case TypeClass_DOUBLE:
872 addAttribute( XMLNS_DIALOGS_PREFIX ":value-default", OUString::number( *o3tl::forceAccess<double>(a) ) );
873 break;
874 case TypeClass_STRING:
875 addAttribute( XMLNS_DIALOGS_PREFIX ":value-default", *o3tl::forceAccess<OUString>(a) );
876 break;
877 default:
878 break;
880 readDoubleAttr( "EffectiveMin", XMLNS_DIALOGS_PREFIX ":value-min" );
881 readDoubleAttr( "EffectiveMax", XMLNS_DIALOGS_PREFIX ":value-max" );
882 readDoubleAttr( "EffectiveValue", XMLNS_DIALOGS_PREFIX ":value" );
884 // format spec
885 sal_Int32 nKey = 0;
886 if (readProp( "FormatKey" ) >>= nKey)
888 Reference< util::XNumberFormatsSupplier > xSupplier;
889 if (readProp( "FormatsSupplier" ) >>= xSupplier)
891 addNumberFormatAttr(
892 xSupplier->getNumberFormats()->getByKey( nKey ) );
895 readBoolAttr( "TreatAsNumber", XMLNS_DIALOGS_PREFIX ":treat-as-number" );
896 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX ":enforce-format" );
898 readEvents();
901 void ElementDescriptor::readSpinButtonModel( StyleBag * all_styles )
903 // collect styles
904 Style aStyle( 0x1 | 0x4 );
905 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
906 aStyle._set |= 0x1;
907 if (readBorderProps( this, aStyle ))
908 aStyle._set |= 0x4;
909 if (aStyle._set)
911 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
914 // collect elements
915 readDefaults();
916 readOrientationAttr( "Orientation", XMLNS_DIALOGS_PREFIX ":align" );
917 readLongAttr( "SpinIncrement", XMLNS_DIALOGS_PREFIX ":increment" );
918 readLongAttr( "SpinValue", XMLNS_DIALOGS_PREFIX ":curval" );
919 readLongAttr( "SpinValueMax", XMLNS_DIALOGS_PREFIX ":maxval" );
920 readLongAttr( "SpinValueMin", XMLNS_DIALOGS_PREFIX ":minval" );
921 readLongAttr( "Repeat", XMLNS_DIALOGS_PREFIX ":repeat" );
922 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat-delay" );
923 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
924 readHexLongAttr( "SymbolColor", XMLNS_DIALOGS_PREFIX ":symbol-color" );
925 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
926 readEvents();
929 void ElementDescriptor::readFixedLineModel( StyleBag * all_styles )
931 // collect styles
932 Style aStyle( 0x2 | 0x8 | 0x20 );
933 if (readProp( "TextColor" ) >>= aStyle._textColor)
934 aStyle._set |= 0x2;
935 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
936 aStyle._set |= 0x20;
937 if (readFontProps( this, aStyle ))
938 aStyle._set |= 0x8;
939 if (aStyle._set)
941 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
944 // collect elements
945 readDefaults();
946 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX ":value" );
947 readOrientationAttr( "Orientation", XMLNS_DIALOGS_PREFIX ":align" );
948 readEvents();
951 void ElementDescriptor::readProgressBarModel( StyleBag * all_styles )
953 // collect styles
954 Style aStyle( 0x1 | 0x4 | 0x10 );
955 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
956 aStyle._set |= 0x1;
957 if (readBorderProps( this, aStyle ))
958 aStyle._set |= 0x4;
959 if (readProp( "FillColor" ) >>= aStyle._descr)
960 aStyle._set |= 0x10;
961 if (aStyle._set)
963 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
966 // collect elements
967 readDefaults();
968 readLongAttr( "ProgressValue", XMLNS_DIALOGS_PREFIX ":value" );
969 readLongAttr( "ProgressValueMin", XMLNS_DIALOGS_PREFIX ":value-min" );
970 readLongAttr( "ProgressValueMax", XMLNS_DIALOGS_PREFIX ":value-max" );
971 readEvents();
974 void ElementDescriptor::readScrollBarModel( StyleBag * all_styles )
976 // collect styles
977 Style aStyle( 0x1 | 0x4 );
978 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
979 aStyle._set |= 0x1;
980 if (readBorderProps( this, aStyle ))
981 aStyle._set |= 0x4;
982 if (aStyle._set)
984 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
987 // collect elements
988 readDefaults();
989 readOrientationAttr( "Orientation", XMLNS_DIALOGS_PREFIX ":align" );
990 readLongAttr( "BlockIncrement", XMLNS_DIALOGS_PREFIX ":pageincrement" );
991 readLongAttr( "LineIncrement", XMLNS_DIALOGS_PREFIX ":increment" );
992 readLongAttr( "ScrollValue", XMLNS_DIALOGS_PREFIX ":curpos" );
993 readLongAttr( "ScrollValueMax", XMLNS_DIALOGS_PREFIX ":maxpos" );
994 readLongAttr( "ScrollValueMin", XMLNS_DIALOGS_PREFIX ":minpos" );
995 readLongAttr( "VisibleSize", XMLNS_DIALOGS_PREFIX ":visible-size" );
996 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat" );
997 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
998 readBoolAttr( "LiveScroll", XMLNS_DIALOGS_PREFIX ":live-scroll" );
999 readHexLongAttr( "SymbolColor", XMLNS_DIALOGS_PREFIX ":symbol-color" );
1000 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
1001 readEvents();
1004 void ElementDescriptor::readGridControlModel( StyleBag * all_styles )
1006 // collect styles
1007 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
1008 if (readProp("BackgroundColor") >>= aStyle._backgroundColor)
1009 aStyle._set |= 0x1;
1010 if (readBorderProps( this, aStyle ))
1011 aStyle._set |= 0x4;
1012 if (readProp("TextColor") >>= aStyle._textColor)
1013 aStyle._set |= 0x2;
1014 if (readProp("TextLineColor") >>= aStyle._textLineColor)
1015 aStyle._set |= 0x20;
1016 if (readFontProps( this, aStyle ))
1017 aStyle._set |= 0x8;
1018 if (aStyle._set)
1020 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id",all_styles->getStyleId( aStyle ) );
1022 // collect elements
1023 readDefaults();
1024 readBoolAttr("Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop");
1025 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign");
1026 readSelectionTypeAttr( "SelectionModel", XMLNS_DIALOGS_PREFIX ":selectiontype");
1027 readBoolAttr( "ShowColumnHeader", XMLNS_DIALOGS_PREFIX ":showcolumnheader");
1028 readBoolAttr( "ShowRowHeader", XMLNS_DIALOGS_PREFIX ":showrowheader");
1029 readHexLongAttr( "GridLineColor", XMLNS_DIALOGS_PREFIX ":gridline-color");
1030 readBoolAttr( "UseGridLines", XMLNS_DIALOGS_PREFIX ":usegridlines" );
1031 readHexLongAttr( "HeaderBackgroundColor", XMLNS_DIALOGS_PREFIX ":headerbackground-color");
1032 readHexLongAttr( "HeaderTextColor", XMLNS_DIALOGS_PREFIX ":headertext-color");
1033 readHexLongAttr( "ActiveSelectionBackgroundColor", XMLNS_DIALOGS_PREFIX ":activeselectionbackground-color");
1034 readHexLongAttr( "ActiveSelectionTextColor", XMLNS_DIALOGS_PREFIX ":activeselectiontext-color");
1035 readHexLongAttr( "InactiveSelectionBackgroundColor", XMLNS_DIALOGS_PREFIX ":inactiveselectionbackground-color");
1036 readHexLongAttr( "InactiveSelectionTextColor", XMLNS_DIALOGS_PREFIX ":inactiveselectiontext-color");
1037 readEvents();
1040 void ElementDescriptor::readDialogModel( StyleBag * all_styles )
1042 // collect elements
1043 addAttribute( "xmlns:" XMLNS_DIALOGS_PREFIX, XMLNS_DIALOGS_URI );
1044 addAttribute( "xmlns:" XMLNS_SCRIPT_PREFIX, XMLNS_SCRIPT_URI );
1046 // collect styles
1047 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
1048 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
1049 aStyle._set |= 0x1;
1050 if (readProp( "TextColor" ) >>= aStyle._textColor)
1051 aStyle._set |= 0x2;
1052 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
1053 aStyle._set |= 0x20;
1054 if (readFontProps( this, aStyle ))
1055 aStyle._set |= 0x8;
1056 if (aStyle._set)
1058 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
1061 // collect elements
1062 readDefaults( false, false );
1063 readBoolAttr("Closeable", XMLNS_DIALOGS_PREFIX ":closeable" );
1064 readBoolAttr( "Moveable", XMLNS_DIALOGS_PREFIX ":moveable" );
1065 readBoolAttr( "Sizeable", XMLNS_DIALOGS_PREFIX ":resizeable" );
1066 readStringAttr( "Title", XMLNS_DIALOGS_PREFIX ":title" );
1068 readScrollableSettings();
1069 Any aDecorationAny( _xProps->getPropertyValue( "Decoration" ) );
1070 bool bDecoration = false;
1071 if ( (aDecorationAny >>= bDecoration) && !bDecoration )
1072 addAttribute( XMLNS_DIALOGS_PREFIX ":withtitlebar", "false" );
1073 readImageOrGraphicAttr(XMLNS_DIALOGS_PREFIX ":image-src");
1074 readEvents();
1077 void ElementDescriptor::readBullitinBoard( StyleBag * all_styles )
1079 // collect elements
1080 ::std::vector< ElementDescriptor* > all_elements;
1081 // read out all props
1082 Reference< container::XNameContainer > xDialogModel( _xProps, UNO_QUERY );
1083 if ( !xDialogModel.is() )
1084 return; // #TODO throw???
1085 const Sequence< OUString > aElements( xDialogModel->getElementNames() );
1087 ElementDescriptor * pRadioGroup = nullptr;
1089 for ( const auto& rElement : aElements )
1091 Any aControlModel( xDialogModel->getByName( rElement ) );
1092 Reference< beans::XPropertySet > xProps;
1093 OSL_VERIFY( aControlModel >>= xProps );
1094 if (! xProps.is())
1095 continue;
1096 Reference< beans::XPropertyState > xPropState( xProps, UNO_QUERY );
1097 OSL_ENSURE( xPropState.is(), "no XPropertyState!" );
1098 if (! xPropState.is())
1099 continue;
1100 Reference< lang::XServiceInfo > xServiceInfo( xProps, UNO_QUERY );
1101 OSL_ENSURE( xServiceInfo.is(), "no XServiceInfo!" );
1102 if (! xServiceInfo.is())
1103 continue;
1105 ElementDescriptor * pElem = nullptr;
1107 // group up radio buttons
1108 if ( xServiceInfo->supportsService( "com.sun.star.awt.UnoControlRadioButtonModel" ) )
1110 if (! pRadioGroup) // open radiogroup
1112 pRadioGroup = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":radiogroup", _xDocument );
1113 all_elements.push_back( pRadioGroup );
1116 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":radio", _xDocument );
1117 pElem->readRadioButtonModel( all_styles );
1118 pRadioGroup->addSubElement( pElem );
1120 else // no radio
1122 pRadioGroup = nullptr; // close radiogroup
1124 if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlButtonModel" ) )
1126 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":button", _xDocument );
1127 pElem->readButtonModel( all_styles );
1129 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlCheckBoxModel" ) )
1131 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":checkbox", _xDocument );
1132 pElem->readCheckBoxModel( all_styles );
1134 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlComboBoxModel" ) )
1136 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":combobox", _xDocument );
1137 pElem->readComboBoxModel( all_styles );
1139 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlListBoxModel" ) )
1141 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":menulist", _xDocument );
1142 pElem->readListBoxModel( all_styles );
1144 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlGroupBoxModel" ) )
1146 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":titledbox", _xDocument );
1147 pElem->readGroupBoxModel( all_styles );
1149 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoMultiPageModel" ) )
1151 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":multipage", _xDocument );
1152 pElem->readMultiPageModel( all_styles );
1154 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoFrameModel" ) )
1156 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":frame", _xDocument );
1157 pElem->readFrameModel( all_styles );
1159 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoPageModel" ) )
1161 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":page", _xDocument );
1162 pElem->readPageModel( all_styles );
1164 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlFixedTextModel" ) )
1166 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":text", _xDocument );
1167 pElem->readFixedTextModel( all_styles );
1169 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlEditModel" ) )
1171 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":textfield", _xDocument );
1172 pElem->readEditModel( all_styles );
1174 // FixedHyperLink
1175 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlFixedHyperlinkModel" ) )
1177 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":linklabel", _xDocument );
1178 pElem->readFixedHyperLinkModel( all_styles );
1180 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlImageControlModel" ) )
1182 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":img", _xDocument );
1183 pElem->readImageControlModel( all_styles );
1185 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlFileControlModel" ) )
1187 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":filecontrol", _xDocument );
1188 pElem->readFileControlModel( all_styles );
1190 else if (xServiceInfo->supportsService( "com.sun.star.awt.tree.TreeControlModel" ) )
1192 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":treecontrol", _xDocument );
1193 pElem->readTreeControlModel( all_styles );
1195 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlCurrencyFieldModel" ) )
1197 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":currencyfield", _xDocument );
1198 pElem->readCurrencyFieldModel( all_styles );
1200 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlDateFieldModel" ) )
1202 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":datefield", _xDocument );
1203 pElem->readDateFieldModel( all_styles );
1205 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlNumericFieldModel" ) )
1207 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":numericfield", _xDocument );
1208 pElem->readNumericFieldModel( all_styles );
1210 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlTimeFieldModel" ) )
1212 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":timefield", _xDocument);
1213 pElem->readTimeFieldModel( all_styles );
1215 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlPatternFieldModel" ) )
1217 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":patternfield", _xDocument );
1218 pElem->readPatternFieldModel( all_styles );
1220 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlFormattedFieldModel" ) )
1222 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":formattedfield", _xDocument );
1223 pElem->readFormattedFieldModel( all_styles );
1225 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlFixedLineModel" ) )
1227 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":fixedline", _xDocument );
1228 pElem->readFixedLineModel( all_styles );
1230 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlScrollBarModel" ) )
1232 pElem = new ElementDescriptor(xProps, xPropState, XMLNS_DIALOGS_PREFIX ":scrollbar", _xDocument );
1233 pElem->readScrollBarModel( all_styles );
1235 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlSpinButtonModel" ) )
1237 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":spinbutton", _xDocument );
1238 pElem->readSpinButtonModel( all_styles );
1240 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlProgressBarModel" ) )
1242 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":progressmeter", _xDocument );
1243 pElem->readProgressBarModel( all_styles );
1245 else if (xServiceInfo->supportsService( "com.sun.star.awt.grid.UnoControlGridModel" ) )
1247 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":table", _xDocument );
1248 pElem->readGridControlModel( all_styles );
1251 if (pElem)
1253 all_elements.push_back( pElem );
1255 else
1257 OSL_FAIL( "unknown control type!" );
1258 continue;
1262 for (ElementDescriptor* p : all_elements)
1264 addSubElement( p );
1270 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */