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 //
toInt32(::rtl::OUString const & rStr)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 
getBoolAttr(sal_Bool * pRet,::rtl::OUString const & rAttrName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,sal_Int32 nUid)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 
getStringAttr(::rtl::OUString * pRet,::rtl::OUString const & rAttrName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,sal_Int32 nUid)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 
getLongAttr(sal_Int32 * pRet,::rtl::OUString const & rAttrName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,sal_Int32 nUid)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:
isEventElementxmlscript::DialogImport131     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 >
getComponentContextxmlscript::DialogImport153     const & getComponentContext() SAL_THROW( () ) { return _xContext; }
154     css::uno::Reference< css::util::XNumberFormatsSupplier >
155     const & getNumberFormatsSupplier();
156 
DialogImportxmlscript::DialogImport157     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 
StylesElement(::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)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 
StyleElement(::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)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 
MenuPopupElement(::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)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:
getEvents()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:
ImportContext(DialogImport * pImport,css::uno::Reference<css::beans::XPropertySet> const & xControlModel_,::rtl::OUString const & id)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 
getControlModel()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     bool importImageScaleModeProperty(
451         ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
452         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
453 };
454 
455 //==============================================================================
456 class ControlImportContext : public ImportContext
457 {
458 public:
ControlImportContext(DialogImport * pImport,::rtl::OUString const & rId,::rtl::OUString const & rControlName)459     inline ControlImportContext(
460         DialogImport * pImport,
461         ::rtl::OUString const & rId, ::rtl::OUString const & rControlName )
462         : ImportContext(
463             pImport,
464             css::uno::Reference< css::beans::XPropertySet >(
465                 pImport->_xDialogModelFactory->createInstance( rControlName ),
466                 css::uno::UNO_QUERY_THROW ), rId )
467         {}
~ControlImportContext()468     inline ~ControlImportContext()
469     {
470         _pImport->_xDialogModel->insertByName(
471             _aId, css::uno::makeAny(
472                 css::uno::Reference<css::awt::XControlModel>::query(
473                     _xControlModel ) ) );
474     }
475 };
476 
477 //==============================================================================
478 class WindowElement
479     : public ControlElement
480 {
481 public:
482     virtual css::uno::Reference< css::xml::input::XElement >
483     SAL_CALL startChildElement(
484         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
485         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
486         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
487     virtual void SAL_CALL endElement()
488         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
489 
WindowElement(::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)490     inline WindowElement(
491         ::rtl::OUString const & rLocalName,
492         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
493         ElementBase * pParent, DialogImport * pImport )
494         SAL_THROW( () )
495         : ControlElement( rLocalName, xAttributes, pParent, pImport )
496         {}
497 };
498 
499 //==============================================================================
500 class EventElement
501     : public ElementBase
502 {
503 public:
504     virtual void SAL_CALL endElement()
505         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
506 
EventElement(sal_Int32 nUid,::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)507     inline EventElement(
508         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
509         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
510         ElementBase * pParent, DialogImport * pImport )
511         SAL_THROW( () )
512         : ElementBase( nUid, rLocalName, xAttributes, pParent, pImport )
513         {}
514 };
515 
516 //==============================================================================
517 class BulletinBoardElement
518     : public ControlElement
519 {
520 public:
521     virtual css::uno::Reference< css::xml::input::XElement >
522     SAL_CALL startChildElement(
523         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
524         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
525         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
526 
527     BulletinBoardElement(
528         ::rtl::OUString const & rLocalName,
529         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
530         ElementBase * pParent, DialogImport * pImport )
531         SAL_THROW( () );
532 };
533 
534 //==============================================================================
535 class ButtonElement
536     : public ControlElement
537 {
538 public:
539     virtual css::uno::Reference< css::xml::input::XElement >
540     SAL_CALL startChildElement(
541         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
542         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
543         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
544     virtual void SAL_CALL endElement()
545         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
546 
ButtonElement(::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)547     inline ButtonElement(
548         ::rtl::OUString const & rLocalName,
549         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
550         ElementBase * pParent, DialogImport * pImport )
551         SAL_THROW( () )
552         : ControlElement( rLocalName, xAttributes, pParent, pImport )
553         {}
554 };
555 
556 //==============================================================================
557 class CheckBoxElement
558     : public ControlElement
559 {
560 public:
561     virtual css::uno::Reference< css::xml::input::XElement >
562     SAL_CALL startChildElement(
563         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
564         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
565         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
566     virtual void SAL_CALL endElement()
567         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
568 
CheckBoxElement(::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)569     inline CheckBoxElement(
570         ::rtl::OUString const & rLocalName,
571         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
572         ElementBase * pParent, DialogImport * pImport )
573         SAL_THROW( () )
574         : ControlElement( rLocalName, xAttributes, pParent, pImport )
575         {}
576 };
577 
578 //==============================================================================
579 class ComboBoxElement
580     : public ControlElement
581 {
582     css::uno::Reference< css::xml::input::XElement > _popup;
583 public:
584     virtual css::uno::Reference< css::xml::input::XElement >
585     SAL_CALL startChildElement(
586         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
587         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
588         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
589     virtual void SAL_CALL endElement()
590         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
591 
ComboBoxElement(::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)592     inline ComboBoxElement(
593         ::rtl::OUString const & rLocalName,
594         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
595         ElementBase * pParent, DialogImport * pImport )
596         SAL_THROW( () )
597         : ControlElement( rLocalName, xAttributes, pParent, pImport )
598         {}
599 };
600 
601 //==============================================================================
602 class MenuListElement
603     : public ControlElement
604 {
605     css::uno::Reference< css::xml::input::XElement > _popup;
606 public:
607     virtual css::uno::Reference< css::xml::input::XElement >
608     SAL_CALL startChildElement(
609         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
610         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
611         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
612     virtual void SAL_CALL endElement()
613         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
614 
MenuListElement(::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)615     inline MenuListElement(
616         ::rtl::OUString const & rLocalName,
617         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
618         ElementBase * pParent, DialogImport * pImport )
619         SAL_THROW( () )
620         : ControlElement( rLocalName, xAttributes, pParent, pImport )
621         {}
622 };
623 
624 //==============================================================================
625 class RadioElement
626     : public ControlElement
627 {
628 public:
629     virtual css::uno::Reference< css::xml::input::XElement >
630     SAL_CALL startChildElement(
631         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
632         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
633         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
634 
RadioElement(::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)635     inline RadioElement(
636         ::rtl::OUString const & rLocalName,
637         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
638         ElementBase * pParent, DialogImport * pImport )
639         SAL_THROW( () )
640         : ControlElement( rLocalName, xAttributes, pParent, pImport )
641         {}
642 };
643 
644 //==============================================================================
645 class RadioGroupElement
646     : public ControlElement
647 {
648     ::std::vector< css::uno::Reference< css::xml::input::XElement > > _radios;
649 public:
650     virtual css::uno::Reference< css::xml::input::XElement >
651     SAL_CALL startChildElement(
652         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
653         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
654         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
655     void SAL_CALL endElement()
656         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
657 
RadioGroupElement(::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)658     inline RadioGroupElement(
659         ::rtl::OUString const & rLocalName,
660         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
661         ElementBase * pParent, DialogImport * pImport )
662         SAL_THROW( () )
663         : ControlElement( rLocalName, xAttributes, pParent, pImport )
664         {}
665 };
666 
667 //==============================================================================
668 class TitledBoxElement
669     : public BulletinBoardElement
670 {
671     ::rtl::OUString _label;
672     ::std::vector< css::uno::Reference< css::xml::input::XElement > > _radios;
673 public:
674     virtual css::uno::Reference< css::xml::input::XElement >
675     SAL_CALL startChildElement(
676         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
677         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
678         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
679     virtual void SAL_CALL endElement()
680         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
681 
TitledBoxElement(::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)682     inline TitledBoxElement(
683         ::rtl::OUString const & rLocalName,
684         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
685         ElementBase * pParent, DialogImport * pImport )
686         SAL_THROW( () )
687         : BulletinBoardElement( rLocalName, xAttributes, pParent, pImport )
688         {}
689 };
690 
691 //==============================================================================
692 class TextElement
693     : public ControlElement
694 {
695 public:
696     virtual css::uno::Reference< css::xml::input::XElement >
697     SAL_CALL startChildElement(
698         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
699         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
700         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
701     virtual void SAL_CALL endElement()
702         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
703 
TextElement(::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)704     inline TextElement(
705         ::rtl::OUString const & rLocalName,
706         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
707         ElementBase * pParent, DialogImport * pImport )
708         SAL_THROW( () )
709         : ControlElement( rLocalName, xAttributes, pParent, pImport )
710         {}
711 };
712 //==============================================================================
713 class FixedHyperLinkElement
714     : public ControlElement
715 {
716 public:
717     virtual css::uno::Reference< css::xml::input::XElement >
718     SAL_CALL startChildElement(
719         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
720         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
721         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
722     virtual void SAL_CALL endElement()
723         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
724 
FixedHyperLinkElement(::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)725     inline FixedHyperLinkElement(
726         ::rtl::OUString const & rLocalName,
727         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
728         ElementBase * pParent, DialogImport * pImport )
729         SAL_THROW( () )
730         : ControlElement( rLocalName, xAttributes, pParent, pImport )
731         {}
732 };
733 //==============================================================================
734 class TextFieldElement
735     : public ControlElement
736 {
737 public:
738     virtual css::uno::Reference< css::xml::input::XElement >
739     SAL_CALL startChildElement(
740         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
741         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
742         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
743     virtual void SAL_CALL endElement()
744         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
745 
TextFieldElement(::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)746     inline TextFieldElement(
747         ::rtl::OUString const & rLocalName,
748         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
749         ElementBase * pParent, DialogImport * pImport )
750         SAL_THROW( () )
751         : ControlElement( rLocalName, xAttributes, pParent, pImport )
752         {}
753 };
754 
755 //==============================================================================
756 class ImageControlElement
757     : public ControlElement
758 {
759 public:
760     virtual css::uno::Reference< css::xml::input::XElement >
761     SAL_CALL startChildElement(
762         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
763         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
764         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
765     virtual void SAL_CALL endElement()
766         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
767 
ImageControlElement(::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)768     inline ImageControlElement(
769         ::rtl::OUString const & rLocalName,
770         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
771         ElementBase * pParent, DialogImport * pImport )
772         SAL_THROW( () )
773         : ControlElement( rLocalName, xAttributes, pParent, pImport )
774         {}
775 };
776 
777 //==============================================================================
778 class FileControlElement
779     : public ControlElement
780 {
781 public:
782     virtual css::uno::Reference< css::xml::input::XElement >
783     SAL_CALL startChildElement(
784         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
785         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
786         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
787     virtual void SAL_CALL endElement()
788         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
789 
FileControlElement(::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)790     inline FileControlElement(
791         ::rtl::OUString const & rLocalName,
792         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
793         ElementBase * pParent, DialogImport * pImport )
794         SAL_THROW( () )
795         : ControlElement( rLocalName, xAttributes, pParent, pImport )
796         {}
797 };
798 
799 //==============================================================================
800 class TreeControlElement
801     : public ControlElement
802 {
803 public:
804     virtual css::uno::Reference< css::xml::input::XElement >
805     SAL_CALL startChildElement(
806         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
807         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
808         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
809     virtual void SAL_CALL endElement()
810         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
811 
TreeControlElement(::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)812     inline TreeControlElement(
813         ::rtl::OUString const & rLocalName,
814         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
815         ElementBase * pParent, DialogImport * pImport )
816         SAL_THROW( () )
817         : ControlElement( rLocalName, xAttributes, pParent, pImport )
818         {}
819 };
820 
821 //==============================================================================
822 class CurrencyFieldElement
823     : public ControlElement
824 {
825 public:
826     virtual css::uno::Reference< css::xml::input::XElement >
827     SAL_CALL startChildElement(
828         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
829         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
830         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
831     virtual void SAL_CALL endElement()
832         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
833 
CurrencyFieldElement(::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)834     inline CurrencyFieldElement(
835         ::rtl::OUString const & rLocalName,
836         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
837         ElementBase * pParent, DialogImport * pImport )
838         SAL_THROW( () )
839         : ControlElement( rLocalName, xAttributes, pParent, pImport )
840         {}
841 };
842 
843 //==============================================================================
844 class DateFieldElement
845     : public ControlElement
846 {
847 public:
848     virtual css::uno::Reference< css::xml::input::XElement >
849     SAL_CALL startChildElement(
850         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
851         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
852         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
853     virtual void SAL_CALL endElement()
854         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
855 
DateFieldElement(::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)856     inline DateFieldElement(
857         ::rtl::OUString const & rLocalName,
858         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
859         ElementBase * pParent, DialogImport * pImport )
860         SAL_THROW( () )
861         : ControlElement( rLocalName, xAttributes, pParent, pImport )
862         {}
863 };
864 
865 //==============================================================================
866 class NumericFieldElement
867     : public ControlElement
868 {
869 public:
870     virtual css::uno::Reference< css::xml::input::XElement >
871     SAL_CALL startChildElement(
872         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
873         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
874         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
875     virtual void SAL_CALL endElement()
876         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
877 
NumericFieldElement(::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)878     inline NumericFieldElement(
879         ::rtl::OUString const & rLocalName,
880         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
881         ElementBase * pParent, DialogImport * pImport )
882         SAL_THROW( () )
883         : ControlElement( rLocalName, xAttributes, pParent, pImport )
884         {}
885 };
886 
887 //==============================================================================
888 class TimeFieldElement
889     : public ControlElement
890 {
891 public:
892     virtual css::uno::Reference< css::xml::input::XElement >
893     SAL_CALL startChildElement(
894         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
895         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
896         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
897     virtual void SAL_CALL endElement()
898         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
899 
TimeFieldElement(::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)900     inline TimeFieldElement(
901         ::rtl::OUString const & rLocalName,
902         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
903         ElementBase * pParent, DialogImport * pImport )
904         SAL_THROW( () )
905         : ControlElement( rLocalName, xAttributes, pParent, pImport )
906         {}
907 };
908 
909 //==============================================================================
910 class PatternFieldElement
911     : public ControlElement
912 {
913 public:
914     virtual css::uno::Reference< css::xml::input::XElement >
915     SAL_CALL startChildElement(
916         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
917         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
918         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
919     virtual void SAL_CALL endElement()
920         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
921 
PatternFieldElement(::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)922     inline PatternFieldElement(
923         ::rtl::OUString const & rLocalName,
924         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
925         ElementBase * pParent, DialogImport * pImport )
926         SAL_THROW( () )
927         : ControlElement( rLocalName, xAttributes, pParent, pImport )
928         {}
929 };
930 
931 //==============================================================================
932 class FormattedFieldElement
933     : public ControlElement
934 {
935 public:
936     virtual css::uno::Reference< css::xml::input::XElement >
937     SAL_CALL startChildElement(
938         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
939         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
940         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
941     virtual void SAL_CALL endElement()
942         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
943 
FormattedFieldElement(::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)944     inline FormattedFieldElement(
945         ::rtl::OUString const & rLocalName,
946         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
947         ElementBase * pParent, DialogImport * pImport )
948         SAL_THROW( () )
949         : ControlElement( rLocalName, xAttributes, pParent, pImport )
950         {}
951 };
952 
953 //==============================================================================
954 class FixedLineElement
955     : public ControlElement
956 {
957 public:
958     virtual css::uno::Reference< css::xml::input::XElement >
959     SAL_CALL startChildElement(
960         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
961         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
962         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
963     virtual void SAL_CALL endElement()
964         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
965 
FixedLineElement(::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)966     inline FixedLineElement(
967         ::rtl::OUString const & rLocalName,
968         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
969         ElementBase * pParent, DialogImport * pImport )
970         SAL_THROW( () )
971         : ControlElement( rLocalName, xAttributes, pParent, pImport )
972         {}
973 };
974 
975 //==============================================================================
976 class ScrollBarElement
977     : public ControlElement
978 {
979 public:
980     virtual css::uno::Reference< css::xml::input::XElement >
981     SAL_CALL startChildElement(
982         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
983         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
984         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
985     virtual void SAL_CALL endElement()
986         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
987 
ScrollBarElement(::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)988     inline ScrollBarElement(
989         ::rtl::OUString const & rLocalName,
990         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
991         ElementBase * pParent, DialogImport * pImport )
992         SAL_THROW( () )
993         : ControlElement( rLocalName, xAttributes, pParent, pImport )
994         {}
995 };
996 
997 //==============================================================================
998 class ProgressBarElement
999     : public ControlElement
1000 {
1001 public:
1002     virtual css::uno::Reference< css::xml::input::XElement >
1003     SAL_CALL startChildElement(
1004         sal_Int32 nUid, ::rtl::OUString const & rLocalName,
1005         css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
1006         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
1007     virtual void SAL_CALL endElement()
1008         throw (css::xml::sax::SAXException, css::uno::RuntimeException);
1009 
ProgressBarElement(::rtl::OUString const & rLocalName,css::uno::Reference<css::xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)1010     inline ProgressBarElement(
1011         ::rtl::OUString const & rLocalName,
1012         css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
1013         ElementBase * pParent, DialogImport * pImport )
1014         SAL_THROW( () )
1015         : ControlElement( rLocalName, xAttributes, pParent, pImport )
1016         {}
1017 };
1018 
1019 }
1020