xref: /trunk/main/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx (revision e1d5bd03a6ea7ac2b26b792c9e2a94e9f347a43b)
1*e1d5bd03SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*e1d5bd03SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*e1d5bd03SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*e1d5bd03SAndrew Rist  * distributed with this work for additional information
6*e1d5bd03SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*e1d5bd03SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*e1d5bd03SAndrew Rist  * "License"); you may not use this file except in compliance
9*e1d5bd03SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*e1d5bd03SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*e1d5bd03SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*e1d5bd03SAndrew Rist  * software distributed under the License is distributed on an
15*e1d5bd03SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*e1d5bd03SAndrew Rist  * KIND, either express or implied.  See the License for the
17*e1d5bd03SAndrew Rist  * specific language governing permissions and limitations
18*e1d5bd03SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*e1d5bd03SAndrew Rist  *************************************************************/
21*e1d5bd03SAndrew Rist 
22*e1d5bd03SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_xmlscript.hxx"
26cdf0e10cSrcweir #include "imp_share.hxx"
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
29cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyState.hpp>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir 
32cdf0e10cSrcweir using namespace ::com::sun::star;
33cdf0e10cSrcweir using namespace ::com::sun::star::uno;
34cdf0e10cSrcweir using ::rtl::OUString;
35cdf0e10cSrcweir 
36cdf0e10cSrcweir namespace xmlscript
37cdf0e10cSrcweir {
38cdf0e10cSrcweir 
39cdf0e10cSrcweir // progessmeter
40cdf0e10cSrcweir //__________________________________________________________________________________________________
41cdf0e10cSrcweir Reference< xml::input::XElement > ProgressBarElement::startChildElement(
42cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
43cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
44cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
45cdf0e10cSrcweir {
46cdf0e10cSrcweir     // event
47cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
48cdf0e10cSrcweir     {
49cdf0e10cSrcweir         return new EventElement(
50cdf0e10cSrcweir             nUid, rLocalName, xAttributes, this, _pImport );
51cdf0e10cSrcweir     }
52cdf0e10cSrcweir     else
53cdf0e10cSrcweir     {
54cdf0e10cSrcweir         throw xml::sax::SAXException(
55cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
56cdf0e10cSrcweir             Reference< XInterface >(), Any() );
57cdf0e10cSrcweir     }
58cdf0e10cSrcweir }
59cdf0e10cSrcweir //__________________________________________________________________________________________________
60cdf0e10cSrcweir void ProgressBarElement::endElement()
61cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
62cdf0e10cSrcweir {
63cdf0e10cSrcweir     ControlImportContext ctx(
64cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
65cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) );
66cdf0e10cSrcweir 
67cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
68cdf0e10cSrcweir     if (xStyle.is())
69cdf0e10cSrcweir     {
70cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
71cdf0e10cSrcweir         Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
72cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xControlModel );
73cdf0e10cSrcweir         pStyle->importBorderStyle( xControlModel );
74cdf0e10cSrcweir         pStyle->importFillColorStyle( xControlModel );
75cdf0e10cSrcweir     }
76cdf0e10cSrcweir 
77cdf0e10cSrcweir     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
78cdf0e10cSrcweir     ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ),
79cdf0e10cSrcweir                             OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
80cdf0e10cSrcweir                             _xAttributes );
81cdf0e10cSrcweir     ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMin") ),
82cdf0e10cSrcweir                             OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
83cdf0e10cSrcweir                             _xAttributes );
84cdf0e10cSrcweir     ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ),
85cdf0e10cSrcweir                             OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
86cdf0e10cSrcweir                             _xAttributes );
87cdf0e10cSrcweir     ctx.importEvents( _events );
88cdf0e10cSrcweir     // avoid ring-reference:
89cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
90cdf0e10cSrcweir     _events.clear();
91cdf0e10cSrcweir }
92cdf0e10cSrcweir 
93cdf0e10cSrcweir //##################################################################################################
94cdf0e10cSrcweir 
95cdf0e10cSrcweir // scrollbar
96cdf0e10cSrcweir //__________________________________________________________________________________________________
97cdf0e10cSrcweir Reference< xml::input::XElement > ScrollBarElement::startChildElement(
98cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
99cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
100cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
101cdf0e10cSrcweir {
102cdf0e10cSrcweir     // event
103cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
104cdf0e10cSrcweir     {
105cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
106cdf0e10cSrcweir     }
107cdf0e10cSrcweir     else
108cdf0e10cSrcweir     {
109cdf0e10cSrcweir         throw xml::sax::SAXException(
110cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
111cdf0e10cSrcweir             Reference< XInterface >(), Any() );
112cdf0e10cSrcweir     }
113cdf0e10cSrcweir }
114cdf0e10cSrcweir //__________________________________________________________________________________________________
115cdf0e10cSrcweir void ScrollBarElement::endElement()
116cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
117cdf0e10cSrcweir {
118cdf0e10cSrcweir     ControlImportContext ctx(
119cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
120cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) );
121cdf0e10cSrcweir 
122cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
123cdf0e10cSrcweir     if (xStyle.is())
124cdf0e10cSrcweir     {
125cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
126cdf0e10cSrcweir         Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
127cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xControlModel );
128cdf0e10cSrcweir         pStyle->importBorderStyle( xControlModel );
129cdf0e10cSrcweir     }
130cdf0e10cSrcweir 
131cdf0e10cSrcweir     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
132cdf0e10cSrcweir     ctx.importOrientationProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
133cdf0e10cSrcweir                                    OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
134cdf0e10cSrcweir                                    _xAttributes );
135cdf0e10cSrcweir     ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("BlockIncrement") ),
136cdf0e10cSrcweir                             OUString( RTL_CONSTASCII_USTRINGPARAM("pageincrement") ),
137cdf0e10cSrcweir                             _xAttributes );
138cdf0e10cSrcweir     ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineIncrement") ),
139cdf0e10cSrcweir                             OUString( RTL_CONSTASCII_USTRINGPARAM("increment") ),
140cdf0e10cSrcweir                             _xAttributes );
141cdf0e10cSrcweir     ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScrollValue") ),
142cdf0e10cSrcweir                             OUString( RTL_CONSTASCII_USTRINGPARAM("curpos") ),
143cdf0e10cSrcweir                             _xAttributes );
144cdf0e10cSrcweir     ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScrollValueMax") ),
145cdf0e10cSrcweir                             OUString( RTL_CONSTASCII_USTRINGPARAM("maxpos") ),
146cdf0e10cSrcweir                             _xAttributes );
147cdf0e10cSrcweir     ctx.importLongProperty( OUSTR("ScrollValueMin"), OUSTR("minpos"),
148cdf0e10cSrcweir                             _xAttributes );
149cdf0e10cSrcweir     ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VisibleSize") ),
150cdf0e10cSrcweir                             OUString( RTL_CONSTASCII_USTRINGPARAM("visible-size") ),
151cdf0e10cSrcweir                             _xAttributes );
152cdf0e10cSrcweir     ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
153cdf0e10cSrcweir                             _xAttributes );
154cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
155cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
156cdf0e10cSrcweir                                _xAttributes );
157cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LiveScroll") ),
158cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("live-scroll") ),
159cdf0e10cSrcweir                                _xAttributes );
160cdf0e10cSrcweir     ctx.importHexLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
161cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("symbol-color") ),
162cdf0e10cSrcweir                                _xAttributes );
163cdf0e10cSrcweir 
164cdf0e10cSrcweir     ctx.importEvents( _events );
165cdf0e10cSrcweir     // avoid ring-reference:
166cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
167cdf0e10cSrcweir     _events.clear();
168cdf0e10cSrcweir }
169cdf0e10cSrcweir 
170cdf0e10cSrcweir //##################################################################################################
171cdf0e10cSrcweir 
172cdf0e10cSrcweir // fixedline
173cdf0e10cSrcweir //__________________________________________________________________________________________________
174cdf0e10cSrcweir Reference< xml::input::XElement > FixedLineElement::startChildElement(
175cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
176cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
177cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
178cdf0e10cSrcweir {
179cdf0e10cSrcweir     // event
180cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
181cdf0e10cSrcweir     {
182cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
183cdf0e10cSrcweir     }
184cdf0e10cSrcweir     else
185cdf0e10cSrcweir     {
186cdf0e10cSrcweir         throw xml::sax::SAXException(
187cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
188cdf0e10cSrcweir             Reference< XInterface >(), Any() );
189cdf0e10cSrcweir     }
190cdf0e10cSrcweir }
191cdf0e10cSrcweir //__________________________________________________________________________________________________
192cdf0e10cSrcweir void FixedLineElement::endElement()
193cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
194cdf0e10cSrcweir {
195cdf0e10cSrcweir     ControlImportContext ctx(
196cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
197cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel") ) );
198cdf0e10cSrcweir 
199cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
200cdf0e10cSrcweir     if (xStyle.is())
201cdf0e10cSrcweir     {
202cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
203cdf0e10cSrcweir         Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
204cdf0e10cSrcweir         pStyle->importTextColorStyle( xControlModel );
205cdf0e10cSrcweir         pStyle->importTextLineColorStyle( xControlModel );
206cdf0e10cSrcweir         pStyle->importFontStyle( xControlModel );
207cdf0e10cSrcweir     }
208cdf0e10cSrcweir 
209cdf0e10cSrcweir     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
210cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
211cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
212cdf0e10cSrcweir                               _xAttributes );
213cdf0e10cSrcweir     ctx.importOrientationProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
214cdf0e10cSrcweir                                    OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
215cdf0e10cSrcweir                                    _xAttributes );
216cdf0e10cSrcweir     ctx.importEvents( _events );
217cdf0e10cSrcweir     // avoid ring-reference:
218cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
219cdf0e10cSrcweir     _events.clear();
220cdf0e10cSrcweir }
221cdf0e10cSrcweir 
222cdf0e10cSrcweir //##################################################################################################
223cdf0e10cSrcweir 
224cdf0e10cSrcweir // patternfield
225cdf0e10cSrcweir //__________________________________________________________________________________________________
226cdf0e10cSrcweir Reference< xml::input::XElement > PatternFieldElement::startChildElement(
227cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
228cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
229cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
230cdf0e10cSrcweir {
231cdf0e10cSrcweir     // event
232cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
233cdf0e10cSrcweir     {
234cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
235cdf0e10cSrcweir     }
236cdf0e10cSrcweir     else
237cdf0e10cSrcweir     {
238cdf0e10cSrcweir         throw xml::sax::SAXException(
239cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
240cdf0e10cSrcweir             Reference< XInterface >(), Any() );
241cdf0e10cSrcweir     }
242cdf0e10cSrcweir }
243cdf0e10cSrcweir //__________________________________________________________________________________________________
244cdf0e10cSrcweir void PatternFieldElement::endElement()
245cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
246cdf0e10cSrcweir {
247cdf0e10cSrcweir     ControlImportContext ctx(
248cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
249cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlPatternFieldModel") ) );
250cdf0e10cSrcweir 
251cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
252cdf0e10cSrcweir     if (xStyle.is())
253cdf0e10cSrcweir     {
254cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
255cdf0e10cSrcweir         Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
256cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xControlModel );
257cdf0e10cSrcweir         pStyle->importTextColorStyle( xControlModel );
258cdf0e10cSrcweir         pStyle->importTextLineColorStyle( xControlModel );
259cdf0e10cSrcweir         pStyle->importBorderStyle( xControlModel );
260cdf0e10cSrcweir         pStyle->importFontStyle( xControlModel );
261cdf0e10cSrcweir     }
262cdf0e10cSrcweir 
263cdf0e10cSrcweir     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
264cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
265cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
266cdf0e10cSrcweir                                _xAttributes );
267cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
268cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
269cdf0e10cSrcweir                                _xAttributes );
270cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
271cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ),
272cdf0e10cSrcweir                                _xAttributes );
273cdf0e10cSrcweir     ctx.importBooleanProperty(
274cdf0e10cSrcweir         OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
275cdf0e10cSrcweir         _xAttributes );
276cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
277cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
278cdf0e10cSrcweir                               _xAttributes );
279cdf0e10cSrcweir     ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
280cdf0e10cSrcweir                              OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ),
281cdf0e10cSrcweir                              _xAttributes );
282cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EditMask") ),
283cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("edit-mask") ),
284cdf0e10cSrcweir                               _xAttributes );
285cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LiteralMask") ),
286cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("literal-mask") ),
287cdf0e10cSrcweir                               _xAttributes );
288cdf0e10cSrcweir     ctx.importEvents( _events );
289cdf0e10cSrcweir     // avoid ring-reference:
290cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
291cdf0e10cSrcweir     _events.clear();
292cdf0e10cSrcweir }
293cdf0e10cSrcweir 
294cdf0e10cSrcweir //##################################################################################################
295cdf0e10cSrcweir 
296cdf0e10cSrcweir // formattedfield
297cdf0e10cSrcweir //__________________________________________________________________________________________________
298cdf0e10cSrcweir Reference< xml::input::XElement > FormattedFieldElement::startChildElement(
299cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
300cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
301cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
302cdf0e10cSrcweir {
303cdf0e10cSrcweir     // event
304cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
305cdf0e10cSrcweir     {
306cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
307cdf0e10cSrcweir     }
308cdf0e10cSrcweir     else
309cdf0e10cSrcweir     {
310cdf0e10cSrcweir         throw xml::sax::SAXException(
311cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
312cdf0e10cSrcweir             Reference< XInterface >(), Any() );
313cdf0e10cSrcweir     }
314cdf0e10cSrcweir }
315cdf0e10cSrcweir //__________________________________________________________________________________________________
316cdf0e10cSrcweir void FormattedFieldElement::endElement()
317cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
318cdf0e10cSrcweir {
319cdf0e10cSrcweir     ControlImportContext ctx(
320cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
321cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFormattedFieldModel") ) );
322cdf0e10cSrcweir 
323cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
324cdf0e10cSrcweir     if (xStyle.is())
325cdf0e10cSrcweir     {
326cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
327cdf0e10cSrcweir         Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
328cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xControlModel );
329cdf0e10cSrcweir         pStyle->importTextColorStyle( xControlModel );
330cdf0e10cSrcweir         pStyle->importTextLineColorStyle( xControlModel );
331cdf0e10cSrcweir         pStyle->importBorderStyle( xControlModel );
332cdf0e10cSrcweir         pStyle->importFontStyle( xControlModel );
333cdf0e10cSrcweir     }
334cdf0e10cSrcweir 
335cdf0e10cSrcweir     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
336cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
337cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
338cdf0e10cSrcweir                                _xAttributes );
339cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
340cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
341cdf0e10cSrcweir                                _xAttributes );
342cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
343cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ),
344cdf0e10cSrcweir                                _xAttributes );
345cdf0e10cSrcweir     ctx.importBooleanProperty(
346cdf0e10cSrcweir         OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
347cdf0e10cSrcweir         _xAttributes );
348cdf0e10cSrcweir     ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
349cdf0e10cSrcweir                              OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
350cdf0e10cSrcweir                              _xAttributes );
351cdf0e10cSrcweir     ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveMin") ),
352cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
353cdf0e10cSrcweir                               _xAttributes );
354cdf0e10cSrcweir     ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveMax") ),
355cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
356cdf0e10cSrcweir                               _xAttributes );
357cdf0e10cSrcweir     ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveValue") ),
358cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
359cdf0e10cSrcweir                               _xAttributes );
360cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
361cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("text") ),
362cdf0e10cSrcweir                               _xAttributes );
363cdf0e10cSrcweir     ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
364cdf0e10cSrcweir                              OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ),
365cdf0e10cSrcweir                              _xAttributes );
366cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
367cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
368cdf0e10cSrcweir                                _xAttributes );
369cdf0e10cSrcweir     if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
370cdf0e10cSrcweir                                 _xAttributes ))
371cdf0e10cSrcweir         ctx.getControlModel()->setPropertyValue(
372cdf0e10cSrcweir             OUSTR("Repeat"), makeAny(true) );
373cdf0e10cSrcweir 
374cdf0e10cSrcweir     OUString sDefault(
375cdf0e10cSrcweir         _xAttributes->getValueByUidName(
376cdf0e10cSrcweir             _pImport->XMLNS_DIALOGS_UID,
377cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("value-default") ) ) );
378cdf0e10cSrcweir     if (sDefault.getLength())
379cdf0e10cSrcweir     {
380cdf0e10cSrcweir         double d = sDefault.toDouble();
381cdf0e10cSrcweir         if (d != 0.0 ||
382cdf0e10cSrcweir             sDefault.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("0") ) ||
383cdf0e10cSrcweir             sDefault.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("0.0") ))
384cdf0e10cSrcweir         {
385cdf0e10cSrcweir             ctx.getControlModel()->setPropertyValue(
386cdf0e10cSrcweir                 OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveDefault") ),
387cdf0e10cSrcweir                 makeAny( d ) );
388cdf0e10cSrcweir         }
389cdf0e10cSrcweir         else // treat as string
390cdf0e10cSrcweir         {
391cdf0e10cSrcweir             ctx.getControlModel()->setPropertyValue(
392cdf0e10cSrcweir                 OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveDefault") ),
393cdf0e10cSrcweir                 makeAny( sDefault ) );
394cdf0e10cSrcweir         }
395cdf0e10cSrcweir     }
396cdf0e10cSrcweir 
397cdf0e10cSrcweir     // format spec
398cdf0e10cSrcweir     ctx.getControlModel()->setPropertyValue(
399cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("FormatsSupplier") ),
400cdf0e10cSrcweir         makeAny( _pImport->getNumberFormatsSupplier() ) );
401cdf0e10cSrcweir 
402cdf0e10cSrcweir     OUString sFormat(
403cdf0e10cSrcweir         _xAttributes->getValueByUidName(
404cdf0e10cSrcweir             _pImport->XMLNS_DIALOGS_UID,
405cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("format-code") ) ) );
406cdf0e10cSrcweir     if (sFormat.getLength())
407cdf0e10cSrcweir     {
408cdf0e10cSrcweir         lang::Locale locale;
409cdf0e10cSrcweir 
410cdf0e10cSrcweir         OUString sLocale(
411cdf0e10cSrcweir             _xAttributes->getValueByUidName(
412cdf0e10cSrcweir                 _pImport->XMLNS_DIALOGS_UID,
413cdf0e10cSrcweir                 OUString( RTL_CONSTASCII_USTRINGPARAM("format-locale") ) ) );
414cdf0e10cSrcweir         if (sLocale.getLength())
415cdf0e10cSrcweir         {
416cdf0e10cSrcweir             // split locale
417cdf0e10cSrcweir             sal_Int32 semi0 = sLocale.indexOf( ';' );
418cdf0e10cSrcweir             if (semi0 < 0) // no semi at all, just try language
419cdf0e10cSrcweir             {
420cdf0e10cSrcweir                 locale.Language = sLocale;
421cdf0e10cSrcweir             }
422cdf0e10cSrcweir             else
423cdf0e10cSrcweir             {
424cdf0e10cSrcweir                 sal_Int32 semi1 = sLocale.indexOf( ';', semi0 +1 );
425cdf0e10cSrcweir                 if (semi1 > semi0) // language;country;variant
426cdf0e10cSrcweir                 {
427cdf0e10cSrcweir                     locale.Language = sLocale.copy( 0, semi0 );
428cdf0e10cSrcweir                     locale.Country = sLocale.copy( semi0 +1, semi1 - semi0 -1 );
429cdf0e10cSrcweir                     locale.Variant = sLocale.copy( semi1 +1 );
430cdf0e10cSrcweir                 }
431cdf0e10cSrcweir                 else // try language;country
432cdf0e10cSrcweir                 {
433cdf0e10cSrcweir                     locale.Language = sLocale.copy( 0, semi0 );
434cdf0e10cSrcweir                     locale.Country = sLocale.copy( semi0 +1 );
435cdf0e10cSrcweir                 }
436cdf0e10cSrcweir             }
437cdf0e10cSrcweir         }
438cdf0e10cSrcweir 
439cdf0e10cSrcweir         try
440cdf0e10cSrcweir         {
441cdf0e10cSrcweir             Reference< util::XNumberFormats > xFormats(
442cdf0e10cSrcweir                 _pImport->getNumberFormatsSupplier()->getNumberFormats() );
443cdf0e10cSrcweir             sal_Int32 nKey = xFormats->queryKey( sFormat, locale, sal_True );
444cdf0e10cSrcweir             if (-1 == nKey)
445cdf0e10cSrcweir             {
446cdf0e10cSrcweir                 nKey = xFormats->addNew( sFormat, locale );
447cdf0e10cSrcweir             }
448cdf0e10cSrcweir             ctx.getControlModel()->setPropertyValue(
449cdf0e10cSrcweir                 OUString( RTL_CONSTASCII_USTRINGPARAM("FormatKey") ), makeAny( nKey ) );
450cdf0e10cSrcweir         }
451cdf0e10cSrcweir         catch (util::MalformedNumberFormatException & exc)
452cdf0e10cSrcweir         {
453cdf0e10cSrcweir             OSL_ENSURE( 0, "### util::MalformedNumberFormatException occured!" );
454cdf0e10cSrcweir             // rethrow
455cdf0e10cSrcweir             throw xml::sax::SAXException( exc.Message, Reference< XInterface >(), Any() );
456cdf0e10cSrcweir         }
457cdf0e10cSrcweir     }
458cdf0e10cSrcweir     ctx.importBooleanProperty(
459cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("TreatAsNumber") ),
460cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("treat-as-number") ),
461cdf0e10cSrcweir         _xAttributes );
462cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
463cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
464cdf0e10cSrcweir                                _xAttributes );
465cdf0e10cSrcweir 
466cdf0e10cSrcweir     ctx.importEvents( _events );
467cdf0e10cSrcweir     // avoid ring-reference:
468cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
469cdf0e10cSrcweir     _events.clear();
470cdf0e10cSrcweir }
471cdf0e10cSrcweir 
472cdf0e10cSrcweir //##################################################################################################
473cdf0e10cSrcweir 
474cdf0e10cSrcweir // timefield
475cdf0e10cSrcweir //__________________________________________________________________________________________________
476cdf0e10cSrcweir Reference< xml::input::XElement > TimeFieldElement::startChildElement(
477cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
478cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
479cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
480cdf0e10cSrcweir {
481cdf0e10cSrcweir     // event
482cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
483cdf0e10cSrcweir     {
484cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
485cdf0e10cSrcweir     }
486cdf0e10cSrcweir     else
487cdf0e10cSrcweir     {
488cdf0e10cSrcweir         throw xml::sax::SAXException(
489cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
490cdf0e10cSrcweir             Reference< XInterface >(), Any() );
491cdf0e10cSrcweir     }
492cdf0e10cSrcweir }
493cdf0e10cSrcweir //__________________________________________________________________________________________________
494cdf0e10cSrcweir void TimeFieldElement::endElement()
495cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
496cdf0e10cSrcweir {
497cdf0e10cSrcweir     ControlImportContext ctx(
498cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
499cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlTimeFieldModel") ) );
500cdf0e10cSrcweir 
501cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
502cdf0e10cSrcweir     if (xStyle.is())
503cdf0e10cSrcweir     {
504cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
505cdf0e10cSrcweir         Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
506cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xControlModel );
507cdf0e10cSrcweir         pStyle->importTextColorStyle( xControlModel );
508cdf0e10cSrcweir         pStyle->importTextLineColorStyle( xControlModel );
509cdf0e10cSrcweir         pStyle->importBorderStyle( xControlModel );
510cdf0e10cSrcweir         pStyle->importFontStyle( xControlModel );
511cdf0e10cSrcweir     }
512cdf0e10cSrcweir 
513cdf0e10cSrcweir     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
514cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
515cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
516cdf0e10cSrcweir                                _xAttributes );
517cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
518cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
519cdf0e10cSrcweir                                _xAttributes );
520cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
521cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ),
522cdf0e10cSrcweir                                _xAttributes );
523cdf0e10cSrcweir     ctx.importBooleanProperty(
524cdf0e10cSrcweir         OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
525cdf0e10cSrcweir         _xAttributes );
526cdf0e10cSrcweir     ctx.importTimeFormatProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeFormat") ),
527cdf0e10cSrcweir                                   OUString( RTL_CONSTASCII_USTRINGPARAM("time-format") ),
528cdf0e10cSrcweir                                   _xAttributes );
529cdf0e10cSrcweir     ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Time") ),
530cdf0e10cSrcweir                             OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
531cdf0e10cSrcweir                             _xAttributes );
532cdf0e10cSrcweir     ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeMin") ),
533cdf0e10cSrcweir                             OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
534cdf0e10cSrcweir                             _xAttributes );
535cdf0e10cSrcweir     ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("TimeMax") ),
536cdf0e10cSrcweir                             OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
537cdf0e10cSrcweir                             _xAttributes );
538cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
539cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
540cdf0e10cSrcweir                                _xAttributes );
541cdf0e10cSrcweir     if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
542cdf0e10cSrcweir                                 _xAttributes ))
543cdf0e10cSrcweir         ctx.getControlModel()->setPropertyValue(
544cdf0e10cSrcweir             OUSTR("Repeat"), makeAny(true) );
545cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
546cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("text") ),
547cdf0e10cSrcweir                               _xAttributes );
548cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
549cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
550cdf0e10cSrcweir                                _xAttributes );
551cdf0e10cSrcweir 
552cdf0e10cSrcweir     ctx.importEvents( _events );
553cdf0e10cSrcweir     // avoid ring-reference:
554cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
555cdf0e10cSrcweir     _events.clear();
556cdf0e10cSrcweir }
557cdf0e10cSrcweir 
558cdf0e10cSrcweir //##################################################################################################
559cdf0e10cSrcweir 
560cdf0e10cSrcweir // numericfield
561cdf0e10cSrcweir //__________________________________________________________________________________________________
562cdf0e10cSrcweir Reference< xml::input::XElement > NumericFieldElement::startChildElement(
563cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
564cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
565cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
566cdf0e10cSrcweir {
567cdf0e10cSrcweir     // event
568cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
569cdf0e10cSrcweir     {
570cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
571cdf0e10cSrcweir     }
572cdf0e10cSrcweir     else
573cdf0e10cSrcweir     {
574cdf0e10cSrcweir         throw xml::sax::SAXException(
575cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
576cdf0e10cSrcweir             Reference< XInterface >(), Any() );
577cdf0e10cSrcweir     }
578cdf0e10cSrcweir }
579cdf0e10cSrcweir //__________________________________________________________________________________________________
580cdf0e10cSrcweir void NumericFieldElement::endElement()
581cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
582cdf0e10cSrcweir {
583cdf0e10cSrcweir     ControlImportContext ctx(
584cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
585cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlNumericFieldModel") ) );
586cdf0e10cSrcweir 
587cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
588cdf0e10cSrcweir     if (xStyle.is())
589cdf0e10cSrcweir     {
590cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
591cdf0e10cSrcweir         Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
592cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xControlModel );
593cdf0e10cSrcweir         pStyle->importTextColorStyle( xControlModel );
594cdf0e10cSrcweir         pStyle->importTextLineColorStyle( xControlModel );
595cdf0e10cSrcweir         pStyle->importBorderStyle( xControlModel );
596cdf0e10cSrcweir         pStyle->importFontStyle( xControlModel );
597cdf0e10cSrcweir     }
598cdf0e10cSrcweir 
599cdf0e10cSrcweir     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
600cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
601cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
602cdf0e10cSrcweir                                _xAttributes );
603cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
604cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
605cdf0e10cSrcweir                                _xAttributes );
606cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
607cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ),
608cdf0e10cSrcweir                                _xAttributes );
609cdf0e10cSrcweir     ctx.importBooleanProperty(
610cdf0e10cSrcweir         OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
611cdf0e10cSrcweir         _xAttributes );
612cdf0e10cSrcweir     ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DecimalAccuracy") ),
613cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("decimal-accuracy") ),
614cdf0e10cSrcweir                                _xAttributes );
615cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowThousandsSeparator") ),
616cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("thousands-separator") ),
617cdf0e10cSrcweir                                _xAttributes );
618cdf0e10cSrcweir     ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Value") ),
619cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
620cdf0e10cSrcweir                               _xAttributes );
621cdf0e10cSrcweir     ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMin") ),
622cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
623cdf0e10cSrcweir                               _xAttributes );
624cdf0e10cSrcweir     ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMax") ),
625cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
626cdf0e10cSrcweir                               _xAttributes );
627cdf0e10cSrcweir     ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueStep") ),
628cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("value-step") ),
629cdf0e10cSrcweir                               _xAttributes );
630cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
631cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
632cdf0e10cSrcweir                                _xAttributes );
633cdf0e10cSrcweir     if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
634cdf0e10cSrcweir                                 _xAttributes ))
635cdf0e10cSrcweir         ctx.getControlModel()->setPropertyValue(
636cdf0e10cSrcweir             OUSTR("Repeat"), makeAny(true) );
637cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
638cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
639cdf0e10cSrcweir                                _xAttributes );
640cdf0e10cSrcweir     ctx.importEvents( _events );
641cdf0e10cSrcweir     // avoid ring-reference:
642cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
643cdf0e10cSrcweir     _events.clear();
644cdf0e10cSrcweir }
645cdf0e10cSrcweir 
646cdf0e10cSrcweir //##################################################################################################
647cdf0e10cSrcweir 
648cdf0e10cSrcweir // datefield
649cdf0e10cSrcweir //__________________________________________________________________________________________________
650cdf0e10cSrcweir Reference< xml::input::XElement > DateFieldElement::startChildElement(
651cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
652cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
653cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
654cdf0e10cSrcweir {
655cdf0e10cSrcweir     // event
656cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
657cdf0e10cSrcweir     {
658cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
659cdf0e10cSrcweir     }
660cdf0e10cSrcweir     else
661cdf0e10cSrcweir     {
662cdf0e10cSrcweir         throw xml::sax::SAXException(
663cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
664cdf0e10cSrcweir             Reference< XInterface >(), Any() );
665cdf0e10cSrcweir     }
666cdf0e10cSrcweir }
667cdf0e10cSrcweir //__________________________________________________________________________________________________
668cdf0e10cSrcweir void DateFieldElement::endElement()
669cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
670cdf0e10cSrcweir {
671cdf0e10cSrcweir     ControlImportContext ctx(
672cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
673cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDateFieldModel") ) );
674cdf0e10cSrcweir 
675cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
676cdf0e10cSrcweir     if (xStyle.is())
677cdf0e10cSrcweir     {
678cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
679cdf0e10cSrcweir         Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
680cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xControlModel );
681cdf0e10cSrcweir         pStyle->importTextColorStyle( xControlModel );
682cdf0e10cSrcweir         pStyle->importTextLineColorStyle( xControlModel );
683cdf0e10cSrcweir         pStyle->importBorderStyle( xControlModel );
684cdf0e10cSrcweir         pStyle->importFontStyle( xControlModel );
685cdf0e10cSrcweir     }
686cdf0e10cSrcweir 
687cdf0e10cSrcweir     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
688cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
689cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
690cdf0e10cSrcweir                                _xAttributes );
691cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
692cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
693cdf0e10cSrcweir                                _xAttributes );
694cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
695cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ),
696cdf0e10cSrcweir                                _xAttributes );
697cdf0e10cSrcweir     ctx.importBooleanProperty(
698cdf0e10cSrcweir         OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
699cdf0e10cSrcweir         _xAttributes );
700cdf0e10cSrcweir     ctx.importDateFormatProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateFormat") ),
701cdf0e10cSrcweir                                   OUString( RTL_CONSTASCII_USTRINGPARAM("date-format") ),
702cdf0e10cSrcweir                                   _xAttributes );
703cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateShowCentury") ),
704cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("show-century") ),
705cdf0e10cSrcweir                                _xAttributes );
706cdf0e10cSrcweir     ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Date") ),
707cdf0e10cSrcweir                             OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
708cdf0e10cSrcweir                             _xAttributes );
709cdf0e10cSrcweir     ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateMin") ),
710cdf0e10cSrcweir                             OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
711cdf0e10cSrcweir                             _xAttributes );
712cdf0e10cSrcweir     ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DateMax") ),
713cdf0e10cSrcweir                             OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
714cdf0e10cSrcweir                             _xAttributes );
715cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
716cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
717cdf0e10cSrcweir                                _xAttributes );
718cdf0e10cSrcweir     if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
719cdf0e10cSrcweir                                 _xAttributes ))
720cdf0e10cSrcweir         ctx.getControlModel()->setPropertyValue(
721cdf0e10cSrcweir             OUSTR("Repeat"), makeAny(true) );
722cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
723cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("dropdown") ),
724cdf0e10cSrcweir                                _xAttributes );
725cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
726cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("text") ),
727cdf0e10cSrcweir                               _xAttributes );
728cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
729cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
730cdf0e10cSrcweir                                _xAttributes );
731cdf0e10cSrcweir     ctx.importEvents( _events );
732cdf0e10cSrcweir     // avoid ring-reference:
733cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
734cdf0e10cSrcweir     _events.clear();
735cdf0e10cSrcweir }
736cdf0e10cSrcweir 
737cdf0e10cSrcweir //##################################################################################################
738cdf0e10cSrcweir 
739cdf0e10cSrcweir // currencyfield
740cdf0e10cSrcweir //__________________________________________________________________________________________________
741cdf0e10cSrcweir Reference< xml::input::XElement > CurrencyFieldElement::startChildElement(
742cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
743cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
744cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
745cdf0e10cSrcweir {
746cdf0e10cSrcweir     // event
747cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
748cdf0e10cSrcweir     {
749cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
750cdf0e10cSrcweir     }
751cdf0e10cSrcweir     else
752cdf0e10cSrcweir     {
753cdf0e10cSrcweir         throw xml::sax::SAXException(
754cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
755cdf0e10cSrcweir             Reference< XInterface >(), Any() );
756cdf0e10cSrcweir     }
757cdf0e10cSrcweir }
758cdf0e10cSrcweir //__________________________________________________________________________________________________
759cdf0e10cSrcweir void CurrencyFieldElement::endElement()
760cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
761cdf0e10cSrcweir {
762cdf0e10cSrcweir     ControlImportContext ctx(
763cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
764cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCurrencyFieldModel") ) );
765cdf0e10cSrcweir 
766cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
767cdf0e10cSrcweir     if (xStyle.is())
768cdf0e10cSrcweir     {
769cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
770cdf0e10cSrcweir         Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
771cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xControlModel );
772cdf0e10cSrcweir         pStyle->importTextColorStyle( xControlModel );
773cdf0e10cSrcweir         pStyle->importTextLineColorStyle( xControlModel );
774cdf0e10cSrcweir         pStyle->importBorderStyle( xControlModel );
775cdf0e10cSrcweir         pStyle->importFontStyle( xControlModel );
776cdf0e10cSrcweir     }
777cdf0e10cSrcweir 
778cdf0e10cSrcweir     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
779cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
780cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
781cdf0e10cSrcweir                                _xAttributes );
782cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
783cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
784cdf0e10cSrcweir                                _xAttributes );
785cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
786cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ),
787cdf0e10cSrcweir                                _xAttributes );
788cdf0e10cSrcweir     ctx.importBooleanProperty(
789cdf0e10cSrcweir         OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
790cdf0e10cSrcweir         _xAttributes );
791cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("CurrencySymbol") ),
792cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("currency-symbol") ),
793cdf0e10cSrcweir                               _xAttributes );
794cdf0e10cSrcweir     ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DecimalAccuracy") ),
795cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("decimal-accuracy") ),
796cdf0e10cSrcweir                                _xAttributes );
797cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowThousandsSeparator") ),
798cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("thousands-separator") ),
799cdf0e10cSrcweir                                _xAttributes );
800cdf0e10cSrcweir     ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Value") ),
801cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
802cdf0e10cSrcweir                               _xAttributes );
803cdf0e10cSrcweir     ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMin") ),
804cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
805cdf0e10cSrcweir                               _xAttributes );
806cdf0e10cSrcweir     ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMax") ),
807cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
808cdf0e10cSrcweir                               _xAttributes );
809cdf0e10cSrcweir     ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueStep") ),
810cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("value-step") ),
811cdf0e10cSrcweir                               _xAttributes );
812cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
813cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
814cdf0e10cSrcweir                                _xAttributes );
815cdf0e10cSrcweir     if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
816cdf0e10cSrcweir                                 _xAttributes ))
817cdf0e10cSrcweir         ctx.getControlModel()->setPropertyValue(
818cdf0e10cSrcweir             OUSTR("Repeat"), makeAny(true) );
819cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("PrependCurrencySymbol") ),
820cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("prepend-symbol") ),
821cdf0e10cSrcweir                                _xAttributes );
822cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
823cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
824cdf0e10cSrcweir                                _xAttributes );
825cdf0e10cSrcweir     ctx.importEvents( _events );
826cdf0e10cSrcweir     // avoid ring-reference:
827cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
828cdf0e10cSrcweir     _events.clear();
829cdf0e10cSrcweir }
830cdf0e10cSrcweir 
831cdf0e10cSrcweir //##################################################################################################
832cdf0e10cSrcweir 
833cdf0e10cSrcweir // filecontrol
834cdf0e10cSrcweir //__________________________________________________________________________________________________
835cdf0e10cSrcweir Reference< xml::input::XElement > FileControlElement::startChildElement(
836cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
837cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
838cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
839cdf0e10cSrcweir {
840cdf0e10cSrcweir     // event
841cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
842cdf0e10cSrcweir     {
843cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
844cdf0e10cSrcweir     }
845cdf0e10cSrcweir     else
846cdf0e10cSrcweir     {
847cdf0e10cSrcweir         throw xml::sax::SAXException(
848cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
849cdf0e10cSrcweir             Reference< XInterface >(), Any() );
850cdf0e10cSrcweir     }
851cdf0e10cSrcweir }
852cdf0e10cSrcweir //__________________________________________________________________________________________________
853cdf0e10cSrcweir void FileControlElement::endElement()
854cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
855cdf0e10cSrcweir {
856cdf0e10cSrcweir     ControlImportContext ctx(
857cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
858cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFileControlModel") ) );
859cdf0e10cSrcweir 
860cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
861cdf0e10cSrcweir     if (xStyle.is())
862cdf0e10cSrcweir     {
863cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
864cdf0e10cSrcweir         Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
865cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xControlModel );
866cdf0e10cSrcweir         pStyle->importTextColorStyle( xControlModel );
867cdf0e10cSrcweir         pStyle->importTextLineColorStyle( xControlModel );
868cdf0e10cSrcweir         pStyle->importBorderStyle( xControlModel );
869cdf0e10cSrcweir         pStyle->importFontStyle( xControlModel );
870cdf0e10cSrcweir     }
871cdf0e10cSrcweir 
872cdf0e10cSrcweir     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
873cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
874cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
875cdf0e10cSrcweir                                _xAttributes );
876cdf0e10cSrcweir     ctx.importBooleanProperty(
877cdf0e10cSrcweir         OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
878cdf0e10cSrcweir         _xAttributes );
879cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
880cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
881cdf0e10cSrcweir                               _xAttributes );
882cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
883cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
884cdf0e10cSrcweir                                _xAttributes );
885cdf0e10cSrcweir     ctx.importEvents( _events );
886cdf0e10cSrcweir     // avoid ring-reference:
887cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
888cdf0e10cSrcweir     _events.clear();
889cdf0e10cSrcweir }
890cdf0e10cSrcweir //##################################################################################################
891cdf0e10cSrcweir 
892cdf0e10cSrcweir // treecontrol
893cdf0e10cSrcweir //__________________________________________________________________________________________________
894cdf0e10cSrcweir Reference< xml::input::XElement > TreeControlElement::startChildElement(
895cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
896cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
897cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
898cdf0e10cSrcweir {
899cdf0e10cSrcweir     // event
900cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
901cdf0e10cSrcweir     {
902cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
903cdf0e10cSrcweir     }
904cdf0e10cSrcweir     else
905cdf0e10cSrcweir     {
906cdf0e10cSrcweir         throw xml::sax::SAXException(
907cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
908cdf0e10cSrcweir             Reference< XInterface >(), Any() );
909cdf0e10cSrcweir     }
910cdf0e10cSrcweir }
911cdf0e10cSrcweir //__________________________________________________________________________________________________
912cdf0e10cSrcweir void TreeControlElement::endElement()
913cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
914cdf0e10cSrcweir {
915cdf0e10cSrcweir     ControlImportContext ctx(
916cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
917cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.tree.TreeControlModel") ) );
918cdf0e10cSrcweir 
919cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
920cdf0e10cSrcweir     if (xStyle.is())
921cdf0e10cSrcweir     {
922cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
923cdf0e10cSrcweir         Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
924cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xControlModel );
925cdf0e10cSrcweir         pStyle->importBorderStyle( xControlModel );
926cdf0e10cSrcweir     }
927cdf0e10cSrcweir 
928cdf0e10cSrcweir     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
929cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
930cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
931cdf0e10cSrcweir                                _xAttributes );
932cdf0e10cSrcweir     ctx.importSelectionTypeProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectionType") ),
933cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("selectiontype") ),
934cdf0e10cSrcweir                               _xAttributes );
935cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("RootDisplayed") ),
936cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("rootdisplayed") ),
937cdf0e10cSrcweir                                _xAttributes );
938cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsHandles") ),
939cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("showshandles") ),
940cdf0e10cSrcweir                                _xAttributes );
941cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsRootHandles") ),
942cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("showsroothandles") ),
943cdf0e10cSrcweir                                _xAttributes );
944cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Editable") ),
945cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("editable") ),
946cdf0e10cSrcweir                                _xAttributes );
947cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("RowHeight") ),
948cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
949cdf0e10cSrcweir                                _xAttributes );
950cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("InvokesStopNodeEditing") ),
951cdf0e10cSrcweir                              OUString( RTL_CONSTASCII_USTRINGPARAM("invokesstopnodeediting") ),
952cdf0e10cSrcweir                              _xAttributes );
953cdf0e10cSrcweir 
954cdf0e10cSrcweir     ctx.importEvents( _events );
955cdf0e10cSrcweir     // avoid ring-reference:
956cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
957cdf0e10cSrcweir     _events.clear();
958cdf0e10cSrcweir }
959cdf0e10cSrcweir 
960cdf0e10cSrcweir //##################################################################################################
961cdf0e10cSrcweir 
962cdf0e10cSrcweir // imagecontrol
963cdf0e10cSrcweir //__________________________________________________________________________________________________
964cdf0e10cSrcweir Reference< xml::input::XElement > ImageControlElement::startChildElement(
965cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
966cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
967cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
968cdf0e10cSrcweir {
969cdf0e10cSrcweir     // event
970cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
971cdf0e10cSrcweir     {
972cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
973cdf0e10cSrcweir     }
974cdf0e10cSrcweir     else
975cdf0e10cSrcweir     {
976cdf0e10cSrcweir         throw xml::sax::SAXException(
977cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
978cdf0e10cSrcweir             Reference< XInterface >(), Any() );
979cdf0e10cSrcweir     }
980cdf0e10cSrcweir }
981cdf0e10cSrcweir //__________________________________________________________________________________________________
982cdf0e10cSrcweir void ImageControlElement::endElement()
983cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
984cdf0e10cSrcweir {
985cdf0e10cSrcweir     ControlImportContext ctx(
986cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
987cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) );
988cdf0e10cSrcweir 
989cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
990cdf0e10cSrcweir     if (xStyle.is())
991cdf0e10cSrcweir     {
992cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
993cdf0e10cSrcweir         Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
994cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xControlModel );
995cdf0e10cSrcweir         pStyle->importBorderStyle( xControlModel );
996cdf0e10cSrcweir     }
997cdf0e10cSrcweir 
998cdf0e10cSrcweir     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
999cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
1000cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("scale-image") ),
1001cdf0e10cSrcweir                                _xAttributes );
1002cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
1003cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("src") ),
1004cdf0e10cSrcweir                               _xAttributes );
1005cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1006cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1007cdf0e10cSrcweir                                _xAttributes );
1008cdf0e10cSrcweir     ctx.importEvents( _events );
1009cdf0e10cSrcweir     // avoid ring-reference:
1010cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
1011cdf0e10cSrcweir     _events.clear();
1012cdf0e10cSrcweir }
1013cdf0e10cSrcweir 
1014cdf0e10cSrcweir //##################################################################################################
1015cdf0e10cSrcweir 
1016cdf0e10cSrcweir // textfield
1017cdf0e10cSrcweir //__________________________________________________________________________________________________
1018cdf0e10cSrcweir Reference< xml::input::XElement > TextElement::startChildElement(
1019cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
1020cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
1021cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1022cdf0e10cSrcweir {
1023cdf0e10cSrcweir     // event
1024cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
1025cdf0e10cSrcweir     {
1026cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1027cdf0e10cSrcweir     }
1028cdf0e10cSrcweir     else
1029cdf0e10cSrcweir     {
1030cdf0e10cSrcweir         throw xml::sax::SAXException(
1031cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1032cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1033cdf0e10cSrcweir     }
1034cdf0e10cSrcweir }
1035cdf0e10cSrcweir //__________________________________________________________________________________________________
1036cdf0e10cSrcweir void TextElement::endElement()
1037cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1038cdf0e10cSrcweir {
1039cdf0e10cSrcweir     ControlImportContext ctx(
1040cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
1041cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) );
1042cdf0e10cSrcweir 
1043cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1044cdf0e10cSrcweir     if (xStyle.is())
1045cdf0e10cSrcweir     {
1046cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1047cdf0e10cSrcweir         Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1048cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xControlModel );
1049cdf0e10cSrcweir         pStyle->importTextColorStyle( xControlModel );
1050cdf0e10cSrcweir         pStyle->importTextLineColorStyle( xControlModel );
1051cdf0e10cSrcweir         pStyle->importBorderStyle( xControlModel );
1052cdf0e10cSrcweir         pStyle->importFontStyle( xControlModel );
1053cdf0e10cSrcweir     }
1054cdf0e10cSrcweir 
1055cdf0e10cSrcweir     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1056cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1057cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1058cdf0e10cSrcweir                               _xAttributes );
1059cdf0e10cSrcweir     ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1060cdf0e10cSrcweir                              OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1061cdf0e10cSrcweir                              _xAttributes );
1062cdf0e10cSrcweir     ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
1063cdf0e10cSrcweir                                      OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
1064cdf0e10cSrcweir                                      _xAttributes );
1065cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1066cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1067cdf0e10cSrcweir                                _xAttributes );
1068cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1069cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1070cdf0e10cSrcweir                                _xAttributes );
1071cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("NoLabel") ),
1072cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("nolabel") ),
1073cdf0e10cSrcweir                                _xAttributes );
1074cdf0e10cSrcweir     ctx.importEvents( _events );
1075cdf0e10cSrcweir     // avoid ring-reference:
1076cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
1077cdf0e10cSrcweir     _events.clear();
1078cdf0e10cSrcweir }
1079cdf0e10cSrcweir 
1080cdf0e10cSrcweir //##################################################################################################
1081cdf0e10cSrcweir // FixedHyperLink
1082cdf0e10cSrcweir //__________________________________________________________________________________________________
1083cdf0e10cSrcweir Reference< xml::input::XElement > FixedHyperLinkElement::startChildElement(
1084cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
1085cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
1086cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1087cdf0e10cSrcweir {
1088cdf0e10cSrcweir     // event
1089cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
1090cdf0e10cSrcweir     {
1091cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1092cdf0e10cSrcweir     }
1093cdf0e10cSrcweir     else
1094cdf0e10cSrcweir     {
1095cdf0e10cSrcweir         throw xml::sax::SAXException(
1096cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1097cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1098cdf0e10cSrcweir     }
1099cdf0e10cSrcweir }
1100cdf0e10cSrcweir //__________________________________________________________________________________________________
1101cdf0e10cSrcweir void FixedHyperLinkElement::endElement()
1102cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1103cdf0e10cSrcweir {
1104cdf0e10cSrcweir     ControlImportContext ctx(
1105cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
1106cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedHyperlinkModel") ) );
1107cdf0e10cSrcweir 
1108cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1109cdf0e10cSrcweir     if (xStyle.is())
1110cdf0e10cSrcweir     {
1111cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1112cdf0e10cSrcweir         Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1113cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xControlModel );
1114cdf0e10cSrcweir         pStyle->importTextColorStyle( xControlModel );
1115cdf0e10cSrcweir         pStyle->importTextLineColorStyle( xControlModel );
1116cdf0e10cSrcweir         pStyle->importBorderStyle( xControlModel );
1117cdf0e10cSrcweir         pStyle->importFontStyle( xControlModel );
1118cdf0e10cSrcweir     }
1119cdf0e10cSrcweir 
1120cdf0e10cSrcweir     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1121cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1122cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1123cdf0e10cSrcweir                               _xAttributes );
1124cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("URL") ),
1125cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("url") ),
1126cdf0e10cSrcweir                               _xAttributes );
1127cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Description") ),
1128cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("description") ),
1129cdf0e10cSrcweir                               _xAttributes );
1130cdf0e10cSrcweir 
1131cdf0e10cSrcweir     ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1132cdf0e10cSrcweir                              OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1133cdf0e10cSrcweir                              _xAttributes );
1134cdf0e10cSrcweir     ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
1135cdf0e10cSrcweir                                      OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
1136cdf0e10cSrcweir                                      _xAttributes );
1137cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1138cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1139cdf0e10cSrcweir                                _xAttributes );
1140cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1141cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1142cdf0e10cSrcweir                                _xAttributes );
1143cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("NoLabel") ),
1144cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("nolabel") ),
1145cdf0e10cSrcweir                                _xAttributes );
1146cdf0e10cSrcweir     ctx.importEvents( _events );
1147cdf0e10cSrcweir     // avoid ring-reference:
1148cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
1149cdf0e10cSrcweir     _events.clear();
1150cdf0e10cSrcweir }
1151cdf0e10cSrcweir 
1152cdf0e10cSrcweir //##################################################################################################
1153cdf0e10cSrcweir 
1154cdf0e10cSrcweir // edit
1155cdf0e10cSrcweir //__________________________________________________________________________________________________
1156cdf0e10cSrcweir Reference< xml::input::XElement > TextFieldElement::startChildElement(
1157cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
1158cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
1159cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1160cdf0e10cSrcweir {
1161cdf0e10cSrcweir     // event
1162cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
1163cdf0e10cSrcweir     {
1164cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1165cdf0e10cSrcweir     }
1166cdf0e10cSrcweir     else
1167cdf0e10cSrcweir     {
1168cdf0e10cSrcweir         throw xml::sax::SAXException(
1169cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1170cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1171cdf0e10cSrcweir     }
1172cdf0e10cSrcweir }
1173cdf0e10cSrcweir //__________________________________________________________________________________________________
1174cdf0e10cSrcweir void TextFieldElement::endElement()
1175cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1176cdf0e10cSrcweir {
1177cdf0e10cSrcweir     ControlImportContext ctx(
1178cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
1179cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) );
1180cdf0e10cSrcweir     Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1181cdf0e10cSrcweir 
1182cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1183cdf0e10cSrcweir     if (xStyle.is())
1184cdf0e10cSrcweir     {
1185cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1186cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xControlModel );
1187cdf0e10cSrcweir         pStyle->importTextColorStyle( xControlModel );
1188cdf0e10cSrcweir         pStyle->importTextLineColorStyle( xControlModel );
1189cdf0e10cSrcweir         pStyle->importBorderStyle( xControlModel );
1190cdf0e10cSrcweir         pStyle->importFontStyle( xControlModel );
1191cdf0e10cSrcweir     }
1192cdf0e10cSrcweir 
1193cdf0e10cSrcweir     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1194cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1195cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1196cdf0e10cSrcweir                                _xAttributes );
1197cdf0e10cSrcweir     ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1198cdf0e10cSrcweir                              OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1199cdf0e10cSrcweir                              _xAttributes );
1200cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("HardLineBreaks") ),
1201cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("hard-linebreaks") ),
1202cdf0e10cSrcweir                                _xAttributes );
1203cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("HScroll") ),
1204cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("hscroll") ),
1205cdf0e10cSrcweir                                _xAttributes );
1206cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VScroll") ),
1207cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("vscroll") ),
1208cdf0e10cSrcweir                                _xAttributes );
1209cdf0e10cSrcweir     ctx.importBooleanProperty(
1210cdf0e10cSrcweir         OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
1211cdf0e10cSrcweir         _xAttributes );
1212cdf0e10cSrcweir     ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
1213cdf0e10cSrcweir                              OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ),
1214cdf0e10cSrcweir                              _xAttributes );
1215cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1216cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1217cdf0e10cSrcweir                                _xAttributes );
1218cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
1219cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
1220cdf0e10cSrcweir                                _xAttributes );
1221cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
1222cdf0e10cSrcweir                                   OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1223cdf0e10cSrcweir                                   _xAttributes );
1224cdf0e10cSrcweir     ctx.importLineEndFormatProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineEndFormat") ),
1225cdf0e10cSrcweir                                      OUString( RTL_CONSTASCII_USTRINGPARAM("lineend-format") ),
1226cdf0e10cSrcweir                                      _xAttributes );
1227cdf0e10cSrcweir     OUString aValue;
1228cdf0e10cSrcweir     if (getStringAttr( &aValue,
1229cdf0e10cSrcweir                        OUString( RTL_CONSTASCII_USTRINGPARAM("echochar") ),
1230cdf0e10cSrcweir                        _xAttributes,
1231cdf0e10cSrcweir                        _pImport->XMLNS_DIALOGS_UID ) &&
1232cdf0e10cSrcweir         aValue.getLength() > 0)
1233cdf0e10cSrcweir     {
1234cdf0e10cSrcweir         OSL_ENSURE( aValue.getLength() == 1, "### more than one character given for echochar!" );
1235cdf0e10cSrcweir         sal_Int16 nChar = (sal_Int16)aValue[ 0 ];
1236cdf0e10cSrcweir         xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("EchoChar") ),
1237cdf0e10cSrcweir                                          makeAny( nChar ) );
1238cdf0e10cSrcweir     }
1239cdf0e10cSrcweir 
1240cdf0e10cSrcweir     ctx.importEvents( _events );
1241cdf0e10cSrcweir     // avoid ring-reference:
1242cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
1243cdf0e10cSrcweir     _events.clear();
1244cdf0e10cSrcweir }
1245cdf0e10cSrcweir 
1246cdf0e10cSrcweir //##################################################################################################
1247cdf0e10cSrcweir 
1248cdf0e10cSrcweir // titledbox
1249cdf0e10cSrcweir //__________________________________________________________________________________________________
1250cdf0e10cSrcweir Reference< xml::input::XElement > TitledBoxElement::startChildElement(
1251cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
1252cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
1253cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1254cdf0e10cSrcweir {
1255cdf0e10cSrcweir     // event
1256cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
1257cdf0e10cSrcweir     {
1258cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1259cdf0e10cSrcweir     }
1260cdf0e10cSrcweir     else if (_pImport->XMLNS_DIALOGS_UID != nUid)
1261cdf0e10cSrcweir     {
1262cdf0e10cSrcweir         throw xml::sax::SAXException(
1263cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
1264cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1265cdf0e10cSrcweir     }
1266cdf0e10cSrcweir     // title
1267cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("title") ))
1268cdf0e10cSrcweir     {
1269cdf0e10cSrcweir         getStringAttr( &_label,
1270cdf0e10cSrcweir                        OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1271cdf0e10cSrcweir                        xAttributes,
1272cdf0e10cSrcweir                        _pImport->XMLNS_DIALOGS_UID );
1273cdf0e10cSrcweir 
1274cdf0e10cSrcweir         return new ElementBase(
1275cdf0e10cSrcweir             _pImport->XMLNS_DIALOGS_UID,
1276cdf0e10cSrcweir             rLocalName, xAttributes, this, _pImport );
1277cdf0e10cSrcweir     }
1278cdf0e10cSrcweir     // radio
1279cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("radio") ))
1280cdf0e10cSrcweir     {
1281cdf0e10cSrcweir         // dont create radios here, => titledbox must be inserted first due to radio grouping,
1282cdf0e10cSrcweir         // possible predecessors!
1283cdf0e10cSrcweir         Reference< xml::input::XElement > xRet(
1284cdf0e10cSrcweir             new RadioElement( rLocalName, xAttributes, this, _pImport ) );
1285cdf0e10cSrcweir         _radios.push_back( xRet );
1286cdf0e10cSrcweir         return xRet;
1287cdf0e10cSrcweir     }
1288cdf0e10cSrcweir     // event
1289cdf0e10cSrcweir     else if (_pImport->isEventElement( nUid, rLocalName ))
1290cdf0e10cSrcweir     {
1291cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1292cdf0e10cSrcweir     }
1293cdf0e10cSrcweir     else
1294cdf0e10cSrcweir     {
1295cdf0e10cSrcweir         return BulletinBoardElement::startChildElement( nUid, rLocalName, xAttributes );
1296cdf0e10cSrcweir     }
1297cdf0e10cSrcweir }
1298cdf0e10cSrcweir //__________________________________________________________________________________________________
1299cdf0e10cSrcweir void TitledBoxElement::endElement()
1300cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1301cdf0e10cSrcweir {
1302cdf0e10cSrcweir     {
1303cdf0e10cSrcweir     ControlImportContext ctx(
1304cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
1305cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) );
1306cdf0e10cSrcweir     Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1307cdf0e10cSrcweir 
1308cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1309cdf0e10cSrcweir     if (xStyle.is())
1310cdf0e10cSrcweir     {
1311cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1312cdf0e10cSrcweir         pStyle->importTextColorStyle( xControlModel );
1313cdf0e10cSrcweir         pStyle->importTextLineColorStyle( xControlModel );
1314cdf0e10cSrcweir         pStyle->importFontStyle( xControlModel );
1315cdf0e10cSrcweir     }
1316cdf0e10cSrcweir 
1317cdf0e10cSrcweir     ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
1318cdf0e10cSrcweir 
1319cdf0e10cSrcweir     if (_label.getLength())
1320cdf0e10cSrcweir     {
1321cdf0e10cSrcweir         xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1322cdf0e10cSrcweir                                          makeAny( _label ) );
1323cdf0e10cSrcweir     }
1324cdf0e10cSrcweir 
1325cdf0e10cSrcweir     ctx.importEvents( _events );
1326cdf0e10cSrcweir     // avoid ring-reference:
1327cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
1328cdf0e10cSrcweir     _events.clear();
1329cdf0e10cSrcweir     }
1330cdf0e10cSrcweir 
1331cdf0e10cSrcweir     // create radios AFTER group box!
1332cdf0e10cSrcweir     for ( size_t nPos = 0; nPos < _radios.size(); ++nPos )
1333cdf0e10cSrcweir     {
1334cdf0e10cSrcweir         Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
1335cdf0e10cSrcweir         Reference< xml::input::XAttributes > xAttributes(
1336cdf0e10cSrcweir             xRadio->getAttributes() );
1337cdf0e10cSrcweir 
1338cdf0e10cSrcweir         ControlImportContext ctx(
1339cdf0e10cSrcweir             _pImport, getControlId( xAttributes ),
1340cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) );
1341cdf0e10cSrcweir         Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1342cdf0e10cSrcweir 
1343cdf0e10cSrcweir         Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
1344cdf0e10cSrcweir         if (xStyle.is())
1345cdf0e10cSrcweir         {
1346cdf0e10cSrcweir             StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1347cdf0e10cSrcweir             pStyle->importBackgroundColorStyle( xControlModel );
1348cdf0e10cSrcweir             pStyle->importTextColorStyle( xControlModel );
1349cdf0e10cSrcweir             pStyle->importTextLineColorStyle( xControlModel );
1350cdf0e10cSrcweir             pStyle->importFontStyle( xControlModel );
1351cdf0e10cSrcweir             pStyle->importVisualEffectStyle( xControlModel );
1352cdf0e10cSrcweir         }
1353cdf0e10cSrcweir 
1354cdf0e10cSrcweir         ctx.importDefaults( _nBasePosX, _nBasePosY, xAttributes );
1355cdf0e10cSrcweir         ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1356cdf0e10cSrcweir                                    OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1357cdf0e10cSrcweir                                    xAttributes );
1358cdf0e10cSrcweir         ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1359cdf0e10cSrcweir                                   OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1360cdf0e10cSrcweir                                   xAttributes );
1361cdf0e10cSrcweir         ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1362cdf0e10cSrcweir                                  OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1363cdf0e10cSrcweir                                  xAttributes );
1364cdf0e10cSrcweir         ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
1365cdf0e10cSrcweir                                          OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
1366cdf0e10cSrcweir                                          xAttributes );
1367cdf0e10cSrcweir         ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
1368cdf0e10cSrcweir                                   OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
1369cdf0e10cSrcweir                                   xAttributes );
1370cdf0e10cSrcweir         ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
1371cdf0e10cSrcweir                                          OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
1372cdf0e10cSrcweir                                          xAttributes );
1373cdf0e10cSrcweir         ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1374cdf0e10cSrcweir                                    OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1375cdf0e10cSrcweir                                    xAttributes );
1376cdf0e10cSrcweir 
1377cdf0e10cSrcweir         sal_Int16 nVal = 0;
1378cdf0e10cSrcweir         sal_Bool bChecked = sal_False;
1379cdf0e10cSrcweir         if (getBoolAttr( &bChecked,
1380cdf0e10cSrcweir                          OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ),
1381cdf0e10cSrcweir                          xAttributes,
1382cdf0e10cSrcweir                          _pImport->XMLNS_DIALOGS_UID ) &&
1383cdf0e10cSrcweir             bChecked)
1384cdf0e10cSrcweir         {
1385cdf0e10cSrcweir             nVal = 1;
1386cdf0e10cSrcweir         }
1387cdf0e10cSrcweir         xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
1388cdf0e10cSrcweir                                          makeAny( nVal ) );
1389cdf0e10cSrcweir 
1390cdf0e10cSrcweir         ::std::vector< Reference< xml::input::XElement > > * radioEvents =
1391cdf0e10cSrcweir             static_cast< RadioElement * >( xRadio.get() )->getEvents();
1392cdf0e10cSrcweir         ctx.importEvents( *radioEvents );
1393cdf0e10cSrcweir         // avoid ring-reference:
1394cdf0e10cSrcweir         // vector< event elements > holding event elements holding this (via _pParent)
1395cdf0e10cSrcweir         radioEvents->clear();
1396cdf0e10cSrcweir     }
1397cdf0e10cSrcweir     // avoid ring-reference:
1398cdf0e10cSrcweir     // vector< radio elements > holding radio elements holding this (via _pParent)
1399cdf0e10cSrcweir     _radios.clear();
1400cdf0e10cSrcweir }
1401cdf0e10cSrcweir 
1402cdf0e10cSrcweir //##################################################################################################
1403cdf0e10cSrcweir 
1404cdf0e10cSrcweir // radio
1405cdf0e10cSrcweir //__________________________________________________________________________________________________
1406cdf0e10cSrcweir Reference< xml::input::XElement > RadioElement::startChildElement(
1407cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
1408cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
1409cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1410cdf0e10cSrcweir {
1411cdf0e10cSrcweir     // event
1412cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
1413cdf0e10cSrcweir     {
1414cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1415cdf0e10cSrcweir     }
1416cdf0e10cSrcweir     else
1417cdf0e10cSrcweir     {
1418cdf0e10cSrcweir         throw xml::sax::SAXException(
1419cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1420cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1421cdf0e10cSrcweir     }
1422cdf0e10cSrcweir }
1423cdf0e10cSrcweir 
1424cdf0e10cSrcweir //##################################################################################################
1425cdf0e10cSrcweir 
1426cdf0e10cSrcweir // radiogroup
1427cdf0e10cSrcweir //__________________________________________________________________________________________________
1428cdf0e10cSrcweir Reference< xml::input::XElement > RadioGroupElement::startChildElement(
1429cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
1430cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
1431cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1432cdf0e10cSrcweir {
1433cdf0e10cSrcweir     if (_pImport->XMLNS_DIALOGS_UID != nUid)
1434cdf0e10cSrcweir     {
1435cdf0e10cSrcweir         throw xml::sax::SAXException(
1436cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
1437cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1438cdf0e10cSrcweir     }
1439cdf0e10cSrcweir     // radio
1440cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("radio") ))
1441cdf0e10cSrcweir     {
1442cdf0e10cSrcweir         // dont create radios here, => titledbox must be inserted first due to radio grouping,
1443cdf0e10cSrcweir         // possible predecessors!
1444cdf0e10cSrcweir         Reference< xml::input::XElement > xRet(
1445cdf0e10cSrcweir             new RadioElement( rLocalName, xAttributes, this, _pImport ) );
1446cdf0e10cSrcweir         _radios.push_back( xRet );
1447cdf0e10cSrcweir         return xRet;
1448cdf0e10cSrcweir     }
1449cdf0e10cSrcweir     else
1450cdf0e10cSrcweir     {
1451cdf0e10cSrcweir         throw xml::sax::SAXException(
1452cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected radio element!") ),
1453cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1454cdf0e10cSrcweir     }
1455cdf0e10cSrcweir }
1456cdf0e10cSrcweir //__________________________________________________________________________________________________
1457cdf0e10cSrcweir void RadioGroupElement::endElement()
1458cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1459cdf0e10cSrcweir {
1460cdf0e10cSrcweir     for ( size_t nPos = 0; nPos < _radios.size(); ++nPos )
1461cdf0e10cSrcweir     {
1462cdf0e10cSrcweir         Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
1463cdf0e10cSrcweir         Reference< xml::input::XAttributes > xAttributes(
1464cdf0e10cSrcweir             xRadio->getAttributes() );
1465cdf0e10cSrcweir 
1466cdf0e10cSrcweir         ControlImportContext ctx(
1467cdf0e10cSrcweir             _pImport, getControlId( xAttributes ),
1468cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) );
1469cdf0e10cSrcweir         Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1470cdf0e10cSrcweir 
1471cdf0e10cSrcweir         Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
1472cdf0e10cSrcweir         if (xStyle.is())
1473cdf0e10cSrcweir         {
1474cdf0e10cSrcweir             StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1475cdf0e10cSrcweir             pStyle->importBackgroundColorStyle( xControlModel );
1476cdf0e10cSrcweir             pStyle->importTextColorStyle( xControlModel );
1477cdf0e10cSrcweir             pStyle->importTextLineColorStyle( xControlModel );
1478cdf0e10cSrcweir             pStyle->importFontStyle( xControlModel );
1479cdf0e10cSrcweir             pStyle->importVisualEffectStyle( xControlModel );
1480cdf0e10cSrcweir         }
1481cdf0e10cSrcweir 
1482cdf0e10cSrcweir         ctx.importDefaults( _nBasePosX, _nBasePosY, xAttributes );
1483cdf0e10cSrcweir         ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1484cdf0e10cSrcweir                                    OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1485cdf0e10cSrcweir                                    xAttributes );
1486cdf0e10cSrcweir         ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1487cdf0e10cSrcweir                                   OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1488cdf0e10cSrcweir                                   xAttributes );
1489cdf0e10cSrcweir         ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1490cdf0e10cSrcweir                                  OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1491cdf0e10cSrcweir                                  xAttributes );
1492cdf0e10cSrcweir         ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
1493cdf0e10cSrcweir                                          OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
1494cdf0e10cSrcweir                                          xAttributes );
1495cdf0e10cSrcweir         ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
1496cdf0e10cSrcweir                                   OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
1497cdf0e10cSrcweir                                   xAttributes );
1498cdf0e10cSrcweir         ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
1499cdf0e10cSrcweir                                          OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
1500cdf0e10cSrcweir                                          xAttributes );
1501cdf0e10cSrcweir         ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1502cdf0e10cSrcweir                                    OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1503cdf0e10cSrcweir                                    xAttributes );
1504cdf0e10cSrcweir         sal_Int16 nVal = 0;
1505cdf0e10cSrcweir         sal_Bool bChecked = sal_False;
1506cdf0e10cSrcweir         if (getBoolAttr( &bChecked,
1507cdf0e10cSrcweir                          OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ),
1508cdf0e10cSrcweir                          xAttributes,
1509cdf0e10cSrcweir                          _pImport->XMLNS_DIALOGS_UID ) &&
1510cdf0e10cSrcweir             bChecked)
1511cdf0e10cSrcweir         {
1512cdf0e10cSrcweir             nVal = 1;
1513cdf0e10cSrcweir         }
1514cdf0e10cSrcweir         xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
1515cdf0e10cSrcweir                                          makeAny( nVal ) );
1516cdf0e10cSrcweir 
1517cdf0e10cSrcweir         ::std::vector< Reference< xml::input::XElement > > * radioEvents =
1518cdf0e10cSrcweir             static_cast< RadioElement * >( xRadio.get() )->getEvents();
1519cdf0e10cSrcweir         ctx.importEvents( *radioEvents );
1520cdf0e10cSrcweir         // avoid ring-reference:
1521cdf0e10cSrcweir         // vector< event elements > holding event elements holding this (via _pParent)
1522cdf0e10cSrcweir         radioEvents->clear();
1523cdf0e10cSrcweir     }
1524cdf0e10cSrcweir     // avoid ring-reference:
1525cdf0e10cSrcweir     // vector< radio elements > holding radio elements holding this (via _pParent)
1526cdf0e10cSrcweir     _radios.clear();
1527cdf0e10cSrcweir }
1528cdf0e10cSrcweir 
1529cdf0e10cSrcweir //##################################################################################################
1530cdf0e10cSrcweir 
1531cdf0e10cSrcweir // menupopup
1532cdf0e10cSrcweir //__________________________________________________________________________________________________
1533cdf0e10cSrcweir Reference< xml::input::XElement > MenuPopupElement::startChildElement(
1534cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
1535cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
1536cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1537cdf0e10cSrcweir {
1538cdf0e10cSrcweir     if (_pImport->XMLNS_DIALOGS_UID != nUid)
1539cdf0e10cSrcweir     {
1540cdf0e10cSrcweir         throw xml::sax::SAXException(
1541cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
1542cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1543cdf0e10cSrcweir     }
1544cdf0e10cSrcweir     // menuitem
1545cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menuitem") ))
1546cdf0e10cSrcweir     {
1547cdf0e10cSrcweir         OUString aValue(
1548cdf0e10cSrcweir             xAttributes->getValueByUidName(
1549cdf0e10cSrcweir                 _pImport->XMLNS_DIALOGS_UID,
1550cdf0e10cSrcweir                 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ) ) );
1551cdf0e10cSrcweir         OSL_ENSURE( aValue.getLength(), "### menuitem has no value?" );
1552cdf0e10cSrcweir         if (aValue.getLength())
1553cdf0e10cSrcweir         {
1554cdf0e10cSrcweir             _itemValues.push_back( aValue );
1555cdf0e10cSrcweir 
1556cdf0e10cSrcweir             OUString aSel(
1557cdf0e10cSrcweir                 xAttributes->getValueByUidName(
1558cdf0e10cSrcweir                     _pImport->XMLNS_DIALOGS_UID,
1559cdf0e10cSrcweir                     OUString( RTL_CONSTASCII_USTRINGPARAM("selected") ) ) );
1560cdf0e10cSrcweir             if (aSel.getLength() && aSel.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("true") ))
1561cdf0e10cSrcweir             {
1562cdf0e10cSrcweir                 _itemSelected.push_back(
1563cdf0e10cSrcweir                     static_cast<sal_Int16>(_itemValues.size()) -1 );
1564cdf0e10cSrcweir             }
1565cdf0e10cSrcweir         }
1566cdf0e10cSrcweir         return new ElementBase(
1567cdf0e10cSrcweir             _pImport->XMLNS_DIALOGS_UID,
1568cdf0e10cSrcweir             rLocalName, xAttributes, this, _pImport );
1569cdf0e10cSrcweir     }
1570cdf0e10cSrcweir     else
1571cdf0e10cSrcweir     {
1572cdf0e10cSrcweir         throw xml::sax::SAXException(
1573cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected menuitem!") ),
1574cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1575cdf0e10cSrcweir     }
1576cdf0e10cSrcweir }
1577cdf0e10cSrcweir //__________________________________________________________________________________________________
1578cdf0e10cSrcweir Sequence< OUString > MenuPopupElement::getItemValues()
1579cdf0e10cSrcweir {
1580cdf0e10cSrcweir     Sequence< OUString > aRet( _itemValues.size() );
1581cdf0e10cSrcweir     OUString * pRet = aRet.getArray();
1582cdf0e10cSrcweir     for ( size_t nPos = _itemValues.size(); nPos--; )
1583cdf0e10cSrcweir     {
1584cdf0e10cSrcweir         pRet[ nPos ] = _itemValues[ nPos ];
1585cdf0e10cSrcweir     }
1586cdf0e10cSrcweir     return aRet;
1587cdf0e10cSrcweir }
1588cdf0e10cSrcweir //__________________________________________________________________________________________________
1589cdf0e10cSrcweir Sequence< sal_Int16 > MenuPopupElement::getSelectedItems()
1590cdf0e10cSrcweir {
1591cdf0e10cSrcweir     Sequence< sal_Int16 > aRet( _itemSelected.size() );
1592cdf0e10cSrcweir     sal_Int16 * pRet = aRet.getArray();
1593cdf0e10cSrcweir     for ( size_t nPos = _itemSelected.size(); nPos--; )
1594cdf0e10cSrcweir     {
1595cdf0e10cSrcweir         pRet[ nPos ] = _itemSelected[ nPos ];
1596cdf0e10cSrcweir     }
1597cdf0e10cSrcweir     return aRet;
1598cdf0e10cSrcweir }
1599cdf0e10cSrcweir 
1600cdf0e10cSrcweir //##################################################################################################
1601cdf0e10cSrcweir 
1602cdf0e10cSrcweir // menulist
1603cdf0e10cSrcweir //__________________________________________________________________________________________________
1604cdf0e10cSrcweir Reference< xml::input::XElement > MenuListElement::startChildElement(
1605cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
1606cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
1607cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1608cdf0e10cSrcweir {
1609cdf0e10cSrcweir     // event
1610cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
1611cdf0e10cSrcweir     {
1612cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1613cdf0e10cSrcweir     }
1614cdf0e10cSrcweir     else if (_pImport->XMLNS_DIALOGS_UID != nUid)
1615cdf0e10cSrcweir     {
1616cdf0e10cSrcweir         throw xml::sax::SAXException(
1617cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
1618cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1619cdf0e10cSrcweir     }
1620cdf0e10cSrcweir     // menupopup
1621cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menupopup") ))
1622cdf0e10cSrcweir     {
1623cdf0e10cSrcweir         _popup = new MenuPopupElement( rLocalName, xAttributes, this, _pImport );
1624cdf0e10cSrcweir         return _popup;
1625cdf0e10cSrcweir     }
1626cdf0e10cSrcweir     else
1627cdf0e10cSrcweir     {
1628cdf0e10cSrcweir         throw xml::sax::SAXException(
1629cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event or menupopup element!") ),
1630cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1631cdf0e10cSrcweir     }
1632cdf0e10cSrcweir }
1633cdf0e10cSrcweir //__________________________________________________________________________________________________
1634cdf0e10cSrcweir void MenuListElement::endElement()
1635cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1636cdf0e10cSrcweir {
1637cdf0e10cSrcweir     ControlImportContext ctx(
1638cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
1639cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) );
1640cdf0e10cSrcweir     Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1641cdf0e10cSrcweir 
1642cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1643cdf0e10cSrcweir     if (xStyle.is())
1644cdf0e10cSrcweir     {
1645cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1646cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xControlModel );
1647cdf0e10cSrcweir         pStyle->importTextColorStyle( xControlModel );
1648cdf0e10cSrcweir         pStyle->importTextLineColorStyle( xControlModel );
1649cdf0e10cSrcweir         pStyle->importBorderStyle( xControlModel );
1650cdf0e10cSrcweir         pStyle->importFontStyle( xControlModel );
1651cdf0e10cSrcweir     }
1652cdf0e10cSrcweir 
1653cdf0e10cSrcweir     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1654cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1655cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1656cdf0e10cSrcweir                                _xAttributes );
1657cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiSelection") ),
1658cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("multiselection") ),
1659cdf0e10cSrcweir                                _xAttributes );
1660cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
1661cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
1662cdf0e10cSrcweir                                _xAttributes );
1663cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
1664cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
1665cdf0e10cSrcweir                                _xAttributes );
1666cdf0e10cSrcweir     ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
1667cdf0e10cSrcweir                              OUString( RTL_CONSTASCII_USTRINGPARAM("linecount") ),
1668cdf0e10cSrcweir                              _xAttributes );
1669cdf0e10cSrcweir     ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1670cdf0e10cSrcweir                              OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1671cdf0e10cSrcweir                              _xAttributes );
1672cdf0e10cSrcweir 
1673cdf0e10cSrcweir     if (_popup.is())
1674cdf0e10cSrcweir     {
1675cdf0e10cSrcweir         MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
1676cdf0e10cSrcweir         xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
1677cdf0e10cSrcweir                                          makeAny( p->getItemValues() ) );
1678cdf0e10cSrcweir         xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ),
1679cdf0e10cSrcweir                                          makeAny( p->getSelectedItems() ) );
1680cdf0e10cSrcweir     }
1681cdf0e10cSrcweir     ctx.importEvents( _events );
1682cdf0e10cSrcweir     // avoid ring-reference:
1683cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
1684cdf0e10cSrcweir     _events.clear();
1685cdf0e10cSrcweir }
1686cdf0e10cSrcweir 
1687cdf0e10cSrcweir //##################################################################################################
1688cdf0e10cSrcweir 
1689cdf0e10cSrcweir // combobox
1690cdf0e10cSrcweir //__________________________________________________________________________________________________
1691cdf0e10cSrcweir Reference< xml::input::XElement > ComboBoxElement::startChildElement(
1692cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
1693cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
1694cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1695cdf0e10cSrcweir {
1696cdf0e10cSrcweir     // event
1697cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
1698cdf0e10cSrcweir     {
1699cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1700cdf0e10cSrcweir     }
1701cdf0e10cSrcweir     else if (_pImport->XMLNS_DIALOGS_UID != nUid)
1702cdf0e10cSrcweir     {
1703cdf0e10cSrcweir         throw xml::sax::SAXException(
1704cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
1705cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1706cdf0e10cSrcweir     }
1707cdf0e10cSrcweir     // menupopup
1708cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menupopup") ))
1709cdf0e10cSrcweir     {
1710cdf0e10cSrcweir         _popup = new MenuPopupElement( rLocalName, xAttributes, this, _pImport );
1711cdf0e10cSrcweir         return _popup;
1712cdf0e10cSrcweir     }
1713cdf0e10cSrcweir     else
1714cdf0e10cSrcweir     {
1715cdf0e10cSrcweir         throw xml::sax::SAXException(
1716cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event or menupopup element!") ),
1717cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1718cdf0e10cSrcweir     }
1719cdf0e10cSrcweir }
1720cdf0e10cSrcweir //__________________________________________________________________________________________________
1721cdf0e10cSrcweir void ComboBoxElement::endElement()
1722cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1723cdf0e10cSrcweir {
1724cdf0e10cSrcweir     ControlImportContext ctx(
1725cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
1726cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) );
1727cdf0e10cSrcweir     Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1728cdf0e10cSrcweir 
1729cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1730cdf0e10cSrcweir     if (xStyle.is())
1731cdf0e10cSrcweir     {
1732cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1733cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xControlModel );
1734cdf0e10cSrcweir         pStyle->importTextColorStyle( xControlModel );
1735cdf0e10cSrcweir         pStyle->importTextLineColorStyle( xControlModel );
1736cdf0e10cSrcweir         pStyle->importBorderStyle( xControlModel );
1737cdf0e10cSrcweir         pStyle->importFontStyle( xControlModel );
1738cdf0e10cSrcweir     }
1739cdf0e10cSrcweir 
1740cdf0e10cSrcweir     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1741cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1742cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1743cdf0e10cSrcweir                                _xAttributes );
1744cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
1745cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
1746cdf0e10cSrcweir                                _xAttributes );
1747cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Autocomplete") ),
1748cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("autocomplete") ),
1749cdf0e10cSrcweir                                _xAttributes );
1750cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
1751cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
1752cdf0e10cSrcweir                                _xAttributes );
1753cdf0e10cSrcweir     ctx.importBooleanProperty(
1754cdf0e10cSrcweir         OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
1755cdf0e10cSrcweir         _xAttributes );
1756cdf0e10cSrcweir     ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
1757cdf0e10cSrcweir                              OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ),
1758cdf0e10cSrcweir                              _xAttributes );
1759cdf0e10cSrcweir     ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
1760cdf0e10cSrcweir                              OUString( RTL_CONSTASCII_USTRINGPARAM("linecount") ),
1761cdf0e10cSrcweir                              _xAttributes );
1762cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
1763cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1764cdf0e10cSrcweir                               _xAttributes );
1765cdf0e10cSrcweir     ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1766cdf0e10cSrcweir                              OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1767cdf0e10cSrcweir                              _xAttributes );
1768cdf0e10cSrcweir 
1769cdf0e10cSrcweir     if (_popup.is())
1770cdf0e10cSrcweir     {
1771cdf0e10cSrcweir         MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
1772cdf0e10cSrcweir         xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
1773cdf0e10cSrcweir                                          makeAny( p->getItemValues() ) );
1774cdf0e10cSrcweir     }
1775cdf0e10cSrcweir 
1776cdf0e10cSrcweir     ctx.importEvents( _events );
1777cdf0e10cSrcweir     // avoid ring-reference:
1778cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
1779cdf0e10cSrcweir     _events.clear();
1780cdf0e10cSrcweir }
1781cdf0e10cSrcweir 
1782cdf0e10cSrcweir //##################################################################################################
1783cdf0e10cSrcweir 
1784cdf0e10cSrcweir // checkbox
1785cdf0e10cSrcweir //__________________________________________________________________________________________________
1786cdf0e10cSrcweir Reference< xml::input::XElement > CheckBoxElement::startChildElement(
1787cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
1788cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
1789cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1790cdf0e10cSrcweir {
1791cdf0e10cSrcweir     // event
1792cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
1793cdf0e10cSrcweir     {
1794cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1795cdf0e10cSrcweir     }
1796cdf0e10cSrcweir     else
1797cdf0e10cSrcweir     {
1798cdf0e10cSrcweir         throw xml::sax::SAXException(
1799cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1800cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1801cdf0e10cSrcweir     }
1802cdf0e10cSrcweir }
1803cdf0e10cSrcweir //__________________________________________________________________________________________________
1804cdf0e10cSrcweir void CheckBoxElement::endElement()
1805cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1806cdf0e10cSrcweir {
1807cdf0e10cSrcweir     ControlImportContext ctx(
1808cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
1809cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) );
1810cdf0e10cSrcweir     Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1811cdf0e10cSrcweir 
1812cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1813cdf0e10cSrcweir     if (xStyle.is())
1814cdf0e10cSrcweir     {
1815cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1816cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xControlModel );
1817cdf0e10cSrcweir         pStyle->importTextColorStyle( xControlModel );
1818cdf0e10cSrcweir         pStyle->importTextLineColorStyle( xControlModel );
1819cdf0e10cSrcweir         pStyle->importFontStyle( xControlModel );
1820cdf0e10cSrcweir         pStyle->importVisualEffectStyle( xControlModel );
1821cdf0e10cSrcweir     }
1822cdf0e10cSrcweir 
1823cdf0e10cSrcweir     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1824cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1825cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1826cdf0e10cSrcweir                                _xAttributes );
1827cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1828cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1829cdf0e10cSrcweir                               _xAttributes );
1830cdf0e10cSrcweir     ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1831cdf0e10cSrcweir                              OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1832cdf0e10cSrcweir                              _xAttributes );
1833cdf0e10cSrcweir     ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
1834cdf0e10cSrcweir                                      OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
1835cdf0e10cSrcweir                                      _xAttributes );
1836cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
1837cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
1838cdf0e10cSrcweir                               _xAttributes );
1839cdf0e10cSrcweir     ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
1840cdf0e10cSrcweir                                      OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
1841cdf0e10cSrcweir                                      _xAttributes );
1842cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1843cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1844cdf0e10cSrcweir                                _xAttributes );
1845cdf0e10cSrcweir 
1846cdf0e10cSrcweir 
1847cdf0e10cSrcweir     sal_Bool bTriState = sal_False;
1848cdf0e10cSrcweir     if (getBoolAttr( &bTriState,
1849cdf0e10cSrcweir                      OUString( RTL_CONSTASCII_USTRINGPARAM("tristate") ),
1850cdf0e10cSrcweir                      _xAttributes,
1851cdf0e10cSrcweir                      _pImport->XMLNS_DIALOGS_UID ))
1852cdf0e10cSrcweir     {
1853cdf0e10cSrcweir         xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("TriState") ),
1854cdf0e10cSrcweir                                          makeAny( bTriState ) );
1855cdf0e10cSrcweir     }
1856cdf0e10cSrcweir     sal_Bool bChecked = sal_False;
1857cdf0e10cSrcweir     if (getBoolAttr( &bChecked,
1858cdf0e10cSrcweir                      OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ),
1859cdf0e10cSrcweir                      _xAttributes,
1860cdf0e10cSrcweir                      _pImport->XMLNS_DIALOGS_UID ))
1861cdf0e10cSrcweir     {
1862cdf0e10cSrcweir         // has "checked" attribute
1863cdf0e10cSrcweir         sal_Int16 nVal = (bChecked ? 1 : 0);
1864cdf0e10cSrcweir         xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
1865cdf0e10cSrcweir                                          makeAny( nVal ) );
1866cdf0e10cSrcweir     }
1867cdf0e10cSrcweir     else
1868cdf0e10cSrcweir     {
1869cdf0e10cSrcweir         sal_Int16 nVal = (bTriState ? 2 : 0); // if tristate set, but checked omitted => dont know!
1870cdf0e10cSrcweir         xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
1871cdf0e10cSrcweir                                          makeAny( nVal ) );
1872cdf0e10cSrcweir     }
1873cdf0e10cSrcweir 
1874cdf0e10cSrcweir     ctx.importEvents( _events );
1875cdf0e10cSrcweir     // avoid ring-reference:
1876cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
1877cdf0e10cSrcweir     _events.clear();
1878cdf0e10cSrcweir }
1879cdf0e10cSrcweir 
1880cdf0e10cSrcweir //##################################################################################################
1881cdf0e10cSrcweir 
1882cdf0e10cSrcweir // button
1883cdf0e10cSrcweir //__________________________________________________________________________________________________
1884cdf0e10cSrcweir Reference< xml::input::XElement > ButtonElement::startChildElement(
1885cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
1886cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
1887cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1888cdf0e10cSrcweir {
1889cdf0e10cSrcweir     // event
1890cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
1891cdf0e10cSrcweir     {
1892cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1893cdf0e10cSrcweir     }
1894cdf0e10cSrcweir     else
1895cdf0e10cSrcweir     {
1896cdf0e10cSrcweir         throw xml::sax::SAXException(
1897cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1898cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1899cdf0e10cSrcweir     }
1900cdf0e10cSrcweir }
1901cdf0e10cSrcweir //__________________________________________________________________________________________________
1902cdf0e10cSrcweir void ButtonElement::endElement()
1903cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1904cdf0e10cSrcweir {
1905cdf0e10cSrcweir     ControlImportContext ctx(
1906cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
1907cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) );
1908cdf0e10cSrcweir 
1909cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1910cdf0e10cSrcweir     if (xStyle.is())
1911cdf0e10cSrcweir     {
1912cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1913cdf0e10cSrcweir         Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1914cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xControlModel );
1915cdf0e10cSrcweir         pStyle->importTextColorStyle( xControlModel );
1916cdf0e10cSrcweir         pStyle->importTextLineColorStyle( xControlModel );
1917cdf0e10cSrcweir         pStyle->importFontStyle( xControlModel );
1918cdf0e10cSrcweir     }
1919cdf0e10cSrcweir 
1920cdf0e10cSrcweir     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1921cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1922cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1923cdf0e10cSrcweir                                _xAttributes );
1924cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1925cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1926cdf0e10cSrcweir                               _xAttributes );
1927cdf0e10cSrcweir     ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1928cdf0e10cSrcweir                              OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1929cdf0e10cSrcweir                              _xAttributes );
1930cdf0e10cSrcweir     ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
1931cdf0e10cSrcweir                                      OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
1932cdf0e10cSrcweir                                      _xAttributes );
1933cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultButton") ),
1934cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("default") ),
1935cdf0e10cSrcweir                                _xAttributes );
1936cdf0e10cSrcweir     ctx.importButtonTypeProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("PushButtonType") ),
1937cdf0e10cSrcweir                                   OUString( RTL_CONSTASCII_USTRINGPARAM("button-type") ),
1938cdf0e10cSrcweir                                   _xAttributes );
1939cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
1940cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
1941cdf0e10cSrcweir                               _xAttributes );
1942cdf0e10cSrcweir     ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
1943cdf0e10cSrcweir                                      OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
1944cdf0e10cSrcweir                                      _xAttributes );
1945cdf0e10cSrcweir     ctx.importImageAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageAlign") ),
1946cdf0e10cSrcweir                                   OUString( RTL_CONSTASCII_USTRINGPARAM("image-align") ),
1947cdf0e10cSrcweir                                   _xAttributes );
1948cdf0e10cSrcweir     if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
1949cdf0e10cSrcweir                                 _xAttributes ))
1950cdf0e10cSrcweir         ctx.getControlModel()->setPropertyValue(
1951cdf0e10cSrcweir             OUSTR("Repeat"), makeAny(true) );
1952cdf0e10cSrcweir     sal_Int32 toggled = 0;
1953cdf0e10cSrcweir     if (getLongAttr( &toggled, OUSTR("toggled"), _xAttributes,
1954cdf0e10cSrcweir                      _pImport->XMLNS_DIALOGS_UID ) && toggled == 1)
1955cdf0e10cSrcweir         ctx.getControlModel()->setPropertyValue(OUSTR("Toggle"), makeAny(true));
1956cdf0e10cSrcweir     ctx.importBooleanProperty( OUSTR("FocusOnClick"), OUSTR("grab-focus"),
1957cdf0e10cSrcweir                                _xAttributes );
1958cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1959cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1960cdf0e10cSrcweir                                _xAttributes );
1961cdf0e10cSrcweir     // State
1962cdf0e10cSrcweir     sal_Bool bChecked = sal_False;
1963cdf0e10cSrcweir     if (getBoolAttr(
1964cdf0e10cSrcweir             &bChecked,
1965cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ),
1966cdf0e10cSrcweir             _xAttributes,
1967cdf0e10cSrcweir             _pImport->XMLNS_DIALOGS_UID ) &&
1968cdf0e10cSrcweir         bChecked)
1969cdf0e10cSrcweir     {
1970cdf0e10cSrcweir         sal_Int16 nVal = 1;
1971cdf0e10cSrcweir         ctx.getControlModel()->setPropertyValue(
1972cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("State") ), makeAny( nVal ) );
1973cdf0e10cSrcweir     }
1974cdf0e10cSrcweir 
1975cdf0e10cSrcweir     ctx.importEvents( _events );
1976cdf0e10cSrcweir     // avoid ring-reference:
1977cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
1978cdf0e10cSrcweir     _events.clear();
1979cdf0e10cSrcweir }
1980cdf0e10cSrcweir 
1981cdf0e10cSrcweir //##################################################################################################
1982cdf0e10cSrcweir 
1983cdf0e10cSrcweir // bulletinboard
1984cdf0e10cSrcweir //__________________________________________________________________________________________________
1985cdf0e10cSrcweir Reference< xml::input::XElement > BulletinBoardElement::startChildElement(
1986cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
1987cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
1988cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1989cdf0e10cSrcweir {
1990cdf0e10cSrcweir     if (_pImport->XMLNS_DIALOGS_UID != nUid)
1991cdf0e10cSrcweir     {
1992cdf0e10cSrcweir         throw xml::sax::SAXException(
1993cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
1994cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1995cdf0e10cSrcweir     }
1996cdf0e10cSrcweir     // button
1997cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("button") ))
1998cdf0e10cSrcweir     {
1999cdf0e10cSrcweir         return new ButtonElement( rLocalName, xAttributes, this, _pImport );
2000cdf0e10cSrcweir     }
2001cdf0e10cSrcweir     // checkbox
2002cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("checkbox") ))
2003cdf0e10cSrcweir     {
2004cdf0e10cSrcweir         return new CheckBoxElement( rLocalName, xAttributes, this, _pImport );
2005cdf0e10cSrcweir     }
2006cdf0e10cSrcweir     // combobox
2007cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("combobox") ))
2008cdf0e10cSrcweir     {
2009cdf0e10cSrcweir         return new ComboBoxElement( rLocalName, xAttributes, this, _pImport );
2010cdf0e10cSrcweir     }
2011cdf0e10cSrcweir     // listbox
2012cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menulist") ))
2013cdf0e10cSrcweir     {
2014cdf0e10cSrcweir         return new MenuListElement( rLocalName, xAttributes, this, _pImport );
2015cdf0e10cSrcweir     }
2016cdf0e10cSrcweir     // radiogroup
2017cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("radiogroup") ))
2018cdf0e10cSrcweir     {
2019cdf0e10cSrcweir         return new RadioGroupElement( rLocalName, xAttributes, this, _pImport );
2020cdf0e10cSrcweir     }
2021cdf0e10cSrcweir     // titledbox
2022cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("titledbox") ))
2023cdf0e10cSrcweir     {
2024cdf0e10cSrcweir         return new TitledBoxElement( rLocalName, xAttributes, this, _pImport );
2025cdf0e10cSrcweir     }
2026cdf0e10cSrcweir     // text
2027cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("text") ))
2028cdf0e10cSrcweir     {
2029cdf0e10cSrcweir         return new TextElement( rLocalName, xAttributes, this, _pImport );
2030cdf0e10cSrcweir     }
2031cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("linklabel") ))
2032cdf0e10cSrcweir     {
2033cdf0e10cSrcweir         return new FixedHyperLinkElement( rLocalName, xAttributes, this, _pImport );
2034cdf0e10cSrcweir     }
2035cdf0e10cSrcweir     // textfield
2036cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("textfield") ))
2037cdf0e10cSrcweir     {
2038cdf0e10cSrcweir         return new TextFieldElement( rLocalName, xAttributes, this, _pImport );
2039cdf0e10cSrcweir     }
2040cdf0e10cSrcweir     // img
2041cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("img") ))
2042cdf0e10cSrcweir     {
2043cdf0e10cSrcweir         return new ImageControlElement( rLocalName, xAttributes, this, _pImport );
2044cdf0e10cSrcweir     }
2045cdf0e10cSrcweir     // filecontrol
2046cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("filecontrol") ))
2047cdf0e10cSrcweir     {
2048cdf0e10cSrcweir         return new FileControlElement( rLocalName, xAttributes, this, _pImport );
2049cdf0e10cSrcweir     }
2050cdf0e10cSrcweir     // treecontrol
2051cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("treecontrol") ))
2052cdf0e10cSrcweir     {
2053cdf0e10cSrcweir         return new TreeControlElement( rLocalName, xAttributes, this, _pImport );
2054cdf0e10cSrcweir     }
2055cdf0e10cSrcweir     // currencyfield
2056cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("currencyfield") ))
2057cdf0e10cSrcweir     {
2058cdf0e10cSrcweir         return new CurrencyFieldElement( rLocalName, xAttributes, this, _pImport );
2059cdf0e10cSrcweir     }
2060cdf0e10cSrcweir     // datefield
2061cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("datefield") ))
2062cdf0e10cSrcweir     {
2063cdf0e10cSrcweir         return new DateFieldElement( rLocalName, xAttributes, this, _pImport );
2064cdf0e10cSrcweir     }
2065cdf0e10cSrcweir     // datefield
2066cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("numericfield") ))
2067cdf0e10cSrcweir     {
2068cdf0e10cSrcweir         return new NumericFieldElement( rLocalName, xAttributes, this, _pImport );
2069cdf0e10cSrcweir     }
2070cdf0e10cSrcweir     // timefield
2071cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("timefield") ))
2072cdf0e10cSrcweir     {
2073cdf0e10cSrcweir         return new TimeFieldElement( rLocalName, xAttributes, this, _pImport );
2074cdf0e10cSrcweir     }
2075cdf0e10cSrcweir     // patternfield
2076cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("patternfield") ))
2077cdf0e10cSrcweir     {
2078cdf0e10cSrcweir         return new PatternFieldElement( rLocalName, xAttributes, this, _pImport );
2079cdf0e10cSrcweir     }
2080cdf0e10cSrcweir     // formattedfield
2081cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("formattedfield") ))
2082cdf0e10cSrcweir     {
2083cdf0e10cSrcweir         return new FormattedFieldElement( rLocalName, xAttributes, this, _pImport );
2084cdf0e10cSrcweir     }
2085cdf0e10cSrcweir     // fixedline
2086cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("fixedline") ))
2087cdf0e10cSrcweir     {
2088cdf0e10cSrcweir         return new FixedLineElement( rLocalName, xAttributes, this, _pImport );
2089cdf0e10cSrcweir     }
2090cdf0e10cSrcweir     // scrollbar
2091cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("scrollbar") ))
2092cdf0e10cSrcweir     {
2093cdf0e10cSrcweir         return new ScrollBarElement( rLocalName, xAttributes, this, _pImport );
2094cdf0e10cSrcweir     }
2095cdf0e10cSrcweir     // progressmeter
2096cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("progressmeter") ))
2097cdf0e10cSrcweir     {
2098cdf0e10cSrcweir         return new ProgressBarElement( rLocalName, xAttributes, this, _pImport );
2099cdf0e10cSrcweir     }
2100cdf0e10cSrcweir     // bulletinboard
2101cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") ))
2102cdf0e10cSrcweir     {
2103cdf0e10cSrcweir         return new BulletinBoardElement( rLocalName, xAttributes, this, _pImport );
2104cdf0e10cSrcweir     }
2105cdf0e10cSrcweir     else
2106cdf0e10cSrcweir     {
2107cdf0e10cSrcweir         throw xml::sax::SAXException(
2108cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected styles, bulletinboard or bulletinboard element, not: ") ) + rLocalName,
2109cdf0e10cSrcweir             Reference< XInterface >(), Any() );
2110cdf0e10cSrcweir     }
2111cdf0e10cSrcweir }
2112cdf0e10cSrcweir //__________________________________________________________________________________________________
2113cdf0e10cSrcweir BulletinBoardElement::BulletinBoardElement(
2114cdf0e10cSrcweir     OUString const & rLocalName,
2115cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes,
2116cdf0e10cSrcweir     ElementBase * pParent, DialogImport * pImport )
2117cdf0e10cSrcweir     SAL_THROW( () )
2118cdf0e10cSrcweir     : ControlElement( rLocalName, xAttributes, pParent, pImport )
2119cdf0e10cSrcweir {
2120cdf0e10cSrcweir     OUString aValue(
2121cdf0e10cSrcweir         _xAttributes->getValueByUidName(
2122cdf0e10cSrcweir             _pImport->XMLNS_DIALOGS_UID,
2123cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("left") ) ) );
2124cdf0e10cSrcweir     if (aValue.getLength())
2125cdf0e10cSrcweir     {
2126cdf0e10cSrcweir         _nBasePosX += toInt32( aValue );
2127cdf0e10cSrcweir     }
2128cdf0e10cSrcweir     aValue = _xAttributes->getValueByUidName(
2129cdf0e10cSrcweir         _pImport->XMLNS_DIALOGS_UID,
2130cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("top") ) );
2131cdf0e10cSrcweir     if (aValue.getLength())
2132cdf0e10cSrcweir     {
2133cdf0e10cSrcweir         _nBasePosY += toInt32( aValue );
2134cdf0e10cSrcweir     }
2135cdf0e10cSrcweir }
2136cdf0e10cSrcweir 
2137cdf0e10cSrcweir //##################################################################################################
2138cdf0e10cSrcweir 
2139cdf0e10cSrcweir // style
2140cdf0e10cSrcweir //__________________________________________________________________________________________________
2141cdf0e10cSrcweir Reference< xml::input::XElement > StyleElement::startChildElement(
2142cdf0e10cSrcweir     sal_Int32 /*nUid*/, OUString const & /*rLocalName*/,
2143cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & /*xAttributes*/ )
2144cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
2145cdf0e10cSrcweir {
2146cdf0e10cSrcweir     throw xml::sax::SAXException(
2147cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("unexpected sub elements of style!") ),
2148cdf0e10cSrcweir         Reference< XInterface >(), Any() );
2149cdf0e10cSrcweir }
2150cdf0e10cSrcweir //__________________________________________________________________________________________________
2151cdf0e10cSrcweir void StyleElement::endElement()
2152cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
2153cdf0e10cSrcweir {
2154cdf0e10cSrcweir     Reference< xml::input::XAttributes > xStyle;
2155cdf0e10cSrcweir     OUString aStyleId(
2156cdf0e10cSrcweir         _xAttributes->getValueByUidName(
2157cdf0e10cSrcweir             _pImport->XMLNS_DIALOGS_UID,
2158cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("style-id") ) ) );
2159cdf0e10cSrcweir     if (aStyleId.getLength())
2160cdf0e10cSrcweir     {
2161cdf0e10cSrcweir         _pImport->addStyle( aStyleId, this );
2162cdf0e10cSrcweir     }
2163cdf0e10cSrcweir     else
2164cdf0e10cSrcweir     {
2165cdf0e10cSrcweir         throw xml::sax::SAXException(
2166cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("missing style-id attribute!") ),
2167cdf0e10cSrcweir             Reference< XInterface >(), Any() );
2168cdf0e10cSrcweir     }
2169cdf0e10cSrcweir }
2170cdf0e10cSrcweir 
2171cdf0e10cSrcweir //##################################################################################################
2172cdf0e10cSrcweir 
2173cdf0e10cSrcweir // styles
2174cdf0e10cSrcweir //__________________________________________________________________________________________________
2175cdf0e10cSrcweir Reference< xml::input::XElement > StylesElement::startChildElement(
2176cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
2177cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
2178cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
2179cdf0e10cSrcweir {
2180cdf0e10cSrcweir     if (_pImport->XMLNS_DIALOGS_UID != nUid)
2181cdf0e10cSrcweir     {
2182cdf0e10cSrcweir         throw xml::sax::SAXException(
2183cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
2184cdf0e10cSrcweir             Reference< XInterface >(), Any() );
2185cdf0e10cSrcweir     }
2186cdf0e10cSrcweir     // style
2187cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("style") ))
2188cdf0e10cSrcweir     {
2189cdf0e10cSrcweir         return new StyleElement( rLocalName, xAttributes, this, _pImport );
2190cdf0e10cSrcweir     }
2191cdf0e10cSrcweir     else
2192cdf0e10cSrcweir     {
2193cdf0e10cSrcweir         throw xml::sax::SAXException(
2194cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected style element!") ),
2195cdf0e10cSrcweir             Reference< XInterface >(), Any() );
2196cdf0e10cSrcweir     }
2197cdf0e10cSrcweir }
2198cdf0e10cSrcweir 
2199cdf0e10cSrcweir //##################################################################################################
2200cdf0e10cSrcweir 
2201cdf0e10cSrcweir // window
2202cdf0e10cSrcweir //__________________________________________________________________________________________________
2203cdf0e10cSrcweir Reference< xml::input::XElement > WindowElement::startChildElement(
2204cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
2205cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
2206cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
2207cdf0e10cSrcweir {
2208cdf0e10cSrcweir     // event
2209cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
2210cdf0e10cSrcweir     {
2211cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
2212cdf0e10cSrcweir     }
2213cdf0e10cSrcweir     else if (_pImport->XMLNS_DIALOGS_UID != nUid)
2214cdf0e10cSrcweir     {
2215cdf0e10cSrcweir         throw xml::sax::SAXException(
2216cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
2217cdf0e10cSrcweir             Reference< XInterface >(), Any() );
2218cdf0e10cSrcweir     }
2219cdf0e10cSrcweir     // styles
2220cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("styles") ))
2221cdf0e10cSrcweir     {
2222cdf0e10cSrcweir         return new StylesElement( rLocalName, xAttributes, this, _pImport );
2223cdf0e10cSrcweir     }
2224cdf0e10cSrcweir     // bulletinboard
2225cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") ))
2226cdf0e10cSrcweir     {
2227cdf0e10cSrcweir         return new BulletinBoardElement( rLocalName, xAttributes, this, _pImport );
2228cdf0e10cSrcweir     }
2229cdf0e10cSrcweir     else
2230cdf0e10cSrcweir     {
2231cdf0e10cSrcweir         throw xml::sax::SAXException(
2232cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected styles ot bulletinboard element!") ),
2233cdf0e10cSrcweir             Reference< XInterface >(), Any() );
2234cdf0e10cSrcweir     }
2235cdf0e10cSrcweir }
2236cdf0e10cSrcweir //__________________________________________________________________________________________________
2237cdf0e10cSrcweir void WindowElement::endElement()
2238cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
2239cdf0e10cSrcweir {
2240cdf0e10cSrcweir     Reference< beans::XPropertySet > xProps(
2241cdf0e10cSrcweir         _pImport->_xDialogModel, UNO_QUERY_THROW );
2242cdf0e10cSrcweir     ImportContext ctx( _pImport, xProps, getControlId( _xAttributes ) );
2243cdf0e10cSrcweir 
2244cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
2245cdf0e10cSrcweir     if (xStyle.is())
2246cdf0e10cSrcweir     {
2247cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
2248cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xProps );
2249cdf0e10cSrcweir         pStyle->importTextColorStyle( xProps );
2250cdf0e10cSrcweir         pStyle->importTextLineColorStyle( xProps );
2251cdf0e10cSrcweir         pStyle->importFontStyle( xProps );
2252cdf0e10cSrcweir     }
2253cdf0e10cSrcweir 
2254cdf0e10cSrcweir     ctx.importDefaults( 0, 0, _xAttributes, false );
2255cdf0e10cSrcweir     ctx.importBooleanProperty(
2256cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("Closeable") ),
2257cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("closeable") ),
2258cdf0e10cSrcweir         _xAttributes );
2259cdf0e10cSrcweir     ctx.importBooleanProperty(
2260cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("Moveable") ),
2261cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("moveable") ),
2262cdf0e10cSrcweir         _xAttributes );
2263cdf0e10cSrcweir     ctx.importBooleanProperty(
2264cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("Sizeable") ),
2265cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("resizeable") ),
2266cdf0e10cSrcweir         _xAttributes );
2267cdf0e10cSrcweir     ctx.importStringProperty(
2268cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ),
2269cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("title") ),
2270cdf0e10cSrcweir         _xAttributes );
2271cdf0e10cSrcweir     ctx.importBooleanProperty(
2272cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("Decoration") ),
2273cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("withtitlebar") ),
2274cdf0e10cSrcweir         _xAttributes );
2275cdf0e10cSrcweir     ctx.importStringProperty(
2276cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
2277cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
2278cdf0e10cSrcweir         _xAttributes );
2279cdf0e10cSrcweir     ctx.importEvents( _events );
2280cdf0e10cSrcweir     // avoid ring-reference:
2281cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
2282cdf0e10cSrcweir     _events.clear();
2283cdf0e10cSrcweir }
2284cdf0e10cSrcweir 
2285cdf0e10cSrcweir }
2286