Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / xmlscript / source / xmldlg_imexp / xmldlg_expmodels.cxx
blob823df0e9ac1bcb1c9b74f14c8f3033017ba2c932
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>
29 #include <rtl/ref.hxx>
31 using namespace ::com::sun::star;
32 using namespace ::com::sun::star::uno;
34 namespace xmlscript
37 static bool readBorderProps(
38 ElementDescriptor * element, Style & style )
40 if (element->readProp( &style._border, "Border" )) {
41 if (style._border == BORDER_SIMPLE /* simple */)
43 if (element->readProp( &style._borderColor, "BorderColor" ))
44 style._border = BORDER_SIMPLE_COLOR;
46 return true;
48 return false;
51 static bool readFontProps( ElementDescriptor * element, Style & style )
53 bool ret = element->readProp(
54 &style._descr, "FontDescriptor" );
55 ret |= element->readProp(
56 &style._fontEmphasisMark, "FontEmphasisMark" );
57 ret |= element->readProp(
58 &style._fontRelief, "FontRelief" );
59 return ret;
62 void ElementDescriptor::readMultiPageModel( StyleBag * all_styles )
64 // collect styles
65 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
66 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
67 aStyle._set |= 0x1;
68 if (readProp( "TextColor" ) >>= aStyle._textColor)
69 aStyle._set |= 0x2;
70 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
71 aStyle._set |= 0x20;
72 if (readFontProps( this, aStyle ))
73 aStyle._set |= 0x8;
74 if (aStyle._set)
76 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id" , all_styles->getStyleId( aStyle ) );
79 // collect elements
80 readDefaults();
81 readLongAttr( "MultiPageValue", XMLNS_DIALOGS_PREFIX ":value" );
82 Any aDecorationAny( _xProps->getPropertyValue( "Decoration" ) );
83 bool bDecoration = true;
84 if ( (aDecorationAny >>= bDecoration) && !bDecoration )
85 addAttribute( XMLNS_DIALOGS_PREFIX ":withtabs", "false" );
87 readEvents();
88 uno::Reference< container::XNameContainer > xPagesContainer( _xProps, uno::UNO_QUERY );
89 if ( xPagesContainer.is() && xPagesContainer->getElementNames().hasElements() )
91 rtl::Reference<ElementDescriptor> pElem = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":bulletinboard", _xDocument );
92 pElem->readBullitinBoard( all_styles );
93 addSubElement( pElem );
97 void ElementDescriptor::readFrameModel( StyleBag * all_styles )
99 // collect styles
100 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
102 if (readProp( "TextColor" ) >>= aStyle._textColor)
103 aStyle._set |= 0x2;
104 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
105 aStyle._set |= 0x20;
106 if (readFontProps( this, aStyle ))
107 aStyle._set |= 0x8;
108 if (aStyle._set)
110 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
113 // collect elements
114 readDefaults();
115 OUString aTitle;
117 if ( readProp( "Label" ) >>= aTitle)
119 rtl::Reference<ElementDescriptor> title = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":title", _xDocument );
120 title->addAttribute( XMLNS_DIALOGS_PREFIX ":value", aTitle );
121 addSubElement( title );
123 uno::Reference< container::XNameContainer > xControlContainer( _xProps, uno::UNO_QUERY );
124 if ( xControlContainer.is() && xControlContainer->getElementNames().hasElements() )
126 rtl::Reference<ElementDescriptor> pElem = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":bulletinboard", _xDocument );
127 pElem->readBullitinBoard( all_styles );
128 addSubElement( pElem );
130 readEvents();
133 void ElementDescriptor::readPageModel( StyleBag * all_styles )
135 // collect styles
136 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
137 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
138 aStyle._set |= 0x1;
139 if (readProp( "TextColor" ) >>= aStyle._textColor)
140 aStyle._set |= 0x2;
141 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
142 aStyle._set |= 0x20;
143 if (readFontProps( this, aStyle ))
144 aStyle._set |= 0x8;
145 if (aStyle._set)
147 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
150 // collect elements
151 readDefaults();
152 readStringAttr( "Title", XMLNS_DIALOGS_PREFIX ":title" );
153 uno::Reference< container::XNameContainer > xControlContainer( _xProps, uno::UNO_QUERY );
154 if ( xControlContainer.is() && xControlContainer->getElementNames().hasElements() )
156 rtl::Reference<ElementDescriptor> pElem = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":bulletinboard", _xDocument );
157 pElem->readBullitinBoard( all_styles );
158 addSubElement( pElem );
160 readEvents();
163 void ElementDescriptor::readButtonModel( StyleBag * all_styles )
165 // collect styles
166 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
167 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
168 aStyle._set |= 0x1;
169 if (readProp( "TextColor" ) >>= aStyle._textColor)
170 aStyle._set |= 0x2;
171 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
172 aStyle._set |= 0x20;
173 if (readFontProps( this, aStyle ))
174 aStyle._set |= 0x8;
175 if (aStyle._set)
177 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
180 // collect elements
181 readDefaults();
182 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
183 readBoolAttr( "DefaultButton", XMLNS_DIALOGS_PREFIX ":default" );
184 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX ":value" );
185 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
186 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
187 readButtonTypeAttr( "PushButtonType", XMLNS_DIALOGS_PREFIX ":button-type" );
188 readImageOrGraphicAttr(XMLNS_DIALOGS_PREFIX ":image-src");
189 readImagePositionAttr( "ImagePosition", XMLNS_DIALOGS_PREFIX ":image-position" );
190 readImageAlignAttr( "ImageAlign", XMLNS_DIALOGS_PREFIX ":image-align" );
192 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
193 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
195 if (extract_throw<bool>( _xProps->getPropertyValue( "Toggle" ) ))
196 addAttribute( XMLNS_DIALOGS_PREFIX ":toggled", "1" );
198 readBoolAttr( "FocusOnClick", XMLNS_DIALOGS_PREFIX ":grab-focus" );
199 readBoolAttr( "MultiLine",XMLNS_DIALOGS_PREFIX ":multiline" );
201 // State
202 sal_Int16 nState = 0;
203 if (readProp( "State" ) >>= nState)
205 switch (nState)
207 case 0:
208 addAttribute( XMLNS_DIALOGS_PREFIX ":checked", "false" );
209 break;
210 case 1:
211 addAttribute( XMLNS_DIALOGS_PREFIX ":checked", "true" );
212 break;
213 default:
214 OSL_FAIL( "### unexpected radio state!" );
215 break;
219 readEvents();
222 void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles )
224 // collect styles
225 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 | 0x40 );
226 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
227 aStyle._set |= 0x1;
228 if (readProp( "TextColor" ) >>= aStyle._textColor)
229 aStyle._set |= 0x2;
230 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
231 aStyle._set |= 0x20;
232 if (readFontProps( this, aStyle ))
233 aStyle._set |= 0x8;
234 if (readProp( "VisualEffect" ) >>= aStyle._visualEffect)
235 aStyle._set |= 0x40;
236 if (aStyle._set)
238 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
241 // collect elements
242 readDefaults();
243 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
244 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX ":value" );
245 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
246 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
247 readImageOrGraphicAttr(XMLNS_DIALOGS_PREFIX ":image-src");
248 readImagePositionAttr( "ImagePosition", XMLNS_DIALOGS_PREFIX ":image-position" );
249 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX ":multiline" );
251 bool bTriState = false;
252 if ((readProp( "TriState" ) >>= bTriState) && bTriState)
254 addAttribute( XMLNS_DIALOGS_PREFIX ":tristate", "true" );
256 sal_Int16 nState = 0;
257 if (_xProps->getPropertyValue( "State" ) >>= nState)
259 switch (nState)
261 case 0:
262 addAttribute( XMLNS_DIALOGS_PREFIX ":checked", "false" );
263 break;
264 case 1:
265 addAttribute( XMLNS_DIALOGS_PREFIX ":checked", "true" );
266 break;
267 case 2: // tristate=true exported, checked omitted => don't know!
268 OSL_ENSURE( bTriState, "### detected tristate value, but TriState is not set!" );
269 break;
270 default:
271 OSL_FAIL( "### unexpected checkbox state!" );
272 break;
275 readEvents();
278 void ElementDescriptor::readComboBoxModel( StyleBag * all_styles )
280 // collect styles
281 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
282 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
283 aStyle._set |= 0x1;
284 if (readProp( "TextColor" ) >>= aStyle._textColor)
285 aStyle._set |= 0x2;
286 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
287 aStyle._set |= 0x20;
288 if (readBorderProps( this, aStyle ))
289 aStyle._set |= 0x4;
290 if (readFontProps( this, aStyle ))
291 aStyle._set |= 0x8;
292 if (aStyle._set)
294 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
297 // collect elements
298 readDefaults();
299 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
300 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":value" );
301 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
302 readBoolAttr( "Autocomplete", XMLNS_DIALOGS_PREFIX ":autocomplete" );
303 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
304 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
305 readBoolAttr( "Dropdown", XMLNS_DIALOGS_PREFIX ":spin" );
306 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX ":maxlength" );
307 readShortAttr( "LineCount", XMLNS_DIALOGS_PREFIX ":linecount" );
308 // Cell Range, Ref Cell etc.
309 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
310 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":source-cell-range" );
312 // string item list
313 Sequence< OUString > itemValues;
314 if ((readProp( "StringItemList" ) >>= itemValues) && itemValues.hasElements())
316 rtl::Reference<ElementDescriptor> popup = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menupopup", _xDocument );
318 for ( const auto& rItemValue : std::as_const(itemValues) )
320 rtl::Reference<ElementDescriptor> item = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menuitem", _xDocument );
321 item->addAttribute( XMLNS_DIALOGS_PREFIX ":value", rItemValue );
322 popup->addSubElement( item );
325 addSubElement( popup );
327 readEvents();
330 void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
332 // collect styles
333 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
334 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
335 aStyle._set |= 0x1;
336 if (readProp( "TextColor" ) >>= aStyle._textColor)
337 aStyle._set |= 0x2;
338 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
339 aStyle._set |= 0x20;
340 if (readBorderProps( this, aStyle ))
341 aStyle._set |= 0x4;
342 if (readFontProps( this, aStyle ))
343 aStyle._set |= 0x8;
344 if (aStyle._set)
346 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
349 // collect elements
350 readDefaults();
351 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
352 readBoolAttr( "MultiSelection", XMLNS_DIALOGS_PREFIX ":multiselection" );
353 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
354 readBoolAttr( "Dropdown", XMLNS_DIALOGS_PREFIX ":spin" );
355 readShortAttr( "LineCount", XMLNS_DIALOGS_PREFIX ":linecount" );
356 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
357 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
358 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":source-cell-range" );
359 // string item list
360 Sequence< OUString > itemValues;
361 if ((readProp( "StringItemList" ) >>= itemValues) && itemValues.hasElements())
363 rtl::Reference<ElementDescriptor> popup = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menupopup", _xDocument );
365 for ( const auto& rItemValue : std::as_const(itemValues) )
367 rtl::Reference<ElementDescriptor> item = new ElementDescriptor(_xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menuitem", _xDocument );
368 item->addAttribute( XMLNS_DIALOGS_PREFIX ":value", rItemValue );
369 popup->addSubElement( item );
372 Sequence< sal_Int16 > selected;
373 if (readProp( "SelectedItems" ) >>= selected)
375 sal_Int16 const * pSelected = selected.getConstArray();
376 for ( sal_Int32 nPos = selected.getLength(); nPos--; )
378 ElementDescriptor * item = static_cast< ElementDescriptor * >(
379 popup->getSubElement( pSelected[ nPos ] ).get() );
380 item->addAttribute( XMLNS_DIALOGS_PREFIX ":selected", "true" );
384 addSubElement( popup );
386 readEvents();
389 void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles )
391 // collect styles
392 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 | 0x40 );
393 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
394 aStyle._set |= 0x1;
395 if (readProp( "TextColor" ) >>= aStyle._textColor)
396 aStyle._set |= 0x2;
397 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
398 aStyle._set |= 0x20;
399 if (readFontProps( this, aStyle ))
400 aStyle._set |= 0x8;
401 if (readProp( "VisualEffect" ) >>= aStyle._visualEffect)
402 aStyle._set |= 0x40;
403 if (aStyle._set)
405 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id" , all_styles->getStyleId( aStyle ) );
408 // collect elements
409 readDefaults();
410 readBoolAttr("Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
411 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX ":value" );
412 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
413 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
414 readImageOrGraphicAttr(XMLNS_DIALOGS_PREFIX ":image-src");
415 readImagePositionAttr( "ImagePosition", XMLNS_DIALOGS_PREFIX ":image-position" );
416 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX ":multiline" );
417 readStringAttr( "GroupName", XMLNS_DIALOGS_PREFIX ":group-name" );
419 sal_Int16 nState = 0;
420 if (readProp( "State" ) >>= nState)
422 switch (nState)
424 case 0:
425 addAttribute(XMLNS_DIALOGS_PREFIX ":checked", "false" );
426 break;
427 case 1:
428 addAttribute( XMLNS_DIALOGS_PREFIX ":checked", "true" );
429 break;
430 default:
431 OSL_FAIL( "### unexpected radio state!" );
432 break;
435 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
436 readEvents();
439 void ElementDescriptor::readGroupBoxModel( StyleBag * all_styles )
441 // collect styles
442 Style aStyle( 0x2 | 0x8 | 0x20 );
443 if (readProp( "TextColor" ) >>= aStyle._textColor)
444 aStyle._set |= 0x2;
445 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
446 aStyle._set |= 0x20;
447 if (readFontProps( this, aStyle ))
448 aStyle._set |= 0x8;
449 if (aStyle._set)
451 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
454 // collect elements
455 readDefaults();
457 OUString aTitle;
458 if (readProp( "Label" ) >>= aTitle)
460 rtl::Reference<ElementDescriptor> title = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":title", _xDocument );
461 title->addAttribute( XMLNS_DIALOGS_PREFIX ":value", aTitle );
462 addSubElement( title );
465 readEvents();
468 void ElementDescriptor::readFixedTextModel( StyleBag * all_styles )
470 // collect styles
471 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
472 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
473 aStyle._set |= 0x1;
474 if (readProp( "TextColor" ) >>= aStyle._textColor)
475 aStyle._set |= 0x2;
476 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
477 aStyle._set |= 0x20;
478 if (readBorderProps( this, aStyle ))
479 aStyle._set |= 0x4;
480 if (readFontProps( this, aStyle ))
481 aStyle._set |= 0x8;
482 if (aStyle._set)
484 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
487 // collect elements
488 readDefaults();
489 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX ":value" );
490 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
491 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
492 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX ":multiline" );
493 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
494 readBoolAttr( "NoLabel", XMLNS_DIALOGS_PREFIX ":nolabel" );
495 readEvents();
498 void ElementDescriptor::readFixedHyperLinkModel( StyleBag * all_styles )
500 // collect styles
501 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
502 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
503 aStyle._set |= 0x1;
504 if (readProp( "TextColor" ) >>= aStyle._textColor)
505 aStyle._set |= 0x2;
506 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
507 aStyle._set |= 0x20;
508 if (readBorderProps( this, aStyle ))
509 aStyle._set |= 0x4;
510 if (readFontProps( this, aStyle ))
511 aStyle._set |= 0x8;
512 if (aStyle._set)
514 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
517 // collect elements
518 readDefaults();
519 readStringAttr( "Label",XMLNS_DIALOGS_PREFIX ":value" );
520 readStringAttr( "URL", XMLNS_DIALOGS_PREFIX ":url" );
521 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
522 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
523 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX ":multiline" );
524 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
525 readBoolAttr( "NoLabel", XMLNS_DIALOGS_PREFIX ":nolabel" );
526 readEvents();
529 void ElementDescriptor::readEditModel( StyleBag * all_styles )
531 // collect styles
532 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
533 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
534 aStyle._set |= 0x1;
535 if (readProp( "TextColor" ) >>= aStyle._textColor)
536 aStyle._set |= 0x2;
537 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
538 aStyle._set |= 0x20;
539 if (readBorderProps( this, aStyle ))
540 aStyle._set |= 0x4;
541 if (readFontProps( this, aStyle ))
542 aStyle._set |= 0x8;
543 if (aStyle._set)
545 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
548 // collect elements
549 readDefaults();
550 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
551 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
552 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
553 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
554 readBoolAttr( "HardLineBreaks", XMLNS_DIALOGS_PREFIX ":hard-linebreaks" );
555 readBoolAttr( "HScroll", XMLNS_DIALOGS_PREFIX ":hscroll" );
556 readBoolAttr( "VScroll", XMLNS_DIALOGS_PREFIX ":vscroll" );
557 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX ":maxlength" );
558 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX ":multiline" );
559 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
560 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":value" );
561 readLineEndFormatAttr( "LineEndFormat", XMLNS_DIALOGS_PREFIX ":lineend-format" );
562 sal_Int16 nEcho = 0;
563 if (readProp( "EchoChar" ) >>= nEcho)
565 sal_Unicode cEcho = static_cast<sal_Unicode>(nEcho);
566 addAttribute( XMLNS_DIALOGS_PREFIX ":echochar", OUString( &cEcho, 1 ) );
568 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
569 readEvents();
572 void ElementDescriptor::readImageControlModel( StyleBag * all_styles )
574 // collect styles
575 Style aStyle( 0x1 | 0x4 );
576 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
577 aStyle._set |= 0x1;
578 if (readBorderProps( this, aStyle ))
579 aStyle._set |= 0x4;
580 if (aStyle._set)
582 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
585 // collect elements
586 readDefaults();
587 readBoolAttr( "ScaleImage", XMLNS_DIALOGS_PREFIX ":scale-image" );
588 readImageScaleModeAttr( "ScaleMode", XMLNS_DIALOGS_PREFIX ":scale-mode" );
589 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
590 readImageOrGraphicAttr(XMLNS_DIALOGS_PREFIX ":src");
591 readEvents();
594 void ElementDescriptor::readFileControlModel( StyleBag * all_styles )
596 // collect styles
597 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
598 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
599 aStyle._set |= 0x1;
600 if (readProp( "TextColor" ) >>= aStyle._textColor)
601 aStyle._set |= 0x2;
602 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
603 aStyle._set |= 0x20;
604 if (readBorderProps( this, aStyle ))
605 aStyle._set |= 0x4;
606 if (readFontProps( this, aStyle ))
607 aStyle._set |= 0x8;
608 if (aStyle._set)
610 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
613 // collect elements
614 readDefaults();
615 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
616 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
617 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":value" );
618 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
619 readEvents();
622 void ElementDescriptor::readTreeControlModel( StyleBag * all_styles )
624 // collect styles
625 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
626 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
627 aStyle._set |= 0x1;
628 if (readBorderProps( this, aStyle ))
629 aStyle._set |= 0x4;
630 if (aStyle._set)
632 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
635 // collect elements
636 readDefaults();
637 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
638 readSelectionTypeAttr( "SelectionType", XMLNS_DIALOGS_PREFIX ":selectiontype" );
640 readBoolAttr( "RootDisplayed", XMLNS_DIALOGS_PREFIX ":rootdisplayed" );
641 readBoolAttr( "ShowsHandles", XMLNS_DIALOGS_PREFIX ":showshandles" );
642 readBoolAttr( "ShowsRootHandles", XMLNS_DIALOGS_PREFIX ":showsroothandles" );
643 readBoolAttr( "Editable", XMLNS_DIALOGS_PREFIX ":editable" );
644 readBoolAttr( "InvokesStopNodeEditing", XMLNS_DIALOGS_PREFIX ":invokesstopnodeediting" );
645 readLongAttr( "RowHeight", XMLNS_DIALOGS_PREFIX ":rowheight" );
646 readEvents();
649 void ElementDescriptor::readCurrencyFieldModel( StyleBag * all_styles )
651 // collect styles
652 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
653 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
654 aStyle._set |= 0x1;
655 if (readProp( "TextColor" ) >>= aStyle._textColor)
656 aStyle._set |= 0x2;
657 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
658 aStyle._set |= 0x20;
659 if (readBorderProps( this, aStyle ))
660 aStyle._set |= 0x4;
661 if (readFontProps( this, aStyle ))
662 aStyle._set |= 0x8;
663 if (aStyle._set)
665 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
668 // collect elements
669 readDefaults();
670 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
671 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
672 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
673 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
674 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
675 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
676 readStringAttr( "CurrencySymbol", XMLNS_DIALOGS_PREFIX ":currency-symbol" );
677 readShortAttr( "DecimalAccuracy", XMLNS_DIALOGS_PREFIX ":decimal-accuracy" );
678 readBoolAttr( "ShowThousandsSeparator", XMLNS_DIALOGS_PREFIX ":thousands-separator" );
679 readDoubleAttr( "Value", XMLNS_DIALOGS_PREFIX ":value" );
680 readDoubleAttr( "ValueMin", XMLNS_DIALOGS_PREFIX ":value-min" );
681 readDoubleAttr( "ValueMax", XMLNS_DIALOGS_PREFIX ":value-max" );
682 readDoubleAttr( "ValueStep", XMLNS_DIALOGS_PREFIX ":value-step" );
683 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX ":spin" );
684 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
685 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
686 readBoolAttr("PrependCurrencySymbol", XMLNS_DIALOGS_PREFIX ":prepend-symbol" );
687 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX ":enforce-format" );
688 readEvents();
691 void ElementDescriptor::readDateFieldModel( StyleBag * all_styles )
693 // collect styles
694 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
695 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
696 aStyle._set |= 0x1;
697 if (readProp( "TextColor" ) >>= aStyle._textColor)
698 aStyle._set |= 0x2;
699 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
700 aStyle._set |= 0x20;
701 if (readBorderProps( this, aStyle ))
702 aStyle._set |= 0x4;
703 if (readFontProps( this, aStyle ))
704 aStyle._set |= 0x8;
705 if (aStyle._set)
707 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
710 // collect elements
711 readDefaults();
712 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
713 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
714 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
715 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
716 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
717 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
718 readDateFormatAttr( "DateFormat", XMLNS_DIALOGS_PREFIX ":date-format" );
719 readBoolAttr( "DateShowCentury", XMLNS_DIALOGS_PREFIX ":show-century" );
720 readDateAttr( "Date", XMLNS_DIALOGS_PREFIX ":value" );
721 readDateAttr( "DateMin", XMLNS_DIALOGS_PREFIX ":value-min" );
722 readDateAttr( "DateMax", XMLNS_DIALOGS_PREFIX ":value-max" );
723 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX ":spin" );
724 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
725 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
726 readBoolAttr( "Dropdown", XMLNS_DIALOGS_PREFIX ":dropdown" );
727 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":text" );
728 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX ":enforce-format" );
729 readEvents();
732 void ElementDescriptor::readNumericFieldModel( StyleBag * all_styles )
734 // collect styles
735 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
736 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
737 aStyle._set |= 0x1;
738 if (readProp( "TextColor" ) >>= aStyle._textColor)
739 aStyle._set |= 0x2;
740 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
741 aStyle._set |= 0x20;
742 if (readBorderProps( this, aStyle ))
743 aStyle._set |= 0x4;
744 if (readFontProps( this, aStyle ))
745 aStyle._set |= 0x8;
746 if (aStyle._set)
748 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
751 // collect elements
752 readDefaults();
753 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
754 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
755 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
756 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
757 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
758 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
759 readShortAttr( "DecimalAccuracy", XMLNS_DIALOGS_PREFIX ":decimal-accuracy" );
760 readBoolAttr( "ShowThousandsSeparator", XMLNS_DIALOGS_PREFIX ":thousands-separator" );
761 readDoubleAttr( "Value", XMLNS_DIALOGS_PREFIX ":value" );
762 readDoubleAttr( "ValueMin", XMLNS_DIALOGS_PREFIX ":value-min" );
763 readDoubleAttr( "ValueMax", XMLNS_DIALOGS_PREFIX ":value-max" );
764 readDoubleAttr( "ValueStep", XMLNS_DIALOGS_PREFIX ":value-step" );
765 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX ":spin" );
766 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
767 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
768 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX ":enforce-format" );
769 readEvents();
772 void ElementDescriptor::readTimeFieldModel( StyleBag * all_styles )
774 // collect styles
775 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
776 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
777 aStyle._set |= 0x1;
778 if (readProp( "TextColor" ) >>= aStyle._textColor)
779 aStyle._set |= 0x2;
780 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
781 aStyle._set |= 0x20;
782 if (readBorderProps( this, aStyle ))
783 aStyle._set |= 0x4;
784 if (readFontProps( this, aStyle ))
785 aStyle._set |= 0x8;
786 if (aStyle._set)
788 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
791 // collect elements
792 readDefaults();
793 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop");
794 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
795 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
796 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
797 readTimeFormatAttr( "TimeFormat", XMLNS_DIALOGS_PREFIX ":time-format" );
798 readTimeAttr( "Time", XMLNS_DIALOGS_PREFIX ":value" );
799 readTimeAttr( "TimeMin", XMLNS_DIALOGS_PREFIX ":value-min" );
800 readTimeAttr( "TimeMax", XMLNS_DIALOGS_PREFIX ":value-max" );
801 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX ":spin" );
802 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
803 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
804 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":text" );
805 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX ":enforce-format" );
806 readEvents();
809 void ElementDescriptor::readPatternFieldModel( StyleBag * all_styles )
811 // collect styles
812 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
813 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
814 aStyle._set |= 0x1;
815 if (readProp( "TextColor" ) >>= aStyle._textColor)
816 aStyle._set |= 0x2;
817 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
818 aStyle._set |= 0x20;
819 if (readBorderProps( this, aStyle ))
820 aStyle._set |= 0x4;
821 if (readFontProps( this, aStyle ))
822 aStyle._set |= 0x8;
823 if (aStyle._set)
825 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
828 // collect elements
829 readDefaults();
830 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
831 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
832 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
833 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
834 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":value" );
835 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX ":maxlength" );
836 readStringAttr( "EditMask", XMLNS_DIALOGS_PREFIX ":edit-mask" );
837 readStringAttr( "LiteralMask", XMLNS_DIALOGS_PREFIX ":literal-mask" );
838 readEvents();
841 void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles )
843 // collect styles
844 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
845 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
846 aStyle._set |= 0x1;
847 if (readProp( "TextColor" ) >>= aStyle._textColor)
848 aStyle._set |= 0x2;
849 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
850 aStyle._set |= 0x20;
851 if (readBorderProps( this, aStyle ))
852 aStyle._set |= 0x4;
853 if (readFontProps( this, aStyle ))
854 aStyle._set |= 0x8;
855 if (aStyle._set)
857 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
860 // collect elements
861 readDefaults();
862 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
863 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
864 readBoolAttr( "HideInactiveSelection",XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
865 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
866 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":text" );
867 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
868 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX ":maxlength" );
869 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX ":spin" );
870 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
871 readLongAttr( "RepeatDelay",XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
873 Any a( readProp( "EffectiveDefault" ) );
874 switch (a.getValueTypeClass())
876 case TypeClass_DOUBLE:
877 addAttribute( XMLNS_DIALOGS_PREFIX ":value-default", OUString::number( *o3tl::forceAccess<double>(a) ) );
878 break;
879 case TypeClass_STRING:
880 addAttribute( XMLNS_DIALOGS_PREFIX ":value-default", *o3tl::forceAccess<OUString>(a) );
881 break;
882 default:
883 break;
885 readDoubleAttr( "EffectiveMin", XMLNS_DIALOGS_PREFIX ":value-min" );
886 readDoubleAttr( "EffectiveMax", XMLNS_DIALOGS_PREFIX ":value-max" );
887 readDoubleAttr( "EffectiveValue", XMLNS_DIALOGS_PREFIX ":value" );
889 // format spec
890 sal_Int32 nKey = 0;
891 if (readProp( "FormatKey" ) >>= nKey)
893 Reference< util::XNumberFormatsSupplier > xSupplier;
894 if (readProp( "FormatsSupplier" ) >>= xSupplier)
896 addNumberFormatAttr(
897 xSupplier->getNumberFormats()->getByKey( nKey ) );
900 readBoolAttr( "TreatAsNumber", XMLNS_DIALOGS_PREFIX ":treat-as-number" );
901 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX ":enforce-format" );
903 readEvents();
906 void ElementDescriptor::readSpinButtonModel( StyleBag * all_styles )
908 // collect styles
909 Style aStyle( 0x1 | 0x4 );
910 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
911 aStyle._set |= 0x1;
912 if (readBorderProps( this, aStyle ))
913 aStyle._set |= 0x4;
914 if (aStyle._set)
916 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
919 // collect elements
920 readDefaults();
921 readOrientationAttr( "Orientation", XMLNS_DIALOGS_PREFIX ":align" );
922 readLongAttr( "SpinIncrement", XMLNS_DIALOGS_PREFIX ":increment" );
923 readLongAttr( "SpinValue", XMLNS_DIALOGS_PREFIX ":curval" );
924 readLongAttr( "SpinValueMax", XMLNS_DIALOGS_PREFIX ":maxval" );
925 readLongAttr( "SpinValueMin", XMLNS_DIALOGS_PREFIX ":minval" );
926 readLongAttr( "Repeat", XMLNS_DIALOGS_PREFIX ":repeat" );
927 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat-delay" );
928 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
929 readHexLongAttr( "SymbolColor", XMLNS_DIALOGS_PREFIX ":symbol-color" );
930 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
931 readEvents();
934 void ElementDescriptor::readFixedLineModel( StyleBag * all_styles )
936 // collect styles
937 Style aStyle( 0x2 | 0x8 | 0x20 );
938 if (readProp( "TextColor" ) >>= aStyle._textColor)
939 aStyle._set |= 0x2;
940 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
941 aStyle._set |= 0x20;
942 if (readFontProps( this, aStyle ))
943 aStyle._set |= 0x8;
944 if (aStyle._set)
946 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
949 // collect elements
950 readDefaults();
951 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX ":value" );
952 readOrientationAttr( "Orientation", XMLNS_DIALOGS_PREFIX ":align" );
953 readEvents();
956 void ElementDescriptor::readProgressBarModel( StyleBag * all_styles )
958 // collect styles
959 Style aStyle( 0x1 | 0x4 | 0x10 );
960 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
961 aStyle._set |= 0x1;
962 if (readBorderProps( this, aStyle ))
963 aStyle._set |= 0x4;
964 if (readProp( "FillColor" ) >>= aStyle._descr)
965 aStyle._set |= 0x10;
966 if (aStyle._set)
968 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
971 // collect elements
972 readDefaults();
973 readLongAttr( "ProgressValue", XMLNS_DIALOGS_PREFIX ":value" );
974 readLongAttr( "ProgressValueMin", XMLNS_DIALOGS_PREFIX ":value-min" );
975 readLongAttr( "ProgressValueMax", XMLNS_DIALOGS_PREFIX ":value-max" );
976 readEvents();
979 void ElementDescriptor::readScrollBarModel( StyleBag * all_styles )
981 // collect styles
982 Style aStyle( 0x1 | 0x4 );
983 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
984 aStyle._set |= 0x1;
985 if (readBorderProps( this, aStyle ))
986 aStyle._set |= 0x4;
987 if (aStyle._set)
989 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
992 // collect elements
993 readDefaults();
994 readOrientationAttr( "Orientation", XMLNS_DIALOGS_PREFIX ":align" );
995 readLongAttr( "BlockIncrement", XMLNS_DIALOGS_PREFIX ":pageincrement" );
996 readLongAttr( "LineIncrement", XMLNS_DIALOGS_PREFIX ":increment" );
997 readLongAttr( "ScrollValue", XMLNS_DIALOGS_PREFIX ":curpos" );
998 readLongAttr( "ScrollValueMax", XMLNS_DIALOGS_PREFIX ":maxpos" );
999 readLongAttr( "ScrollValueMin", XMLNS_DIALOGS_PREFIX ":minpos" );
1000 readLongAttr( "VisibleSize", XMLNS_DIALOGS_PREFIX ":visible-size" );
1001 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat" );
1002 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
1003 readBoolAttr( "LiveScroll", XMLNS_DIALOGS_PREFIX ":live-scroll" );
1004 readHexLongAttr( "SymbolColor", XMLNS_DIALOGS_PREFIX ":symbol-color" );
1005 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
1006 readEvents();
1009 void ElementDescriptor::readGridControlModel( StyleBag * all_styles )
1011 // collect styles
1012 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
1013 if (readProp("BackgroundColor") >>= aStyle._backgroundColor)
1014 aStyle._set |= 0x1;
1015 if (readBorderProps( this, aStyle ))
1016 aStyle._set |= 0x4;
1017 if (readProp("TextColor") >>= aStyle._textColor)
1018 aStyle._set |= 0x2;
1019 if (readProp("TextLineColor") >>= aStyle._textLineColor)
1020 aStyle._set |= 0x20;
1021 if (readFontProps( this, aStyle ))
1022 aStyle._set |= 0x8;
1023 if (aStyle._set)
1025 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id",all_styles->getStyleId( aStyle ) );
1027 // collect elements
1028 readDefaults();
1029 readBoolAttr("Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop");
1030 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign");
1031 readSelectionTypeAttr( "SelectionModel", XMLNS_DIALOGS_PREFIX ":selectiontype");
1032 readBoolAttr( "ShowColumnHeader", XMLNS_DIALOGS_PREFIX ":showcolumnheader");
1033 readBoolAttr( "ShowRowHeader", XMLNS_DIALOGS_PREFIX ":showrowheader");
1034 readHexLongAttr( "GridLineColor", XMLNS_DIALOGS_PREFIX ":gridline-color");
1035 readBoolAttr( "UseGridLines", XMLNS_DIALOGS_PREFIX ":usegridlines" );
1036 readHexLongAttr( "HeaderBackgroundColor", XMLNS_DIALOGS_PREFIX ":headerbackground-color");
1037 readHexLongAttr( "HeaderTextColor", XMLNS_DIALOGS_PREFIX ":headertext-color");
1038 readHexLongAttr( "ActiveSelectionBackgroundColor", XMLNS_DIALOGS_PREFIX ":activeselectionbackground-color");
1039 readHexLongAttr( "ActiveSelectionTextColor", XMLNS_DIALOGS_PREFIX ":activeselectiontext-color");
1040 readHexLongAttr( "InactiveSelectionBackgroundColor", XMLNS_DIALOGS_PREFIX ":inactiveselectionbackground-color");
1041 readHexLongAttr( "InactiveSelectionTextColor", XMLNS_DIALOGS_PREFIX ":inactiveselectiontext-color");
1042 readEvents();
1045 void ElementDescriptor::readDialogModel( StyleBag * all_styles )
1047 // collect elements
1048 addAttribute( "xmlns:" XMLNS_DIALOGS_PREFIX, XMLNS_DIALOGS_URI );
1049 addAttribute( "xmlns:" XMLNS_SCRIPT_PREFIX, XMLNS_SCRIPT_URI );
1051 // collect styles
1052 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
1053 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
1054 aStyle._set |= 0x1;
1055 if (readProp( "TextColor" ) >>= aStyle._textColor)
1056 aStyle._set |= 0x2;
1057 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
1058 aStyle._set |= 0x20;
1059 if (readFontProps( this, aStyle ))
1060 aStyle._set |= 0x8;
1061 if (aStyle._set)
1063 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
1066 // collect elements
1067 readDefaults( false, false );
1068 readBoolAttr("Closeable", XMLNS_DIALOGS_PREFIX ":closeable" );
1069 readBoolAttr( "Moveable", XMLNS_DIALOGS_PREFIX ":moveable" );
1070 readBoolAttr( "Sizeable", XMLNS_DIALOGS_PREFIX ":resizeable" );
1071 readStringAttr( "Title", XMLNS_DIALOGS_PREFIX ":title" );
1073 readScrollableSettings();
1074 Any aDecorationAny( _xProps->getPropertyValue( "Decoration" ) );
1075 bool bDecoration = false;
1076 if ( (aDecorationAny >>= bDecoration) && !bDecoration )
1077 addAttribute( XMLNS_DIALOGS_PREFIX ":withtitlebar", "false" );
1078 readImageOrGraphicAttr(XMLNS_DIALOGS_PREFIX ":image-src");
1079 readEvents();
1082 void ElementDescriptor::readBullitinBoard( StyleBag * all_styles )
1084 // collect elements
1085 ::std::vector< rtl::Reference<ElementDescriptor> > all_elements;
1086 // read out all props
1087 Reference< container::XNameContainer > xDialogModel( _xProps, UNO_QUERY );
1088 if ( !xDialogModel.is() )
1089 return; // #TODO throw???
1090 const Sequence< OUString > aElements( xDialogModel->getElementNames() );
1092 rtl::Reference<ElementDescriptor> pRadioGroup;
1094 for ( const auto& rElement : aElements )
1096 Any aControlModel( xDialogModel->getByName( rElement ) );
1097 Reference< beans::XPropertySet > xProps;
1098 OSL_VERIFY( aControlModel >>= xProps );
1099 if (! xProps.is())
1100 continue;
1101 Reference< beans::XPropertyState > xPropState( xProps, UNO_QUERY );
1102 OSL_ENSURE( xPropState.is(), "no XPropertyState!" );
1103 if (! xPropState.is())
1104 continue;
1105 Reference< lang::XServiceInfo > xServiceInfo( xProps, UNO_QUERY );
1106 OSL_ENSURE( xServiceInfo.is(), "no XServiceInfo!" );
1107 if (! xServiceInfo.is())
1108 continue;
1110 rtl::Reference<ElementDescriptor> pElem;
1112 // group up radio buttons
1113 if ( xServiceInfo->supportsService( "com.sun.star.awt.UnoControlRadioButtonModel" ) )
1115 if (! pRadioGroup) // open radiogroup
1117 pRadioGroup = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":radiogroup", _xDocument );
1118 all_elements.push_back( pRadioGroup );
1121 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":radio", _xDocument );
1122 pElem->readRadioButtonModel( all_styles );
1123 pRadioGroup->addSubElement( pElem );
1125 else // no radio
1127 pRadioGroup = nullptr; // close radiogroup
1129 if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlButtonModel" ) )
1131 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":button", _xDocument );
1132 pElem->readButtonModel( all_styles );
1134 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlCheckBoxModel" ) )
1136 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":checkbox", _xDocument );
1137 pElem->readCheckBoxModel( all_styles );
1139 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlComboBoxModel" ) )
1141 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":combobox", _xDocument );
1142 pElem->readComboBoxModel( all_styles );
1144 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlListBoxModel" ) )
1146 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":menulist", _xDocument );
1147 pElem->readListBoxModel( all_styles );
1149 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlGroupBoxModel" ) )
1151 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":titledbox", _xDocument );
1152 pElem->readGroupBoxModel( all_styles );
1154 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoMultiPageModel" ) )
1156 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":multipage", _xDocument );
1157 pElem->readMultiPageModel( all_styles );
1159 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoFrameModel" ) )
1161 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":frame", _xDocument );
1162 pElem->readFrameModel( all_styles );
1164 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoPageModel" ) )
1166 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":page", _xDocument );
1167 pElem->readPageModel( all_styles );
1169 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlFixedTextModel" ) )
1171 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":text", _xDocument );
1172 pElem->readFixedTextModel( all_styles );
1174 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlEditModel" ) )
1176 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":textfield", _xDocument );
1177 pElem->readEditModel( all_styles );
1179 // FixedHyperLink
1180 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlFixedHyperlinkModel" ) )
1182 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":linklabel", _xDocument );
1183 pElem->readFixedHyperLinkModel( all_styles );
1185 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlImageControlModel" ) )
1187 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":img", _xDocument );
1188 pElem->readImageControlModel( all_styles );
1190 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlFileControlModel" ) )
1192 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":filecontrol", _xDocument );
1193 pElem->readFileControlModel( all_styles );
1195 else if (xServiceInfo->supportsService( "com.sun.star.awt.tree.TreeControlModel" ) )
1197 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":treecontrol", _xDocument );
1198 pElem->readTreeControlModel( all_styles );
1200 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlCurrencyFieldModel" ) )
1202 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":currencyfield", _xDocument );
1203 pElem->readCurrencyFieldModel( all_styles );
1205 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlDateFieldModel" ) )
1207 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":datefield", _xDocument );
1208 pElem->readDateFieldModel( all_styles );
1210 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlNumericFieldModel" ) )
1212 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":numericfield", _xDocument );
1213 pElem->readNumericFieldModel( all_styles );
1215 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlTimeFieldModel" ) )
1217 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":timefield", _xDocument);
1218 pElem->readTimeFieldModel( all_styles );
1220 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlPatternFieldModel" ) )
1222 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":patternfield", _xDocument );
1223 pElem->readPatternFieldModel( all_styles );
1225 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlFormattedFieldModel" ) )
1227 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":formattedfield", _xDocument );
1228 pElem->readFormattedFieldModel( all_styles );
1230 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlFixedLineModel" ) )
1232 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":fixedline", _xDocument );
1233 pElem->readFixedLineModel( all_styles );
1235 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlScrollBarModel" ) )
1237 pElem = new ElementDescriptor(xProps, xPropState, XMLNS_DIALOGS_PREFIX ":scrollbar", _xDocument );
1238 pElem->readScrollBarModel( all_styles );
1240 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlSpinButtonModel" ) )
1242 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":spinbutton", _xDocument );
1243 pElem->readSpinButtonModel( all_styles );
1245 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlProgressBarModel" ) )
1247 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":progressmeter", _xDocument );
1248 pElem->readProgressBarModel( all_styles );
1250 else if (xServiceInfo->supportsService( "com.sun.star.awt.grid.UnoControlGridModel" ) )
1252 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":table", _xDocument );
1253 pElem->readGridControlModel( all_styles );
1256 if (pElem)
1258 all_elements.push_back( pElem );
1260 else
1262 OSL_FAIL( "unknown control type!" );
1263 continue;
1267 for (const rtl::Reference<ElementDescriptor> & p : all_elements)
1269 addSubElement( p );
1275 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */