xref: /trunk/main/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx (revision cf6516809c57e1bb0a940545cca99cdad54d4ce2)
1e1d5bd03SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3e1d5bd03SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4e1d5bd03SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5e1d5bd03SAndrew Rist  * distributed with this work for additional information
6e1d5bd03SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7e1d5bd03SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8e1d5bd03SAndrew Rist  * "License"); you may not use this file except in compliance
9e1d5bd03SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11e1d5bd03SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13e1d5bd03SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14e1d5bd03SAndrew Rist  * software distributed under the License is distributed on an
15e1d5bd03SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16e1d5bd03SAndrew Rist  * KIND, either express or implied.  See the License for the
17e1d5bd03SAndrew Rist  * specific language governing permissions and limitations
18e1d5bd03SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20e1d5bd03SAndrew Rist  *************************************************************/
21e1d5bd03SAndrew Rist 
22e1d5bd03SAndrew 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 //__________________________________________________________________________________________________
startChildElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)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 //__________________________________________________________________________________________________
endElement()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 //__________________________________________________________________________________________________
startChildElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)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 //__________________________________________________________________________________________________
endElement()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 //__________________________________________________________________________________________________
startChildElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)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 //__________________________________________________________________________________________________
endElement()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 //__________________________________________________________________________________________________
startChildElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)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 //__________________________________________________________________________________________________
endElement()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 //__________________________________________________________________________________________________
startChildElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)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 //__________________________________________________________________________________________________
endElement()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         {
45386e1cf34SPedro Giffuni             OSL_ENSURE( 0, "### util::MalformedNumberFormatException occurred!" );
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 //__________________________________________________________________________________________________
startChildElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)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 //__________________________________________________________________________________________________
endElement()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 //__________________________________________________________________________________________________
startChildElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)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 //__________________________________________________________________________________________________
endElement()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 //__________________________________________________________________________________________________
startChildElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)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 //__________________________________________________________________________________________________
endElement()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 //__________________________________________________________________________________________________
startChildElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)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 //__________________________________________________________________________________________________
endElement()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 //__________________________________________________________________________________________________
startChildElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)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 //__________________________________________________________________________________________________
endElement()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 //__________________________________________________________________________________________________
startChildElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)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 //__________________________________________________________________________________________________
endElement()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 //__________________________________________________________________________________________________
startChildElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)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 //__________________________________________________________________________________________________
endElement()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 );
1002*874957b9STsutomu Uchino     ctx.importImageScaleModeProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleMode") ),
1003*874957b9STsutomu Uchino                                      OUString( RTL_CONSTASCII_USTRINGPARAM("scale-mode") ),
1004*874957b9STsutomu Uchino                                      _xAttributes );
1005cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
1006cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("src") ),
1007cdf0e10cSrcweir                               _xAttributes );
1008cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1009cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1010cdf0e10cSrcweir                                _xAttributes );
1011cdf0e10cSrcweir     ctx.importEvents( _events );
1012cdf0e10cSrcweir     // avoid ring-reference:
1013cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
1014cdf0e10cSrcweir     _events.clear();
1015cdf0e10cSrcweir }
1016cdf0e10cSrcweir 
1017cdf0e10cSrcweir //##################################################################################################
1018cdf0e10cSrcweir 
1019cdf0e10cSrcweir // textfield
1020cdf0e10cSrcweir //__________________________________________________________________________________________________
startChildElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)1021cdf0e10cSrcweir Reference< xml::input::XElement > TextElement::startChildElement(
1022cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
1023cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
1024cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1025cdf0e10cSrcweir {
1026cdf0e10cSrcweir     // event
1027cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
1028cdf0e10cSrcweir     {
1029cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1030cdf0e10cSrcweir     }
1031cdf0e10cSrcweir     else
1032cdf0e10cSrcweir     {
1033cdf0e10cSrcweir         throw xml::sax::SAXException(
1034cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1035cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1036cdf0e10cSrcweir     }
1037cdf0e10cSrcweir }
1038cdf0e10cSrcweir //__________________________________________________________________________________________________
endElement()1039cdf0e10cSrcweir void TextElement::endElement()
1040cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1041cdf0e10cSrcweir {
1042cdf0e10cSrcweir     ControlImportContext ctx(
1043cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
1044cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) );
1045cdf0e10cSrcweir 
1046cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1047cdf0e10cSrcweir     if (xStyle.is())
1048cdf0e10cSrcweir     {
1049cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1050cdf0e10cSrcweir         Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1051cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xControlModel );
1052cdf0e10cSrcweir         pStyle->importTextColorStyle( xControlModel );
1053cdf0e10cSrcweir         pStyle->importTextLineColorStyle( xControlModel );
1054cdf0e10cSrcweir         pStyle->importBorderStyle( xControlModel );
1055cdf0e10cSrcweir         pStyle->importFontStyle( xControlModel );
1056cdf0e10cSrcweir     }
1057cdf0e10cSrcweir 
1058cdf0e10cSrcweir     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1059cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1060cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1061cdf0e10cSrcweir                               _xAttributes );
1062cdf0e10cSrcweir     ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1063cdf0e10cSrcweir                              OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1064cdf0e10cSrcweir                              _xAttributes );
1065cdf0e10cSrcweir     ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
1066cdf0e10cSrcweir                                      OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
1067cdf0e10cSrcweir                                      _xAttributes );
1068cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1069cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1070cdf0e10cSrcweir                                _xAttributes );
1071cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1072cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1073cdf0e10cSrcweir                                _xAttributes );
1074cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("NoLabel") ),
1075cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("nolabel") ),
1076cdf0e10cSrcweir                                _xAttributes );
1077cdf0e10cSrcweir     ctx.importEvents( _events );
1078cdf0e10cSrcweir     // avoid ring-reference:
1079cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
1080cdf0e10cSrcweir     _events.clear();
1081cdf0e10cSrcweir }
1082cdf0e10cSrcweir 
1083cdf0e10cSrcweir //##################################################################################################
1084cdf0e10cSrcweir // FixedHyperLink
1085cdf0e10cSrcweir //__________________________________________________________________________________________________
startChildElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)1086cdf0e10cSrcweir Reference< xml::input::XElement > FixedHyperLinkElement::startChildElement(
1087cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
1088cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
1089cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1090cdf0e10cSrcweir {
1091cdf0e10cSrcweir     // event
1092cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
1093cdf0e10cSrcweir     {
1094cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1095cdf0e10cSrcweir     }
1096cdf0e10cSrcweir     else
1097cdf0e10cSrcweir     {
1098cdf0e10cSrcweir         throw xml::sax::SAXException(
1099cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1100cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1101cdf0e10cSrcweir     }
1102cdf0e10cSrcweir }
1103cdf0e10cSrcweir //__________________________________________________________________________________________________
endElement()1104cdf0e10cSrcweir void FixedHyperLinkElement::endElement()
1105cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1106cdf0e10cSrcweir {
1107cdf0e10cSrcweir     ControlImportContext ctx(
1108cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
1109cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedHyperlinkModel") ) );
1110cdf0e10cSrcweir 
1111cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1112cdf0e10cSrcweir     if (xStyle.is())
1113cdf0e10cSrcweir     {
1114cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1115cdf0e10cSrcweir         Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1116cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xControlModel );
1117cdf0e10cSrcweir         pStyle->importTextColorStyle( xControlModel );
1118cdf0e10cSrcweir         pStyle->importTextLineColorStyle( xControlModel );
1119cdf0e10cSrcweir         pStyle->importBorderStyle( xControlModel );
1120cdf0e10cSrcweir         pStyle->importFontStyle( xControlModel );
1121cdf0e10cSrcweir     }
1122cdf0e10cSrcweir 
1123cdf0e10cSrcweir     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1124cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1125cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1126cdf0e10cSrcweir                               _xAttributes );
1127cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("URL") ),
1128cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("url") ),
1129cdf0e10cSrcweir                               _xAttributes );
1130cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Description") ),
1131cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("description") ),
1132cdf0e10cSrcweir                               _xAttributes );
1133cdf0e10cSrcweir 
1134cdf0e10cSrcweir     ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1135cdf0e10cSrcweir                              OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1136cdf0e10cSrcweir                              _xAttributes );
1137cdf0e10cSrcweir     ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
1138cdf0e10cSrcweir                                      OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
1139cdf0e10cSrcweir                                      _xAttributes );
1140cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1141cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1142cdf0e10cSrcweir                                _xAttributes );
1143cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1144cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1145cdf0e10cSrcweir                                _xAttributes );
1146cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("NoLabel") ),
1147cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("nolabel") ),
1148cdf0e10cSrcweir                                _xAttributes );
1149cdf0e10cSrcweir     ctx.importEvents( _events );
1150cdf0e10cSrcweir     // avoid ring-reference:
1151cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
1152cdf0e10cSrcweir     _events.clear();
1153cdf0e10cSrcweir }
1154cdf0e10cSrcweir 
1155cdf0e10cSrcweir //##################################################################################################
1156cdf0e10cSrcweir 
1157cdf0e10cSrcweir // edit
1158cdf0e10cSrcweir //__________________________________________________________________________________________________
startChildElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)1159cdf0e10cSrcweir Reference< xml::input::XElement > TextFieldElement::startChildElement(
1160cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
1161cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
1162cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1163cdf0e10cSrcweir {
1164cdf0e10cSrcweir     // event
1165cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
1166cdf0e10cSrcweir     {
1167cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1168cdf0e10cSrcweir     }
1169cdf0e10cSrcweir     else
1170cdf0e10cSrcweir     {
1171cdf0e10cSrcweir         throw xml::sax::SAXException(
1172cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1173cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1174cdf0e10cSrcweir     }
1175cdf0e10cSrcweir }
1176cdf0e10cSrcweir //__________________________________________________________________________________________________
endElement()1177cdf0e10cSrcweir void TextFieldElement::endElement()
1178cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1179cdf0e10cSrcweir {
1180cdf0e10cSrcweir     ControlImportContext ctx(
1181cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
1182cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) );
1183cdf0e10cSrcweir     Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1184cdf0e10cSrcweir 
1185cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1186cdf0e10cSrcweir     if (xStyle.is())
1187cdf0e10cSrcweir     {
1188cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1189cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xControlModel );
1190cdf0e10cSrcweir         pStyle->importTextColorStyle( xControlModel );
1191cdf0e10cSrcweir         pStyle->importTextLineColorStyle( xControlModel );
1192cdf0e10cSrcweir         pStyle->importBorderStyle( xControlModel );
1193cdf0e10cSrcweir         pStyle->importFontStyle( xControlModel );
1194cdf0e10cSrcweir     }
1195cdf0e10cSrcweir 
1196cdf0e10cSrcweir     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1197cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1198cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1199cdf0e10cSrcweir                                _xAttributes );
1200cdf0e10cSrcweir     ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1201cdf0e10cSrcweir                              OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1202cdf0e10cSrcweir                              _xAttributes );
1203cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("HardLineBreaks") ),
1204cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("hard-linebreaks") ),
1205cdf0e10cSrcweir                                _xAttributes );
1206cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("HScroll") ),
1207cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("hscroll") ),
1208cdf0e10cSrcweir                                _xAttributes );
1209cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VScroll") ),
1210cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("vscroll") ),
1211cdf0e10cSrcweir                                _xAttributes );
1212cdf0e10cSrcweir     ctx.importBooleanProperty(
1213cdf0e10cSrcweir         OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
1214cdf0e10cSrcweir         _xAttributes );
1215cdf0e10cSrcweir     ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
1216cdf0e10cSrcweir                              OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ),
1217cdf0e10cSrcweir                              _xAttributes );
1218cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1219cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1220cdf0e10cSrcweir                                _xAttributes );
1221cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
1222cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
1223cdf0e10cSrcweir                                _xAttributes );
1224cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
1225cdf0e10cSrcweir                                   OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1226cdf0e10cSrcweir                                   _xAttributes );
1227cdf0e10cSrcweir     ctx.importLineEndFormatProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineEndFormat") ),
1228cdf0e10cSrcweir                                      OUString( RTL_CONSTASCII_USTRINGPARAM("lineend-format") ),
1229cdf0e10cSrcweir                                      _xAttributes );
1230cdf0e10cSrcweir     OUString aValue;
1231cdf0e10cSrcweir     if (getStringAttr( &aValue,
1232cdf0e10cSrcweir                        OUString( RTL_CONSTASCII_USTRINGPARAM("echochar") ),
1233cdf0e10cSrcweir                        _xAttributes,
1234cdf0e10cSrcweir                        _pImport->XMLNS_DIALOGS_UID ) &&
1235cdf0e10cSrcweir         aValue.getLength() > 0)
1236cdf0e10cSrcweir     {
1237cdf0e10cSrcweir         OSL_ENSURE( aValue.getLength() == 1, "### more than one character given for echochar!" );
1238cdf0e10cSrcweir         sal_Int16 nChar = (sal_Int16)aValue[ 0 ];
1239cdf0e10cSrcweir         xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("EchoChar") ),
1240cdf0e10cSrcweir                                          makeAny( nChar ) );
1241cdf0e10cSrcweir     }
1242cdf0e10cSrcweir 
1243cdf0e10cSrcweir     ctx.importEvents( _events );
1244cdf0e10cSrcweir     // avoid ring-reference:
1245cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
1246cdf0e10cSrcweir     _events.clear();
1247cdf0e10cSrcweir }
1248cdf0e10cSrcweir 
1249cdf0e10cSrcweir //##################################################################################################
1250cdf0e10cSrcweir 
1251cdf0e10cSrcweir // titledbox
1252cdf0e10cSrcweir //__________________________________________________________________________________________________
startChildElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)1253cdf0e10cSrcweir Reference< xml::input::XElement > TitledBoxElement::startChildElement(
1254cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
1255cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
1256cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1257cdf0e10cSrcweir {
1258cdf0e10cSrcweir     // event
1259cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
1260cdf0e10cSrcweir     {
1261cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1262cdf0e10cSrcweir     }
1263cdf0e10cSrcweir     else if (_pImport->XMLNS_DIALOGS_UID != nUid)
1264cdf0e10cSrcweir     {
1265cdf0e10cSrcweir         throw xml::sax::SAXException(
1266cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
1267cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1268cdf0e10cSrcweir     }
1269cdf0e10cSrcweir     // title
1270cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("title") ))
1271cdf0e10cSrcweir     {
1272cdf0e10cSrcweir         getStringAttr( &_label,
1273cdf0e10cSrcweir                        OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1274cdf0e10cSrcweir                        xAttributes,
1275cdf0e10cSrcweir                        _pImport->XMLNS_DIALOGS_UID );
1276cdf0e10cSrcweir 
1277cdf0e10cSrcweir         return new ElementBase(
1278cdf0e10cSrcweir             _pImport->XMLNS_DIALOGS_UID,
1279cdf0e10cSrcweir             rLocalName, xAttributes, this, _pImport );
1280cdf0e10cSrcweir     }
1281cdf0e10cSrcweir     // radio
1282cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("radio") ))
1283cdf0e10cSrcweir     {
1284cdf0e10cSrcweir         // dont create radios here, => titledbox must be inserted first due to radio grouping,
1285cdf0e10cSrcweir         // possible predecessors!
1286cdf0e10cSrcweir         Reference< xml::input::XElement > xRet(
1287cdf0e10cSrcweir             new RadioElement( rLocalName, xAttributes, this, _pImport ) );
1288cdf0e10cSrcweir         _radios.push_back( xRet );
1289cdf0e10cSrcweir         return xRet;
1290cdf0e10cSrcweir     }
1291cdf0e10cSrcweir     // event
1292cdf0e10cSrcweir     else if (_pImport->isEventElement( nUid, rLocalName ))
1293cdf0e10cSrcweir     {
1294cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1295cdf0e10cSrcweir     }
1296cdf0e10cSrcweir     else
1297cdf0e10cSrcweir     {
1298cdf0e10cSrcweir         return BulletinBoardElement::startChildElement( nUid, rLocalName, xAttributes );
1299cdf0e10cSrcweir     }
1300cdf0e10cSrcweir }
1301cdf0e10cSrcweir //__________________________________________________________________________________________________
endElement()1302cdf0e10cSrcweir void TitledBoxElement::endElement()
1303cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1304cdf0e10cSrcweir {
1305cdf0e10cSrcweir     {
1306cdf0e10cSrcweir     ControlImportContext ctx(
1307cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
1308cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) );
1309cdf0e10cSrcweir     Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1310cdf0e10cSrcweir 
1311cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1312cdf0e10cSrcweir     if (xStyle.is())
1313cdf0e10cSrcweir     {
1314cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1315cdf0e10cSrcweir         pStyle->importTextColorStyle( xControlModel );
1316cdf0e10cSrcweir         pStyle->importTextLineColorStyle( xControlModel );
1317cdf0e10cSrcweir         pStyle->importFontStyle( xControlModel );
1318cdf0e10cSrcweir     }
1319cdf0e10cSrcweir 
1320cdf0e10cSrcweir     ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
1321cdf0e10cSrcweir 
1322cdf0e10cSrcweir     if (_label.getLength())
1323cdf0e10cSrcweir     {
1324cdf0e10cSrcweir         xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1325cdf0e10cSrcweir                                          makeAny( _label ) );
1326cdf0e10cSrcweir     }
1327cdf0e10cSrcweir 
1328cdf0e10cSrcweir     ctx.importEvents( _events );
1329cdf0e10cSrcweir     // avoid ring-reference:
1330cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
1331cdf0e10cSrcweir     _events.clear();
1332cdf0e10cSrcweir     }
1333cdf0e10cSrcweir 
1334cdf0e10cSrcweir     // create radios AFTER group box!
1335cdf0e10cSrcweir     for ( size_t nPos = 0; nPos < _radios.size(); ++nPos )
1336cdf0e10cSrcweir     {
1337cdf0e10cSrcweir         Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
1338cdf0e10cSrcweir         Reference< xml::input::XAttributes > xAttributes(
1339cdf0e10cSrcweir             xRadio->getAttributes() );
1340cdf0e10cSrcweir 
1341cdf0e10cSrcweir         ControlImportContext ctx(
1342cdf0e10cSrcweir             _pImport, getControlId( xAttributes ),
1343cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) );
1344cdf0e10cSrcweir         Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1345cdf0e10cSrcweir 
1346cdf0e10cSrcweir         Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
1347cdf0e10cSrcweir         if (xStyle.is())
1348cdf0e10cSrcweir         {
1349cdf0e10cSrcweir             StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1350cdf0e10cSrcweir             pStyle->importBackgroundColorStyle( xControlModel );
1351cdf0e10cSrcweir             pStyle->importTextColorStyle( xControlModel );
1352cdf0e10cSrcweir             pStyle->importTextLineColorStyle( xControlModel );
1353cdf0e10cSrcweir             pStyle->importFontStyle( xControlModel );
1354cdf0e10cSrcweir             pStyle->importVisualEffectStyle( xControlModel );
1355cdf0e10cSrcweir         }
1356cdf0e10cSrcweir 
1357cdf0e10cSrcweir         ctx.importDefaults( _nBasePosX, _nBasePosY, xAttributes );
1358cdf0e10cSrcweir         ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1359cdf0e10cSrcweir                                    OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1360cdf0e10cSrcweir                                    xAttributes );
1361cdf0e10cSrcweir         ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1362cdf0e10cSrcweir                                   OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1363cdf0e10cSrcweir                                   xAttributes );
1364cdf0e10cSrcweir         ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1365cdf0e10cSrcweir                                  OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1366cdf0e10cSrcweir                                  xAttributes );
1367cdf0e10cSrcweir         ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
1368cdf0e10cSrcweir                                          OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
1369cdf0e10cSrcweir                                          xAttributes );
1370cdf0e10cSrcweir         ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
1371cdf0e10cSrcweir                                   OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
1372cdf0e10cSrcweir                                   xAttributes );
1373cdf0e10cSrcweir         ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
1374cdf0e10cSrcweir                                          OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
1375cdf0e10cSrcweir                                          xAttributes );
1376cdf0e10cSrcweir         ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1377cdf0e10cSrcweir                                    OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1378cdf0e10cSrcweir                                    xAttributes );
1379cdf0e10cSrcweir 
1380cdf0e10cSrcweir         sal_Int16 nVal = 0;
1381cdf0e10cSrcweir         sal_Bool bChecked = sal_False;
1382cdf0e10cSrcweir         if (getBoolAttr( &bChecked,
1383cdf0e10cSrcweir                          OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ),
1384cdf0e10cSrcweir                          xAttributes,
1385cdf0e10cSrcweir                          _pImport->XMLNS_DIALOGS_UID ) &&
1386cdf0e10cSrcweir             bChecked)
1387cdf0e10cSrcweir         {
1388cdf0e10cSrcweir             nVal = 1;
1389cdf0e10cSrcweir         }
1390cdf0e10cSrcweir         xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
1391cdf0e10cSrcweir                                          makeAny( nVal ) );
1392cdf0e10cSrcweir 
1393cdf0e10cSrcweir         ::std::vector< Reference< xml::input::XElement > > * radioEvents =
1394cdf0e10cSrcweir             static_cast< RadioElement * >( xRadio.get() )->getEvents();
1395cdf0e10cSrcweir         ctx.importEvents( *radioEvents );
1396cdf0e10cSrcweir         // avoid ring-reference:
1397cdf0e10cSrcweir         // vector< event elements > holding event elements holding this (via _pParent)
1398cdf0e10cSrcweir         radioEvents->clear();
1399cdf0e10cSrcweir     }
1400cdf0e10cSrcweir     // avoid ring-reference:
1401cdf0e10cSrcweir     // vector< radio elements > holding radio elements holding this (via _pParent)
1402cdf0e10cSrcweir     _radios.clear();
1403cdf0e10cSrcweir }
1404cdf0e10cSrcweir 
1405cdf0e10cSrcweir //##################################################################################################
1406cdf0e10cSrcweir 
1407cdf0e10cSrcweir // radio
1408cdf0e10cSrcweir //__________________________________________________________________________________________________
startChildElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)1409cdf0e10cSrcweir Reference< xml::input::XElement > RadioElement::startChildElement(
1410cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
1411cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
1412cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1413cdf0e10cSrcweir {
1414cdf0e10cSrcweir     // event
1415cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
1416cdf0e10cSrcweir     {
1417cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1418cdf0e10cSrcweir     }
1419cdf0e10cSrcweir     else
1420cdf0e10cSrcweir     {
1421cdf0e10cSrcweir         throw xml::sax::SAXException(
1422cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1423cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1424cdf0e10cSrcweir     }
1425cdf0e10cSrcweir }
1426cdf0e10cSrcweir 
1427cdf0e10cSrcweir //##################################################################################################
1428cdf0e10cSrcweir 
1429cdf0e10cSrcweir // radiogroup
1430cdf0e10cSrcweir //__________________________________________________________________________________________________
startChildElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)1431cdf0e10cSrcweir Reference< xml::input::XElement > RadioGroupElement::startChildElement(
1432cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
1433cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
1434cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1435cdf0e10cSrcweir {
1436cdf0e10cSrcweir     if (_pImport->XMLNS_DIALOGS_UID != nUid)
1437cdf0e10cSrcweir     {
1438cdf0e10cSrcweir         throw xml::sax::SAXException(
1439cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
1440cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1441cdf0e10cSrcweir     }
1442cdf0e10cSrcweir     // radio
1443cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("radio") ))
1444cdf0e10cSrcweir     {
1445cdf0e10cSrcweir         // dont create radios here, => titledbox must be inserted first due to radio grouping,
1446cdf0e10cSrcweir         // possible predecessors!
1447cdf0e10cSrcweir         Reference< xml::input::XElement > xRet(
1448cdf0e10cSrcweir             new RadioElement( rLocalName, xAttributes, this, _pImport ) );
1449cdf0e10cSrcweir         _radios.push_back( xRet );
1450cdf0e10cSrcweir         return xRet;
1451cdf0e10cSrcweir     }
1452cdf0e10cSrcweir     else
1453cdf0e10cSrcweir     {
1454cdf0e10cSrcweir         throw xml::sax::SAXException(
1455cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected radio element!") ),
1456cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1457cdf0e10cSrcweir     }
1458cdf0e10cSrcweir }
1459cdf0e10cSrcweir //__________________________________________________________________________________________________
endElement()1460cdf0e10cSrcweir void RadioGroupElement::endElement()
1461cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1462cdf0e10cSrcweir {
1463cdf0e10cSrcweir     for ( size_t nPos = 0; nPos < _radios.size(); ++nPos )
1464cdf0e10cSrcweir     {
1465cdf0e10cSrcweir         Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
1466cdf0e10cSrcweir         Reference< xml::input::XAttributes > xAttributes(
1467cdf0e10cSrcweir             xRadio->getAttributes() );
1468cdf0e10cSrcweir 
1469cdf0e10cSrcweir         ControlImportContext ctx(
1470cdf0e10cSrcweir             _pImport, getControlId( xAttributes ),
1471cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) );
1472cdf0e10cSrcweir         Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1473cdf0e10cSrcweir 
1474cdf0e10cSrcweir         Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
1475cdf0e10cSrcweir         if (xStyle.is())
1476cdf0e10cSrcweir         {
1477cdf0e10cSrcweir             StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1478cdf0e10cSrcweir             pStyle->importBackgroundColorStyle( xControlModel );
1479cdf0e10cSrcweir             pStyle->importTextColorStyle( xControlModel );
1480cdf0e10cSrcweir             pStyle->importTextLineColorStyle( xControlModel );
1481cdf0e10cSrcweir             pStyle->importFontStyle( xControlModel );
1482cdf0e10cSrcweir             pStyle->importVisualEffectStyle( xControlModel );
1483cdf0e10cSrcweir         }
1484cdf0e10cSrcweir 
1485cdf0e10cSrcweir         ctx.importDefaults( _nBasePosX, _nBasePosY, xAttributes );
1486cdf0e10cSrcweir         ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1487cdf0e10cSrcweir                                    OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1488cdf0e10cSrcweir                                    xAttributes );
1489cdf0e10cSrcweir         ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1490cdf0e10cSrcweir                                   OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1491cdf0e10cSrcweir                                   xAttributes );
1492cdf0e10cSrcweir         ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1493cdf0e10cSrcweir                                  OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1494cdf0e10cSrcweir                                  xAttributes );
1495cdf0e10cSrcweir         ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
1496cdf0e10cSrcweir                                          OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
1497cdf0e10cSrcweir                                          xAttributes );
1498cdf0e10cSrcweir         ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
1499cdf0e10cSrcweir                                   OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
1500cdf0e10cSrcweir                                   xAttributes );
1501cdf0e10cSrcweir         ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
1502cdf0e10cSrcweir                                          OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
1503cdf0e10cSrcweir                                          xAttributes );
1504cdf0e10cSrcweir         ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1505cdf0e10cSrcweir                                    OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1506cdf0e10cSrcweir                                    xAttributes );
1507cdf0e10cSrcweir         sal_Int16 nVal = 0;
1508cdf0e10cSrcweir         sal_Bool bChecked = sal_False;
1509cdf0e10cSrcweir         if (getBoolAttr( &bChecked,
1510cdf0e10cSrcweir                          OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ),
1511cdf0e10cSrcweir                          xAttributes,
1512cdf0e10cSrcweir                          _pImport->XMLNS_DIALOGS_UID ) &&
1513cdf0e10cSrcweir             bChecked)
1514cdf0e10cSrcweir         {
1515cdf0e10cSrcweir             nVal = 1;
1516cdf0e10cSrcweir         }
1517cdf0e10cSrcweir         xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
1518cdf0e10cSrcweir                                          makeAny( nVal ) );
1519cdf0e10cSrcweir 
1520cdf0e10cSrcweir         ::std::vector< Reference< xml::input::XElement > > * radioEvents =
1521cdf0e10cSrcweir             static_cast< RadioElement * >( xRadio.get() )->getEvents();
1522cdf0e10cSrcweir         ctx.importEvents( *radioEvents );
1523cdf0e10cSrcweir         // avoid ring-reference:
1524cdf0e10cSrcweir         // vector< event elements > holding event elements holding this (via _pParent)
1525cdf0e10cSrcweir         radioEvents->clear();
1526cdf0e10cSrcweir     }
1527cdf0e10cSrcweir     // avoid ring-reference:
1528cdf0e10cSrcweir     // vector< radio elements > holding radio elements holding this (via _pParent)
1529cdf0e10cSrcweir     _radios.clear();
1530cdf0e10cSrcweir }
1531cdf0e10cSrcweir 
1532cdf0e10cSrcweir //##################################################################################################
1533cdf0e10cSrcweir 
1534cdf0e10cSrcweir // menupopup
1535cdf0e10cSrcweir //__________________________________________________________________________________________________
startChildElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)1536cdf0e10cSrcweir Reference< xml::input::XElement > MenuPopupElement::startChildElement(
1537cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
1538cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
1539cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1540cdf0e10cSrcweir {
1541cdf0e10cSrcweir     if (_pImport->XMLNS_DIALOGS_UID != nUid)
1542cdf0e10cSrcweir     {
1543cdf0e10cSrcweir         throw xml::sax::SAXException(
1544cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
1545cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1546cdf0e10cSrcweir     }
1547cdf0e10cSrcweir     // menuitem
1548cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menuitem") ))
1549cdf0e10cSrcweir     {
1550cdf0e10cSrcweir         OUString aValue(
1551cdf0e10cSrcweir             xAttributes->getValueByUidName(
1552cdf0e10cSrcweir                 _pImport->XMLNS_DIALOGS_UID,
1553cdf0e10cSrcweir                 OUString( RTL_CONSTASCII_USTRINGPARAM("value") ) ) );
1554cdf0e10cSrcweir         OSL_ENSURE( aValue.getLength(), "### menuitem has no value?" );
1555cdf0e10cSrcweir         if (aValue.getLength())
1556cdf0e10cSrcweir         {
1557cdf0e10cSrcweir             _itemValues.push_back( aValue );
1558cdf0e10cSrcweir 
1559cdf0e10cSrcweir             OUString aSel(
1560cdf0e10cSrcweir                 xAttributes->getValueByUidName(
1561cdf0e10cSrcweir                     _pImport->XMLNS_DIALOGS_UID,
1562cdf0e10cSrcweir                     OUString( RTL_CONSTASCII_USTRINGPARAM("selected") ) ) );
1563cdf0e10cSrcweir             if (aSel.getLength() && aSel.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("true") ))
1564cdf0e10cSrcweir             {
1565cdf0e10cSrcweir                 _itemSelected.push_back(
1566cdf0e10cSrcweir                     static_cast<sal_Int16>(_itemValues.size()) -1 );
1567cdf0e10cSrcweir             }
1568cdf0e10cSrcweir         }
1569cdf0e10cSrcweir         return new ElementBase(
1570cdf0e10cSrcweir             _pImport->XMLNS_DIALOGS_UID,
1571cdf0e10cSrcweir             rLocalName, xAttributes, this, _pImport );
1572cdf0e10cSrcweir     }
1573cdf0e10cSrcweir     else
1574cdf0e10cSrcweir     {
1575cdf0e10cSrcweir         throw xml::sax::SAXException(
1576cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected menuitem!") ),
1577cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1578cdf0e10cSrcweir     }
1579cdf0e10cSrcweir }
1580cdf0e10cSrcweir //__________________________________________________________________________________________________
getItemValues()1581cdf0e10cSrcweir Sequence< OUString > MenuPopupElement::getItemValues()
1582cdf0e10cSrcweir {
1583cdf0e10cSrcweir     Sequence< OUString > aRet( _itemValues.size() );
1584cdf0e10cSrcweir     OUString * pRet = aRet.getArray();
1585cdf0e10cSrcweir     for ( size_t nPos = _itemValues.size(); nPos--; )
1586cdf0e10cSrcweir     {
1587cdf0e10cSrcweir         pRet[ nPos ] = _itemValues[ nPos ];
1588cdf0e10cSrcweir     }
1589cdf0e10cSrcweir     return aRet;
1590cdf0e10cSrcweir }
1591cdf0e10cSrcweir //__________________________________________________________________________________________________
getSelectedItems()1592cdf0e10cSrcweir Sequence< sal_Int16 > MenuPopupElement::getSelectedItems()
1593cdf0e10cSrcweir {
1594cdf0e10cSrcweir     Sequence< sal_Int16 > aRet( _itemSelected.size() );
1595cdf0e10cSrcweir     sal_Int16 * pRet = aRet.getArray();
1596cdf0e10cSrcweir     for ( size_t nPos = _itemSelected.size(); nPos--; )
1597cdf0e10cSrcweir     {
1598cdf0e10cSrcweir         pRet[ nPos ] = _itemSelected[ nPos ];
1599cdf0e10cSrcweir     }
1600cdf0e10cSrcweir     return aRet;
1601cdf0e10cSrcweir }
1602cdf0e10cSrcweir 
1603cdf0e10cSrcweir //##################################################################################################
1604cdf0e10cSrcweir 
1605cdf0e10cSrcweir // menulist
1606cdf0e10cSrcweir //__________________________________________________________________________________________________
startChildElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)1607cdf0e10cSrcweir Reference< xml::input::XElement > MenuListElement::startChildElement(
1608cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
1609cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
1610cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1611cdf0e10cSrcweir {
1612cdf0e10cSrcweir     // event
1613cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
1614cdf0e10cSrcweir     {
1615cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1616cdf0e10cSrcweir     }
1617cdf0e10cSrcweir     else if (_pImport->XMLNS_DIALOGS_UID != nUid)
1618cdf0e10cSrcweir     {
1619cdf0e10cSrcweir         throw xml::sax::SAXException(
1620cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
1621cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1622cdf0e10cSrcweir     }
1623cdf0e10cSrcweir     // menupopup
1624cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menupopup") ))
1625cdf0e10cSrcweir     {
1626cdf0e10cSrcweir         _popup = new MenuPopupElement( rLocalName, xAttributes, this, _pImport );
1627cdf0e10cSrcweir         return _popup;
1628cdf0e10cSrcweir     }
1629cdf0e10cSrcweir     else
1630cdf0e10cSrcweir     {
1631cdf0e10cSrcweir         throw xml::sax::SAXException(
1632cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event or menupopup element!") ),
1633cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1634cdf0e10cSrcweir     }
1635cdf0e10cSrcweir }
1636cdf0e10cSrcweir //__________________________________________________________________________________________________
endElement()1637cdf0e10cSrcweir void MenuListElement::endElement()
1638cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1639cdf0e10cSrcweir {
1640cdf0e10cSrcweir     ControlImportContext ctx(
1641cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
1642cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) );
1643cdf0e10cSrcweir     Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1644cdf0e10cSrcweir 
1645cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1646cdf0e10cSrcweir     if (xStyle.is())
1647cdf0e10cSrcweir     {
1648cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1649cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xControlModel );
1650cdf0e10cSrcweir         pStyle->importTextColorStyle( xControlModel );
1651cdf0e10cSrcweir         pStyle->importTextLineColorStyle( xControlModel );
1652cdf0e10cSrcweir         pStyle->importBorderStyle( xControlModel );
1653cdf0e10cSrcweir         pStyle->importFontStyle( xControlModel );
1654cdf0e10cSrcweir     }
1655cdf0e10cSrcweir 
1656cdf0e10cSrcweir     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1657cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1658cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1659cdf0e10cSrcweir                                _xAttributes );
1660cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiSelection") ),
1661cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("multiselection") ),
1662cdf0e10cSrcweir                                _xAttributes );
1663cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
1664cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
1665cdf0e10cSrcweir                                _xAttributes );
1666cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
1667cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
1668cdf0e10cSrcweir                                _xAttributes );
1669cdf0e10cSrcweir     ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
1670cdf0e10cSrcweir                              OUString( RTL_CONSTASCII_USTRINGPARAM("linecount") ),
1671cdf0e10cSrcweir                              _xAttributes );
1672cdf0e10cSrcweir     ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1673cdf0e10cSrcweir                              OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1674cdf0e10cSrcweir                              _xAttributes );
1675cdf0e10cSrcweir 
1676cdf0e10cSrcweir     if (_popup.is())
1677cdf0e10cSrcweir     {
1678cdf0e10cSrcweir         MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
1679cdf0e10cSrcweir         xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
1680cdf0e10cSrcweir                                          makeAny( p->getItemValues() ) );
1681cdf0e10cSrcweir         xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ),
1682cdf0e10cSrcweir                                          makeAny( p->getSelectedItems() ) );
1683cdf0e10cSrcweir     }
1684cdf0e10cSrcweir     ctx.importEvents( _events );
1685cdf0e10cSrcweir     // avoid ring-reference:
1686cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
1687cdf0e10cSrcweir     _events.clear();
1688cdf0e10cSrcweir }
1689cdf0e10cSrcweir 
1690cdf0e10cSrcweir //##################################################################################################
1691cdf0e10cSrcweir 
1692cdf0e10cSrcweir // combobox
1693cdf0e10cSrcweir //__________________________________________________________________________________________________
startChildElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)1694cdf0e10cSrcweir Reference< xml::input::XElement > ComboBoxElement::startChildElement(
1695cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
1696cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
1697cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1698cdf0e10cSrcweir {
1699cdf0e10cSrcweir     // event
1700cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
1701cdf0e10cSrcweir     {
1702cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1703cdf0e10cSrcweir     }
1704cdf0e10cSrcweir     else if (_pImport->XMLNS_DIALOGS_UID != nUid)
1705cdf0e10cSrcweir     {
1706cdf0e10cSrcweir         throw xml::sax::SAXException(
1707cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
1708cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1709cdf0e10cSrcweir     }
1710cdf0e10cSrcweir     // menupopup
1711cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menupopup") ))
1712cdf0e10cSrcweir     {
1713cdf0e10cSrcweir         _popup = new MenuPopupElement( rLocalName, xAttributes, this, _pImport );
1714cdf0e10cSrcweir         return _popup;
1715cdf0e10cSrcweir     }
1716cdf0e10cSrcweir     else
1717cdf0e10cSrcweir     {
1718cdf0e10cSrcweir         throw xml::sax::SAXException(
1719cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event or menupopup element!") ),
1720cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1721cdf0e10cSrcweir     }
1722cdf0e10cSrcweir }
1723cdf0e10cSrcweir //__________________________________________________________________________________________________
endElement()1724cdf0e10cSrcweir void ComboBoxElement::endElement()
1725cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1726cdf0e10cSrcweir {
1727cdf0e10cSrcweir     ControlImportContext ctx(
1728cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
1729cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) );
1730cdf0e10cSrcweir     Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1731cdf0e10cSrcweir 
1732cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1733cdf0e10cSrcweir     if (xStyle.is())
1734cdf0e10cSrcweir     {
1735cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1736cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xControlModel );
1737cdf0e10cSrcweir         pStyle->importTextColorStyle( xControlModel );
1738cdf0e10cSrcweir         pStyle->importTextLineColorStyle( xControlModel );
1739cdf0e10cSrcweir         pStyle->importBorderStyle( xControlModel );
1740cdf0e10cSrcweir         pStyle->importFontStyle( xControlModel );
1741cdf0e10cSrcweir     }
1742cdf0e10cSrcweir 
1743cdf0e10cSrcweir     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1744cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1745cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1746cdf0e10cSrcweir                                _xAttributes );
1747cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
1748cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
1749cdf0e10cSrcweir                                _xAttributes );
1750cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Autocomplete") ),
1751cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("autocomplete") ),
1752cdf0e10cSrcweir                                _xAttributes );
1753cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
1754cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
1755cdf0e10cSrcweir                                _xAttributes );
1756cdf0e10cSrcweir     ctx.importBooleanProperty(
1757cdf0e10cSrcweir         OUSTR("HideInactiveSelection"), OUSTR("hide-inactive-selection"),
1758cdf0e10cSrcweir         _xAttributes );
1759cdf0e10cSrcweir     ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
1760cdf0e10cSrcweir                              OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ),
1761cdf0e10cSrcweir                              _xAttributes );
1762cdf0e10cSrcweir     ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
1763cdf0e10cSrcweir                              OUString( RTL_CONSTASCII_USTRINGPARAM("linecount") ),
1764cdf0e10cSrcweir                              _xAttributes );
1765cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
1766cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1767cdf0e10cSrcweir                               _xAttributes );
1768cdf0e10cSrcweir     ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1769cdf0e10cSrcweir                              OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1770cdf0e10cSrcweir                              _xAttributes );
1771cdf0e10cSrcweir 
1772cdf0e10cSrcweir     if (_popup.is())
1773cdf0e10cSrcweir     {
1774cdf0e10cSrcweir         MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
1775cdf0e10cSrcweir         xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
1776cdf0e10cSrcweir                                          makeAny( p->getItemValues() ) );
1777cdf0e10cSrcweir     }
1778cdf0e10cSrcweir 
1779cdf0e10cSrcweir     ctx.importEvents( _events );
1780cdf0e10cSrcweir     // avoid ring-reference:
1781cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
1782cdf0e10cSrcweir     _events.clear();
1783cdf0e10cSrcweir }
1784cdf0e10cSrcweir 
1785cdf0e10cSrcweir //##################################################################################################
1786cdf0e10cSrcweir 
1787cdf0e10cSrcweir // checkbox
1788cdf0e10cSrcweir //__________________________________________________________________________________________________
startChildElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)1789cdf0e10cSrcweir Reference< xml::input::XElement > CheckBoxElement::startChildElement(
1790cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
1791cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
1792cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1793cdf0e10cSrcweir {
1794cdf0e10cSrcweir     // event
1795cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
1796cdf0e10cSrcweir     {
1797cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1798cdf0e10cSrcweir     }
1799cdf0e10cSrcweir     else
1800cdf0e10cSrcweir     {
1801cdf0e10cSrcweir         throw xml::sax::SAXException(
1802cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1803cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1804cdf0e10cSrcweir     }
1805cdf0e10cSrcweir }
1806cdf0e10cSrcweir //__________________________________________________________________________________________________
endElement()1807cdf0e10cSrcweir void CheckBoxElement::endElement()
1808cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1809cdf0e10cSrcweir {
1810cdf0e10cSrcweir     ControlImportContext ctx(
1811cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
1812cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) );
1813cdf0e10cSrcweir     Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1814cdf0e10cSrcweir 
1815cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1816cdf0e10cSrcweir     if (xStyle.is())
1817cdf0e10cSrcweir     {
1818cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1819cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xControlModel );
1820cdf0e10cSrcweir         pStyle->importTextColorStyle( xControlModel );
1821cdf0e10cSrcweir         pStyle->importTextLineColorStyle( xControlModel );
1822cdf0e10cSrcweir         pStyle->importFontStyle( xControlModel );
1823cdf0e10cSrcweir         pStyle->importVisualEffectStyle( xControlModel );
1824cdf0e10cSrcweir     }
1825cdf0e10cSrcweir 
1826cdf0e10cSrcweir     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1827cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1828cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1829cdf0e10cSrcweir                                _xAttributes );
1830cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1831cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1832cdf0e10cSrcweir                               _xAttributes );
1833cdf0e10cSrcweir     ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1834cdf0e10cSrcweir                              OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1835cdf0e10cSrcweir                              _xAttributes );
1836cdf0e10cSrcweir     ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
1837cdf0e10cSrcweir                                      OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
1838cdf0e10cSrcweir                                      _xAttributes );
1839cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
1840cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
1841cdf0e10cSrcweir                               _xAttributes );
1842cdf0e10cSrcweir     ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
1843cdf0e10cSrcweir                                      OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
1844cdf0e10cSrcweir                                      _xAttributes );
1845cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1846cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1847cdf0e10cSrcweir                                _xAttributes );
1848cdf0e10cSrcweir 
1849cdf0e10cSrcweir 
1850cdf0e10cSrcweir     sal_Bool bTriState = sal_False;
1851cdf0e10cSrcweir     if (getBoolAttr( &bTriState,
1852cdf0e10cSrcweir                      OUString( RTL_CONSTASCII_USTRINGPARAM("tristate") ),
1853cdf0e10cSrcweir                      _xAttributes,
1854cdf0e10cSrcweir                      _pImport->XMLNS_DIALOGS_UID ))
1855cdf0e10cSrcweir     {
1856cdf0e10cSrcweir         xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("TriState") ),
1857cdf0e10cSrcweir                                          makeAny( bTriState ) );
1858cdf0e10cSrcweir     }
1859cdf0e10cSrcweir     sal_Bool bChecked = sal_False;
1860cdf0e10cSrcweir     if (getBoolAttr( &bChecked,
1861cdf0e10cSrcweir                      OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ),
1862cdf0e10cSrcweir                      _xAttributes,
1863cdf0e10cSrcweir                      _pImport->XMLNS_DIALOGS_UID ))
1864cdf0e10cSrcweir     {
1865cdf0e10cSrcweir         // has "checked" attribute
1866cdf0e10cSrcweir         sal_Int16 nVal = (bChecked ? 1 : 0);
1867cdf0e10cSrcweir         xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
1868cdf0e10cSrcweir                                          makeAny( nVal ) );
1869cdf0e10cSrcweir     }
1870cdf0e10cSrcweir     else
1871cdf0e10cSrcweir     {
1872cdf0e10cSrcweir         sal_Int16 nVal = (bTriState ? 2 : 0); // if tristate set, but checked omitted => dont know!
1873cdf0e10cSrcweir         xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
1874cdf0e10cSrcweir                                          makeAny( nVal ) );
1875cdf0e10cSrcweir     }
1876cdf0e10cSrcweir 
1877cdf0e10cSrcweir     ctx.importEvents( _events );
1878cdf0e10cSrcweir     // avoid ring-reference:
1879cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
1880cdf0e10cSrcweir     _events.clear();
1881cdf0e10cSrcweir }
1882cdf0e10cSrcweir 
1883cdf0e10cSrcweir //##################################################################################################
1884cdf0e10cSrcweir 
1885cdf0e10cSrcweir // button
1886cdf0e10cSrcweir //__________________________________________________________________________________________________
startChildElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)1887cdf0e10cSrcweir Reference< xml::input::XElement > ButtonElement::startChildElement(
1888cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
1889cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
1890cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1891cdf0e10cSrcweir {
1892cdf0e10cSrcweir     // event
1893cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
1894cdf0e10cSrcweir     {
1895cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
1896cdf0e10cSrcweir     }
1897cdf0e10cSrcweir     else
1898cdf0e10cSrcweir     {
1899cdf0e10cSrcweir         throw xml::sax::SAXException(
1900cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
1901cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1902cdf0e10cSrcweir     }
1903cdf0e10cSrcweir }
1904cdf0e10cSrcweir //__________________________________________________________________________________________________
endElement()1905cdf0e10cSrcweir void ButtonElement::endElement()
1906cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1907cdf0e10cSrcweir {
1908cdf0e10cSrcweir     ControlImportContext ctx(
1909cdf0e10cSrcweir         _pImport, getControlId( _xAttributes ),
1910cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) );
1911cdf0e10cSrcweir 
1912cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
1913cdf0e10cSrcweir     if (xStyle.is())
1914cdf0e10cSrcweir     {
1915cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
1916cdf0e10cSrcweir         Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
1917cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xControlModel );
1918cdf0e10cSrcweir         pStyle->importTextColorStyle( xControlModel );
1919cdf0e10cSrcweir         pStyle->importTextLineColorStyle( xControlModel );
1920cdf0e10cSrcweir         pStyle->importFontStyle( xControlModel );
1921cdf0e10cSrcweir     }
1922cdf0e10cSrcweir 
1923cdf0e10cSrcweir     ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
1924cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
1925cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
1926cdf0e10cSrcweir                                _xAttributes );
1927cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
1928cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
1929cdf0e10cSrcweir                               _xAttributes );
1930cdf0e10cSrcweir     ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
1931cdf0e10cSrcweir                              OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
1932cdf0e10cSrcweir                              _xAttributes );
1933cdf0e10cSrcweir     ctx.importVerticalAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
1934cdf0e10cSrcweir                                      OUString( RTL_CONSTASCII_USTRINGPARAM("valign") ),
1935cdf0e10cSrcweir                                      _xAttributes );
1936cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultButton") ),
1937cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("default") ),
1938cdf0e10cSrcweir                                _xAttributes );
1939cdf0e10cSrcweir     ctx.importButtonTypeProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("PushButtonType") ),
1940cdf0e10cSrcweir                                   OUString( RTL_CONSTASCII_USTRINGPARAM("button-type") ),
1941cdf0e10cSrcweir                                   _xAttributes );
1942cdf0e10cSrcweir     ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
1943cdf0e10cSrcweir                               OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
1944cdf0e10cSrcweir                               _xAttributes );
1945cdf0e10cSrcweir     ctx.importImagePositionProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
1946cdf0e10cSrcweir                                      OUString( RTL_CONSTASCII_USTRINGPARAM("image-position") ),
1947cdf0e10cSrcweir                                      _xAttributes );
1948cdf0e10cSrcweir     ctx.importImageAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageAlign") ),
1949cdf0e10cSrcweir                                   OUString( RTL_CONSTASCII_USTRINGPARAM("image-align") ),
1950cdf0e10cSrcweir                                   _xAttributes );
1951cdf0e10cSrcweir     if (ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat"),
1952cdf0e10cSrcweir                                 _xAttributes ))
1953cdf0e10cSrcweir         ctx.getControlModel()->setPropertyValue(
1954cdf0e10cSrcweir             OUSTR("Repeat"), makeAny(true) );
1955cdf0e10cSrcweir     sal_Int32 toggled = 0;
1956cdf0e10cSrcweir     if (getLongAttr( &toggled, OUSTR("toggled"), _xAttributes,
1957cdf0e10cSrcweir                      _pImport->XMLNS_DIALOGS_UID ) && toggled == 1)
1958cdf0e10cSrcweir         ctx.getControlModel()->setPropertyValue(OUSTR("Toggle"), makeAny(true));
1959cdf0e10cSrcweir     ctx.importBooleanProperty( OUSTR("FocusOnClick"), OUSTR("grab-focus"),
1960cdf0e10cSrcweir                                _xAttributes );
1961cdf0e10cSrcweir     ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
1962cdf0e10cSrcweir                                OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
1963cdf0e10cSrcweir                                _xAttributes );
1964cdf0e10cSrcweir     // State
1965cdf0e10cSrcweir     sal_Bool bChecked = sal_False;
1966cdf0e10cSrcweir     if (getBoolAttr(
1967cdf0e10cSrcweir             &bChecked,
1968cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("checked") ),
1969cdf0e10cSrcweir             _xAttributes,
1970cdf0e10cSrcweir             _pImport->XMLNS_DIALOGS_UID ) &&
1971cdf0e10cSrcweir         bChecked)
1972cdf0e10cSrcweir     {
1973cdf0e10cSrcweir         sal_Int16 nVal = 1;
1974cdf0e10cSrcweir         ctx.getControlModel()->setPropertyValue(
1975cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("State") ), makeAny( nVal ) );
1976cdf0e10cSrcweir     }
1977cdf0e10cSrcweir 
1978cdf0e10cSrcweir     ctx.importEvents( _events );
1979cdf0e10cSrcweir     // avoid ring-reference:
1980cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
1981cdf0e10cSrcweir     _events.clear();
1982cdf0e10cSrcweir }
1983cdf0e10cSrcweir 
1984cdf0e10cSrcweir //##################################################################################################
1985cdf0e10cSrcweir 
1986cdf0e10cSrcweir // bulletinboard
1987cdf0e10cSrcweir //__________________________________________________________________________________________________
startChildElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)1988cdf0e10cSrcweir Reference< xml::input::XElement > BulletinBoardElement::startChildElement(
1989cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
1990cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
1991cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
1992cdf0e10cSrcweir {
1993cdf0e10cSrcweir     if (_pImport->XMLNS_DIALOGS_UID != nUid)
1994cdf0e10cSrcweir     {
1995cdf0e10cSrcweir         throw xml::sax::SAXException(
1996cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
1997cdf0e10cSrcweir             Reference< XInterface >(), Any() );
1998cdf0e10cSrcweir     }
1999cdf0e10cSrcweir     // button
2000cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("button") ))
2001cdf0e10cSrcweir     {
2002cdf0e10cSrcweir         return new ButtonElement( rLocalName, xAttributes, this, _pImport );
2003cdf0e10cSrcweir     }
2004cdf0e10cSrcweir     // checkbox
2005cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("checkbox") ))
2006cdf0e10cSrcweir     {
2007cdf0e10cSrcweir         return new CheckBoxElement( rLocalName, xAttributes, this, _pImport );
2008cdf0e10cSrcweir     }
2009cdf0e10cSrcweir     // combobox
2010cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("combobox") ))
2011cdf0e10cSrcweir     {
2012cdf0e10cSrcweir         return new ComboBoxElement( rLocalName, xAttributes, this, _pImport );
2013cdf0e10cSrcweir     }
2014cdf0e10cSrcweir     // listbox
2015cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("menulist") ))
2016cdf0e10cSrcweir     {
2017cdf0e10cSrcweir         return new MenuListElement( rLocalName, xAttributes, this, _pImport );
2018cdf0e10cSrcweir     }
2019cdf0e10cSrcweir     // radiogroup
2020cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("radiogroup") ))
2021cdf0e10cSrcweir     {
2022cdf0e10cSrcweir         return new RadioGroupElement( rLocalName, xAttributes, this, _pImport );
2023cdf0e10cSrcweir     }
2024cdf0e10cSrcweir     // titledbox
2025cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("titledbox") ))
2026cdf0e10cSrcweir     {
2027cdf0e10cSrcweir         return new TitledBoxElement( rLocalName, xAttributes, this, _pImport );
2028cdf0e10cSrcweir     }
2029cdf0e10cSrcweir     // text
2030cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("text") ))
2031cdf0e10cSrcweir     {
2032cdf0e10cSrcweir         return new TextElement( rLocalName, xAttributes, this, _pImport );
2033cdf0e10cSrcweir     }
2034cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("linklabel") ))
2035cdf0e10cSrcweir     {
2036cdf0e10cSrcweir         return new FixedHyperLinkElement( rLocalName, xAttributes, this, _pImport );
2037cdf0e10cSrcweir     }
2038cdf0e10cSrcweir     // textfield
2039cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("textfield") ))
2040cdf0e10cSrcweir     {
2041cdf0e10cSrcweir         return new TextFieldElement( rLocalName, xAttributes, this, _pImport );
2042cdf0e10cSrcweir     }
2043cdf0e10cSrcweir     // img
2044cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("img") ))
2045cdf0e10cSrcweir     {
2046cdf0e10cSrcweir         return new ImageControlElement( rLocalName, xAttributes, this, _pImport );
2047cdf0e10cSrcweir     }
2048cdf0e10cSrcweir     // filecontrol
2049cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("filecontrol") ))
2050cdf0e10cSrcweir     {
2051cdf0e10cSrcweir         return new FileControlElement( rLocalName, xAttributes, this, _pImport );
2052cdf0e10cSrcweir     }
2053cdf0e10cSrcweir     // treecontrol
2054cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("treecontrol") ))
2055cdf0e10cSrcweir     {
2056cdf0e10cSrcweir         return new TreeControlElement( rLocalName, xAttributes, this, _pImport );
2057cdf0e10cSrcweir     }
2058cdf0e10cSrcweir     // currencyfield
2059cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("currencyfield") ))
2060cdf0e10cSrcweir     {
2061cdf0e10cSrcweir         return new CurrencyFieldElement( rLocalName, xAttributes, this, _pImport );
2062cdf0e10cSrcweir     }
2063cdf0e10cSrcweir     // datefield
2064cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("datefield") ))
2065cdf0e10cSrcweir     {
2066cdf0e10cSrcweir         return new DateFieldElement( rLocalName, xAttributes, this, _pImport );
2067cdf0e10cSrcweir     }
2068cdf0e10cSrcweir     // datefield
2069cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("numericfield") ))
2070cdf0e10cSrcweir     {
2071cdf0e10cSrcweir         return new NumericFieldElement( rLocalName, xAttributes, this, _pImport );
2072cdf0e10cSrcweir     }
2073cdf0e10cSrcweir     // timefield
2074cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("timefield") ))
2075cdf0e10cSrcweir     {
2076cdf0e10cSrcweir         return new TimeFieldElement( rLocalName, xAttributes, this, _pImport );
2077cdf0e10cSrcweir     }
2078cdf0e10cSrcweir     // patternfield
2079cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("patternfield") ))
2080cdf0e10cSrcweir     {
2081cdf0e10cSrcweir         return new PatternFieldElement( rLocalName, xAttributes, this, _pImport );
2082cdf0e10cSrcweir     }
2083cdf0e10cSrcweir     // formattedfield
2084cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("formattedfield") ))
2085cdf0e10cSrcweir     {
2086cdf0e10cSrcweir         return new FormattedFieldElement( rLocalName, xAttributes, this, _pImport );
2087cdf0e10cSrcweir     }
2088cdf0e10cSrcweir     // fixedline
2089cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("fixedline") ))
2090cdf0e10cSrcweir     {
2091cdf0e10cSrcweir         return new FixedLineElement( rLocalName, xAttributes, this, _pImport );
2092cdf0e10cSrcweir     }
2093cdf0e10cSrcweir     // scrollbar
2094cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("scrollbar") ))
2095cdf0e10cSrcweir     {
2096cdf0e10cSrcweir         return new ScrollBarElement( rLocalName, xAttributes, this, _pImport );
2097cdf0e10cSrcweir     }
2098cdf0e10cSrcweir     // progressmeter
2099cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("progressmeter") ))
2100cdf0e10cSrcweir     {
2101cdf0e10cSrcweir         return new ProgressBarElement( rLocalName, xAttributes, this, _pImport );
2102cdf0e10cSrcweir     }
2103cdf0e10cSrcweir     // bulletinboard
2104cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") ))
2105cdf0e10cSrcweir     {
2106cdf0e10cSrcweir         return new BulletinBoardElement( rLocalName, xAttributes, this, _pImport );
2107cdf0e10cSrcweir     }
2108cdf0e10cSrcweir     else
2109cdf0e10cSrcweir     {
2110cdf0e10cSrcweir         throw xml::sax::SAXException(
2111cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected styles, bulletinboard or bulletinboard element, not: ") ) + rLocalName,
2112cdf0e10cSrcweir             Reference< XInterface >(), Any() );
2113cdf0e10cSrcweir     }
2114cdf0e10cSrcweir }
2115cdf0e10cSrcweir //__________________________________________________________________________________________________
BulletinBoardElement(OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)2116cdf0e10cSrcweir BulletinBoardElement::BulletinBoardElement(
2117cdf0e10cSrcweir     OUString const & rLocalName,
2118cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes,
2119cdf0e10cSrcweir     ElementBase * pParent, DialogImport * pImport )
2120cdf0e10cSrcweir     SAL_THROW( () )
2121cdf0e10cSrcweir     : ControlElement( rLocalName, xAttributes, pParent, pImport )
2122cdf0e10cSrcweir {
2123cdf0e10cSrcweir     OUString aValue(
2124cdf0e10cSrcweir         _xAttributes->getValueByUidName(
2125cdf0e10cSrcweir             _pImport->XMLNS_DIALOGS_UID,
2126cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("left") ) ) );
2127cdf0e10cSrcweir     if (aValue.getLength())
2128cdf0e10cSrcweir     {
2129cdf0e10cSrcweir         _nBasePosX += toInt32( aValue );
2130cdf0e10cSrcweir     }
2131cdf0e10cSrcweir     aValue = _xAttributes->getValueByUidName(
2132cdf0e10cSrcweir         _pImport->XMLNS_DIALOGS_UID,
2133cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("top") ) );
2134cdf0e10cSrcweir     if (aValue.getLength())
2135cdf0e10cSrcweir     {
2136cdf0e10cSrcweir         _nBasePosY += toInt32( aValue );
2137cdf0e10cSrcweir     }
2138cdf0e10cSrcweir }
2139cdf0e10cSrcweir 
2140cdf0e10cSrcweir //##################################################################################################
2141cdf0e10cSrcweir 
2142cdf0e10cSrcweir // style
2143cdf0e10cSrcweir //__________________________________________________________________________________________________
startChildElement(sal_Int32,OUString const &,Reference<xml::input::XAttributes> const &)2144cdf0e10cSrcweir Reference< xml::input::XElement > StyleElement::startChildElement(
2145cdf0e10cSrcweir     sal_Int32 /*nUid*/, OUString const & /*rLocalName*/,
2146cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & /*xAttributes*/ )
2147cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
2148cdf0e10cSrcweir {
2149cdf0e10cSrcweir     throw xml::sax::SAXException(
2150cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("unexpected sub elements of style!") ),
2151cdf0e10cSrcweir         Reference< XInterface >(), Any() );
2152cdf0e10cSrcweir }
2153cdf0e10cSrcweir //__________________________________________________________________________________________________
endElement()2154cdf0e10cSrcweir void StyleElement::endElement()
2155cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
2156cdf0e10cSrcweir {
2157cdf0e10cSrcweir     Reference< xml::input::XAttributes > xStyle;
2158cdf0e10cSrcweir     OUString aStyleId(
2159cdf0e10cSrcweir         _xAttributes->getValueByUidName(
2160cdf0e10cSrcweir             _pImport->XMLNS_DIALOGS_UID,
2161cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("style-id") ) ) );
2162cdf0e10cSrcweir     if (aStyleId.getLength())
2163cdf0e10cSrcweir     {
2164cdf0e10cSrcweir         _pImport->addStyle( aStyleId, this );
2165cdf0e10cSrcweir     }
2166cdf0e10cSrcweir     else
2167cdf0e10cSrcweir     {
2168cdf0e10cSrcweir         throw xml::sax::SAXException(
2169cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("missing style-id attribute!") ),
2170cdf0e10cSrcweir             Reference< XInterface >(), Any() );
2171cdf0e10cSrcweir     }
2172cdf0e10cSrcweir }
2173cdf0e10cSrcweir 
2174cdf0e10cSrcweir //##################################################################################################
2175cdf0e10cSrcweir 
2176cdf0e10cSrcweir // styles
2177cdf0e10cSrcweir //__________________________________________________________________________________________________
startChildElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)2178cdf0e10cSrcweir Reference< xml::input::XElement > StylesElement::startChildElement(
2179cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
2180cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
2181cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
2182cdf0e10cSrcweir {
2183cdf0e10cSrcweir     if (_pImport->XMLNS_DIALOGS_UID != nUid)
2184cdf0e10cSrcweir     {
2185cdf0e10cSrcweir         throw xml::sax::SAXException(
2186cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
2187cdf0e10cSrcweir             Reference< XInterface >(), Any() );
2188cdf0e10cSrcweir     }
2189cdf0e10cSrcweir     // style
2190cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("style") ))
2191cdf0e10cSrcweir     {
2192cdf0e10cSrcweir         return new StyleElement( rLocalName, xAttributes, this, _pImport );
2193cdf0e10cSrcweir     }
2194cdf0e10cSrcweir     else
2195cdf0e10cSrcweir     {
2196cdf0e10cSrcweir         throw xml::sax::SAXException(
2197cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected style element!") ),
2198cdf0e10cSrcweir             Reference< XInterface >(), Any() );
2199cdf0e10cSrcweir     }
2200cdf0e10cSrcweir }
2201cdf0e10cSrcweir 
2202cdf0e10cSrcweir //##################################################################################################
2203cdf0e10cSrcweir 
2204cdf0e10cSrcweir // window
2205cdf0e10cSrcweir //__________________________________________________________________________________________________
startChildElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)2206cdf0e10cSrcweir Reference< xml::input::XElement > WindowElement::startChildElement(
2207cdf0e10cSrcweir     sal_Int32 nUid, OUString const & rLocalName,
2208cdf0e10cSrcweir     Reference< xml::input::XAttributes > const & xAttributes )
2209cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
2210cdf0e10cSrcweir {
2211cdf0e10cSrcweir     // event
2212cdf0e10cSrcweir     if (_pImport->isEventElement( nUid, rLocalName ))
2213cdf0e10cSrcweir     {
2214cdf0e10cSrcweir         return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
2215cdf0e10cSrcweir     }
2216cdf0e10cSrcweir     else if (_pImport->XMLNS_DIALOGS_UID != nUid)
2217cdf0e10cSrcweir     {
2218cdf0e10cSrcweir         throw xml::sax::SAXException(
2219cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
2220cdf0e10cSrcweir             Reference< XInterface >(), Any() );
2221cdf0e10cSrcweir     }
2222cdf0e10cSrcweir     // styles
2223cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("styles") ))
2224cdf0e10cSrcweir     {
2225cdf0e10cSrcweir         return new StylesElement( rLocalName, xAttributes, this, _pImport );
2226cdf0e10cSrcweir     }
2227cdf0e10cSrcweir     // bulletinboard
2228cdf0e10cSrcweir     else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") ))
2229cdf0e10cSrcweir     {
2230cdf0e10cSrcweir         return new BulletinBoardElement( rLocalName, xAttributes, this, _pImport );
2231cdf0e10cSrcweir     }
2232cdf0e10cSrcweir     else
2233cdf0e10cSrcweir     {
2234cdf0e10cSrcweir         throw xml::sax::SAXException(
2235cdf0e10cSrcweir             OUString( RTL_CONSTASCII_USTRINGPARAM("expected styles ot bulletinboard element!") ),
2236cdf0e10cSrcweir             Reference< XInterface >(), Any() );
2237cdf0e10cSrcweir     }
2238cdf0e10cSrcweir }
2239cdf0e10cSrcweir //__________________________________________________________________________________________________
endElement()2240cdf0e10cSrcweir void WindowElement::endElement()
2241cdf0e10cSrcweir     throw (xml::sax::SAXException, RuntimeException)
2242cdf0e10cSrcweir {
2243cdf0e10cSrcweir     Reference< beans::XPropertySet > xProps(
2244cdf0e10cSrcweir         _pImport->_xDialogModel, UNO_QUERY_THROW );
2245cdf0e10cSrcweir     ImportContext ctx( _pImport, xProps, getControlId( _xAttributes ) );
2246cdf0e10cSrcweir 
2247cdf0e10cSrcweir     Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
2248cdf0e10cSrcweir     if (xStyle.is())
2249cdf0e10cSrcweir     {
2250cdf0e10cSrcweir         StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
2251cdf0e10cSrcweir         pStyle->importBackgroundColorStyle( xProps );
2252cdf0e10cSrcweir         pStyle->importTextColorStyle( xProps );
2253cdf0e10cSrcweir         pStyle->importTextLineColorStyle( xProps );
2254cdf0e10cSrcweir         pStyle->importFontStyle( xProps );
2255cdf0e10cSrcweir     }
2256cdf0e10cSrcweir 
2257cdf0e10cSrcweir     ctx.importDefaults( 0, 0, _xAttributes, false );
2258cdf0e10cSrcweir     ctx.importBooleanProperty(
2259cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("Closeable") ),
2260cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("closeable") ),
2261cdf0e10cSrcweir         _xAttributes );
2262cdf0e10cSrcweir     ctx.importBooleanProperty(
2263cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("Moveable") ),
2264cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("moveable") ),
2265cdf0e10cSrcweir         _xAttributes );
2266cdf0e10cSrcweir     ctx.importBooleanProperty(
2267cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("Sizeable") ),
2268cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("resizeable") ),
2269cdf0e10cSrcweir         _xAttributes );
2270cdf0e10cSrcweir     ctx.importStringProperty(
2271cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ),
2272cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("title") ),
2273cdf0e10cSrcweir         _xAttributes );
2274cdf0e10cSrcweir     ctx.importBooleanProperty(
2275cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("Decoration") ),
2276cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("withtitlebar") ),
2277cdf0e10cSrcweir         _xAttributes );
2278cdf0e10cSrcweir     ctx.importStringProperty(
2279cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
2280cdf0e10cSrcweir         OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
2281cdf0e10cSrcweir         _xAttributes );
2282cdf0e10cSrcweir     ctx.importEvents( _events );
2283cdf0e10cSrcweir     // avoid ring-reference:
2284cdf0e10cSrcweir     // vector< event elements > holding event elements holding this (via _pParent)
2285cdf0e10cSrcweir     _events.clear();
2286cdf0e10cSrcweir }
2287cdf0e10cSrcweir 
2288cdf0e10cSrcweir }
2289