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/lang/XServiceInfo.hpp>
30 #include <o3tl/any.hxx>
32 using namespace ::com::sun::star
;
33 using namespace ::com::sun::star::uno
;
38 static inline bool readBorderProps(
39 ElementDescriptor
* element
, Style
& style
)
41 if (element
->readProp( &style
._border
, "Border" )) {
42 if (style
._border
== BORDER_SIMPLE
/* simple */)
44 if (element
->readProp( &style
._borderColor
, "BorderColor" ))
45 style
._border
= BORDER_SIMPLE_COLOR
;
52 static inline bool readFontProps( ElementDescriptor
* element
, Style
& style
)
54 bool ret
= element
->readProp(
55 &style
._descr
, "FontDescriptor" );
56 ret
|= element
->readProp(
57 &style
._fontEmphasisMark
, "FontEmphasisMark" );
58 ret
|= element
->readProp(
59 &style
._fontRelief
, "FontRelief" );
63 void ElementDescriptor::readMultiPageModel( StyleBag
* all_styles
)
66 Style
aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
67 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
69 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
71 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
73 if (readFontProps( this, aStyle
))
77 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id" , all_styles
->getStyleId( aStyle
) );
82 readLongAttr( "MultiPageValue", XMLNS_DIALOGS_PREFIX
":value" );
83 Any
aDecorationAny( _xProps
->getPropertyValue( "Decoration" ) );
84 bool bDecoration
= true;
85 if ( (aDecorationAny
>>= bDecoration
) && !bDecoration
)
86 addAttribute( XMLNS_DIALOGS_PREFIX
":withtabs", "false" );
89 uno::Reference
< container::XNameContainer
> xPagesContainer( _xProps
, uno::UNO_QUERY
);
90 if ( xPagesContainer
.is() && xPagesContainer
->getElementNames().getLength() )
92 ElementDescriptor
* pElem
= new ElementDescriptor( _xProps
, _xPropState
, XMLNS_DIALOGS_PREFIX
":bulletinboard", _xDocument
);
93 pElem
->readBullitinBoard( all_styles
);
94 addSubElement( pElem
);
98 void ElementDescriptor::readFrameModel( StyleBag
* all_styles
)
101 Style
aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
103 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
105 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
107 if (readFontProps( this, aStyle
))
111 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
118 if ( readProp( "Label" ) >>= aTitle
)
120 ElementDescriptor
* title
= new ElementDescriptor( _xProps
, _xPropState
, XMLNS_DIALOGS_PREFIX
":title", _xDocument
);
121 title
->addAttribute( XMLNS_DIALOGS_PREFIX
":value", aTitle
);
122 addSubElement( title
);
124 uno::Reference
< container::XNameContainer
> xControlContainer( _xProps
, uno::UNO_QUERY
);
125 if ( xControlContainer
.is() && xControlContainer
->getElementNames().getLength() )
127 ElementDescriptor
* pElem
= new ElementDescriptor( _xProps
, _xPropState
, XMLNS_DIALOGS_PREFIX
":bulletinboard", _xDocument
);
128 pElem
->readBullitinBoard( all_styles
);
129 addSubElement( pElem
);
134 void ElementDescriptor::readPageModel( StyleBag
* all_styles
)
137 Style
aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
138 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
140 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
142 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
144 if (readFontProps( this, aStyle
))
148 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
153 readStringAttr( "Title", XMLNS_DIALOGS_PREFIX
":title" );
154 uno::Reference
< container::XNameContainer
> xControlContainer( _xProps
, uno::UNO_QUERY
);
155 if ( xControlContainer
.is() && xControlContainer
->getElementNames().getLength() )
157 ElementDescriptor
* pElem
= new ElementDescriptor( _xProps
, _xPropState
, XMLNS_DIALOGS_PREFIX
":bulletinboard", _xDocument
);
158 pElem
->readBullitinBoard( all_styles
);
159 addSubElement( pElem
);
164 void ElementDescriptor::readButtonModel( StyleBag
* all_styles
)
167 Style
aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
168 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
170 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
172 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
174 if (readFontProps( this, aStyle
))
178 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
183 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
184 readBoolAttr( "DefaultButton", XMLNS_DIALOGS_PREFIX
":default" );
185 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX
":value" );
186 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX
":align" );
187 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX
":valign" );
188 readButtonTypeAttr( "PushButtonType", XMLNS_DIALOGS_PREFIX
":button-type" );
189 readImageOrGraphicAttr(XMLNS_DIALOGS_PREFIX
":image-src");
190 readImagePositionAttr( "ImagePosition", XMLNS_DIALOGS_PREFIX
":image-position" );
191 readImageAlignAttr( "ImageAlign", XMLNS_DIALOGS_PREFIX
":image-align" );
193 if (extract_throw
<bool>( _xProps
->getPropertyValue( "Repeat" ) ))
194 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX
":repeat", true /* force */ );
196 if (extract_throw
<bool>( _xProps
->getPropertyValue( "Toggle" ) ))
197 addAttribute( XMLNS_DIALOGS_PREFIX
":toggled", "1" );
199 readBoolAttr( "FocusOnClick", XMLNS_DIALOGS_PREFIX
":grab-focus" );
200 readBoolAttr( "MultiLine",XMLNS_DIALOGS_PREFIX
":multiline" );
203 sal_Int16 nState
= 0;
204 if (readProp( "State" ) >>= nState
)
209 addAttribute( XMLNS_DIALOGS_PREFIX
":checked", "false" );
212 addAttribute( XMLNS_DIALOGS_PREFIX
":checked", "true" );
215 OSL_FAIL( "### unexpected radio state!" );
223 void ElementDescriptor::readCheckBoxModel( StyleBag
* all_styles
)
226 Style
aStyle( 0x1 | 0x2 | 0x8 | 0x20 | 0x40 );
227 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
229 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
231 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
233 if (readFontProps( this, aStyle
))
235 if (readProp( "VisualEffect" ) >>= aStyle
._visualEffect
)
239 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
244 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
245 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX
":value" );
246 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX
":align" );
247 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX
":valign" );
248 readImageOrGraphicAttr(XMLNS_DIALOGS_PREFIX
":image-src");
249 readImagePositionAttr( "ImagePosition", XMLNS_DIALOGS_PREFIX
":image-position" );
250 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX
":multiline" );
252 bool bTriState
= false;
253 if ((readProp( "TriState" ) >>= bTriState
) && bTriState
)
255 addAttribute( XMLNS_DIALOGS_PREFIX
":tristate", "true" );
257 sal_Int16 nState
= 0;
258 if (_xProps
->getPropertyValue( "State" ) >>= nState
)
263 addAttribute( XMLNS_DIALOGS_PREFIX
":checked", "false" );
266 addAttribute( XMLNS_DIALOGS_PREFIX
":checked", "true" );
268 case 2: // tristate=true exported, checked omitted => don't know!
269 OSL_ENSURE( bTriState
, "### detected tristate value, but TriState is not set!" );
272 OSL_FAIL( "### unexpected checkbox state!" );
279 void ElementDescriptor::readComboBoxModel( StyleBag
* all_styles
)
282 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
283 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
285 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
287 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
289 if (readBorderProps( this, aStyle
))
291 if (readFontProps( this, aStyle
))
295 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
300 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
301 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX
":value" );
302 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX
":align" );
303 readBoolAttr( "Autocomplete", XMLNS_DIALOGS_PREFIX
":autocomplete" );
304 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX
":readonly" );
305 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX
":hide-inactive-selection" );
306 readBoolAttr( "Dropdown", XMLNS_DIALOGS_PREFIX
":spin" );
307 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX
":maxlength" );
308 readShortAttr( "LineCount", XMLNS_DIALOGS_PREFIX
":linecount" );
309 // Cell Range, Ref Cell etc.
310 readDataAwareAttr( XMLNS_DIALOGS_PREFIX
":linked-cell" );
311 readDataAwareAttr( XMLNS_DIALOGS_PREFIX
":source-cell-range" );
314 Sequence
< OUString
> itemValues
;
315 if ((readProp( "StringItemList" ) >>= itemValues
) && itemValues
.getLength() > 0)
317 ElementDescriptor
* popup
= new ElementDescriptor( _xProps
, _xPropState
, XMLNS_DIALOGS_PREFIX
":menupopup", _xDocument
);
319 OUString
const * pItemValues
= itemValues
.getConstArray();
320 for ( sal_Int32 nPos
= 0; nPos
< itemValues
.getLength(); ++nPos
)
322 ElementDescriptor
* item
= new ElementDescriptor( _xProps
, _xPropState
, XMLNS_DIALOGS_PREFIX
":menuitem", _xDocument
);
323 item
->addAttribute( XMLNS_DIALOGS_PREFIX
":value", pItemValues
[ nPos
] );
324 popup
->addSubElement( item
);
327 addSubElement( popup
);
332 void ElementDescriptor::readListBoxModel( StyleBag
* all_styles
)
335 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
336 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
338 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
340 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
342 if (readBorderProps( this, aStyle
))
344 if (readFontProps( this, aStyle
))
348 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
353 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
354 readBoolAttr( "MultiSelection", XMLNS_DIALOGS_PREFIX
":multiselection" );
355 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX
":readonly" );
356 readBoolAttr( "Dropdown", XMLNS_DIALOGS_PREFIX
":spin" );
357 readShortAttr( "LineCount", XMLNS_DIALOGS_PREFIX
":linecount" );
358 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX
":align" );
359 readDataAwareAttr( XMLNS_DIALOGS_PREFIX
":linked-cell" );
360 readDataAwareAttr( XMLNS_DIALOGS_PREFIX
":source-cell-range" );
362 Sequence
< OUString
> itemValues
;
363 if ((readProp( "StringItemList" ) >>= itemValues
) && itemValues
.getLength() > 0)
365 ElementDescriptor
* popup
= new ElementDescriptor( _xProps
, _xPropState
, XMLNS_DIALOGS_PREFIX
":menupopup", _xDocument
);
367 OUString
const * pItemValues
= itemValues
.getConstArray();
369 for ( nPos
= 0; nPos
< itemValues
.getLength(); ++nPos
)
371 ElementDescriptor
* item
= new ElementDescriptor(_xProps
, _xPropState
, XMLNS_DIALOGS_PREFIX
":menuitem", _xDocument
);
372 item
->addAttribute( XMLNS_DIALOGS_PREFIX
":value", pItemValues
[ nPos
] );
373 popup
->addSubElement( item
);
376 Sequence
< sal_Int16
> selected
;
377 if (readProp( "SelectedItems" ) >>= selected
)
379 sal_Int16
const * pSelected
= selected
.getConstArray();
380 for ( nPos
= selected
.getLength(); nPos
--; )
382 ElementDescriptor
* item
= static_cast< ElementDescriptor
* >(
383 popup
->getSubElement( pSelected
[ nPos
] ).get() );
384 item
->addAttribute( XMLNS_DIALOGS_PREFIX
":selected", "true" );
388 addSubElement( popup
);
393 void ElementDescriptor::readRadioButtonModel( StyleBag
* all_styles
)
396 Style
aStyle( 0x1 | 0x2 | 0x8 | 0x20 | 0x40 );
397 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
399 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
401 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
403 if (readFontProps( this, aStyle
))
405 if (readProp( "VisualEffect" ) >>= aStyle
._visualEffect
)
409 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id" , all_styles
->getStyleId( aStyle
) );
414 readBoolAttr("Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
415 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX
":value" );
416 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX
":align" );
417 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX
":valign" );
418 readImageOrGraphicAttr(XMLNS_DIALOGS_PREFIX
":image-src");
419 readImagePositionAttr( "ImagePosition", XMLNS_DIALOGS_PREFIX
":image-position" );
420 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX
":multiline" );
421 readStringAttr( "GroupName", XMLNS_DIALOGS_PREFIX
":group-name" );
423 sal_Int16 nState
= 0;
424 if (readProp( "State" ) >>= nState
)
429 addAttribute(XMLNS_DIALOGS_PREFIX
":checked", "false" );
432 addAttribute( XMLNS_DIALOGS_PREFIX
":checked", "true" );
435 OSL_FAIL( "### unexpected radio state!" );
439 readDataAwareAttr( XMLNS_DIALOGS_PREFIX
":linked-cell" );
443 void ElementDescriptor::readGroupBoxModel( StyleBag
* all_styles
)
446 Style
aStyle( 0x2 | 0x8 | 0x20 );
447 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
449 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
451 if (readFontProps( this, aStyle
))
455 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
462 if (readProp( "Label" ) >>= aTitle
)
464 ElementDescriptor
* title
= new ElementDescriptor( _xProps
, _xPropState
, XMLNS_DIALOGS_PREFIX
":title", _xDocument
);
465 title
->addAttribute( XMLNS_DIALOGS_PREFIX
":value", aTitle
);
466 addSubElement( title
);
472 void ElementDescriptor::readFixedTextModel( StyleBag
* all_styles
)
475 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
476 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
478 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
480 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
482 if (readBorderProps( this, aStyle
))
484 if (readFontProps( this, aStyle
))
488 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
493 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX
":value" );
494 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX
":align" );
495 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX
":valign" );
496 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX
":multiline" );
497 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
498 readBoolAttr( "NoLabel", XMLNS_DIALOGS_PREFIX
":nolabel" );
502 void ElementDescriptor::readFixedHyperLinkModel( StyleBag
* all_styles
)
505 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
506 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
508 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
510 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
512 if (readBorderProps( this, aStyle
))
514 if (readFontProps( this, aStyle
))
518 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
523 readStringAttr( "Label",XMLNS_DIALOGS_PREFIX
":value" );
524 readStringAttr( "URL", XMLNS_DIALOGS_PREFIX
":url" );
525 readStringAttr( "Description", XMLNS_DIALOGS_PREFIX
":description" );
526 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX
":align" );
527 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX
":valign" );
528 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX
":multiline" );
529 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
530 readBoolAttr( "NoLabel", XMLNS_DIALOGS_PREFIX
":nolabel" );
534 void ElementDescriptor::readEditModel( StyleBag
* all_styles
)
537 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
538 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
540 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
542 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
544 if (readBorderProps( this, aStyle
))
546 if (readFontProps( this, aStyle
))
550 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
555 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
556 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX
":hide-inactive-selection" );
557 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX
":align" );
558 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX
":valign" );
559 readBoolAttr( "HardLineBreaks", XMLNS_DIALOGS_PREFIX
":hard-linebreaks" );
560 readBoolAttr( "HScroll", XMLNS_DIALOGS_PREFIX
":hscroll" );
561 readBoolAttr( "VScroll", XMLNS_DIALOGS_PREFIX
":vscroll" );
562 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX
":maxlength" );
563 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX
":multiline" );
564 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX
":readonly" );
565 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX
":value" );
566 readLineEndFormatAttr( "LineEndFormat", XMLNS_DIALOGS_PREFIX
":lineend-format" );
568 if (readProp( "EchoChar" ) >>= nEcho
)
570 sal_Unicode cEcho
= static_cast<sal_Unicode
>(nEcho
);
571 addAttribute( XMLNS_DIALOGS_PREFIX
":echochar", OUString( &cEcho
, 1 ) );
573 readDataAwareAttr( XMLNS_DIALOGS_PREFIX
":linked-cell" );
577 void ElementDescriptor::readImageControlModel( StyleBag
* all_styles
)
580 Style
aStyle( 0x1 | 0x4 );
581 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
583 if (readBorderProps( this, aStyle
))
587 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
592 readBoolAttr( "ScaleImage", XMLNS_DIALOGS_PREFIX
":scale-image" );
593 readImageScaleModeAttr( "ScaleMode", XMLNS_DIALOGS_PREFIX
":scale-mode" );
594 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
595 readImageOrGraphicAttr(XMLNS_DIALOGS_PREFIX
":src");
599 void ElementDescriptor::readFileControlModel( StyleBag
* all_styles
)
602 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
603 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
605 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
607 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
609 if (readBorderProps( this, aStyle
))
611 if (readFontProps( this, aStyle
))
615 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
620 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
621 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX
":hide-inactive-selection" );
622 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX
":value" );
623 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX
":readonly" );
627 void ElementDescriptor::readTreeControlModel( StyleBag
* all_styles
)
630 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
631 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
633 if (readBorderProps( this, aStyle
))
637 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
642 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
643 readSelectionTypeAttr( "SelectionType", XMLNS_DIALOGS_PREFIX
":selectiontype" );
645 readBoolAttr( "RootDisplayed", XMLNS_DIALOGS_PREFIX
":rootdisplayed" );
646 readBoolAttr( "ShowsHandles", XMLNS_DIALOGS_PREFIX
":showshandles" );
647 readBoolAttr( "ShowsRootHandles", XMLNS_DIALOGS_PREFIX
":showsroothandles" );
648 readBoolAttr( "Editable", XMLNS_DIALOGS_PREFIX
":editable" );
649 readBoolAttr( "InvokesStopNodeEditing", XMLNS_DIALOGS_PREFIX
":invokesstopnodeediting" );
650 readLongAttr( "RowHeight", XMLNS_DIALOGS_PREFIX
":rowheight" );
654 void ElementDescriptor::readCurrencyFieldModel( StyleBag
* all_styles
)
657 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
658 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
660 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
662 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
664 if (readBorderProps( this, aStyle
))
666 if (readFontProps( this, aStyle
))
670 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
675 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
676 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX
":readonly" );
677 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX
":hide-inactive-selection" );
678 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX
":strict-format" );
679 readStringAttr( "CurrencySymbol", XMLNS_DIALOGS_PREFIX
":currency-symbol" );
680 readShortAttr( "DecimalAccuracy", XMLNS_DIALOGS_PREFIX
":decimal-accuracy" );
681 readBoolAttr( "ShowThousandsSeparator", XMLNS_DIALOGS_PREFIX
":thousands-separator" );
682 readDoubleAttr( "Value", XMLNS_DIALOGS_PREFIX
":value" );
683 readDoubleAttr( "ValueMin", XMLNS_DIALOGS_PREFIX
":value-min" );
684 readDoubleAttr( "ValueMax", XMLNS_DIALOGS_PREFIX
":value-max" );
685 readDoubleAttr( "ValueStep", XMLNS_DIALOGS_PREFIX
":value-step" );
686 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX
":spin" );
687 if (extract_throw
<bool>( _xProps
->getPropertyValue( "Repeat" ) ))
688 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX
":repeat", true /* force */ );
689 readBoolAttr("PrependCurrencySymbol", XMLNS_DIALOGS_PREFIX
":prepend-symbol" );
690 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX
":enforce-format" );
694 void ElementDescriptor::readDateFieldModel( StyleBag
* all_styles
)
697 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
698 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
700 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
702 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
704 if (readBorderProps( this, aStyle
))
706 if (readFontProps( this, aStyle
))
710 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
715 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
716 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX
":readonly" );
717 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX
":hide-inactive-selection" );
718 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX
":strict-format" );
719 readDateFormatAttr( "DateFormat", XMLNS_DIALOGS_PREFIX
":date-format" );
720 readBoolAttr( "DateShowCentury", XMLNS_DIALOGS_PREFIX
":show-century" );
721 readDateAttr( "Date", XMLNS_DIALOGS_PREFIX
":value" );
722 readDateAttr( "DateMin", XMLNS_DIALOGS_PREFIX
":value-min" );
723 readDateAttr( "DateMax", XMLNS_DIALOGS_PREFIX
":value-max" );
724 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX
":spin" );
725 if (extract_throw
<bool>( _xProps
->getPropertyValue( "Repeat" ) ))
726 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX
":repeat", true /* force */ );
727 readBoolAttr( "Dropdown", XMLNS_DIALOGS_PREFIX
":dropdown" );
728 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX
":text" );
729 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX
":enforce-format" );
733 void ElementDescriptor::readNumericFieldModel( StyleBag
* all_styles
)
736 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
737 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
739 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
741 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
743 if (readBorderProps( this, aStyle
))
745 if (readFontProps( this, aStyle
))
749 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
754 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX
":align" );
755 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX
":valign" );
756 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
757 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX
":readonly" );
758 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX
":hide-inactive-selection" );
759 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX
":strict-format" );
760 readShortAttr( "DecimalAccuracy", XMLNS_DIALOGS_PREFIX
":decimal-accuracy" );
761 readBoolAttr( "ShowThousandsSeparator", XMLNS_DIALOGS_PREFIX
":thousands-separator" );
762 readDoubleAttr( "Value", XMLNS_DIALOGS_PREFIX
":value" );
763 readDoubleAttr( "ValueMin", XMLNS_DIALOGS_PREFIX
":value-min" );
764 readDoubleAttr( "ValueMax", XMLNS_DIALOGS_PREFIX
":value-max" );
765 readDoubleAttr( "ValueStep", XMLNS_DIALOGS_PREFIX
":value-step" );
766 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX
":spin" );
767 if (extract_throw
<bool>( _xProps
->getPropertyValue( "Repeat" ) ))
768 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX
":repeat", true /* force */ );
769 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX
":enforce-format" );
773 void ElementDescriptor::readTimeFieldModel( StyleBag
* all_styles
)
776 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
777 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
779 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
781 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
783 if (readBorderProps( this, aStyle
))
785 if (readFontProps( this, aStyle
))
789 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
794 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop");
795 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX
":readonly" );
796 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX
":hide-inactive-selection" );
797 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX
":strict-format" );
798 readTimeFormatAttr( "TimeFormat", XMLNS_DIALOGS_PREFIX
":time-format" );
799 readTimeAttr( "Time", XMLNS_DIALOGS_PREFIX
":value" );
800 readTimeAttr( "TimeMin", XMLNS_DIALOGS_PREFIX
":value-min" );
801 readTimeAttr( "TimeMax", XMLNS_DIALOGS_PREFIX
":value-max" );
802 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX
":spin" );
803 if (extract_throw
<bool>( _xProps
->getPropertyValue( "Repeat" ) ))
804 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX
":repeat", true /* force */ );
805 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX
":text" );
806 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX
":enforce-format" );
810 void ElementDescriptor::readPatternFieldModel( StyleBag
* all_styles
)
813 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
814 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
816 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
818 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
820 if (readBorderProps( this, aStyle
))
822 if (readFontProps( this, aStyle
))
826 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
831 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
832 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX
":readonly" );
833 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX
":hide-inactive-selection" );
834 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX
":strict-format" );
835 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX
":value" );
836 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX
":maxlength" );
837 readStringAttr( "EditMask", XMLNS_DIALOGS_PREFIX
":edit-mask" );
838 readStringAttr( "LiteralMask", XMLNS_DIALOGS_PREFIX
":literal-mask" );
842 void ElementDescriptor::readFormattedFieldModel( StyleBag
* all_styles
)
845 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
846 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
848 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
850 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
852 if (readBorderProps( this, aStyle
))
854 if (readFontProps( this, aStyle
))
858 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
863 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
864 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX
":readonly" );
865 readBoolAttr( "HideInactiveSelection",XMLNS_DIALOGS_PREFIX
":hide-inactive-selection" );
866 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX
":strict-format" );
867 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX
":text" );
868 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX
":align" );
869 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX
":maxlength" );
870 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX
":spin" );
871 if (extract_throw
<bool>( _xProps
->getPropertyValue( "Repeat" ) ))
872 readLongAttr( "RepeatDelay",XMLNS_DIALOGS_PREFIX
":repeat", true /* force */ );
874 Any
a( readProp( "EffectiveDefault" ) );
875 switch (a
.getValueTypeClass())
877 case TypeClass_DOUBLE
:
878 addAttribute( XMLNS_DIALOGS_PREFIX
":value-default", OUString::number( *o3tl::forceAccess
<double>(a
) ) );
880 case TypeClass_STRING
:
881 addAttribute( XMLNS_DIALOGS_PREFIX
":value-default", *o3tl::forceAccess
<OUString
>(a
) );
886 readDoubleAttr( "EffectiveMin", XMLNS_DIALOGS_PREFIX
":value-min" );
887 readDoubleAttr( "EffectiveMax", XMLNS_DIALOGS_PREFIX
":value-max" );
888 readDoubleAttr( "EffectiveValue", XMLNS_DIALOGS_PREFIX
":value" );
892 if (readProp( "FormatKey" ) >>= nKey
)
894 Reference
< util::XNumberFormatsSupplier
> xSupplier
;
895 if (readProp( "FormatsSupplier" ) >>= xSupplier
)
898 xSupplier
->getNumberFormats()->getByKey( nKey
) );
901 readBoolAttr( "TreatAsNumber", XMLNS_DIALOGS_PREFIX
":treat-as-number" );
902 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX
":enforce-format" );
907 void ElementDescriptor::readSpinButtonModel( StyleBag
* all_styles
)
910 Style
aStyle( 0x1 | 0x4 );
911 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
913 if (readBorderProps( this, aStyle
))
917 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
922 readOrientationAttr( "Orientation", XMLNS_DIALOGS_PREFIX
":align" );
923 readLongAttr( "SpinIncrement", XMLNS_DIALOGS_PREFIX
":increment" );
924 readLongAttr( "SpinValue", XMLNS_DIALOGS_PREFIX
":curval" );
925 readLongAttr( "SpinValueMax", XMLNS_DIALOGS_PREFIX
":maxval" );
926 readLongAttr( "SpinValueMin", XMLNS_DIALOGS_PREFIX
":minval" );
927 readLongAttr( "Repeat", XMLNS_DIALOGS_PREFIX
":repeat" );
928 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX
":repeat-delay" );
929 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
930 readHexLongAttr( "SymbolColor", XMLNS_DIALOGS_PREFIX
":symbol-color" );
931 readDataAwareAttr( XMLNS_DIALOGS_PREFIX
":linked-cell" );
935 void ElementDescriptor::readFixedLineModel( StyleBag
* all_styles
)
938 Style
aStyle( 0x2 | 0x8 | 0x20 );
939 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
941 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
943 if (readFontProps( this, aStyle
))
947 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
952 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX
":value" );
953 readOrientationAttr( "Orientation", XMLNS_DIALOGS_PREFIX
":align" );
957 void ElementDescriptor::readProgressBarModel( StyleBag
* all_styles
)
960 Style
aStyle( 0x1 | 0x4 | 0x10 );
961 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
963 if (readBorderProps( this, aStyle
))
965 if (readProp( "FillColor" ) >>= aStyle
._descr
)
969 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
974 readLongAttr( "ProgressValue", XMLNS_DIALOGS_PREFIX
":value" );
975 readLongAttr( "ProgressValueMin", XMLNS_DIALOGS_PREFIX
":value-min" );
976 readLongAttr( "ProgressValueMax", XMLNS_DIALOGS_PREFIX
":value-max" );
980 void ElementDescriptor::readScrollBarModel( StyleBag
* all_styles
)
983 Style
aStyle( 0x1 | 0x4 );
984 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
986 if (readBorderProps( this, aStyle
))
990 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
995 readOrientationAttr( "Orientation", XMLNS_DIALOGS_PREFIX
":align" );
996 readLongAttr( "BlockIncrement", XMLNS_DIALOGS_PREFIX
":pageincrement" );
997 readLongAttr( "LineIncrement", XMLNS_DIALOGS_PREFIX
":increment" );
998 readLongAttr( "ScrollValue", XMLNS_DIALOGS_PREFIX
":curpos" );
999 readLongAttr( "ScrollValueMax", XMLNS_DIALOGS_PREFIX
":maxpos" );
1000 readLongAttr( "ScrollValueMin", XMLNS_DIALOGS_PREFIX
":minpos" );
1001 readLongAttr( "VisibleSize", XMLNS_DIALOGS_PREFIX
":visible-size" );
1002 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX
":repeat" );
1003 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
1004 readBoolAttr( "LiveScroll", XMLNS_DIALOGS_PREFIX
":live-scroll" );
1005 readHexLongAttr( "SymbolColor", XMLNS_DIALOGS_PREFIX
":symbol-color" );
1006 readDataAwareAttr( XMLNS_DIALOGS_PREFIX
":linked-cell" );
1010 void ElementDescriptor::readDialogModel( StyleBag
* all_styles
)
1013 addAttribute( "xmlns:" XMLNS_DIALOGS_PREFIX
, XMLNS_DIALOGS_URI
);
1014 addAttribute( "xmlns:" XMLNS_SCRIPT_PREFIX
, XMLNS_SCRIPT_URI
);
1017 Style
aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
1018 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
1020 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
1022 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
1023 aStyle
._set
|= 0x20;
1024 if (readFontProps( this, aStyle
))
1028 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
1032 readDefaults( false, false );
1033 readBoolAttr("Closeable", XMLNS_DIALOGS_PREFIX
":closeable" );
1034 readBoolAttr( "Moveable", XMLNS_DIALOGS_PREFIX
":moveable" );
1035 readBoolAttr( "Sizeable", XMLNS_DIALOGS_PREFIX
":resizeable" );
1036 readStringAttr( "Title", XMLNS_DIALOGS_PREFIX
":title" );
1038 readScrollableSettings();
1039 Any
aDecorationAny( _xProps
->getPropertyValue( "Decoration" ) );
1040 bool bDecoration
= false;
1041 if ( (aDecorationAny
>>= bDecoration
) && !bDecoration
)
1042 addAttribute( XMLNS_DIALOGS_PREFIX
":withtitlebar", "false" );
1043 readImageOrGraphicAttr(XMLNS_DIALOGS_PREFIX
":image-src");
1047 void ElementDescriptor::readBullitinBoard( StyleBag
* all_styles
)
1050 ::std::vector
< ElementDescriptor
* > all_elements
;
1051 // read out all props
1052 Reference
< container::XNameContainer
> xDialogModel( _xProps
, UNO_QUERY
);
1053 if ( !xDialogModel
.is() )
1054 return; // #TODO throw???
1055 Sequence
< OUString
> aElements( xDialogModel
->getElementNames() );
1056 OUString
const * pElements
= aElements
.getConstArray();
1058 ElementDescriptor
* pRadioGroup
= nullptr;
1061 for ( nPos
= 0; nPos
< aElements
.getLength(); ++nPos
)
1063 Any
aControlModel( xDialogModel
->getByName( pElements
[ nPos
] ) );
1064 Reference
< beans::XPropertySet
> xProps
;
1065 OSL_VERIFY( aControlModel
>>= xProps
);
1068 Reference
< beans::XPropertyState
> xPropState( xProps
, UNO_QUERY
);
1069 OSL_ENSURE( xPropState
.is(), "no XPropertyState!" );
1070 if (! xPropState
.is())
1072 Reference
< lang::XServiceInfo
> xServiceInfo( xProps
, UNO_QUERY
);
1073 OSL_ENSURE( xServiceInfo
.is(), "no XServiceInfo!" );
1074 if (! xServiceInfo
.is())
1077 ElementDescriptor
* pElem
= nullptr;
1079 // group up radio buttons
1080 if ( xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlRadioButtonModel" ) )
1082 if (! pRadioGroup
) // open radiogroup
1084 pRadioGroup
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":radiogroup", _xDocument
);
1085 all_elements
.push_back( pRadioGroup
);
1088 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":radio", _xDocument
);
1089 pElem
->readRadioButtonModel( all_styles
);
1090 pRadioGroup
->addSubElement( pElem
);
1094 pRadioGroup
= nullptr; // close radiogroup
1096 if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlButtonModel" ) )
1098 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":button", _xDocument
);
1099 pElem
->readButtonModel( all_styles
);
1101 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlCheckBoxModel" ) )
1103 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":checkbox", _xDocument
);
1104 pElem
->readCheckBoxModel( all_styles
);
1106 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlComboBoxModel" ) )
1108 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":combobox", _xDocument
);
1109 pElem
->readComboBoxModel( all_styles
);
1111 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlListBoxModel" ) )
1113 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":menulist", _xDocument
);
1114 pElem
->readListBoxModel( all_styles
);
1116 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlGroupBoxModel" ) )
1118 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":titledbox", _xDocument
);
1119 pElem
->readGroupBoxModel( all_styles
);
1121 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoMultiPageModel" ) )
1123 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":multipage", _xDocument
);
1124 pElem
->readMultiPageModel( all_styles
);
1126 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoFrameModel" ) )
1128 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":frame", _xDocument
);
1129 pElem
->readFrameModel( all_styles
);
1131 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoPageModel" ) )
1133 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":page", _xDocument
);
1134 pElem
->readPageModel( all_styles
);
1136 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlFixedTextModel" ) )
1138 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":text", _xDocument
);
1139 pElem
->readFixedTextModel( all_styles
);
1141 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlEditModel" ) )
1143 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":textfield", _xDocument
);
1144 pElem
->readEditModel( all_styles
);
1147 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlFixedHyperlinkModel" ) )
1149 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":linklabel", _xDocument
);
1150 pElem
->readFixedHyperLinkModel( all_styles
);
1152 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlImageControlModel" ) )
1154 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":img", _xDocument
);
1155 pElem
->readImageControlModel( all_styles
);
1157 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlFileControlModel" ) )
1159 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":filecontrol", _xDocument
);
1160 pElem
->readFileControlModel( all_styles
);
1162 else if (xServiceInfo
->supportsService( "com.sun.star.awt.tree.TreeControlModel" ) )
1164 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":treecontrol", _xDocument
);
1165 pElem
->readTreeControlModel( all_styles
);
1167 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlCurrencyFieldModel" ) )
1169 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":currencyfield", _xDocument
);
1170 pElem
->readCurrencyFieldModel( all_styles
);
1172 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlDateFieldModel" ) )
1174 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":datefield", _xDocument
);
1175 pElem
->readDateFieldModel( all_styles
);
1177 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlNumericFieldModel" ) )
1179 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":numericfield", _xDocument
);
1180 pElem
->readNumericFieldModel( all_styles
);
1182 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlTimeFieldModel" ) )
1184 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":timefield", _xDocument
);
1185 pElem
->readTimeFieldModel( all_styles
);
1187 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlPatternFieldModel" ) )
1189 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":patternfield", _xDocument
);
1190 pElem
->readPatternFieldModel( all_styles
);
1192 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlFormattedFieldModel" ) )
1194 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":formattedfield", _xDocument
);
1195 pElem
->readFormattedFieldModel( all_styles
);
1197 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlFixedLineModel" ) )
1199 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":fixedline", _xDocument
);
1200 pElem
->readFixedLineModel( all_styles
);
1202 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlScrollBarModel" ) )
1204 pElem
= new ElementDescriptor(xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":scrollbar", _xDocument
);
1205 pElem
->readScrollBarModel( all_styles
);
1207 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlSpinButtonModel" ) )
1209 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":spinbutton", _xDocument
);
1210 pElem
->readSpinButtonModel( all_styles
);
1212 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlProgressBarModel" ) )
1214 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":progressmeter", _xDocument
);
1215 pElem
->readProgressBarModel( all_styles
);
1220 all_elements
.push_back( pElem
);
1224 OSL_FAIL( "unknown control type!" );
1229 if (! all_elements
.empty())
1231 for (ElementDescriptor
* p
: all_elements
)
1240 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */