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