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