1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
;
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
;
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" );
64 //__________________________________________________________________________________________________
65 void ElementDescriptor::readMultiPageModel( StyleBag
* all_styles
)
68 Style
aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
69 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
71 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
73 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
75 if (readFontProps( this, aStyle
))
79 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id" , all_styles
->getStyleId( aStyle
) );
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" );
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
)
103 Style
aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
105 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
107 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
109 if (readFontProps( this, aStyle
))
113 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
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();
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
);
138 //__________________________________________________________________________________________________
139 void ElementDescriptor::readPageModel( StyleBag
* all_styles
)
142 Style
aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
143 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
145 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
147 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
149 if (readFontProps( this, aStyle
))
153 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
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
);
169 void ElementDescriptor::readButtonModel( StyleBag
* all_styles
)
170 SAL_THROW( (Exception
) )
173 Style
aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
174 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
176 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
178 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
180 if (readFontProps( this, aStyle
))
184 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
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" );
212 sal_Int16 nState
= 0;
213 if (readProp( "State" ) >>= nState
)
218 addAttribute( XMLNS_DIALOGS_PREFIX
":checked", "false" );
221 addAttribute( XMLNS_DIALOGS_PREFIX
":checked", "true" );
224 OSL_FAIL( "### unexpected radio state!" );
231 //__________________________________________________________________________________________________
232 void ElementDescriptor::readCheckBoxModel( StyleBag
* all_styles
)
233 SAL_THROW( (Exception
) )
236 Style
aStyle( 0x1 | 0x2 | 0x8 | 0x20 | 0x40 );
237 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
239 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
241 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
243 if (readFontProps( this, aStyle
))
245 if (readProp( "VisualEffect" ) >>= aStyle
._visualEffect
)
249 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
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
)
273 addAttribute( XMLNS_DIALOGS_PREFIX
":checked", "false" );
276 addAttribute( XMLNS_DIALOGS_PREFIX
":checked", "true" );
278 case 2: // tristate=true exported, checked omitted => dont know!
279 OSL_ENSURE( bTriState
, "### detected tristate value, but TriState is not set!" );
282 OSL_FAIL( "### unexpected checkbox state!" );
288 //__________________________________________________________________________________________________
289 void ElementDescriptor::readComboBoxModel( StyleBag
* all_styles
)
290 SAL_THROW( (Exception
) )
293 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
294 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
296 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
298 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
300 if (readBorderProps( this, aStyle
))
302 if (readFontProps( this, aStyle
))
306 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
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" );
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
);
342 //__________________________________________________________________________________________________
343 void ElementDescriptor::readListBoxModel( StyleBag
* all_styles
)
344 SAL_THROW( (Exception
) )
347 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
348 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
350 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
352 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
354 if (readBorderProps( this, aStyle
))
356 if (readFontProps( this, aStyle
))
360 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
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" );
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();
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
);
404 //__________________________________________________________________________________________________
405 void ElementDescriptor::readRadioButtonModel( StyleBag
* all_styles
)
406 SAL_THROW( (Exception
) )
409 Style
aStyle( 0x1 | 0x2 | 0x8 | 0x20 | 0x40 );
410 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
412 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
414 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
416 if (readFontProps( this, aStyle
))
418 if (readProp( "VisualEffect" ) >>= aStyle
._visualEffect
)
422 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id" , all_styles
->getStyleId( aStyle
) );
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
)
442 addAttribute(XMLNS_DIALOGS_PREFIX
":checked", "false" );
445 addAttribute( XMLNS_DIALOGS_PREFIX
":checked", "true" );
448 OSL_FAIL( "### unexpected radio state!" );
452 readDataAwareAttr( XMLNS_DIALOGS_PREFIX
":linked-cell" );
455 //__________________________________________________________________________________________________
456 void ElementDescriptor::readGroupBoxModel( StyleBag
* all_styles
)
457 SAL_THROW( (Exception
) )
460 Style
aStyle( 0x2 | 0x8 | 0x20 );
461 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
463 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
465 if (readFontProps( this, aStyle
))
469 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
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
);
485 //__________________________________________________________________________________________________
486 void ElementDescriptor::readFixedTextModel( StyleBag
* all_styles
)
487 SAL_THROW( (Exception
) )
490 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
491 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
493 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
495 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
497 if (readBorderProps( this, aStyle
))
499 if (readFontProps( this, aStyle
))
503 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
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" );
516 //__________________________________________________________________________________________________
517 void ElementDescriptor::readFixedHyperLinkModel( StyleBag
* all_styles
)
518 SAL_THROW( (Exception
) )
521 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
522 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
524 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
526 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
528 if (readBorderProps( this, aStyle
))
530 if (readFontProps( this, aStyle
))
534 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
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" );
549 //__________________________________________________________________________________________________
550 void ElementDescriptor::readEditModel( StyleBag
* all_styles
)
551 SAL_THROW( (Exception
) )
554 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
555 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
557 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
559 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
561 if (readBorderProps( this, aStyle
))
563 if (readFontProps( this, aStyle
))
567 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
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" );
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" );
592 //__________________________________________________________________________________________________
593 void ElementDescriptor::readImageControlModel( StyleBag
* all_styles
)
594 SAL_THROW( (Exception
) )
597 Style
aStyle( 0x1 | 0x4 );
598 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
600 if (readBorderProps( this, aStyle
))
604 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
609 readBoolAttr( "ScaleImage", XMLNS_DIALOGS_PREFIX
":scale-image" );
610 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
611 readImageURLAttr( "ImageURL", XMLNS_DIALOGS_PREFIX
":src" );
614 //__________________________________________________________________________________________________
615 void ElementDescriptor::readFileControlModel( StyleBag
* all_styles
)
616 SAL_THROW( (Exception
) )
619 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
620 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
622 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
624 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
626 if (readBorderProps( this, aStyle
))
628 if (readFontProps( this, aStyle
))
632 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
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" );
643 //__________________________________________________________________________________________________
644 void ElementDescriptor::readTreeControlModel( StyleBag
* all_styles
)
645 SAL_THROW( (Exception
) )
648 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
649 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
651 if (readBorderProps( this, aStyle
))
655 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
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" );
671 //__________________________________________________________________________________________________
672 void ElementDescriptor::readCurrencyFieldModel( StyleBag
* all_styles
)
673 SAL_THROW( (Exception
) )
676 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
677 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
679 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
681 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
683 if (readBorderProps( this, aStyle
))
685 if (readFontProps( this, aStyle
))
689 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
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" );
712 //__________________________________________________________________________________________________
713 void ElementDescriptor::readDateFieldModel( StyleBag
* all_styles
)
714 SAL_THROW( (Exception
) )
717 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
718 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
720 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
722 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
724 if (readBorderProps( this, aStyle
))
726 if (readFontProps( this, aStyle
))
730 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
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" );
752 //__________________________________________________________________________________________________
753 void ElementDescriptor::readNumericFieldModel( StyleBag
* all_styles
)
754 SAL_THROW( (Exception
) )
757 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
758 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
760 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
762 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
764 if (readBorderProps( this, aStyle
))
766 if (readFontProps( this, aStyle
))
770 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
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" );
791 //__________________________________________________________________________________________________
792 void ElementDescriptor::readTimeFieldModel( StyleBag
* all_styles
)
793 SAL_THROW( (Exception
) )
796 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
797 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
799 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
801 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
803 if (readBorderProps( this, aStyle
))
805 if (readFontProps( this, aStyle
))
809 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
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" );
829 //__________________________________________________________________________________________________
830 void ElementDescriptor::readPatternFieldModel( StyleBag
* all_styles
)
831 SAL_THROW( (Exception
) )
834 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
835 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
837 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
839 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
841 if (readBorderProps( this, aStyle
))
843 if (readFontProps( this, aStyle
))
847 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
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" );
862 //__________________________________________________________________________________________________
863 void ElementDescriptor::readFormattedFieldModel( StyleBag
* all_styles
)
864 SAL_THROW( (Exception
) )
867 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
868 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
870 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
872 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
874 if (readBorderProps( this, aStyle
))
876 if (readFontProps( this, aStyle
))
880 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
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() ) );
902 case TypeClass_STRING
:
903 addAttribute( XMLNS_DIALOGS_PREFIX
":value-default", *(OUString
const *)a
.getValue() );
908 readDoubleAttr( "EffectiveMin", XMLNS_DIALOGS_PREFIX
":value-min" );
909 readDoubleAttr( "EffectiveMax", XMLNS_DIALOGS_PREFIX
":value-max" );
910 readDoubleAttr( "EffectiveValue", XMLNS_DIALOGS_PREFIX
":value" );
914 if (readProp( "FormatKey" ) >>= nKey
)
916 Reference
< util::XNumberFormatsSupplier
> xSupplier
;
917 if (readProp( "FormatsSupplier" ) >>= xSupplier
)
920 xSupplier
->getNumberFormats()->getByKey( nKey
) );
923 readBoolAttr( "TreatAsNumber", XMLNS_DIALOGS_PREFIX
":treat-as-number" );
924 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX
":enforce-format" );
929 void ElementDescriptor::readSpinButtonModel( StyleBag
* all_styles
)
930 SAL_THROW( (Exception
) )
933 Style
aStyle( 0x1 | 0x4 );
934 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
936 if (readBorderProps( this, aStyle
))
940 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
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" );
958 //__________________________________________________________________________________________________
959 void ElementDescriptor::readFixedLineModel( StyleBag
* all_styles
)
960 SAL_THROW( (Exception
) )
963 Style
aStyle( 0x2 | 0x8 | 0x20 );
964 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
966 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
968 if (readFontProps( this, aStyle
))
972 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
977 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX
":value" );
978 readOrientationAttr( "Orientation", XMLNS_DIALOGS_PREFIX
":align" );
981 //__________________________________________________________________________________________________
982 void ElementDescriptor::readProgressBarModel( StyleBag
* all_styles
)
983 SAL_THROW( (Exception
) )
986 Style
aStyle( 0x1 | 0x4 | 0x10 );
987 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
989 if (readBorderProps( this, aStyle
))
991 if (readProp( "FillColor" ) >>= aStyle
._descr
)
995 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
1000 readLongAttr( "ProgressValue", XMLNS_DIALOGS_PREFIX
":value" );
1001 readLongAttr( "ProgressValueMin", XMLNS_DIALOGS_PREFIX
":value-min" );
1002 readLongAttr( "ProgressValueMax", XMLNS_DIALOGS_PREFIX
":value-max" );
1005 //__________________________________________________________________________________________________
1006 void ElementDescriptor::readScrollBarModel( StyleBag
* all_styles
)
1007 SAL_THROW( (Exception
) )
1010 Style
aStyle( 0x1 | 0x4 );
1011 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
1013 if (readBorderProps( this, aStyle
))
1017 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
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" );
1036 //__________________________________________________________________________________________________
1037 void ElementDescriptor::readDialogModel( StyleBag
* all_styles
)
1038 SAL_THROW( (Exception
) )
1041 addAttribute( "xmlns:" XMLNS_DIALOGS_PREFIX
, XMLNS_DIALOGS_URI
);
1042 addAttribute( "xmlns:" XMLNS_SCRIPT_PREFIX
, XMLNS_SCRIPT_URI
);
1045 Style
aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
1046 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
1048 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
1050 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
1051 aStyle
._set
|= 0x20;
1052 if (readFontProps( this, aStyle
))
1056 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
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" );
1075 void ElementDescriptor::readBullitinBoard( StyleBag
* all_styles
)
1076 SAL_THROW( (Exception
) )
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;
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
);
1097 Reference
< beans::XPropertyState
> xPropState( xProps
, UNO_QUERY
);
1098 OSL_ENSURE( xPropState
.is(), "no XPropertyState!" );
1099 if (! xPropState
.is())
1101 Reference
< lang::XServiceInfo
> xServiceInfo( xProps
, UNO_QUERY
);
1102 OSL_ENSURE( xServiceInfo
.is(), "no XServiceInfo!" );
1103 if (! xServiceInfo
.is())
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
);
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
);
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
);
1249 all_elements
.push_back( pElem
);
1253 OSL_FAIL( "unknown control type!" );
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: */