1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmldlg_export.cxx,v $
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 <rtl/ustrbuf.hxx>
36 #include <tools/diagnose_ex.h>
38 #include <com/sun/star/awt/CharSet.hpp>
39 #include <com/sun/star/awt/FontFamily.hpp>
40 #include <com/sun/star/awt/FontPitch.hpp>
41 #include <com/sun/star/awt/FontSlant.hpp>
42 #include <com/sun/star/awt/FontStrikeout.hpp>
43 #include <com/sun/star/awt/FontType.hpp>
44 #include <com/sun/star/awt/FontUnderline.hpp>
45 #include <com/sun/star/awt/FontWeight.hpp>
46 #include <com/sun/star/awt/FontWidth.hpp>
47 #include <com/sun/star/awt/ImagePosition.hpp>
48 #include <com/sun/star/awt/LineEndFormat.hpp>
49 #include <com/sun/star/awt/PushButtonType.hpp>
50 #include <com/sun/star/awt/VisualEffect.hpp>
52 #include <com/sun/star/script/XScriptEventsSupplier.hpp>
53 #include <com/sun/star/script/ScriptEventDescriptor.hpp>
55 #include <com/sun/star/style/VerticalAlignment.hpp>
57 #include <com/sun/star/lang/XServiceInfo.hpp>
58 #include <com/sun/star/lang/Locale.hpp>
59 #include <com/sun/star/util/NumberFormat.hpp>
61 #include <com/sun/star/view/SelectionType.hpp>
64 using namespace ::com::sun::star
;
65 using namespace ::com::sun::star::uno
;
66 using ::rtl::OUString
;
67 using ::rtl::OUStringBuffer
;
72 //__________________________________________________________________________________________________
73 Reference
< xml::sax::XAttributeList
> Style::createElement()
75 ElementDescriptor
* pStyle
= new ElementDescriptor(
76 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":style") ) );
79 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":style-id") ), _id
);
84 OUStringBuffer
buf( 16 );
85 buf
.append( (sal_Unicode
)'0' );
86 buf
.append( (sal_Unicode
)'x' );
87 buf
.append( OUString::valueOf( (sal_Int64
)(sal_uInt64
)_backgroundColor
, 16 ) );
88 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":background-color") ),
89 buf
.makeStringAndClear() );
95 OUStringBuffer
buf( 16 );
96 buf
.append( (sal_Unicode
)'0' );
97 buf
.append( (sal_Unicode
)'x' );
98 buf
.append( OUString::valueOf( (sal_Int64
)(sal_uInt64
)_textColor
, 16 ) );
99 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":text-color") ),
100 buf
.makeStringAndClear() );
106 OUStringBuffer
buf( 16 );
107 buf
.append( (sal_Unicode
)'0' );
108 buf
.append( (sal_Unicode
)'x' );
109 buf
.append( OUString::valueOf( (sal_Int64
)(sal_uInt64
)_textLineColor
, 16 ) );
110 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":textline-color") ),
111 buf
.makeStringAndClear() );
117 OUStringBuffer
buf( 16 );
118 buf
.append( (sal_Unicode
)'0' );
119 buf
.append( (sal_Unicode
)'x' );
120 buf
.append( OUString::valueOf( (sal_Int64
)(sal_uInt64
)_fillColor
, 16 ) );
121 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":fill-color") ),
122 buf
.makeStringAndClear() );
131 pStyle
->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX
":border"),
135 pStyle
->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX
":border"),
139 pStyle
->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX
":border"),
142 case BORDER_SIMPLE_COLOR
: {
144 buf
.appendAscii( RTL_CONSTASCII_STRINGPARAM("0x") );
145 buf
.append( OUString::valueOf(
146 (sal_Int64
)(sal_uInt64
)_borderColor
, 16 ) );
147 pStyle
->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX
":border"),
148 buf
.makeStringAndClear() );
152 OSL_ENSURE( 0, "### unexpected border value!" );
157 // visual effect (look)
160 switch (_visualEffect
)
162 case awt::VisualEffect::NONE
:
163 pStyle
->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX
":look"),
166 case awt::VisualEffect::LOOK3D
:
167 pStyle
->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX
":look"),
170 case awt::VisualEffect::FLAT
:
171 pStyle
->addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX
":look"),
175 OSL_ENSURE( 0, "### unexpected visual effect value!" );
183 awt::FontDescriptor def_descr
;
185 // dialog:font-name CDATA #IMPLIED
186 if (def_descr
.Name
!= _descr
.Name
)
188 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-name") ),
191 // dialog:font-height %numeric; #IMPLIED
192 if (def_descr
.Height
!= _descr
.Height
)
194 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-height") ),
195 OUString::valueOf( (sal_Int32
)_descr
.Height
) );
197 // dialog:font-width %numeric; #IMPLIED
198 if (def_descr
.Width
!= _descr
.Width
)
200 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-width") ),
201 OUString::valueOf( (sal_Int32
)_descr
.Width
) );
203 // dialog:font-stylename CDATA #IMPLIED
204 if (def_descr
.StyleName
!= _descr
.StyleName
)
206 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-stylename") ),
209 // dialog:font-family "(decorative|modern|roman|script|swiss|system)" #IMPLIED
210 if (def_descr
.Family
!= _descr
.Family
)
212 switch (_descr
.Family
)
214 case awt::FontFamily::DECORATIVE
:
215 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-family") ),
216 OUString( RTL_CONSTASCII_USTRINGPARAM("decorative") ) );
218 case awt::FontFamily::MODERN
:
219 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-family") ),
220 OUString( RTL_CONSTASCII_USTRINGPARAM("modern") ) );
222 case awt::FontFamily::ROMAN
:
223 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-family") ),
224 OUString( RTL_CONSTASCII_USTRINGPARAM("roman") ) );
226 case awt::FontFamily::SCRIPT
:
227 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-family") ),
228 OUString( RTL_CONSTASCII_USTRINGPARAM("script") ) );
230 case awt::FontFamily::SWISS
:
231 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-family") ),
232 OUString( RTL_CONSTASCII_USTRINGPARAM("swiss") ) );
234 case awt::FontFamily::SYSTEM
:
235 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-family") ),
236 OUString( RTL_CONSTASCII_USTRINGPARAM("system") ) );
239 OSL_ENSURE( 0, "### unexpected font-family!" );
243 // dialog:font-charset "(ansi|mac|ibmpc_437|ibmpc_850|ibmpc_860|ibmpc_861|ibmpc_863|ibmpc_865|system|symbol)" #IMPLIED
244 if (def_descr
.CharSet
!= _descr
.CharSet
)
246 switch (_descr
.CharSet
)
248 case awt::CharSet::ANSI
:
249 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-charset") ),
250 OUString( RTL_CONSTASCII_USTRINGPARAM("ansi") ) );
252 case awt::CharSet::MAC
:
253 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-charset") ),
254 OUString( RTL_CONSTASCII_USTRINGPARAM("mac") ) );
256 case awt::CharSet::IBMPC_437
:
257 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-charset") ),
258 OUString( RTL_CONSTASCII_USTRINGPARAM("ibmpc_437") ) );
260 case awt::CharSet::IBMPC_850
:
261 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-charset") ),
262 OUString( RTL_CONSTASCII_USTRINGPARAM("ibmpc_850") ) );
264 case awt::CharSet::IBMPC_860
:
265 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-charset") ),
266 OUString( RTL_CONSTASCII_USTRINGPARAM("ibmpc_860") ) );
268 case awt::CharSet::IBMPC_861
:
269 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-charset") ),
270 OUString( RTL_CONSTASCII_USTRINGPARAM("ibmpc_861") ) );
272 case awt::CharSet::IBMPC_863
:
273 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-charset") ),
274 OUString( RTL_CONSTASCII_USTRINGPARAM("ibmpc_863") ) );
276 case awt::CharSet::IBMPC_865
:
277 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-charset") ),
278 OUString( RTL_CONSTASCII_USTRINGPARAM("ibmpc_865") ) );
280 case awt::CharSet::SYSTEM
:
281 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-charset") ),
282 OUString( RTL_CONSTASCII_USTRINGPARAM("system") ) );
284 case awt::CharSet::SYMBOL
:
285 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-charset") ),
286 OUString( RTL_CONSTASCII_USTRINGPARAM("symbol") ) );
289 OSL_ENSURE( 0, "### unexpected font-charset!" );
293 // dialog:font-pitch "(fixed|variable)" #IMPLIED
294 if (def_descr
.Pitch
!= _descr
.Pitch
)
296 switch (_descr
.Pitch
)
298 case awt::FontPitch::FIXED
:
299 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-pitch") ),
300 OUString( RTL_CONSTASCII_USTRINGPARAM("fixed") ) );
302 case awt::FontPitch::VARIABLE
:
303 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-pitch") ),
304 OUString( RTL_CONSTASCII_USTRINGPARAM("variable") ) );
307 OSL_ENSURE( 0, "### unexpected font-pitch!" );
311 // dialog:font-charwidth CDATA #IMPLIED
312 if (def_descr
.CharacterWidth
!= _descr
.CharacterWidth
)
314 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-charwidth") ),
315 OUString::valueOf( (float)_descr
.CharacterWidth
) );
317 // dialog:font-weight CDATA #IMPLIED
318 if (def_descr
.Weight
!= _descr
.Weight
)
320 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-weight") ),
321 OUString::valueOf( (float)_descr
.Weight
) );
323 // dialog:font-slant "(oblique|italic|reverse_oblique|reverse_italic)" #IMPLIED
324 if (def_descr
.Slant
!= _descr
.Slant
)
326 switch (_descr
.Slant
)
328 case awt::FontSlant_OBLIQUE
:
329 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-slant") ),
330 OUString( RTL_CONSTASCII_USTRINGPARAM("oblique") ) );
332 case awt::FontSlant_ITALIC
:
333 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-slant") ),
334 OUString( RTL_CONSTASCII_USTRINGPARAM("italic") ) );
336 case awt::FontSlant_REVERSE_OBLIQUE
:
337 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-slant") ),
338 OUString( RTL_CONSTASCII_USTRINGPARAM("reverse_oblique") ) );
340 case awt::FontSlant_REVERSE_ITALIC
:
341 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-slant") ),
342 OUString( RTL_CONSTASCII_USTRINGPARAM("reverse_italic") ) );
345 OSL_ENSURE( 0, "### unexpected font-slant!" );
349 // dialog:font-underline "(single|double|dotted|dash|longdash|dashdot|dashdotdot|smallwave|wave|doublewave|bold|bolddotted|bolddash|boldlongdash|bolddashdot|bolddashdotdot|boldwave)" #IMPLIED
350 if (def_descr
.Underline
!= _descr
.Underline
)
352 switch (_descr
.Underline
)
354 case awt::FontUnderline::SINGLE
:
355 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-underline") ),
356 OUString( RTL_CONSTASCII_USTRINGPARAM("single") ) );
358 case awt::FontUnderline::DOUBLE
:
359 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-underline") ),
360 OUString( RTL_CONSTASCII_USTRINGPARAM("double") ) );
362 case awt::FontUnderline::DOTTED
:
363 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-underline") ),
364 OUString( RTL_CONSTASCII_USTRINGPARAM("dotted") ) );
366 case awt::FontUnderline::DASH
:
367 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-underline") ),
368 OUString( RTL_CONSTASCII_USTRINGPARAM("dash") ) );
370 case awt::FontUnderline::LONGDASH
:
371 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-underline") ),
372 OUString( RTL_CONSTASCII_USTRINGPARAM("longdash") ) );
374 case awt::FontUnderline::DASHDOT
:
375 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-underline") ),
376 OUString( RTL_CONSTASCII_USTRINGPARAM("dashdot") ) );
378 case awt::FontUnderline::DASHDOTDOT
:
379 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-underline") ),
380 OUString( RTL_CONSTASCII_USTRINGPARAM("dashdotdot") ) );
382 case awt::FontUnderline::SMALLWAVE
:
383 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-underline") ),
384 OUString( RTL_CONSTASCII_USTRINGPARAM("smallwave") ) );
386 case awt::FontUnderline::WAVE
:
387 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-underline") ),
388 OUString( RTL_CONSTASCII_USTRINGPARAM("wave") ) );
390 case awt::FontUnderline::DOUBLEWAVE
:
391 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-underline") ),
392 OUString( RTL_CONSTASCII_USTRINGPARAM("doublewave") ) );
394 case awt::FontUnderline::BOLD
:
395 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-underline") ),
396 OUString( RTL_CONSTASCII_USTRINGPARAM("bold") ) );
398 case awt::FontUnderline::BOLDDOTTED
:
399 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-underline") ),
400 OUString( RTL_CONSTASCII_USTRINGPARAM("bolddotted") ) );
402 case awt::FontUnderline::BOLDDASH
:
403 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-underline") ),
404 OUString( RTL_CONSTASCII_USTRINGPARAM("bolddash") ) );
406 case awt::FontUnderline::BOLDLONGDASH
:
407 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-underline") ),
408 OUString( RTL_CONSTASCII_USTRINGPARAM("boldlongdash") ) );
410 case awt::FontUnderline::BOLDDASHDOT
:
411 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-underline") ),
412 OUString( RTL_CONSTASCII_USTRINGPARAM("bolddashdot") ) );
414 case awt::FontUnderline::BOLDDASHDOTDOT
:
415 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-underline") ),
416 OUString( RTL_CONSTASCII_USTRINGPARAM("bolddashdotdot") ) );
418 case awt::FontUnderline::BOLDWAVE
:
419 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-underline") ),
420 OUString( RTL_CONSTASCII_USTRINGPARAM("boldwave") ) );
423 OSL_ENSURE( 0, "### unexpected font-underline!" );
427 // dialog:font-strikeout "(single|double|bold|slash|x)" #IMPLIED
428 if (def_descr
.Strikeout
!= _descr
.Strikeout
)
430 switch (_descr
.Strikeout
)
432 case awt::FontStrikeout::SINGLE
:
433 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-strikeout") ),
434 OUString( RTL_CONSTASCII_USTRINGPARAM("single") ) );
436 case awt::FontStrikeout::DOUBLE
:
437 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-strikeout") ),
438 OUString( RTL_CONSTASCII_USTRINGPARAM("double") ) );
440 case awt::FontStrikeout::BOLD
:
441 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-strikeout") ),
442 OUString( RTL_CONSTASCII_USTRINGPARAM("bold") ) );
444 case awt::FontStrikeout::SLASH
:
445 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-strikeout") ),
446 OUString( RTL_CONSTASCII_USTRINGPARAM("slash") ) );
448 case awt::FontStrikeout::X
:
449 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-strikeout") ),
450 OUString( RTL_CONSTASCII_USTRINGPARAM("x") ) );
453 OSL_ENSURE( 0, "### unexpected font-strikeout!" );
457 // dialog:font-orientation CDATA #IMPLIED
458 if (def_descr
.Orientation
!= _descr
.Orientation
)
460 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-orientation") ),
461 OUString::valueOf( (float)_descr
.Orientation
) );
463 // dialog:font-kerning %boolean; #IMPLIED
464 if ((def_descr
.Kerning
!= sal_False
) != (_descr
.Kerning
!= sal_False
))
466 pStyle
->addBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-kerning") ),
469 // dialog:font-wordlinemode %boolean; #IMPLIED
470 if ((def_descr
.WordLineMode
!= sal_False
) != (_descr
.WordLineMode
!= sal_False
))
472 pStyle
->addBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-wordlinemode") ),
473 _descr
.WordLineMode
);
475 // dialog:font-type "(raster|device|scalable)" #IMPLIED
476 if (def_descr
.Type
!= _descr
.Type
)
480 case awt::FontType::RASTER
:
481 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-type") ),
482 OUString( RTL_CONSTASCII_USTRINGPARAM("raster") ) );
484 case awt::FontType::DEVICE
:
485 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-type") ),
486 OUString( RTL_CONSTASCII_USTRINGPARAM("device") ) );
488 case awt::FontType::SCALABLE
:
489 pStyle
->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-type") ),
490 OUString( RTL_CONSTASCII_USTRINGPARAM("scalable") ) );
493 OSL_ENSURE( 0, "### unexpected font-type!" );
498 // additional attributes not in FontDescriptor struct
499 // dialog:font-relief (none|embossed|engraved) #IMPLIED
502 case awt::FontRelief::NONE
: // dont export default
504 case awt::FontRelief::EMBOSSED
:
505 pStyle
->addAttribute(
506 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-relief") ),
507 OUString( RTL_CONSTASCII_USTRINGPARAM("embossed") ) );
509 case awt::FontRelief::ENGRAVED
:
510 pStyle
->addAttribute(
511 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-relief") ),
512 OUString( RTL_CONSTASCII_USTRINGPARAM("engraved") ) );
515 OSL_ENSURE( 0, "### unexpected font-relief!" );
518 // dialog:font-emphasismark (none|dot|circle|disc|accent|above|below) #IMPLIED
519 switch (_fontEmphasisMark
)
521 case awt::FontEmphasisMark::NONE
: // dont export default
523 case awt::FontEmphasisMark::DOT
:
524 pStyle
->addAttribute(
525 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-emphasismark") ),
526 OUString( RTL_CONSTASCII_USTRINGPARAM("dot") ) );
528 case awt::FontEmphasisMark::CIRCLE
:
529 pStyle
->addAttribute(
530 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-emphasismark") ),
531 OUString( RTL_CONSTASCII_USTRINGPARAM("circle") ) );
533 case awt::FontEmphasisMark::DISC
:
534 pStyle
->addAttribute(
535 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-emphasismark") ),
536 OUString( RTL_CONSTASCII_USTRINGPARAM("disc") ) );
538 case awt::FontEmphasisMark::ACCENT
:
539 pStyle
->addAttribute(
540 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-emphasismark") ),
541 OUString( RTL_CONSTASCII_USTRINGPARAM("accent") ) );
543 case awt::FontEmphasisMark::ABOVE
:
544 pStyle
->addAttribute(
545 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-emphasismark") ),
546 OUString( RTL_CONSTASCII_USTRINGPARAM("above") ) );
548 case awt::FontEmphasisMark::BELOW
:
549 pStyle
->addAttribute(
550 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":font-emphasismark") ),
551 OUString( RTL_CONSTASCII_USTRINGPARAM("below") ) );
554 OSL_ENSURE( 0, "### unexpected font-emphasismark!" );
562 //##################################################################################################
564 //__________________________________________________________________________________________________
565 void ElementDescriptor::addNumberFormatAttr(
566 Reference
< beans::XPropertySet
> const & xFormatProperties
,
567 OUString
const & /*rAttrName*/ )
569 Reference
< beans::XPropertyState
> xState( xFormatProperties
, UNO_QUERY
);
572 OSL_VERIFY( xFormatProperties
->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("FormatString") ) ) >>= sFormat
);
573 OSL_VERIFY( xFormatProperties
->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Locale") ) ) >>= locale
);
576 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":format-code") ),
580 OUStringBuffer
buf( 48 );
581 buf
.append( locale
.Language
);
582 if (locale
.Country
.getLength())
584 buf
.append( (sal_Unicode
)';' );
585 buf
.append( locale
.Country
);
586 if (locale
.Variant
.getLength())
588 buf
.append( (sal_Unicode
)';' );
589 buf
.append( locale
.Variant
);
593 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":format-locale") ),
594 buf
.makeStringAndClear() );
596 //__________________________________________________________________________________________________
597 Any
ElementDescriptor::readProp( OUString
const & rPropName
)
599 if (beans::PropertyState_DEFAULT_VALUE
!= _xPropState
->getPropertyState( rPropName
))
601 return _xProps
->getPropertyValue( rPropName
);
606 //______________________________________________________________________________
607 void ElementDescriptor::readStringAttr(
608 OUString
const & rPropName
, OUString
const & rAttrName
)
610 if (beans::PropertyState_DEFAULT_VALUE
!=
611 _xPropState
->getPropertyState( rPropName
))
613 Any
a( _xProps
->getPropertyValue( rPropName
) );
616 addAttribute( rAttrName
, v
);
618 OSL_ENSURE( 0, "### unexpected property type!" );
622 //__________________________________________________________________________________________________
623 void ElementDescriptor::readHexLongAttr( OUString
const & rPropName
, OUString
const & rAttrName
)
625 if (beans::PropertyState_DEFAULT_VALUE
!= _xPropState
->getPropertyState( rPropName
))
627 Any
a( _xProps
->getPropertyValue( rPropName
) );
628 if (a
.getValueTypeClass() == TypeClass_LONG
)
630 OUStringBuffer
buf( 16 );
631 buf
.append( (sal_Unicode
)'0' );
632 buf
.append( (sal_Unicode
)'x' );
633 buf
.append( OUString::valueOf( (sal_Int64
)(sal_uInt64
)*(sal_uInt32
*)a
.getValue(), 16 ) );
634 addAttribute( rAttrName
, buf
.makeStringAndClear() );
639 //__________________________________________________________________________________________________
640 void ElementDescriptor::readDateFormatAttr( OUString
const & rPropName
, OUString
const & rAttrName
)
642 if (beans::PropertyState_DEFAULT_VALUE
!= _xPropState
->getPropertyState( rPropName
))
644 Any
a( _xProps
->getPropertyValue( rPropName
) );
645 if (a
.getValueTypeClass() == TypeClass_SHORT
)
647 switch (*(sal_Int16
const *)a
.getValue())
650 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("system_short") ) );
653 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("system_short_YY") ) );
656 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("system_short_YYYY") ) );
659 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("system_long") ) );
662 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("short_DDMMYY") ) );
665 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("short_MMDDYY") ) );
668 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("short_YYMMDD") ) );
671 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("short_DDMMYYYY") ) );
674 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("short_MMDDYYYY") ) );
677 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("short_YYYYMMDD") ) );
680 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("short_YYMMDD_DIN5008") ) );
683 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("short_YYYYMMDD_DIN5008") ) );
686 OSL_ENSURE( 0, "### unexpected date format!" );
692 //__________________________________________________________________________________________________
693 void ElementDescriptor::readTimeFormatAttr( OUString
const & rPropName
, OUString
const & rAttrName
)
695 if (beans::PropertyState_DEFAULT_VALUE
!= _xPropState
->getPropertyState( rPropName
))
697 Any
a( _xProps
->getPropertyValue( rPropName
) );
698 if (a
.getValueTypeClass() == TypeClass_SHORT
)
700 switch (*(sal_Int16
const *)a
.getValue())
703 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("24h_short") ) );
706 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("24h_long") ) );
709 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("12h_short") ) );
712 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("12h_long") ) );
715 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("Duration_short") ) );
718 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("Duration_long") ) );
721 OSL_ENSURE( 0, "### unexpected time format!" );
727 //__________________________________________________________________________________________________
728 void ElementDescriptor::readAlignAttr( OUString
const & rPropName
, OUString
const & rAttrName
)
730 if (beans::PropertyState_DEFAULT_VALUE
!= _xPropState
->getPropertyState( rPropName
))
732 Any
a( _xProps
->getPropertyValue( rPropName
) );
733 if (a
.getValueTypeClass() == TypeClass_SHORT
)
735 switch (*(sal_Int16
const *)a
.getValue())
738 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("left") ) );
741 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("center") ) );
744 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("right") ) );
747 OSL_ENSURE( 0, "### illegal alignment value!" );
753 //__________________________________________________________________________________________________
754 void ElementDescriptor::readVerticalAlignAttr( OUString
const & rPropName
, OUString
const & rAttrName
)
756 if (beans::PropertyState_DEFAULT_VALUE
!= _xPropState
->getPropertyState( rPropName
))
758 Any
a( _xProps
->getPropertyValue( rPropName
) );
759 if (a
.getValueTypeClass() == TypeClass_ENUM
&& a
.getValueType() == ::getCppuType( (style::VerticalAlignment
*)0 ))
761 style::VerticalAlignment eAlign
;
765 case style::VerticalAlignment_TOP
:
766 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("top") ) );
768 case style::VerticalAlignment_MIDDLE
:
769 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("center") ) );
771 case style::VerticalAlignment_BOTTOM
:
772 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("bottom") ) );
775 OSL_ENSURE( 0, "### illegal vertical alignment value!" );
781 //__________________________________________________________________________________________________
782 void ElementDescriptor::readImageAlignAttr( OUString
const & rPropName
, OUString
const & rAttrName
)
784 if (beans::PropertyState_DEFAULT_VALUE
!= _xPropState
->getPropertyState( rPropName
))
786 Any
a( _xProps
->getPropertyValue( rPropName
) );
787 if (a
.getValueTypeClass() == TypeClass_SHORT
)
789 switch (*(sal_Int16
const *)a
.getValue())
792 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("left") ) );
795 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("top") ) );
798 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("right") ) );
801 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("bottom") ) );
804 OSL_ENSURE( 0, "### illegal image alignment value!" );
810 //__________________________________________________________________________________________________
811 void ElementDescriptor::readImagePositionAttr( OUString
const & rPropName
, OUString
const & rAttrName
)
813 if (beans::PropertyState_DEFAULT_VALUE
!= _xPropState
->getPropertyState( rPropName
))
815 Any
a( _xProps
->getPropertyValue( rPropName
) );
816 if (a
.getValueTypeClass() == TypeClass_SHORT
)
818 switch (*(sal_Int16
const *)a
.getValue())
820 case awt::ImagePosition::LeftTop
:
821 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("left-top") ) );
823 case awt::ImagePosition::LeftCenter
:
824 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("left-center") ) );
826 case awt::ImagePosition::LeftBottom
:
827 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("left-bottom") ) );
829 case awt::ImagePosition::RightTop
:
830 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("right-top") ) );
832 case awt::ImagePosition::RightCenter
:
833 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("right-center") ) );
835 case awt::ImagePosition::RightBottom
:
836 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("right-bottom") ) );
838 case awt::ImagePosition::AboveLeft
:
839 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("top-left") ) );
841 case awt::ImagePosition::AboveCenter
:
842 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("top-center") ) );
844 case awt::ImagePosition::AboveRight
:
845 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("top-right") ) );
847 case awt::ImagePosition::BelowLeft
:
848 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("bottom-left") ) );
850 case awt::ImagePosition::BelowCenter
:
851 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("bottom-center") ) );
853 case awt::ImagePosition::BelowRight
:
854 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("bottom-right") ) );
856 case awt::ImagePosition::Centered
:
857 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("center") ) );
860 OSL_ENSURE( 0, "### illegal image position value!" );
866 //__________________________________________________________________________________________________
867 void ElementDescriptor::readButtonTypeAttr( OUString
const & rPropName
, OUString
const & rAttrName
)
869 if (beans::PropertyState_DEFAULT_VALUE
!= _xPropState
->getPropertyState( rPropName
))
871 Any
a( _xProps
->getPropertyValue( rPropName
) );
872 if (a
.getValueTypeClass() == TypeClass_SHORT
)
874 switch (*(sal_Int16
const *)a
.getValue())
876 case awt::PushButtonType_STANDARD
:
877 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("standard") ) );
879 case awt::PushButtonType_OK
:
880 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("ok") ) );
882 case awt::PushButtonType_CANCEL
:
883 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("cancel") ) );
885 case awt::PushButtonType_HELP
:
886 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("help") ) );
889 OSL_ENSURE( 0, "### illegal button-type value!" );
895 //__________________________________________________________________________________________________
896 void ElementDescriptor::readOrientationAttr( OUString
const & rPropName
, OUString
const & rAttrName
)
898 if (beans::PropertyState_DEFAULT_VALUE
!= _xPropState
->getPropertyState( rPropName
))
900 Any
a( _xProps
->getPropertyValue( rPropName
) );
901 if (a
.getValueTypeClass() == TypeClass_LONG
)
903 switch (*(sal_Int32
const *)a
.getValue())
906 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("horizontal") ) );
909 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("vertical") ) );
912 OSL_ENSURE( 0, "### illegal orientation value!" );
918 //__________________________________________________________________________________________________
919 void ElementDescriptor::readLineEndFormatAttr( OUString
const & rPropName
, OUString
const & rAttrName
)
921 if (beans::PropertyState_DEFAULT_VALUE
!= _xPropState
->getPropertyState( rPropName
))
923 Any
a( _xProps
->getPropertyValue( rPropName
) );
924 if (a
.getValueTypeClass() == TypeClass_SHORT
)
926 switch (*(sal_Int16
const *)a
.getValue())
928 case awt::LineEndFormat::CARRIAGE_RETURN
:
929 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("carriage-return") ) );
931 case awt::LineEndFormat::LINE_FEED
:
932 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("line-feed") ) );
934 case awt::LineEndFormat::CARRIAGE_RETURN_LINE_FEED
:
935 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("carriage-return-line-feed") ) );
938 OSL_ENSURE( 0, "### illegal line end format value!" );
944 //__________________________________________________________________________________________________
945 void ElementDescriptor::readSelectionTypeAttr( OUString
const & rPropName
, OUString
const & rAttrName
)
947 if (beans::PropertyState_DEFAULT_VALUE
!= _xPropState
->getPropertyState( rPropName
))
949 Any
aSelectionType ( _xProps
->getPropertyValue( rPropName
) );
951 if (aSelectionType
.getValueTypeClass() == TypeClass_ENUM
&& aSelectionType
.getValueType() == ::getCppuType( (::view::SelectionType
*)0 ))
953 ::view::SelectionType eSelectionType
;
954 aSelectionType
>>= eSelectionType
;
956 switch (eSelectionType
)
958 case ::view::SelectionType_NONE
:
959 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("none") ) );
961 case ::view::SelectionType_SINGLE
:
962 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("single") ) );
964 case ::view::SelectionType_MULTI
:
965 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("multi") ) );
967 case ::view::SelectionType_RANGE
:
968 addAttribute( rAttrName
, OUString( RTL_CONSTASCII_USTRINGPARAM("range") ) );
971 OSL_ENSURE( 0, "### illegal selection type value!" );
977 //__________________________________________________________________________________________________
978 void ElementDescriptor::readDefaults( bool supportPrintable
)
980 Any
a( _xProps
->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) );
981 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":id") ),
982 * reinterpret_cast< const OUString
* >( a
.getValue() ) );
983 readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("TabIndex") ),
984 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":tab-index") ) );
986 sal_Bool bEnabled
= sal_False
;
987 if (_xProps
->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Enabled") ) ) >>= bEnabled
)
991 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":disabled") ),
992 OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) );
997 OSL_ENSURE( 0, "unexpected property type for \"Enabled\": not bool!" );
1000 sal_Bool bVisible
= sal_True
;
1003 if (_xProps
->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("EnableVisible") ) ) >>= bVisible
)
1006 // only write out the non default case
1009 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":visible") ),
1010 OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) );
1016 DBG_UNHANDLED_EXCEPTION();
1018 // force writing of pos/size
1019 a
= _xProps
->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("PositionX") ) );
1020 if (a
.getValueTypeClass() == TypeClass_LONG
)
1022 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":left") ),
1023 OUString::valueOf( *(sal_Int32
const *)a
.getValue() ) );
1025 a
= _xProps
->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("PositionY") ) );
1026 if (a
.getValueTypeClass() == TypeClass_LONG
)
1028 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":top") ),
1029 OUString::valueOf( *(sal_Int32
const *)a
.getValue() ) );
1031 a
= _xProps
->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ) );
1032 if (a
.getValueTypeClass() == TypeClass_LONG
)
1034 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":width") ),
1035 OUString::valueOf( *(sal_Int32
const *)a
.getValue() ) );
1037 a
= _xProps
->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ) );
1038 if (a
.getValueTypeClass() == TypeClass_LONG
)
1040 addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":height") ),
1041 OUString::valueOf( *(sal_Int32
const *)a
.getValue() ) );
1044 if (supportPrintable
)
1047 OUString( RTL_CONSTASCII_USTRINGPARAM("Printable") ),
1048 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":printable") ) );
1050 readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Step") ),
1051 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":page") ) );
1052 readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tag") ),
1053 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":tag") ) );
1054 readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("HelpText") ),
1055 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":help-text") ) );
1056 readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("HelpURL") ),
1057 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":help-url") ) );
1063 char const * second
;
1066 extern StringTriple
const * const g_pEventTranslations
;
1068 //__________________________________________________________________________________________________
1069 void ElementDescriptor::readEvents()
1070 SAL_THROW( (Exception
) )
1072 Reference
< script::XScriptEventsSupplier
> xSupplier( _xProps
, UNO_QUERY
);
1075 Reference
< container::XNameContainer
> xEvents( xSupplier
->getEvents() );
1078 Sequence
< OUString
> aNames( xEvents
->getElementNames() );
1079 OUString
const * pNames
= aNames
.getConstArray();
1080 for ( sal_Int32 nPos
= 0; nPos
< aNames
.getLength(); ++nPos
)
1082 script::ScriptEventDescriptor descr
;
1083 if (xEvents
->getByName( pNames
[ nPos
] ) >>= descr
)
1085 OSL_ENSURE( descr
.ListenerType
.getLength() > 0 &&
1086 descr
.EventMethod
.getLength() > 0 &&
1087 descr
.ScriptCode
.getLength() > 0 &&
1088 descr
.ScriptType
.getLength() > 0,
1089 "### invalid event descr!" );
1091 OUString aEventName
;
1093 if (! descr
.AddListenerParam
.getLength())
1095 // detection of event-name
1096 ::rtl::OString
listenerType(
1097 ::rtl::OUStringToOString(
1099 RTL_TEXTENCODING_ASCII_US
) );
1100 ::rtl::OString
eventMethod(
1101 ::rtl::OUStringToOString(
1103 RTL_TEXTENCODING_ASCII_US
) );
1104 StringTriple
const * p
= g_pEventTranslations
;
1107 if (0 == ::rtl_str_compare( p
->second
, eventMethod
.getStr() ) &&
1108 0 == ::rtl_str_compare( p
->first
, listenerType
.getStr() ))
1110 aEventName
= OUString( p
->third
, ::rtl_str_getLength( p
->third
), RTL_TEXTENCODING_ASCII_US
);
1117 ElementDescriptor
* pElem
;
1118 Reference
< xml::sax::XAttributeList
> xElem
;
1120 if (aEventName
.getLength()) // script:event
1122 pElem
= new ElementDescriptor(
1123 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX
":event") ) );
1126 pElem
->addAttribute(
1127 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX
":event-name") ),
1130 else // script:listener-event
1132 pElem
= new ElementDescriptor(
1133 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX
":listener-event") ) );
1136 pElem
->addAttribute(
1137 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX
":listener-type") ),
1138 descr
.ListenerType
);
1139 pElem
->addAttribute(
1140 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX
":listener-method") ),
1141 descr
.EventMethod
);
1143 if (descr
.AddListenerParam
.getLength())
1145 pElem
->addAttribute(
1146 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX
":listener-param") ),
1147 descr
.AddListenerParam
);
1150 if ( descr
.ScriptType
.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( "StarBasic" ) ) ) )
1152 // separate optional location
1153 sal_Int32 nIndex
= descr
.ScriptCode
.indexOf( (sal_Unicode
)':' );
1156 pElem
->addAttribute(
1157 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX
":location") ),
1158 descr
.ScriptCode
.copy( 0, nIndex
) );
1159 pElem
->addAttribute(
1160 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX
":macro-name") ),
1161 descr
.ScriptCode
.copy( nIndex
+1 ) );
1165 pElem
->addAttribute(
1166 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX
":macro-name") ),
1172 pElem
->addAttribute(
1173 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX
":macro-name") ),
1178 pElem
->addAttribute(
1179 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_PREFIX
":language") ),
1182 addSubElement( xElem
);
1186 OSL_ENSURE( 0, "### unexpected event type in container!" );
1193 //##################################################################################################
1195 inline bool equalFont( Style
const & style1
, Style
const & style2
)
1197 awt::FontDescriptor
const & f1
= style1
._descr
;
1198 awt::FontDescriptor
const & f2
= style2
._descr
;
1200 f1
.Name
== f2
.Name
&&
1201 f1
.Height
== f2
.Height
&&
1202 f1
.Width
== f2
.Width
&&
1203 f1
.StyleName
== f2
.StyleName
&&
1204 f1
.Family
== f2
.Family
&&
1205 f1
.CharSet
== f2
.CharSet
&&
1206 f1
.Pitch
== f2
.CharSet
&&
1207 f1
.CharacterWidth
== f2
.CharacterWidth
&&
1208 f1
.Weight
== f2
.Weight
&&
1209 f1
.Slant
== f2
.Slant
&&
1210 f1
.Underline
== f2
.Underline
&&
1211 f1
.Strikeout
== f2
.Strikeout
&&
1212 f1
.Orientation
== f2
.Orientation
&&
1213 (f1
.Kerning
!= sal_False
) == (f2
.Kerning
!= sal_False
) &&
1214 (f1
.WordLineMode
!= sal_False
) == (f2
.WordLineMode
!= sal_False
) &&
1215 f1
.Type
== f2
.Type
&&
1216 style1
._fontRelief
== style2
._fontRelief
&&
1217 style1
._fontEmphasisMark
== style2
._fontEmphasisMark
1220 //__________________________________________________________________________________________________
1221 OUString
StyleBag::getStyleId( Style
const & rStyle
)
1224 if (! rStyle
._set
) // nothin set
1226 return OUString(); // everything default: no need to export a specific style
1229 // lookup existing style
1230 for ( size_t nStylesPos
= 0; nStylesPos
< _styles
.size(); ++nStylesPos
)
1232 Style
* pStyle
= _styles
[ nStylesPos
];
1234 short demanded_defaults
= ~rStyle
._set
& rStyle
._all
;
1235 // test, if defaults are not set
1236 if ((~pStyle
->_set
& demanded_defaults
) == demanded_defaults
&&
1237 (rStyle
._set
& (pStyle
->_all
& ~pStyle
->_set
)) == 0)
1239 short bset
= rStyle
._set
& pStyle
->_set
;
1241 rStyle
._backgroundColor
!= pStyle
->_backgroundColor
)
1244 rStyle
._textColor
!= pStyle
->_textColor
)
1246 if ((bset
& 0x20) &&
1247 rStyle
._textLineColor
!= pStyle
->_textLineColor
)
1249 if ((bset
& 0x10) &&
1250 rStyle
._fillColor
!= pStyle
->_fillColor
)
1253 (rStyle
._border
!= pStyle
->_border
||
1254 (rStyle
._border
== BORDER_SIMPLE_COLOR
&&
1255 rStyle
._borderColor
!= pStyle
->_borderColor
)))
1258 !equalFont( rStyle
, *pStyle
))
1260 if ((bset
& 0x40) &&
1261 rStyle
._visualEffect
!= pStyle
->_visualEffect
)
1265 short bnset
= rStyle
._set
& ~pStyle
->_set
;
1267 pStyle
->_backgroundColor
= rStyle
._backgroundColor
;
1269 pStyle
->_textColor
= rStyle
._textColor
;
1271 pStyle
->_textLineColor
= rStyle
._textLineColor
;
1273 pStyle
->_fillColor
= rStyle
._fillColor
;
1275 pStyle
->_border
= rStyle
._border
;
1276 pStyle
->_borderColor
= rStyle
._borderColor
;
1279 pStyle
->_descr
= rStyle
._descr
;
1280 pStyle
->_fontRelief
= rStyle
._fontRelief
;
1281 pStyle
->_fontEmphasisMark
= rStyle
._fontEmphasisMark
;
1284 pStyle
->_visualEffect
= rStyle
._visualEffect
;
1286 pStyle
->_all
|= rStyle
._all
;
1287 pStyle
->_set
|= rStyle
._set
;
1293 // no appr style found, append new
1294 Style
* pStyle
= new Style( rStyle
);
1295 pStyle
->_id
= OUString::valueOf( (sal_Int32
)_styles
.size() );
1296 _styles
.push_back( pStyle
);
1299 //__________________________________________________________________________________________________
1300 StyleBag::~StyleBag() SAL_THROW( () )
1302 for ( size_t nPos
= 0; nPos
< _styles
.size(); ++nPos
)
1304 delete _styles
[ nPos
];
1307 //__________________________________________________________________________________________________
1308 void StyleBag::dump( Reference
< xml::sax::XExtendedDocumentHandler
> const & xOut
)
1310 if (! _styles
.empty())
1312 OUString
aStylesName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":styles") );
1313 xOut
->ignorableWhitespace( OUString() );
1314 xOut
->startElement( aStylesName
, Reference
< xml::sax::XAttributeList
>() );
1316 for ( size_t nPos
= 0; nPos
< _styles
.size(); ++nPos
)
1318 Reference
< xml::sax::XAttributeList
> xAttr( _styles
[ nPos
]->createElement() );
1319 static_cast< ElementDescriptor
* >( xAttr
.get() )->dump( xOut
.get() );
1321 xOut
->ignorableWhitespace( OUString() );
1322 xOut
->endElement( aStylesName
);
1326 //##################################################################################################
1328 //==================================================================================================
1329 void SAL_CALL
exportDialogModel(
1330 Reference
< xml::sax::XExtendedDocumentHandler
> const & xOut
,
1331 Reference
< container::XNameContainer
> const & xDialogModel
,
1332 Reference
< frame::XModel
> const & xDocument
)
1333 SAL_THROW( (Exception
) )
1335 StyleBag all_styles
;
1336 ::std::vector
< Reference
< xml::sax::XAttributeList
> > all_elements
;
1338 // read out all props
1340 Sequence
< OUString
> aElements( xDialogModel
->getElementNames() );
1341 OUString
const * pElements
= aElements
.getConstArray();
1343 ElementDescriptor
* pRadioGroup
= 0;
1346 for ( nPos
= 0; nPos
< aElements
.getLength(); ++nPos
)
1348 Any
aControlModel( xDialogModel
->getByName( pElements
[ nPos
] ) );
1349 Reference
< beans::XPropertySet
> xProps
;
1350 OSL_VERIFY( aControlModel
>>= xProps
);
1353 Reference
< beans::XPropertyState
> xPropState( xProps
, UNO_QUERY
);
1354 OSL_ENSURE( xPropState
.is(), "no XPropertyState!" );
1355 if (! xPropState
.is())
1357 Reference
< lang::XServiceInfo
> xServiceInfo( xProps
, UNO_QUERY
);
1358 OSL_ENSURE( xServiceInfo
.is(), "no XServiceInfo!" );
1359 if (! xServiceInfo
.is())
1362 ElementDescriptor
* pElem
= 0;
1363 Reference
< xml::sax::XAttributeList
> xElem
;
1365 // group up radio buttons
1366 if ( xServiceInfo
->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ) )
1368 if (! pRadioGroup
) // open radiogroup
1370 pRadioGroup
= new ElementDescriptor(
1372 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":radiogroup") ) );
1373 all_elements
.push_back( pRadioGroup
);
1376 pElem
= new ElementDescriptor(
1378 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":radio") ) );
1379 xElem
= static_cast< xml::sax::XAttributeList
* >( pElem
);
1380 pElem
->readRadioButtonModel( &all_styles
, xDocument
);
1381 pRadioGroup
->addSubElement( xElem
);
1385 pRadioGroup
= 0; // close radiogroup
1387 if (xServiceInfo
->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) ) )
1389 pElem
= new ElementDescriptor(
1391 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":button") ) );
1392 xElem
= static_cast< xml::sax::XAttributeList
* >( pElem
);
1393 pElem
->readButtonModel( &all_styles
);
1395 else if (xServiceInfo
->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) ) )
1397 pElem
= new ElementDescriptor(
1399 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":checkbox") ) );
1400 xElem
= static_cast< xml::sax::XAttributeList
* >( pElem
);
1401 pElem
->readCheckBoxModel( &all_styles
);
1403 else if (xServiceInfo
->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ) )
1405 pElem
= new ElementDescriptor(
1407 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":combobox") ) );
1408 xElem
= static_cast< xml::sax::XAttributeList
* >( pElem
);
1409 pElem
->readComboBoxModel( &all_styles
, xDocument
);
1411 else if (xServiceInfo
->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) )
1413 pElem
= new ElementDescriptor(
1415 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":menulist") ) );
1416 xElem
= static_cast< xml::sax::XAttributeList
* >( pElem
);
1417 pElem
->readListBoxModel( &all_styles
, xDocument
);
1419 else if (xServiceInfo
->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) )
1421 pElem
= new ElementDescriptor(
1423 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":titledbox") ) );
1424 xElem
= static_cast< xml::sax::XAttributeList
* >( pElem
);
1425 pElem
->readGroupBoxModel( &all_styles
);
1427 else if (xServiceInfo
->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ) )
1429 pElem
= new ElementDescriptor(
1431 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":multipage") ) );
1432 xElem
= static_cast< xml::sax::XAttributeList
* >( pElem
);
1433 pElem
->readMultiPageModel( &all_styles
);
1435 else if (xServiceInfo
->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) )
1437 pElem
= new ElementDescriptor(
1439 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":text") ) );
1440 xElem
= static_cast< xml::sax::XAttributeList
* >( pElem
);
1441 pElem
->readFixedTextModel( &all_styles
);
1443 else if (xServiceInfo
->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) ) )
1445 pElem
= new ElementDescriptor(
1447 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":textfield") ) );
1448 xElem
= static_cast< xml::sax::XAttributeList
* >( pElem
);
1449 pElem
->readEditModel( &all_styles
);
1452 else if (xServiceInfo
->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedHyperlinkModel") ) ) )
1454 pElem
= new ElementDescriptor(
1456 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":linklabel") ) );
1457 xElem
= static_cast< xml::sax::XAttributeList
* >( pElem
);
1458 pElem
->readFixedHyperLinkModel( &all_styles
);
1460 else if (xServiceInfo
->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) ) )
1462 pElem
= new ElementDescriptor(
1464 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":img") ) );
1465 xElem
= static_cast< xml::sax::XAttributeList
* >( pElem
);
1466 pElem
->readImageControlModel( &all_styles
, xDocument
);
1468 else if (xServiceInfo
->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFileControlModel") ) ) )
1470 pElem
= new ElementDescriptor(
1472 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":filecontrol") ) );
1473 xElem
= static_cast< xml::sax::XAttributeList
* >( pElem
);
1474 pElem
->readFileControlModel( &all_styles
);
1476 else if (xServiceInfo
->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.tree.TreeControlModel") ) ) )
1478 pElem
= new ElementDescriptor(
1480 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":treecontrol") ) );
1481 xElem
= static_cast< xml::sax::XAttributeList
* >( pElem
);
1482 pElem
->readTreeControlModel( &all_styles
);
1484 else if (xServiceInfo
->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCurrencyFieldModel") ) ) )
1486 pElem
= new ElementDescriptor(
1488 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":currencyfield") ) );
1489 xElem
= static_cast< xml::sax::XAttributeList
* >( pElem
);
1490 pElem
->readCurrencyFieldModel( &all_styles
);
1492 else if (xServiceInfo
->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDateFieldModel") ) ) )
1494 pElem
= new ElementDescriptor(
1496 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":datefield") ) );
1497 xElem
= static_cast< xml::sax::XAttributeList
* >( pElem
);
1498 pElem
->readDateFieldModel( &all_styles
);
1500 else if (xServiceInfo
->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlNumericFieldModel") ) ) )
1502 pElem
= new ElementDescriptor(
1504 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":numericfield") ) );
1505 xElem
= static_cast< xml::sax::XAttributeList
* >( pElem
);
1506 pElem
->readNumericFieldModel( &all_styles
);
1508 else if (xServiceInfo
->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlTimeFieldModel") ) ) )
1510 pElem
= new ElementDescriptor(
1512 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":timefield") ) );
1513 xElem
= static_cast< xml::sax::XAttributeList
* >( pElem
);
1514 pElem
->readTimeFieldModel( &all_styles
);
1516 else if (xServiceInfo
->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlPatternFieldModel") ) ) )
1518 pElem
= new ElementDescriptor(
1520 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":patternfield") ) );
1521 xElem
= static_cast< xml::sax::XAttributeList
* >( pElem
);
1522 pElem
->readPatternFieldModel( &all_styles
);
1524 else if (xServiceInfo
->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFormattedFieldModel") ) ) )
1526 pElem
= new ElementDescriptor(
1528 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":formattedfield") ) );
1529 xElem
= static_cast< xml::sax::XAttributeList
* >( pElem
);
1530 pElem
->readFormattedFieldModel( &all_styles
);
1532 else if (xServiceInfo
->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel") ) ) )
1534 pElem
= new ElementDescriptor(
1536 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":fixedline") ) );
1537 xElem
= static_cast< xml::sax::XAttributeList
* >( pElem
);
1538 pElem
->readFixedLineModel( &all_styles
);
1540 else if (xServiceInfo
->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ) )
1542 pElem
= new ElementDescriptor(
1544 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":scrollbar") ) );
1545 xElem
= static_cast< xml::sax::XAttributeList
* >( pElem
);
1546 pElem
->readScrollBarModel( &all_styles
, xDocument
);
1548 else if (xServiceInfo
->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) ) )
1550 pElem
= new ElementDescriptor(
1552 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":spinbutton") ) );
1553 xElem
= static_cast< xml::sax::XAttributeList
* >( pElem
);
1554 pElem
->readSpinButtonModel( &all_styles
, xDocument
);
1556 else if (xServiceInfo
->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) )
1558 pElem
= new ElementDescriptor(
1560 OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":progressmeter") ) );
1561 xElem
= static_cast< xml::sax::XAttributeList
* >( pElem
);
1562 pElem
->readProgressBarModel( &all_styles
);
1566 OSL_ASSERT( xElem
.is() );
1569 all_elements
.push_back( xElem
);
1573 OSL_ENSURE( sal_False
, "unknown control type!" );
1579 xOut
->startDocument();
1581 OUString
aDocTypeStr( RTL_CONSTASCII_USTRINGPARAM(
1582 "<!DOCTYPE dlg:window PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\""
1583 " \"dialog.dtd\">" ) );
1584 xOut
->unknown( aDocTypeStr
);
1585 xOut
->ignorableWhitespace( OUString() );
1588 Reference
< beans::XPropertySet
> xProps( xDialogModel
, UNO_QUERY
);
1589 OSL_ASSERT( xProps
.is() );
1590 Reference
< beans::XPropertyState
> xPropState( xProps
, UNO_QUERY
);
1591 OSL_ASSERT( xPropState
.is() );
1593 OUString
aWindowName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":window") );
1594 ElementDescriptor
* pWindow
= new ElementDescriptor( xProps
, xPropState
, aWindowName
);
1595 Reference
< xml::sax::XAttributeList
> xWindow( pWindow
);
1596 pWindow
->readDialogModel( &all_styles
);
1597 xOut
->ignorableWhitespace( OUString() );
1598 xOut
->startElement( aWindowName
, xWindow
);
1600 pWindow
->dumpSubElements( xOut
.get() );
1601 // dump out stylebag
1602 all_styles
.dump( xOut
);
1604 if (! all_elements
.empty())
1606 // open up bulletinboard
1607 OUString
aBBoardName( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX
":bulletinboard") );
1608 xOut
->ignorableWhitespace( OUString() );
1609 xOut
->startElement( aBBoardName
, Reference
< xml::sax::XAttributeList
>() );
1611 // export control elements
1612 for ( std::size_t n
= 0; n
< all_elements
.size(); ++n
)
1614 ElementDescriptor
* pElem
= static_cast< ElementDescriptor
* >( all_elements
[ n
].get() );
1615 pElem
->dump( xOut
.get() );
1618 // end bulletinboard
1619 xOut
->ignorableWhitespace( OUString() );
1620 xOut
->endElement( aBBoardName
);
1624 xOut
->ignorableWhitespace( OUString() );
1625 xOut
->endElement( aWindowName
);
1627 xOut
->endDocument();