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     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
595                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":src") ) );
596     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
597                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
598     readEvents();
599 }
600 //__________________________________________________________________________________________________
readFileControlModel(StyleBag * all_styles)601 void ElementDescriptor::readFileControlModel( StyleBag * all_styles )
602     SAL_THROW( (Exception) )
603 {
604     // collect styles
605     Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
606     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
607         aStyle._set |= 0x1;
608     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
609         aStyle._set |= 0x2;
610     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
611         aStyle._set |= 0x20;
612     if (readBorderProps( this, aStyle ))
613         aStyle._set |= 0x4;
614     if (readFontProps( this, aStyle ))
615         aStyle._set |= 0x8;
616     if (aStyle._set)
617     {
618         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
619                       all_styles->getStyleId( aStyle ) );
620     }
621 
622     // collect elements
623     readDefaults();
624     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
625                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
626     readBoolAttr( OUSTR("HideInactiveSelection"),
627                   OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
628     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
629                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
630     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
631                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
632     readEvents();
633 }
634 //__________________________________________________________________________________________________
readTreeControlModel(StyleBag * all_styles)635 void ElementDescriptor::readTreeControlModel( StyleBag * all_styles )
636     SAL_THROW( (Exception) )
637 {
638     // collect styles
639     Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
640     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
641         aStyle._set |= 0x1;
642     if (readBorderProps( this, aStyle ))
643         aStyle._set |= 0x4;
644     if (aStyle._set)
645     {
646         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
647                       all_styles->getStyleId( aStyle ) );
648     }
649 
650     // collect elements
651     readDefaults();
652     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
653                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
654     readSelectionTypeAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectionType") ),
655                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":selectiontype") ) );
656 
657     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("RootDisplayed") ),
658                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":rootdisplayed") ) );
659     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsHandles") ),
660                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":showshandles") ) );
661 	readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsRootHandles") ),
662                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":showsroothandles") ) );
663 	readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Editable") ),
664                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":editable") ) );
665 	readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("InvokesStopNodeEditing") ),
666                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":invokesstopnodeediting") ) );
667     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("RowHeight") ),
668                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":rowheight") ) );
669     readEvents();
670 }
671 //__________________________________________________________________________________________________
readCurrencyFieldModel(StyleBag * all_styles)672 void ElementDescriptor::readCurrencyFieldModel( StyleBag * all_styles )
673     SAL_THROW( (Exception) )
674 {
675     // collect styles
676     Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
677     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
678         aStyle._set |= 0x1;
679     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
680         aStyle._set |= 0x2;
681     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
682         aStyle._set |= 0x20;
683     if (readBorderProps( this, aStyle ))
684         aStyle._set |= 0x4;
685     if (readFontProps( this, aStyle ))
686         aStyle._set |= 0x8;
687     if (aStyle._set)
688     {
689         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
690                       all_styles->getStyleId( aStyle ) );
691     }
692 
693     // collect elements
694     readDefaults();
695     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
696                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
697     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
698                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
699     readBoolAttr( OUSTR("HideInactiveSelection"),
700                   OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
701     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
702                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) );
703     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("CurrencySymbol") ),
704                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":currency-symbol") ) );
705     readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DecimalAccuracy") ),
706                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":decimal-accuracy") ) );
707     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowThousandsSeparator") ),
708                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":thousands-separator") ) );
709     readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Value") ),
710                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
711     readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMin") ),
712                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
713     readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMax") ),
714                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
715     readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueStep") ),
716                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-step") ) );
717     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
718                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) );
719     if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Repeat") ) ))
720         readLongAttr( OUSTR("RepeatDelay"),
721                       OUSTR(XMLNS_DIALOGS_PREFIX ":repeat"), true /* force */ );
722     readBoolAttr(
723         OUString( RTL_CONSTASCII_USTRINGPARAM("PrependCurrencySymbol") ),
724         OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":prepend-symbol") ) );
725     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
726                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":enforce-format") ) );
727     readEvents();
728 }
729 //__________________________________________________________________________________________________
readDateFieldModel(StyleBag * all_styles)730 void ElementDescriptor::readDateFieldModel( StyleBag * all_styles )
731     SAL_THROW( (Exception) )
732 {
733     // collect styles
734     Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
735     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
736         aStyle._set |= 0x1;
737     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
738         aStyle._set |= 0x2;
739     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
740         aStyle._set |= 0x20;
741     if (readBorderProps( this, aStyle ))
742         aStyle._set |= 0x4;
743     if (readFontProps( this, aStyle ))
744         aStyle._set |= 0x8;
745     if (aStyle._set)
746     {
747         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
748                       all_styles->getStyleId( aStyle ) );
749     }
750 
751     // collect elements
752     readDefaults();
753     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
754                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
755     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
756                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
757     readBoolAttr( OUSTR("HideInactiveSelection"),
758                   OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
759     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
760                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) );
761     readDateFormatAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DateFormat") ),
762                         OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":date-format") ) );
763     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DateShowCentury") ),
764                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":show-century") ) );
765     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Date") ),
766                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
767     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DateMin") ),
768                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
769     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DateMax") ),
770                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
771     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
772                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) );
773     if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Repeat") ) ))
774         readLongAttr( OUSTR("RepeatDelay"),
775                       OUSTR(XMLNS_DIALOGS_PREFIX ":repeat"), true /* force */ );
776     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
777                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":dropdown") ) );
778     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
779                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":text") ) );
780     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
781                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":enforce-format") ) );
782     readEvents();
783 }
784 //__________________________________________________________________________________________________
readNumericFieldModel(StyleBag * all_styles)785 void ElementDescriptor::readNumericFieldModel( StyleBag * all_styles )
786     SAL_THROW( (Exception) )
787 {
788     // collect styles
789     Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
790     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
791         aStyle._set |= 0x1;
792     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
793         aStyle._set |= 0x2;
794     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
795         aStyle._set |= 0x20;
796     if (readBorderProps( this, aStyle ))
797         aStyle._set |= 0x4;
798     if (readFontProps( this, aStyle ))
799         aStyle._set |= 0x8;
800     if (aStyle._set)
801     {
802         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
803                       all_styles->getStyleId( aStyle ) );
804     }
805 
806     // collect elements
807     readDefaults();
808     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
809                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
810     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
811                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
812     readBoolAttr( OUSTR("HideInactiveSelection"),
813                   OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
814     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
815                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) );
816     readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DecimalAccuracy") ),
817                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":decimal-accuracy") ) );
818     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowThousandsSeparator") ),
819                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":thousands-separator") ) );
820     readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Value") ),
821                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
822     readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMin") ),
823                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
824     readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMax") ),
825                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
826     readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueStep") ),
827                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-step") ) );
828     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
829                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) );
830     if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Repeat") ) ))
831         readLongAttr( OUSTR("RepeatDelay"),
832                       OUSTR(XMLNS_DIALOGS_PREFIX ":repeat"), true /* force */ );
833     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
834                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":enforce-format") ) );
835     readEvents();
836 }
837 //__________________________________________________________________________________________________
readTimeFieldModel(StyleBag * all_styles)838 void ElementDescriptor::readTimeFieldModel( StyleBag * all_styles )
839     SAL_THROW( (Exception) )
840 {
841     // collect styles
842     Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
843     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
844         aStyle._set |= 0x1;
845     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
846         aStyle._set |= 0x2;
847     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
848         aStyle._set |= 0x20;
849     if (readBorderProps( this, aStyle ))
850         aStyle._set |= 0x4;
851     if (readFontProps( this, aStyle ))
852         aStyle._set |= 0x8;
853     if (aStyle._set)
854     {
855         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
856                       all_styles->getStyleId( aStyle ) );
857     }
858 
859     // collect elements
860     readDefaults();
861     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
862                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
863     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
864                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
865     readBoolAttr( OUSTR("HideInactiveSelection"),
866                   OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
867     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
868                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) );
869     readTimeFormatAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeFormat") ),
870                         OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":time-format") ) );
871     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Time") ),
872                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
873     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeMin") ),
874                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
875     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeMax") ),
876                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
877     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
878                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) );
879     if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Repeat") ) ))
880         readLongAttr( OUSTR("RepeatDelay"),
881                       OUSTR(XMLNS_DIALOGS_PREFIX ":repeat"), true /* force */ );
882     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
883                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":text") ) );
884     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
885                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":enforce-format") ) );
886     readEvents();
887 }
888 //__________________________________________________________________________________________________
readPatternFieldModel(StyleBag * all_styles)889 void ElementDescriptor::readPatternFieldModel( StyleBag * all_styles )
890     SAL_THROW( (Exception) )
891 {
892     // collect styles
893     Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
894     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
895         aStyle._set |= 0x1;
896     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
897         aStyle._set |= 0x2;
898     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
899         aStyle._set |= 0x20;
900     if (readBorderProps( this, aStyle ))
901         aStyle._set |= 0x4;
902     if (readFontProps( this, aStyle ))
903         aStyle._set |= 0x8;
904     if (aStyle._set)
905     {
906         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
907                       all_styles->getStyleId( aStyle ) );
908     }
909 
910     // collect elements
911     readDefaults();
912     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
913                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
914     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
915                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
916     readBoolAttr( OUSTR("HideInactiveSelection"),
917                   OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
918     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
919                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) );
920     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
921                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
922     readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
923                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
924     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EditMask") ),
925                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":edit-mask") ) );
926     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LiteralMask") ),
927                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":literal-mask") ) );
928     readEvents();
929 }
930 //__________________________________________________________________________________________________
readFormattedFieldModel(StyleBag * all_styles)931 void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles )
932     SAL_THROW( (Exception) )
933 {
934     // collect styles
935     Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
936     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
937         aStyle._set |= 0x1;
938     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
939         aStyle._set |= 0x2;
940     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
941         aStyle._set |= 0x20;
942     if (readBorderProps( this, aStyle ))
943         aStyle._set |= 0x4;
944     if (readFontProps( this, aStyle ))
945         aStyle._set |= 0x8;
946     if (aStyle._set)
947     {
948         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
949                       all_styles->getStyleId( aStyle ) );
950     }
951 
952     // collect elements
953     readDefaults();
954     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
955                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
956     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
957                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
958     readBoolAttr( OUSTR("HideInactiveSelection"),
959                   OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
960     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
961                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) );
962     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
963                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":text") ) );
964     readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
965                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
966     readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
967                    OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
968     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
969                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) );
970     if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Repeat") ) ))
971         readLongAttr( OUSTR("RepeatDelay"),
972                       OUSTR(XMLNS_DIALOGS_PREFIX ":repeat"), true /* force */ );
973 
974     Any a( readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveDefault") ) ) );
975     switch (a.getValueTypeClass())
976     {
977     case TypeClass_DOUBLE:
978         addAttribute(
979             OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-default") ),
980             OUString::valueOf( *(double const *)a.getValue() ) );
981         break;
982     case TypeClass_STRING:
983         addAttribute(
984             OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-default") ),
985             *(OUString const *)a.getValue() );
986         break;
987     default:
988         break;
989     }
990     readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveMin") ),
991                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
992     readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveMax") ),
993                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
994     readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveValue") ),
995                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
996 
997     // format spec
998     sal_Int32 nKey = 0;
999     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FormatKey") ) ) >>= nKey)
1000     {
1001         Reference< util::XNumberFormatsSupplier > xSupplier;
1002         if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FormatsSupplier") ) ) >>= xSupplier)
1003         {
1004             addNumberFormatAttr(
1005                 xSupplier->getNumberFormats()->getByKey( nKey ),
1006                 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
1007         }
1008     }
1009     readBoolAttr(
1010         OUString( RTL_CONSTASCII_USTRINGPARAM("TreatAsNumber") ),
1011         OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":treat-as-number") ) );
1012     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
1013                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":enforce-format") ) );
1014 
1015     readEvents();
1016 }
1017 //__________________________________________________________________________________________________
readFixedLineModel(StyleBag * all_styles)1018 void ElementDescriptor::readFixedLineModel( StyleBag * all_styles )
1019     SAL_THROW( (Exception) )
1020 {
1021     // collect styles
1022     Style aStyle( 0x2 | 0x8 | 0x20 );
1023     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
1024         aStyle._set |= 0x2;
1025     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
1026         aStyle._set |= 0x20;
1027     if (readFontProps( this, aStyle ))
1028         aStyle._set |= 0x8;
1029     if (aStyle._set)
1030     {
1031         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
1032                       all_styles->getStyleId( aStyle ) );
1033     }
1034 
1035     // collect elements
1036     readDefaults();
1037     readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1038                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
1039     readOrientationAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
1040                          OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
1041     readEvents();
1042 }
1043 //__________________________________________________________________________________________________
readProgressBarModel(StyleBag * all_styles)1044 void ElementDescriptor::readProgressBarModel( StyleBag * all_styles )
1045     SAL_THROW( (Exception) )
1046 {
1047     // collect styles
1048     Style aStyle( 0x1 | 0x4 | 0x10 );
1049     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
1050         aStyle._set |= 0x1;
1051     if (readBorderProps( this, aStyle ))
1052         aStyle._set |= 0x4;
1053     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FillColor") ) ) >>= aStyle._descr)
1054         aStyle._set |= 0x10;
1055     if (aStyle._set)
1056     {
1057         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
1058                       all_styles->getStyleId( aStyle ) );
1059     }
1060 
1061     // collect elements
1062     readDefaults();
1063     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ),
1064                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
1065     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMin") ),
1066                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
1067     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ),
1068                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
1069     readEvents();
1070 }
1071 //__________________________________________________________________________________________________
readScrollBarModel(StyleBag * all_styles)1072 void ElementDescriptor::readScrollBarModel( StyleBag * all_styles )
1073     SAL_THROW( (Exception) )
1074 {
1075     // collect styles
1076     Style aStyle( 0x1 | 0x4 );
1077     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
1078         aStyle._set |= 0x1;
1079     if (readBorderProps( this, aStyle ))
1080         aStyle._set |= 0x4;
1081     if (aStyle._set)
1082     {
1083         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
1084                       all_styles->getStyleId( aStyle ) );
1085     }
1086 
1087     // collect elements
1088     readDefaults();
1089     readOrientationAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
1090                          OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
1091     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("BlockIncrement") ),
1092                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":pageincrement") ) );
1093     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineIncrement") ),
1094                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":increment") ) );
1095     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScrollValue") ),
1096                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":curpos") ) );
1097     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMax") ),
1098                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxpos") ) );
1099     readLongAttr( OUSTR("ScrollValueMin"),
1100                   OUSTR(XMLNS_DIALOGS_PREFIX ":minpos") );
1101     readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VisibleSize") ),
1102                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":visible-size") ) );
1103     readLongAttr( OUSTR("RepeatDelay"), OUSTR(XMLNS_DIALOGS_PREFIX ":repeat") );
1104     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1105                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
1106     readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LiveScroll") ),
1107                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":live-scroll") ) );
1108     readHexLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
1109                      OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":symbol-color") ) );
1110     readEvents();
1111 }
1112 //__________________________________________________________________________________________________
readDialogModel(StyleBag * all_styles)1113 void ElementDescriptor::readDialogModel( StyleBag * all_styles )
1114     SAL_THROW( (Exception) )
1115 {
1116     // collect elements
1117     addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM("xmlns:" XMLNS_DIALOGS_PREFIX) ),
1118                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_URI) ) );
1119     addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM("xmlns:" XMLNS_SCRIPT_PREFIX) ),
1120                   OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_URI) ) );
1121 
1122     // collect styles
1123     Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
1124     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
1125         aStyle._set |= 0x1;
1126     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
1127         aStyle._set |= 0x2;
1128     if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
1129         aStyle._set |= 0x20;
1130     if (readFontProps( this, aStyle ))
1131         aStyle._set |= 0x8;
1132     if (aStyle._set)
1133     {
1134         addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
1135                       all_styles->getStyleId( aStyle ) );
1136     }
1137 
1138     // collect elements
1139     readDefaults( false, false );
1140     readBoolAttr(
1141         OUString( RTL_CONSTASCII_USTRINGPARAM("Closeable") ),
1142         OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":closeable") ) );
1143     readBoolAttr(
1144         OUString( RTL_CONSTASCII_USTRINGPARAM("Moveable") ),
1145         OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":moveable") ) );
1146     readBoolAttr(
1147         OUString( RTL_CONSTASCII_USTRINGPARAM("Sizeable") ),
1148         OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":resizeable") ) );
1149     readStringAttr(
1150         OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ),
1151         OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) );
1152 
1153     Any aDecorationAny( _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Decoration") ) ) );
1154 	bool bDecoration = sal_False;
1155     if ( (aDecorationAny >>= bDecoration) && !bDecoration )
1156 		addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":withtitlebar") ),
1157 		              OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) );
1158 
1159 	readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
1160                     OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
1161 
1162     readEvents();
1163 }
1164 
1165 }
1166