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 .
21 #include "exp_share.hxx"
23 #include <xmlscript/xmlns.h>
25 #include <com/sun/star/container/XNameContainer.hpp>
26 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <o3tl/any.hxx>
30 using namespace ::com::sun::star
;
31 using namespace ::com::sun::star::uno
;
36 static bool readBorderProps(
37 ElementDescriptor
* element
, Style
& style
)
39 if (element
->readProp( &style
._border
, "Border" )) {
40 if (style
._border
== BORDER_SIMPLE
/* simple */)
42 if (element
->readProp( &style
._borderColor
, "BorderColor" ))
43 style
._border
= BORDER_SIMPLE_COLOR
;
50 static bool readFontProps( ElementDescriptor
* element
, Style
& style
)
52 bool ret
= element
->readProp(
53 &style
._descr
, "FontDescriptor" );
54 ret
|= element
->readProp(
55 &style
._fontEmphasisMark
, "FontEmphasisMark" );
56 ret
|= element
->readProp(
57 &style
._fontRelief
, "FontRelief" );
61 void ElementDescriptor::readMultiPageModel( StyleBag
* all_styles
)
64 Style
aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
65 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
67 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
69 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
71 if (readFontProps( this, aStyle
))
75 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id" , all_styles
->getStyleId( aStyle
) );
80 readLongAttr( "MultiPageValue", XMLNS_DIALOGS_PREFIX
":value" );
81 Any
aDecorationAny( _xProps
->getPropertyValue( "Decoration" ) );
82 bool bDecoration
= true;
83 if ( (aDecorationAny
>>= bDecoration
) && !bDecoration
)
84 addAttribute( XMLNS_DIALOGS_PREFIX
":withtabs", "false" );
87 uno::Reference
< container::XNameContainer
> xPagesContainer( _xProps
, uno::UNO_QUERY
);
88 if ( xPagesContainer
.is() && xPagesContainer
->getElementNames().hasElements() )
90 ElementDescriptor
* pElem
= new ElementDescriptor( _xProps
, _xPropState
, XMLNS_DIALOGS_PREFIX
":bulletinboard", _xDocument
);
91 pElem
->readBullitinBoard( all_styles
);
92 addSubElement( pElem
);
96 void ElementDescriptor::readFrameModel( StyleBag
* all_styles
)
99 Style
aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
101 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
103 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
105 if (readFontProps( this, aStyle
))
109 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
116 if ( readProp( "Label" ) >>= aTitle
)
118 ElementDescriptor
* title
= new ElementDescriptor( _xProps
, _xPropState
, XMLNS_DIALOGS_PREFIX
":title", _xDocument
);
119 title
->addAttribute( XMLNS_DIALOGS_PREFIX
":value", aTitle
);
120 addSubElement( title
);
122 uno::Reference
< container::XNameContainer
> xControlContainer( _xProps
, uno::UNO_QUERY
);
123 if ( xControlContainer
.is() && xControlContainer
->getElementNames().hasElements() )
125 ElementDescriptor
* pElem
= new ElementDescriptor( _xProps
, _xPropState
, XMLNS_DIALOGS_PREFIX
":bulletinboard", _xDocument
);
126 pElem
->readBullitinBoard( all_styles
);
127 addSubElement( pElem
);
132 void ElementDescriptor::readPageModel( StyleBag
* all_styles
)
135 Style
aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
136 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
138 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
140 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
142 if (readFontProps( this, aStyle
))
146 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
151 readStringAttr( "Title", XMLNS_DIALOGS_PREFIX
":title" );
152 uno::Reference
< container::XNameContainer
> xControlContainer( _xProps
, uno::UNO_QUERY
);
153 if ( xControlContainer
.is() && xControlContainer
->getElementNames().hasElements() )
155 ElementDescriptor
* pElem
= new ElementDescriptor( _xProps
, _xPropState
, XMLNS_DIALOGS_PREFIX
":bulletinboard", _xDocument
);
156 pElem
->readBullitinBoard( all_styles
);
157 addSubElement( pElem
);
162 void ElementDescriptor::readButtonModel( StyleBag
* all_styles
)
165 Style
aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
166 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
168 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
170 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
172 if (readFontProps( this, aStyle
))
176 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
181 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
182 readBoolAttr( "DefaultButton", XMLNS_DIALOGS_PREFIX
":default" );
183 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX
":value" );
184 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX
":align" );
185 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX
":valign" );
186 readButtonTypeAttr( "PushButtonType", XMLNS_DIALOGS_PREFIX
":button-type" );
187 readImageOrGraphicAttr(XMLNS_DIALOGS_PREFIX
":image-src");
188 readImagePositionAttr( "ImagePosition", XMLNS_DIALOGS_PREFIX
":image-position" );
189 readImageAlignAttr( "ImageAlign", XMLNS_DIALOGS_PREFIX
":image-align" );
191 if (extract_throw
<bool>( _xProps
->getPropertyValue( "Repeat" ) ))
192 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX
":repeat", true /* force */ );
194 if (extract_throw
<bool>( _xProps
->getPropertyValue( "Toggle" ) ))
195 addAttribute( XMLNS_DIALOGS_PREFIX
":toggled", "1" );
197 readBoolAttr( "FocusOnClick", XMLNS_DIALOGS_PREFIX
":grab-focus" );
198 readBoolAttr( "MultiLine",XMLNS_DIALOGS_PREFIX
":multiline" );
201 sal_Int16 nState
= 0;
202 if (readProp( "State" ) >>= nState
)
207 addAttribute( XMLNS_DIALOGS_PREFIX
":checked", "false" );
210 addAttribute( XMLNS_DIALOGS_PREFIX
":checked", "true" );
213 OSL_FAIL( "### unexpected radio state!" );
221 void ElementDescriptor::readCheckBoxModel( StyleBag
* all_styles
)
224 Style
aStyle( 0x1 | 0x2 | 0x8 | 0x20 | 0x40 );
225 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
227 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
229 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
231 if (readFontProps( this, aStyle
))
233 if (readProp( "VisualEffect" ) >>= aStyle
._visualEffect
)
237 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
242 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
243 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX
":value" );
244 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX
":align" );
245 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX
":valign" );
246 readImageOrGraphicAttr(XMLNS_DIALOGS_PREFIX
":image-src");
247 readImagePositionAttr( "ImagePosition", XMLNS_DIALOGS_PREFIX
":image-position" );
248 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX
":multiline" );
250 bool bTriState
= false;
251 if ((readProp( "TriState" ) >>= bTriState
) && bTriState
)
253 addAttribute( XMLNS_DIALOGS_PREFIX
":tristate", "true" );
255 sal_Int16 nState
= 0;
256 if (_xProps
->getPropertyValue( "State" ) >>= nState
)
261 addAttribute( XMLNS_DIALOGS_PREFIX
":checked", "false" );
264 addAttribute( XMLNS_DIALOGS_PREFIX
":checked", "true" );
266 case 2: // tristate=true exported, checked omitted => don't know!
267 OSL_ENSURE( bTriState
, "### detected tristate value, but TriState is not set!" );
270 OSL_FAIL( "### unexpected checkbox state!" );
277 void ElementDescriptor::readComboBoxModel( StyleBag
* all_styles
)
280 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
281 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
283 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
285 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
287 if (readBorderProps( this, aStyle
))
289 if (readFontProps( this, aStyle
))
293 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
298 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
299 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX
":value" );
300 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX
":align" );
301 readBoolAttr( "Autocomplete", XMLNS_DIALOGS_PREFIX
":autocomplete" );
302 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX
":readonly" );
303 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX
":hide-inactive-selection" );
304 readBoolAttr( "Dropdown", XMLNS_DIALOGS_PREFIX
":spin" );
305 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX
":maxlength" );
306 readShortAttr( "LineCount", XMLNS_DIALOGS_PREFIX
":linecount" );
307 // Cell Range, Ref Cell etc.
308 readDataAwareAttr( XMLNS_DIALOGS_PREFIX
":linked-cell" );
309 readDataAwareAttr( XMLNS_DIALOGS_PREFIX
":source-cell-range" );
312 Sequence
< OUString
> itemValues
;
313 if ((readProp( "StringItemList" ) >>= itemValues
) && itemValues
.hasElements())
315 ElementDescriptor
* popup
= new ElementDescriptor( _xProps
, _xPropState
, XMLNS_DIALOGS_PREFIX
":menupopup", _xDocument
);
317 for ( const auto& rItemValue
: std::as_const(itemValues
) )
319 ElementDescriptor
* item
= new ElementDescriptor( _xProps
, _xPropState
, XMLNS_DIALOGS_PREFIX
":menuitem", _xDocument
);
320 item
->addAttribute( XMLNS_DIALOGS_PREFIX
":value", rItemValue
);
321 popup
->addSubElement( item
);
324 addSubElement( popup
);
329 void ElementDescriptor::readListBoxModel( StyleBag
* all_styles
)
332 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
333 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
335 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
337 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
339 if (readBorderProps( this, aStyle
))
341 if (readFontProps( this, aStyle
))
345 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
350 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
351 readBoolAttr( "MultiSelection", XMLNS_DIALOGS_PREFIX
":multiselection" );
352 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX
":readonly" );
353 readBoolAttr( "Dropdown", XMLNS_DIALOGS_PREFIX
":spin" );
354 readShortAttr( "LineCount", XMLNS_DIALOGS_PREFIX
":linecount" );
355 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX
":align" );
356 readDataAwareAttr( XMLNS_DIALOGS_PREFIX
":linked-cell" );
357 readDataAwareAttr( XMLNS_DIALOGS_PREFIX
":source-cell-range" );
359 Sequence
< OUString
> itemValues
;
360 if ((readProp( "StringItemList" ) >>= itemValues
) && itemValues
.hasElements())
362 ElementDescriptor
* popup
= new ElementDescriptor( _xProps
, _xPropState
, XMLNS_DIALOGS_PREFIX
":menupopup", _xDocument
);
364 for ( const auto& rItemValue
: std::as_const(itemValues
) )
366 ElementDescriptor
* item
= new ElementDescriptor(_xProps
, _xPropState
, XMLNS_DIALOGS_PREFIX
":menuitem", _xDocument
);
367 item
->addAttribute( XMLNS_DIALOGS_PREFIX
":value", rItemValue
);
368 popup
->addSubElement( item
);
371 Sequence
< sal_Int16
> selected
;
372 if (readProp( "SelectedItems" ) >>= selected
)
374 sal_Int16
const * pSelected
= selected
.getConstArray();
375 for ( sal_Int32 nPos
= selected
.getLength(); nPos
--; )
377 ElementDescriptor
* item
= static_cast< ElementDescriptor
* >(
378 popup
->getSubElement( pSelected
[ nPos
] ).get() );
379 item
->addAttribute( XMLNS_DIALOGS_PREFIX
":selected", "true" );
383 addSubElement( popup
);
388 void ElementDescriptor::readRadioButtonModel( StyleBag
* all_styles
)
391 Style
aStyle( 0x1 | 0x2 | 0x8 | 0x20 | 0x40 );
392 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
394 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
396 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
398 if (readFontProps( this, aStyle
))
400 if (readProp( "VisualEffect" ) >>= aStyle
._visualEffect
)
404 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id" , all_styles
->getStyleId( aStyle
) );
409 readBoolAttr("Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
410 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX
":value" );
411 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX
":align" );
412 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX
":valign" );
413 readImageOrGraphicAttr(XMLNS_DIALOGS_PREFIX
":image-src");
414 readImagePositionAttr( "ImagePosition", XMLNS_DIALOGS_PREFIX
":image-position" );
415 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX
":multiline" );
416 readStringAttr( "GroupName", XMLNS_DIALOGS_PREFIX
":group-name" );
418 sal_Int16 nState
= 0;
419 if (readProp( "State" ) >>= nState
)
424 addAttribute(XMLNS_DIALOGS_PREFIX
":checked", "false" );
427 addAttribute( XMLNS_DIALOGS_PREFIX
":checked", "true" );
430 OSL_FAIL( "### unexpected radio state!" );
434 readDataAwareAttr( XMLNS_DIALOGS_PREFIX
":linked-cell" );
438 void ElementDescriptor::readGroupBoxModel( StyleBag
* all_styles
)
441 Style
aStyle( 0x2 | 0x8 | 0x20 );
442 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
444 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
446 if (readFontProps( this, aStyle
))
450 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
457 if (readProp( "Label" ) >>= aTitle
)
459 ElementDescriptor
* title
= new ElementDescriptor( _xProps
, _xPropState
, XMLNS_DIALOGS_PREFIX
":title", _xDocument
);
460 title
->addAttribute( XMLNS_DIALOGS_PREFIX
":value", aTitle
);
461 addSubElement( title
);
467 void ElementDescriptor::readFixedTextModel( StyleBag
* all_styles
)
470 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
471 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
473 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
475 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
477 if (readBorderProps( this, aStyle
))
479 if (readFontProps( this, aStyle
))
483 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
488 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX
":value" );
489 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX
":align" );
490 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX
":valign" );
491 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX
":multiline" );
492 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
493 readBoolAttr( "NoLabel", XMLNS_DIALOGS_PREFIX
":nolabel" );
497 void ElementDescriptor::readFixedHyperLinkModel( StyleBag
* all_styles
)
500 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
501 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
503 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
505 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
507 if (readBorderProps( this, aStyle
))
509 if (readFontProps( this, aStyle
))
513 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
518 readStringAttr( "Label",XMLNS_DIALOGS_PREFIX
":value" );
519 readStringAttr( "URL", XMLNS_DIALOGS_PREFIX
":url" );
520 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX
":align" );
521 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX
":valign" );
522 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX
":multiline" );
523 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
524 readBoolAttr( "NoLabel", XMLNS_DIALOGS_PREFIX
":nolabel" );
528 void ElementDescriptor::readEditModel( StyleBag
* all_styles
)
531 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
532 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
534 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
536 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
538 if (readBorderProps( this, aStyle
))
540 if (readFontProps( this, aStyle
))
544 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
549 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
550 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX
":hide-inactive-selection" );
551 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX
":align" );
552 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX
":valign" );
553 readBoolAttr( "HardLineBreaks", XMLNS_DIALOGS_PREFIX
":hard-linebreaks" );
554 readBoolAttr( "HScroll", XMLNS_DIALOGS_PREFIX
":hscroll" );
555 readBoolAttr( "VScroll", XMLNS_DIALOGS_PREFIX
":vscroll" );
556 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX
":maxlength" );
557 readBoolAttr( "MultiLine", XMLNS_DIALOGS_PREFIX
":multiline" );
558 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX
":readonly" );
559 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX
":value" );
560 readLineEndFormatAttr( "LineEndFormat", XMLNS_DIALOGS_PREFIX
":lineend-format" );
562 if (readProp( "EchoChar" ) >>= nEcho
)
564 sal_Unicode cEcho
= static_cast<sal_Unicode
>(nEcho
);
565 addAttribute( XMLNS_DIALOGS_PREFIX
":echochar", OUString( &cEcho
, 1 ) );
567 readDataAwareAttr( XMLNS_DIALOGS_PREFIX
":linked-cell" );
571 void ElementDescriptor::readImageControlModel( StyleBag
* all_styles
)
574 Style
aStyle( 0x1 | 0x4 );
575 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
577 if (readBorderProps( this, aStyle
))
581 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
586 readBoolAttr( "ScaleImage", XMLNS_DIALOGS_PREFIX
":scale-image" );
587 readImageScaleModeAttr( "ScaleMode", XMLNS_DIALOGS_PREFIX
":scale-mode" );
588 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
589 readImageOrGraphicAttr(XMLNS_DIALOGS_PREFIX
":src");
593 void ElementDescriptor::readFileControlModel( StyleBag
* all_styles
)
596 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
597 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
599 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
601 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
603 if (readBorderProps( this, aStyle
))
605 if (readFontProps( this, aStyle
))
609 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
614 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
615 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX
":hide-inactive-selection" );
616 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX
":value" );
617 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX
":readonly" );
621 void ElementDescriptor::readTreeControlModel( StyleBag
* all_styles
)
624 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
625 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
627 if (readBorderProps( this, aStyle
))
631 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
636 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
637 readSelectionTypeAttr( "SelectionType", XMLNS_DIALOGS_PREFIX
":selectiontype" );
639 readBoolAttr( "RootDisplayed", XMLNS_DIALOGS_PREFIX
":rootdisplayed" );
640 readBoolAttr( "ShowsHandles", XMLNS_DIALOGS_PREFIX
":showshandles" );
641 readBoolAttr( "ShowsRootHandles", XMLNS_DIALOGS_PREFIX
":showsroothandles" );
642 readBoolAttr( "Editable", XMLNS_DIALOGS_PREFIX
":editable" );
643 readBoolAttr( "InvokesStopNodeEditing", XMLNS_DIALOGS_PREFIX
":invokesstopnodeediting" );
644 readLongAttr( "RowHeight", XMLNS_DIALOGS_PREFIX
":rowheight" );
648 void ElementDescriptor::readCurrencyFieldModel( StyleBag
* all_styles
)
651 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
652 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
654 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
656 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
658 if (readBorderProps( this, aStyle
))
660 if (readFontProps( this, aStyle
))
664 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
669 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
670 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX
":readonly" );
671 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX
":hide-inactive-selection" );
672 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX
":strict-format" );
673 readStringAttr( "CurrencySymbol", XMLNS_DIALOGS_PREFIX
":currency-symbol" );
674 readShortAttr( "DecimalAccuracy", XMLNS_DIALOGS_PREFIX
":decimal-accuracy" );
675 readBoolAttr( "ShowThousandsSeparator", XMLNS_DIALOGS_PREFIX
":thousands-separator" );
676 readDoubleAttr( "Value", XMLNS_DIALOGS_PREFIX
":value" );
677 readDoubleAttr( "ValueMin", XMLNS_DIALOGS_PREFIX
":value-min" );
678 readDoubleAttr( "ValueMax", XMLNS_DIALOGS_PREFIX
":value-max" );
679 readDoubleAttr( "ValueStep", XMLNS_DIALOGS_PREFIX
":value-step" );
680 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX
":spin" );
681 if (extract_throw
<bool>( _xProps
->getPropertyValue( "Repeat" ) ))
682 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX
":repeat", true /* force */ );
683 readBoolAttr("PrependCurrencySymbol", XMLNS_DIALOGS_PREFIX
":prepend-symbol" );
684 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX
":enforce-format" );
688 void ElementDescriptor::readDateFieldModel( StyleBag
* all_styles
)
691 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
692 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
694 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
696 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
698 if (readBorderProps( this, aStyle
))
700 if (readFontProps( this, aStyle
))
704 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
709 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
710 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX
":readonly" );
711 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX
":hide-inactive-selection" );
712 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX
":strict-format" );
713 readDateFormatAttr( "DateFormat", XMLNS_DIALOGS_PREFIX
":date-format" );
714 readBoolAttr( "DateShowCentury", XMLNS_DIALOGS_PREFIX
":show-century" );
715 readDateAttr( "Date", XMLNS_DIALOGS_PREFIX
":value" );
716 readDateAttr( "DateMin", XMLNS_DIALOGS_PREFIX
":value-min" );
717 readDateAttr( "DateMax", XMLNS_DIALOGS_PREFIX
":value-max" );
718 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX
":spin" );
719 if (extract_throw
<bool>( _xProps
->getPropertyValue( "Repeat" ) ))
720 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX
":repeat", true /* force */ );
721 readBoolAttr( "Dropdown", XMLNS_DIALOGS_PREFIX
":dropdown" );
722 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX
":text" );
723 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX
":enforce-format" );
727 void ElementDescriptor::readNumericFieldModel( StyleBag
* all_styles
)
730 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
731 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
733 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
735 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
737 if (readBorderProps( this, aStyle
))
739 if (readFontProps( this, aStyle
))
743 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
748 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX
":align" );
749 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX
":valign" );
750 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
751 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX
":readonly" );
752 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX
":hide-inactive-selection" );
753 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX
":strict-format" );
754 readShortAttr( "DecimalAccuracy", XMLNS_DIALOGS_PREFIX
":decimal-accuracy" );
755 readBoolAttr( "ShowThousandsSeparator", XMLNS_DIALOGS_PREFIX
":thousands-separator" );
756 readDoubleAttr( "Value", XMLNS_DIALOGS_PREFIX
":value" );
757 readDoubleAttr( "ValueMin", XMLNS_DIALOGS_PREFIX
":value-min" );
758 readDoubleAttr( "ValueMax", XMLNS_DIALOGS_PREFIX
":value-max" );
759 readDoubleAttr( "ValueStep", XMLNS_DIALOGS_PREFIX
":value-step" );
760 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX
":spin" );
761 if (extract_throw
<bool>( _xProps
->getPropertyValue( "Repeat" ) ))
762 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX
":repeat", true /* force */ );
763 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX
":enforce-format" );
767 void ElementDescriptor::readTimeFieldModel( StyleBag
* all_styles
)
770 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
771 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
773 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
775 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
777 if (readBorderProps( this, aStyle
))
779 if (readFontProps( this, aStyle
))
783 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
788 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop");
789 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX
":readonly" );
790 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX
":hide-inactive-selection" );
791 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX
":strict-format" );
792 readTimeFormatAttr( "TimeFormat", XMLNS_DIALOGS_PREFIX
":time-format" );
793 readTimeAttr( "Time", XMLNS_DIALOGS_PREFIX
":value" );
794 readTimeAttr( "TimeMin", XMLNS_DIALOGS_PREFIX
":value-min" );
795 readTimeAttr( "TimeMax", XMLNS_DIALOGS_PREFIX
":value-max" );
796 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX
":spin" );
797 if (extract_throw
<bool>( _xProps
->getPropertyValue( "Repeat" ) ))
798 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX
":repeat", true /* force */ );
799 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX
":text" );
800 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX
":enforce-format" );
804 void ElementDescriptor::readPatternFieldModel( StyleBag
* all_styles
)
807 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
808 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
810 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
812 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
814 if (readBorderProps( this, aStyle
))
816 if (readFontProps( this, aStyle
))
820 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
825 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
826 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX
":readonly" );
827 readBoolAttr( "HideInactiveSelection", XMLNS_DIALOGS_PREFIX
":hide-inactive-selection" );
828 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX
":strict-format" );
829 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX
":value" );
830 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX
":maxlength" );
831 readStringAttr( "EditMask", XMLNS_DIALOGS_PREFIX
":edit-mask" );
832 readStringAttr( "LiteralMask", XMLNS_DIALOGS_PREFIX
":literal-mask" );
836 void ElementDescriptor::readFormattedFieldModel( StyleBag
* all_styles
)
839 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
840 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
842 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
844 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
846 if (readBorderProps( this, aStyle
))
848 if (readFontProps( this, aStyle
))
852 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
857 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
858 readBoolAttr( "ReadOnly", XMLNS_DIALOGS_PREFIX
":readonly" );
859 readBoolAttr( "HideInactiveSelection",XMLNS_DIALOGS_PREFIX
":hide-inactive-selection" );
860 readBoolAttr( "StrictFormat", XMLNS_DIALOGS_PREFIX
":strict-format" );
861 readStringAttr( "Text", XMLNS_DIALOGS_PREFIX
":text" );
862 readAlignAttr( "Align", XMLNS_DIALOGS_PREFIX
":align" );
863 readShortAttr( "MaxTextLen", XMLNS_DIALOGS_PREFIX
":maxlength" );
864 readBoolAttr( "Spin", XMLNS_DIALOGS_PREFIX
":spin" );
865 if (extract_throw
<bool>( _xProps
->getPropertyValue( "Repeat" ) ))
866 readLongAttr( "RepeatDelay",XMLNS_DIALOGS_PREFIX
":repeat", true /* force */ );
868 Any
a( readProp( "EffectiveDefault" ) );
869 switch (a
.getValueTypeClass())
871 case TypeClass_DOUBLE
:
872 addAttribute( XMLNS_DIALOGS_PREFIX
":value-default", OUString::number( *o3tl::forceAccess
<double>(a
) ) );
874 case TypeClass_STRING
:
875 addAttribute( XMLNS_DIALOGS_PREFIX
":value-default", *o3tl::forceAccess
<OUString
>(a
) );
880 readDoubleAttr( "EffectiveMin", XMLNS_DIALOGS_PREFIX
":value-min" );
881 readDoubleAttr( "EffectiveMax", XMLNS_DIALOGS_PREFIX
":value-max" );
882 readDoubleAttr( "EffectiveValue", XMLNS_DIALOGS_PREFIX
":value" );
886 if (readProp( "FormatKey" ) >>= nKey
)
888 Reference
< util::XNumberFormatsSupplier
> xSupplier
;
889 if (readProp( "FormatsSupplier" ) >>= xSupplier
)
892 xSupplier
->getNumberFormats()->getByKey( nKey
) );
895 readBoolAttr( "TreatAsNumber", XMLNS_DIALOGS_PREFIX
":treat-as-number" );
896 readBoolAttr( "EnforceFormat", XMLNS_DIALOGS_PREFIX
":enforce-format" );
901 void ElementDescriptor::readSpinButtonModel( StyleBag
* all_styles
)
904 Style
aStyle( 0x1 | 0x4 );
905 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
907 if (readBorderProps( this, aStyle
))
911 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
916 readOrientationAttr( "Orientation", XMLNS_DIALOGS_PREFIX
":align" );
917 readLongAttr( "SpinIncrement", XMLNS_DIALOGS_PREFIX
":increment" );
918 readLongAttr( "SpinValue", XMLNS_DIALOGS_PREFIX
":curval" );
919 readLongAttr( "SpinValueMax", XMLNS_DIALOGS_PREFIX
":maxval" );
920 readLongAttr( "SpinValueMin", XMLNS_DIALOGS_PREFIX
":minval" );
921 readLongAttr( "Repeat", XMLNS_DIALOGS_PREFIX
":repeat" );
922 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX
":repeat-delay" );
923 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
924 readHexLongAttr( "SymbolColor", XMLNS_DIALOGS_PREFIX
":symbol-color" );
925 readDataAwareAttr( XMLNS_DIALOGS_PREFIX
":linked-cell" );
929 void ElementDescriptor::readFixedLineModel( StyleBag
* all_styles
)
932 Style
aStyle( 0x2 | 0x8 | 0x20 );
933 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
935 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
937 if (readFontProps( this, aStyle
))
941 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
946 readStringAttr( "Label", XMLNS_DIALOGS_PREFIX
":value" );
947 readOrientationAttr( "Orientation", XMLNS_DIALOGS_PREFIX
":align" );
951 void ElementDescriptor::readProgressBarModel( StyleBag
* all_styles
)
954 Style
aStyle( 0x1 | 0x4 | 0x10 );
955 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
957 if (readBorderProps( this, aStyle
))
959 if (readProp( "FillColor" ) >>= aStyle
._descr
)
963 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
968 readLongAttr( "ProgressValue", XMLNS_DIALOGS_PREFIX
":value" );
969 readLongAttr( "ProgressValueMin", XMLNS_DIALOGS_PREFIX
":value-min" );
970 readLongAttr( "ProgressValueMax", XMLNS_DIALOGS_PREFIX
":value-max" );
974 void ElementDescriptor::readScrollBarModel( StyleBag
* all_styles
)
977 Style
aStyle( 0x1 | 0x4 );
978 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
980 if (readBorderProps( this, aStyle
))
984 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
989 readOrientationAttr( "Orientation", XMLNS_DIALOGS_PREFIX
":align" );
990 readLongAttr( "BlockIncrement", XMLNS_DIALOGS_PREFIX
":pageincrement" );
991 readLongAttr( "LineIncrement", XMLNS_DIALOGS_PREFIX
":increment" );
992 readLongAttr( "ScrollValue", XMLNS_DIALOGS_PREFIX
":curpos" );
993 readLongAttr( "ScrollValueMax", XMLNS_DIALOGS_PREFIX
":maxpos" );
994 readLongAttr( "ScrollValueMin", XMLNS_DIALOGS_PREFIX
":minpos" );
995 readLongAttr( "VisibleSize", XMLNS_DIALOGS_PREFIX
":visible-size" );
996 readLongAttr( "RepeatDelay", XMLNS_DIALOGS_PREFIX
":repeat" );
997 readBoolAttr( "Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop" );
998 readBoolAttr( "LiveScroll", XMLNS_DIALOGS_PREFIX
":live-scroll" );
999 readHexLongAttr( "SymbolColor", XMLNS_DIALOGS_PREFIX
":symbol-color" );
1000 readDataAwareAttr( XMLNS_DIALOGS_PREFIX
":linked-cell" );
1004 void ElementDescriptor::readGridControlModel( StyleBag
* all_styles
)
1007 Style
aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
1008 if (readProp("BackgroundColor") >>= aStyle
._backgroundColor
)
1010 if (readBorderProps( this, aStyle
))
1012 if (readProp("TextColor") >>= aStyle
._textColor
)
1014 if (readProp("TextLineColor") >>= aStyle
._textLineColor
)
1015 aStyle
._set
|= 0x20;
1016 if (readFontProps( this, aStyle
))
1020 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id",all_styles
->getStyleId( aStyle
) );
1024 readBoolAttr("Tabstop", XMLNS_DIALOGS_PREFIX
":tabstop");
1025 readVerticalAlignAttr( "VerticalAlign", XMLNS_DIALOGS_PREFIX
":valign");
1026 readSelectionTypeAttr( "SelectionModel", XMLNS_DIALOGS_PREFIX
":selectiontype");
1027 readBoolAttr( "ShowColumnHeader", XMLNS_DIALOGS_PREFIX
":showcolumnheader");
1028 readBoolAttr( "ShowRowHeader", XMLNS_DIALOGS_PREFIX
":showrowheader");
1029 readHexLongAttr( "GridLineColor", XMLNS_DIALOGS_PREFIX
":gridline-color");
1030 readBoolAttr( "UseGridLines", XMLNS_DIALOGS_PREFIX
":usegridlines" );
1031 readHexLongAttr( "HeaderBackgroundColor", XMLNS_DIALOGS_PREFIX
":headerbackground-color");
1032 readHexLongAttr( "HeaderTextColor", XMLNS_DIALOGS_PREFIX
":headertext-color");
1033 readHexLongAttr( "ActiveSelectionBackgroundColor", XMLNS_DIALOGS_PREFIX
":activeselectionbackground-color");
1034 readHexLongAttr( "ActiveSelectionTextColor", XMLNS_DIALOGS_PREFIX
":activeselectiontext-color");
1035 readHexLongAttr( "InactiveSelectionBackgroundColor", XMLNS_DIALOGS_PREFIX
":inactiveselectionbackground-color");
1036 readHexLongAttr( "InactiveSelectionTextColor", XMLNS_DIALOGS_PREFIX
":inactiveselectiontext-color");
1040 void ElementDescriptor::readDialogModel( StyleBag
* all_styles
)
1043 addAttribute( "xmlns:" XMLNS_DIALOGS_PREFIX
, XMLNS_DIALOGS_URI
);
1044 addAttribute( "xmlns:" XMLNS_SCRIPT_PREFIX
, XMLNS_SCRIPT_URI
);
1047 Style
aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
1048 if (readProp( "BackgroundColor" ) >>= aStyle
._backgroundColor
)
1050 if (readProp( "TextColor" ) >>= aStyle
._textColor
)
1052 if (readProp( "TextLineColor" ) >>= aStyle
._textLineColor
)
1053 aStyle
._set
|= 0x20;
1054 if (readFontProps( this, aStyle
))
1058 addAttribute( XMLNS_DIALOGS_PREFIX
":style-id", all_styles
->getStyleId( aStyle
) );
1062 readDefaults( false, false );
1063 readBoolAttr("Closeable", XMLNS_DIALOGS_PREFIX
":closeable" );
1064 readBoolAttr( "Moveable", XMLNS_DIALOGS_PREFIX
":moveable" );
1065 readBoolAttr( "Sizeable", XMLNS_DIALOGS_PREFIX
":resizeable" );
1066 readStringAttr( "Title", XMLNS_DIALOGS_PREFIX
":title" );
1068 readScrollableSettings();
1069 Any
aDecorationAny( _xProps
->getPropertyValue( "Decoration" ) );
1070 bool bDecoration
= false;
1071 if ( (aDecorationAny
>>= bDecoration
) && !bDecoration
)
1072 addAttribute( XMLNS_DIALOGS_PREFIX
":withtitlebar", "false" );
1073 readImageOrGraphicAttr(XMLNS_DIALOGS_PREFIX
":image-src");
1077 void ElementDescriptor::readBullitinBoard( StyleBag
* all_styles
)
1080 ::std::vector
< ElementDescriptor
* > all_elements
;
1081 // read out all props
1082 Reference
< container::XNameContainer
> xDialogModel( _xProps
, UNO_QUERY
);
1083 if ( !xDialogModel
.is() )
1084 return; // #TODO throw???
1085 const Sequence
< OUString
> aElements( xDialogModel
->getElementNames() );
1087 ElementDescriptor
* pRadioGroup
= nullptr;
1089 for ( const auto& rElement
: aElements
)
1091 Any
aControlModel( xDialogModel
->getByName( rElement
) );
1092 Reference
< beans::XPropertySet
> xProps
;
1093 OSL_VERIFY( aControlModel
>>= xProps
);
1096 Reference
< beans::XPropertyState
> xPropState( xProps
, UNO_QUERY
);
1097 OSL_ENSURE( xPropState
.is(), "no XPropertyState!" );
1098 if (! xPropState
.is())
1100 Reference
< lang::XServiceInfo
> xServiceInfo( xProps
, UNO_QUERY
);
1101 OSL_ENSURE( xServiceInfo
.is(), "no XServiceInfo!" );
1102 if (! xServiceInfo
.is())
1105 ElementDescriptor
* pElem
= nullptr;
1107 // group up radio buttons
1108 if ( xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlRadioButtonModel" ) )
1110 if (! pRadioGroup
) // open radiogroup
1112 pRadioGroup
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":radiogroup", _xDocument
);
1113 all_elements
.push_back( pRadioGroup
);
1116 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":radio", _xDocument
);
1117 pElem
->readRadioButtonModel( all_styles
);
1118 pRadioGroup
->addSubElement( pElem
);
1122 pRadioGroup
= nullptr; // close radiogroup
1124 if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlButtonModel" ) )
1126 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":button", _xDocument
);
1127 pElem
->readButtonModel( all_styles
);
1129 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlCheckBoxModel" ) )
1131 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":checkbox", _xDocument
);
1132 pElem
->readCheckBoxModel( all_styles
);
1134 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlComboBoxModel" ) )
1136 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":combobox", _xDocument
);
1137 pElem
->readComboBoxModel( all_styles
);
1139 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlListBoxModel" ) )
1141 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":menulist", _xDocument
);
1142 pElem
->readListBoxModel( all_styles
);
1144 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlGroupBoxModel" ) )
1146 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":titledbox", _xDocument
);
1147 pElem
->readGroupBoxModel( all_styles
);
1149 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoMultiPageModel" ) )
1151 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":multipage", _xDocument
);
1152 pElem
->readMultiPageModel( all_styles
);
1154 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoFrameModel" ) )
1156 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":frame", _xDocument
);
1157 pElem
->readFrameModel( all_styles
);
1159 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoPageModel" ) )
1161 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":page", _xDocument
);
1162 pElem
->readPageModel( all_styles
);
1164 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlFixedTextModel" ) )
1166 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":text", _xDocument
);
1167 pElem
->readFixedTextModel( all_styles
);
1169 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlEditModel" ) )
1171 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":textfield", _xDocument
);
1172 pElem
->readEditModel( all_styles
);
1175 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlFixedHyperlinkModel" ) )
1177 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":linklabel", _xDocument
);
1178 pElem
->readFixedHyperLinkModel( all_styles
);
1180 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlImageControlModel" ) )
1182 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":img", _xDocument
);
1183 pElem
->readImageControlModel( all_styles
);
1185 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlFileControlModel" ) )
1187 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":filecontrol", _xDocument
);
1188 pElem
->readFileControlModel( all_styles
);
1190 else if (xServiceInfo
->supportsService( "com.sun.star.awt.tree.TreeControlModel" ) )
1192 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":treecontrol", _xDocument
);
1193 pElem
->readTreeControlModel( all_styles
);
1195 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlCurrencyFieldModel" ) )
1197 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":currencyfield", _xDocument
);
1198 pElem
->readCurrencyFieldModel( all_styles
);
1200 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlDateFieldModel" ) )
1202 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":datefield", _xDocument
);
1203 pElem
->readDateFieldModel( all_styles
);
1205 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlNumericFieldModel" ) )
1207 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":numericfield", _xDocument
);
1208 pElem
->readNumericFieldModel( all_styles
);
1210 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlTimeFieldModel" ) )
1212 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":timefield", _xDocument
);
1213 pElem
->readTimeFieldModel( all_styles
);
1215 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlPatternFieldModel" ) )
1217 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":patternfield", _xDocument
);
1218 pElem
->readPatternFieldModel( all_styles
);
1220 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlFormattedFieldModel" ) )
1222 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":formattedfield", _xDocument
);
1223 pElem
->readFormattedFieldModel( all_styles
);
1225 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlFixedLineModel" ) )
1227 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":fixedline", _xDocument
);
1228 pElem
->readFixedLineModel( all_styles
);
1230 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlScrollBarModel" ) )
1232 pElem
= new ElementDescriptor(xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":scrollbar", _xDocument
);
1233 pElem
->readScrollBarModel( all_styles
);
1235 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlSpinButtonModel" ) )
1237 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":spinbutton", _xDocument
);
1238 pElem
->readSpinButtonModel( all_styles
);
1240 else if (xServiceInfo
->supportsService( "com.sun.star.awt.UnoControlProgressBarModel" ) )
1242 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":progressmeter", _xDocument
);
1243 pElem
->readProgressBarModel( all_styles
);
1245 else if (xServiceInfo
->supportsService( "com.sun.star.awt.grid.UnoControlGridModel" ) )
1247 pElem
= new ElementDescriptor( xProps
, xPropState
, XMLNS_DIALOGS_PREFIX
":table", _xDocument
);
1248 pElem
->readGridControlModel( all_styles
);
1253 all_elements
.push_back( pElem
);
1257 OSL_FAIL( "unknown control type!" );
1262 for (ElementDescriptor
* p
: all_elements
)
1270 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */