LCOV - code coverage report
Current view: top level - xmlscript/source/xmldlg_imexp - xmldlg_impmodels.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 258 948 27.2 %
Date: 2014-04-11 Functions: 15 61 24.6 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10