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 <osl/diagnose.h>
29cdf0e10cSrcweir #include <tools/diagnose_ex.h>
30cdf0e10cSrcweir #include <osl/mutex.hxx>
31cdf0e10cSrcweir
32cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
33cdf0e10cSrcweir
34*b63233d8Sdamjan #include <xml_import.hxx>
35cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
36cdf0e10cSrcweir
37cdf0e10cSrcweir #include <com/sun/star/awt/CharSet.hpp>
38cdf0e10cSrcweir #include <com/sun/star/awt/FontFamily.hpp>
39cdf0e10cSrcweir #include <com/sun/star/awt/FontPitch.hpp>
40cdf0e10cSrcweir #include <com/sun/star/awt/FontSlant.hpp>
41cdf0e10cSrcweir #include <com/sun/star/awt/FontStrikeout.hpp>
42cdf0e10cSrcweir #include <com/sun/star/awt/FontType.hpp>
43cdf0e10cSrcweir #include <com/sun/star/awt/FontUnderline.hpp>
44cdf0e10cSrcweir #include <com/sun/star/awt/FontWeight.hpp>
45cdf0e10cSrcweir #include <com/sun/star/awt/FontWidth.hpp>
46cdf0e10cSrcweir #include <com/sun/star/awt/ImagePosition.hpp>
47874957b9STsutomu Uchino #include <com/sun/star/awt/ImageScaleMode.hpp>
48cdf0e10cSrcweir #include <com/sun/star/awt/LineEndFormat.hpp>
49cdf0e10cSrcweir #include <com/sun/star/awt/PushButtonType.hpp>
50cdf0e10cSrcweir #include <com/sun/star/awt/VisualEffect.hpp>
51cdf0e10cSrcweir #include <com/sun/star/style/VerticalAlignment.hpp>
52cdf0e10cSrcweir
53cdf0e10cSrcweir #include <com/sun/star/script/XScriptEventsSupplier.hpp>
54cdf0e10cSrcweir #include <com/sun/star/script/ScriptEventDescriptor.hpp>
55cdf0e10cSrcweir
56cdf0e10cSrcweir #include <com/sun/star/view/SelectionType.hpp>
57cdf0e10cSrcweir
58cdf0e10cSrcweir using namespace ::com::sun::star;
59cdf0e10cSrcweir using namespace ::com::sun::star::uno;
60cdf0e10cSrcweir using ::rtl::OUString;
61cdf0e10cSrcweir
62cdf0e10cSrcweir namespace xmlscript
63cdf0e10cSrcweir {
64cdf0e10cSrcweir
65cdf0e10cSrcweir //__________________________________________________________________________________________________
endElement()66cdf0e10cSrcweir void EventElement::endElement()
67cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException)
68cdf0e10cSrcweir {
69cdf0e10cSrcweir static_cast< ControlElement * >( _pParent )->_events.push_back( this );
70cdf0e10cSrcweir }
71cdf0e10cSrcweir //__________________________________________________________________________________________________
ControlElement(OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)72cdf0e10cSrcweir ControlElement::ControlElement(
73cdf0e10cSrcweir OUString const & rLocalName,
74cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes,
75cdf0e10cSrcweir ElementBase * pParent, DialogImport * pImport )
76cdf0e10cSrcweir SAL_THROW( () )
77cdf0e10cSrcweir : ElementBase(
78cdf0e10cSrcweir pImport->XMLNS_DIALOGS_UID, rLocalName, xAttributes, pParent, pImport )
79cdf0e10cSrcweir {
80cdf0e10cSrcweir if (_pParent)
81cdf0e10cSrcweir {
82cdf0e10cSrcweir // inherit position
83cdf0e10cSrcweir _nBasePosX = static_cast< ControlElement * >( _pParent )->_nBasePosX;
84cdf0e10cSrcweir _nBasePosY = static_cast< ControlElement * >( _pParent )->_nBasePosY;
85cdf0e10cSrcweir }
86cdf0e10cSrcweir else
87cdf0e10cSrcweir {
88cdf0e10cSrcweir _nBasePosX = 0;
89cdf0e10cSrcweir _nBasePosY = 0;
90cdf0e10cSrcweir }
91cdf0e10cSrcweir }
92cdf0e10cSrcweir
93cdf0e10cSrcweir //__________________________________________________________________________________________________
getStyle(Reference<xml::input::XAttributes> const & xAttributes)94cdf0e10cSrcweir Reference< xml::input::XElement > ControlElement::getStyle(
95cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes )
96cdf0e10cSrcweir {
97cdf0e10cSrcweir OUString aStyleId(
98cdf0e10cSrcweir xAttributes->getValueByUidName(
99cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID,
100cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("style-id") ) ) );
101cdf0e10cSrcweir if (aStyleId.getLength())
102cdf0e10cSrcweir {
103cdf0e10cSrcweir return _pImport->getStyle( aStyleId );
104cdf0e10cSrcweir }
105cdf0e10cSrcweir return Reference< xml::input::XElement >();
106cdf0e10cSrcweir }
107cdf0e10cSrcweir //__________________________________________________________________________________________________
getControlId(Reference<xml::input::XAttributes> const & xAttributes)108cdf0e10cSrcweir OUString ControlElement::getControlId(
109cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes )
110cdf0e10cSrcweir {
111cdf0e10cSrcweir OUString aId(
112cdf0e10cSrcweir xAttributes->getValueByUidName(
113cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID,
114cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("id") ) ) );
115cdf0e10cSrcweir if (! aId.getLength())
116cdf0e10cSrcweir {
117cdf0e10cSrcweir throw xml::sax::SAXException(
118cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("missing id attribute!") ),
119cdf0e10cSrcweir Reference< XInterface >(), Any() );
120cdf0e10cSrcweir }
121cdf0e10cSrcweir return aId;
122cdf0e10cSrcweir }
123cdf0e10cSrcweir
124cdf0e10cSrcweir //##################################################################################################
125cdf0e10cSrcweir
126cdf0e10cSrcweir //__________________________________________________________________________________________________
importTextColorStyle(Reference<beans::XPropertySet> const & xProps)127cdf0e10cSrcweir bool StyleElement::importTextColorStyle(
128cdf0e10cSrcweir Reference< beans::XPropertySet > const & xProps )
129cdf0e10cSrcweir {
130cdf0e10cSrcweir if ((_inited & 0x2) != 0)
131cdf0e10cSrcweir {
132cdf0e10cSrcweir if ((_hasValue & 0x2) != 0)
133cdf0e10cSrcweir {
134cdf0e10cSrcweir xProps->setPropertyValue(
135cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ),
136cdf0e10cSrcweir makeAny( _textColor ) );
137cdf0e10cSrcweir return true;
138cdf0e10cSrcweir }
139cdf0e10cSrcweir return false;
140cdf0e10cSrcweir }
141cdf0e10cSrcweir _inited |= 0x2;
142cdf0e10cSrcweir
143cdf0e10cSrcweir if (getLongAttr( &_textColor,
144cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("text-color") ),
145cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
146cdf0e10cSrcweir {
147cdf0e10cSrcweir _hasValue |= 0x2;
148cdf0e10cSrcweir xProps->setPropertyValue(
149cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ),
150cdf0e10cSrcweir makeAny( _textColor ) );
151cdf0e10cSrcweir return true;
152cdf0e10cSrcweir }
153cdf0e10cSrcweir return false;
154cdf0e10cSrcweir }
155cdf0e10cSrcweir //__________________________________________________________________________________________________
importTextLineColorStyle(Reference<beans::XPropertySet> const & xProps)156cdf0e10cSrcweir bool StyleElement::importTextLineColorStyle(
157cdf0e10cSrcweir Reference< beans::XPropertySet > const & xProps )
158cdf0e10cSrcweir {
159cdf0e10cSrcweir if ((_inited & 0x20) != 0)
160cdf0e10cSrcweir {
161cdf0e10cSrcweir if ((_hasValue & 0x20) != 0)
162cdf0e10cSrcweir {
163cdf0e10cSrcweir xProps->setPropertyValue(
164cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ),
165cdf0e10cSrcweir makeAny( _textLineColor ) );
166cdf0e10cSrcweir return true;
167cdf0e10cSrcweir }
168cdf0e10cSrcweir return false;
169cdf0e10cSrcweir }
170cdf0e10cSrcweir _inited |= 0x20;
171cdf0e10cSrcweir
172cdf0e10cSrcweir if (getLongAttr( &_textLineColor,
173cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("textline-color") ),
174cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
175cdf0e10cSrcweir {
176cdf0e10cSrcweir _hasValue |= 0x20;
177cdf0e10cSrcweir xProps->setPropertyValue(
178cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ),
179cdf0e10cSrcweir makeAny( _textLineColor ) );
180cdf0e10cSrcweir return true;
181cdf0e10cSrcweir }
182cdf0e10cSrcweir return false;
183cdf0e10cSrcweir }
184cdf0e10cSrcweir //__________________________________________________________________________________________________
importFillColorStyle(Reference<beans::XPropertySet> const & xProps)185cdf0e10cSrcweir bool StyleElement::importFillColorStyle(
186cdf0e10cSrcweir Reference< beans::XPropertySet > const & xProps )
187cdf0e10cSrcweir {
188cdf0e10cSrcweir if ((_inited & 0x10) != 0)
189cdf0e10cSrcweir {
190cdf0e10cSrcweir if ((_hasValue & 0x10) != 0)
191cdf0e10cSrcweir {
192cdf0e10cSrcweir xProps->setPropertyValue(
193cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("FillColor") ), makeAny( _fillColor ) );
194cdf0e10cSrcweir return true;
195cdf0e10cSrcweir }
196cdf0e10cSrcweir return false;
197cdf0e10cSrcweir }
198cdf0e10cSrcweir _inited |= 0x10;
199cdf0e10cSrcweir
200cdf0e10cSrcweir if (getLongAttr(
201cdf0e10cSrcweir &_fillColor,
202cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("fill-color") ),
203cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
204cdf0e10cSrcweir {
205cdf0e10cSrcweir _hasValue |= 0x10;
206cdf0e10cSrcweir xProps->setPropertyValue(
207cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("FillColor") ),
208cdf0e10cSrcweir makeAny( _fillColor ) );
209cdf0e10cSrcweir return true;
210cdf0e10cSrcweir }
211cdf0e10cSrcweir return false;
212cdf0e10cSrcweir }
213cdf0e10cSrcweir //__________________________________________________________________________________________________
importBackgroundColorStyle(Reference<beans::XPropertySet> const & xProps)214cdf0e10cSrcweir bool StyleElement::importBackgroundColorStyle(
215cdf0e10cSrcweir Reference< beans::XPropertySet > const & xProps )
216cdf0e10cSrcweir {
217cdf0e10cSrcweir if ((_inited & 0x1) != 0)
218cdf0e10cSrcweir {
219cdf0e10cSrcweir if ((_hasValue & 0x1) != 0)
220cdf0e10cSrcweir {
221cdf0e10cSrcweir xProps->setPropertyValue(
222cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ), makeAny( _backgroundColor ) );
223cdf0e10cSrcweir return true;
224cdf0e10cSrcweir }
225cdf0e10cSrcweir return false;
226cdf0e10cSrcweir }
227cdf0e10cSrcweir _inited |= 0x1;
228cdf0e10cSrcweir
229cdf0e10cSrcweir if (getLongAttr(
230cdf0e10cSrcweir &_backgroundColor,
231cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("background-color") ),
232cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
233cdf0e10cSrcweir {
234cdf0e10cSrcweir _hasValue |= 0x1;
235cdf0e10cSrcweir xProps->setPropertyValue(
236cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ), makeAny( _backgroundColor ) );
237cdf0e10cSrcweir return true;
238cdf0e10cSrcweir }
239cdf0e10cSrcweir return false;
240cdf0e10cSrcweir }
241cdf0e10cSrcweir
242cdf0e10cSrcweir //__________________________________________________________________________________________________
importBorderStyle(Reference<beans::XPropertySet> const & xProps)243cdf0e10cSrcweir bool StyleElement::importBorderStyle(
244cdf0e10cSrcweir Reference< beans::XPropertySet > const & xProps )
245cdf0e10cSrcweir {
246cdf0e10cSrcweir if ((_inited & 0x4) != 0)
247cdf0e10cSrcweir {
248cdf0e10cSrcweir if ((_hasValue & 0x4) != 0)
249cdf0e10cSrcweir {
250cdf0e10cSrcweir xProps->setPropertyValue(
251cdf0e10cSrcweir OUSTR("Border"), makeAny( _border == BORDER_SIMPLE_COLOR
252cdf0e10cSrcweir ? BORDER_SIMPLE : _border ) );
253cdf0e10cSrcweir if (_border == BORDER_SIMPLE_COLOR)
254cdf0e10cSrcweir xProps->setPropertyValue( OUSTR("BorderColor"),
255cdf0e10cSrcweir makeAny(_borderColor) );
256cdf0e10cSrcweir return true;
257cdf0e10cSrcweir }
258cdf0e10cSrcweir return false;
259cdf0e10cSrcweir }
260cdf0e10cSrcweir _inited |= 0x4;
261cdf0e10cSrcweir
262cdf0e10cSrcweir OUString aValue;
263cdf0e10cSrcweir if (getStringAttr(
264cdf0e10cSrcweir &aValue, OUSTR("border"),
265cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID )) {
266cdf0e10cSrcweir if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") ))
267cdf0e10cSrcweir _border = BORDER_NONE;
268cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("3d") ))
269cdf0e10cSrcweir _border = BORDER_3D;
270cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("simple") ))
271cdf0e10cSrcweir _border = BORDER_SIMPLE;
272cdf0e10cSrcweir else {
273cdf0e10cSrcweir _border = BORDER_SIMPLE_COLOR;
274cdf0e10cSrcweir _borderColor = toInt32(aValue);
275cdf0e10cSrcweir }
276cdf0e10cSrcweir
277cdf0e10cSrcweir _hasValue |= 0x4;
278cdf0e10cSrcweir importBorderStyle(xProps); // write values
279cdf0e10cSrcweir }
280cdf0e10cSrcweir return false;
281cdf0e10cSrcweir }
282cdf0e10cSrcweir
283cdf0e10cSrcweir //______________________________________________________________________________
importVisualEffectStyle(Reference<beans::XPropertySet> const & xProps)284cdf0e10cSrcweir bool StyleElement::importVisualEffectStyle(
285cdf0e10cSrcweir Reference<beans::XPropertySet> const & xProps )
286cdf0e10cSrcweir {
287cdf0e10cSrcweir if ((_inited & 0x40) != 0)
288cdf0e10cSrcweir {
289cdf0e10cSrcweir if ((_hasValue & 0x40) != 0)
290cdf0e10cSrcweir {
291cdf0e10cSrcweir xProps->setPropertyValue( OUSTR("VisualEffect"),
292cdf0e10cSrcweir makeAny(_visualEffect) );
293cdf0e10cSrcweir return true;
294cdf0e10cSrcweir }
295cdf0e10cSrcweir return false;
296cdf0e10cSrcweir }
297cdf0e10cSrcweir _inited |= 0x40;
298cdf0e10cSrcweir
299cdf0e10cSrcweir OUString aValue;
300cdf0e10cSrcweir if (getStringAttr( &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("look") ),
301cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
302cdf0e10cSrcweir {
303cdf0e10cSrcweir if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") ))
304cdf0e10cSrcweir {
305cdf0e10cSrcweir _visualEffect = awt::VisualEffect::NONE;
306cdf0e10cSrcweir }
307cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("3d") ))
308cdf0e10cSrcweir {
309cdf0e10cSrcweir _visualEffect = awt::VisualEffect::LOOK3D;
310cdf0e10cSrcweir }
311cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("simple") ))
312cdf0e10cSrcweir {
313cdf0e10cSrcweir _visualEffect = awt::VisualEffect::FLAT;
314cdf0e10cSrcweir }
315cdf0e10cSrcweir else
316cdf0e10cSrcweir OSL_ASSERT( 0 );
317cdf0e10cSrcweir
318cdf0e10cSrcweir _hasValue |= 0x40;
319cdf0e10cSrcweir xProps->setPropertyValue( OUSTR("VisualEffect"),
320cdf0e10cSrcweir makeAny(_visualEffect) );
321cdf0e10cSrcweir }
322cdf0e10cSrcweir return false;
323cdf0e10cSrcweir }
324cdf0e10cSrcweir
325cdf0e10cSrcweir //__________________________________________________________________________________________________
setFontProperties(Reference<beans::XPropertySet> const & xProps)326cdf0e10cSrcweir void StyleElement::setFontProperties(
327cdf0e10cSrcweir Reference< beans::XPropertySet > const & xProps )
328cdf0e10cSrcweir {
329cdf0e10cSrcweir xProps->setPropertyValue(
330cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ), makeAny( _descr ) );
331cdf0e10cSrcweir xProps->setPropertyValue(
332cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("FontEmphasisMark") ), makeAny( _fontEmphasisMark ) );
333cdf0e10cSrcweir xProps->setPropertyValue(
334cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("FontRelief") ), makeAny( _fontRelief ) );
335cdf0e10cSrcweir }
336cdf0e10cSrcweir //__________________________________________________________________________________________________
importFontStyle(Reference<beans::XPropertySet> const & xProps)337cdf0e10cSrcweir bool StyleElement::importFontStyle(
338cdf0e10cSrcweir Reference< beans::XPropertySet > const & xProps )
339cdf0e10cSrcweir {
340cdf0e10cSrcweir if ((_inited & 0x8) != 0)
341cdf0e10cSrcweir {
342cdf0e10cSrcweir if ((_hasValue & 0x8) != 0)
343cdf0e10cSrcweir {
344cdf0e10cSrcweir setFontProperties( xProps );
345cdf0e10cSrcweir return true;
346cdf0e10cSrcweir }
347cdf0e10cSrcweir return false;
348cdf0e10cSrcweir }
349cdf0e10cSrcweir _inited |= 0x8;
350cdf0e10cSrcweir
351cdf0e10cSrcweir OUString aValue;
352cdf0e10cSrcweir bool bFontImport;
353cdf0e10cSrcweir
354cdf0e10cSrcweir // dialog:font-name CDATA #IMPLIED
355cdf0e10cSrcweir bFontImport = getStringAttr(
356cdf0e10cSrcweir &_descr.Name, OUString( RTL_CONSTASCII_USTRINGPARAM("font-name") ),
357cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID );
358cdf0e10cSrcweir
359cdf0e10cSrcweir // dialog:font-height %numeric; #IMPLIED
360cdf0e10cSrcweir if (getStringAttr(
361cdf0e10cSrcweir &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-height") ),
362cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
363cdf0e10cSrcweir {
364cdf0e10cSrcweir _descr.Height = (sal_Int16)toInt32( aValue );
365cdf0e10cSrcweir bFontImport = true;
366cdf0e10cSrcweir }
367cdf0e10cSrcweir // dialog:font-width %numeric; #IMPLIED
368cdf0e10cSrcweir if (getStringAttr(
369cdf0e10cSrcweir &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-width") ),
370cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
371cdf0e10cSrcweir {
372cdf0e10cSrcweir _descr.Width = (sal_Int16)toInt32( aValue );
373cdf0e10cSrcweir bFontImport = true;
374cdf0e10cSrcweir }
375cdf0e10cSrcweir // dialog:font-stylename CDATA #IMPLIED
376cdf0e10cSrcweir bFontImport |= getStringAttr(
377cdf0e10cSrcweir &_descr.StyleName,
378cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("font-stylename") ),
379cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID );
380cdf0e10cSrcweir
381cdf0e10cSrcweir // dialog:font-family "(decorative|modern|roman|script|swiss|system)" #IMPLIED
382cdf0e10cSrcweir if (getStringAttr(
383cdf0e10cSrcweir &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-family") ),
384cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
385cdf0e10cSrcweir {
386cdf0e10cSrcweir if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("decorative") ))
387cdf0e10cSrcweir {
388cdf0e10cSrcweir _descr.Family = awt::FontFamily::DECORATIVE;
389cdf0e10cSrcweir }
390cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("modern") ))
391cdf0e10cSrcweir {
392cdf0e10cSrcweir _descr.Family = awt::FontFamily::MODERN;
393cdf0e10cSrcweir }
394cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("roman") ))
395cdf0e10cSrcweir {
396cdf0e10cSrcweir _descr.Family = awt::FontFamily::ROMAN;
397cdf0e10cSrcweir }
398cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("script") ))
399cdf0e10cSrcweir {
400cdf0e10cSrcweir _descr.Family = awt::FontFamily::SCRIPT;
401cdf0e10cSrcweir }
402cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("swiss") ))
403cdf0e10cSrcweir {
404cdf0e10cSrcweir _descr.Family = awt::FontFamily::SWISS;
405cdf0e10cSrcweir }
406cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("system") ))
407cdf0e10cSrcweir {
408cdf0e10cSrcweir _descr.Family = awt::FontFamily::SYSTEM;
409cdf0e10cSrcweir }
410cdf0e10cSrcweir else
411cdf0e10cSrcweir {
412cdf0e10cSrcweir throw xml::sax::SAXException(
413cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-family style!") ),
414cdf0e10cSrcweir Reference< XInterface >(), Any() );
415cdf0e10cSrcweir }
416cdf0e10cSrcweir bFontImport = true;
417cdf0e10cSrcweir }
418cdf0e10cSrcweir
419cdf0e10cSrcweir // dialog:font-charset "(ansi|mac|ibmpc_437|ibmpc_850|ibmpc_860|ibmpc_861|ibmpc_863|ibmpc_865|system|symbol)" #IMPLIED
420cdf0e10cSrcweir if (getStringAttr(
421cdf0e10cSrcweir &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-charset") ),
422cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
423cdf0e10cSrcweir {
424cdf0e10cSrcweir if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ansi") ))
425cdf0e10cSrcweir {
426cdf0e10cSrcweir _descr.CharSet = awt::CharSet::ANSI;
427cdf0e10cSrcweir }
428cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("mac") ))
429cdf0e10cSrcweir {
430cdf0e10cSrcweir _descr.CharSet = awt::CharSet::MAC;
431cdf0e10cSrcweir }
432cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ibmpc_437") ))
433cdf0e10cSrcweir {
434cdf0e10cSrcweir _descr.CharSet = awt::CharSet::IBMPC_437;
435cdf0e10cSrcweir }
436cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ibmpc_850") ))
437cdf0e10cSrcweir {
438cdf0e10cSrcweir _descr.CharSet = awt::CharSet::IBMPC_850;
439cdf0e10cSrcweir }
440cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ibmpc_860") ))
441cdf0e10cSrcweir {
442cdf0e10cSrcweir _descr.CharSet = awt::CharSet::IBMPC_860;
443cdf0e10cSrcweir }
444cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ibmpc_861") ))
445cdf0e10cSrcweir {
446cdf0e10cSrcweir _descr.CharSet = awt::CharSet::IBMPC_861;
447cdf0e10cSrcweir }
448cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ibmpc_863") ))
449cdf0e10cSrcweir {
450cdf0e10cSrcweir _descr.CharSet = awt::CharSet::IBMPC_863;
451cdf0e10cSrcweir }
452cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ibmpc_865") ))
453cdf0e10cSrcweir {
454cdf0e10cSrcweir _descr.CharSet = awt::CharSet::IBMPC_865;
455cdf0e10cSrcweir }
456cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("system") ))
457cdf0e10cSrcweir {
458cdf0e10cSrcweir _descr.CharSet = awt::CharSet::SYSTEM;
459cdf0e10cSrcweir }
460cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("symbol") ))
461cdf0e10cSrcweir {
462cdf0e10cSrcweir _descr.CharSet = awt::CharSet::SYMBOL;
463cdf0e10cSrcweir }
464cdf0e10cSrcweir else
465cdf0e10cSrcweir {
466cdf0e10cSrcweir throw xml::sax::SAXException(
467cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-charset style!") ),
468cdf0e10cSrcweir Reference< XInterface >(), Any() );
469cdf0e10cSrcweir }
470cdf0e10cSrcweir bFontImport = true;
471cdf0e10cSrcweir }
472cdf0e10cSrcweir
473cdf0e10cSrcweir // dialog:font-pitch "(fixed|variable)" #IMPLIED
474cdf0e10cSrcweir if (getStringAttr(
475cdf0e10cSrcweir &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-pitch") ),
476cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
477cdf0e10cSrcweir {
478cdf0e10cSrcweir if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("fixed") ))
479cdf0e10cSrcweir {
480cdf0e10cSrcweir _descr.Pitch = awt::FontPitch::FIXED;
481cdf0e10cSrcweir }
482cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("variable") ))
483cdf0e10cSrcweir {
484cdf0e10cSrcweir _descr.Pitch = awt::FontPitch::VARIABLE;
485cdf0e10cSrcweir }
486cdf0e10cSrcweir else
487cdf0e10cSrcweir {
488cdf0e10cSrcweir throw xml::sax::SAXException(
489cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-pitch style!") ),
490cdf0e10cSrcweir Reference< XInterface >(), Any() );
491cdf0e10cSrcweir }
492cdf0e10cSrcweir bFontImport = true;
493cdf0e10cSrcweir }
494cdf0e10cSrcweir
495cdf0e10cSrcweir // dialog:font-charwidth CDATA #IMPLIED
496cdf0e10cSrcweir if (getStringAttr(
497cdf0e10cSrcweir &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-charwidth") ),
498cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
499cdf0e10cSrcweir {
500cdf0e10cSrcweir _descr.CharacterWidth = aValue.toFloat();
501cdf0e10cSrcweir bFontImport = true;
502cdf0e10cSrcweir }
503cdf0e10cSrcweir // dialog:font-weight CDATA #IMPLIED
504cdf0e10cSrcweir if (getStringAttr(
505cdf0e10cSrcweir &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-weight") ),
506cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
507cdf0e10cSrcweir {
508cdf0e10cSrcweir _descr.Weight = aValue.toFloat();
509cdf0e10cSrcweir bFontImport = true;
510cdf0e10cSrcweir }
511cdf0e10cSrcweir
512cdf0e10cSrcweir // dialog:font-slant "(oblique|italic|reverse_oblique|reverse_italic)" #IMPLIED
513cdf0e10cSrcweir if (getStringAttr(
514cdf0e10cSrcweir &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-slant") ),
515cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
516cdf0e10cSrcweir {
517cdf0e10cSrcweir if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("oblique") ))
518cdf0e10cSrcweir {
519cdf0e10cSrcweir _descr.Slant = awt::FontSlant_OBLIQUE;
520cdf0e10cSrcweir }
521cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("italic") ))
522cdf0e10cSrcweir {
523cdf0e10cSrcweir _descr.Slant = awt::FontSlant_ITALIC;
524cdf0e10cSrcweir }
525cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("reverse_oblique") ))
526cdf0e10cSrcweir {
527cdf0e10cSrcweir _descr.Slant = awt::FontSlant_REVERSE_OBLIQUE;
528cdf0e10cSrcweir }
529cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("reverse_italic") ))
530cdf0e10cSrcweir {
531cdf0e10cSrcweir _descr.Slant = awt::FontSlant_REVERSE_ITALIC;
532cdf0e10cSrcweir }
533cdf0e10cSrcweir else
534cdf0e10cSrcweir {
535cdf0e10cSrcweir throw xml::sax::SAXException(
536cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-slant style!") ),
537cdf0e10cSrcweir Reference< XInterface >(), Any() );
538cdf0e10cSrcweir }
539cdf0e10cSrcweir bFontImport = true;
540cdf0e10cSrcweir }
541cdf0e10cSrcweir
542cdf0e10cSrcweir // dialog:font-underline "(single|double|dotted|dash|longdash|dashdot|dashdotdot|smallwave|wave|doublewave|bold|bolddotted|bolddash|boldlongdash|bolddashdot|bolddashdotdot|boldwave)" #IMPLIED
543cdf0e10cSrcweir if (getStringAttr(
544cdf0e10cSrcweir &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-underline") ),
545cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
546cdf0e10cSrcweir {
547cdf0e10cSrcweir if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("single") ))
548cdf0e10cSrcweir {
549cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::SINGLE;
550cdf0e10cSrcweir }
551cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("double") ))
552cdf0e10cSrcweir {
553cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::DOUBLE;
554cdf0e10cSrcweir }
555cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dotted") ))
556cdf0e10cSrcweir {
557cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::DOTTED;
558cdf0e10cSrcweir }
559cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dash") ))
560cdf0e10cSrcweir {
561cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::DASH;
562cdf0e10cSrcweir }
563cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("longdash") ))
564cdf0e10cSrcweir {
565cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::LONGDASH;
566cdf0e10cSrcweir }
567cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dashdot") ))
568cdf0e10cSrcweir {
569cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::DASHDOT;
570cdf0e10cSrcweir }
571cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dashdotdot") ))
572cdf0e10cSrcweir {
573cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::DASHDOTDOT;
574cdf0e10cSrcweir }
575cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("smallwave") ))
576cdf0e10cSrcweir {
577cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::SMALLWAVE;
578cdf0e10cSrcweir }
579cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("wave") ))
580cdf0e10cSrcweir {
581cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::WAVE;
582cdf0e10cSrcweir }
583cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("doublewave") ))
584cdf0e10cSrcweir {
585cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::DOUBLEWAVE;
586cdf0e10cSrcweir }
587cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bold") ))
588cdf0e10cSrcweir {
589cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::BOLD;
590cdf0e10cSrcweir }
591cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bolddotted") ))
592cdf0e10cSrcweir {
593cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::BOLDDOTTED;
594cdf0e10cSrcweir }
595cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bolddash") ))
596cdf0e10cSrcweir {
597cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::BOLDDASH;
598cdf0e10cSrcweir }
599cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("boldlongdash") ))
600cdf0e10cSrcweir {
601cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::BOLDLONGDASH;
602cdf0e10cSrcweir }
603cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bolddashdot") ))
604cdf0e10cSrcweir {
605cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::BOLDDASHDOT;
606cdf0e10cSrcweir }
607cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bolddashdotdot") ))
608cdf0e10cSrcweir {
609cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::BOLDDASHDOTDOT;
610cdf0e10cSrcweir }
611cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("boldwave") ))
612cdf0e10cSrcweir {
613cdf0e10cSrcweir _descr.Underline = awt::FontUnderline::BOLDWAVE;
614cdf0e10cSrcweir }
615cdf0e10cSrcweir else
616cdf0e10cSrcweir {
617cdf0e10cSrcweir throw xml::sax::SAXException(
618cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-underline style!") ),
619cdf0e10cSrcweir Reference< XInterface >(), Any() );
620cdf0e10cSrcweir }
621cdf0e10cSrcweir bFontImport = true;
622cdf0e10cSrcweir }
623cdf0e10cSrcweir
624cdf0e10cSrcweir // dialog:font-strikeout "(single|double|bold|slash|x)" #IMPLIED
625cdf0e10cSrcweir if (getStringAttr(
626cdf0e10cSrcweir &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-strikeout") ),
627cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
628cdf0e10cSrcweir {
629cdf0e10cSrcweir if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("single") ))
630cdf0e10cSrcweir {
631cdf0e10cSrcweir _descr.Strikeout = awt::FontStrikeout::SINGLE;
632cdf0e10cSrcweir }
633cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("double") ))
634cdf0e10cSrcweir {
635cdf0e10cSrcweir _descr.Strikeout = awt::FontStrikeout::DOUBLE;
636cdf0e10cSrcweir }
637cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bold") ))
638cdf0e10cSrcweir {
639cdf0e10cSrcweir _descr.Strikeout = awt::FontStrikeout::BOLD;
640cdf0e10cSrcweir }
641cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("slash") ))
642cdf0e10cSrcweir {
643cdf0e10cSrcweir _descr.Strikeout = awt::FontStrikeout::SLASH;
644cdf0e10cSrcweir }
645cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("x") ))
646cdf0e10cSrcweir {
647cdf0e10cSrcweir _descr.Strikeout = awt::FontStrikeout::X;
648cdf0e10cSrcweir }
649cdf0e10cSrcweir else
650cdf0e10cSrcweir {
651cdf0e10cSrcweir throw xml::sax::SAXException(
652cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-strikeout style!") ),
653cdf0e10cSrcweir Reference< XInterface >(), Any() );
654cdf0e10cSrcweir }
655cdf0e10cSrcweir bFontImport = true;
656cdf0e10cSrcweir }
657cdf0e10cSrcweir
658cdf0e10cSrcweir // dialog:font-orientation CDATA #IMPLIED
659cdf0e10cSrcweir if (getStringAttr(
660cdf0e10cSrcweir &aValue,
661cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("font-orientation") ),
662cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
663cdf0e10cSrcweir {
664cdf0e10cSrcweir _descr.Orientation = aValue.toFloat();
665cdf0e10cSrcweir bFontImport = true;
666cdf0e10cSrcweir }
667cdf0e10cSrcweir // dialog:font-kerning %boolean; #IMPLIED
668cdf0e10cSrcweir bFontImport |= getBoolAttr(
669cdf0e10cSrcweir &_descr.Kerning,
670cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("font-kerning") ),
671cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID );
672cdf0e10cSrcweir // dialog:font-wordlinemode %boolean; #IMPLIED
673cdf0e10cSrcweir bFontImport |= getBoolAttr(
674cdf0e10cSrcweir &_descr.WordLineMode,
675cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("font-wordlinemode") ),
676cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID );
677cdf0e10cSrcweir
678cdf0e10cSrcweir // dialog:font-type "(raster|device|scalable)" #IMPLIED
679cdf0e10cSrcweir if (getStringAttr(
680cdf0e10cSrcweir &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-type") ),
681cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
682cdf0e10cSrcweir {
683cdf0e10cSrcweir if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("raster") ))
684cdf0e10cSrcweir {
685cdf0e10cSrcweir _descr.Type = awt::FontType::RASTER;
686cdf0e10cSrcweir }
687cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("device") ))
688cdf0e10cSrcweir {
689cdf0e10cSrcweir _descr.Type = awt::FontType::DEVICE;
690cdf0e10cSrcweir }
691cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("scalable") ))
692cdf0e10cSrcweir {
693cdf0e10cSrcweir _descr.Type = awt::FontType::SCALABLE;
694cdf0e10cSrcweir }
695cdf0e10cSrcweir else
696cdf0e10cSrcweir {
697cdf0e10cSrcweir throw xml::sax::SAXException(
698cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-type style!") ),
699cdf0e10cSrcweir Reference< XInterface >(), Any() );
700cdf0e10cSrcweir }
701cdf0e10cSrcweir bFontImport = true;
702cdf0e10cSrcweir }
703cdf0e10cSrcweir
704cdf0e10cSrcweir // additional properties which are not part of the FontDescriptor struct
705cdf0e10cSrcweir // dialog:font-relief (none|embossed|engraved) #IMPLIED
706cdf0e10cSrcweir if (getStringAttr(
707cdf0e10cSrcweir &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-relief") ),
708cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
709cdf0e10cSrcweir {
710cdf0e10cSrcweir if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") ))
711cdf0e10cSrcweir {
712cdf0e10cSrcweir _fontRelief = awt::FontRelief::NONE;
713cdf0e10cSrcweir }
714cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("embossed") ))
715cdf0e10cSrcweir {
716cdf0e10cSrcweir _fontRelief = awt::FontRelief::EMBOSSED;
717cdf0e10cSrcweir }
718cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("engraved") ))
719cdf0e10cSrcweir {
720cdf0e10cSrcweir _fontRelief = awt::FontRelief::ENGRAVED;
721cdf0e10cSrcweir }
722cdf0e10cSrcweir else
723cdf0e10cSrcweir {
724cdf0e10cSrcweir throw xml::sax::SAXException(
725cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-relief style!") ),
726cdf0e10cSrcweir Reference< XInterface >(), Any() );
727cdf0e10cSrcweir }
728cdf0e10cSrcweir bFontImport = true;
729cdf0e10cSrcweir }
730cdf0e10cSrcweir // dialog:font-emphasismark (none|dot|circle|disc|accent|above|below) #IMPLIED
731cdf0e10cSrcweir if (getStringAttr(
732cdf0e10cSrcweir &aValue,
733cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("font-emphasismark") ),
734cdf0e10cSrcweir _xAttributes, _pImport->XMLNS_DIALOGS_UID ))
735cdf0e10cSrcweir {
736cdf0e10cSrcweir if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") ))
737cdf0e10cSrcweir {
738cdf0e10cSrcweir _fontEmphasisMark = awt::FontEmphasisMark::NONE;
739cdf0e10cSrcweir }
740cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dot") ))
741cdf0e10cSrcweir {
742cdf0e10cSrcweir _fontEmphasisMark = awt::FontEmphasisMark::DOT;
743cdf0e10cSrcweir }
744cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("circle") ))
745cdf0e10cSrcweir {
746cdf0e10cSrcweir _fontEmphasisMark = awt::FontEmphasisMark::CIRCLE;
747cdf0e10cSrcweir }
748cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("disc") ))
749cdf0e10cSrcweir {
750cdf0e10cSrcweir _fontEmphasisMark = awt::FontEmphasisMark::DISC;
751cdf0e10cSrcweir }
752cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("accent") ))
753cdf0e10cSrcweir {
754cdf0e10cSrcweir _fontEmphasisMark = awt::FontEmphasisMark::ACCENT;
755cdf0e10cSrcweir }
756cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("above") ))
757cdf0e10cSrcweir {
758cdf0e10cSrcweir _fontEmphasisMark = awt::FontEmphasisMark::ABOVE;
759cdf0e10cSrcweir }
760cdf0e10cSrcweir else if (aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("below") ))
761cdf0e10cSrcweir {
762cdf0e10cSrcweir _fontEmphasisMark = awt::FontEmphasisMark::BELOW;
763cdf0e10cSrcweir }
764cdf0e10cSrcweir else
765cdf0e10cSrcweir {
766cdf0e10cSrcweir throw xml::sax::SAXException(
767cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid font-emphasismark style!") ),
768cdf0e10cSrcweir Reference< XInterface >(), Any() );
769cdf0e10cSrcweir }
770cdf0e10cSrcweir bFontImport = true;
771cdf0e10cSrcweir }
772cdf0e10cSrcweir
773cdf0e10cSrcweir // ==================================================
774cdf0e10cSrcweir if (bFontImport)
775cdf0e10cSrcweir {
776cdf0e10cSrcweir _hasValue |= 0x8;
777cdf0e10cSrcweir setFontProperties( xProps );
778cdf0e10cSrcweir }
779cdf0e10cSrcweir
780cdf0e10cSrcweir return bFontImport;
781cdf0e10cSrcweir }
782cdf0e10cSrcweir
783cdf0e10cSrcweir //##################################################################################################
784cdf0e10cSrcweir
785cdf0e10cSrcweir //__________________________________________________________________________________________________
importStringProperty(OUString const & rPropName,OUString const & rAttrName,Reference<xml::input::XAttributes> const & xAttributes)786cdf0e10cSrcweir bool ImportContext::importStringProperty(
787cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName,
788cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes )
789cdf0e10cSrcweir {
790cdf0e10cSrcweir OUString aValue(
791cdf0e10cSrcweir xAttributes->getValueByUidName(
792cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
793cdf0e10cSrcweir if (aValue.getLength())
794cdf0e10cSrcweir {
795cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( aValue ) );
796cdf0e10cSrcweir return true;
797cdf0e10cSrcweir }
798cdf0e10cSrcweir return false;
799cdf0e10cSrcweir }
800cdf0e10cSrcweir //__________________________________________________________________________________________________
importDoubleProperty(OUString const & rPropName,OUString const & rAttrName,Reference<xml::input::XAttributes> const & xAttributes)801cdf0e10cSrcweir bool ImportContext::importDoubleProperty(
802cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName,
803cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes )
804cdf0e10cSrcweir {
805cdf0e10cSrcweir OUString aValue(
806cdf0e10cSrcweir xAttributes->getValueByUidName(
807cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
808cdf0e10cSrcweir if (aValue.getLength())
809cdf0e10cSrcweir {
810cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( aValue.toDouble() ) );
811cdf0e10cSrcweir return true;
812cdf0e10cSrcweir }
813cdf0e10cSrcweir return false;
814cdf0e10cSrcweir }
815cdf0e10cSrcweir //__________________________________________________________________________________________________
importBooleanProperty(OUString const & rPropName,OUString const & rAttrName,Reference<xml::input::XAttributes> const & xAttributes)816cdf0e10cSrcweir bool ImportContext::importBooleanProperty(
817cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName,
818cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes )
819cdf0e10cSrcweir {
820cdf0e10cSrcweir sal_Bool bBool;
821cdf0e10cSrcweir if (getBoolAttr(
822cdf0e10cSrcweir &bBool, rAttrName, xAttributes, _pImport->XMLNS_DIALOGS_UID ))
823cdf0e10cSrcweir {
824cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( bBool ) );
825cdf0e10cSrcweir return true;
826cdf0e10cSrcweir }
827cdf0e10cSrcweir return false;
828cdf0e10cSrcweir }
829cdf0e10cSrcweir //__________________________________________________________________________________________________
importLongProperty(OUString const & rPropName,OUString const & rAttrName,Reference<xml::input::XAttributes> const & xAttributes)830cdf0e10cSrcweir bool ImportContext::importLongProperty(
831cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName,
832cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes )
833cdf0e10cSrcweir {
834cdf0e10cSrcweir OUString aValue(
835cdf0e10cSrcweir xAttributes->getValueByUidName(
836cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
837cdf0e10cSrcweir if (aValue.getLength())
838cdf0e10cSrcweir {
839cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( toInt32( aValue ) ) );
840cdf0e10cSrcweir return true;
841cdf0e10cSrcweir }
842cdf0e10cSrcweir return false;
843cdf0e10cSrcweir }
844cdf0e10cSrcweir //__________________________________________________________________________________________________
importLongProperty(sal_Int32 nOffset,OUString const & rPropName,OUString const & rAttrName,Reference<xml::input::XAttributes> const & xAttributes)845cdf0e10cSrcweir bool ImportContext::importLongProperty(
846cdf0e10cSrcweir sal_Int32 nOffset,
847cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName,
848cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes )
849cdf0e10cSrcweir {
850cdf0e10cSrcweir OUString aValue(
851cdf0e10cSrcweir xAttributes->getValueByUidName(
852cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
853cdf0e10cSrcweir if (aValue.getLength())
854cdf0e10cSrcweir {
855cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( toInt32( aValue ) + nOffset ) );
856cdf0e10cSrcweir return true;
857cdf0e10cSrcweir }
858cdf0e10cSrcweir return false;
859cdf0e10cSrcweir }
860cdf0e10cSrcweir //__________________________________________________________________________________________________
importHexLongProperty(OUString const & rPropName,OUString const & rAttrName,Reference<xml::input::XAttributes> const & xAttributes)861cdf0e10cSrcweir bool ImportContext::importHexLongProperty(
862cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName,
863cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes )
864cdf0e10cSrcweir {
865cdf0e10cSrcweir OUString aValue(
866cdf0e10cSrcweir xAttributes->getValueByUidName(
867cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
868cdf0e10cSrcweir if (aValue.getLength())
869cdf0e10cSrcweir {
870cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( toInt32( aValue ) ) );
871cdf0e10cSrcweir return true;
872cdf0e10cSrcweir }
873cdf0e10cSrcweir return false;
874cdf0e10cSrcweir }
875cdf0e10cSrcweir //__________________________________________________________________________________________________
importShortProperty(OUString const & rPropName,OUString const & rAttrName,Reference<xml::input::XAttributes> const & xAttributes)876cdf0e10cSrcweir bool ImportContext::importShortProperty(
877cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName,
878cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes )
879cdf0e10cSrcweir {
880cdf0e10cSrcweir OUString aValue(
881cdf0e10cSrcweir xAttributes->getValueByUidName(
882cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
883cdf0e10cSrcweir if (aValue.getLength())
884cdf0e10cSrcweir {
885cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( (sal_Int16)toInt32( aValue ) ) );
886cdf0e10cSrcweir return true;
887cdf0e10cSrcweir }
888cdf0e10cSrcweir return false;
889cdf0e10cSrcweir }
890cdf0e10cSrcweir //__________________________________________________________________________________________________
importAlignProperty(OUString const & rPropName,OUString const & rAttrName,Reference<xml::input::XAttributes> const & xAttributes)891cdf0e10cSrcweir bool ImportContext::importAlignProperty(
892cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName,
893cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes )
894cdf0e10cSrcweir {
895cdf0e10cSrcweir OUString aAlign(
896cdf0e10cSrcweir xAttributes->getValueByUidName(
897cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
898cdf0e10cSrcweir if (aAlign.getLength())
899cdf0e10cSrcweir {
900cdf0e10cSrcweir sal_Int16 nAlign;
901cdf0e10cSrcweir if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("left") ))
902cdf0e10cSrcweir {
903cdf0e10cSrcweir nAlign = 0;
904cdf0e10cSrcweir }
905cdf0e10cSrcweir else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("center") ))
906cdf0e10cSrcweir {
907cdf0e10cSrcweir nAlign = 1;
908cdf0e10cSrcweir }
909cdf0e10cSrcweir else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("right") ))
910cdf0e10cSrcweir {
911cdf0e10cSrcweir nAlign = 2;
912cdf0e10cSrcweir }
913cdf0e10cSrcweir else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") ))
914cdf0e10cSrcweir {
915cdf0e10cSrcweir nAlign = 0; // default
916cdf0e10cSrcweir }
917cdf0e10cSrcweir else
918cdf0e10cSrcweir {
919cdf0e10cSrcweir throw xml::sax::SAXException(
920cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid align value!") ),
921cdf0e10cSrcweir Reference< XInterface >(), Any() );
922cdf0e10cSrcweir }
923cdf0e10cSrcweir
924cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( nAlign ) );
925cdf0e10cSrcweir return true;
926cdf0e10cSrcweir }
927cdf0e10cSrcweir return false;
928cdf0e10cSrcweir }
929cdf0e10cSrcweir //__________________________________________________________________________________________________
importVerticalAlignProperty(OUString const & rPropName,OUString const & rAttrName,Reference<xml::input::XAttributes> const & xAttributes)930cdf0e10cSrcweir bool ImportContext::importVerticalAlignProperty(
931cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName,
932cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes )
933cdf0e10cSrcweir {
934cdf0e10cSrcweir OUString aAlign(
935cdf0e10cSrcweir xAttributes->getValueByUidName(
936cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
937cdf0e10cSrcweir if (aAlign.getLength())
938cdf0e10cSrcweir {
939cdf0e10cSrcweir style::VerticalAlignment eAlign;
940cdf0e10cSrcweir
941cdf0e10cSrcweir if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("top") ))
942cdf0e10cSrcweir {
943cdf0e10cSrcweir eAlign = style::VerticalAlignment_TOP;
944cdf0e10cSrcweir }
945cdf0e10cSrcweir else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("center") ))
946cdf0e10cSrcweir {
947cdf0e10cSrcweir eAlign = style::VerticalAlignment_MIDDLE;
948cdf0e10cSrcweir }
949cdf0e10cSrcweir else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bottom") ))
950cdf0e10cSrcweir {
951cdf0e10cSrcweir eAlign = style::VerticalAlignment_BOTTOM;
952cdf0e10cSrcweir }
953cdf0e10cSrcweir else
954cdf0e10cSrcweir {
955cdf0e10cSrcweir throw xml::sax::SAXException(
956cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid vertical align value!") ),
957cdf0e10cSrcweir Reference< XInterface >(), Any() );
958cdf0e10cSrcweir }
959cdf0e10cSrcweir
960cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( eAlign ) );
961cdf0e10cSrcweir return true;
962cdf0e10cSrcweir }
963cdf0e10cSrcweir return false;
964cdf0e10cSrcweir }
965cdf0e10cSrcweir //__________________________________________________________________________________________________
importImageAlignProperty(OUString const & rPropName,OUString const & rAttrName,Reference<xml::input::XAttributes> const & xAttributes)966cdf0e10cSrcweir bool ImportContext::importImageAlignProperty(
967cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName,
968cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes )
969cdf0e10cSrcweir {
970cdf0e10cSrcweir OUString aAlign(
971cdf0e10cSrcweir xAttributes->getValueByUidName(
972cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
973cdf0e10cSrcweir if (aAlign.getLength())
974cdf0e10cSrcweir {
975cdf0e10cSrcweir sal_Int16 nAlign;
976cdf0e10cSrcweir if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("left") ))
977cdf0e10cSrcweir {
978cdf0e10cSrcweir nAlign = 0;
979cdf0e10cSrcweir }
980cdf0e10cSrcweir else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("top") ))
981cdf0e10cSrcweir {
982cdf0e10cSrcweir nAlign = 1;
983cdf0e10cSrcweir }
984cdf0e10cSrcweir else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("right") ))
985cdf0e10cSrcweir {
986cdf0e10cSrcweir nAlign = 2;
987cdf0e10cSrcweir }
988cdf0e10cSrcweir else if (aAlign.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bottom") ))
989cdf0e10cSrcweir {
990cdf0e10cSrcweir nAlign = 3;
991cdf0e10cSrcweir }
992cdf0e10cSrcweir else
993cdf0e10cSrcweir {
994cdf0e10cSrcweir throw xml::sax::SAXException(
995cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid image align value!") ),
996cdf0e10cSrcweir Reference< XInterface >(), Any() );
997cdf0e10cSrcweir }
998cdf0e10cSrcweir
999cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( nAlign ) );
1000cdf0e10cSrcweir return true;
1001cdf0e10cSrcweir }
1002cdf0e10cSrcweir return false;
1003cdf0e10cSrcweir }
1004cdf0e10cSrcweir //__________________________________________________________________________________________________
importImagePositionProperty(OUString const & rPropName,OUString const & rAttrName,Reference<xml::input::XAttributes> const & xAttributes)1005cdf0e10cSrcweir bool ImportContext::importImagePositionProperty(
1006cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName,
1007cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes )
1008cdf0e10cSrcweir {
1009cdf0e10cSrcweir OUString aPosition(
1010cdf0e10cSrcweir xAttributes->getValueByUidName(
1011cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
1012cdf0e10cSrcweir if (aPosition.getLength())
1013cdf0e10cSrcweir {
1014cdf0e10cSrcweir sal_Int16 nPosition;
1015cdf0e10cSrcweir if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("left-top") ))
1016cdf0e10cSrcweir {
1017cdf0e10cSrcweir nPosition = awt::ImagePosition::LeftTop;
1018cdf0e10cSrcweir }
1019cdf0e10cSrcweir else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("left-center") ))
1020cdf0e10cSrcweir {
1021cdf0e10cSrcweir nPosition = awt::ImagePosition::LeftCenter;
1022cdf0e10cSrcweir }
1023cdf0e10cSrcweir else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("left-bottom") ))
1024cdf0e10cSrcweir {
1025cdf0e10cSrcweir nPosition = awt::ImagePosition::LeftBottom;
1026cdf0e10cSrcweir }
1027cdf0e10cSrcweir else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("right-top") ))
1028cdf0e10cSrcweir {
1029cdf0e10cSrcweir nPosition = awt::ImagePosition::RightTop;
1030cdf0e10cSrcweir }
1031cdf0e10cSrcweir else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("right-center") ))
1032cdf0e10cSrcweir {
1033cdf0e10cSrcweir nPosition = awt::ImagePosition::RightCenter;
1034cdf0e10cSrcweir }
1035cdf0e10cSrcweir else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("right-bottom") ))
1036cdf0e10cSrcweir {
1037cdf0e10cSrcweir nPosition = awt::ImagePosition::RightBottom;
1038cdf0e10cSrcweir }
1039cdf0e10cSrcweir else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("top-left") ))
1040cdf0e10cSrcweir {
1041cdf0e10cSrcweir nPosition = awt::ImagePosition::AboveLeft;
1042cdf0e10cSrcweir }
1043cdf0e10cSrcweir else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("top-center") ))
1044cdf0e10cSrcweir {
1045cdf0e10cSrcweir nPosition = awt::ImagePosition::AboveCenter;
1046cdf0e10cSrcweir }
1047cdf0e10cSrcweir else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("top-right") ))
1048cdf0e10cSrcweir {
1049cdf0e10cSrcweir nPosition = awt::ImagePosition::AboveRight;
1050cdf0e10cSrcweir }
1051cdf0e10cSrcweir else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bottom-left") ))
1052cdf0e10cSrcweir {
1053cdf0e10cSrcweir nPosition = awt::ImagePosition::BelowLeft;
1054cdf0e10cSrcweir }
1055cdf0e10cSrcweir else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bottom-center") ))
1056cdf0e10cSrcweir {
1057cdf0e10cSrcweir nPosition = awt::ImagePosition::BelowCenter;
1058cdf0e10cSrcweir }
1059cdf0e10cSrcweir else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bottom-right") ))
1060cdf0e10cSrcweir {
1061cdf0e10cSrcweir nPosition = awt::ImagePosition::BelowRight;
1062cdf0e10cSrcweir }
1063cdf0e10cSrcweir else if (aPosition.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("center") ))
1064cdf0e10cSrcweir {
1065cdf0e10cSrcweir nPosition = awt::ImagePosition::Centered;
1066cdf0e10cSrcweir }
1067cdf0e10cSrcweir else
1068cdf0e10cSrcweir {
1069cdf0e10cSrcweir throw xml::sax::SAXException(
1070cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid image position value!") ),
1071cdf0e10cSrcweir Reference< XInterface >(), Any() );
1072cdf0e10cSrcweir }
1073cdf0e10cSrcweir
1074cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( nPosition ) );
1075cdf0e10cSrcweir return true;
1076cdf0e10cSrcweir }
1077cdf0e10cSrcweir return false;
1078cdf0e10cSrcweir }
1079cdf0e10cSrcweir //__________________________________________________________________________________________________
importButtonTypeProperty(OUString const & rPropName,OUString const & rAttrName,Reference<xml::input::XAttributes> const & xAttributes)1080cdf0e10cSrcweir bool ImportContext::importButtonTypeProperty(
1081cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName,
1082cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes )
1083cdf0e10cSrcweir {
1084cdf0e10cSrcweir OUString buttonType(
1085cdf0e10cSrcweir xAttributes->getValueByUidName(
1086cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
1087cdf0e10cSrcweir if (buttonType.getLength())
1088cdf0e10cSrcweir {
1089cdf0e10cSrcweir sal_Int16 nButtonType;
1090cdf0e10cSrcweir if (buttonType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("standard") ))
1091cdf0e10cSrcweir {
1092cdf0e10cSrcweir nButtonType = awt::PushButtonType_STANDARD;
1093cdf0e10cSrcweir }
1094cdf0e10cSrcweir else if (buttonType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ok") ))
1095cdf0e10cSrcweir {
1096cdf0e10cSrcweir nButtonType = awt::PushButtonType_OK;
1097cdf0e10cSrcweir }
1098cdf0e10cSrcweir else if (buttonType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("cancel") ))
1099cdf0e10cSrcweir {
1100cdf0e10cSrcweir nButtonType = awt::PushButtonType_CANCEL;
1101cdf0e10cSrcweir }
1102cdf0e10cSrcweir else if (buttonType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("help") ))
1103cdf0e10cSrcweir {
1104cdf0e10cSrcweir nButtonType = awt::PushButtonType_HELP;
1105cdf0e10cSrcweir }
1106cdf0e10cSrcweir else
1107cdf0e10cSrcweir {
1108cdf0e10cSrcweir throw xml::sax::SAXException(
1109cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid button-type value!") ),
1110cdf0e10cSrcweir Reference< XInterface >(), Any() );
1111cdf0e10cSrcweir }
1112cdf0e10cSrcweir
1113cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( nButtonType ) );
1114cdf0e10cSrcweir return true;
1115cdf0e10cSrcweir }
1116cdf0e10cSrcweir return false;
1117cdf0e10cSrcweir }
1118cdf0e10cSrcweir //__________________________________________________________________________________________________
importDateFormatProperty(OUString const & rPropName,OUString const & rAttrName,Reference<xml::input::XAttributes> const & xAttributes)1119cdf0e10cSrcweir bool ImportContext::importDateFormatProperty(
1120cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName,
1121cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes )
1122cdf0e10cSrcweir {
1123cdf0e10cSrcweir OUString aFormat(
1124cdf0e10cSrcweir xAttributes->getValueByUidName(
1125cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
1126cdf0e10cSrcweir if (aFormat.getLength())
1127cdf0e10cSrcweir {
1128cdf0e10cSrcweir sal_Int16 nFormat;
1129cdf0e10cSrcweir if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("system_short") ))
1130cdf0e10cSrcweir {
1131cdf0e10cSrcweir nFormat = 0;
1132cdf0e10cSrcweir }
1133cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("system_short_YY") ))
1134cdf0e10cSrcweir {
1135cdf0e10cSrcweir nFormat = 1;
1136cdf0e10cSrcweir }
1137cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("system_short_YYYY") ))
1138cdf0e10cSrcweir {
1139cdf0e10cSrcweir nFormat = 2;
1140cdf0e10cSrcweir }
1141cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("system_long") ))
1142cdf0e10cSrcweir {
1143cdf0e10cSrcweir nFormat = 3;
1144cdf0e10cSrcweir }
1145cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short_DDMMYY") ))
1146cdf0e10cSrcweir {
1147cdf0e10cSrcweir nFormat = 4;
1148cdf0e10cSrcweir }
1149cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short_MMDDYY") ))
1150cdf0e10cSrcweir {
1151cdf0e10cSrcweir nFormat = 5;
1152cdf0e10cSrcweir }
1153cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short_YYMMDD") ))
1154cdf0e10cSrcweir {
1155cdf0e10cSrcweir nFormat = 6;
1156cdf0e10cSrcweir }
1157cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short_DDMMYYYY") ))
1158cdf0e10cSrcweir {
1159cdf0e10cSrcweir nFormat = 7;
1160cdf0e10cSrcweir }
1161cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short_MMDDYYYY") ))
1162cdf0e10cSrcweir {
1163cdf0e10cSrcweir nFormat = 8;
1164cdf0e10cSrcweir }
1165cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short_YYYYMMDD") ))
1166cdf0e10cSrcweir {
1167cdf0e10cSrcweir nFormat = 9;
1168cdf0e10cSrcweir }
1169cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short_YYMMDD_DIN5008") ))
1170cdf0e10cSrcweir {
1171cdf0e10cSrcweir nFormat = 10;
1172cdf0e10cSrcweir }
1173cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("short_YYYYMMDD_DIN5008") ))
1174cdf0e10cSrcweir {
1175cdf0e10cSrcweir nFormat = 11;
1176cdf0e10cSrcweir }
1177cdf0e10cSrcweir else
1178cdf0e10cSrcweir {
1179cdf0e10cSrcweir throw xml::sax::SAXException(
1180cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid date-format value!") ),
1181cdf0e10cSrcweir Reference< XInterface >(), Any() );
1182cdf0e10cSrcweir }
1183cdf0e10cSrcweir
1184cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( nFormat ) );
1185cdf0e10cSrcweir return true;
1186cdf0e10cSrcweir }
1187cdf0e10cSrcweir return false;
1188cdf0e10cSrcweir }
1189cdf0e10cSrcweir //__________________________________________________________________________________________________
importTimeFormatProperty(OUString const & rPropName,OUString const & rAttrName,Reference<xml::input::XAttributes> const & xAttributes)1190cdf0e10cSrcweir bool ImportContext::importTimeFormatProperty(
1191cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName,
1192cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes )
1193cdf0e10cSrcweir {
1194cdf0e10cSrcweir OUString aFormat(
1195cdf0e10cSrcweir xAttributes->getValueByUidName(
1196cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
1197cdf0e10cSrcweir if (aFormat.getLength())
1198cdf0e10cSrcweir {
1199cdf0e10cSrcweir sal_Int16 nFormat;
1200cdf0e10cSrcweir if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("24h_short") ))
1201cdf0e10cSrcweir {
1202cdf0e10cSrcweir nFormat = 0;
1203cdf0e10cSrcweir }
1204cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("24h_long") ))
1205cdf0e10cSrcweir {
1206cdf0e10cSrcweir nFormat = 1;
1207cdf0e10cSrcweir }
1208cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("12h_short") ))
1209cdf0e10cSrcweir {
1210cdf0e10cSrcweir nFormat = 2;
1211cdf0e10cSrcweir }
1212cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("12h_long") ))
1213cdf0e10cSrcweir {
1214cdf0e10cSrcweir nFormat = 3;
1215cdf0e10cSrcweir }
1216cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Duration_short") ))
1217cdf0e10cSrcweir {
1218cdf0e10cSrcweir nFormat = 4;
1219cdf0e10cSrcweir }
1220cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Duration_long") ))
1221cdf0e10cSrcweir {
1222cdf0e10cSrcweir nFormat = 5;
1223cdf0e10cSrcweir }
1224cdf0e10cSrcweir else
1225cdf0e10cSrcweir {
1226cdf0e10cSrcweir throw xml::sax::SAXException(
1227cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid time-format value!") ),
1228cdf0e10cSrcweir Reference< XInterface >(), Any() );
1229cdf0e10cSrcweir }
1230cdf0e10cSrcweir
1231cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( nFormat ) );
1232cdf0e10cSrcweir return true;
1233cdf0e10cSrcweir }
1234cdf0e10cSrcweir return false;
1235cdf0e10cSrcweir }
1236cdf0e10cSrcweir //__________________________________________________________________________________________________
importOrientationProperty(OUString const & rPropName,OUString const & rAttrName,Reference<xml::input::XAttributes> const & xAttributes)1237cdf0e10cSrcweir bool ImportContext::importOrientationProperty(
1238cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName,
1239cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes )
1240cdf0e10cSrcweir {
1241cdf0e10cSrcweir OUString aOrient(
1242cdf0e10cSrcweir xAttributes->getValueByUidName(
1243cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
1244cdf0e10cSrcweir if (aOrient.getLength())
1245cdf0e10cSrcweir {
1246cdf0e10cSrcweir sal_Int32 nOrient;
1247cdf0e10cSrcweir if (aOrient.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("horizontal") ))
1248cdf0e10cSrcweir {
1249cdf0e10cSrcweir nOrient = 0;
1250cdf0e10cSrcweir }
1251cdf0e10cSrcweir else if (aOrient.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("vertical") ))
1252cdf0e10cSrcweir {
1253cdf0e10cSrcweir nOrient = 1;
1254cdf0e10cSrcweir }
1255cdf0e10cSrcweir else
1256cdf0e10cSrcweir {
1257cdf0e10cSrcweir throw xml::sax::SAXException(
1258cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid orientation value!") ),
1259cdf0e10cSrcweir Reference< XInterface >(), Any() );
1260cdf0e10cSrcweir }
1261cdf0e10cSrcweir
1262cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( nOrient ) );
1263cdf0e10cSrcweir return true;
1264cdf0e10cSrcweir }
1265cdf0e10cSrcweir return false;
1266cdf0e10cSrcweir }
1267cdf0e10cSrcweir //__________________________________________________________________________________________________
importLineEndFormatProperty(OUString const & rPropName,OUString const & rAttrName,Reference<xml::input::XAttributes> const & xAttributes)1268cdf0e10cSrcweir bool ImportContext::importLineEndFormatProperty(
1269cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName,
1270cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes )
1271cdf0e10cSrcweir {
1272cdf0e10cSrcweir OUString aFormat(
1273cdf0e10cSrcweir xAttributes->getValueByUidName(
1274cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
1275cdf0e10cSrcweir if (aFormat.getLength())
1276cdf0e10cSrcweir {
1277cdf0e10cSrcweir sal_Int16 nFormat;
1278cdf0e10cSrcweir if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("carriage-return") ))
1279cdf0e10cSrcweir {
1280cdf0e10cSrcweir nFormat = awt::LineEndFormat::CARRIAGE_RETURN;
1281cdf0e10cSrcweir }
1282cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("line-feed") ))
1283cdf0e10cSrcweir {
1284cdf0e10cSrcweir nFormat = awt::LineEndFormat::LINE_FEED;
1285cdf0e10cSrcweir }
1286cdf0e10cSrcweir else if (aFormat.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("carriage-return-line-feed") ))
1287cdf0e10cSrcweir {
1288cdf0e10cSrcweir nFormat = awt::LineEndFormat::CARRIAGE_RETURN_LINE_FEED;
1289cdf0e10cSrcweir }
1290cdf0e10cSrcweir else
1291cdf0e10cSrcweir {
1292cdf0e10cSrcweir throw xml::sax::SAXException(
1293cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid line end format value!") ),
1294cdf0e10cSrcweir Reference< XInterface >(), Any() );
1295cdf0e10cSrcweir }
1296cdf0e10cSrcweir
1297cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( nFormat ) );
1298cdf0e10cSrcweir return true;
1299cdf0e10cSrcweir }
1300cdf0e10cSrcweir return false;
1301cdf0e10cSrcweir }
1302cdf0e10cSrcweir //__________________________________________________________________________________________________
importSelectionTypeProperty(OUString const & rPropName,OUString const & rAttrName,Reference<xml::input::XAttributes> const & xAttributes)1303cdf0e10cSrcweir bool ImportContext::importSelectionTypeProperty(
1304cdf0e10cSrcweir OUString const & rPropName, OUString const & rAttrName,
1305cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes )
1306cdf0e10cSrcweir {
1307cdf0e10cSrcweir OUString aSelectionType(
1308cdf0e10cSrcweir xAttributes->getValueByUidName(
1309cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
1310cdf0e10cSrcweir if (aSelectionType.getLength())
1311cdf0e10cSrcweir {
1312cdf0e10cSrcweir view::SelectionType eSelectionType;
1313cdf0e10cSrcweir
1314cdf0e10cSrcweir if (aSelectionType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") ))
1315cdf0e10cSrcweir {
1316cdf0e10cSrcweir eSelectionType = view::SelectionType_NONE;
1317cdf0e10cSrcweir }
1318cdf0e10cSrcweir else if (aSelectionType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("single") ))
1319cdf0e10cSrcweir {
1320cdf0e10cSrcweir eSelectionType = view::SelectionType_SINGLE;
1321cdf0e10cSrcweir }
1322cdf0e10cSrcweir else if (aSelectionType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("multi") ))
1323cdf0e10cSrcweir {
1324cdf0e10cSrcweir eSelectionType = view::SelectionType_MULTI;
1325cdf0e10cSrcweir }
1326cdf0e10cSrcweir else if (aSelectionType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("range") ))
1327cdf0e10cSrcweir {
1328cdf0e10cSrcweir eSelectionType = view::SelectionType_RANGE;
1329cdf0e10cSrcweir }
1330cdf0e10cSrcweir else
1331cdf0e10cSrcweir {
1332cdf0e10cSrcweir throw xml::sax::SAXException(
1333cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("invalid selection type value!") ),
1334cdf0e10cSrcweir Reference< XInterface >(), Any() );
1335cdf0e10cSrcweir }
1336cdf0e10cSrcweir
1337cdf0e10cSrcweir _xControlModel->setPropertyValue( rPropName, makeAny( eSelectionType ) );
1338cdf0e10cSrcweir return true;
1339cdf0e10cSrcweir }
1340cdf0e10cSrcweir return false;
1341cdf0e10cSrcweir }
1342cdf0e10cSrcweir
1343874957b9STsutomu Uchino //__________________________________________________________________________________________________
importImageScaleModeProperty(OUString const & rPropName,OUString const & rAttrName,Reference<xml::input::XAttributes> const & xAttributes)1344874957b9STsutomu Uchino bool ImportContext::importImageScaleModeProperty(
1345874957b9STsutomu Uchino OUString const & rPropName, OUString const & rAttrName,
1346874957b9STsutomu Uchino Reference< xml::input::XAttributes > const & xAttributes )
1347874957b9STsutomu Uchino {
1348874957b9STsutomu Uchino OUString aImageScaleMode(
1349874957b9STsutomu Uchino xAttributes->getValueByUidName(
1350874957b9STsutomu Uchino _pImport->XMLNS_DIALOGS_UID, rAttrName ) );
1351874957b9STsutomu Uchino if (!aImageScaleMode.isEmpty())
1352874957b9STsutomu Uchino {
1353874957b9STsutomu Uchino sal_Int16 nImageScaleMode;
1354874957b9STsutomu Uchino
1355874957b9STsutomu Uchino if (aImageScaleMode.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("none") ))
1356874957b9STsutomu Uchino {
1357874957b9STsutomu Uchino nImageScaleMode = awt::ImageScaleMode::NONE;
1358874957b9STsutomu Uchino }
1359874957b9STsutomu Uchino else if (aImageScaleMode.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("isotropic") ))
1360874957b9STsutomu Uchino {
1361874957b9STsutomu Uchino nImageScaleMode = awt::ImageScaleMode::ISOTROPIC;
1362874957b9STsutomu Uchino }
1363874957b9STsutomu Uchino else if (aImageScaleMode.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("anisotropic") ))
1364874957b9STsutomu Uchino {
1365874957b9STsutomu Uchino nImageScaleMode = awt::ImageScaleMode::ANISOTROPIC;
1366874957b9STsutomu Uchino }
1367874957b9STsutomu Uchino else
1368874957b9STsutomu Uchino {
1369874957b9STsutomu Uchino throw xml::sax::SAXException(
1370874957b9STsutomu Uchino OUString( RTL_CONSTASCII_USTRINGPARAM("invalid scale image mode value!") ),
1371874957b9STsutomu Uchino Reference< XInterface >(), Any() );
1372874957b9STsutomu Uchino }
1373874957b9STsutomu Uchino
1374874957b9STsutomu Uchino _xControlModel->setPropertyValue( rPropName, makeAny( nImageScaleMode ) );
1375874957b9STsutomu Uchino return true;
1376874957b9STsutomu Uchino }
1377874957b9STsutomu Uchino return false;
1378874957b9STsutomu Uchino }
1379874957b9STsutomu Uchino
1380cdf0e10cSrcweir //==================================================================================================
1381cdf0e10cSrcweir struct StringTriple
1382cdf0e10cSrcweir {
1383cdf0e10cSrcweir char const * first;
1384cdf0e10cSrcweir char const * second;
1385cdf0e10cSrcweir char const * third;
1386cdf0e10cSrcweir };
1387cdf0e10cSrcweir static StringTriple const s_aEventTranslations[] =
1388cdf0e10cSrcweir {
1389cdf0e10cSrcweir // from xmloff/source/forms/formevents.cxx
1390cdf0e10cSrcweir // 28.09.2001 tbe added on-adjustmentvaluechange
1391cdf0e10cSrcweir { "com.sun.star.form.XApproveActionListener", "approveAction", "on-approveaction" },
1392cdf0e10cSrcweir { "com.sun.star.awt.XActionListener", "actionPerformed", "on-performaction" },
1393cdf0e10cSrcweir { "com.sun.star.form.XChangeListener", "changed", "on-change" },
1394cdf0e10cSrcweir { "com.sun.star.awt.XTextListener", "textChanged", "on-textchange" },
1395cdf0e10cSrcweir { "com.sun.star.awt.XItemListener", "itemStateChanged", "on-itemstatechange" },
1396cdf0e10cSrcweir { "com.sun.star.awt.XFocusListener", "focusGained", "on-focus" },
1397cdf0e10cSrcweir { "com.sun.star.awt.XFocusListener", "focusLost", "on-blur" },
1398cdf0e10cSrcweir { "com.sun.star.awt.XKeyListener", "keyPressed", "on-keydown" },
1399cdf0e10cSrcweir { "com.sun.star.awt.XKeyListener", "keyReleased", "on-keyup" },
1400cdf0e10cSrcweir { "com.sun.star.awt.XMouseListener", "mouseEntered", "on-mouseover" },
1401cdf0e10cSrcweir { "com.sun.star.awt.XMouseMotionListener", "mouseDragged", "on-mousedrag" },
1402cdf0e10cSrcweir { "com.sun.star.awt.XMouseMotionListener", "mouseMoved", "on-mousemove" },
1403cdf0e10cSrcweir { "com.sun.star.awt.XMouseListener", "mousePressed", "on-mousedown" },
1404cdf0e10cSrcweir { "com.sun.star.awt.XMouseListener", "mouseReleased", "on-mouseup" },
1405cdf0e10cSrcweir { "com.sun.star.awt.XMouseListener", "mouseExited", "on-mouseout" },
1406cdf0e10cSrcweir { "com.sun.star.form.XResetListener", "approveReset", "on-approvereset" },
1407cdf0e10cSrcweir { "com.sun.star.form.XResetListener", "resetted", "on-reset" },
1408cdf0e10cSrcweir { "com.sun.star.form.XSubmitListener", "approveSubmit", "on-submit" },
1409cdf0e10cSrcweir { "com.sun.star.form.XUpdateListener", "approveUpdate", "on-approveupdate" },
1410cdf0e10cSrcweir { "com.sun.star.form.XUpdateListener", "updated", "on-update" },
1411cdf0e10cSrcweir { "com.sun.star.form.XLoadListener", "loaded", "on-load" },
1412cdf0e10cSrcweir { "com.sun.star.form.XLoadListener", "reloading", "on-startreload" },
1413cdf0e10cSrcweir { "com.sun.star.form.XLoadListener", "reloaded", "on-reload" },
1414cdf0e10cSrcweir { "com.sun.star.form.XLoadListener", "unloading", "on-startunload" },
1415cdf0e10cSrcweir { "com.sun.star.form.XLoadListener", "unloaded", "on-unload" },
1416cdf0e10cSrcweir { "com.sun.star.form.XConfirmDeleteListener", "confirmDelete", "on-confirmdelete" },
1417cdf0e10cSrcweir { "com.sun.star.sdb.XRowSetApproveListener", "approveRowChange", "on-approverowchange" },
1418cdf0e10cSrcweir { "com.sun.star.sdbc.XRowSetListener", "rowChanged", "on-rowchange" },
1419cdf0e10cSrcweir { "com.sun.star.sdb.XRowSetApproveListener", "approveCursorMove", "on-approvecursormove" },
1420cdf0e10cSrcweir { "com.sun.star.sdbc.XRowSetListener", "cursorMoved", "on-cursormove" },
1421cdf0e10cSrcweir { "com.sun.star.form.XDatabaseParameterListener", "approveParameter", "on-supplyparameter" },
1422cdf0e10cSrcweir { "com.sun.star.sdb.XSQLErrorListener", "errorOccured", "on-error" },
1423cdf0e10cSrcweir { "com.sun.star.awt.XAdjustmentListener", "adjustmentValueChanged", "on-adjustmentvaluechange" },
1424cdf0e10cSrcweir { 0, 0, 0 }
1425cdf0e10cSrcweir };
1426cdf0e10cSrcweir extern StringTriple const * const g_pEventTranslations;
1427cdf0e10cSrcweir StringTriple const * const g_pEventTranslations = s_aEventTranslations;
1428cdf0e10cSrcweir
1429cdf0e10cSrcweir //__________________________________________________________________________________________________
importEvents(::std::vector<Reference<xml::input::XElement>> const & rEvents)1430cdf0e10cSrcweir void ImportContext::importEvents(
1431cdf0e10cSrcweir ::std::vector< Reference< xml::input::XElement > > const & rEvents )
1432cdf0e10cSrcweir {
1433cdf0e10cSrcweir Reference< script::XScriptEventsSupplier > xSupplier(
1434cdf0e10cSrcweir _xControlModel, UNO_QUERY );
1435cdf0e10cSrcweir if (xSupplier.is())
1436cdf0e10cSrcweir {
1437cdf0e10cSrcweir Reference< container::XNameContainer > xEvents( xSupplier->getEvents() );
1438cdf0e10cSrcweir if (xEvents.is())
1439cdf0e10cSrcweir {
1440cdf0e10cSrcweir for ( size_t nPos = 0; nPos < rEvents.size(); ++nPos )
1441cdf0e10cSrcweir {
1442cdf0e10cSrcweir script::ScriptEventDescriptor descr;
1443cdf0e10cSrcweir
1444cdf0e10cSrcweir EventElement * pEventElement = static_cast< EventElement * >( rEvents[ nPos ].get() );
1445cdf0e10cSrcweir sal_Int32 nUid = pEventElement->getUid();
1446cdf0e10cSrcweir OUString aLocalName( pEventElement->getLocalName() );
1447cdf0e10cSrcweir Reference< xml::input::XAttributes > xAttributes(
1448cdf0e10cSrcweir pEventElement->getAttributes() );
1449cdf0e10cSrcweir
1450cdf0e10cSrcweir // nowadays script events
1451cdf0e10cSrcweir if (_pImport->XMLNS_SCRIPT_UID == nUid)
1452cdf0e10cSrcweir {
1453cdf0e10cSrcweir if (!getStringAttr( &descr.ScriptType,
1454cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(
1455cdf0e10cSrcweir "language") ),
1456cdf0e10cSrcweir xAttributes,
1457cdf0e10cSrcweir _pImport->XMLNS_SCRIPT_UID ) ||
1458cdf0e10cSrcweir !getStringAttr( &descr.ScriptCode,
1459cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(
1460cdf0e10cSrcweir "macro-name") ),
1461cdf0e10cSrcweir xAttributes,
1462cdf0e10cSrcweir _pImport->XMLNS_SCRIPT_UID ))
1463cdf0e10cSrcweir {
1464cdf0e10cSrcweir throw xml::sax::SAXException(
1465cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(
1466cdf0e10cSrcweir "missing language or macro-name "
1467cdf0e10cSrcweir "attribute(s) of event!") ),
1468cdf0e10cSrcweir Reference< XInterface >(), Any() );
1469cdf0e10cSrcweir }
1470cdf0e10cSrcweir if ( descr.ScriptType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( "StarBasic" ) ) ) )
1471cdf0e10cSrcweir {
1472cdf0e10cSrcweir OUString aLocation;
1473cdf0e10cSrcweir if (getStringAttr( &aLocation,
1474cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(
1475cdf0e10cSrcweir "location") ),
1476cdf0e10cSrcweir xAttributes,
1477cdf0e10cSrcweir _pImport->XMLNS_SCRIPT_UID ))
1478cdf0e10cSrcweir {
1479cdf0e10cSrcweir // prepend location
1480cdf0e10cSrcweir ::rtl::OUStringBuffer buf;
1481cdf0e10cSrcweir buf.append( aLocation );
1482cdf0e10cSrcweir buf.append( (sal_Unicode)':' );
1483cdf0e10cSrcweir buf.append( descr.ScriptCode );
1484cdf0e10cSrcweir descr.ScriptCode = buf.makeStringAndClear();
1485cdf0e10cSrcweir }
1486cdf0e10cSrcweir }
1487cdf0e10cSrcweir else if ( descr.ScriptType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( "Script" ) ) ) )
1488cdf0e10cSrcweir {
1489cdf0e10cSrcweir // Check if there is a protocol, if not assume
1490cdf0e10cSrcweir // this is an early scripting framework url ( without
1491cdf0e10cSrcweir // the protocol ) and fix it up!!
1492cdf0e10cSrcweir if ( descr.ScriptCode.indexOf( ':' ) == -1 )
1493cdf0e10cSrcweir {
1494cdf0e10cSrcweir ::rtl::OUStringBuffer buf;
1495cdf0e10cSrcweir buf.append( OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.script:" ) ) );
1496cdf0e10cSrcweir buf.append( descr.ScriptCode );
1497cdf0e10cSrcweir descr.ScriptCode = buf.makeStringAndClear();
1498cdf0e10cSrcweir }
1499cdf0e10cSrcweir }
1500cdf0e10cSrcweir
1501cdf0e10cSrcweir // script:event element
1502cdf0e10cSrcweir if (aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("event") ))
1503cdf0e10cSrcweir {
1504cdf0e10cSrcweir OUString aEventName;
1505cdf0e10cSrcweir if (! getStringAttr(
1506cdf0e10cSrcweir &aEventName,
1507cdf0e10cSrcweir OUString(
1508cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("event-name") ),
1509cdf0e10cSrcweir xAttributes,
1510cdf0e10cSrcweir _pImport->XMLNS_SCRIPT_UID ))
1511cdf0e10cSrcweir {
1512cdf0e10cSrcweir throw xml::sax::SAXException(
1513cdf0e10cSrcweir OUString(
1514cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM(
1515cdf0e10cSrcweir "missing event-name attribute!") ),
1516cdf0e10cSrcweir Reference< XInterface >(), Any() );
1517cdf0e10cSrcweir }
1518cdf0e10cSrcweir
1519cdf0e10cSrcweir // lookup in table
1520cdf0e10cSrcweir ::rtl::OString str(
1521cdf0e10cSrcweir ::rtl::OUStringToOString(
1522cdf0e10cSrcweir aEventName, RTL_TEXTENCODING_ASCII_US ) );
1523cdf0e10cSrcweir StringTriple const * p = g_pEventTranslations;
1524cdf0e10cSrcweir while (p->first)
1525cdf0e10cSrcweir {
1526cdf0e10cSrcweir if (0 == ::rtl_str_compare( p->third, str.getStr() ))
1527cdf0e10cSrcweir {
1528cdf0e10cSrcweir descr.ListenerType = OUString(
1529cdf0e10cSrcweir p->first, ::rtl_str_getLength( p->first ),
1530cdf0e10cSrcweir RTL_TEXTENCODING_ASCII_US );
1531cdf0e10cSrcweir descr.EventMethod = OUString(
1532cdf0e10cSrcweir p->second, ::rtl_str_getLength( p->second ),
1533cdf0e10cSrcweir RTL_TEXTENCODING_ASCII_US );
1534cdf0e10cSrcweir break;
1535cdf0e10cSrcweir }
1536cdf0e10cSrcweir ++p;
1537cdf0e10cSrcweir }
1538cdf0e10cSrcweir
1539cdf0e10cSrcweir if (! p->first)
1540cdf0e10cSrcweir {
1541cdf0e10cSrcweir throw xml::sax::SAXException(
1542cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("no matching event-name found!") ),
1543cdf0e10cSrcweir Reference< XInterface >(), Any() );
1544cdf0e10cSrcweir }
1545cdf0e10cSrcweir }
1546cdf0e10cSrcweir else // script:listener-event element
1547cdf0e10cSrcweir {
1548cdf0e10cSrcweir OSL_ASSERT( aLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("listener-event") ) );
1549cdf0e10cSrcweir
1550cdf0e10cSrcweir if (!getStringAttr(
1551cdf0e10cSrcweir &descr.ListenerType,
1552cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(
1553cdf0e10cSrcweir "listener-type") ),
1554cdf0e10cSrcweir xAttributes,
1555cdf0e10cSrcweir _pImport->XMLNS_SCRIPT_UID ) ||
1556cdf0e10cSrcweir !getStringAttr(
1557cdf0e10cSrcweir &descr.EventMethod,
1558cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(
1559cdf0e10cSrcweir "listener-method") ),
1560cdf0e10cSrcweir xAttributes, _pImport->XMLNS_SCRIPT_UID ))
1561cdf0e10cSrcweir {
1562cdf0e10cSrcweir throw xml::sax::SAXException(
1563cdf0e10cSrcweir OUString(
1564cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM(
1565cdf0e10cSrcweir "missing listener-type or "
1566cdf0e10cSrcweir "listener-method attribute(s)!") ),
1567cdf0e10cSrcweir Reference< XInterface >(), Any() );
1568cdf0e10cSrcweir }
1569cdf0e10cSrcweir // optional listener param
1570cdf0e10cSrcweir getStringAttr(
1571cdf0e10cSrcweir &descr.AddListenerParam,
1572cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(
1573cdf0e10cSrcweir "listener-param") ),
1574cdf0e10cSrcweir xAttributes, _pImport->XMLNS_SCRIPT_UID );
1575cdf0e10cSrcweir }
1576cdf0e10cSrcweir }
1577cdf0e10cSrcweir else // deprecated dlg:event element
1578cdf0e10cSrcweir {
1579cdf0e10cSrcweir OSL_ASSERT(
1580cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID == nUid &&
1581cdf0e10cSrcweir aLocalName.equalsAsciiL(
1582cdf0e10cSrcweir RTL_CONSTASCII_STRINGPARAM("event") ) );
1583cdf0e10cSrcweir
1584cdf0e10cSrcweir if (!getStringAttr( &descr.ListenerType,
1585cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(
1586cdf0e10cSrcweir "listener-type") ),
1587cdf0e10cSrcweir xAttributes,
1588cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID ) ||
1589cdf0e10cSrcweir !getStringAttr( &descr.EventMethod,
1590cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(
1591cdf0e10cSrcweir "event-method") ),
1592cdf0e10cSrcweir xAttributes,
1593cdf0e10cSrcweir _pImport->XMLNS_DIALOGS_UID ))
1594cdf0e10cSrcweir {
1595cdf0e10cSrcweir throw xml::sax::SAXException(
1596cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("missing listener-type or event-method attribute(s)!") ),
1597cdf0e10cSrcweir Reference< XInterface >(), Any() );
1598cdf0e10cSrcweir }
1599cdf0e10cSrcweir
1600cdf0e10cSrcweir getStringAttr(
1601cdf0e10cSrcweir &descr.ScriptType,
1602cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("script-type") ),
1603cdf0e10cSrcweir xAttributes, _pImport->XMLNS_DIALOGS_UID );
1604cdf0e10cSrcweir getStringAttr(
1605cdf0e10cSrcweir &descr.ScriptCode,
1606cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("script-code") ),
1607cdf0e10cSrcweir xAttributes, _pImport->XMLNS_DIALOGS_UID );
1608cdf0e10cSrcweir getStringAttr(
1609cdf0e10cSrcweir &descr.AddListenerParam,
1610cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("param") ),
1611cdf0e10cSrcweir xAttributes, _pImport->XMLNS_DIALOGS_UID );
1612cdf0e10cSrcweir }
1613cdf0e10cSrcweir
1614cdf0e10cSrcweir ::rtl::OUStringBuffer buf;
1615cdf0e10cSrcweir buf.append( descr.ListenerType );
1616cdf0e10cSrcweir buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("::") );
1617cdf0e10cSrcweir buf.append( descr.EventMethod );
1618cdf0e10cSrcweir xEvents->insertByName( buf.makeStringAndClear(), makeAny( descr ) );
1619cdf0e10cSrcweir }
1620cdf0e10cSrcweir }
1621cdf0e10cSrcweir }
1622cdf0e10cSrcweir }
1623cdf0e10cSrcweir //__________________________________________________________________________________________________
importDefaults(sal_Int32 nBaseX,sal_Int32 nBaseY,Reference<xml::input::XAttributes> const & xAttributes,bool supportPrintable)1624cdf0e10cSrcweir void ImportContext::importDefaults(
1625cdf0e10cSrcweir sal_Int32 nBaseX, sal_Int32 nBaseY,
1626cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes,
1627cdf0e10cSrcweir bool supportPrintable )
1628cdf0e10cSrcweir {
1629cdf0e10cSrcweir _xControlModel->setPropertyValue(
1630cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ),
1631cdf0e10cSrcweir makeAny( _aId ) );
1632cdf0e10cSrcweir
1633cdf0e10cSrcweir importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("TabIndex") ),
1634cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("tab-index") ),
1635cdf0e10cSrcweir xAttributes );
1636cdf0e10cSrcweir
1637cdf0e10cSrcweir sal_Bool bDisable = sal_False;
1638cdf0e10cSrcweir if (getBoolAttr(
1639cdf0e10cSrcweir &bDisable, OUString( RTL_CONSTASCII_USTRINGPARAM("disabled") ),
1640cdf0e10cSrcweir xAttributes, _pImport->XMLNS_DIALOGS_UID ) &&
1641cdf0e10cSrcweir bDisable)
1642cdf0e10cSrcweir {
1643cdf0e10cSrcweir _xControlModel->setPropertyValue(
1644cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("Enabled") ), makeAny( sal_False ) );
1645cdf0e10cSrcweir }
1646cdf0e10cSrcweir
1647cdf0e10cSrcweir sal_Bool bVisible = sal_True;
1648cdf0e10cSrcweir if (getBoolAttr(
1649cdf0e10cSrcweir &bVisible, OUString( RTL_CONSTASCII_USTRINGPARAM("visible") ),
1650cdf0e10cSrcweir xAttributes, _pImport->XMLNS_DIALOGS_UID ) && !bVisible)
1651cdf0e10cSrcweir {
1652cdf0e10cSrcweir try
1653cdf0e10cSrcweir {
1654cdf0e10cSrcweir
1655cdf0e10cSrcweir _xControlModel->setPropertyValue(
1656cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("EnableVisible") ), makeAny( sal_False ) );
1657cdf0e10cSrcweir }
1658cdf0e10cSrcweir catch( Exception& )
1659cdf0e10cSrcweir {
1660cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION();
1661cdf0e10cSrcweir }
1662cdf0e10cSrcweir }
1663cdf0e10cSrcweir
1664cdf0e10cSrcweir if (!importLongProperty( nBaseX,
1665cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("PositionX") ),
1666cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("left") ),
1667cdf0e10cSrcweir xAttributes ) ||
1668cdf0e10cSrcweir !importLongProperty( nBaseY,
1669cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("PositionY") ),
1670cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("top") ),
1671cdf0e10cSrcweir xAttributes ) ||
1672cdf0e10cSrcweir !importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Width") ),
1673cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("width") ),
1674cdf0e10cSrcweir xAttributes ) ||
1675cdf0e10cSrcweir !importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ),
1676cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("height") ),
1677cdf0e10cSrcweir xAttributes ))
1678cdf0e10cSrcweir {
1679cdf0e10cSrcweir throw xml::sax::SAXException(
1680cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("missing pos size attribute(s)!") ),
1681cdf0e10cSrcweir Reference< XInterface >(), Any() );
1682cdf0e10cSrcweir }
1683cdf0e10cSrcweir
1684cdf0e10cSrcweir if (supportPrintable)
1685cdf0e10cSrcweir {
1686cdf0e10cSrcweir importBooleanProperty(
1687cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("Printable") ),
1688cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("printable") ),
1689cdf0e10cSrcweir xAttributes );
1690cdf0e10cSrcweir }
1691cdf0e10cSrcweir
1692cdf0e10cSrcweir sal_Int32 nLong;
1693cdf0e10cSrcweir if (! getLongAttr(
1694cdf0e10cSrcweir &nLong,
1695cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("page") ),
1696cdf0e10cSrcweir xAttributes, _pImport->XMLNS_DIALOGS_UID ))
1697cdf0e10cSrcweir {
1698cdf0e10cSrcweir nLong = 0;
1699cdf0e10cSrcweir }
1700cdf0e10cSrcweir _xControlModel->setPropertyValue(
1701cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("Step") ),
1702cdf0e10cSrcweir makeAny( nLong ) );
1703cdf0e10cSrcweir
1704cdf0e10cSrcweir importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tag") ),
1705cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("tag") ),
1706cdf0e10cSrcweir xAttributes );
1707cdf0e10cSrcweir importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("HelpText") ),
1708cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("help-text") ),
1709cdf0e10cSrcweir xAttributes );
1710cdf0e10cSrcweir importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("HelpURL") ),
1711cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("help-url") ),
1712cdf0e10cSrcweir xAttributes );
1713cdf0e10cSrcweir }
1714cdf0e10cSrcweir
1715cdf0e10cSrcweir //##################################################################################################
1716cdf0e10cSrcweir
1717cdf0e10cSrcweir //__________________________________________________________________________________________________
getParent()1718cdf0e10cSrcweir Reference< xml::input::XElement > ElementBase::getParent()
1719cdf0e10cSrcweir throw (RuntimeException)
1720cdf0e10cSrcweir {
1721cdf0e10cSrcweir return static_cast< xml::input::XElement * >( _pParent );
1722cdf0e10cSrcweir }
1723cdf0e10cSrcweir //__________________________________________________________________________________________________
getLocalName()1724cdf0e10cSrcweir OUString ElementBase::getLocalName()
1725cdf0e10cSrcweir throw (RuntimeException)
1726cdf0e10cSrcweir {
1727cdf0e10cSrcweir return _aLocalName;
1728cdf0e10cSrcweir }
1729cdf0e10cSrcweir //__________________________________________________________________________________________________
getUid()1730cdf0e10cSrcweir sal_Int32 ElementBase::getUid()
1731cdf0e10cSrcweir throw (RuntimeException)
1732cdf0e10cSrcweir {
1733cdf0e10cSrcweir return _nUid;
1734cdf0e10cSrcweir }
1735cdf0e10cSrcweir //__________________________________________________________________________________________________
getAttributes()1736cdf0e10cSrcweir Reference< xml::input::XAttributes > ElementBase::getAttributes()
1737cdf0e10cSrcweir throw (RuntimeException)
1738cdf0e10cSrcweir {
1739cdf0e10cSrcweir return _xAttributes;
1740cdf0e10cSrcweir }
1741cdf0e10cSrcweir //__________________________________________________________________________________________________
ignorableWhitespace(OUString const &)1742cdf0e10cSrcweir void ElementBase::ignorableWhitespace(
1743cdf0e10cSrcweir OUString const & /*rWhitespaces*/ )
1744cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException)
1745cdf0e10cSrcweir {
1746cdf0e10cSrcweir // not used
1747cdf0e10cSrcweir }
1748cdf0e10cSrcweir //__________________________________________________________________________________________________
characters(OUString const &)1749cdf0e10cSrcweir void ElementBase::characters( OUString const & /*rChars*/ )
1750cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException)
1751cdf0e10cSrcweir {
1752cdf0e10cSrcweir // not used, all characters ignored
1753cdf0e10cSrcweir }
1754cdf0e10cSrcweir //__________________________________________________________________________________________________
endElement()1755cdf0e10cSrcweir void ElementBase::endElement()
1756cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException)
1757cdf0e10cSrcweir {
1758cdf0e10cSrcweir }
1759cdf0e10cSrcweir //______________________________________________________________________________
processingInstruction(OUString const &,OUString const &)1760cdf0e10cSrcweir void ElementBase::processingInstruction(
1761cdf0e10cSrcweir OUString const & /*Target*/, OUString const & /*Data*/ )
1762cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException)
1763cdf0e10cSrcweir {
1764cdf0e10cSrcweir }
1765cdf0e10cSrcweir //__________________________________________________________________________________________________
startChildElement(sal_Int32,OUString const &,Reference<xml::input::XAttributes> const &)1766cdf0e10cSrcweir Reference< xml::input::XElement > ElementBase::startChildElement(
1767cdf0e10cSrcweir sal_Int32 /*nUid*/, OUString const & /*rLocalName*/,
1768cdf0e10cSrcweir Reference< xml::input::XAttributes > const & /*xAttributes*/ )
1769cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException)
1770cdf0e10cSrcweir {
1771cdf0e10cSrcweir throw xml::sax::SAXException(
1772cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("unexpected element!") ),
1773cdf0e10cSrcweir Reference< XInterface >(), Any() );
1774cdf0e10cSrcweir }
1775cdf0e10cSrcweir
1776cdf0e10cSrcweir //__________________________________________________________________________________________________
ElementBase(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes,ElementBase * pParent,DialogImport * pImport)1777cdf0e10cSrcweir ElementBase::ElementBase(
1778cdf0e10cSrcweir sal_Int32 nUid, OUString const & rLocalName,
1779cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes,
1780cdf0e10cSrcweir ElementBase * pParent, DialogImport * pImport )
1781cdf0e10cSrcweir SAL_THROW( () )
1782cdf0e10cSrcweir : _pImport( pImport )
1783cdf0e10cSrcweir , _pParent( pParent )
1784cdf0e10cSrcweir , _nUid( nUid )
1785cdf0e10cSrcweir , _aLocalName( rLocalName )
1786cdf0e10cSrcweir , _xAttributes( xAttributes )
1787cdf0e10cSrcweir {
1788cdf0e10cSrcweir _pImport->acquire();
1789cdf0e10cSrcweir
1790cdf0e10cSrcweir if (_pParent)
1791cdf0e10cSrcweir {
1792cdf0e10cSrcweir _pParent->acquire();
1793cdf0e10cSrcweir }
1794cdf0e10cSrcweir }
1795cdf0e10cSrcweir //__________________________________________________________________________________________________
~ElementBase()1796cdf0e10cSrcweir ElementBase::~ElementBase()
1797cdf0e10cSrcweir SAL_THROW( () )
1798cdf0e10cSrcweir {
1799cdf0e10cSrcweir _pImport->release();
1800cdf0e10cSrcweir
1801cdf0e10cSrcweir if (_pParent)
1802cdf0e10cSrcweir {
1803cdf0e10cSrcweir _pParent->release();
1804cdf0e10cSrcweir }
1805cdf0e10cSrcweir
1806cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
1807cdf0e10cSrcweir ::rtl::OString aStr( ::rtl::OUStringToOString(
1808cdf0e10cSrcweir _aLocalName, RTL_TEXTENCODING_ASCII_US ) );
1809cdf0e10cSrcweir OSL_TRACE( "ElementBase::~ElementBase(): %s\n", aStr.getStr() );
1810cdf0e10cSrcweir #endif
1811cdf0e10cSrcweir }
1812cdf0e10cSrcweir
1813cdf0e10cSrcweir //##################################################################################################
1814cdf0e10cSrcweir
1815cdf0e10cSrcweir // XRoot
1816cdf0e10cSrcweir //
1817cdf0e10cSrcweir
1818cdf0e10cSrcweir //______________________________________________________________________________
startDocument(Reference<xml::input::XNamespaceMapping> const & xNamespaceMapping)1819cdf0e10cSrcweir void DialogImport::startDocument(
1820cdf0e10cSrcweir Reference< xml::input::XNamespaceMapping > const & xNamespaceMapping )
1821cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException)
1822cdf0e10cSrcweir {
1823cdf0e10cSrcweir XMLNS_DIALOGS_UID = xNamespaceMapping->getUidByUri(
1824cdf0e10cSrcweir OUSTR(XMLNS_DIALOGS_URI) );
1825cdf0e10cSrcweir XMLNS_SCRIPT_UID = xNamespaceMapping->getUidByUri(
1826cdf0e10cSrcweir OUSTR(XMLNS_SCRIPT_URI) );
1827cdf0e10cSrcweir }
1828cdf0e10cSrcweir //__________________________________________________________________________________________________
endDocument()1829cdf0e10cSrcweir void DialogImport::endDocument()
1830cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException)
1831cdf0e10cSrcweir {
1832cdf0e10cSrcweir // ignored
1833cdf0e10cSrcweir }
1834cdf0e10cSrcweir //__________________________________________________________________________________________________
processingInstruction(OUString const &,OUString const &)1835cdf0e10cSrcweir void DialogImport::processingInstruction(
1836cdf0e10cSrcweir OUString const & /*rTarget*/, OUString const & /*rData*/ )
1837cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException)
1838cdf0e10cSrcweir {
1839cdf0e10cSrcweir // ignored for now: xxx todo
1840cdf0e10cSrcweir }
1841cdf0e10cSrcweir //__________________________________________________________________________________________________
setDocumentLocator(Reference<xml::sax::XLocator> const &)1842cdf0e10cSrcweir void DialogImport::setDocumentLocator(
1843cdf0e10cSrcweir Reference< xml::sax::XLocator > const & /*xLocator*/ )
1844cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException)
1845cdf0e10cSrcweir {
1846cdf0e10cSrcweir // ignored for now: xxx todo
1847cdf0e10cSrcweir }
1848cdf0e10cSrcweir //__________________________________________________________________________________________________
startRootElement(sal_Int32 nUid,OUString const & rLocalName,Reference<xml::input::XAttributes> const & xAttributes)1849cdf0e10cSrcweir Reference< xml::input::XElement > DialogImport::startRootElement(
1850cdf0e10cSrcweir sal_Int32 nUid, OUString const & rLocalName,
1851cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes )
1852cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException)
1853cdf0e10cSrcweir {
1854cdf0e10cSrcweir if (XMLNS_DIALOGS_UID != nUid)
1855cdf0e10cSrcweir {
1856cdf0e10cSrcweir throw xml::sax::SAXException(
1857cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("illegal namespace!") ),
1858cdf0e10cSrcweir Reference< XInterface >(), Any() );
1859cdf0e10cSrcweir }
1860cdf0e10cSrcweir // window
1861cdf0e10cSrcweir else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("window") ))
1862cdf0e10cSrcweir {
1863cdf0e10cSrcweir return new WindowElement( rLocalName, xAttributes, 0, this );
1864cdf0e10cSrcweir }
1865cdf0e10cSrcweir else
1866cdf0e10cSrcweir {
1867cdf0e10cSrcweir throw xml::sax::SAXException(
1868cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(
1869cdf0e10cSrcweir "illegal root element (expected window) given: ") ) +
1870cdf0e10cSrcweir rLocalName, Reference< XInterface >(), Any() );
1871cdf0e10cSrcweir }
1872cdf0e10cSrcweir }
1873cdf0e10cSrcweir //__________________________________________________________________________________________________
~DialogImport()1874cdf0e10cSrcweir DialogImport::~DialogImport()
1875cdf0e10cSrcweir SAL_THROW( () )
1876cdf0e10cSrcweir {
1877cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
1878cdf0e10cSrcweir OSL_TRACE( "DialogImport::~DialogImport().\n" );
1879cdf0e10cSrcweir #endif
1880cdf0e10cSrcweir }
1881cdf0e10cSrcweir //__________________________________________________________________________________________________
getNumberFormatsSupplier()1882cdf0e10cSrcweir Reference< util::XNumberFormatsSupplier > const & DialogImport::getNumberFormatsSupplier()
1883cdf0e10cSrcweir {
1884cdf0e10cSrcweir if (! _xSupplier.is())
1885cdf0e10cSrcweir {
1886cdf0e10cSrcweir Reference< XComponentContext > xContext( getComponentContext() );
1887cdf0e10cSrcweir Reference< util::XNumberFormatsSupplier > xSupplier(
1888cdf0e10cSrcweir xContext->getServiceManager()->createInstanceWithContext(
1889cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM(
1890cdf0e10cSrcweir "com.sun.star.util.NumberFormatsSupplier") ),
1891cdf0e10cSrcweir xContext ), UNO_QUERY );
1892cdf0e10cSrcweir
1893cdf0e10cSrcweir ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
1894cdf0e10cSrcweir if (! _xSupplier.is())
1895cdf0e10cSrcweir {
1896cdf0e10cSrcweir _xSupplier = xSupplier;
1897cdf0e10cSrcweir }
1898cdf0e10cSrcweir }
1899cdf0e10cSrcweir return _xSupplier;
1900cdf0e10cSrcweir }
1901cdf0e10cSrcweir
1902cdf0e10cSrcweir //__________________________________________________________________________________________________
addStyle(OUString const & rStyleId,Reference<xml::input::XElement> const & xStyle)1903cdf0e10cSrcweir void DialogImport::addStyle(
1904cdf0e10cSrcweir OUString const & rStyleId,
1905cdf0e10cSrcweir Reference< xml::input::XElement > const & xStyle )
1906cdf0e10cSrcweir SAL_THROW( () )
1907cdf0e10cSrcweir {
1908cdf0e10cSrcweir _styleNames.push_back( rStyleId );
1909cdf0e10cSrcweir _styles.push_back( xStyle );
1910cdf0e10cSrcweir }
1911cdf0e10cSrcweir //__________________________________________________________________________________________________
getStyle(OUString const & rStyleId) const1912cdf0e10cSrcweir Reference< xml::input::XElement > DialogImport::getStyle(
1913cdf0e10cSrcweir OUString const & rStyleId ) const
1914cdf0e10cSrcweir SAL_THROW( () )
1915cdf0e10cSrcweir {
1916cdf0e10cSrcweir for ( size_t nPos = 0; nPos < _styleNames.size(); ++nPos )
1917cdf0e10cSrcweir {
1918cdf0e10cSrcweir if (_styleNames[ nPos ] == rStyleId)
1919cdf0e10cSrcweir {
1920cdf0e10cSrcweir return _styles[ nPos ];
1921cdf0e10cSrcweir }
1922cdf0e10cSrcweir }
1923cdf0e10cSrcweir return 0;
1924cdf0e10cSrcweir }
1925cdf0e10cSrcweir
1926cdf0e10cSrcweir //##################################################################################################
1927cdf0e10cSrcweir
1928cdf0e10cSrcweir //==================================================================================================
importDialogModel(Reference<container::XNameContainer> const & xDialogModel,Reference<XComponentContext> const & xContext)1929cdf0e10cSrcweir Reference< xml::sax::XDocumentHandler > SAL_CALL importDialogModel(
1930cdf0e10cSrcweir Reference< container::XNameContainer > const & xDialogModel,
1931cdf0e10cSrcweir Reference< XComponentContext > const & xContext )
1932cdf0e10cSrcweir SAL_THROW( (Exception) )
1933cdf0e10cSrcweir {
1934cdf0e10cSrcweir return ::xmlscript::createDocumentHandler(
1935cdf0e10cSrcweir static_cast< xml::input::XRoot * >(
1936cdf0e10cSrcweir new DialogImport( xContext, xDialogModel ) ) );
1937cdf0e10cSrcweir }
1938cdf0e10cSrcweir
1939cdf0e10cSrcweir }
1940