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

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

Generated by: LCOV version 1.10