bump product version to 4.1.6.2
[LibreOffice.git] / xmlscript / source / xmldlg_imexp / xmldlg_expmodels.cxx
blob2ff22084f4c34ef7d10c5a12af4f499c80b34798
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "exp_share.hxx"
22 #include <com/sun/star/form/binding/XListEntrySink.hpp>
23 #include <com/sun/star/form/binding/XBindableValue.hpp>
24 #include <com/sun/star/form/binding/XValueBinding.hpp>
25 #include <com/sun/star/table/CellAddress.hpp>
26 #include <com/sun/star/table/CellRangeAddress.hpp>
27 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
28 #include <com/sun/star/document/XStorageBasedDocument.hpp>
29 #include <com/sun/star/document/XGraphicObjectResolver.hpp>
30 #include <comphelper/componentcontext.hxx>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
33 using namespace ::com::sun::star;
34 using namespace ::com::sun::star::uno;
36 namespace xmlscript
39 static inline bool readBorderProps(
40 ElementDescriptor * element, Style & style )
42 if (element->readProp( &style._border, "Border" )) {
43 if (style._border == BORDER_SIMPLE /* simple */)
45 if (element->readProp( &style._borderColor, "BorderColor" ))
46 style._border = BORDER_SIMPLE_COLOR;
48 return true;
50 return false;
53 static inline bool readFontProps( ElementDescriptor * element, Style & style )
55 bool ret = element->readProp(
56 &style._descr, "FontDescriptor" );
57 ret |= element->readProp(
58 &style._fontEmphasisMark, "FontEmphasisMark" );
59 ret |= element->readProp(
60 &style._fontRelief, "FontRelief" );
61 return ret;
64 //__________________________________________________________________________________________________
65 void ElementDescriptor::readMultiPageModel( StyleBag * all_styles )
67 // collect styles
68 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
69 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
70 aStyle._set |= 0x1;
71 if (readProp( "TextColor" ) >>= aStyle._textColor)
72 aStyle._set |= 0x2;
73 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
74 aStyle._set |= 0x20;
75 if (readFontProps( this, aStyle ))
76 aStyle._set |= 0x8;
77 if (aStyle._set)
79 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id" , all_styles->getStyleId( aStyle ) );
82 // collect elements
83 readDefaults();
84 readLongAttr( "MultiPageValue", XMLNS_DIALOGS_PREFIX ":value" );
85 Any aDecorationAny( _xProps->getPropertyValue( "Decoration" ) );
86 bool bDecoration = sal_True;
87 if ( (aDecorationAny >>= bDecoration) && !bDecoration )
88 addAttribute( XMLNS_DIALOGS_PREFIX ":withtabs", "false" );
90 readEvents();
91 uno::Reference< container::XNameContainer > xPagesContainer( _xProps, uno::UNO_QUERY );
92 if ( xPagesContainer.is() && xPagesContainer->getElementNames().getLength() )
94 ElementDescriptor * pElem = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":bulletinboard", _xDocument );
95 pElem->readBullitinBoard( all_styles );
96 addSubElement( pElem );
99 //__________________________________________________________________________________________________
100 void ElementDescriptor::readFrameModel( StyleBag * all_styles )
102 // collect styles
103 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
105 if (readProp( "TextColor" ) >>= aStyle._textColor)
106 aStyle._set |= 0x2;
107 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
108 aStyle._set |= 0x20;
109 if (readFontProps( this, aStyle ))
110 aStyle._set |= 0x8;
111 if (aStyle._set)
113 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
116 // collect elements
117 readDefaults();
118 OUString aTitle;
120 if ( readProp( "Label" ) >>= aTitle)
122 ElementDescriptor * title = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":title", _xDocument );
123 title->addAttribute( XMLNS_DIALOGS_PREFIX ":value", aTitle );
124 addSubElement( title );
126 #ifdef SCROLLABLEFRAME
127 readScrollableSettings();
128 #endif
129 uno::Reference< container::XNameContainer > xControlContainer( _xProps, uno::UNO_QUERY );
130 if ( xControlContainer.is() && xControlContainer->getElementNames().getLength() )
132 ElementDescriptor * pElem = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":bulletinboard", _xDocument );
133 pElem->readBullitinBoard( all_styles );
134 addSubElement( pElem );
136 readEvents();
138 //__________________________________________________________________________________________________
139 void ElementDescriptor::readPageModel( StyleBag * all_styles )
141 // collect styles
142 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
143 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
144 aStyle._set |= 0x1;
145 if (readProp( "TextColor" ) >>= aStyle._textColor)
146 aStyle._set |= 0x2;
147 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
148 aStyle._set |= 0x20;
149 if (readFontProps( this, aStyle ))
150 aStyle._set |= 0x8;
151 if (aStyle._set)
153 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
156 // collect elements
157 readDefaults();
158 readStringAttr( "Title", XMLNS_DIALOGS_PREFIX ":title" );
159 uno::Reference< container::XNameContainer > xControlContainer( _xProps, uno::UNO_QUERY );
160 if ( xControlContainer.is() && xControlContainer->getElementNames().getLength() )
162 ElementDescriptor * pElem = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":bulletinboard", _xDocument );
163 pElem->readBullitinBoard( all_styles );
164 addSubElement( pElem );
166 readEvents();
169 void ElementDescriptor::readButtonModel( StyleBag * all_styles )
170 SAL_THROW( (Exception) )
172 // collect styles
173 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
174 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
175 aStyle._set |= 0x1;
176 if (readProp( "TextColor" ) >>= aStyle._textColor)
177 aStyle._set |= 0x2;
178 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
179 aStyle._set |= 0x20;
180 if (readFontProps( this, aStyle ))
181 aStyle._set |= 0x8;
182 if (aStyle._set)
184 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
187 // collect elements
188 readDefaults();
189 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
190 readBoolAttr( "DefaultButton", XMLNS_DIALOGS_PREFIX ":default" );
191 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX ":value" );
192 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
193 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
194 readButtonTypeAttr( "PushButtonType", XMLNS_DIALOGS_PREFIX ":button-type" );
195 readImageURLAttr( "ImageURL", XMLNS_DIALOGS_PREFIX ":image-src" );
198 readImagePositionAttr( "ImagePosition", XMLNS_DIALOGS_PREFIX ":image-position" );
199 readImageAlignAttr( "ImageAlign", XMLNS_DIALOGS_PREFIX ":image-align" );
201 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
202 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
204 if (extract_throw<bool>( _xProps->getPropertyValue( "Toggle" ) ))
205 addAttribute( XMLNS_DIALOGS_PREFIX ":toggled", "1" );
207 readBoolAttr( "FocusOnClick", XMLNS_DIALOGS_PREFIX ":grab-focus" );
208 readBoolAttr( "MultiLine",XMLNS_DIALOGS_PREFIX ":multiline" );
211 // State
212 sal_Int16 nState = 0;
213 if (readProp( "State" ) >>= nState)
215 switch (nState)
217 case 0:
218 addAttribute( XMLNS_DIALOGS_PREFIX ":checked", "false" );
219 break;
220 case 1:
221 addAttribute( XMLNS_DIALOGS_PREFIX ":checked", "true" );
222 break;
223 default:
224 OSL_FAIL( "### unexpected radio state!" );
225 break;
229 readEvents();
231 //__________________________________________________________________________________________________
232 void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles )
233 SAL_THROW( (Exception) )
235 // collect styles
236 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 | 0x40 );
237 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
238 aStyle._set |= 0x1;
239 if (readProp( "TextColor" ) >>= aStyle._textColor)
240 aStyle._set |= 0x2;
241 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
242 aStyle._set |= 0x20;
243 if (readFontProps( this, aStyle ))
244 aStyle._set |= 0x8;
245 if (readProp( "VisualEffect" ) >>= aStyle._visualEffect)
246 aStyle._set |= 0x40;
247 if (aStyle._set)
249 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
252 // collect elements
253 readDefaults();
254 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
255 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX ":value" );
256 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
257 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
258 readImageURLAttr( "ImageURL", XMLNS_DIALOGS_PREFIX ":image-src" );
259 readImagePositionAttr( "ImagePosition", XMLNS_DIALOGS_PREFIX ":image-position" );
260 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX ":multiline" );
262 sal_Bool bTriState = sal_False;
263 if ((readProp( "TriState" ) >>= bTriState) && bTriState)
265 addAttribute( XMLNS_DIALOGS_PREFIX ":tristate", "true" );
267 sal_Int16 nState = 0;
268 if (_xProps->getPropertyValue( "State" ) >>= nState)
270 switch (nState)
272 case 0:
273 addAttribute( XMLNS_DIALOGS_PREFIX ":checked", "false" );
274 break;
275 case 1:
276 addAttribute( XMLNS_DIALOGS_PREFIX ":checked", "true" );
277 break;
278 case 2: // tristate=true exported, checked omitted => dont know!
279 OSL_ENSURE( bTriState, "### detected tristate value, but TriState is not set!" );
280 break;
281 default:
282 OSL_FAIL( "### unexpected checkbox state!" );
283 break;
286 readEvents();
288 //__________________________________________________________________________________________________
289 void ElementDescriptor::readComboBoxModel( StyleBag * all_styles )
290 SAL_THROW( (Exception) )
292 // collect styles
293 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
294 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
295 aStyle._set |= 0x1;
296 if (readProp( "TextColor" ) >>= aStyle._textColor)
297 aStyle._set |= 0x2;
298 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
299 aStyle._set |= 0x20;
300 if (readBorderProps( this, aStyle ))
301 aStyle._set |= 0x4;
302 if (readFontProps( this, aStyle ))
303 aStyle._set |= 0x8;
304 if (aStyle._set)
306 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
309 // collect elements
310 readDefaults();
311 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
312 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":value" );
313 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
314 readBoolAttr( "Autocomplete", XMLNS_DIALOGS_PREFIX ":autocomplete" );
315 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
316 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
317 readBoolAttr( "Dropdown", XMLNS_DIALOGS_PREFIX ":spin" );
318 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX ":maxlength" );
319 readShortAttr( "LineCount", XMLNS_DIALOGS_PREFIX ":linecount" );
320 // Cell Range, Ref Cell etc.
321 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
322 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":source-cell-range" );
324 // string item list
325 Sequence< OUString > itemValues;
326 if ((readProp( "StringItemList" ) >>= itemValues) && itemValues.getLength() > 0)
328 ElementDescriptor * popup = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menupopup", _xDocument );
330 OUString const * pItemValues = itemValues.getConstArray();
331 for ( sal_Int32 nPos = 0; nPos < itemValues.getLength(); ++nPos )
333 ElementDescriptor * item = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menuitem", _xDocument );
334 item->addAttribute( XMLNS_DIALOGS_PREFIX ":value", pItemValues[ nPos ] );
335 popup->addSubElement( item );
338 addSubElement( popup );
340 readEvents();
342 //__________________________________________________________________________________________________
343 void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
344 SAL_THROW( (Exception) )
346 // collect styles
347 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
348 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
349 aStyle._set |= 0x1;
350 if (readProp( "TextColor" ) >>= aStyle._textColor)
351 aStyle._set |= 0x2;
352 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
353 aStyle._set |= 0x20;
354 if (readBorderProps( this, aStyle ))
355 aStyle._set |= 0x4;
356 if (readFontProps( this, aStyle ))
357 aStyle._set |= 0x8;
358 if (aStyle._set)
360 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
363 // collect elements
364 readDefaults();
365 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
366 readBoolAttr( "MultiSelection", XMLNS_DIALOGS_PREFIX ":multiselection" );
367 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
368 readBoolAttr( "Dropdown", XMLNS_DIALOGS_PREFIX ":spin" );
369 readShortAttr( "LineCount", XMLNS_DIALOGS_PREFIX ":linecount" );
370 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
371 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
372 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":source-cell-range" );
373 // string item list
374 Sequence< OUString > itemValues;
375 if ((readProp( "StringItemList" ) >>= itemValues) && itemValues.getLength() > 0)
377 ElementDescriptor * popup = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menupopup", _xDocument );
379 OUString const * pItemValues = itemValues.getConstArray();
380 sal_Int32 nPos;
381 for ( nPos = 0; nPos < itemValues.getLength(); ++nPos )
383 ElementDescriptor * item = new ElementDescriptor(_xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menuitem", _xDocument );
384 item->addAttribute( XMLNS_DIALOGS_PREFIX ":value", pItemValues[ nPos ] );
385 popup->addSubElement( item );
388 Sequence< sal_Int16 > selected;
389 if (readProp( "SelectedItems" ) >>= selected)
391 sal_Int16 const * pSelected = selected.getConstArray();
392 for ( nPos = selected.getLength(); nPos--; )
394 ElementDescriptor * item = static_cast< ElementDescriptor * >(
395 popup->getSubElement( pSelected[ nPos ] ).get() );
396 item->addAttribute( XMLNS_DIALOGS_PREFIX ":selected", "true" );
400 addSubElement( popup );
402 readEvents();
404 //__________________________________________________________________________________________________
405 void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles )
406 SAL_THROW( (Exception) )
408 // collect styles
409 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 | 0x40 );
410 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
411 aStyle._set |= 0x1;
412 if (readProp( "TextColor" ) >>= aStyle._textColor)
413 aStyle._set |= 0x2;
414 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
415 aStyle._set |= 0x20;
416 if (readFontProps( this, aStyle ))
417 aStyle._set |= 0x8;
418 if (readProp( "VisualEffect" ) >>= aStyle._visualEffect)
419 aStyle._set |= 0x40;
420 if (aStyle._set)
422 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id" , all_styles->getStyleId( aStyle ) );
425 // collect elements
426 readDefaults();
427 readBoolAttr("Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
428 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX ":value" );
429 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
430 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
431 readImageURLAttr( "ImageURL", XMLNS_DIALOGS_PREFIX ":image-src" );
432 readImagePositionAttr( "ImagePosition", XMLNS_DIALOGS_PREFIX ":image-position" );
433 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX ":multiline" );
434 readStringAttr( "GroupName", XMLNS_DIALOGS_PREFIX ":group-name" );
436 sal_Int16 nState = 0;
437 if (readProp( "State" ) >>= nState)
439 switch (nState)
441 case 0:
442 addAttribute(XMLNS_DIALOGS_PREFIX ":checked", "false" );
443 break;
444 case 1:
445 addAttribute( XMLNS_DIALOGS_PREFIX ":checked", "true" );
446 break;
447 default:
448 OSL_FAIL( "### unexpected radio state!" );
449 break;
452 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
453 readEvents();
455 //__________________________________________________________________________________________________
456 void ElementDescriptor::readGroupBoxModel( StyleBag * all_styles )
457 SAL_THROW( (Exception) )
459 // collect styles
460 Style aStyle( 0x2 | 0x8 | 0x20 );
461 if (readProp( "TextColor" ) >>= aStyle._textColor)
462 aStyle._set |= 0x2;
463 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
464 aStyle._set |= 0x20;
465 if (readFontProps( this, aStyle ))
466 aStyle._set |= 0x8;
467 if (aStyle._set)
469 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
472 // collect elements
473 readDefaults();
475 OUString aTitle;
476 if (readProp( "Label" ) >>= aTitle)
478 ElementDescriptor * title = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":title", _xDocument );
479 title->addAttribute( XMLNS_DIALOGS_PREFIX ":value", aTitle );
480 addSubElement( title );
483 readEvents();
485 //__________________________________________________________________________________________________
486 void ElementDescriptor::readFixedTextModel( StyleBag * all_styles )
487 SAL_THROW( (Exception) )
489 // collect styles
490 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
491 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
492 aStyle._set |= 0x1;
493 if (readProp( "TextColor" ) >>= aStyle._textColor)
494 aStyle._set |= 0x2;
495 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
496 aStyle._set |= 0x20;
497 if (readBorderProps( this, aStyle ))
498 aStyle._set |= 0x4;
499 if (readFontProps( this, aStyle ))
500 aStyle._set |= 0x8;
501 if (aStyle._set)
503 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
506 // collect elements
507 readDefaults();
508 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX ":value" );
509 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
510 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
511 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX ":multiline" );
512 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
513 readBoolAttr( "NoLabel", XMLNS_DIALOGS_PREFIX ":nolabel" );
514 readEvents();
516 //__________________________________________________________________________________________________
517 void ElementDescriptor::readFixedHyperLinkModel( StyleBag * all_styles )
518 SAL_THROW( (Exception) )
520 // collect styles
521 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
522 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
523 aStyle._set |= 0x1;
524 if (readProp( "TextColor" ) >>= aStyle._textColor)
525 aStyle._set |= 0x2;
526 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
527 aStyle._set |= 0x20;
528 if (readBorderProps( this, aStyle ))
529 aStyle._set |= 0x4;
530 if (readFontProps( this, aStyle ))
531 aStyle._set |= 0x8;
532 if (aStyle._set)
534 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
537 // collect elements
538 readDefaults();
539 readStringAttr( "Label",XMLNS_DIALOGS_PREFIX ":value" );
540 readStringAttr( "URL", XMLNS_DIALOGS_PREFIX ":url" );
541 readStringAttr( "Description", XMLNS_DIALOGS_PREFIX ":description" );
542 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
543 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX ":valign" );
544 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX ":multiline" );
545 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
546 readBoolAttr( "NoLabel", XMLNS_DIALOGS_PREFIX ":nolabel" );
547 readEvents();
549 //__________________________________________________________________________________________________
550 void ElementDescriptor::readEditModel( StyleBag * all_styles )
551 SAL_THROW( (Exception) )
553 // collect styles
554 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
555 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
556 aStyle._set |= 0x1;
557 if (readProp( "TextColor" ) >>= aStyle._textColor)
558 aStyle._set |= 0x2;
559 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
560 aStyle._set |= 0x20;
561 if (readBorderProps( this, aStyle ))
562 aStyle._set |= 0x4;
563 if (readFontProps( this, aStyle ))
564 aStyle._set |= 0x8;
565 if (aStyle._set)
567 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
570 // collect elements
571 readDefaults();
572 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
573 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
574 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
575 readBoolAttr( "HardLineBreaks", XMLNS_DIALOGS_PREFIX ":hard-linebreaks" );
576 readBoolAttr( "HScroll", XMLNS_DIALOGS_PREFIX ":hscroll" );
577 readBoolAttr( "VScroll", XMLNS_DIALOGS_PREFIX ":vscroll" );
578 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX ":maxlength" );
579 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX ":multiline" );
580 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
581 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":value" );
582 readLineEndFormatAttr( "LineEndFormat", XMLNS_DIALOGS_PREFIX ":lineend-format" );
583 sal_Int16 nEcho = 0;
584 if (readProp( "EchoChar" ) >>= nEcho)
586 sal_Unicode cEcho = (sal_Unicode)nEcho;
587 addAttribute( XMLNS_DIALOGS_PREFIX ":echochar", OUString( &cEcho, 1 ) );
589 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
590 readEvents();
592 //__________________________________________________________________________________________________
593 void ElementDescriptor::readImageControlModel( StyleBag * all_styles )
594 SAL_THROW( (Exception) )
596 // collect styles
597 Style aStyle( 0x1 | 0x4 );
598 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
599 aStyle._set |= 0x1;
600 if (readBorderProps( this, aStyle ))
601 aStyle._set |= 0x4;
602 if (aStyle._set)
604 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
607 // collect elements
608 readDefaults();
609 readBoolAttr( "ScaleImage", XMLNS_DIALOGS_PREFIX ":scale-image" );
610 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
611 readImageURLAttr( "ImageURL", XMLNS_DIALOGS_PREFIX ":src" );
612 readEvents();
614 //__________________________________________________________________________________________________
615 void ElementDescriptor::readFileControlModel( StyleBag * all_styles )
616 SAL_THROW( (Exception) )
618 // collect styles
619 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
620 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
621 aStyle._set |= 0x1;
622 if (readProp( "TextColor" ) >>= aStyle._textColor)
623 aStyle._set |= 0x2;
624 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
625 aStyle._set |= 0x20;
626 if (readBorderProps( this, aStyle ))
627 aStyle._set |= 0x4;
628 if (readFontProps( this, aStyle ))
629 aStyle._set |= 0x8;
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 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
639 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":value" );
640 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
641 readEvents();
643 //__________________________________________________________________________________________________
644 void ElementDescriptor::readTreeControlModel( StyleBag * all_styles )
645 SAL_THROW( (Exception) )
647 // collect styles
648 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
649 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
650 aStyle._set |= 0x1;
651 if (readBorderProps( this, aStyle ))
652 aStyle._set |= 0x4;
653 if (aStyle._set)
655 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
658 // collect elements
659 readDefaults();
660 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
661 readSelectionTypeAttr( "SelectionType", XMLNS_DIALOGS_PREFIX ":selectiontype" );
663 readBoolAttr( "RootDisplayed", XMLNS_DIALOGS_PREFIX ":rootdisplayed" );
664 readBoolAttr( "ShowsHandles", XMLNS_DIALOGS_PREFIX ":showshandles" );
665 readBoolAttr( "ShowsRootHandles", XMLNS_DIALOGS_PREFIX ":showsroothandles" );
666 readBoolAttr( "Editable", XMLNS_DIALOGS_PREFIX ":editable" );
667 readBoolAttr( "InvokesStopNodeEditing", XMLNS_DIALOGS_PREFIX ":invokesstopnodeediting" );
668 readLongAttr( "RowHeight", XMLNS_DIALOGS_PREFIX ":rowheight" );
669 readEvents();
671 //__________________________________________________________________________________________________
672 void ElementDescriptor::readCurrencyFieldModel( StyleBag * all_styles )
673 SAL_THROW( (Exception) )
675 // collect styles
676 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
677 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
678 aStyle._set |= 0x1;
679 if (readProp( "TextColor" ) >>= aStyle._textColor)
680 aStyle._set |= 0x2;
681 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
682 aStyle._set |= 0x20;
683 if (readBorderProps( this, aStyle ))
684 aStyle._set |= 0x4;
685 if (readFontProps( this, aStyle ))
686 aStyle._set |= 0x8;
687 if (aStyle._set)
689 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
692 // collect elements
693 readDefaults();
694 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
695 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
696 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
697 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
698 readStringAttr( "CurrencySymbol", XMLNS_DIALOGS_PREFIX ":currency-symbol" );
699 readShortAttr( "DecimalAccuracy", XMLNS_DIALOGS_PREFIX ":decimal-accuracy" );
700 readBoolAttr( "ShowThousandsSeparator", XMLNS_DIALOGS_PREFIX ":thousands-separator" );
701 readDoubleAttr( "Value", XMLNS_DIALOGS_PREFIX ":value" );
702 readDoubleAttr( "ValueMin", XMLNS_DIALOGS_PREFIX ":value-min" );
703 readDoubleAttr( "ValueMax", XMLNS_DIALOGS_PREFIX ":value-max" );
704 readDoubleAttr( "ValueStep", XMLNS_DIALOGS_PREFIX ":value-step" );
705 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX ":spin" );
706 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
707 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
708 readBoolAttr("PrependCurrencySymbol", XMLNS_DIALOGS_PREFIX ":prepend-symbol" );
709 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX ":enforce-format" );
710 readEvents();
712 //__________________________________________________________________________________________________
713 void ElementDescriptor::readDateFieldModel( StyleBag * all_styles )
714 SAL_THROW( (Exception) )
716 // collect styles
717 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
718 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
719 aStyle._set |= 0x1;
720 if (readProp( "TextColor" ) >>= aStyle._textColor)
721 aStyle._set |= 0x2;
722 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
723 aStyle._set |= 0x20;
724 if (readBorderProps( this, aStyle ))
725 aStyle._set |= 0x4;
726 if (readFontProps( this, aStyle ))
727 aStyle._set |= 0x8;
728 if (aStyle._set)
730 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
733 // collect elements
734 readDefaults();
735 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
736 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
737 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
738 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
739 readDateFormatAttr( "DateFormat", XMLNS_DIALOGS_PREFIX ":date-format" );
740 readBoolAttr( "DateShowCentury", XMLNS_DIALOGS_PREFIX ":show-century" );
741 readDateAttr( "Date", XMLNS_DIALOGS_PREFIX ":value" );
742 readDateAttr( "DateMin", XMLNS_DIALOGS_PREFIX ":value-min" );
743 readDateAttr( "DateMax", XMLNS_DIALOGS_PREFIX ":value-max" );
744 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX ":spin" );
745 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
746 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
747 readBoolAttr( "Dropdown", XMLNS_DIALOGS_PREFIX ":dropdown" );
748 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":text" );
749 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX ":enforce-format" );
750 readEvents();
752 //__________________________________________________________________________________________________
753 void ElementDescriptor::readNumericFieldModel( StyleBag * all_styles )
754 SAL_THROW( (Exception) )
756 // collect styles
757 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
758 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
759 aStyle._set |= 0x1;
760 if (readProp( "TextColor" ) >>= aStyle._textColor)
761 aStyle._set |= 0x2;
762 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
763 aStyle._set |= 0x20;
764 if (readBorderProps( this, aStyle ))
765 aStyle._set |= 0x4;
766 if (readFontProps( this, aStyle ))
767 aStyle._set |= 0x8;
768 if (aStyle._set)
770 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
773 // collect elements
774 readDefaults();
775 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
776 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
777 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
778 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
779 readShortAttr( "DecimalAccuracy", XMLNS_DIALOGS_PREFIX ":decimal-accuracy" );
780 readBoolAttr( "ShowThousandsSeparator", XMLNS_DIALOGS_PREFIX ":thousands-separator" );
781 readDoubleAttr( "Value", XMLNS_DIALOGS_PREFIX ":value" );
782 readDoubleAttr( "ValueMin", XMLNS_DIALOGS_PREFIX ":value-min" );
783 readDoubleAttr( "ValueMax", XMLNS_DIALOGS_PREFIX ":value-max" );
784 readDoubleAttr( "ValueStep", XMLNS_DIALOGS_PREFIX ":value-step" );
785 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX ":spin" );
786 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
787 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
788 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX ":enforce-format" );
789 readEvents();
791 //__________________________________________________________________________________________________
792 void ElementDescriptor::readTimeFieldModel( StyleBag * all_styles )
793 SAL_THROW( (Exception) )
795 // collect styles
796 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
797 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
798 aStyle._set |= 0x1;
799 if (readProp( "TextColor" ) >>= aStyle._textColor)
800 aStyle._set |= 0x2;
801 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
802 aStyle._set |= 0x20;
803 if (readBorderProps( this, aStyle ))
804 aStyle._set |= 0x4;
805 if (readFontProps( this, aStyle ))
806 aStyle._set |= 0x8;
807 if (aStyle._set)
809 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
812 // collect elements
813 readDefaults();
814 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop");
815 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
816 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
817 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
818 readTimeFormatAttr( "TimeFormat", XMLNS_DIALOGS_PREFIX ":time-format" );
819 readTimeAttr( "Time", XMLNS_DIALOGS_PREFIX ":value" );
820 readTimeAttr( "TimeMin", XMLNS_DIALOGS_PREFIX ":value-min" );
821 readTimeAttr( "TimeMax", XMLNS_DIALOGS_PREFIX ":value-max" );
822 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX ":spin" );
823 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
824 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
825 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":text" );
826 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX ":enforce-format" );
827 readEvents();
829 //__________________________________________________________________________________________________
830 void ElementDescriptor::readPatternFieldModel( StyleBag * all_styles )
831 SAL_THROW( (Exception) )
833 // collect styles
834 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
835 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
836 aStyle._set |= 0x1;
837 if (readProp( "TextColor" ) >>= aStyle._textColor)
838 aStyle._set |= 0x2;
839 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
840 aStyle._set |= 0x20;
841 if (readBorderProps( this, aStyle ))
842 aStyle._set |= 0x4;
843 if (readFontProps( this, aStyle ))
844 aStyle._set |= 0x8;
845 if (aStyle._set)
847 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
850 // collect elements
851 readDefaults();
852 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
853 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
854 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
855 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
856 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":value" );
857 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX ":maxlength" );
858 readStringAttr( "EditMask", XMLNS_DIALOGS_PREFIX ":edit-mask" );
859 readStringAttr( "LiteralMask", XMLNS_DIALOGS_PREFIX ":literal-mask" );
860 readEvents();
862 //__________________________________________________________________________________________________
863 void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles )
864 SAL_THROW( (Exception) )
866 // collect styles
867 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
868 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
869 aStyle._set |= 0x1;
870 if (readProp( "TextColor" ) >>= aStyle._textColor)
871 aStyle._set |= 0x2;
872 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
873 aStyle._set |= 0x20;
874 if (readBorderProps( this, aStyle ))
875 aStyle._set |= 0x4;
876 if (readFontProps( this, aStyle ))
877 aStyle._set |= 0x8;
878 if (aStyle._set)
880 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
883 // collect elements
884 readDefaults();
885 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
886 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX ":readonly" );
887 readBoolAttr( "HideInactiveSelection",XMLNS_DIALOGS_PREFIX ":hide-inactive-selection" );
888 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX ":strict-format" );
889 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX ":text" );
890 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX ":align" );
891 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX ":maxlength" );
892 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX ":spin" );
893 if (extract_throw<bool>( _xProps->getPropertyValue( "Repeat" ) ))
894 readLongAttr( "RepeatDelay",XMLNS_DIALOGS_PREFIX ":repeat", true /* force */ );
896 Any a( readProp( "EffectiveDefault" ) );
897 switch (a.getValueTypeClass())
899 case TypeClass_DOUBLE:
900 addAttribute( XMLNS_DIALOGS_PREFIX ":value-default", OUString::valueOf( *(double const *)a.getValue() ) );
901 break;
902 case TypeClass_STRING:
903 addAttribute( XMLNS_DIALOGS_PREFIX ":value-default", *(OUString const *)a.getValue() );
904 break;
905 default:
906 break;
908 readDoubleAttr( "EffectiveMin", XMLNS_DIALOGS_PREFIX ":value-min" );
909 readDoubleAttr( "EffectiveMax", XMLNS_DIALOGS_PREFIX ":value-max" );
910 readDoubleAttr( "EffectiveValue", XMLNS_DIALOGS_PREFIX ":value" );
912 // format spec
913 sal_Int32 nKey = 0;
914 if (readProp( "FormatKey" ) >>= nKey)
916 Reference< util::XNumberFormatsSupplier > xSupplier;
917 if (readProp( "FormatsSupplier" ) >>= xSupplier)
919 addNumberFormatAttr(
920 xSupplier->getNumberFormats()->getByKey( nKey ) );
923 readBoolAttr( "TreatAsNumber", XMLNS_DIALOGS_PREFIX ":treat-as-number" );
924 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX ":enforce-format" );
926 readEvents();
929 void ElementDescriptor::readSpinButtonModel( StyleBag * all_styles )
930 SAL_THROW( (Exception) )
932 // collect styles
933 Style aStyle( 0x1 | 0x4 );
934 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
935 aStyle._set |= 0x1;
936 if (readBorderProps( this, aStyle ))
937 aStyle._set |= 0x4;
938 if (aStyle._set)
940 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
943 // collect elements
944 readDefaults();
945 readOrientationAttr( "Orientation", XMLNS_DIALOGS_PREFIX ":align" );
946 readLongAttr( "SpinIncrement", XMLNS_DIALOGS_PREFIX ":increment" );
947 readLongAttr( "SpinValue", XMLNS_DIALOGS_PREFIX ":curval" );
948 readLongAttr( "SpinValueMax", XMLNS_DIALOGS_PREFIX ":maxval" );
949 readLongAttr( "SpinValueMin", XMLNS_DIALOGS_PREFIX ":minval" );
950 readLongAttr( "Repeat", XMLNS_DIALOGS_PREFIX ":repeat" );
951 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat-delay" );
952 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
953 readHexLongAttr( "SymbolColor", XMLNS_DIALOGS_PREFIX ":symbol-color" );
954 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
955 readEvents();
958 //__________________________________________________________________________________________________
959 void ElementDescriptor::readFixedLineModel( StyleBag * all_styles )
960 SAL_THROW( (Exception) )
962 // collect styles
963 Style aStyle( 0x2 | 0x8 | 0x20 );
964 if (readProp( "TextColor" ) >>= aStyle._textColor)
965 aStyle._set |= 0x2;
966 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
967 aStyle._set |= 0x20;
968 if (readFontProps( this, aStyle ))
969 aStyle._set |= 0x8;
970 if (aStyle._set)
972 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
975 // collect elements
976 readDefaults();
977 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX ":value" );
978 readOrientationAttr( "Orientation", XMLNS_DIALOGS_PREFIX ":align" );
979 readEvents();
981 //__________________________________________________________________________________________________
982 void ElementDescriptor::readProgressBarModel( StyleBag * all_styles )
983 SAL_THROW( (Exception) )
985 // collect styles
986 Style aStyle( 0x1 | 0x4 | 0x10 );
987 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
988 aStyle._set |= 0x1;
989 if (readBorderProps( this, aStyle ))
990 aStyle._set |= 0x4;
991 if (readProp( "FillColor" ) >>= aStyle._descr)
992 aStyle._set |= 0x10;
993 if (aStyle._set)
995 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
998 // collect elements
999 readDefaults();
1000 readLongAttr( "ProgressValue", XMLNS_DIALOGS_PREFIX ":value" );
1001 readLongAttr( "ProgressValueMin", XMLNS_DIALOGS_PREFIX ":value-min" );
1002 readLongAttr( "ProgressValueMax", XMLNS_DIALOGS_PREFIX ":value-max" );
1003 readEvents();
1005 //__________________________________________________________________________________________________
1006 void ElementDescriptor::readScrollBarModel( StyleBag * all_styles )
1007 SAL_THROW( (Exception) )
1009 // collect styles
1010 Style aStyle( 0x1 | 0x4 );
1011 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
1012 aStyle._set |= 0x1;
1013 if (readBorderProps( this, aStyle ))
1014 aStyle._set |= 0x4;
1015 if (aStyle._set)
1017 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
1020 // collect elements
1021 readDefaults();
1022 readOrientationAttr( "Orientation", XMLNS_DIALOGS_PREFIX ":align" );
1023 readLongAttr( "BlockIncrement", XMLNS_DIALOGS_PREFIX ":pageincrement" );
1024 readLongAttr( "LineIncrement", XMLNS_DIALOGS_PREFIX ":increment" );
1025 readLongAttr( "ScrollValue", XMLNS_DIALOGS_PREFIX ":curpos" );
1026 readLongAttr( "ScrollValueMax", XMLNS_DIALOGS_PREFIX ":maxpos" );
1027 readLongAttr( "ScrollValueMin", XMLNS_DIALOGS_PREFIX ":minpos" );
1028 readLongAttr( "VisibleSize", XMLNS_DIALOGS_PREFIX ":visible-size" );
1029 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX ":repeat" );
1030 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX ":tabstop" );
1031 readBoolAttr( "LiveScroll", XMLNS_DIALOGS_PREFIX ":live-scroll" );
1032 readHexLongAttr( "SymbolColor", XMLNS_DIALOGS_PREFIX ":symbol-color" );
1033 readDataAwareAttr( XMLNS_DIALOGS_PREFIX ":linked-cell" );
1034 readEvents();
1036 //__________________________________________________________________________________________________
1037 void ElementDescriptor::readDialogModel( StyleBag * all_styles )
1038 SAL_THROW( (Exception) )
1040 // collect elements
1041 addAttribute( "xmlns:" XMLNS_DIALOGS_PREFIX, XMLNS_DIALOGS_URI );
1042 addAttribute( "xmlns:" XMLNS_SCRIPT_PREFIX, XMLNS_SCRIPT_URI );
1044 // collect styles
1045 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
1046 if (readProp( "BackgroundColor" ) >>= aStyle._backgroundColor)
1047 aStyle._set |= 0x1;
1048 if (readProp( "TextColor" ) >>= aStyle._textColor)
1049 aStyle._set |= 0x2;
1050 if (readProp( "TextLineColor" ) >>= aStyle._textLineColor)
1051 aStyle._set |= 0x20;
1052 if (readFontProps( this, aStyle ))
1053 aStyle._set |= 0x8;
1054 if (aStyle._set)
1056 addAttribute( XMLNS_DIALOGS_PREFIX ":style-id", all_styles->getStyleId( aStyle ) );
1059 // collect elements
1060 readDefaults( false, false );
1061 readBoolAttr("Closeable", XMLNS_DIALOGS_PREFIX ":closeable" );
1062 readBoolAttr( "Moveable", XMLNS_DIALOGS_PREFIX ":moveable" );
1063 readBoolAttr( "Sizeable", XMLNS_DIALOGS_PREFIX ":resizeable" );
1064 readStringAttr( "Title", XMLNS_DIALOGS_PREFIX ":title" );
1066 readScrollableSettings();
1067 Any aDecorationAny( _xProps->getPropertyValue( "Decoration" ) );
1068 bool bDecoration = sal_False;
1069 if ( (aDecorationAny >>= bDecoration) && !bDecoration )
1070 addAttribute( XMLNS_DIALOGS_PREFIX ":withtitlebar", "false" );
1071 readImageURLAttr( "ImageURL", XMLNS_DIALOGS_PREFIX ":image-src" );
1072 readEvents();
1075 void ElementDescriptor::readBullitinBoard( StyleBag * all_styles )
1076 SAL_THROW( (Exception) )
1078 // collect elements
1079 ::std::vector< ElementDescriptor* > all_elements;
1080 // read out all props
1081 Reference< container::XNameContainer > xDialogModel( _xProps, UNO_QUERY );
1082 if ( !xDialogModel.is() )
1083 return; // #TODO throw???
1084 Sequence< OUString > aElements( xDialogModel->getElementNames() );
1085 OUString const * pElements = aElements.getConstArray();
1087 ElementDescriptor * pRadioGroup = 0;
1089 sal_Int32 nPos;
1090 for ( nPos = 0; nPos < aElements.getLength(); ++nPos )
1092 Any aControlModel( xDialogModel->getByName( pElements[ nPos ] ) );
1093 Reference< beans::XPropertySet > xProps;
1094 OSL_VERIFY( aControlModel >>= xProps );
1095 if (! xProps.is())
1096 continue;
1097 Reference< beans::XPropertyState > xPropState( xProps, UNO_QUERY );
1098 OSL_ENSURE( xPropState.is(), "no XPropertyState!" );
1099 if (! xPropState.is())
1100 continue;
1101 Reference< lang::XServiceInfo > xServiceInfo( xProps, UNO_QUERY );
1102 OSL_ENSURE( xServiceInfo.is(), "no XServiceInfo!" );
1103 if (! xServiceInfo.is())
1104 continue;
1106 ElementDescriptor * pElem = 0;
1108 // group up radio buttons
1109 if ( xServiceInfo->supportsService( "com.sun.star.awt.UnoControlRadioButtonModel" ) )
1111 if (! pRadioGroup) // open radiogroup
1113 pRadioGroup = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":radiogroup", _xDocument );
1114 all_elements.push_back( pRadioGroup );
1117 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":radio", _xDocument );
1118 pElem->readRadioButtonModel( all_styles );
1119 pRadioGroup->addSubElement( pElem );
1121 else // no radio
1123 pRadioGroup = 0; // close radiogroup
1125 if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlButtonModel" ) )
1127 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":button", _xDocument );
1128 pElem->readButtonModel( all_styles );
1130 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlCheckBoxModel" ) )
1132 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":checkbox", _xDocument );
1133 pElem->readCheckBoxModel( all_styles );
1135 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlComboBoxModel" ) )
1137 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":combobox", _xDocument );
1138 pElem->readComboBoxModel( all_styles );
1140 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlListBoxModel" ) )
1142 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":menulist", _xDocument );
1143 pElem->readListBoxModel( all_styles );
1145 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlGroupBoxModel" ) )
1147 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":titledbox", _xDocument );
1148 pElem->readGroupBoxModel( all_styles );
1150 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoMultiPageModel" ) )
1152 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":multipage", _xDocument );
1153 pElem->readMultiPageModel( all_styles );
1155 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoFrameModel" ) )
1157 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":frame", _xDocument );
1158 pElem->readFrameModel( all_styles );
1160 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoPageModel" ) )
1162 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":page", _xDocument );
1163 pElem->readPageModel( all_styles );
1165 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlFixedTextModel" ) )
1167 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":text", _xDocument );
1168 pElem->readFixedTextModel( all_styles );
1170 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlEditModel" ) )
1172 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":textfield", _xDocument );
1173 pElem->readEditModel( all_styles );
1175 // FixedHyperLink
1176 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlFixedHyperlinkModel" ) )
1178 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":linklabel", _xDocument );
1179 pElem->readFixedHyperLinkModel( all_styles );
1181 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlImageControlModel" ) )
1183 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":img", _xDocument );
1184 pElem->readImageControlModel( all_styles );
1186 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlFileControlModel" ) )
1188 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":filecontrol", _xDocument );
1189 pElem->readFileControlModel( all_styles );
1191 else if (xServiceInfo->supportsService( "com.sun.star.awt.tree.TreeControlModel" ) )
1193 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":treecontrol", _xDocument );
1194 pElem->readTreeControlModel( all_styles );
1196 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlCurrencyFieldModel" ) )
1198 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":currencyfield", _xDocument );
1199 pElem->readCurrencyFieldModel( all_styles );
1201 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlDateFieldModel" ) )
1203 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":datefield", _xDocument );
1204 pElem->readDateFieldModel( all_styles );
1206 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlNumericFieldModel" ) )
1208 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":numericfield", _xDocument );
1209 pElem->readNumericFieldModel( all_styles );
1211 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlTimeFieldModel" ) )
1213 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":timefield", _xDocument);
1214 pElem->readTimeFieldModel( all_styles );
1216 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlPatternFieldModel" ) )
1218 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":patternfield", _xDocument );
1219 pElem->readPatternFieldModel( all_styles );
1221 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlFormattedFieldModel" ) )
1223 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":formattedfield", _xDocument );
1224 pElem->readFormattedFieldModel( all_styles );
1226 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlFixedLineModel" ) )
1228 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":fixedline", _xDocument );
1229 pElem->readFixedLineModel( all_styles );
1231 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlScrollBarModel" ) )
1233 pElem = new ElementDescriptor(xProps, xPropState, XMLNS_DIALOGS_PREFIX ":scrollbar", _xDocument );
1234 pElem->readScrollBarModel( all_styles );
1236 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlSpinButtonModel" ) )
1238 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":spinbutton", _xDocument );
1239 pElem->readSpinButtonModel( all_styles );
1241 else if (xServiceInfo->supportsService( "com.sun.star.awt.UnoControlProgressBarModel" ) )
1243 pElem = new ElementDescriptor( xProps, xPropState, XMLNS_DIALOGS_PREFIX ":progressmeter", _xDocument );
1244 pElem->readProgressBarModel( all_styles );
1247 if (pElem)
1249 all_elements.push_back( pElem );
1251 else
1253 OSL_FAIL( "unknown control type!" );
1254 continue;
1258 if (! all_elements.empty())
1260 for ( std::size_t n = 0; n < all_elements.size(); ++n )
1262 addSubElement( all_elements[ n ] );
1269 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */