Update ooo320-m1
[ooovba.git] / xmlscript / source / xmldlg_imexp / xmldlg_import.cxx
blobf895d6683296c9181401fdcdabf7e7754183dacd
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_import.cxx,v $
10 * $Revision: 1.37 $
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 "imp_share.hxx"
35 #include <osl/diagnose.h>
36 #include <tools/diagnose_ex.h>
37 #include <osl/mutex.hxx>
39 #include <rtl/ustrbuf.hxx>
41 #include <xmlscript/xml_import.hxx>
42 #include <comphelper/processfactory.hxx>
44 #include <com/sun/star/awt/CharSet.hpp>
45 #include <com/sun/star/awt/FontFamily.hpp>
46 #include <com/sun/star/awt/FontPitch.hpp>
47 #include <com/sun/star/awt/FontSlant.hpp>
48 #include <com/sun/star/awt/FontStrikeout.hpp>
49 #include <com/sun/star/awt/FontType.hpp>
50 #include <com/sun/star/awt/FontUnderline.hpp>
51 #include <com/sun/star/awt/FontWeight.hpp>
52 #include <com/sun/star/awt/FontWidth.hpp>
53 #include <com/sun/star/awt/ImagePosition.hpp>
54 #include <com/sun/star/awt/LineEndFormat.hpp>
55 #include <com/sun/star/awt/PushButtonType.hpp>
56 #include <com/sun/star/awt/VisualEffect.hpp>
57 #include <com/sun/star/style/VerticalAlignment.hpp>
59 #include <com/sun/star/script/XScriptEventsSupplier.hpp>
60 #include <com/sun/star/script/ScriptEventDescriptor.hpp>
62 #include <com/sun/star/view/SelectionType.hpp>
63 #include <com/sun/star/document/XStorageBasedDocument.hpp>
64 #include <com/sun/star/script/DocumentScriptLibraryContainer.hpp>
65 #include <com/sun/star/script/XVBACompat.hpp>
67 using namespace ::com::sun::star;
68 using namespace ::com::sun::star::uno;
69 using namespace ::com::sun::star::frame;
70 using ::rtl::OUString;
72 namespace xmlscript
75 //__________________________________________________________________________________________________
76 void EventElement::endElement()
77 throw (xml::sax::SAXException, RuntimeException)
79 static_cast< ControlElement * >( _pParent )->_events.push_back( this );
81 //__________________________________________________________________________________________________
82 ControlElement::ControlElement(
83 OUString const & rLocalName,
84 Reference< xml::input::XAttributes > const & xAttributes,
85 ElementBase * pParent, DialogImport * pImport )
86 SAL_THROW( () )
87 : ElementBase(
88 pImport->XMLNS_DIALOGS_UID, rLocalName, xAttributes, pParent, pImport )
90 if (_pParent)
92 // inherit position
93 _nBasePosX = static_cast< ControlElement * >( _pParent )->_nBasePosX;
94 _nBasePosY = static_cast< ControlElement * >( _pParent )->_nBasePosY;
96 else
98 _nBasePosX = 0;
99 _nBasePosY = 0;
103 //__________________________________________________________________________________________________
104 Reference< xml::input::XElement > ControlElement::getStyle(
105 Reference< xml::input::XAttributes > const & xAttributes )
107 OUString aStyleId(
108 xAttributes->getValueByUidName(
109 _pImport->XMLNS_DIALOGS_UID,
110 OUString( RTL_CONSTASCII_USTRINGPARAM("style-id") ) ) );
111 if (aStyleId.getLength())
113 return _pImport->getStyle( aStyleId );
115 return Reference< xml::input::XElement >();
117 //__________________________________________________________________________________________________
118 OUString ControlElement::getControlId(
119 Reference< xml::input::XAttributes > const & xAttributes )
121 OUString aId(
122 xAttributes->getValueByUidName(
123 _pImport->XMLNS_DIALOGS_UID,
124 OUString( RTL_CONSTASCII_USTRINGPARAM("id") ) ) );
125 if (! aId.getLength())
127 throw xml::sax::SAXException(
128 OUString( RTL_CONSTASCII_USTRINGPARAM("missing id attribute!") ),
129 Reference< XInterface >(), Any() );
131 return aId;
134 //##################################################################################################
136 //__________________________________________________________________________________________________
137 bool StyleElement::importTextColorStyle(
138 Reference< beans::XPropertySet > const & xProps )
140 if ((_inited & 0x2) != 0)
142 if ((_hasValue & 0x2) != 0)
144 xProps->setPropertyValue(
145 OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ),
146 makeAny( _textColor ) );
147 return true;
149 return false;
151 _inited |= 0x2;
153 if (getLongAttr( &_textColor,
154 OUString( RTL_CONSTASCII_USTRINGPARAM("text-color") ),
155 _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
157 _hasValue |= 0x2;
158 xProps->setPropertyValue(
159 OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ),
160 makeAny( _textColor ) );
161 return true;
163 return false;
165 //__________________________________________________________________________________________________
166 bool StyleElement::importTextLineColorStyle(
167 Reference< beans::XPropertySet > const & xProps )
169 if ((_inited & 0x20) != 0)
171 if ((_hasValue & 0x20) != 0)
173 xProps->setPropertyValue(
174 OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ),
175 makeAny( _textLineColor ) );
176 return true;
178 return false;
180 _inited |= 0x20;
182 if (getLongAttr( &_textLineColor,
183 OUString( RTL_CONSTASCII_USTRINGPARAM("textline-color") ),
184 _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
186 _hasValue |= 0x20;
187 xProps->setPropertyValue(
188 OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ),
189 makeAny( _textLineColor ) );
190 return true;
192 return false;
194 //__________________________________________________________________________________________________
195 bool StyleElement::importFillColorStyle(
196 Reference< beans::XPropertySet > const & xProps )
198 if ((_inited & 0x10) != 0)
200 if ((_hasValue & 0x10) != 0)
202 xProps->setPropertyValue(
203 OUString( RTL_CONSTASCII_USTRINGPARAM("FillColor") ), makeAny( _fillColor ) );
204 return true;
206 return false;
208 _inited |= 0x10;
210 if (getLongAttr(
211 &_fillColor,
212 OUString( RTL_CONSTASCII_USTRINGPARAM("fill-color") ),
213 _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
215 _hasValue |= 0x10;
216 xProps->setPropertyValue(
217 OUString( RTL_CONSTASCII_USTRINGPARAM("FillColor") ),
218 makeAny( _fillColor ) );
219 return true;
221 return false;
223 //__________________________________________________________________________________________________
224 bool StyleElement::importBackgroundColorStyle(
225 Reference< beans::XPropertySet > const & xProps )
227 if ((_inited & 0x1) != 0)
229 if ((_hasValue & 0x1) != 0)
231 xProps->setPropertyValue(
232 OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ), makeAny( _backgroundColor ) );
233 return true;
235 return false;
237 _inited |= 0x1;
239 if (getLongAttr(
240 &_backgroundColor,
241 OUString( RTL_CONSTASCII_USTRINGPARAM("background-color") ),
242 _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
244 _hasValue |= 0x1;
245 xProps->setPropertyValue(
246 OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ), makeAny( _backgroundColor ) );
247 return true;
249 return false;
252 //__________________________________________________________________________________________________
253 bool StyleElement::importBorderStyle(
254 Reference< beans::XPropertySet > const & xProps )
256 if ((_inited & 0x4) != 0)
258 if ((_hasValue & 0x4) != 0)
260 xProps->setPropertyValue(
261 OUSTR("Border"), makeAny( _border == BORDER_SIMPLE_COLOR
262 ? BORDER_SIMPLE : _border ) );
263 if (_border == BORDER_SIMPLE_COLOR)
264 xProps->setPropertyValue( OUSTR("BorderColor"),
265 makeAny(_borderColor) );
266 return true;
268 return false;
270 _inited |= 0x4;
272 OUString aValue;
273 if (getStringAttr(
274 &aValue, OUSTR("border"),
275 _xAttributes, _pImport->XMLNS_DIALOGS_UID )) {
276 if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") ))
277 _border = BORDER_NONE;
278 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("3d") ))
279 _border = BORDER_3D;
280 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("simple") ))
281 _border = BORDER_SIMPLE;
282 else {
283 _border = BORDER_SIMPLE_COLOR;
284 _borderColor = toInt32(aValue);
287 _hasValue |= 0x4;
288 importBorderStyle(xProps); // write values
290 return false;
293 //______________________________________________________________________________
294 bool StyleElement::importVisualEffectStyle(
295 Reference<beans::XPropertySet> const & xProps )
297 if ((_inited & 0x40) != 0)
299 if ((_hasValue & 0x40) != 0)
301 xProps->setPropertyValue( OUSTR("VisualEffect"),
302 makeAny(_visualEffect) );
303 return true;
305 return false;
307 _inited |= 0x40;
309 OUString aValue;
310 if (getStringAttr( &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("look") ),
311 _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
313 if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") ))
315 _visualEffect = awt::VisualEffect::NONE;
317 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("3d") ))
319 _visualEffect = awt::VisualEffect::LOOK3D;
321 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("simple") ))
323 _visualEffect = awt::VisualEffect::FLAT;
325 else
326 OSL_ASSERT( 0 );
328 _hasValue |= 0x40;
329 xProps->setPropertyValue( OUSTR("VisualEffect"),
330 makeAny(_visualEffect) );
332 return false;
335 //__________________________________________________________________________________________________
336 void StyleElement::setFontProperties(
337 Reference< beans::XPropertySet > const & xProps )
339 xProps->setPropertyValue(
340 OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ), makeAny( _descr ) );
341 xProps->setPropertyValue(
342 OUString( RTL_CONSTASCII_USTRINGPARAM("FontEmphasisMark") ), makeAny( _fontEmphasisMark ) );
343 xProps->setPropertyValue(
344 OUString( RTL_CONSTASCII_USTRINGPARAM("FontRelief") ), makeAny( _fontRelief ) );
346 //__________________________________________________________________________________________________
347 bool StyleElement::importFontStyle(
348 Reference< beans::XPropertySet > const & xProps )
350 if ((_inited & 0x8) != 0)
352 if ((_hasValue & 0x8) != 0)
354 setFontProperties( xProps );
355 return true;
357 return false;
359 _inited |= 0x8;
361 OUString aValue;
362 bool bFontImport;
364 // dialog:font-name CDATA #IMPLIED
365 bFontImport = getStringAttr(
366 &_descr.Name, OUString( RTL_CONSTASCII_USTRINGPARAM("font-name") ),
367 _xAttributes, _pImport->XMLNS_DIALOGS_UID );
369 // dialog:font-height %numeric; #IMPLIED
370 if (getStringAttr(
371 &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-height") ),
372 _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
374 _descr.Height = (sal_Int16)toInt32( aValue );
375 bFontImport = true;
377 // dialog:font-width %numeric; #IMPLIED
378 if (getStringAttr(
379 &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-width") ),
380 _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
382 _descr.Width = (sal_Int16)toInt32( aValue );
383 bFontImport = true;
385 // dialog:font-stylename CDATA #IMPLIED
386 bFontImport |= getStringAttr(
387 &_descr.StyleName,
388 OUString( RTL_CONSTASCII_USTRINGPARAM("font-stylename") ),
389 _xAttributes, _pImport->XMLNS_DIALOGS_UID );
391 // dialog:font-family "(decorative|modern|roman|script|swiss|system)" #IMPLIED
392 if (getStringAttr(
393 &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-family") ),
394 _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
396 if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("decorative") ))
398 _descr.Family = awt::FontFamily::DECORATIVE;
400 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("modern") ))
402 _descr.Family = awt::FontFamily::MODERN;
404 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("roman") ))
406 _descr.Family = awt::FontFamily::ROMAN;
408 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("script") ))
410 _descr.Family = awt::FontFamily::SCRIPT;
412 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("swiss") ))
414 _descr.Family = awt::FontFamily::SWISS;
416 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("system") ))
418 _descr.Family = awt::FontFamily::SYSTEM;
420 else
422 throw xml::sax::SAXException(
423 OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-family style!") ),
424 Reference< XInterface >(), Any() );
426 bFontImport = true;
429 // dialog:font-charset "(ansi|mac|ibmpc_437|ibmpc_850|ibmpc_860|ibmpc_861|ibmpc_863|ibmpc_865|system|symbol)" #IMPLIED
430 if (getStringAttr(
431 &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-charset") ),
432 _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
434 if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ansi") ))
436 _descr.CharSet = awt::CharSet::ANSI;
438 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("mac") ))
440 _descr.CharSet = awt::CharSet::MAC;
442 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ibmpc_437") ))
444 _descr.CharSet = awt::CharSet::IBMPC_437;
446 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ibmpc_850") ))
448 _descr.CharSet = awt::CharSet::IBMPC_850;
450 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ibmpc_860") ))
452 _descr.CharSet = awt::CharSet::IBMPC_860;
454 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ibmpc_861") ))
456 _descr.CharSet = awt::CharSet::IBMPC_861;
458 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ibmpc_863") ))
460 _descr.CharSet = awt::CharSet::IBMPC_863;
462 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ibmpc_865") ))
464 _descr.CharSet = awt::CharSet::IBMPC_865;
466 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("system") ))
468 _descr.CharSet = awt::CharSet::SYSTEM;
470 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("symbol") ))
472 _descr.CharSet = awt::CharSet::SYMBOL;
474 else
476 throw xml::sax::SAXException(
477 OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-charset style!") ),
478 Reference< XInterface >(), Any() );
480 bFontImport = true;
483 // dialog:font-pitch "(fixed|variable)" #IMPLIED
484 if (getStringAttr(
485 &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-pitch") ),
486 _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
488 if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("fixed") ))
490 _descr.Pitch = awt::FontPitch::FIXED;
492 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("variable") ))
494 _descr.Pitch = awt::FontPitch::VARIABLE;
496 else
498 throw xml::sax::SAXException(
499 OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-pitch style!") ),
500 Reference< XInterface >(), Any() );
502 bFontImport = true;
505 // dialog:font-charwidth CDATA #IMPLIED
506 if (getStringAttr(
507 &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-charwidth") ),
508 _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
510 _descr.CharacterWidth = aValue.toFloat();
511 bFontImport = true;
513 // dialog:font-weight CDATA #IMPLIED
514 if (getStringAttr(
515 &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-weight") ),
516 _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
518 _descr.Weight = aValue.toFloat();
519 bFontImport = true;
522 // dialog:font-slant "(oblique|italic|reverse_oblique|reverse_italic)" #IMPLIED
523 if (getStringAttr(
524 &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-slant") ),
525 _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
527 if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("oblique") ))
529 _descr.Slant = awt::FontSlant_OBLIQUE;
531 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("italic") ))
533 _descr.Slant = awt::FontSlant_ITALIC;
535 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("reverse_oblique") ))
537 _descr.Slant = awt::FontSlant_REVERSE_OBLIQUE;
539 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("reverse_italic") ))
541 _descr.Slant = awt::FontSlant_REVERSE_ITALIC;
543 else
545 throw xml::sax::SAXException(
546 OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-slant style!") ),
547 Reference< XInterface >(), Any() );
549 bFontImport = true;
552 // dialog:font-underline "(single|double|dotted|dash|longdash|dashdot|dashdotdot|smallwave|wave|doublewave|bold|bolddotted|bolddash|boldlongdash|bolddashdot|bolddashdotdot|boldwave)" #IMPLIED
553 if (getStringAttr(
554 &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-underline") ),
555 _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
557 if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("single") ))
559 _descr.Underline = awt::FontUnderline::SINGLE;
561 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("double") ))
563 _descr.Underline = awt::FontUnderline::DOUBLE;
565 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dotted") ))
567 _descr.Underline = awt::FontUnderline::DOTTED;
569 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dash") ))
571 _descr.Underline = awt::FontUnderline::DASH;
573 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("longdash") ))
575 _descr.Underline = awt::FontUnderline::LONGDASH;
577 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dashdot") ))
579 _descr.Underline = awt::FontUnderline::DASHDOT;
581 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dashdotdot") ))
583 _descr.Underline = awt::FontUnderline::DASHDOTDOT;
585 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("smallwave") ))
587 _descr.Underline = awt::FontUnderline::SMALLWAVE;
589 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("wave") ))
591 _descr.Underline = awt::FontUnderline::WAVE;
593 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("doublewave") ))
595 _descr.Underline = awt::FontUnderline::DOUBLEWAVE;
597 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bold") ))
599 _descr.Underline = awt::FontUnderline::BOLD;
601 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bolddotted") ))
603 _descr.Underline = awt::FontUnderline::BOLDDOTTED;
605 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bolddash") ))
607 _descr.Underline = awt::FontUnderline::BOLDDASH;
609 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("boldlongdash") ))
611 _descr.Underline = awt::FontUnderline::BOLDLONGDASH;
613 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bolddashdot") ))
615 _descr.Underline = awt::FontUnderline::BOLDDASHDOT;
617 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bolddashdotdot") ))
619 _descr.Underline = awt::FontUnderline::BOLDDASHDOTDOT;
621 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("boldwave") ))
623 _descr.Underline = awt::FontUnderline::BOLDWAVE;
625 else
627 throw xml::sax::SAXException(
628 OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-underline style!") ),
629 Reference< XInterface >(), Any() );
631 bFontImport = true;
634 // dialog:font-strikeout "(single|double|bold|slash|x)" #IMPLIED
635 if (getStringAttr(
636 &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-strikeout") ),
637 _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
639 if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("single") ))
641 _descr.Strikeout = awt::FontStrikeout::SINGLE;
643 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("double") ))
645 _descr.Strikeout = awt::FontStrikeout::DOUBLE;
647 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bold") ))
649 _descr.Strikeout = awt::FontStrikeout::BOLD;
651 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("slash") ))
653 _descr.Strikeout = awt::FontStrikeout::SLASH;
655 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("x") ))
657 _descr.Strikeout = awt::FontStrikeout::X;
659 else
661 throw xml::sax::SAXException(
662 OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-strikeout style!") ),
663 Reference< XInterface >(), Any() );
665 bFontImport = true;
668 // dialog:font-orientation CDATA #IMPLIED
669 if (getStringAttr(
670 &aValue,
671 OUString( RTL_CONSTASCII_USTRINGPARAM("font-orientation") ),
672 _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
674 _descr.Orientation = aValue.toFloat();
675 bFontImport = true;
677 // dialog:font-kerning %boolean; #IMPLIED
678 bFontImport |= getBoolAttr(
679 &_descr.Kerning,
680 OUString( RTL_CONSTASCII_USTRINGPARAM("font-kerning") ),
681 _xAttributes, _pImport->XMLNS_DIALOGS_UID );
682 // dialog:font-wordlinemode %boolean; #IMPLIED
683 bFontImport |= getBoolAttr(
684 &_descr.WordLineMode,
685 OUString( RTL_CONSTASCII_USTRINGPARAM("font-wordlinemode") ),
686 _xAttributes, _pImport->XMLNS_DIALOGS_UID );
688 // dialog:font-type "(raster|device|scalable)" #IMPLIED
689 if (getStringAttr(
690 &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-type") ),
691 _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
693 if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("raster") ))
695 _descr.Type = awt::FontType::RASTER;
697 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("device") ))
699 _descr.Type = awt::FontType::DEVICE;
701 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("scalable") ))
703 _descr.Type = awt::FontType::SCALABLE;
705 else
707 throw xml::sax::SAXException(
708 OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-type style!") ),
709 Reference< XInterface >(), Any() );
711 bFontImport = true;
714 // additional properties which are not part of the FontDescriptor struct
715 // dialog:font-relief (none|embossed|engraved) #IMPLIED
716 if (getStringAttr(
717 &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-relief") ),
718 _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
720 if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") ))
722 _fontRelief = awt::FontRelief::NONE;
724 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("embossed") ))
726 _fontRelief = awt::FontRelief::EMBOSSED;
728 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("engraved") ))
730 _fontRelief = awt::FontRelief::ENGRAVED;
732 else
734 throw xml::sax::SAXException(
735 OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-relief style!") ),
736 Reference< XInterface >(), Any() );
738 bFontImport = true;
740 // dialog:font-emphasismark (none|dot|circle|disc|accent|above|below) #IMPLIED
741 if (getStringAttr(
742 &aValue,
743 OUString( RTL_CONSTASCII_USTRINGPARAM("font-emphasismark") ),
744 _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
746 if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") ))
748 _fontEmphasisMark = awt::FontEmphasisMark::NONE;
750 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dot") ))
752 _fontEmphasisMark = awt::FontEmphasisMark::DOT;
754 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("circle") ))
756 _fontEmphasisMark = awt::FontEmphasisMark::CIRCLE;
758 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("disc") ))
760 _fontEmphasisMark = awt::FontEmphasisMark::DISC;
762 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("accent") ))
764 _fontEmphasisMark = awt::FontEmphasisMark::ACCENT;
766 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("above") ))
768 _fontEmphasisMark = awt::FontEmphasisMark::ABOVE;
770 else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("below") ))
772 _fontEmphasisMark = awt::FontEmphasisMark::BELOW;
774 else
776 throw xml::sax::SAXException(
777 OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-emphasismark style!") ),
778 Reference< XInterface >(), Any() );
780 bFontImport = true;
783 // ==================================================
784 if (bFontImport)
786 _hasValue |= 0x8;
787 setFontProperties( xProps );
790 return bFontImport;
793 //##################################################################################################
795 //__________________________________________________________________________________________________
796 bool ImportContext::importStringProperty(
797 OUString const & rPropName, OUString const & rAttrName,
798 Reference< xml::input::XAttributes > const & xAttributes )
800 OUString aValue(
801 xAttributes->getValueByUidName(
802 _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
803 if (aValue.getLength())
805 _xControlModel->setPropertyValue( rPropName, makeAny( aValue ) );
806 return true;
808 return false;
810 //__________________________________________________________________________________________________
811 bool ImportContext::importDoubleProperty(
812 OUString const & rPropName, OUString const & rAttrName,
813 Reference< xml::input::XAttributes > const & xAttributes )
815 OUString aValue(
816 xAttributes->getValueByUidName(
817 _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
818 if (aValue.getLength())
820 _xControlModel->setPropertyValue( rPropName, makeAny( aValue.toDouble() ) );
821 return true;
823 return false;
825 //__________________________________________________________________________________________________
826 bool ImportContext::importBooleanProperty(
827 OUString const & rPropName, OUString const & rAttrName,
828 Reference< xml::input::XAttributes > const & xAttributes )
830 sal_Bool bBool;
831 if (getBoolAttr(
832 &bBool, rAttrName, xAttributes, _pImport->XMLNS_DIALOGS_UID ))
834 _xControlModel->setPropertyValue( rPropName, makeAny( bBool ) );
835 return true;
837 return false;
839 //__________________________________________________________________________________________________
840 bool ImportContext::importLongProperty(
841 OUString const & rPropName, OUString const & rAttrName,
842 Reference< xml::input::XAttributes > const & xAttributes )
844 OUString aValue(
845 xAttributes->getValueByUidName(
846 _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
847 if (aValue.getLength())
849 _xControlModel->setPropertyValue( rPropName, makeAny( toInt32( aValue ) ) );
850 return true;
852 return false;
854 //__________________________________________________________________________________________________
855 bool ImportContext::importLongProperty(
856 sal_Int32 nOffset,
857 OUString const & rPropName, OUString const & rAttrName,
858 Reference< xml::input::XAttributes > const & xAttributes )
860 OUString aValue(
861 xAttributes->getValueByUidName(
862 _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
863 if (aValue.getLength())
865 _xControlModel->setPropertyValue( rPropName, makeAny( toInt32( aValue ) + nOffset ) );
866 return true;
868 return false;
870 //__________________________________________________________________________________________________
871 bool ImportContext::importHexLongProperty(
872 OUString const & rPropName, OUString const & rAttrName,
873 Reference< xml::input::XAttributes > const & xAttributes )
875 OUString aValue(
876 xAttributes->getValueByUidName(
877 _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
878 if (aValue.getLength())
880 _xControlModel->setPropertyValue( rPropName, makeAny( toInt32( aValue ) ) );
881 return true;
883 return false;
885 //__________________________________________________________________________________________________
886 bool ImportContext::importShortProperty(
887 OUString const & rPropName, OUString const & rAttrName,
888 Reference< xml::input::XAttributes > const & xAttributes )
890 OUString aValue(
891 xAttributes->getValueByUidName(
892 _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
893 if (aValue.getLength())
895 _xControlModel->setPropertyValue( rPropName, makeAny( (sal_Int16)toInt32( aValue ) ) );
896 return true;
898 return false;
900 //__________________________________________________________________________________________________
901 bool ImportContext::importAlignProperty(
902 OUString const & rPropName, OUString const & rAttrName,
903 Reference< xml::input::XAttributes > const & xAttributes )
905 OUString aAlign(
906 xAttributes->getValueByUidName(
907 _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
908 if (aAlign.getLength())
910 sal_Int16 nAlign;
911 if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("left") ))
913 nAlign = 0;
915 else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("center") ))
917 nAlign = 1;
919 else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("right") ))
921 nAlign = 2;
923 else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") ))
925 nAlign = 0; // default
927 else
929 throw xml::sax::SAXException(
930 OUString( RTL_CONSTASCII_USTRINGPARAM("invalid align value!") ),
931 Reference< XInterface >(), Any() );
934 _xControlModel->setPropertyValue( rPropName, makeAny( nAlign ) );
935 return true;
937 return false;
939 //__________________________________________________________________________________________________
940 bool ImportContext::importVerticalAlignProperty(
941 OUString const & rPropName, OUString const & rAttrName,
942 Reference< xml::input::XAttributes > const & xAttributes )
944 OUString aAlign(
945 xAttributes->getValueByUidName(
946 _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
947 if (aAlign.getLength())
949 style::VerticalAlignment eAlign;
951 if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("top") ))
953 eAlign = style::VerticalAlignment_TOP;
955 else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("center") ))
957 eAlign = style::VerticalAlignment_MIDDLE;
959 else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bottom") ))
961 eAlign = style::VerticalAlignment_BOTTOM;
963 else
965 throw xml::sax::SAXException(
966 OUString( RTL_CONSTASCII_USTRINGPARAM("invalid vertical align value!") ),
967 Reference< XInterface >(), Any() );
970 _xControlModel->setPropertyValue( rPropName, makeAny( eAlign ) );
971 return true;
973 return false;
975 //__________________________________________________________________________________________________
976 bool ImportContext::importImageAlignProperty(
977 OUString const & rPropName, OUString const & rAttrName,
978 Reference< xml::input::XAttributes > const & xAttributes )
980 OUString aAlign(
981 xAttributes->getValueByUidName(
982 _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
983 if (aAlign.getLength())
985 sal_Int16 nAlign;
986 if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("left") ))
988 nAlign = 0;
990 else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("top") ))
992 nAlign = 1;
994 else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("right") ))
996 nAlign = 2;
998 else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bottom") ))
1000 nAlign = 3;
1002 else
1004 throw xml::sax::SAXException(
1005 OUString( RTL_CONSTASCII_USTRINGPARAM("invalid image align value!") ),
1006 Reference< XInterface >(), Any() );
1009 _xControlModel->setPropertyValue( rPropName, makeAny( nAlign ) );
1010 return true;
1012 return false;
1014 //__________________________________________________________________________________________________
1015 bool ImportContext::importImagePositionProperty(
1016 OUString const & rPropName, OUString const & rAttrName,
1017 Reference< xml::input::XAttributes > const & xAttributes )
1019 OUString aPosition(
1020 xAttributes->getValueByUidName(
1021 _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
1022 if (aPosition.getLength())
1024 sal_Int16 nPosition;
1025 if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("left-top") ))
1027 nPosition = awt::ImagePosition::LeftTop;
1029 else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("left-center") ))
1031 nPosition = awt::ImagePosition::LeftCenter;
1033 else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("left-bottom") ))
1035 nPosition = awt::ImagePosition::LeftBottom;
1037 else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("right-top") ))
1039 nPosition = awt::ImagePosition::RightTop;
1041 else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("right-center") ))
1043 nPosition = awt::ImagePosition::RightCenter;
1045 else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("right-bottom") ))
1047 nPosition = awt::ImagePosition::RightBottom;
1049 else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("top-left") ))
1051 nPosition = awt::ImagePosition::AboveLeft;
1053 else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("top-center") ))
1055 nPosition = awt::ImagePosition::AboveCenter;
1057 else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("top-right") ))
1059 nPosition = awt::ImagePosition::AboveRight;
1061 else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bottom-left") ))
1063 nPosition = awt::ImagePosition::BelowLeft;
1065 else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bottom-center") ))
1067 nPosition = awt::ImagePosition::BelowCenter;
1069 else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bottom-right") ))
1071 nPosition = awt::ImagePosition::BelowRight;
1073 else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("center") ))
1075 nPosition = awt::ImagePosition::Centered;
1077 else
1079 throw xml::sax::SAXException(
1080 OUString( RTL_CONSTASCII_USTRINGPARAM("invalid image position value!") ),
1081 Reference< XInterface >(), Any() );
1084 _xControlModel->setPropertyValue( rPropName, makeAny( nPosition ) );
1085 return true;
1087 return false;
1089 //__________________________________________________________________________________________________
1090 bool ImportContext::importButtonTypeProperty(
1091 OUString const & rPropName, OUString const & rAttrName,
1092 Reference< xml::input::XAttributes > const & xAttributes )
1094 OUString buttonType(
1095 xAttributes->getValueByUidName(
1096 _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
1097 if (buttonType.getLength())
1099 sal_Int16 nButtonType;
1100 if (buttonType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("standard") ))
1102 nButtonType = awt::PushButtonType_STANDARD;
1104 else if (buttonType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ok") ))
1106 nButtonType = awt::PushButtonType_OK;
1108 else if (buttonType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("cancel") ))
1110 nButtonType = awt::PushButtonType_CANCEL;
1112 else if (buttonType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("help") ))
1114 nButtonType = awt::PushButtonType_HELP;
1116 else
1118 throw xml::sax::SAXException(
1119 OUString( RTL_CONSTASCII_USTRINGPARAM("invalid button-type value!") ),
1120 Reference< XInterface >(), Any() );
1123 _xControlModel->setPropertyValue( rPropName, makeAny( nButtonType ) );
1124 return true;
1126 return false;
1128 //__________________________________________________________________________________________________
1129 bool ImportContext::importDateFormatProperty(
1130 OUString const & rPropName, OUString const & rAttrName,
1131 Reference< xml::input::XAttributes > const & xAttributes )
1133 OUString aFormat(
1134 xAttributes->getValueByUidName(
1135 _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
1136 if (aFormat.getLength())
1138 sal_Int16 nFormat;
1139 if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("system_short") ))
1141 nFormat = 0;
1143 else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("system_short_YY") ))
1145 nFormat = 1;
1147 else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("system_short_YYYY") ))
1149 nFormat = 2;
1151 else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("system_long") ))
1153 nFormat = 3;
1155 else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short_DDMMYY") ))
1157 nFormat = 4;
1159 else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short_MMDDYY") ))
1161 nFormat = 5;
1163 else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short_YYMMDD") ))
1165 nFormat = 6;
1167 else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short_DDMMYYYY") ))
1169 nFormat = 7;
1171 else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short_MMDDYYYY") ))
1173 nFormat = 8;
1175 else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short_YYYYMMDD") ))
1177 nFormat = 9;
1179 else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short_YYMMDD_DIN5008") ))
1181 nFormat = 10;
1183 else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short_YYYYMMDD_DIN5008") ))
1185 nFormat = 11;
1187 else
1189 throw xml::sax::SAXException(
1190 OUString( RTL_CONSTASCII_USTRINGPARAM("invalid date-format value!") ),
1191 Reference< XInterface >(), Any() );
1194 _xControlModel->setPropertyValue( rPropName, makeAny( nFormat ) );
1195 return true;
1197 return false;
1199 //__________________________________________________________________________________________________
1200 bool ImportContext::importTimeFormatProperty(
1201 OUString const & rPropName, OUString const & rAttrName,
1202 Reference< xml::input::XAttributes > const & xAttributes )
1204 OUString aFormat(
1205 xAttributes->getValueByUidName(
1206 _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
1207 if (aFormat.getLength())
1209 sal_Int16 nFormat;
1210 if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("24h_short") ))
1212 nFormat = 0;
1214 else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("24h_long") ))
1216 nFormat = 1;
1218 else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("12h_short") ))
1220 nFormat = 2;
1222 else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("12h_long") ))
1224 nFormat = 3;
1226 else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Duration_short") ))
1228 nFormat = 4;
1230 else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Duration_long") ))
1232 nFormat = 5;
1234 else
1236 throw xml::sax::SAXException(
1237 OUString( RTL_CONSTASCII_USTRINGPARAM("invalid time-format value!") ),
1238 Reference< XInterface >(), Any() );
1241 _xControlModel->setPropertyValue( rPropName, makeAny( nFormat ) );
1242 return true;
1244 return false;
1246 //__________________________________________________________________________________________________
1247 bool ImportContext::importOrientationProperty(
1248 OUString const & rPropName, OUString const & rAttrName,
1249 Reference< xml::input::XAttributes > const & xAttributes )
1251 OUString aOrient(
1252 xAttributes->getValueByUidName(
1253 _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
1254 if (aOrient.getLength())
1256 sal_Int32 nOrient;
1257 if (aOrient.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("horizontal") ))
1259 nOrient = 0;
1261 else if (aOrient.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("vertical") ))
1263 nOrient = 1;
1265 else
1267 throw xml::sax::SAXException(
1268 OUString( RTL_CONSTASCII_USTRINGPARAM("invalid orientation value!") ),
1269 Reference< XInterface >(), Any() );
1272 _xControlModel->setPropertyValue( rPropName, makeAny( nOrient ) );
1273 return true;
1275 return false;
1277 //__________________________________________________________________________________________________
1278 bool ImportContext::importLineEndFormatProperty(
1279 OUString const & rPropName, OUString const & rAttrName,
1280 Reference< xml::input::XAttributes > const & xAttributes )
1282 OUString aFormat(
1283 xAttributes->getValueByUidName(
1284 _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
1285 if (aFormat.getLength())
1287 sal_Int16 nFormat;
1288 if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("carriage-return") ))
1290 nFormat = awt::LineEndFormat::CARRIAGE_RETURN;
1292 else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("line-feed") ))
1294 nFormat = awt::LineEndFormat::LINE_FEED;
1296 else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("carriage-return-line-feed") ))
1298 nFormat = awt::LineEndFormat::CARRIAGE_RETURN_LINE_FEED;
1300 else
1302 throw xml::sax::SAXException(
1303 OUString( RTL_CONSTASCII_USTRINGPARAM("invalid line end format value!") ),
1304 Reference< XInterface >(), Any() );
1307 _xControlModel->setPropertyValue( rPropName, makeAny( nFormat ) );
1308 return true;
1310 return false;
1312 //__________________________________________________________________________________________________
1313 bool ImportContext::importSelectionTypeProperty(
1314 OUString const & rPropName, OUString const & rAttrName,
1315 Reference< xml::input::XAttributes > const & xAttributes )
1317 OUString aSelectionType(
1318 xAttributes->getValueByUidName(
1319 _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
1320 if (aSelectionType.getLength())
1322 view::SelectionType eSelectionType;
1324 if (aSelectionType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") ))
1326 eSelectionType = view::SelectionType_NONE;
1328 else if (aSelectionType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("single") ))
1330 eSelectionType = view::SelectionType_SINGLE;
1332 else if (aSelectionType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("multi") ))
1334 eSelectionType = view::SelectionType_MULTI;
1336 else if (aSelectionType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("range") ))
1338 eSelectionType = view::SelectionType_RANGE;
1340 else
1342 throw xml::sax::SAXException(
1343 OUString( RTL_CONSTASCII_USTRINGPARAM("invalid selection type value!") ),
1344 Reference< XInterface >(), Any() );
1347 _xControlModel->setPropertyValue( rPropName, makeAny( eSelectionType ) );
1348 return true;
1350 return false;
1353 //==================================================================================================
1354 struct StringTriple
1356 char const * first;
1357 char const * second;
1358 char const * third;
1360 static StringTriple const s_aEventTranslations[] =
1362 // from xmloff/source/forms/formevents.cxx
1363 // 28.09.2001 tbe added on-adjustmentvaluechange
1364 { "com.sun.star.form.XApproveActionListener", "approveAction", "on-approveaction" },
1365 { "com.sun.star.awt.XActionListener", "actionPerformed", "on-performaction" },
1366 { "com.sun.star.form.XChangeListener", "changed", "on-change" },
1367 { "com.sun.star.awt.XTextListener", "textChanged", "on-textchange" },
1368 { "com.sun.star.awt.XItemListener", "itemStateChanged", "on-itemstatechange" },
1369 { "com.sun.star.awt.XFocusListener", "focusGained", "on-focus" },
1370 { "com.sun.star.awt.XFocusListener", "focusLost", "on-blur" },
1371 { "com.sun.star.awt.XKeyListener", "keyPressed", "on-keydown" },
1372 { "com.sun.star.awt.XKeyListener", "keyReleased", "on-keyup" },
1373 { "com.sun.star.awt.XMouseListener", "mouseEntered", "on-mouseover" },
1374 { "com.sun.star.awt.XMouseMotionListener", "mouseDragged", "on-mousedrag" },
1375 { "com.sun.star.awt.XMouseMotionListener", "mouseMoved", "on-mousemove" },
1376 { "com.sun.star.awt.XMouseListener", "mousePressed", "on-mousedown" },
1377 { "com.sun.star.awt.XMouseListener", "mouseReleased", "on-mouseup" },
1378 { "com.sun.star.awt.XMouseListener", "mouseExited", "on-mouseout" },
1379 { "com.sun.star.form.XResetListener", "approveReset", "on-approvereset" },
1380 { "com.sun.star.form.XResetListener", "resetted", "on-reset" },
1381 { "com.sun.star.form.XSubmitListener", "approveSubmit", "on-submit" },
1382 { "com.sun.star.form.XUpdateListener", "approveUpdate", "on-approveupdate" },
1383 { "com.sun.star.form.XUpdateListener", "updated", "on-update" },
1384 { "com.sun.star.form.XLoadListener", "loaded", "on-load" },
1385 { "com.sun.star.form.XLoadListener", "reloading", "on-startreload" },
1386 { "com.sun.star.form.XLoadListener", "reloaded", "on-reload" },
1387 { "com.sun.star.form.XLoadListener", "unloading", "on-startunload" },
1388 { "com.sun.star.form.XLoadListener", "unloaded", "on-unload" },
1389 { "com.sun.star.form.XConfirmDeleteListener", "confirmDelete", "on-confirmdelete" },
1390 { "com.sun.star.sdb.XRowSetApproveListener", "approveRowChange", "on-approverowchange" },
1391 { "com.sun.star.sdbc.XRowSetListener", "rowChanged", "on-rowchange" },
1392 { "com.sun.star.sdb.XRowSetApproveListener", "approveCursorMove", "on-approvecursormove" },
1393 { "com.sun.star.sdbc.XRowSetListener", "cursorMoved", "on-cursormove" },
1394 { "com.sun.star.form.XDatabaseParameterListener", "approveParameter", "on-supplyparameter" },
1395 { "com.sun.star.sdb.XSQLErrorListener", "errorOccured", "on-error" },
1396 { "com.sun.star.awt.XAdjustmentListener", "adjustmentValueChanged", "on-adjustmentvaluechange" },
1397 { 0, 0, 0 }
1399 extern StringTriple const * const g_pEventTranslations;
1400 StringTriple const * const g_pEventTranslations = s_aEventTranslations;
1402 //__________________________________________________________________________________________________
1403 void ImportContext::importEvents(
1404 ::std::vector< Reference< xml::input::XElement > > const & rEvents )
1406 Reference< script::XScriptEventsSupplier > xSupplier(
1407 _xControlModel, UNO_QUERY );
1408 if (xSupplier.is())
1410 Reference< container::XNameContainer > xEvents( xSupplier->getEvents() );
1411 if (xEvents.is())
1413 for ( size_t nPos = 0; nPos < rEvents.size(); ++nPos )
1415 script::ScriptEventDescriptor descr;
1417 EventElement * pEventElement = static_cast< EventElement * >( rEvents[ nPos ].get() );
1418 sal_Int32 nUid = pEventElement->getUid();
1419 OUString aLocalName( pEventElement->getLocalName() );
1420 Reference< xml::input::XAttributes > xAttributes(
1421 pEventElement->getAttributes() );
1423 // nowadays script events
1424 if (_pImport->XMLNS_SCRIPT_UID == nUid)
1426 if (!getStringAttr( &descr.ScriptType,
1427 OUString( RTL_CONSTASCII_USTRINGPARAM(
1428 "language") ),
1429 xAttributes,
1430 _pImport->XMLNS_SCRIPT_UID ) ||
1431 !getStringAttr( &descr.ScriptCode,
1432 OUString( RTL_CONSTASCII_USTRINGPARAM(
1433 "macro-name") ),
1434 xAttributes,
1435 _pImport->XMLNS_SCRIPT_UID ))
1437 throw xml::sax::SAXException(
1438 OUString( RTL_CONSTASCII_USTRINGPARAM(
1439 "missing language or macro-name "
1440 "attribute(s) of event!") ),
1441 Reference< XInterface >(), Any() );
1443 if ( descr.ScriptType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( "StarBasic" ) ) ) )
1445 OUString aLocation;
1446 if (getStringAttr( &aLocation,
1447 OUString( RTL_CONSTASCII_USTRINGPARAM(
1448 "location") ),
1449 xAttributes,
1450 _pImport->XMLNS_SCRIPT_UID ))
1452 // prepend location
1453 ::rtl::OUStringBuffer buf;
1454 buf.append( aLocation );
1455 buf.append( (sal_Unicode)':' );
1456 buf.append( descr.ScriptCode );
1457 descr.ScriptCode = buf.makeStringAndClear();
1460 else if ( descr.ScriptType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( "Script" ) ) ) )
1462 // Check if there is a protocol, if not assume
1463 // this is an early scripting framework url ( without
1464 // the protocol ) and fix it up!!
1465 if ( descr.ScriptCode.indexOf( ':' ) == -1 )
1467 ::rtl::OUStringBuffer buf;
1468 buf.append( OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.script:" ) ) );
1469 buf.append( descr.ScriptCode );
1470 descr.ScriptCode = buf.makeStringAndClear();
1474 // script:event element
1475 if (aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("event") ))
1477 OUString aEventName;
1478 if (! getStringAttr(
1479 &aEventName,
1480 OUString(
1481 RTL_CONSTASCII_USTRINGPARAM("event-name") ),
1482 xAttributes,
1483 _pImport->XMLNS_SCRIPT_UID ))
1485 throw xml::sax::SAXException(
1486 OUString(
1487 RTL_CONSTASCII_USTRINGPARAM(
1488 "missing event-name attribute!") ),
1489 Reference< XInterface >(), Any() );
1492 // lookup in table
1493 ::rtl::OString str(
1494 ::rtl::OUStringToOString(
1495 aEventName, RTL_TEXTENCODING_ASCII_US ) );
1496 StringTriple const * p = g_pEventTranslations;
1497 while (p->first)
1499 if (0 == ::rtl_str_compare( p->third, str.getStr() ))
1501 descr.ListenerType = OUString(
1502 p->first, ::rtl_str_getLength( p->first ),
1503 RTL_TEXTENCODING_ASCII_US );
1504 descr.EventMethod = OUString(
1505 p->second, ::rtl_str_getLength( p->second ),
1506 RTL_TEXTENCODING_ASCII_US );
1507 break;
1509 ++p;
1512 if (! p->first)
1514 throw xml::sax::SAXException(
1515 OUString( RTL_CONSTASCII_USTRINGPARAM("no matching event-name found!") ),
1516 Reference< XInterface >(), Any() );
1519 else // script:listener-event element
1521 OSL_ASSERT( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("listener-event") ) );
1523 if (!getStringAttr(
1524 &descr.ListenerType,
1525 OUString( RTL_CONSTASCII_USTRINGPARAM(
1526 "listener-type") ),
1527 xAttributes,
1528 _pImport->XMLNS_SCRIPT_UID ) ||
1529 !getStringAttr(
1530 &descr.EventMethod,
1531 OUString( RTL_CONSTASCII_USTRINGPARAM(
1532 "listener-method") ),
1533 xAttributes, _pImport->XMLNS_SCRIPT_UID ))
1535 throw xml::sax::SAXException(
1536 OUString(
1537 RTL_CONSTASCII_USTRINGPARAM(
1538 "missing listener-type or "
1539 "listener-method attribute(s)!") ),
1540 Reference< XInterface >(), Any() );
1542 // optional listener param
1543 getStringAttr(
1544 &descr.AddListenerParam,
1545 OUString( RTL_CONSTASCII_USTRINGPARAM(
1546 "listener-param") ),
1547 xAttributes, _pImport->XMLNS_SCRIPT_UID );
1550 else // deprecated dlg:event element
1552 OSL_ASSERT(
1553 _pImport->XMLNS_DIALOGS_UID == nUid &&
1554 aLocalName.equalsAsciiL(
1555 RTL_CONSTASCII_STRINGPARAM("event") ) );
1557 if (!getStringAttr( &descr.ListenerType,
1558 OUString( RTL_CONSTASCII_USTRINGPARAM(
1559 "listener-type") ),
1560 xAttributes,
1561 _pImport->XMLNS_DIALOGS_UID ) ||
1562 !getStringAttr( &descr.EventMethod,
1563 OUString( RTL_CONSTASCII_USTRINGPARAM(
1564 "event-method") ),
1565 xAttributes,
1566 _pImport->XMLNS_DIALOGS_UID ))
1568 throw xml::sax::SAXException(
1569 OUString( RTL_CONSTASCII_USTRINGPARAM("missing listener-type or event-method attribute(s)!") ),
1570 Reference< XInterface >(), Any() );
1573 getStringAttr(
1574 &descr.ScriptType,
1575 OUString( RTL_CONSTASCII_USTRINGPARAM("script-type") ),
1576 xAttributes, _pImport->XMLNS_DIALOGS_UID );
1577 getStringAttr(
1578 &descr.ScriptCode,
1579 OUString( RTL_CONSTASCII_USTRINGPARAM("script-code") ),
1580 xAttributes, _pImport->XMLNS_DIALOGS_UID );
1581 getStringAttr(
1582 &descr.AddListenerParam,
1583 OUString( RTL_CONSTASCII_USTRINGPARAM("param") ),
1584 xAttributes, _pImport->XMLNS_DIALOGS_UID );
1587 ::rtl::OUStringBuffer buf;
1588 buf.append( descr.ListenerType );
1589 buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("::") );
1590 buf.append( descr.EventMethod );
1591 xEvents->insertByName( buf.makeStringAndClear(), makeAny( descr ) );
1596 //__________________________________________________________________________________________________
1597 void ImportContext::importDefaults(
1598 sal_Int32 nBaseX, sal_Int32 nBaseY,
1599 Reference< xml::input::XAttributes > const & xAttributes,
1600 bool supportPrintable )
1602 _xControlModel->setPropertyValue(
1603 OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ),
1604 makeAny( _aId ) );
1606 importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("TabIndex") ),
1607 OUString( RTL_CONSTASCII_USTRINGPARAM("tab-index") ),
1608 xAttributes );
1610 sal_Bool bDisable = sal_False;
1611 if (getBoolAttr(
1612 &bDisable, OUString( RTL_CONSTASCII_USTRINGPARAM("disabled") ),
1613 xAttributes, _pImport->XMLNS_DIALOGS_UID ) &&
1614 bDisable)
1616 _xControlModel->setPropertyValue(
1617 OUString( RTL_CONSTASCII_USTRINGPARAM("Enabled") ), makeAny( sal_False ) );
1620 sal_Bool bVisible = sal_True;
1621 if (getBoolAttr(
1622 &bVisible, OUString( RTL_CONSTASCII_USTRINGPARAM("visible") ),
1623 xAttributes, _pImport->XMLNS_DIALOGS_UID ) && !bVisible)
1628 _xControlModel->setPropertyValue(
1629 OUString( RTL_CONSTASCII_USTRINGPARAM("EnableVisible") ), makeAny( sal_False ) );
1631 catch( Exception& )
1633 DBG_UNHANDLED_EXCEPTION();
1637 if (!importLongProperty( nBaseX,
1638 OUString( RTL_CONSTASCII_USTRINGPARAM("PositionX") ),
1639 OUString( RTL_CONSTASCII_USTRINGPARAM("left") ),
1640 xAttributes ) ||
1641 !importLongProperty( nBaseY,
1642 OUString( RTL_CONSTASCII_USTRINGPARAM("PositionY") ),
1643 OUString( RTL_CONSTASCII_USTRINGPARAM("top") ),
1644 xAttributes ) ||
1645 !importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ),
1646 OUString( RTL_CONSTASCII_USTRINGPARAM("width") ),
1647 xAttributes ) ||
1648 !importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ),
1649 OUString( RTL_CONSTASCII_USTRINGPARAM("height") ),
1650 xAttributes ))
1652 throw xml::sax::SAXException(
1653 OUString( RTL_CONSTASCII_USTRINGPARAM("missing pos size attribute(s)!") ),
1654 Reference< XInterface >(), Any() );
1657 if (supportPrintable)
1659 importBooleanProperty(
1660 OUString( RTL_CONSTASCII_USTRINGPARAM("Printable") ),
1661 OUString( RTL_CONSTASCII_USTRINGPARAM("printable") ),
1662 xAttributes );
1665 sal_Int32 nLong;
1666 if (! getLongAttr(
1667 &nLong,
1668 OUString( RTL_CONSTASCII_USTRINGPARAM("page") ),
1669 xAttributes, _pImport->XMLNS_DIALOGS_UID ))
1671 nLong = 0;
1673 _xControlModel->setPropertyValue(
1674 OUString( RTL_CONSTASCII_USTRINGPARAM("Step") ),
1675 makeAny( nLong ) );
1677 importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tag") ),
1678 OUString( RTL_CONSTASCII_USTRINGPARAM("tag") ),
1679 xAttributes );
1680 importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("HelpText") ),
1681 OUString( RTL_CONSTASCII_USTRINGPARAM("help-text") ),
1682 xAttributes );
1683 importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("HelpURL") ),
1684 OUString( RTL_CONSTASCII_USTRINGPARAM("help-url") ),
1685 xAttributes );
1688 //##################################################################################################
1690 //__________________________________________________________________________________________________
1691 Reference< xml::input::XElement > ElementBase::getParent()
1692 throw (RuntimeException)
1694 return static_cast< xml::input::XElement * >( _pParent );
1696 //__________________________________________________________________________________________________
1697 OUString ElementBase::getLocalName()
1698 throw (RuntimeException)
1700 return _aLocalName;
1702 //__________________________________________________________________________________________________
1703 sal_Int32 ElementBase::getUid()
1704 throw (RuntimeException)
1706 return _nUid;
1708 //__________________________________________________________________________________________________
1709 Reference< xml::input::XAttributes > ElementBase::getAttributes()
1710 throw (RuntimeException)
1712 return _xAttributes;
1714 //__________________________________________________________________________________________________
1715 void ElementBase::ignorableWhitespace(
1716 OUString const & /*rWhitespaces*/ )
1717 throw (xml::sax::SAXException, RuntimeException)
1719 // not used
1721 //__________________________________________________________________________________________________
1722 void ElementBase::characters( OUString const & /*rChars*/ )
1723 throw (xml::sax::SAXException, RuntimeException)
1725 // not used, all characters ignored
1727 //__________________________________________________________________________________________________
1728 void ElementBase::endElement()
1729 throw (xml::sax::SAXException, RuntimeException)
1732 //______________________________________________________________________________
1733 void ElementBase::processingInstruction(
1734 OUString const & /*Target*/, OUString const & /*Data*/ )
1735 throw (xml::sax::SAXException, RuntimeException)
1738 //__________________________________________________________________________________________________
1739 Reference< xml::input::XElement > ElementBase::startChildElement(
1740 sal_Int32 /*nUid*/, OUString const & /*rLocalName*/,
1741 Reference< xml::input::XAttributes > const & /*xAttributes*/ )
1742 throw (xml::sax::SAXException, RuntimeException)
1744 throw xml::sax::SAXException(
1745 OUString( RTL_CONSTASCII_USTRINGPARAM("unexpected element!") ),
1746 Reference< XInterface >(), Any() );
1749 //__________________________________________________________________________________________________
1750 ElementBase::ElementBase(
1751 sal_Int32 nUid, OUString const & rLocalName,
1752 Reference< xml::input::XAttributes > const & xAttributes,
1753 ElementBase * pParent, DialogImport * pImport )
1754 SAL_THROW( () )
1755 : _pImport( pImport )
1756 , _pParent( pParent )
1757 , _nUid( nUid )
1758 , _aLocalName( rLocalName )
1759 , _xAttributes( xAttributes )
1761 _pImport->acquire();
1763 if (_pParent)
1765 _pParent->acquire();
1768 //__________________________________________________________________________________________________
1769 ElementBase::~ElementBase()
1770 SAL_THROW( () )
1772 _pImport->release();
1774 if (_pParent)
1776 _pParent->release();
1779 #if OSL_DEBUG_LEVEL > 1
1780 ::rtl::OString aStr( ::rtl::OUStringToOString(
1781 _aLocalName, RTL_TEXTENCODING_ASCII_US ) );
1782 OSL_TRACE( "ElementBase::~ElementBase(): %s\n", aStr.getStr() );
1783 #endif
1786 //##################################################################################################
1788 // XRoot
1791 //______________________________________________________________________________
1792 void DialogImport::startDocument(
1793 Reference< xml::input::XNamespaceMapping > const & xNamespaceMapping )
1794 throw (xml::sax::SAXException, RuntimeException)
1796 XMLNS_DIALOGS_UID = xNamespaceMapping->getUidByUri(
1797 OUSTR(XMLNS_DIALOGS_URI) );
1798 XMLNS_SCRIPT_UID = xNamespaceMapping->getUidByUri(
1799 OUSTR(XMLNS_SCRIPT_URI) );
1801 //__________________________________________________________________________________________________
1802 void DialogImport::endDocument()
1803 throw (xml::sax::SAXException, RuntimeException)
1805 // ignored
1807 //__________________________________________________________________________________________________
1808 void DialogImport::processingInstruction(
1809 OUString const & /*rTarget*/, OUString const & /*rData*/ )
1810 throw (xml::sax::SAXException, RuntimeException)
1812 // ignored for now: xxx todo
1814 //__________________________________________________________________________________________________
1815 void DialogImport::setDocumentLocator(
1816 Reference< xml::sax::XLocator > const & /*xLocator*/ )
1817 throw (xml::sax::SAXException, RuntimeException)
1819 // ignored for now: xxx todo
1821 //__________________________________________________________________________________________________
1822 Reference< xml::input::XElement > DialogImport::startRootElement(
1823 sal_Int32 nUid, OUString const & rLocalName,
1824 Reference< xml::input::XAttributes > const & xAttributes )
1825 throw (xml::sax::SAXException, RuntimeException)
1827 if (XMLNS_DIALOGS_UID != nUid)
1829 throw xml::sax::SAXException(
1830 OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
1831 Reference< XInterface >(), Any() );
1833 // window
1834 else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("window") ))
1836 return new WindowElement( rLocalName, xAttributes, 0, this );
1838 else
1840 throw xml::sax::SAXException(
1841 OUString( RTL_CONSTASCII_USTRINGPARAM(
1842 "illegal root element (expected window) given: ") ) +
1843 rLocalName, Reference< XInterface >(), Any() );
1846 //__________________________________________________________________________________________________
1847 DialogImport::~DialogImport()
1848 SAL_THROW( () )
1850 #if OSL_DEBUG_LEVEL > 1
1851 OSL_TRACE( "DialogImport::~DialogImport().\n" );
1852 #endif
1854 //__________________________________________________________________________________________________
1855 Reference< util::XNumberFormatsSupplier > const & DialogImport::getNumberFormatsSupplier()
1857 if (! _xSupplier.is())
1859 Reference< XComponentContext > xContext( getComponentContext() );
1860 Reference< util::XNumberFormatsSupplier > xSupplier(
1861 xContext->getServiceManager()->createInstanceWithContext(
1862 OUString( RTL_CONSTASCII_USTRINGPARAM(
1863 "com.sun.star.util.NumberFormatsSupplier") ),
1864 xContext ), UNO_QUERY );
1866 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
1867 if (! _xSupplier.is())
1869 _xSupplier = xSupplier;
1872 return _xSupplier;
1875 //__________________________________________________________________________________________________
1876 void DialogImport::addStyle(
1877 OUString const & rStyleId,
1878 Reference< xml::input::XElement > const & xStyle )
1879 SAL_THROW( () )
1881 _styleNames.push_back( rStyleId );
1882 _styles.push_back( xStyle );
1884 //__________________________________________________________________________________________________
1885 Reference< xml::input::XElement > DialogImport::getStyle(
1886 OUString const & rStyleId ) const
1887 SAL_THROW( () )
1889 for ( size_t nPos = 0; nPos < _styleNames.size(); ++nPos )
1891 if (_styleNames[ nPos ] == rStyleId)
1893 return _styles[ nPos ];
1896 return 0;
1898 //__________________________________________________________________________________________________
1899 Reference< script::XLibraryContainer > DialogImport::getScriptLibraryContainer()
1901 if( !_xScriptLibraryContainer.is() )
1905 Reference< document::XStorageBasedDocument > xStorageDoc( _xDoc, UNO_QUERY );
1906 if( xStorageDoc.is() )
1907 _xScriptLibraryContainer.set(
1908 script::DocumentScriptLibraryContainer::create( comphelper_getProcessComponentContext(), xStorageDoc ),
1909 UNO_QUERY );
1911 catch( const Exception& )
1916 return _xScriptLibraryContainer;
1919 //##################################################################################################
1921 //==================================================================================================
1922 Reference< xml::sax::XDocumentHandler > SAL_CALL importDialogModel(
1923 Reference< container::XNameContainer > const & xDialogModel,
1924 Reference< XComponentContext > const & xContext,
1925 Reference< XModel > const & xDocument )
1926 SAL_THROW( (Exception) )
1928 DialogImport* pImport = new DialogImport( xContext, xDialogModel, xDocument );
1929 uno::Reference< script::XVBACompat > xVBAModeSource( pImport->getScriptLibraryContainer(), uno::UNO_QUERY );
1931 uno::Reference< beans::XPropertySet > xDlgProps( xDialogModel, uno::UNO_QUERY );
1932 if ( xVBAModeSource.is() && xDlgProps.is() && xVBAModeSource->getVBACompatModeOn() )
1933 xDlgProps->setPropertyValue( OUSTR("VBAForm"), uno::makeAny( sal_True ) );
1934 return ::xmlscript::createDocumentHandler(
1935 static_cast< xml::input::XRoot * >( pImport ) );