merge the formfield patch from ooo-build
[ooovba.git] / xmlscript / source / xmldlg_imexp / xmldlg_expmodels.cxx
blobba28702a9201dd47020aba89e80ffe257992a9d8
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmldlg_expmodels.cxx,v $
10 * $Revision: 1.38 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_xmlscript.hxx"
33 #include "exp_share.hxx"
35 #include <com/sun/star/form/binding/XListEntrySink.hpp>
36 #include <com/sun/star/form/binding/XBindableValue.hpp>
37 #include <com/sun/star/form/binding/XValueBinding.hpp>
38 #include <com/sun/star/table/CellAddress.hpp>
39 #include <com/sun/star/table/CellRangeAddress.hpp>
40 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
41 #include <com/sun/star/document/XStorageBasedDocument.hpp>
42 #include <com/sun/star/document/XGraphicObjectResolver.hpp>
43 #include <comphelper/componentcontext.hxx>
44 #include <comphelper/processfactory.hxx>
47 using namespace ::com::sun::star;
48 using namespace ::com::sun::star::uno;
49 using ::rtl::OUString;
51 namespace xmlscript
54 void lclExportBindableAndListSourceBits( Reference< frame::XModel > const & xDocument, const Reference< beans::XPropertySet >& _xProps, ElementDescriptor& rModel )
56 Reference< lang::XMultiServiceFactory > xFac;
57 if ( xDocument.is() )
58 xFac.set( xDocument, uno::UNO_QUERY );
60 Reference< form::binding::XBindableValue > xBinding( _xProps, UNO_QUERY );
62 if ( xFac.is() && xBinding.is() )
64 try
66 Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
67 Reference< beans::XPropertySet > xBindable( xBinding->getValueBinding(), UNO_QUERY );
68 if ( xBindable.is() )
70 table::CellAddress aAddress;
71 xBindable->getPropertyValue( OUSTR("BoundCell") ) >>= aAddress;
72 xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) );
73 rtl::OUString sAddress;
74 xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress;
75 if ( sAddress.getLength() > 0 )
76 rModel.addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell"), sAddress );
78 OSL_TRACE( "*** Bindable value %s", rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() );
82 catch( uno::Exception& )
86 Reference< form::binding::XListEntrySink > xEntrySink( _xProps, UNO_QUERY );
87 if ( xEntrySink.is() )
89 Reference< beans::XPropertySet > xListSource( xEntrySink->getListEntrySource(), UNO_QUERY );
90 if ( xListSource.is() )
92 try
94 Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
96 table::CellRangeAddress aAddress;
97 xListSource->getPropertyValue( OUSTR( "CellRange" ) ) >>= aAddress;
99 rtl::OUString sAddress;
100 xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) );
101 xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress;
102 OSL_TRACE("**** cell range source list %s",
103 rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() );
104 if ( sAddress.getLength() > 0 );
105 rModel.addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":source-cell-range"), sAddress );
107 catch( uno::Exception& )
114 static inline bool readBorderProps(
115 ElementDescriptor * element, Style & style )
117 if (element->readProp( &style._border, OUSTR("Border") )) {
118 if (style._border == BORDER_SIMPLE /* simple */)
120 if (element->readProp( &style._borderColor, OUSTR("BorderColor") ))
121 style._border = BORDER_SIMPLE_COLOR;
123 return true;
125 return false;
128 static inline bool readFontProps( ElementDescriptor * element, Style & style )
130 bool ret = element->readProp(
131 &style._descr, OUSTR("FontDescriptor") );
132 ret |= element->readProp(
133 &style._fontEmphasisMark, OUSTR("FontEmphasisMark") );
134 ret |= element->readProp(
135 &style._fontRelief, OUSTR("FontRelief") );
136 return ret;
139 //__________________________________________________________________________________________________
140 void ElementDescriptor::readMultiPageModel( StyleBag * all_styles )
142 // collect styles
143 Style aStyle( 0x2 | 0x8 | 0x20 );
144 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
145 aStyle._set |= 0x2;
146 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
147 aStyle._set |= 0x20;
148 if (readFontProps( this, aStyle ))
149 aStyle._set |= 0x8;
150 if (aStyle._set)
152 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
153 all_styles->getStyleId( aStyle ) );
156 // collect elements
157 readDefaults();
158 readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ),
159 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
160 readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ),
161 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
163 OUString aTitle;
164 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ) ) >>= aTitle)
166 ElementDescriptor * title = new ElementDescriptor(
167 _xProps, _xPropState,
168 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) );
169 title->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
170 aTitle );
171 addSubElement( title );
174 readEvents();
176 void ElementDescriptor::readButtonModel( StyleBag * all_styles )
177 SAL_THROW( (Exception) )
179 // collect styles
180 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
181 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
182 aStyle._set |= 0x1;
183 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
184 aStyle._set |= 0x2;
185 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
186 aStyle._set |= 0x20;
187 if (readFontProps( this, aStyle ))
188 aStyle._set |= 0x8;
189 if (aStyle._set)
191 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
192 all_styles->getStyleId( aStyle ) );
195 // collect elements
196 readDefaults();
197 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
198 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
199 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultButton") ),
200 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":default") ) );
201 readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
202 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
203 readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
204 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
205 readVerticalAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
206 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) );
207 readButtonTypeAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("PushButtonType") ),
208 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":button-type") ) );
209 readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
210 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
211 readImagePositionAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
212 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) );
213 readImageAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageAlign") ),
214 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-align") ) );
215 if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Repeat") ) ))
216 readLongAttr( OUSTR("RepeatDelay"),
217 OUSTR(XMLNS_DIALOGS_PREFIX ":repeat"), true /* force */ );
218 if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Toggle") ) ))
219 addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":toggled"), OUSTR("1") );
220 readBoolAttr( OUSTR("FocusOnClick"),
221 OUSTR(XMLNS_DIALOGS_PREFIX ":grab-focus") );
222 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
223 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) );
226 // State
227 sal_Int16 nState = 0;
228 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ) ) >>= nState)
230 switch (nState)
232 case 0:
233 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checked") ),
234 OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) );
235 break;
236 case 1:
237 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checked") ),
238 OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) );
239 break;
240 default:
241 OSL_ENSURE( 0, "### unexpected radio state!" );
242 break;
246 readEvents();
248 //__________________________________________________________________________________________________
249 void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles )
250 SAL_THROW( (Exception) )
252 // collect styles
253 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 | 0x40 );
254 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
255 aStyle._set |= 0x1;
256 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
257 aStyle._set |= 0x2;
258 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
259 aStyle._set |= 0x20;
260 if (readFontProps( this, aStyle ))
261 aStyle._set |= 0x8;
262 if (readProp( OUSTR("VisualEffect") ) >>= aStyle._visualEffect)
263 aStyle._set |= 0x40;
264 if (aStyle._set)
266 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
267 all_styles->getStyleId( aStyle ) );
270 // collect elements
271 readDefaults();
272 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
273 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
274 readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
275 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
276 readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
277 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
278 readVerticalAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
279 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) );
280 readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
281 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
282 readImagePositionAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
283 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) );
284 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
285 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) );
287 sal_Bool bTriState = sal_False;
288 if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TriState") ) ) >>= bTriState) && bTriState)
290 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tristate") ),
291 OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) );
293 sal_Int16 nState = 0;
294 if (_xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ) ) >>= nState)
296 switch (nState)
298 case 0:
299 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checked") ),
300 OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) );
301 break;
302 case 1:
303 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checked") ),
304 OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) );
305 break;
306 case 2: // tristate=true exported, checked omitted => dont know!
307 OSL_ENSURE( bTriState, "### detected tristate value, but TriState is not set!" );
308 break;
309 default:
310 OSL_ENSURE( 0, "### unexpected checkbox state!" );
311 break;
314 readEvents();
316 //__________________________________________________________________________________________________
317 void ElementDescriptor::readComboBoxModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
318 SAL_THROW( (Exception) )
320 // collect styles
321 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
322 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
323 aStyle._set |= 0x1;
324 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
325 aStyle._set |= 0x2;
326 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
327 aStyle._set |= 0x20;
328 if (readBorderProps( this, aStyle ))
329 aStyle._set |= 0x4;
330 if (readFontProps( this, aStyle ))
331 aStyle._set |= 0x8;
332 if (aStyle._set)
334 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
335 all_styles->getStyleId( aStyle ) );
338 // collect elements
339 readDefaults();
340 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
341 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
342 readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
343 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
344 readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
345 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
346 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Autocomplete") ),
347 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":autocomplete") ) );
348 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
349 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
350 readBoolAttr( OUSTR("HideInactiveSelection"),
351 OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
352 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
353 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) );
354 readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
355 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
356 readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
357 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
358 // Cell Range, Ref Cell etc.
359 lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
360 // string item list
361 Sequence< OUString > itemValues;
362 if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
363 itemValues.getLength() > 0)
365 ElementDescriptor * popup = new ElementDescriptor(
366 _xProps, _xPropState,
367 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menupopup") ) );
369 OUString const * pItemValues = itemValues.getConstArray();
370 for ( sal_Int32 nPos = 0; nPos < itemValues.getLength(); ++nPos )
372 ElementDescriptor * item = new ElementDescriptor(
373 _xProps, _xPropState,
374 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menuitem") ) );
375 item->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
376 pItemValues[ nPos ] );
377 popup->addSubElement( item );
380 addSubElement( popup );
382 readEvents();
384 //__________________________________________________________________________________________________
385 void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
386 SAL_THROW( (Exception) )
388 // collect styles
389 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
390 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
391 aStyle._set |= 0x1;
392 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
393 aStyle._set |= 0x2;
394 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
395 aStyle._set |= 0x20;
396 if (readBorderProps( this, aStyle ))
397 aStyle._set |= 0x4;
398 if (readFontProps( this, aStyle ))
399 aStyle._set |= 0x8;
400 if (aStyle._set)
402 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
403 all_styles->getStyleId( aStyle ) );
406 // collect elements
407 readDefaults();
408 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
409 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
410 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiSelection") ),
411 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiselection") ) );
412 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
413 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
414 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
415 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) );
416 readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
417 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
418 readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
419 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
420 lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
421 // string item list
422 Sequence< OUString > itemValues;
423 if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
424 itemValues.getLength() > 0)
426 ElementDescriptor * popup = new ElementDescriptor(
427 _xProps, _xPropState,
428 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menupopup") ) );
430 OUString const * pItemValues = itemValues.getConstArray();
431 sal_Int32 nPos;
432 for ( nPos = 0; nPos < itemValues.getLength(); ++nPos )
434 ElementDescriptor * item = new ElementDescriptor(
435 _xProps, _xPropState,
436 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menuitem") ) );
437 item->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
438 pItemValues[ nPos ] );
439 popup->addSubElement( item );
442 Sequence< sal_Int16 > selected;
443 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ) ) >>= selected)
445 sal_Int16 const * pSelected = selected.getConstArray();
446 for ( nPos = selected.getLength(); nPos--; )
448 ElementDescriptor * item = static_cast< ElementDescriptor * >(
449 popup->getSubElement( pSelected[ nPos ] ).get() );
450 item->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":selected") ),
451 OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) );
455 addSubElement( popup );
457 readEvents();
459 //__________________________________________________________________________________________________
460 void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
461 SAL_THROW( (Exception) )
463 // collect styles
464 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 | 0x40 );
465 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
466 aStyle._set |= 0x1;
467 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
468 aStyle._set |= 0x2;
469 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
470 aStyle._set |= 0x20;
471 if (readFontProps( this, aStyle ))
472 aStyle._set |= 0x8;
473 if (readProp( OUSTR("VisualEffect") ) >>= aStyle._visualEffect)
474 aStyle._set |= 0x40;
475 if (aStyle._set)
477 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
478 all_styles->getStyleId( aStyle ) );
481 // collect elements
482 readDefaults();
483 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
484 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
485 readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
486 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
487 readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
488 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
489 readVerticalAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
490 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) );
491 readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
492 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
493 readImagePositionAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
494 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) );
495 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
496 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) );
497 readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ),
498 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":group-name") ) );
500 sal_Int16 nState = 0;
501 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ) ) >>= nState)
503 switch (nState)
505 case 0:
506 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checked") ),
507 OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) );
508 break;
509 case 1:
510 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checked") ),
511 OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) );
512 break;
513 default:
514 OSL_ENSURE( 0, "### unexpected radio state!" );
515 break;
518 lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
519 readEvents();
521 //__________________________________________________________________________________________________
522 void ElementDescriptor::readGroupBoxModel( StyleBag * all_styles )
523 SAL_THROW( (Exception) )
525 // collect styles
526 Style aStyle( 0x2 | 0x8 | 0x20 );
527 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
528 aStyle._set |= 0x2;
529 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
530 aStyle._set |= 0x20;
531 if (readFontProps( this, aStyle ))
532 aStyle._set |= 0x8;
533 if (aStyle._set)
535 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
536 all_styles->getStyleId( aStyle ) );
539 // collect elements
540 readDefaults();
542 OUString aTitle;
543 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ) ) >>= aTitle)
545 ElementDescriptor * title = new ElementDescriptor(
546 _xProps, _xPropState,
547 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) );
548 title->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
549 aTitle );
550 addSubElement( title );
553 readEvents();
555 //__________________________________________________________________________________________________
556 void ElementDescriptor::readFixedTextModel( StyleBag * all_styles )
557 SAL_THROW( (Exception) )
559 // collect styles
560 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
561 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
562 aStyle._set |= 0x1;
563 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
564 aStyle._set |= 0x2;
565 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
566 aStyle._set |= 0x20;
567 if (readBorderProps( this, aStyle ))
568 aStyle._set |= 0x4;
569 if (readFontProps( this, aStyle ))
570 aStyle._set |= 0x8;
571 if (aStyle._set)
573 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
574 all_styles->getStyleId( aStyle ) );
577 // collect elements
578 readDefaults();
579 readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
580 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
581 readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
582 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
583 readVerticalAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
584 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) );
585 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
586 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) );
587 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
588 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
589 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("NoLabel") ),
590 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":nolabel") ) );
591 readEvents();
593 //__________________________________________________________________________________________________
594 void ElementDescriptor::readFixedHyperLinkModel( StyleBag * all_styles )
595 SAL_THROW( (Exception) )
597 // collect styles
598 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
599 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
600 aStyle._set |= 0x1;
601 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
602 aStyle._set |= 0x2;
603 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
604 aStyle._set |= 0x20;
605 if (readBorderProps( this, aStyle ))
606 aStyle._set |= 0x4;
607 if (readFontProps( this, aStyle ))
608 aStyle._set |= 0x8;
609 if (aStyle._set)
611 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
612 all_styles->getStyleId( aStyle ) );
615 // collect elements
616 readDefaults();
617 readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
618 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
619 readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("URL") ),
620 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":url") ) );
621 readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Description") ),
622 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":description") ) );
623 readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
624 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
625 readVerticalAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
626 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) );
627 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
628 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) );
629 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
630 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
631 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("NoLabel") ),
632 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":nolabel") ) );
633 readEvents();
635 //__________________________________________________________________________________________________
636 void ElementDescriptor::readEditModel( StyleBag * all_styles )
637 SAL_THROW( (Exception) )
639 // collect styles
640 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
641 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
642 aStyle._set |= 0x1;
643 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
644 aStyle._set |= 0x2;
645 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
646 aStyle._set |= 0x20;
647 if (readBorderProps( this, aStyle ))
648 aStyle._set |= 0x4;
649 if (readFontProps( this, aStyle ))
650 aStyle._set |= 0x8;
651 if (aStyle._set)
653 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
654 all_styles->getStyleId( aStyle ) );
657 // collect elements
658 readDefaults();
659 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
660 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
661 readBoolAttr( OUSTR("HideInactiveSelection"),
662 OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
663 readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
664 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
665 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("HardLineBreaks") ),
666 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":hard-linebreaks") ) );
667 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("HScroll") ),
668 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":hscroll") ) );
669 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VScroll") ),
670 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":vscroll") ) );
671 readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
672 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
673 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
674 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) );
675 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
676 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
677 readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
678 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
679 readLineEndFormatAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineEndFormat") ),
680 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":lineend-format") ) );
681 sal_Int16 nEcho = 0;
682 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("EchoChar") ) ) >>= nEcho)
684 sal_Unicode cEcho = (sal_Unicode)nEcho;
685 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":echochar") ),
686 OUString( &cEcho, 1 ) );
688 readEvents();
690 //__________________________________________________________________________________________________
691 void ElementDescriptor::readImageControlModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
692 SAL_THROW( (Exception) )
694 // collect styles
695 Style aStyle( 0x1 | 0x4 );
696 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
697 aStyle._set |= 0x1;
698 if (readBorderProps( this, aStyle ))
699 aStyle._set |= 0x4;
700 if (aStyle._set)
702 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
703 all_styles->getStyleId( aStyle ) );
706 // collect elements
707 readDefaults();
708 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
709 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scale-image") ) );
710 rtl::OUString sURL;
711 _xProps->getPropertyValue( OUSTR("ImageURL") ) >>= sURL;
713 if ( sURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) ) ) == 0 )
715 Reference< document::XStorageBasedDocument > xDocStorage( xDocument, UNO_QUERY );
717 if ( xDocStorage.is() )
719 uno::Sequence< Any > aArgs( 1 );
720 aArgs[ 0 ] <<= xDocStorage->getDocumentStorage();
722 ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
723 uno::Reference< document::XGraphicObjectResolver > xGraphicResolver;
724 aContext.createComponentWithArguments( OUSTR( "com.sun.star.comp.Svx.GraphicExportHelper" ), aArgs, xGraphicResolver );
725 if ( xGraphicResolver.is() )
727 sURL = xGraphicResolver->resolveGraphicObjectURL( sURL );
731 if ( sURL.getLength() > 0 )
733 addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":src"), sURL );
735 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
736 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
737 readEvents();
739 //__________________________________________________________________________________________________
740 void ElementDescriptor::readFileControlModel( StyleBag * all_styles )
741 SAL_THROW( (Exception) )
743 // collect styles
744 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
745 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
746 aStyle._set |= 0x1;
747 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
748 aStyle._set |= 0x2;
749 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
750 aStyle._set |= 0x20;
751 if (readBorderProps( this, aStyle ))
752 aStyle._set |= 0x4;
753 if (readFontProps( this, aStyle ))
754 aStyle._set |= 0x8;
755 if (aStyle._set)
757 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
758 all_styles->getStyleId( aStyle ) );
761 // collect elements
762 readDefaults();
763 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
764 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
765 readBoolAttr( OUSTR("HideInactiveSelection"),
766 OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
767 readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
768 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
769 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
770 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
771 readEvents();
773 //__________________________________________________________________________________________________
774 void ElementDescriptor::readTreeControlModel( StyleBag * all_styles )
775 SAL_THROW( (Exception) )
777 // collect styles
778 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
779 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
780 aStyle._set |= 0x1;
781 if (readBorderProps( this, aStyle ))
782 aStyle._set |= 0x4;
783 if (aStyle._set)
785 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
786 all_styles->getStyleId( aStyle ) );
789 // collect elements
790 readDefaults();
791 readSelectionTypeAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectionType") ),
792 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":selectiontype") ) );
794 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("RootDisplayed") ),
795 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":rootdisplayed") ) );
796 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsHandles") ),
797 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":showshandles") ) );
798 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsRootHandles") ),
799 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":showsroothandles") ) );
800 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Editable") ),
801 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":editable") ) );
802 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("InvokesStopNodeEditing") ),
803 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":invokesstopnodeediting") ) );
804 readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("RowHeight") ),
805 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":rowheight") ) );
806 readEvents();
808 //__________________________________________________________________________________________________
809 void ElementDescriptor::readCurrencyFieldModel( StyleBag * all_styles )
810 SAL_THROW( (Exception) )
812 // collect styles
813 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
814 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
815 aStyle._set |= 0x1;
816 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
817 aStyle._set |= 0x2;
818 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
819 aStyle._set |= 0x20;
820 if (readBorderProps( this, aStyle ))
821 aStyle._set |= 0x4;
822 if (readFontProps( this, aStyle ))
823 aStyle._set |= 0x8;
824 if (aStyle._set)
826 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
827 all_styles->getStyleId( aStyle ) );
830 // collect elements
831 readDefaults();
832 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
833 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
834 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
835 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
836 readBoolAttr( OUSTR("HideInactiveSelection"),
837 OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
838 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
839 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) );
840 readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("CurrencySymbol") ),
841 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":currency-symbol") ) );
842 readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DecimalAccuracy") ),
843 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":decimal-accuracy") ) );
844 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowThousandsSeparator") ),
845 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":thousands-separator") ) );
846 readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Value") ),
847 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
848 readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMin") ),
849 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
850 readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMax") ),
851 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
852 readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueStep") ),
853 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-step") ) );
854 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
855 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) );
856 if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Repeat") ) ))
857 readLongAttr( OUSTR("RepeatDelay"),
858 OUSTR(XMLNS_DIALOGS_PREFIX ":repeat"), true /* force */ );
859 readBoolAttr(
860 OUString( RTL_CONSTASCII_USTRINGPARAM("PrependCurrencySymbol") ),
861 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":prepend-symbol") ) );
862 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
863 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":enforce-format") ) );
864 readEvents();
866 //__________________________________________________________________________________________________
867 void ElementDescriptor::readDateFieldModel( StyleBag * all_styles )
868 SAL_THROW( (Exception) )
870 // collect styles
871 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
872 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
873 aStyle._set |= 0x1;
874 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
875 aStyle._set |= 0x2;
876 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
877 aStyle._set |= 0x20;
878 if (readBorderProps( this, aStyle ))
879 aStyle._set |= 0x4;
880 if (readFontProps( this, aStyle ))
881 aStyle._set |= 0x8;
882 if (aStyle._set)
884 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
885 all_styles->getStyleId( aStyle ) );
888 // collect elements
889 readDefaults();
890 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
891 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
892 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
893 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
894 readBoolAttr( OUSTR("HideInactiveSelection"),
895 OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
896 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
897 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) );
898 readDateFormatAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DateFormat") ),
899 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":date-format") ) );
900 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DateShowCentury") ),
901 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":show-century") ) );
902 readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Date") ),
903 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
904 readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DateMin") ),
905 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
906 readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DateMax") ),
907 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
908 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
909 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) );
910 if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Repeat") ) ))
911 readLongAttr( OUSTR("RepeatDelay"),
912 OUSTR(XMLNS_DIALOGS_PREFIX ":repeat"), true /* force */ );
913 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
914 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":dropdown") ) );
915 readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
916 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":text") ) );
917 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
918 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":enforce-format") ) );
919 readEvents();
921 //__________________________________________________________________________________________________
922 void ElementDescriptor::readNumericFieldModel( StyleBag * all_styles )
923 SAL_THROW( (Exception) )
925 // collect styles
926 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
927 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
928 aStyle._set |= 0x1;
929 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
930 aStyle._set |= 0x2;
931 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
932 aStyle._set |= 0x20;
933 if (readBorderProps( this, aStyle ))
934 aStyle._set |= 0x4;
935 if (readFontProps( this, aStyle ))
936 aStyle._set |= 0x8;
937 if (aStyle._set)
939 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
940 all_styles->getStyleId( aStyle ) );
943 // collect elements
944 readDefaults();
945 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
946 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
947 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
948 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
949 readBoolAttr( OUSTR("HideInactiveSelection"),
950 OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
951 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
952 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) );
953 readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DecimalAccuracy") ),
954 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":decimal-accuracy") ) );
955 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowThousandsSeparator") ),
956 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":thousands-separator") ) );
957 readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Value") ),
958 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
959 readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMin") ),
960 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
961 readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMax") ),
962 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
963 readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueStep") ),
964 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-step") ) );
965 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
966 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) );
967 if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Repeat") ) ))
968 readLongAttr( OUSTR("RepeatDelay"),
969 OUSTR(XMLNS_DIALOGS_PREFIX ":repeat"), true /* force */ );
970 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
971 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":enforce-format") ) );
972 readEvents();
974 //__________________________________________________________________________________________________
975 void ElementDescriptor::readTimeFieldModel( StyleBag * all_styles )
976 SAL_THROW( (Exception) )
978 // collect styles
979 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
980 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
981 aStyle._set |= 0x1;
982 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
983 aStyle._set |= 0x2;
984 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
985 aStyle._set |= 0x20;
986 if (readBorderProps( this, aStyle ))
987 aStyle._set |= 0x4;
988 if (readFontProps( this, aStyle ))
989 aStyle._set |= 0x8;
990 if (aStyle._set)
992 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
993 all_styles->getStyleId( aStyle ) );
996 // collect elements
997 readDefaults();
998 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
999 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
1000 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
1001 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
1002 readBoolAttr( OUSTR("HideInactiveSelection"),
1003 OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
1004 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
1005 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) );
1006 readTimeFormatAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeFormat") ),
1007 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":time-format") ) );
1008 readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Time") ),
1009 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
1010 readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeMin") ),
1011 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
1012 readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeMax") ),
1013 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
1014 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
1015 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) );
1016 if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Repeat") ) ))
1017 readLongAttr( OUSTR("RepeatDelay"),
1018 OUSTR(XMLNS_DIALOGS_PREFIX ":repeat"), true /* force */ );
1019 readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
1020 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":text") ) );
1021 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
1022 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":enforce-format") ) );
1023 readEvents();
1025 //__________________________________________________________________________________________________
1026 void ElementDescriptor::readPatternFieldModel( StyleBag * all_styles )
1027 SAL_THROW( (Exception) )
1029 // collect styles
1030 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
1031 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
1032 aStyle._set |= 0x1;
1033 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
1034 aStyle._set |= 0x2;
1035 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
1036 aStyle._set |= 0x20;
1037 if (readBorderProps( this, aStyle ))
1038 aStyle._set |= 0x4;
1039 if (readFontProps( this, aStyle ))
1040 aStyle._set |= 0x8;
1041 if (aStyle._set)
1043 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
1044 all_styles->getStyleId( aStyle ) );
1047 // collect elements
1048 readDefaults();
1049 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1050 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
1051 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
1052 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
1053 readBoolAttr( OUSTR("HideInactiveSelection"),
1054 OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
1055 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
1056 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) );
1057 readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
1058 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
1059 readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
1060 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
1061 readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EditMask") ),
1062 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":edit-mask") ) );
1063 readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LiteralMask") ),
1064 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":literal-mask") ) );
1065 readEvents();
1067 //__________________________________________________________________________________________________
1068 void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles )
1069 SAL_THROW( (Exception) )
1071 // collect styles
1072 Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 | 0x20 );
1073 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
1074 aStyle._set |= 0x1;
1075 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
1076 aStyle._set |= 0x2;
1077 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
1078 aStyle._set |= 0x20;
1079 if (readBorderProps( this, aStyle ))
1080 aStyle._set |= 0x4;
1081 if (readFontProps( this, aStyle ))
1082 aStyle._set |= 0x8;
1083 if (aStyle._set)
1085 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
1086 all_styles->getStyleId( aStyle ) );
1089 // collect elements
1090 readDefaults();
1091 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1092 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
1093 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
1094 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
1095 readBoolAttr( OUSTR("HideInactiveSelection"),
1096 OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
1097 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
1098 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) );
1099 readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
1100 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":text") ) );
1101 readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1102 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
1103 readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
1104 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
1105 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
1106 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) );
1107 if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Repeat") ) ))
1108 readLongAttr( OUSTR("RepeatDelay"),
1109 OUSTR(XMLNS_DIALOGS_PREFIX ":repeat"), true /* force */ );
1111 Any a( readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveDefault") ) ) );
1112 switch (a.getValueTypeClass())
1114 case TypeClass_DOUBLE:
1115 addAttribute(
1116 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-default") ),
1117 OUString::valueOf( *(double const *)a.getValue() ) );
1118 break;
1119 case TypeClass_STRING:
1120 addAttribute(
1121 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-default") ),
1122 *(OUString const *)a.getValue() );
1123 break;
1124 default:
1125 break;
1127 readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveMin") ),
1128 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
1129 readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveMax") ),
1130 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
1131 readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveValue") ),
1132 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
1134 // format spec
1135 sal_Int32 nKey = 0;
1136 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FormatKey") ) ) >>= nKey)
1138 Reference< util::XNumberFormatsSupplier > xSupplier;
1139 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FormatsSupplier") ) ) >>= xSupplier)
1141 addNumberFormatAttr(
1142 xSupplier->getNumberFormats()->getByKey( nKey ),
1143 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
1146 readBoolAttr(
1147 OUString( RTL_CONSTASCII_USTRINGPARAM("TreatAsNumber") ),
1148 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":treat-as-number") ) );
1149 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
1150 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":enforce-format") ) );
1152 readEvents();
1154 //__________________________________________________________________________________________________
1155 void ElementDescriptor::readFixedLineModel( StyleBag * all_styles )
1156 SAL_THROW( (Exception) )
1158 // collect styles
1159 Style aStyle( 0x2 | 0x8 | 0x20 );
1160 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
1161 aStyle._set |= 0x2;
1162 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
1163 aStyle._set |= 0x20;
1164 if (readFontProps( this, aStyle ))
1165 aStyle._set |= 0x8;
1166 if (aStyle._set)
1168 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
1169 all_styles->getStyleId( aStyle ) );
1172 // collect elements
1173 readDefaults();
1174 readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1175 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
1176 readOrientationAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
1177 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
1178 readEvents();
1180 //__________________________________________________________________________________________________
1181 void ElementDescriptor::readProgressBarModel( StyleBag * all_styles )
1182 SAL_THROW( (Exception) )
1184 // collect styles
1185 Style aStyle( 0x1 | 0x4 | 0x10 );
1186 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
1187 aStyle._set |= 0x1;
1188 if (readBorderProps( this, aStyle ))
1189 aStyle._set |= 0x4;
1190 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FillColor") ) ) >>= aStyle._descr)
1191 aStyle._set |= 0x10;
1192 if (aStyle._set)
1194 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
1195 all_styles->getStyleId( aStyle ) );
1198 // collect elements
1199 readDefaults();
1200 readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ),
1201 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
1202 readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMin") ),
1203 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
1204 readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ),
1205 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
1206 readEvents();
1208 //__________________________________________________________________________________________________
1209 void ElementDescriptor::readScrollBarModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
1210 SAL_THROW( (Exception) )
1212 // collect styles
1213 Style aStyle( 0x1 | 0x4 );
1214 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
1215 aStyle._set |= 0x1;
1216 if (readBorderProps( this, aStyle ))
1217 aStyle._set |= 0x4;
1218 if (aStyle._set)
1220 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
1221 all_styles->getStyleId( aStyle ) );
1224 // collect elements
1225 readDefaults();
1226 readOrientationAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
1227 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
1228 readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("BlockIncrement") ),
1229 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":pageincrement") ) );
1230 readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineIncrement") ),
1231 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":increment") ) );
1232 readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScrollValue") ),
1233 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":curpos") ) );
1234 readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMax") ),
1235 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxpos") ) );
1236 readLongAttr( OUSTR("ScrollValueMin"),
1237 OUSTR(XMLNS_DIALOGS_PREFIX ":minpos") );
1238 readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VisibleSize") ),
1239 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":visible-size") ) );
1240 readLongAttr( OUSTR("RepeatDelay"), OUSTR(XMLNS_DIALOGS_PREFIX ":repeat") );
1241 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1242 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
1243 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LiveScroll") ),
1244 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":live-scroll") ) );
1245 readHexLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
1246 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":symbol-color") ) );
1247 // Cell Range, Ref Cell etc.
1248 lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
1249 readEvents();
1251 //__________________________________________________________________________________________________
1252 void ElementDescriptor::readSpinButtonModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
1253 SAL_THROW( (Exception) )
1255 // collect styles
1256 Style aStyle( 0x1 | 0x4 );
1257 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
1258 aStyle._set |= 0x1;
1259 if (readBorderProps( this, aStyle ))
1260 aStyle._set |= 0x4;
1261 if (aStyle._set)
1263 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
1264 all_styles->getStyleId( aStyle ) );
1267 // collect elements
1268 readDefaults();
1269 readOrientationAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
1270 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
1271 readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinIncrement") ),
1272 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":increment") ) );
1273 readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ),
1274 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":curval") ) );
1275 readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ),
1276 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxval") ) );
1277 readLongAttr( OUSTR("SpinValueMin"),
1278 OUSTR(XMLNS_DIALOGS_PREFIX ":minval") );
1279 readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Repeat") ),
1280 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":repeat") ) );
1281 readLongAttr( OUSTR("RepeatDelay"), OUSTR(XMLNS_DIALOGS_PREFIX ":repeat-delay") );
1282 readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1283 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
1284 readHexLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
1285 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":symbol-color") ) );
1286 // Cell Range, Ref Cell etc.
1287 lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
1288 readEvents();
1290 //__________________________________________________________________________________________________
1291 void ElementDescriptor::readDialogModel( StyleBag * all_styles )
1292 SAL_THROW( (Exception) )
1294 // collect elements
1295 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM("xmlns:" XMLNS_DIALOGS_PREFIX) ),
1296 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_URI) ) );
1297 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM("xmlns:" XMLNS_SCRIPT_PREFIX) ),
1298 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_URI) ) );
1300 // collect styles
1301 Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
1302 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
1303 aStyle._set |= 0x1;
1304 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
1305 aStyle._set |= 0x2;
1306 if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
1307 aStyle._set |= 0x20;
1308 if (readFontProps( this, aStyle ))
1309 aStyle._set |= 0x8;
1310 if (aStyle._set)
1312 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
1313 all_styles->getStyleId( aStyle ) );
1316 // collect elements
1317 readDefaults( false );
1318 readBoolAttr(
1319 OUString( RTL_CONSTASCII_USTRINGPARAM("Closeable") ),
1320 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":closeable") ) );
1321 readBoolAttr(
1322 OUString( RTL_CONSTASCII_USTRINGPARAM("Moveable") ),
1323 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":moveable") ) );
1324 readBoolAttr(
1325 OUString( RTL_CONSTASCII_USTRINGPARAM("Sizeable") ),
1326 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":resizeable") ) );
1327 readStringAttr(
1328 OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ),
1329 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) );
1331 Any aDecorationAny( _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Decoration") ) ) );
1332 bool bDecoration = sal_False;
1333 if ( (aDecorationAny >>= bDecoration) && !bDecoration )
1334 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":withtitlebar") ),
1335 OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) );
1337 readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
1338 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
1340 readEvents();