1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_xmlscript.hxx"
26 #include "exp_share.hxx"
27 
28 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
29 
30 
31 using namespace ::com::sun::star;
32 using namespace ::com::sun::star::uno;
33 using ::rtl::OUString;
34 
35 namespace xmlscript
36 {
37 
readBorderProps(ElementDescriptor * element,Style & style)38 static inline bool readBorderProps(
39     ElementDescriptor * element, Style & style )
40 {
41     if (element->readProp( &style._border, OUSTR("Border") )) {
42         if (style._border == BORDER_SIMPLE /* simple */)
43         {
44             if (element->readProp( &style._borderColor, OUSTR("BorderColor") ))
45                 style._border = BORDER_SIMPLE_COLOR;
46         }
47         return true;
48     }
49     return false;
50 }
51 
readFontProps(ElementDescriptor * element,Style & style)52 static inline bool readFontProps( ElementDescriptor * element, Style & style )
53 {
54     bool ret = element->readProp(
55         &style._descr, OUSTR("FontDescriptor") );
56     ret |= element->readProp(
57         &style._fontEmphasisMark, OUSTR("FontEmphasisMark") );
58     ret |= element->readProp(
59         &style._fontRelief, OUSTR("FontRelief") );
60     return ret;
61 }
62 
63 //__________________________________________________________________________________________________
readButtonModel(StyleBag * all_styles)64 void ElementDescriptor::readButtonModel( StyleBag * all_styles )
65     SAL_THROW( (Exception) )
66 {
67     // collect styles
68     Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
69     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
70         aStyle._set |= 0x1;
71     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
72         aStyle._set |= 0x2;
73     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
74         aStyle._set |= 0x20;
75     if (readFontProps( this, aStyle ))
76         aStyle._set |= 0x8;
77     if (aStyle._set)
78     {
79         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
80                       all_styles->getStyleId( aStyle ) );
81     }
82 
83     // collect elements
84     readDefaults();
85     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
86                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
87     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultButton") ),
88                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":default") ) );
89     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
90                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
91     readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
92                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
93     readVerticalAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
94                            OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) );
95     readButtonTypeAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("PushButtonType") ),
96                         OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":button-type") ) );
97     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
98                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
99     readImagePositionAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
100                            OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) );
101     readImageAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageAlign") ),
102                         OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-align") ) );
103     if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Repeat") ) ))
104         readLongAttr( OUSTR("RepeatDelay"),
105                       OUSTR(XMLNS_DIALOGS_PREFIX ":repeat"), true /* force */ );
106     if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Toggle") ) ))
107         addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":toggled"), OUSTR("1") );
108     readBoolAttr( OUSTR("FocusOnClick"),
109                   OUSTR(XMLNS_DIALOGS_PREFIX ":grab-focus") );
110     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
111                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) );
112 
113 
114     // State
115     sal_Int16 nState = 0;
116     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ) ) >>= nState)
117     {
118         switch (nState)
119         {
120         case 0:
121             addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checked") ),
122                           OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) );
123             break;
124         case 1:
125             addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checked") ),
126                           OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) );
127             break;
128         default:
129             OSL_ENSURE( 0, "### unexpected radio state!" );
130             break;
131         }
132     }
133 
134     readEvents();
135 }
136 //__________________________________________________________________________________________________
readCheckBoxModel(StyleBag * all_styles)137 void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles )
138     SAL_THROW( (Exception) )
139 {
140     // collect styles
141     Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 | 0x40 );
142     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
143         aStyle._set |= 0x1;
144     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
145         aStyle._set |= 0x2;
146     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
147         aStyle._set |= 0x20;
148     if (readFontProps( this, aStyle ))
149         aStyle._set |= 0x8;
150     if (readProp( OUSTR("VisualEffect") ) >>= aStyle._visualEffect)
151         aStyle._set |= 0x40;
152     if (aStyle._set)
153     {
154         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
155                       all_styles->getStyleId( aStyle ) );
156     }
157 
158     // collect elements
159     readDefaults();
160     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
161                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
162     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
163                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
164     readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
165                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
166     readVerticalAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
167                            OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) );
168     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
169                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
170     readImagePositionAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
171                            OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) );
172     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
173                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) );
174 
175     sal_Bool bTriState = sal_False;
176     if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TriState") ) ) >>= bTriState) && bTriState)
177     {
178         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tristate") ),
179                       OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) );
180     }
181     sal_Int16 nState = 0;
182     if (_xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ) ) >>= nState)
183     {
184         switch (nState)
185         {
186         case 0:
187             addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checked") ),
188                           OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) );
189             break;
190         case 1:
191             addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checked") ),
192                           OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) );
193             break;
194         case 2: // tristate=true exported, checked omitted => dont know!
195             OSL_ENSURE( bTriState, "### detected tristate value, but TriState is not set!" );
196             break;
197         default:
198             OSL_ENSURE( 0, "### unexpected checkbox state!" );
199             break;
200         }
201     }
202     readEvents();
203 }
204 //__________________________________________________________________________________________________
readComboBoxModel(StyleBag * all_styles)205 void ElementDescriptor::readComboBoxModel( StyleBag * all_styles )
206     SAL_THROW( (Exception) )
207 {
208     // collect styles
209     Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
210     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
211         aStyle._set |= 0x1;
212     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
213         aStyle._set |= 0x2;
214     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
215         aStyle._set |= 0x20;
216     if (readBorderProps( this, aStyle ))
217         aStyle._set |= 0x4;
218     if (readFontProps( this, aStyle ))
219         aStyle._set |= 0x8;
220     if (aStyle._set)
221     {
222         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
223                       all_styles->getStyleId( aStyle ) );
224     }
225 
226     // collect elements
227     readDefaults();
228     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
229                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
230     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
231                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
232     readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
233                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
234     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Autocomplete") ),
235                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":autocomplete") ) );
236     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
237                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
238     readBoolAttr( OUSTR("HideInactiveSelection"),
239                   OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
240     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
241                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) );
242     readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
243                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
244     readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
245                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
246 
247     // string item list
248     Sequence< OUString > itemValues;
249     if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
250         itemValues.getLength() > 0)
251     {
252         ElementDescriptor * popup = new ElementDescriptor(
253             _xProps, _xPropState,
254             OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menupopup") ) );
255 
256         OUString const * pItemValues = itemValues.getConstArray();
257         for ( sal_Int32 nPos = 0; nPos < itemValues.getLength(); ++nPos )
258         {
259             ElementDescriptor * item = new ElementDescriptor(
260                 _xProps, _xPropState,
261                 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menuitem") ) );
262             item->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
263                                 pItemValues[ nPos ] );
264             popup->addSubElement( item );
265         }
266 
267         addSubElement( popup );
268     }
269     readEvents();
270 }
271 //__________________________________________________________________________________________________
readListBoxModel(StyleBag * all_styles)272 void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
273     SAL_THROW( (Exception) )
274 {
275     // collect styles
276     Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
277     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
278         aStyle._set |= 0x1;
279     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
280         aStyle._set |= 0x2;
281     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
282         aStyle._set |= 0x20;
283     if (readBorderProps( this, aStyle ))
284         aStyle._set |= 0x4;
285     if (readFontProps( this, aStyle ))
286         aStyle._set |= 0x8;
287     if (aStyle._set)
288     {
289         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
290                       all_styles->getStyleId( aStyle ) );
291     }
292 
293     // collect elements
294     readDefaults();
295     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
296                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
297     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiSelection") ),
298                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiselection") ) );
299     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
300                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
301     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
302                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) );
303     readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
304                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
305     readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
306                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
307 
308     // string item list
309     Sequence< OUString > itemValues;
310     if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
311         itemValues.getLength() > 0)
312     {
313         ElementDescriptor * popup = new ElementDescriptor(
314             _xProps, _xPropState,
315             OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menupopup") ) );
316 
317         OUString const * pItemValues = itemValues.getConstArray();
318         sal_Int32 nPos;
319         for ( nPos = 0; nPos < itemValues.getLength(); ++nPos )
320         {
321             ElementDescriptor * item = new ElementDescriptor(
322                 _xProps, _xPropState,
323                 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menuitem") ) );
324             item->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
325                                 pItemValues[ nPos ] );
326             popup->addSubElement( item );
327         }
328 
329         Sequence< sal_Int16 > selected;
330         if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ) ) >>= selected)
331         {
332             sal_Int16 const * pSelected = selected.getConstArray();
333             for ( nPos = selected.getLength(); nPos--; )
334             {
335                 ElementDescriptor * item = static_cast< ElementDescriptor * >(
336                     popup->getSubElement( pSelected[ nPos ] ).get() );
337                 item->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":selected") ),
338                                     OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) );
339             }
340         }
341 
342         addSubElement( popup );
343     }
344     readEvents();
345 }
346 //__________________________________________________________________________________________________
readRadioButtonModel(StyleBag * all_styles)347 void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles )
348     SAL_THROW( (Exception) )
349 {
350     // collect styles
351     Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 | 0x40 );
352     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
353         aStyle._set |= 0x1;
354     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
355         aStyle._set |= 0x2;
356     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
357         aStyle._set |= 0x20;
358     if (readFontProps( this, aStyle ))
359         aStyle._set |= 0x8;
360     if (readProp( OUSTR("VisualEffect") ) >>= aStyle._visualEffect)
361         aStyle._set |= 0x40;
362     if (aStyle._set)
363     {
364         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
365                       all_styles->getStyleId( aStyle ) );
366     }
367 
368     // collect elements
369     readDefaults();
370     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
371                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
372     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
373                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
374     readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
375                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
376     readVerticalAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
377                            OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) );
378     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
379                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
380     readImagePositionAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
381                            OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) );
382     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
383                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) );
384 
385     sal_Int16 nState = 0;
386     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ) ) >>= nState)
387     {
388         switch (nState)
389         {
390         case 0:
391             addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checked") ),
392                           OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) );
393             break;
394         case 1:
395             addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checked") ),
396                           OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) );
397             break;
398         default:
399             OSL_ENSURE( 0, "### unexpected radio state!" );
400             break;
401         }
402     }
403     readEvents();
404 }
405 //__________________________________________________________________________________________________
readGroupBoxModel(StyleBag * all_styles)406 void ElementDescriptor::readGroupBoxModel( StyleBag * all_styles )
407     SAL_THROW( (Exception) )
408 {
409     // collect styles
410     Style aStyle( 0x2 | 0x8 | 0x20 );
411     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
412         aStyle._set |= 0x2;
413     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
414         aStyle._set |= 0x20;
415     if (readFontProps( this, aStyle ))
416         aStyle._set |= 0x8;
417     if (aStyle._set)
418     {
419         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
420                       all_styles->getStyleId( aStyle ) );
421     }
422 
423     // collect elements
424     readDefaults();
425 
426     OUString aTitle;
427     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ) ) >>= aTitle)
428     {
429         ElementDescriptor * title = new ElementDescriptor(
430             _xProps, _xPropState,
431             OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) );
432         title->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
433                              aTitle );
434         addSubElement( title );
435     }
436 
437     readEvents();
438 }
439 //__________________________________________________________________________________________________
readFixedTextModel(StyleBag * all_styles)440 void ElementDescriptor::readFixedTextModel( StyleBag * all_styles )
441     SAL_THROW( (Exception) )
442 {
443     // collect styles
444     Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
445     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
446         aStyle._set |= 0x1;
447     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
448         aStyle._set |= 0x2;
449     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
450         aStyle._set |= 0x20;
451     if (readBorderProps( this, aStyle ))
452         aStyle._set |= 0x4;
453     if (readFontProps( this, aStyle ))
454         aStyle._set |= 0x8;
455     if (aStyle._set)
456     {
457         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
458                       all_styles->getStyleId( aStyle ) );
459     }
460 
461     // collect elements
462     readDefaults();
463     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
464                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
465     readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
466                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
467     readVerticalAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
468                            OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) );
469     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
470                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) );
471     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
472                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
473     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("NoLabel") ),
474                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":nolabel") ) );
475     readEvents();
476 }
477 //__________________________________________________________________________________________________
readFixedHyperLinkModel(StyleBag * all_styles)478 void ElementDescriptor::readFixedHyperLinkModel( StyleBag * all_styles )
479     SAL_THROW( (Exception) )
480 {
481     // collect styles
482     Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
483     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
484         aStyle._set |= 0x1;
485     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
486         aStyle._set |= 0x2;
487     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
488         aStyle._set |= 0x20;
489     if (readBorderProps( this, aStyle ))
490         aStyle._set |= 0x4;
491     if (readFontProps( this, aStyle ))
492         aStyle._set |= 0x8;
493     if (aStyle._set)
494     {
495         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
496                       all_styles->getStyleId( aStyle ) );
497     }
498 
499     // collect elements
500     readDefaults();
501     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
502                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
503     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("URL") ),
504                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":url") ) );
505 	readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Description") ),
506                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":description") ) );
507     readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
508                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
509     readVerticalAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
510                            OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) );
511     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
512                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) );
513     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
514                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
515     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("NoLabel") ),
516                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":nolabel") ) );
517     readEvents();
518 }
519 //__________________________________________________________________________________________________
readEditModel(StyleBag * all_styles)520 void ElementDescriptor::readEditModel( StyleBag * all_styles )
521     SAL_THROW( (Exception) )
522 {
523     // collect styles
524     Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
525     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
526         aStyle._set |= 0x1;
527     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
528         aStyle._set |= 0x2;
529     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
530         aStyle._set |= 0x20;
531     if (readBorderProps( this, aStyle ))
532         aStyle._set |= 0x4;
533     if (readFontProps( this, aStyle ))
534         aStyle._set |= 0x8;
535     if (aStyle._set)
536     {
537         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
538                       all_styles->getStyleId( aStyle ) );
539     }
540 
541     // collect elements
542     readDefaults();
543     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
544                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
545     readBoolAttr( OUSTR("HideInactiveSelection"),
546                   OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
547     readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
548                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
549     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("HardLineBreaks") ),
550                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":hard-linebreaks") ) );
551     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("HScroll") ),
552                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":hscroll") ) );
553     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VScroll") ),
554                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":vscroll") ) );
555     readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
556                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
557     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
558                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) );
559     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
560                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
561     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
562                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
563     readLineEndFormatAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineEndFormat") ),
564                            OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":lineend-format") ) );
565     sal_Int16 nEcho = 0;
566     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("EchoChar") ) ) >>= nEcho)
567     {
568         sal_Unicode cEcho = (sal_Unicode)nEcho;
569         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":echochar") ),
570                       OUString( &cEcho, 1 ) );
571     }
572     readEvents();
573 }
574 //__________________________________________________________________________________________________
readImageControlModel(StyleBag * all_styles)575 void ElementDescriptor::readImageControlModel( StyleBag * all_styles )
576     SAL_THROW( (Exception) )
577 {
578     // collect styles
579     Style aStyle( 0x1 | 0x4 );
580     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
581         aStyle._set |= 0x1;
582     if (readBorderProps( this, aStyle ))
583         aStyle._set |= 0x4;
584     if (aStyle._set)
585     {
586         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
587                       all_styles->getStyleId( aStyle ) );
588     }
589 
590     // collect elements
591     readDefaults();
592     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
593                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scale-image") ) );
594     readImageScaleModeAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleMode") ),
595                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scale-mode") ) );
596     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
597                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":src") ) );
598     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
599                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
600     readEvents();
601 }
602 //__________________________________________________________________________________________________
readFileControlModel(StyleBag * all_styles)603 void ElementDescriptor::readFileControlModel( StyleBag * all_styles )
604     SAL_THROW( (Exception) )
605 {
606     // collect styles
607     Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
608     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
609         aStyle._set |= 0x1;
610     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
611         aStyle._set |= 0x2;
612     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
613         aStyle._set |= 0x20;
614     if (readBorderProps( this, aStyle ))
615         aStyle._set |= 0x4;
616     if (readFontProps( this, aStyle ))
617         aStyle._set |= 0x8;
618     if (aStyle._set)
619     {
620         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
621                       all_styles->getStyleId( aStyle ) );
622     }
623 
624     // collect elements
625     readDefaults();
626     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
627                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
628     readBoolAttr( OUSTR("HideInactiveSelection"),
629                   OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
630     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
631                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
632     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
633                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
634     readEvents();
635 }
636 //__________________________________________________________________________________________________
readTreeControlModel(StyleBag * all_styles)637 void ElementDescriptor::readTreeControlModel( StyleBag * all_styles )
638     SAL_THROW( (Exception) )
639 {
640     // collect styles
641     Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
642     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
643         aStyle._set |= 0x1;
644     if (readBorderProps( this, aStyle ))
645         aStyle._set |= 0x4;
646     if (aStyle._set)
647     {
648         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
649                       all_styles->getStyleId( aStyle ) );
650     }
651 
652     // collect elements
653     readDefaults();
654     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
655                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
656     readSelectionTypeAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectionType") ),
657                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":selectiontype") ) );
658 
659     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("RootDisplayed") ),
660                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":rootdisplayed") ) );
661     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsHandles") ),
662                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":showshandles") ) );
663 	readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsRootHandles") ),
664                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":showsroothandles") ) );
665 	readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Editable") ),
666                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":editable") ) );
667 	readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("InvokesStopNodeEditing") ),
668                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":invokesstopnodeediting") ) );
669     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("RowHeight") ),
670                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":rowheight") ) );
671     readEvents();
672 }
673 //__________________________________________________________________________________________________
readCurrencyFieldModel(StyleBag * all_styles)674 void ElementDescriptor::readCurrencyFieldModel( StyleBag * all_styles )
675     SAL_THROW( (Exception) )
676 {
677     // collect styles
678     Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
679     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
680         aStyle._set |= 0x1;
681     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
682         aStyle._set |= 0x2;
683     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
684         aStyle._set |= 0x20;
685     if (readBorderProps( this, aStyle ))
686         aStyle._set |= 0x4;
687     if (readFontProps( this, aStyle ))
688         aStyle._set |= 0x8;
689     if (aStyle._set)
690     {
691         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
692                       all_styles->getStyleId( aStyle ) );
693     }
694 
695     // collect elements
696     readDefaults();
697     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
698                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
699     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
700                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
701     readBoolAttr( OUSTR("HideInactiveSelection"),
702                   OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
703     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
704                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) );
705     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("CurrencySymbol") ),
706                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":currency-symbol") ) );
707     readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DecimalAccuracy") ),
708                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":decimal-accuracy") ) );
709     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowThousandsSeparator") ),
710                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":thousands-separator") ) );
711     readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Value") ),
712                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
713     readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMin") ),
714                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
715     readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMax") ),
716                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
717     readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueStep") ),
718                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-step") ) );
719     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
720                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) );
721     if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Repeat") ) ))
722         readLongAttr( OUSTR("RepeatDelay"),
723                       OUSTR(XMLNS_DIALOGS_PREFIX ":repeat"), true /* force */ );
724     readBoolAttr(
725         OUString( RTL_CONSTASCII_USTRINGPARAM("PrependCurrencySymbol") ),
726         OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":prepend-symbol") ) );
727     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
728                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":enforce-format") ) );
729     readEvents();
730 }
731 //__________________________________________________________________________________________________
readDateFieldModel(StyleBag * all_styles)732 void ElementDescriptor::readDateFieldModel( StyleBag * all_styles )
733     SAL_THROW( (Exception) )
734 {
735     // collect styles
736     Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
737     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
738         aStyle._set |= 0x1;
739     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
740         aStyle._set |= 0x2;
741     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
742         aStyle._set |= 0x20;
743     if (readBorderProps( this, aStyle ))
744         aStyle._set |= 0x4;
745     if (readFontProps( this, aStyle ))
746         aStyle._set |= 0x8;
747     if (aStyle._set)
748     {
749         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
750                       all_styles->getStyleId( aStyle ) );
751     }
752 
753     // collect elements
754     readDefaults();
755     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
756                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
757     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
758                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
759     readBoolAttr( OUSTR("HideInactiveSelection"),
760                   OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
761     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
762                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) );
763     readDateFormatAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DateFormat") ),
764                         OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":date-format") ) );
765     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DateShowCentury") ),
766                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":show-century") ) );
767     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Date") ),
768                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
769     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DateMin") ),
770                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
771     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DateMax") ),
772                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
773     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
774                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) );
775     if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Repeat") ) ))
776         readLongAttr( OUSTR("RepeatDelay"),
777                       OUSTR(XMLNS_DIALOGS_PREFIX ":repeat"), true /* force */ );
778     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
779                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":dropdown") ) );
780     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
781                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":text") ) );
782     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
783                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":enforce-format") ) );
784     readEvents();
785 }
786 //__________________________________________________________________________________________________
readNumericFieldModel(StyleBag * all_styles)787 void ElementDescriptor::readNumericFieldModel( StyleBag * all_styles )
788     SAL_THROW( (Exception) )
789 {
790     // collect styles
791     Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
792     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
793         aStyle._set |= 0x1;
794     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
795         aStyle._set |= 0x2;
796     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
797         aStyle._set |= 0x20;
798     if (readBorderProps( this, aStyle ))
799         aStyle._set |= 0x4;
800     if (readFontProps( this, aStyle ))
801         aStyle._set |= 0x8;
802     if (aStyle._set)
803     {
804         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
805                       all_styles->getStyleId( aStyle ) );
806     }
807 
808     // collect elements
809     readDefaults();
810     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
811                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
812     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
813                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
814     readBoolAttr( OUSTR("HideInactiveSelection"),
815                   OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
816     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
817                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) );
818     readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DecimalAccuracy") ),
819                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":decimal-accuracy") ) );
820     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowThousandsSeparator") ),
821                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":thousands-separator") ) );
822     readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Value") ),
823                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
824     readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMin") ),
825                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
826     readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMax") ),
827                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
828     readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueStep") ),
829                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-step") ) );
830     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
831                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) );
832     if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Repeat") ) ))
833         readLongAttr( OUSTR("RepeatDelay"),
834                       OUSTR(XMLNS_DIALOGS_PREFIX ":repeat"), true /* force */ );
835     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
836                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":enforce-format") ) );
837     readEvents();
838 }
839 //__________________________________________________________________________________________________
readTimeFieldModel(StyleBag * all_styles)840 void ElementDescriptor::readTimeFieldModel( StyleBag * all_styles )
841     SAL_THROW( (Exception) )
842 {
843     // collect styles
844     Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
845     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
846         aStyle._set |= 0x1;
847     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
848         aStyle._set |= 0x2;
849     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
850         aStyle._set |= 0x20;
851     if (readBorderProps( this, aStyle ))
852         aStyle._set |= 0x4;
853     if (readFontProps( this, aStyle ))
854         aStyle._set |= 0x8;
855     if (aStyle._set)
856     {
857         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
858                       all_styles->getStyleId( aStyle ) );
859     }
860 
861     // collect elements
862     readDefaults();
863     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
864                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
865     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
866                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
867     readBoolAttr( OUSTR("HideInactiveSelection"),
868                   OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
869     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
870                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) );
871     readTimeFormatAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeFormat") ),
872                         OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":time-format") ) );
873     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Time") ),
874                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
875     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeMin") ),
876                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
877     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeMax") ),
878                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
879     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
880                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) );
881     if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Repeat") ) ))
882         readLongAttr( OUSTR("RepeatDelay"),
883                       OUSTR(XMLNS_DIALOGS_PREFIX ":repeat"), true /* force */ );
884     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
885                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":text") ) );
886     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
887                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":enforce-format") ) );
888     readEvents();
889 }
890 //__________________________________________________________________________________________________
readPatternFieldModel(StyleBag * all_styles)891 void ElementDescriptor::readPatternFieldModel( StyleBag * all_styles )
892     SAL_THROW( (Exception) )
893 {
894     // collect styles
895     Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
896     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
897         aStyle._set |= 0x1;
898     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
899         aStyle._set |= 0x2;
900     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
901         aStyle._set |= 0x20;
902     if (readBorderProps( this, aStyle ))
903         aStyle._set |= 0x4;
904     if (readFontProps( this, aStyle ))
905         aStyle._set |= 0x8;
906     if (aStyle._set)
907     {
908         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
909                       all_styles->getStyleId( aStyle ) );
910     }
911 
912     // collect elements
913     readDefaults();
914     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
915                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
916     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
917                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
918     readBoolAttr( OUSTR("HideInactiveSelection"),
919                   OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
920     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
921                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) );
922     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
923                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
924     readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
925                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
926     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EditMask") ),
927                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":edit-mask") ) );
928     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LiteralMask") ),
929                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":literal-mask") ) );
930     readEvents();
931 }
932 //__________________________________________________________________________________________________
readFormattedFieldModel(StyleBag * all_styles)933 void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles )
934     SAL_THROW( (Exception) )
935 {
936     // collect styles
937     Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
938     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
939         aStyle._set |= 0x1;
940     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
941         aStyle._set |= 0x2;
942     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
943         aStyle._set |= 0x20;
944     if (readBorderProps( this, aStyle ))
945         aStyle._set |= 0x4;
946     if (readFontProps( this, aStyle ))
947         aStyle._set |= 0x8;
948     if (aStyle._set)
949     {
950         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
951                       all_styles->getStyleId( aStyle ) );
952     }
953 
954     // collect elements
955     readDefaults();
956     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
957                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
958     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
959                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
960     readBoolAttr( OUSTR("HideInactiveSelection"),
961                   OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
962     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
963                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) );
964     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
965                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":text") ) );
966     readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
967                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
968     readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
969                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
970     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
971                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) );
972     if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Repeat") ) ))
973         readLongAttr( OUSTR("RepeatDelay"),
974                       OUSTR(XMLNS_DIALOGS_PREFIX ":repeat"), true /* force */ );
975 
976     Any a( readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveDefault") ) ) );
977     switch (a.getValueTypeClass())
978     {
979     case TypeClass_DOUBLE:
980         addAttribute(
981             OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-default") ),
982             OUString::valueOf( *(double const *)a.getValue() ) );
983         break;
984     case TypeClass_STRING:
985         addAttribute(
986             OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-default") ),
987             *(OUString const *)a.getValue() );
988         break;
989     default:
990         break;
991     }
992     readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveMin") ),
993                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
994     readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveMax") ),
995                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
996     readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveValue") ),
997                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
998 
999     // format spec
1000     sal_Int32 nKey = 0;
1001     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FormatKey") ) ) >>= nKey)
1002     {
1003         Reference< util::XNumberFormatsSupplier > xSupplier;
1004         if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FormatsSupplier") ) ) >>= xSupplier)
1005         {
1006             addNumberFormatAttr(
1007                 xSupplier->getNumberFormats()->getByKey( nKey ),
1008                 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
1009         }
1010     }
1011     readBoolAttr(
1012         OUString( RTL_CONSTASCII_USTRINGPARAM("TreatAsNumber") ),
1013         OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":treat-as-number") ) );
1014     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
1015                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":enforce-format") ) );
1016 
1017     readEvents();
1018 }
1019 //__________________________________________________________________________________________________
readFixedLineModel(StyleBag * all_styles)1020 void ElementDescriptor::readFixedLineModel( StyleBag * all_styles )
1021     SAL_THROW( (Exception) )
1022 {
1023     // collect styles
1024     Style aStyle( 0x2 | 0x8 | 0x20 );
1025     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
1026         aStyle._set |= 0x2;
1027     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
1028         aStyle._set |= 0x20;
1029     if (readFontProps( this, aStyle ))
1030         aStyle._set |= 0x8;
1031     if (aStyle._set)
1032     {
1033         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
1034                       all_styles->getStyleId( aStyle ) );
1035     }
1036 
1037     // collect elements
1038     readDefaults();
1039     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1040                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
1041     readOrientationAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
1042                          OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
1043     readEvents();
1044 }
1045 //__________________________________________________________________________________________________
readProgressBarModel(StyleBag * all_styles)1046 void ElementDescriptor::readProgressBarModel( StyleBag * all_styles )
1047     SAL_THROW( (Exception) )
1048 {
1049     // collect styles
1050     Style aStyle( 0x1 | 0x4 | 0x10 );
1051     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
1052         aStyle._set |= 0x1;
1053     if (readBorderProps( this, aStyle ))
1054         aStyle._set |= 0x4;
1055     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FillColor") ) ) >>= aStyle._descr)
1056         aStyle._set |= 0x10;
1057     if (aStyle._set)
1058     {
1059         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
1060                       all_styles->getStyleId( aStyle ) );
1061     }
1062 
1063     // collect elements
1064     readDefaults();
1065     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ),
1066                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
1067     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMin") ),
1068                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
1069     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ),
1070                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
1071     readEvents();
1072 }
1073 //__________________________________________________________________________________________________
readScrollBarModel(StyleBag * all_styles)1074 void ElementDescriptor::readScrollBarModel( StyleBag * all_styles )
1075     SAL_THROW( (Exception) )
1076 {
1077     // collect styles
1078     Style aStyle( 0x1 | 0x4 );
1079     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
1080         aStyle._set |= 0x1;
1081     if (readBorderProps( this, aStyle ))
1082         aStyle._set |= 0x4;
1083     if (aStyle._set)
1084     {
1085         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
1086                       all_styles->getStyleId( aStyle ) );
1087     }
1088 
1089     // collect elements
1090     readDefaults();
1091     readOrientationAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
1092                          OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
1093     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("BlockIncrement") ),
1094                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":pageincrement") ) );
1095     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineIncrement") ),
1096                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":increment") ) );
1097     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScrollValue") ),
1098                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":curpos") ) );
1099     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMax") ),
1100                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxpos") ) );
1101     readLongAttr( OUSTR("ScrollValueMin"),
1102                   OUSTR(XMLNS_DIALOGS_PREFIX ":minpos") );
1103     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VisibleSize") ),
1104                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":visible-size") ) );
1105     readLongAttr( OUSTR("RepeatDelay"), OUSTR(XMLNS_DIALOGS_PREFIX ":repeat") );
1106     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1107                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
1108     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LiveScroll") ),
1109                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":live-scroll") ) );
1110     readHexLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
1111                      OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":symbol-color") ) );
1112     readEvents();
1113 }
1114 //__________________________________________________________________________________________________
readDialogModel(StyleBag * all_styles)1115 void ElementDescriptor::readDialogModel( StyleBag * all_styles )
1116     SAL_THROW( (Exception) )
1117 {
1118     // collect elements
1119     addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM("xmlns:" XMLNS_DIALOGS_PREFIX) ),
1120                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_URI) ) );
1121     addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM("xmlns:" XMLNS_SCRIPT_PREFIX) ),
1122                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_URI) ) );
1123 
1124     // collect styles
1125     Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
1126     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
1127         aStyle._set |= 0x1;
1128     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
1129         aStyle._set |= 0x2;
1130     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
1131         aStyle._set |= 0x20;
1132     if (readFontProps( this, aStyle ))
1133         aStyle._set |= 0x8;
1134     if (aStyle._set)
1135     {
1136         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
1137                       all_styles->getStyleId( aStyle ) );
1138     }
1139 
1140     // collect elements
1141     readDefaults( false, false );
1142     readBoolAttr(
1143         OUString( RTL_CONSTASCII_USTRINGPARAM("Closeable") ),
1144         OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":closeable") ) );
1145     readBoolAttr(
1146         OUString( RTL_CONSTASCII_USTRINGPARAM("Moveable") ),
1147         OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":moveable") ) );
1148     readBoolAttr(
1149         OUString( RTL_CONSTASCII_USTRINGPARAM("Sizeable") ),
1150         OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":resizeable") ) );
1151     readStringAttr(
1152         OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ),
1153         OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) );
1154 
1155     Any aDecorationAny( _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Decoration") ) ) );
1156 	bool bDecoration = sal_False;
1157     if ( (aDecorationAny >>= bDecoration) && !bDecoration )
1158 		addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":withtitlebar") ),
1159 		              OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) );
1160 
1161 	readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
1162                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
1163 
1164     readEvents();
1165 }
1166 
1167 }
1168