1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #include "common.hxx"
25 #include "misc.hxx"
26 #include <xmlscript/xmldlg_imexp.hxx>
27 #include <xmlscript/xmllib_imexp.hxx>
28 #include <xmlscript/xmlmod_imexp.hxx>
29 #include <cppuhelper/implbase1.hxx>
30 #include <com/sun/star/uno/XComponentContext.hpp>
31 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
32 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
33 #include <com/sun/star/container/XNameContainer.hpp>
34 #include <com/sun/star/beans/XPropertySet.hpp>
35 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
36 #include <com/sun/star/awt/XControlModel.hpp>
37 #include <com/sun/star/awt/FontDescriptor.hpp>
38 #include <com/sun/star/awt/FontEmphasisMark.hpp>
39 #include <com/sun/star/awt/FontRelief.hpp>
40 #include <com/sun/star/xml/input/XRoot.hpp>
41 #include <vector>
42 
43 
44 namespace css = ::com::sun::star;
45 
46 namespace xmlscript
47 {
48 
49 //
50 inline sal_Int32 toInt32( ::rtl::OUString const & rStr ) SAL_THROW( () )
51 {
52     sal_Int32 nVal;
53     if (rStr.getLength() > 2 && rStr[ 0 ] == '0' && rStr[ 1 ] == 'x')
54         nVal = rStr.copy( 2 ).toInt32( 16 );
55     else
56         nVal = rStr.toInt32();
57     return nVal;
58 }
59 
60 inline bool getBoolAttr(
61     sal_Bool * pRet, ::rtl::OUString const & rAttrName,
62     css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
63     sal_Int32 nUid )
64 {
65     ::rtl::OUString aValue( xAttributes->getValueByUidName( nUid, rAttrName ) );
66     if (aValue.getLength())
67     {
68         if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("true") ))
69         {
70             *pRet = sal_True;
71             return true;
72         }
73         else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("false") ))
74         {
75             *pRet = sal_False;
76             return true;
77         }
78         else
79         {
80             throw css::xml::sax::SAXException(
81                 rAttrName + OUSTR(": no boolean value (true|false)!"),
82                 css::uno::Reference<css::uno::XInterface>(), css::uno::Any() );
83         }
84     }
85     return false;
86 }
87 
88 inline bool getStringAttr(
89     ::rtl::OUString * pRet, ::rtl::OUString const & rAttrName,
90     css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
91     sal_Int32 nUid )
92 {
93     *pRet = xAttributes->getValueByUidName( nUid, rAttrName );
94     return (pRet->getLength() > 0);
95 }
96 
97 inline bool getLongAttr(
98     sal_Int32 * pRet, ::rtl::OUString const & rAttrName,
99     css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
100     sal_Int32 nUid )
101 {
102     ::rtl::OUString aValue( xAttributes->getValueByUidName( nUid, rAttrName ) );
103     if (aValue.getLength())
104     {
105         *pRet = toInt32( aValue );
106         return true;
107     }
108     return false;
109 }
110 
111 class ImportContext;
112 
113 //==============================================================================
114 struct DialogImport
115     : public ::cppu::WeakImplHelper1< css::xml::input::XRoot >
116 {
117     friend class ImportContext;
118 
119     css::uno::Reference< css::uno::XComponentContext > _xContext;
120     css::uno::Reference< css::util::XNumberFormatsSupplier > _xSupplier;
121 
122     ::std::vector< ::rtl::OUString > _styleNames;
123     ::std::vector< css::uno::Reference< css::xml::input::XElement > > _styles;
124 
125     css::uno::Reference< css::container::XNameContainer > _xDialogModel;
126     css::uno::Reference< css::lang::XMultiServiceFactory > _xDialogModelFactory;
127 
128     sal_Int32 XMLNS_DIALOGS_UID, XMLNS_SCRIPT_UID;
129 
130 public:
131     inline bool isEventElement(
132         sal_Int32 nUid, ::rtl::OUString const & rLocalName )
133     {
134         return ((XMLNS_SCRIPT_UID == nUid &&
135                  (rLocalName.equalsAsciiL(
136                      RTL_CONSTASCII_STRINGPARAM("event") ) ||
137                   rLocalName.equalsAsciiL(
138                       RTL_CONSTASCII_STRINGPARAM("listener-event") ))) ||
139                 (XMLNS_DIALOGS_UID == nUid &&
140                  rLocalName.equalsAsciiL(
141                      RTL_CONSTASCII_STRINGPARAM("event") )));
142     }
143 
144     void addStyle(
145         ::rtl::OUString const & rStyleId,
146         css::uno::Reference< css::xml::input::XElement > const & xStyle )
147         SAL_THROW( () );
148     css::uno::Reference< css::xml::input::XElement > getStyle(
149         ::rtl::OUString const & rStyleId ) const
150         SAL_THROW( () );
151 
152     inline css::uno::Reference< css::uno::XComponentContext >
153     const & getComponentContext() SAL_THROW( () ) { return _xContext; }
154     css::uno::Reference< css::util::XNumberFormatsSupplier >
155     const & getNumberFormatsSupplier();
156 
157     inline DialogImport(
158         css::uno::Reference<css::uno::XComponentContext> const & xContext,
159         css::uno::Reference<css::container::XNameContainer>
160         const & xDialogModel )
161         SAL_THROW( () )
162         : _xContext( xContext )
163         , _xDialogModel( xDialogModel )
164         , _xDialogModelFactory( xDialogModel, css::uno::UNO_QUERY_THROW )
165         { OSL_ASSERT( _xDialogModel.is() && _xDialogModelFactory.is() &&
166                       _xContext.is() ); }
167     virtual ~DialogImport()
168         SAL_THROW( () );
169 
170     // XRoot
171     virtual void SAL_CALL startDocument(
172         css::uno::Reference< css::xml::input::XNamespaceMapping >
173         const & xNamespaceMapping )
174         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
175     virtual void SAL_CALL endDocument()
176         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
177     virtual void SAL_CALL processingInstruction(
178         ::rtl::OUString const & rTarget, ::rtl::OUString const & rData )
179         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
180     virtual void SAL_CALL setDocumentLocator(
181         css::uno::Reference< css::xml::sax::XLocator > const & xLocator )
182         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
183     virtual css::uno::Reference< css::xml::input::XElement >
184     SAL_CALL startRootElement(
185         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
186         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
187         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
188 };
189 
190 //==============================================================================
191 class ElementBase
192     : public ::cppu::WeakImplHelper1< css::xml::input::XElement >
193 {
194 protected:
195     DialogImport * _pImport;
196     ElementBase * _pParent;
197 
198     sal_Int32 _nUid;
199     ::rtl::OUString _aLocalName;
200     css::uno::Reference< css::xml::input::XAttributes > _xAttributes;
201 
202 public:
203     ElementBase(
204         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
205         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
206         ElementBase * pParent, DialogImport * pImport )
207         SAL_THROW( () );
208     virtual ~ElementBase()
209         SAL_THROW( () );
210 
211     // XElement
212     virtual css::uno::Reference<css::xml::input::XElement> SAL_CALL getParent()
213         throw (css::uno::RuntimeException);
214     virtual ::rtl::OUString SAL_CALL getLocalName()
215         throw (css::uno::RuntimeException);
216     virtual sal_Int32 SAL_CALL getUid()
217         throw (css::uno::RuntimeException);
218     virtual css::uno::Reference< css::xml::input::XAttributes >
219     SAL_CALL getAttributes() throw (css::uno::RuntimeException);
220     virtual void SAL_CALL ignorableWhitespace(
221         ::rtl::OUString const & rWhitespaces )
222         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
223     virtual void SAL_CALL characters( ::rtl::OUString const & rChars )
224         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
225     virtual void SAL_CALL processingInstruction(
226         ::rtl::OUString const & Target, ::rtl::OUString const & Data )
227         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
228     virtual void SAL_CALL endElement()
229         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
230     virtual css::uno::Reference< css::xml::input::XElement >
231     SAL_CALL startChildElement(
232         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
233         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
234         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
235 };
236 
237 //==============================================================================
238 class StylesElement
239     : public ElementBase
240 {
241 public:
242     virtual css::uno::Reference< css::xml::input::XElement >
243     SAL_CALL startChildElement(
244         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
245         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
246         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
247 
248     inline StylesElement(
249         ::rtl::OUString const & rLocalName,
250         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
251         ElementBase * pParent, DialogImport * pImport )
252         SAL_THROW( () )
253         : ElementBase( pImport->XMLNS_DIALOGS_UID,
254                        rLocalName, xAttributes, pParent, pImport )
255         {}
256 };
257 
258 //==============================================================================
259 class StyleElement
260     : public ElementBase
261 {
262     sal_Int32 _backgroundColor;
263     sal_Int32 _textColor;
264     sal_Int32 _textLineColor;
265     sal_Int16 _border;
266     sal_Int32 _borderColor;
267     css::awt::FontDescriptor _descr;
268     sal_Int16 _fontRelief;
269     sal_Int16 _fontEmphasisMark;
270     sal_Int32 _fillColor;
271     sal_Int16 _visualEffect;
272 
273     // current highest mask: 0x40
274     short _inited, _hasValue;
275 
276     void setFontProperties(
277         css::uno::Reference< css::beans::XPropertySet > const & xProps );
278 
279 public:
280     virtual css::uno::Reference< css::xml::input::XElement >
281     SAL_CALL startChildElement(
282         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
283         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
284         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
285     virtual void SAL_CALL endElement()
286         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
287 
288     bool importTextColorStyle(
289         css::uno::Reference< css::beans::XPropertySet > const & xProps );
290     bool importTextLineColorStyle(
291         css::uno::Reference< css::beans::XPropertySet > const & xProps );
292     bool importFillColorStyle(
293         css::uno::Reference< css::beans::XPropertySet > const & xProps );
294     bool importBackgroundColorStyle(
295         css::uno::Reference< css::beans::XPropertySet > const & xProps );
296     bool importFontStyle(
297         css::uno::Reference< css::beans::XPropertySet > const & xProps );
298     bool importBorderStyle(
299         css::uno::Reference< css::beans::XPropertySet > const & xProps );
300     bool importVisualEffectStyle(
301         css::uno::Reference< css::beans::XPropertySet > const & xProps );
302 
303     inline StyleElement(
304         ::rtl::OUString const & rLocalName,
305         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
306         ElementBase * pParent, DialogImport * pImport )
307         SAL_THROW( () )
308         : ElementBase( pImport->XMLNS_DIALOGS_UID,
309                        rLocalName, xAttributes, pParent, pImport )
310         , _fontRelief( css::awt::FontRelief::NONE )
311         , _fontEmphasisMark( css::awt::FontEmphasisMark::NONE )
312         , _inited( 0 )
313         , _hasValue( 0 )
314         {}
315 };
316 
317 //==============================================================================
318 class MenuPopupElement
319     : public ElementBase
320 {
321     ::std::vector< ::rtl::OUString > _itemValues;
322     ::std::vector< sal_Int16 > _itemSelected;
323 public:
324     css::uno::Sequence< ::rtl::OUString > getItemValues();
325     css::uno::Sequence< sal_Int16 > getSelectedItems();
326 
327     virtual css::uno::Reference< css::xml::input::XElement >
328     SAL_CALL startChildElement(
329         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
330         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
331         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
332 
333     inline MenuPopupElement(
334         ::rtl::OUString const & rLocalName,
335         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
336         ElementBase * pParent, DialogImport * pImport )
337         SAL_THROW( () )
338         : ElementBase( pImport->XMLNS_DIALOGS_UID,
339                        rLocalName, xAttributes, pParent, pImport )
340         {}
341 };
342 
343 //==============================================================================
344 class ControlElement
345     : public ElementBase
346 {
347     friend class EventElement;
348 
349 protected:
350     sal_Int32 _nBasePosX, _nBasePosY;
351 
352     ::std::vector< css::uno::Reference< css::xml::input::XElement > > _events;
353 
354     ::rtl::OUString getControlId(
355         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
356     css::uno::Reference< css::xml::input::XElement > getStyle(
357         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
358 public:
359     ::std::vector<css::uno::Reference< css::xml::input::XElement> > *getEvents()
360         SAL_THROW( () ) { return &_events; }
361 
362     ControlElement(
363         ::rtl::OUString const & rLocalName,
364         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
365         ElementBase * pParent, DialogImport * pImport )
366         SAL_THROW( () );
367 };
368 
369 //==============================================================================
370 class ImportContext
371 {
372 protected:
373     DialogImport * _pImport;
374     css::uno::Reference< css::beans::XPropertySet > _xControlModel;
375     ::rtl::OUString _aId;
376 
377 public:
378     inline ImportContext(
379         DialogImport * pImport,
380         css::uno::Reference< css::beans::XPropertySet > const & xControlModel_,
381         ::rtl::OUString const & id )
382         : _pImport( pImport ),
383           _xControlModel( xControlModel_ ),
384           _aId( id )
385         { OSL_ASSERT( _xControlModel.is() ); }
386 
387     inline css::uno::Reference< css::beans::XPropertySet > getControlModel()
388         { return _xControlModel; }
389 
390     void importDefaults(
391         sal_Int32 nBaseX, sal_Int32 nBaseY,
392         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
393         bool supportPrintable = true );
394     void importEvents(
395         ::std::vector< css::uno::Reference< css::xml::input::XElement > >
396         const & rEvents );
397 
398     bool importStringProperty(
399         ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
400         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
401     bool importDoubleProperty(
402         ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
403         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
404     bool importBooleanProperty(
405         ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
406         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
407     bool importShortProperty(
408         ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
409         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
410     bool importLongProperty(
411         ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
412         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
413     bool importLongProperty(
414         sal_Int32 nOffset,
415         ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
416         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
417     bool importHexLongProperty(
418         ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
419         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
420     bool importAlignProperty(
421         ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
422         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
423     bool importVerticalAlignProperty(
424         ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
425         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
426     bool importImageAlignProperty(
427         ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
428         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
429     bool importImagePositionProperty(
430         ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
431         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
432     bool importDateFormatProperty(
433         ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
434         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
435     bool importTimeFormatProperty(
436         ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
437         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
438     bool importOrientationProperty(
439         ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
440         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
441     bool importButtonTypeProperty(
442         ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
443         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
444     bool importLineEndFormatProperty(
445         ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
446         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
447 	bool importSelectionTypeProperty(
448         ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
449         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
450 };
451 
452 //==============================================================================
453 class ControlImportContext : public ImportContext
454 {
455 public:
456     inline ControlImportContext(
457         DialogImport * pImport,
458         ::rtl::OUString const & rId, ::rtl::OUString const & rControlName )
459         : ImportContext(
460             pImport,
461             css::uno::Reference< css::beans::XPropertySet >(
462                 pImport->_xDialogModelFactory->createInstance( rControlName ),
463                 css::uno::UNO_QUERY_THROW ), rId )
464         {}
465     inline ~ControlImportContext()
466     {
467         _pImport->_xDialogModel->insertByName(
468             _aId, css::uno::makeAny(
469                 css::uno::Reference<css::awt::XControlModel>::query(
470                     _xControlModel ) ) );
471     }
472 };
473 
474 //==============================================================================
475 class WindowElement
476     : public ControlElement
477 {
478 public:
479     virtual css::uno::Reference< css::xml::input::XElement >
480     SAL_CALL startChildElement(
481         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
482         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
483         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
484     virtual void SAL_CALL endElement()
485         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
486 
487     inline WindowElement(
488         ::rtl::OUString const & rLocalName,
489         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
490         ElementBase * pParent, DialogImport * pImport )
491         SAL_THROW( () )
492         : ControlElement( rLocalName, xAttributes, pParent, pImport )
493         {}
494 };
495 
496 //==============================================================================
497 class EventElement
498     : public ElementBase
499 {
500 public:
501     virtual void SAL_CALL endElement()
502         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
503 
504     inline EventElement(
505         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
506         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
507         ElementBase * pParent, DialogImport * pImport )
508         SAL_THROW( () )
509         : ElementBase( nUid, rLocalName, xAttributes, pParent, pImport )
510         {}
511 };
512 
513 //==============================================================================
514 class BulletinBoardElement
515     : public ControlElement
516 {
517 public:
518     virtual css::uno::Reference< css::xml::input::XElement >
519     SAL_CALL startChildElement(
520         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
521         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
522         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
523 
524     BulletinBoardElement(
525         ::rtl::OUString const & rLocalName,
526         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
527         ElementBase * pParent, DialogImport * pImport )
528         SAL_THROW( () );
529 };
530 
531 //==============================================================================
532 class ButtonElement
533     : public ControlElement
534 {
535 public:
536     virtual css::uno::Reference< css::xml::input::XElement >
537     SAL_CALL startChildElement(
538         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
539         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
540         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
541     virtual void SAL_CALL endElement()
542         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
543 
544     inline ButtonElement(
545         ::rtl::OUString const & rLocalName,
546         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
547         ElementBase * pParent, DialogImport * pImport )
548         SAL_THROW( () )
549         : ControlElement( rLocalName, xAttributes, pParent, pImport )
550         {}
551 };
552 
553 //==============================================================================
554 class CheckBoxElement
555     : public ControlElement
556 {
557 public:
558     virtual css::uno::Reference< css::xml::input::XElement >
559     SAL_CALL startChildElement(
560         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
561         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
562         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
563     virtual void SAL_CALL endElement()
564         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
565 
566     inline CheckBoxElement(
567         ::rtl::OUString const & rLocalName,
568         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
569         ElementBase * pParent, DialogImport * pImport )
570         SAL_THROW( () )
571         : ControlElement( rLocalName, xAttributes, pParent, pImport )
572         {}
573 };
574 
575 //==============================================================================
576 class ComboBoxElement
577     : public ControlElement
578 {
579     css::uno::Reference< css::xml::input::XElement > _popup;
580 public:
581     virtual css::uno::Reference< css::xml::input::XElement >
582     SAL_CALL startChildElement(
583         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
584         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
585         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
586     virtual void SAL_CALL endElement()
587         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
588 
589     inline ComboBoxElement(
590         ::rtl::OUString const & rLocalName,
591         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
592         ElementBase * pParent, DialogImport * pImport )
593         SAL_THROW( () )
594         : ControlElement( rLocalName, xAttributes, pParent, pImport )
595         {}
596 };
597 
598 //==============================================================================
599 class MenuListElement
600     : public ControlElement
601 {
602     css::uno::Reference< css::xml::input::XElement > _popup;
603 public:
604     virtual css::uno::Reference< css::xml::input::XElement >
605     SAL_CALL startChildElement(
606         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
607         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
608         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
609     virtual void SAL_CALL endElement()
610         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
611 
612     inline MenuListElement(
613         ::rtl::OUString const & rLocalName,
614         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
615         ElementBase * pParent, DialogImport * pImport )
616         SAL_THROW( () )
617         : ControlElement( rLocalName, xAttributes, pParent, pImport )
618         {}
619 };
620 
621 //==============================================================================
622 class RadioElement
623     : public ControlElement
624 {
625 public:
626     virtual css::uno::Reference< css::xml::input::XElement >
627     SAL_CALL startChildElement(
628         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
629         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
630         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
631 
632     inline RadioElement(
633         ::rtl::OUString const & rLocalName,
634         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
635         ElementBase * pParent, DialogImport * pImport )
636         SAL_THROW( () )
637         : ControlElement( rLocalName, xAttributes, pParent, pImport )
638         {}
639 };
640 
641 //==============================================================================
642 class RadioGroupElement
643     : public ControlElement
644 {
645     ::std::vector< css::uno::Reference< css::xml::input::XElement > > _radios;
646 public:
647     virtual css::uno::Reference< css::xml::input::XElement >
648     SAL_CALL startChildElement(
649         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
650         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
651         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
652     void SAL_CALL endElement()
653         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
654 
655     inline RadioGroupElement(
656         ::rtl::OUString const & rLocalName,
657         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
658         ElementBase * pParent, DialogImport * pImport )
659         SAL_THROW( () )
660         : ControlElement( rLocalName, xAttributes, pParent, pImport )
661         {}
662 };
663 
664 //==============================================================================
665 class TitledBoxElement
666     : public BulletinBoardElement
667 {
668     ::rtl::OUString _label;
669     ::std::vector< css::uno::Reference< css::xml::input::XElement > > _radios;
670 public:
671     virtual css::uno::Reference< css::xml::input::XElement >
672     SAL_CALL startChildElement(
673         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
674         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
675         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
676     virtual void SAL_CALL endElement()
677         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
678 
679     inline TitledBoxElement(
680         ::rtl::OUString const & rLocalName,
681         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
682         ElementBase * pParent, DialogImport * pImport )
683         SAL_THROW( () )
684         : BulletinBoardElement( rLocalName, xAttributes, pParent, pImport )
685         {}
686 };
687 
688 //==============================================================================
689 class TextElement
690     : public ControlElement
691 {
692 public:
693     virtual css::uno::Reference< css::xml::input::XElement >
694     SAL_CALL startChildElement(
695         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
696         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
697         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
698     virtual void SAL_CALL endElement()
699         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
700 
701     inline TextElement(
702         ::rtl::OUString const & rLocalName,
703         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
704         ElementBase * pParent, DialogImport * pImport )
705         SAL_THROW( () )
706         : ControlElement( rLocalName, xAttributes, pParent, pImport )
707         {}
708 };
709 //==============================================================================
710 class FixedHyperLinkElement
711     : public ControlElement
712 {
713 public:
714     virtual css::uno::Reference< css::xml::input::XElement >
715     SAL_CALL startChildElement(
716         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
717         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
718         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
719     virtual void SAL_CALL endElement()
720         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
721 
722     inline FixedHyperLinkElement(
723         ::rtl::OUString const & rLocalName,
724         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
725         ElementBase * pParent, DialogImport * pImport )
726         SAL_THROW( () )
727         : ControlElement( rLocalName, xAttributes, pParent, pImport )
728         {}
729 };
730 //==============================================================================
731 class TextFieldElement
732     : public ControlElement
733 {
734 public:
735     virtual css::uno::Reference< css::xml::input::XElement >
736     SAL_CALL startChildElement(
737         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
738         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
739         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
740     virtual void SAL_CALL endElement()
741         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
742 
743     inline TextFieldElement(
744         ::rtl::OUString const & rLocalName,
745         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
746         ElementBase * pParent, DialogImport * pImport )
747         SAL_THROW( () )
748         : ControlElement( rLocalName, xAttributes, pParent, pImport )
749         {}
750 };
751 
752 //==============================================================================
753 class ImageControlElement
754     : public ControlElement
755 {
756 public:
757     virtual css::uno::Reference< css::xml::input::XElement >
758     SAL_CALL startChildElement(
759         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
760         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
761         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
762     virtual void SAL_CALL endElement()
763         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
764 
765     inline ImageControlElement(
766         ::rtl::OUString const & rLocalName,
767         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
768         ElementBase * pParent, DialogImport * pImport )
769         SAL_THROW( () )
770         : ControlElement( rLocalName, xAttributes, pParent, pImport )
771         {}
772 };
773 
774 //==============================================================================
775 class FileControlElement
776     : public ControlElement
777 {
778 public:
779     virtual css::uno::Reference< css::xml::input::XElement >
780     SAL_CALL startChildElement(
781         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
782         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
783         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
784     virtual void SAL_CALL endElement()
785         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
786 
787     inline FileControlElement(
788         ::rtl::OUString const & rLocalName,
789         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
790         ElementBase * pParent, DialogImport * pImport )
791         SAL_THROW( () )
792         : ControlElement( rLocalName, xAttributes, pParent, pImport )
793         {}
794 };
795 
796 //==============================================================================
797 class TreeControlElement
798     : public ControlElement
799 {
800 public:
801     virtual css::uno::Reference< css::xml::input::XElement >
802     SAL_CALL startChildElement(
803         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
804         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
805         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
806     virtual void SAL_CALL endElement()
807         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
808 
809     inline TreeControlElement(
810         ::rtl::OUString const & rLocalName,
811         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
812         ElementBase * pParent, DialogImport * pImport )
813         SAL_THROW( () )
814         : ControlElement( rLocalName, xAttributes, pParent, pImport )
815         {}
816 };
817 
818 //==============================================================================
819 class CurrencyFieldElement
820     : public ControlElement
821 {
822 public:
823     virtual css::uno::Reference< css::xml::input::XElement >
824     SAL_CALL startChildElement(
825         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
826         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
827         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
828     virtual void SAL_CALL endElement()
829         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
830 
831     inline CurrencyFieldElement(
832         ::rtl::OUString const & rLocalName,
833         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
834         ElementBase * pParent, DialogImport * pImport )
835         SAL_THROW( () )
836         : ControlElement( rLocalName, xAttributes, pParent, pImport )
837         {}
838 };
839 
840 //==============================================================================
841 class DateFieldElement
842     : public ControlElement
843 {
844 public:
845     virtual css::uno::Reference< css::xml::input::XElement >
846     SAL_CALL startChildElement(
847         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
848         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
849         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
850     virtual void SAL_CALL endElement()
851         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
852 
853     inline DateFieldElement(
854         ::rtl::OUString const & rLocalName,
855         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
856         ElementBase * pParent, DialogImport * pImport )
857         SAL_THROW( () )
858         : ControlElement( rLocalName, xAttributes, pParent, pImport )
859         {}
860 };
861 
862 //==============================================================================
863 class NumericFieldElement
864     : public ControlElement
865 {
866 public:
867     virtual css::uno::Reference< css::xml::input::XElement >
868     SAL_CALL startChildElement(
869         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
870         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
871         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
872     virtual void SAL_CALL endElement()
873         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
874 
875     inline NumericFieldElement(
876         ::rtl::OUString const & rLocalName,
877         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
878         ElementBase * pParent, DialogImport * pImport )
879         SAL_THROW( () )
880         : ControlElement( rLocalName, xAttributes, pParent, pImport )
881         {}
882 };
883 
884 //==============================================================================
885 class TimeFieldElement
886     : public ControlElement
887 {
888 public:
889     virtual css::uno::Reference< css::xml::input::XElement >
890     SAL_CALL startChildElement(
891         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
892         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
893         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
894     virtual void SAL_CALL endElement()
895         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
896 
897     inline TimeFieldElement(
898         ::rtl::OUString const & rLocalName,
899         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
900         ElementBase * pParent, DialogImport * pImport )
901         SAL_THROW( () )
902         : ControlElement( rLocalName, xAttributes, pParent, pImport )
903         {}
904 };
905 
906 //==============================================================================
907 class PatternFieldElement
908     : public ControlElement
909 {
910 public:
911     virtual css::uno::Reference< css::xml::input::XElement >
912     SAL_CALL startChildElement(
913         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
914         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
915         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
916     virtual void SAL_CALL endElement()
917         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
918 
919     inline PatternFieldElement(
920         ::rtl::OUString const & rLocalName,
921         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
922         ElementBase * pParent, DialogImport * pImport )
923         SAL_THROW( () )
924         : ControlElement( rLocalName, xAttributes, pParent, pImport )
925         {}
926 };
927 
928 //==============================================================================
929 class FormattedFieldElement
930     : public ControlElement
931 {
932 public:
933     virtual css::uno::Reference< css::xml::input::XElement >
934     SAL_CALL startChildElement(
935         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
936         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
937         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
938     virtual void SAL_CALL endElement()
939         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
940 
941     inline FormattedFieldElement(
942         ::rtl::OUString const & rLocalName,
943         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
944         ElementBase * pParent, DialogImport * pImport )
945         SAL_THROW( () )
946         : ControlElement( rLocalName, xAttributes, pParent, pImport )
947         {}
948 };
949 
950 //==============================================================================
951 class FixedLineElement
952     : public ControlElement
953 {
954 public:
955     virtual css::uno::Reference< css::xml::input::XElement >
956     SAL_CALL startChildElement(
957         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
958         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
959         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
960     virtual void SAL_CALL endElement()
961         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
962 
963     inline FixedLineElement(
964         ::rtl::OUString const & rLocalName,
965         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
966         ElementBase * pParent, DialogImport * pImport )
967         SAL_THROW( () )
968         : ControlElement( rLocalName, xAttributes, pParent, pImport )
969         {}
970 };
971 
972 //==============================================================================
973 class ScrollBarElement
974     : public ControlElement
975 {
976 public:
977     virtual css::uno::Reference< css::xml::input::XElement >
978     SAL_CALL startChildElement(
979         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
980         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
981         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
982     virtual void SAL_CALL endElement()
983         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
984 
985     inline ScrollBarElement(
986         ::rtl::OUString const & rLocalName,
987         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
988         ElementBase * pParent, DialogImport * pImport )
989         SAL_THROW( () )
990         : ControlElement( rLocalName, xAttributes, pParent, pImport )
991         {}
992 };
993 
994 //==============================================================================
995 class ProgressBarElement
996     : public ControlElement
997 {
998 public:
999     virtual css::uno::Reference< css::xml::input::XElement >
1000     SAL_CALL startChildElement(
1001         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
1002         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
1003         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
1004     virtual void SAL_CALL endElement()
1005         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
1006 
1007     inline ProgressBarElement(
1008         ::rtl::OUString const & rLocalName,
1009         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
1010         ElementBase * pParent, DialogImport * pImport )
1011         SAL_THROW( () )
1012         : ControlElement( rLocalName, xAttributes, pParent, pImport )
1013         {}
1014 };
1015 
1016 }
1017