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