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

Generated by: LCOV version 1.11