LCOV - code coverage report
Current view: top level - libreoffice/xmloff/source/forms - elementexport.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 765 0.0 %
Date: 2012-12-27 Functions: 0 53 0.0 %
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             : 
      21             : #include "elementexport.hxx"
      22             : #include "strings.hxx"
      23             : #include "xmloff/xmlnmspe.hxx"
      24             : #include "eventexport.hxx"
      25             : #include "formenums.hxx"
      26             : #include "formcellbinding.hxx"
      27             : #include "xmloff/xformsexport.hxx"
      28             : #include "property_meta_data.hxx"
      29             : 
      30             : #include <com/sun/star/text/XText.hpp>
      31             : #include <com/sun/star/lang/XServiceInfo.hpp>
      32             : #include <com/sun/star/io/XPersistObject.hpp>
      33             : #include <com/sun/star/util/Duration.hpp>
      34             : #include <com/sun/star/form/FormComponentType.hpp>
      35             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      36             : #include <com/sun/star/form/FormSubmitEncoding.hpp>
      37             : #include <com/sun/star/form/FormSubmitMethod.hpp>
      38             : #include <com/sun/star/sdb/CommandType.hpp>
      39             : #include <com/sun/star/form/NavigationBarMode.hpp>
      40             : #include <com/sun/star/form/TabulatorCycle.hpp>
      41             : #include <com/sun/star/form/FormButtonType.hpp>
      42             : #include <com/sun/star/awt/ScrollBarOrientation.hpp>
      43             : #include <com/sun/star/awt/VisualEffect.hpp>
      44             : #include <com/sun/star/form/ListSourceType.hpp>
      45             : #include <com/sun/star/awt/ImagePosition.hpp>
      46             : 
      47             : #include <sax/tools/converter.hxx>
      48             : #include <tools/wintypes.hxx>       // for check states
      49             : #include <xmloff/txtprmap.hxx>
      50             : #include <com/sun/star/form/binding/XBindableValue.hpp>
      51             : #include <com/sun/star/form/binding/XListEntrySink.hpp>
      52             : #include <tools/urlobj.hxx>
      53             : #include <xmloff/xmlexp.hxx>
      54             : #include <xmloff/nmspmap.hxx>
      55             : #include <xmloff/XMLEventExport.hxx>
      56             : #include <xmloff/xmluconv.hxx>
      57             : #include <xmloff/xmltoken.hxx>
      58             : #include <tools/time.hxx>
      59             : #include <tools/diagnose_ex.h>
      60             : #include <comphelper/extract.hxx>
      61             : #include <sal/macros.h>
      62             : 
      63             : #include <stdio.h>
      64             : #include <algorithm>
      65             : 
      66             : //.........................................................................
      67             : namespace xmloff
      68             : {
      69             : //.........................................................................
      70             : 
      71             :     #if OSL_DEBUG_LEVEL > 0
      72             :         #define RESET_BIT( bitfield, bit ) \
      73             :             bitfield = bitfield & ~bit
      74             :     #else
      75             :         #define RESET_BIT( bitfield, bit )
      76             :     #endif
      77             : 
      78             :     using namespace ::xmloff::token;
      79             :     using namespace ::com::sun::star;
      80             :     using namespace ::com::sun::star::uno;
      81             :     using namespace ::com::sun::star::sdb;
      82             :     using namespace ::com::sun::star::awt;
      83             :     using namespace ::com::sun::star::form;
      84             :     using namespace ::com::sun::star::lang;
      85             :     using namespace ::com::sun::star::lang;
      86             :     using namespace ::com::sun::star::beans;
      87             :     using namespace ::com::sun::star::container;
      88             :     using namespace ::com::sun::star::script;
      89             :     using namespace ::com::sun::star::io;
      90             :     using namespace ::com::sun::star::table;
      91             :     using namespace ::com::sun::star::text;
      92             :     using namespace ::com::sun::star::form::binding;
      93             : 
      94             :     //=====================================================================
      95             :     //= OElementExport
      96             :     //=====================================================================
      97           0 :     OElementExport::OElementExport(IFormsExportContext& _rContext, const Reference< XPropertySet >& _rxProps,
      98             :         const Sequence< ScriptEventDescriptor >& _rEvents)
      99             :         :OPropertyExport(_rContext, _rxProps)
     100             :         ,m_aEvents(_rEvents)
     101           0 :         ,m_pXMLElement(NULL)
     102             :     {
     103           0 :     }
     104             : 
     105             :     //---------------------------------------------------------------------
     106           0 :     OElementExport::~OElementExport()
     107             :     {
     108           0 :         implEndElement();
     109           0 :     }
     110             : 
     111             :     //---------------------------------------------------------------------
     112           0 :     void OElementExport::doExport()
     113             :     {
     114             :         // collect some general information about the element
     115           0 :         examine();
     116             : 
     117             :         // first add the attributes necessary for the element
     118           0 :         m_rContext.getGlobalContext().ClearAttrList();
     119             : 
     120             :         // add the attributes
     121           0 :         exportAttributes();
     122             : 
     123             :         // start the XML element
     124           0 :         implStartElement(getXMLElementName());
     125             : 
     126             :         // the sub elements (mostly control type dependent)
     127           0 :         exportSubTags();
     128             : 
     129           0 :         implEndElement();
     130           0 :     }
     131             : 
     132             :     //---------------------------------------------------------------------
     133           0 :     void OElementExport::examine()
     134             :     {
     135             :         // nothing to do here
     136           0 :     }
     137             : 
     138             :     //---------------------------------------------------------------------
     139           0 :     void OElementExport::exportAttributes()
     140             :     {
     141             :         // nothing to do here
     142           0 :     }
     143             : 
     144             :     //---------------------------------------------------------------------
     145           0 :     void OElementExport::exportSubTags()
     146             :     {
     147             :         // the properties which where not exported 'til now
     148           0 :         exportRemainingProperties();
     149             : 
     150             :         // the script:events sub tags
     151           0 :         exportEvents();
     152           0 :     }
     153             : 
     154             :     //---------------------------------------------------------------------
     155           0 :     void OElementExport::implStartElement(const sal_Char* _pName)
     156             :     {
     157           0 :         m_pXMLElement = new SvXMLElementExport(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, _pName, sal_True, sal_True);
     158           0 :     }
     159             : 
     160             :     //---------------------------------------------------------------------
     161           0 :     void OElementExport::implEndElement()
     162             :     {
     163           0 :         delete m_pXMLElement;
     164           0 :         m_pXMLElement = NULL;
     165           0 :     }
     166             : 
     167             :     //---------------------------------------------------------------------
     168           0 :     void OElementExport::exportServiceNameAttribute()
     169             :     {
     170           0 :         Reference< XPersistObject > xPersistence(m_xProps, UNO_QUERY);
     171           0 :         if (!xPersistence.is())
     172             :         {
     173             :             OSL_FAIL("OElementExport::exportServiceNameAttribute: no XPersistObject!");
     174           0 :             return;
     175             :         }
     176             : 
     177           0 :         ::rtl::OUString sServiceName = xPersistence->getServiceName();
     178             :         // we don't want to write the old service name directly: it's a name used for compatibility reasons, but
     179             :         // as we start some kind of new file format here (with this xml export), we don't care about
     180             :         // compatibility ...
     181             :         // So we translate the old persistence service name into new ones, if possible
     182             : 
     183           0 :         ::rtl::OUString sToWriteServiceName = sServiceName;
     184             : #define CHECK_N_TRANSLATE( name )   \
     185             :         else if (sServiceName.equalsAsciiL(SERVICE_PERSISTENT_COMPONENT_##name.ascii, SERVICE_PERSISTENT_COMPONENT_##name.length)) \
     186             :             sToWriteServiceName = SERVICE_##name
     187             : 
     188             :         if (sal_False)
     189             :             ;
     190           0 :         CHECK_N_TRANSLATE( FORM );
     191           0 :         CHECK_N_TRANSLATE( FORM );
     192           0 :         CHECK_N_TRANSLATE( LISTBOX );
     193           0 :         CHECK_N_TRANSLATE( COMBOBOX );
     194           0 :         CHECK_N_TRANSLATE( RADIOBUTTON );
     195           0 :         CHECK_N_TRANSLATE( GROUPBOX );
     196           0 :         CHECK_N_TRANSLATE( FIXEDTEXT );
     197           0 :         CHECK_N_TRANSLATE( COMMANDBUTTON );
     198           0 :         CHECK_N_TRANSLATE( CHECKBOX );
     199           0 :         CHECK_N_TRANSLATE( GRID );
     200           0 :         CHECK_N_TRANSLATE( IMAGEBUTTON );
     201           0 :         CHECK_N_TRANSLATE( FILECONTROL );
     202           0 :         CHECK_N_TRANSLATE( TIMEFIELD );
     203           0 :         CHECK_N_TRANSLATE( DATEFIELD );
     204           0 :         CHECK_N_TRANSLATE( NUMERICFIELD );
     205           0 :         CHECK_N_TRANSLATE( CURRENCYFIELD );
     206           0 :         CHECK_N_TRANSLATE( PATTERNFIELD );
     207           0 :         CHECK_N_TRANSLATE( HIDDENCONTROL );
     208           0 :         CHECK_N_TRANSLATE( IMAGECONTROL );
     209           0 :         CHECK_N_TRANSLATE( FORMATTEDFIELD );
     210           0 :         else if (sServiceName.equalsAsciiL(SERVICE_PERSISTENT_COMPONENT_EDIT.ascii, SERVICE_PERSISTENT_COMPONENT_EDIT.length))
     211             :         {
     212             :             // special handling for the edit field: we have two controls using this as persistence service name
     213           0 :             sToWriteServiceName = SERVICE_EDIT;
     214           0 :             Reference< XServiceInfo > xSI(m_xProps, UNO_QUERY);
     215           0 :             if (xSI.is() && xSI->supportsService(SERVICE_FORMATTEDFIELD))
     216           0 :                 sToWriteServiceName = SERVICE_FORMATTEDFIELD;
     217             :         }
     218             : #if OSL_DEBUG_LEVEL > 0
     219             :         Reference< XServiceInfo > xSI(m_xProps, UNO_QUERY);
     220             :         OSL_ENSURE(xSI.is() && xSI->supportsService(sToWriteServiceName),
     221             :             "OElementExport::exportServiceNameAttribute: wrong service name translation!");
     222             : 
     223             : #endif
     224             :         sToWriteServiceName =
     225           0 :             m_rContext.getGlobalContext().GetNamespaceMap().GetQNameByKey(
     226           0 :                 XML_NAMESPACE_OOO, sToWriteServiceName );
     227             : 
     228             :         // now write this
     229             :         AddAttribute(
     230           0 :             OAttributeMetaData::getCommonControlAttributeNamespace(CCA_SERVICE_NAME),
     231             :             OAttributeMetaData::getCommonControlAttributeName(CCA_SERVICE_NAME),
     232           0 :             sToWriteServiceName);
     233             :     }
     234             : 
     235             :     //---------------------------------------------------------------------
     236           0 :     void OElementExport::exportEvents()
     237             :     {
     238           0 :         if (!m_aEvents.getLength())
     239             :             // nothing to do
     240           0 :             return;
     241             : 
     242           0 :         Reference< XNameReplace > xWrapper = new OEventDescriptorMapper(m_aEvents);
     243           0 :         m_rContext.getGlobalContext().GetEventExport().Export(xWrapper);
     244             :     }
     245             : 
     246             :     //=====================================================================
     247             :     //= OControlExport
     248             :     //=====================================================================
     249             :     //---------------------------------------------------------------------
     250           0 :     OControlExport::OControlExport(IFormsExportContext& _rContext,  const Reference< XPropertySet >& _rxControl,
     251             :         const ::rtl::OUString& _rControlId, const ::rtl::OUString& _rReferringControls,
     252             :         const Sequence< ScriptEventDescriptor >& _rEvents)
     253             :         :OElementExport(_rContext, _rxControl, _rEvents)
     254             :         ,m_sControlId(_rControlId)
     255             :         ,m_sReferringControls(_rReferringControls)
     256             :         ,m_nClassId(FormComponentType::CONTROL)
     257             :         ,m_eType( UNKNOWN )
     258             :         ,m_nIncludeCommon(0)
     259             :         ,m_nIncludeDatabase(0)
     260             :         ,m_nIncludeSpecial(0)
     261             :         ,m_nIncludeEvents(0)
     262             :         ,m_nIncludeBindings(0)
     263           0 :         ,m_pOuterElement(NULL)
     264             :     {
     265             :         OSL_ENSURE(m_xProps.is(), "OControlExport::OControlExport: invalid arguments!");
     266           0 :     }
     267             : 
     268             :     //---------------------------------------------------------------------
     269           0 :     OControlExport::~OControlExport()
     270             :     {
     271           0 :         implEndElement();
     272           0 :     }
     273             : 
     274             :     //---------------------------------------------------------------------
     275           0 :     void OControlExport::exportOuterAttributes()
     276             :     {
     277             :         // the control id
     278           0 :         if (CCA_NAME & m_nIncludeCommon)
     279             :         {
     280             :             exportStringPropertyAttribute(
     281           0 :                 OAttributeMetaData::getCommonControlAttributeNamespace(CCA_NAME),
     282             :                 OAttributeMetaData::getCommonControlAttributeName(CCA_NAME),
     283             :                 PROPERTY_NAME
     284           0 :                 );
     285             :         #if OSL_DEBUG_LEVEL > 0
     286             :             //  reset the bit for later checking
     287             :             m_nIncludeCommon = m_nIncludeCommon & ~CCA_NAME;
     288             :         #endif
     289             :         }
     290             : 
     291             :         // the service name
     292           0 :         if (m_nIncludeCommon & CCA_SERVICE_NAME)
     293             :         {
     294           0 :             exportServiceNameAttribute();
     295             :         #if OSL_DEBUG_LEVEL > 0
     296             :             //  reset the bit for later checking
     297             :             m_nIncludeCommon = m_nIncludeCommon & ~CCA_SERVICE_NAME;
     298             :         #endif
     299             :         }
     300           0 :     }
     301             : 
     302             :     //---------------------------------------------------------------------
     303           0 :     void OControlExport::exportInnerAttributes()
     304             :     {
     305             :         // the control id
     306           0 :         if (CCA_CONTROL_ID & m_nIncludeCommon)
     307             :         {
     308             :             OSL_ENSURE(!m_sControlId.isEmpty(), "OControlExport::exportInnerAttributes: have no control id for the control!");
     309           0 :             m_rContext.getGlobalContext().AddAttributeIdLegacy(
     310           0 :                 XML_NAMESPACE_FORM, m_sControlId);
     311             :         #if OSL_DEBUG_LEVEL > 0
     312             :             //  reset the bit for later checking
     313             :             m_nIncludeCommon = m_nIncludeCommon & ~CCA_CONTROL_ID;
     314             :         #endif
     315             :         }
     316             : 
     317             :         // "new-style" properties ...
     318           0 :         exportGenericHandlerAttributes();
     319             : 
     320             :         // common control attributes
     321           0 :         exportCommonControlAttributes();
     322             : 
     323             :         // common database attributes
     324           0 :         exportDatabaseAttributes();
     325             : 
     326             :         // attributes related to external bindings
     327           0 :         exportBindingAtributes();
     328             : 
     329             :         // attributes special to the respective control type
     330           0 :         exportSpecialAttributes();
     331             : 
     332             :         // add the style references to the attributes
     333           0 :         flagStyleProperties();
     334           0 :     }
     335             : 
     336             :     //---------------------------------------------------------------------
     337           0 :     void OControlExport::exportAttributes()
     338             :     {
     339           0 :         exportOuterAttributes();
     340           0 :     }
     341             : 
     342             :     //---------------------------------------------------------------------
     343           0 :     void OControlExport::exportSubTags() throw (Exception)
     344             :     {
     345             :         // for the upcoming exportRemainingProperties:
     346             :         // if a control has the LabelControl property, this is not stored with the control itself, but instead with
     347             :         // the control which is referenced by this property. As the base class' exportRemainingProperties doesn't
     348             :         // know anything about this, we need to prevent that it tries to export this property
     349           0 :         exportedProperty(PROPERTY_CONTROLLABEL);
     350             : 
     351             :         // if it's a control supporting XText, then we need to declare all text-related properties
     352             :         // as "already exported". This prevents them from being exported as generic "form:property"-tags.
     353             :         // *If* we would export them this way, they would be completely superfluous, and sometimes even
     354             :         // disastrous, since they may, at import time, override paragraph properties which already have
     355             :         // been set before
     356           0 :         Reference< XText > xControlText( m_xProps, UNO_QUERY );
     357           0 :         if ( xControlText.is() )
     358             :         {
     359           0 :             const XMLPropertyMapEntry* pCharAttributeProperties = XMLTextPropertySetMapper::getPropertyMapForType( TEXT_PROP_MAP_TEXT );
     360           0 :             while ( pCharAttributeProperties->msApiName )
     361             :             {
     362           0 :                 exportedProperty( ::rtl::OUString::createFromAscii( pCharAttributeProperties->msApiName ) );
     363           0 :                 ++pCharAttributeProperties;
     364             :             }
     365             : 
     366           0 :             const XMLPropertyMapEntry* pParaAttributeProperties = XMLTextPropertySetMapper::getPropertyMapForType( TEXT_PROP_MAP_SHAPE_PARA );
     367           0 :             while ( pParaAttributeProperties->msApiName )
     368             :             {
     369           0 :                 exportedProperty( ::rtl::OUString::createFromAscii( pParaAttributeProperties->msApiName ) );
     370           0 :                 ++pParaAttributeProperties;
     371             :             }
     372             : 
     373             :             // the RichText property is not exported. The presence of the text:p element
     374             :             // will be used - upon reading - as indicator for the value of the RichText property
     375           0 :             exportedProperty( PROPERTY_RICH_TEXT );
     376             : 
     377             :             // strange thing: paragraphs support both a CharStrikeout and a CharCrossedOut property
     378             :             // The former is a short/enum value, the latter a boolean. The former has a real meaning
     379             :             // (the strikeout type), the latter hasn't. But, when the CharCrossedOut is exported and
     380             :             // later on imported, it overwrites anything which has previously been imported for
     381             :             // CharStrikeout.
     382             :             // #i27729#
     383           0 :             exportedProperty( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharCrossedOut" ) ) );
     384             :         }
     385             : 
     386           0 :         if ( m_eType == LISTBOX )
     387             :         {
     388             :             // will be exported in exportListSourceAsElements:
     389           0 :             if ( controlHasUserSuppliedListEntries() )
     390           0 :                 exportedProperty( PROPERTY_DEFAULT_SELECT_SEQ );
     391             : 
     392             :             // will not be exported in a generic way. Either exportListSourceAsElements cares
     393             :             // for them, or we don't need them
     394           0 :             exportedProperty( PROPERTY_STRING_ITEM_LIST );
     395           0 :             exportedProperty( PROPERTY_VALUE_SEQ );
     396           0 :             exportedProperty( PROPERTY_SELECT_SEQ );
     397           0 :             exportedProperty( PROPERTY_LISTSOURCE );
     398             :         }
     399           0 :         if ( m_eType == COMBOBOX )
     400           0 :             exportedProperty( PROPERTY_STRING_ITEM_LIST );
     401             : 
     402             :         // let the base class export the remaining properties and the events
     403           0 :         OElementExport::exportSubTags();
     404             : 
     405             :         // special sub tags for some controls
     406           0 :         switch (m_eType)
     407             :         {
     408             :             case LISTBOX:
     409             :                 // don't export the list entries if the are not provided by the user, but obtained implicitly
     410             :                 // from other sources
     411             :                 // #i26944#
     412           0 :                 if ( controlHasUserSuppliedListEntries() )
     413           0 :                     exportListSourceAsElements();
     414           0 :                 break;
     415             :             case GRID:
     416             :             {   // a grid control requires us to store all columns as sub elements
     417           0 :                 Reference< XIndexAccess > xColumnContainer(m_xProps, UNO_QUERY);
     418             :                 OSL_ENSURE(xColumnContainer.is(), "OControlExport::exportSubTags: a grid control which is no IndexAccess?!!");
     419           0 :                 if (xColumnContainer.is())
     420           0 :                     m_rContext.exportCollectionElements(xColumnContainer);
     421             :             }
     422           0 :             break;
     423             :             case COMBOBOX:
     424             :             {   // a combox box description has sub elements: the items
     425             :                 DBG_CHECK_PROPERTY( PROPERTY_STRING_ITEM_LIST, Sequence< ::rtl::OUString > );
     426             : 
     427             :                 // don't export the list entries if the are not provided by the user, but obtained implicitly
     428             :                 // from other sources
     429             :                 // #i26944#
     430           0 :                 if ( controlHasUserSuppliedListEntries() )
     431             :                 {
     432             :                     // get the item list
     433           0 :                     Sequence< ::rtl::OUString > aListItems;
     434           0 :                     m_xProps->getPropertyValue(PROPERTY_STRING_ITEM_LIST) >>= aListItems;
     435             :                     // loop through it and write the sub elements
     436           0 :                     const ::rtl::OUString* pListItems = aListItems.getConstArray();
     437           0 :                     for (sal_Int32 i=0; i<aListItems.getLength(); ++i, ++pListItems)
     438             :                     {
     439           0 :                         m_rContext.getGlobalContext().ClearAttrList();
     440             :                         AddAttribute(
     441           0 :                             OAttributeMetaData::getCommonControlAttributeNamespace(CCA_LABEL),
     442             :                             OAttributeMetaData::getCommonControlAttributeName(CCA_LABEL),
     443           0 :                             *pListItems);
     444           0 :                         SvXMLElementExport aFormElement(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, "item", sal_True, sal_True);
     445           0 :                     }
     446             :                 }
     447             :             }
     448           0 :             break;
     449             : 
     450             :             case TEXT_AREA:
     451             :             {
     452             :                 // if we act as rich text control, we need to export some text:p elements
     453           0 :                 if ( xControlText.is() )
     454             :                 {
     455           0 :                     sal_Bool bActingAsRichText = sal_False;
     456           0 :                     if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_RICH_TEXT ) )
     457             :                     {
     458           0 :                         OSL_VERIFY(m_xProps->getPropertyValue( PROPERTY_RICH_TEXT ) >>= bActingAsRichText );
     459             :                     }
     460             : 
     461           0 :                     if ( bActingAsRichText )
     462           0 :                         m_rContext.getGlobalContext().GetTextParagraphExport()->exportText( xControlText );
     463             :                 }
     464             :             }
     465           0 :             break;
     466             :             default:
     467             :                 // nothing do to
     468           0 :                 break;
     469           0 :         }
     470           0 :     }
     471             : 
     472             :     //---------------------------------------------------------------------
     473           0 :     void OControlExport::exportGenericHandlerAttributes()
     474             :     {
     475           0 :         const Sequence< Property > aProperties = m_xPropertyInfo->getProperties();
     476           0 :         for (   const Property* prop = aProperties.getConstArray();
     477           0 :                 prop != aProperties.getConstArray() + aProperties.getLength();
     478             :                 ++prop
     479             :             )
     480             :         {
     481             :             try
     482             :             {
     483             :                 // see if this property can already be handled with an IPropertyHandler (which, on the long
     484             :                 // term, should be the case for most, if not all, properties)
     485           0 :                 const PropertyDescription* propDescription = metadata::getPropertyDescription( prop->Name );
     486           0 :                 if ( propDescription == NULL )
     487           0 :                     continue;
     488             : 
     489             :                 // let the factory provide the concrete handler. Note that caching, if desired, is the task
     490             :                 // of the factory
     491           0 :                 PPropertyHandler handler = (*propDescription->factory)( propDescription->propertyId );
     492           0 :                 if ( !handler.get() )
     493             :                 {
     494             :                     SAL_WARN( "xmloff.forms", "OControlExport::exportGenericHandlerAttributes: invalid property handler provided by the factory!" );
     495           0 :                     continue;
     496             :                 }
     497             : 
     498           0 :                 ::rtl::OUString attributeValue;
     499           0 :                 if ( propDescription->propertyGroup == NO_GROUP )
     500             :                 {
     501             :                     // that's a property which has a direct mapping to an attribute
     502           0 :                     if ( !shouldExportProperty( prop->Name ) )
     503             :                         // TODO: in the future, we surely need a more sophisticated approach to this, involving the property
     504             :                         // handler, or the property description
     505             :                     {
     506           0 :                         exportedProperty( prop->Name );
     507           0 :                         continue;
     508             :                     }
     509             : 
     510           0 :                     const Any propValue = m_xProps->getPropertyValue( prop->Name );
     511           0 :                     attributeValue = handler->getAttributeValue( propValue );
     512             :                 }
     513             :                 else
     514             :                 {
     515             :                     // that's a property which is part of a group of properties, whose values, in their entity, comprise
     516             :                     // a single attribute value
     517             : 
     518             :                     // retrieve the descriptions of all other properties which add to the attribute value
     519           0 :                     PropertyDescriptionList descriptions;
     520           0 :                     metadata::getPropertyGroup( propDescription->propertyGroup, descriptions );
     521             : 
     522             :                     // retrieve the values for all those properties
     523           0 :                     PropertyValues aValues;
     524           0 :                     for (   PropertyDescriptionList::iterator desc = descriptions.begin();
     525           0 :                             desc != descriptions.end();
     526             :                             ++desc
     527             :                         )
     528             :                     {
     529             :                         // TODO: XMultiPropertySet?
     530           0 :                         const Any propValue = m_xProps->getPropertyValue( (*desc)->propertyName );
     531           0 :                         aValues[ (*desc)->propertyId ] = propValue;
     532           0 :                     }
     533             : 
     534             :                     // let the handler translate into an XML attribute value
     535           0 :                     attributeValue = handler->getAttributeValue( aValues );
     536             :                 }
     537             : 
     538             :                 AddAttribute(
     539             :                     propDescription->attribute.namespacePrefix,
     540           0 :                     token::GetXMLToken( propDescription->attribute.attributeToken ),
     541             :                     attributeValue
     542           0 :                 );
     543             : 
     544           0 :                 exportedProperty( prop->Name );
     545             :             }
     546           0 :             catch( const Exception& )
     547             :             {
     548             :                 DBG_UNHANDLED_EXCEPTION();
     549             :             }
     550           0 :         }
     551           0 :     }
     552             : 
     553             :     //---------------------------------------------------------------------
     554           0 :     void OControlExport::exportCommonControlAttributes()
     555             :     {
     556           0 :         size_t i=0;
     557             : 
     558             :         // I decided to handle all the properties here with some static arrays describing the property-attribute
     559             :         // relations. This leads to somewhat ugly code :), but the only alternative I can think of right now
     560             :         // would require maps and O(log n) searches, which seems somewhat expensive as this code is used
     561             :         // very frequently.
     562             : 
     563             :         // the extra indents for the respective blocks are to ensure that there is no copy'n'paste error, using
     564             :         // map identifiers from the wrong block
     565             : 
     566             :         // --------------------------------------------------------------------
     567             :         // some string properties
     568             :         {
     569             :             // the attribute ids of all properties which are expected to be of type string
     570             :             static sal_Int32 nStringPropertyAttributeIds[] =
     571             :             {
     572             :                 CCA_LABEL, CCA_TITLE
     573             :             };
     574             :             // the names of all properties which are expected to be of type string
     575             :             static ::rtl::OUString aStringPropertyNames[] =
     576             :             {
     577             :                 PROPERTY_LABEL, PROPERTY_TITLE
     578           0 :             };
     579             :             OSL_ENSURE( sizeof(aStringPropertyNames)/sizeof(aStringPropertyNames[0]) ==
     580             :                         sizeof(nStringPropertyAttributeIds)/sizeof(nStringPropertyAttributeIds[0]),
     581             :                         "OControlExport::exportCommonControlAttributes: somebody tampered with the maps (1)!");
     582             : 
     583           0 :             for (i=0; i<sizeof(nStringPropertyAttributeIds)/sizeof(nStringPropertyAttributeIds[0]); ++i)
     584           0 :                 if (nStringPropertyAttributeIds[i] & m_nIncludeCommon)
     585             :                 {
     586             :                     exportStringPropertyAttribute(
     587           0 :                         OAttributeMetaData::getCommonControlAttributeNamespace(nStringPropertyAttributeIds[i]),
     588             :                         OAttributeMetaData::getCommonControlAttributeName(nStringPropertyAttributeIds[i]),
     589             :                         aStringPropertyNames[i]
     590           0 :                         );
     591             :                 #if OSL_DEBUG_LEVEL > 0
     592             :                     //  reset the bit for later checking
     593             :                     m_nIncludeCommon = m_nIncludeCommon & ~nStringPropertyAttributeIds[i];
     594             :                 #endif
     595             :                 }
     596             :         }
     597             : 
     598             :         // --------------------------------------------------------------------
     599             :         // some boolean properties
     600             :         {
     601             :             static sal_Int32 nBooleanPropertyAttributeIds[] =
     602             :             {   // attribute flags
     603             :                 CCA_CURRENT_SELECTED, CCA_DISABLED, CCA_DROPDOWN, CCA_PRINTABLE, CCA_READONLY, CCA_SELECTED, CCA_TAB_STOP, CCA_ENABLEVISIBLE
     604             :             };
     605             :             static const ConstAsciiString pBooleanPropertyNames[] =
     606             :             {   // property names
     607             :                 PROPERTY_STATE, PROPERTY_ENABLED, PROPERTY_DROPDOWN, PROPERTY_PRINTABLE, PROPERTY_READONLY, PROPERTY_DEFAULT_STATE, PROPERTY_TABSTOP, PROPERTY_ENABLEVISIBLE
     608           0 :             };
     609             :             static sal_Bool nBooleanPropertyAttrFlags[] =
     610             :             {   // attribute defaults
     611             :                 BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_FALSE | BOOLATTR_INVERSE_SEMANTICS, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_VOID, BOOLATTR_DEFAULT_FALSE
     612             :             };
     613             :         #if OSL_DEBUG_LEVEL > 0
     614             :             sal_Int32 nIdCount = sizeof(nBooleanPropertyAttributeIds) / sizeof(nBooleanPropertyAttributeIds[0]);
     615             :             sal_Int32 nNameCount = sizeof(pBooleanPropertyNames) / sizeof(pBooleanPropertyNames[0]);
     616             :             sal_Int32 nFlagsCount = sizeof(nBooleanPropertyAttrFlags) / sizeof(nBooleanPropertyAttrFlags[0]);
     617             :             OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nFlagsCount),
     618             :                 "OControlExport::exportCommonControlAttributes: somebody tampered with the maps (2)!");
     619             :         #endif
     620           0 :             for (i=0; i<sizeof(nBooleanPropertyAttributeIds)/sizeof(nBooleanPropertyAttributeIds[0]); ++i)
     621           0 :                 if (nBooleanPropertyAttributeIds[i] & m_nIncludeCommon)
     622             :                 {
     623             :                     exportBooleanPropertyAttribute(
     624           0 :                         OAttributeMetaData::getCommonControlAttributeNamespace(nBooleanPropertyAttributeIds[i]),
     625             :                         OAttributeMetaData::getCommonControlAttributeName(nBooleanPropertyAttributeIds[i]),
     626             :                         pBooleanPropertyNames[i],
     627           0 :                         nBooleanPropertyAttrFlags[i]);
     628             :         #if OSL_DEBUG_LEVEL > 0
     629             :                     //  reset the bit for later checking
     630             :                     m_nIncludeCommon = m_nIncludeCommon & ~nBooleanPropertyAttributeIds[i];
     631             :         #endif
     632             :                 }
     633             :         }
     634             : 
     635             : 
     636             :         // --------------------------------------------------------------------
     637             :         // some integer properties
     638             :         {
     639             :             // now the common handling
     640             :             static sal_Int32 nIntegerPropertyAttributeIds[] =
     641             :             {   // attribute flags
     642             :                 CCA_SIZE, CCA_TAB_INDEX
     643             :             };
     644             :             static const ConstAsciiString pIntegerPropertyNames[] =
     645             :             {   // property names
     646             :                 PROPERTY_LINECOUNT, PROPERTY_TABINDEX
     647           0 :             };
     648             :             static const sal_Int16 nIntegerPropertyAttrDefaults[] =
     649             :             {   // attribute defaults
     650             :                 5, 0
     651             :             };
     652             : 
     653           0 :             if ( m_nIncludeCommon & CCA_MAX_LENGTH )
     654           0 :                 exportedProperty(PROPERTY_MAXTEXTLENGTH);
     655             : 
     656             :         #if OSL_DEBUG_LEVEL > 0
     657             :             sal_Int32 nIdCount = sizeof(nIntegerPropertyAttributeIds) / sizeof(nIntegerPropertyAttributeIds[0]);
     658             :             sal_Int32 nNameCount = sizeof(pIntegerPropertyNames) / sizeof(pIntegerPropertyNames[0]);
     659             :             sal_Int32 nDefaultCount = sizeof(nIntegerPropertyAttrDefaults) / sizeof(nIntegerPropertyAttrDefaults[0]);
     660             :             OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nDefaultCount),
     661             :                 "OControlExport::exportCommonControlAttributes: somebody tampered with the maps (3)!");
     662             :         #endif
     663           0 :             for (i=0; i<sizeof(nIntegerPropertyAttributeIds)/sizeof(nIntegerPropertyAttributeIds[0]); ++i)
     664           0 :                 if (nIntegerPropertyAttributeIds[i] & m_nIncludeCommon)
     665             :                 {
     666             :                     exportInt16PropertyAttribute(
     667           0 :                         OAttributeMetaData::getCommonControlAttributeNamespace(nIntegerPropertyAttributeIds[i]),
     668             :                         OAttributeMetaData::getCommonControlAttributeName(nIntegerPropertyAttributeIds[i]),
     669             :                         pIntegerPropertyNames[i],
     670           0 :                         nIntegerPropertyAttrDefaults[i]);
     671             :         #if OSL_DEBUG_LEVEL > 0
     672             :                     //  reset the bit for later checking
     673             :                     m_nIncludeCommon = m_nIncludeCommon & ~nIntegerPropertyAttributeIds[i];
     674             :         #endif
     675             :                 }
     676             : 
     677             : 
     678             :         }
     679             : 
     680             :         // --------------------------------------------------------------------
     681             :         // some enum properties
     682             :         {
     683           0 :             if (m_nIncludeCommon & CCA_BUTTON_TYPE)
     684             :             {
     685             :                 exportEnumPropertyAttribute(
     686           0 :                     OAttributeMetaData::getCommonControlAttributeNamespace(CCA_BUTTON_TYPE),
     687             :                     OAttributeMetaData::getCommonControlAttributeName(CCA_BUTTON_TYPE),
     688             :                     PROPERTY_BUTTONTYPE,
     689             :                     OEnumMapper::getEnumMap(OEnumMapper::epButtonType),
     690           0 :                     FormButtonType_PUSH);
     691             :         #if OSL_DEBUG_LEVEL > 0
     692             :                 //  reset the bit for later checking
     693             :                 m_nIncludeCommon = m_nIncludeCommon & ~CCA_BUTTON_TYPE;
     694             :         #endif
     695             :             }
     696           0 :             if ( m_nIncludeCommon & CCA_ORIENTATION )
     697             :             {
     698             :                 exportEnumPropertyAttribute(
     699           0 :                     OAttributeMetaData::getCommonControlAttributeNamespace( CCA_ORIENTATION ),
     700             :                     OAttributeMetaData::getCommonControlAttributeName( CCA_ORIENTATION ),
     701             :                     PROPERTY_ORIENTATION,
     702             :                     OEnumMapper::getEnumMap( OEnumMapper::epOrientation ),
     703             :                     ScrollBarOrientation::HORIZONTAL
     704           0 :                 );
     705             :         #if OSL_DEBUG_LEVEL > 0
     706             :                 //  reset the bit for later checking
     707             :                 m_nIncludeCommon = m_nIncludeCommon & ~CCA_ORIENTATION;
     708             :         #endif
     709             :             }
     710             : 
     711           0 :             if ( m_nIncludeCommon & CCA_VISUAL_EFFECT )
     712             :             {
     713             :                 exportEnumPropertyAttribute(
     714           0 :                     OAttributeMetaData::getCommonControlAttributeNamespace( CCA_VISUAL_EFFECT ),
     715             :                     OAttributeMetaData::getCommonControlAttributeName( CCA_VISUAL_EFFECT ),
     716             :                     PROPERTY_VISUAL_EFFECT,
     717             :                     OEnumMapper::getEnumMap( OEnumMapper::epVisualEffect ),
     718             :                     VisualEffect::LOOK3D
     719           0 :                 );
     720             :             #if OSL_DEBUG_LEVEL > 0
     721             :                 //  reset the bit for later checking
     722             :                 m_nIncludeCommon = m_nIncludeCommon & ~CCA_VISUAL_EFFECT;
     723             :             #endif
     724             :             }
     725             :         }
     726             : 
     727             :         // --------------------------------------------------------------------
     728             :         // some properties which require a special handling
     729             : 
     730             :         // the target frame
     731           0 :         if (m_nIncludeCommon & CCA_TARGET_FRAME)
     732             :         {
     733           0 :             exportTargetFrameAttribute();
     734             :         #if OSL_DEBUG_LEVEL > 0
     735             :             //  reset the bit for later checking
     736             :             m_nIncludeCommon = m_nIncludeCommon & ~CCA_TARGET_FRAME;
     737             :         #endif
     738             :         }
     739             : 
     740             :         // max text length
     741           0 :         if ( m_nIncludeCommon & CCA_MAX_LENGTH )
     742             :         {
     743             :             // normally, the respective property would be "MaxTextLen"
     744             :             // However, if the model has a property "PersistenceMaxTextLength", then we prefer this
     745             : 
     746             :             // determine the name of the property to export
     747           0 :             ::rtl::OUString sTextLenPropertyName( PROPERTY_MAXTEXTLENGTH );
     748           0 :             if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_PERSISTENCE_MAXTEXTLENGTH ) )
     749           0 :                 sTextLenPropertyName = PROPERTY_PERSISTENCE_MAXTEXTLENGTH;
     750             : 
     751             :             // export it
     752             :             exportInt16PropertyAttribute(
     753           0 :                 OAttributeMetaData::getCommonControlAttributeNamespace( CCA_MAX_LENGTH ),
     754             :                 OAttributeMetaData::getCommonControlAttributeName( CCA_MAX_LENGTH ),
     755             :                 sTextLenPropertyName,
     756             :                 0
     757           0 :             );
     758             : 
     759             :             // in either way, both properties count as "exported"
     760           0 :             exportedProperty( PROPERTY_MAXTEXTLENGTH );
     761           0 :             exportedProperty( PROPERTY_PERSISTENCE_MAXTEXTLENGTH );
     762             : 
     763             :         #if OSL_DEBUG_LEVEL > 0
     764             :             //  reset the bit for later checking
     765             :             m_nIncludeCommon = m_nIncludeCommon & ~CCA_MAX_LENGTH;
     766             :         #endif
     767             :         }
     768             : 
     769           0 :         if (m_nIncludeCommon & CCA_TARGET_LOCATION)
     770             :         {
     771           0 :             exportTargetLocationAttribute(false);
     772             :         #if OSL_DEBUG_LEVEL > 0
     773             :             //  reset the bit for later checking
     774             :             m_nIncludeCommon = m_nIncludeCommon & ~CCA_TARGET_LOCATION;
     775             :         #endif
     776             :         }
     777             : 
     778             :         // OJ #99721#
     779           0 :         if (m_nIncludeCommon & CCA_IMAGE_DATA)
     780             :         {
     781           0 :             exportImageDataAttribute();
     782             :         #if OSL_DEBUG_LEVEL > 0
     783             :             //  reset the bit for later checking
     784             :             m_nIncludeCommon = m_nIncludeCommon & ~CCA_IMAGE_DATA;
     785             :         #endif
     786             :         }
     787             : 
     788             :         // the for attribute
     789             :         // the target frame
     790           0 :         if (m_nIncludeCommon & CCA_FOR)
     791             :         {
     792           0 :             if (!m_sReferringControls.isEmpty())
     793             :             {   // there is at least one control referring to the one we're handling currently
     794             :                 AddAttribute(
     795           0 :                     OAttributeMetaData::getCommonControlAttributeNamespace(CCA_FOR),
     796             :                     OAttributeMetaData::getCommonControlAttributeName(CCA_FOR),
     797           0 :                     m_sReferringControls);
     798             :             }
     799             :         #if OSL_DEBUG_LEVEL > 0
     800             :             //  reset the bit for later checking
     801             :             m_nIncludeCommon = m_nIncludeCommon & ~CCA_FOR;
     802             :         #endif
     803             :         }
     804             : 
     805           0 :         if ((CCA_CURRENT_VALUE | CCA_VALUE) & m_nIncludeCommon)
     806             :         {
     807           0 :             const sal_Char* pCurrentValuePropertyName = NULL;
     808           0 :             const sal_Char* pValuePropertyName = NULL;
     809             : 
     810             :             // get the property names
     811           0 :             getValuePropertyNames(m_eType, m_nClassId, pCurrentValuePropertyName, pValuePropertyName);
     812             : 
     813           0 :             static const sal_Char* pCurrentValueAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCA_CURRENT_VALUE);
     814           0 :             static const sal_Char* pValueAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCA_VALUE);
     815           0 :             static const sal_uInt16 nCurrentValueAttributeNamespaceKey = OAttributeMetaData::getCommonControlAttributeNamespace(CCA_CURRENT_VALUE);
     816           0 :             static const sal_uInt16 nValueAttributeNamespaceKey = OAttributeMetaData::getCommonControlAttributeNamespace(CCA_VALUE);
     817             : 
     818             :             // add the atrtributes if necessary and possible
     819           0 :             if (pCurrentValuePropertyName && (CCA_CURRENT_VALUE & m_nIncludeCommon))
     820             :             {
     821             :                 // don't export the current-value if this value originates from a data binding
     822             :                 // #i26944#
     823           0 :                 if ( controlHasActiveDataBinding() )
     824           0 :                     exportedProperty( ::rtl::OUString::createFromAscii( pCurrentValuePropertyName ) );
     825             :                 else
     826             :                     exportGenericPropertyAttribute(
     827             :                         nCurrentValueAttributeNamespaceKey,
     828             :                         pCurrentValueAttributeName,
     829             :                         pCurrentValuePropertyName
     830           0 :                     );
     831             :             }
     832             : 
     833           0 :             if (pValuePropertyName && (CCA_VALUE & m_nIncludeCommon))
     834             :                 exportGenericPropertyAttribute(
     835             :                     nValueAttributeNamespaceKey,
     836             :                     pValueAttributeName,
     837           0 :                     pValuePropertyName);
     838             : 
     839             :             OSL_ENSURE((NULL == pValuePropertyName) == (0 == (CCA_VALUE & m_nIncludeCommon)),
     840             :                 "OControlExport::exportCommonControlAttributes: no property found for the value attribute!");
     841             :             OSL_ENSURE((NULL == pCurrentValuePropertyName ) == (0 == (CCA_CURRENT_VALUE & m_nIncludeCommon)),
     842             :                 "OControlExport::exportCommonControlAttributes: no property found for the current-value attribute!");
     843             : 
     844             :         #if OSL_DEBUG_LEVEL > 0
     845             :             //  reset the bit for later checking
     846             :             m_nIncludeCommon = m_nIncludeCommon & ~(CCA_CURRENT_VALUE | CCA_VALUE);
     847             :         #endif
     848             :         }
     849             : 
     850             :         OSL_ENSURE(0 == m_nIncludeCommon,
     851             :             "OControlExport::exportCommonControlAttributes: forgot some flags!");
     852             :             // in the dbg_util version, we should have removed every bit we handled from the mask, so it should
     853             :             // be 0 now ...
     854           0 :     }
     855             : 
     856             :     //---------------------------------------------------------------------
     857           0 :     void OControlExport::exportDatabaseAttributes()
     858             :     {
     859             : #if OSL_DEBUG_LEVEL > 0
     860             :         sal_Int32 nIncludeDatabase = m_nIncludeDatabase;
     861             : #endif
     862             :         // the only string property: DataField
     863           0 :         if (DA_DATA_FIELD & m_nIncludeDatabase)
     864             :         {
     865             :             exportStringPropertyAttribute(
     866           0 :                 OAttributeMetaData::getDatabaseAttributeNamespace(DA_DATA_FIELD),
     867             :                 OAttributeMetaData::getDatabaseAttributeName(DA_DATA_FIELD),
     868           0 :                 PROPERTY_DATAFIELD);
     869             :             RESET_BIT( nIncludeDatabase, DA_DATA_FIELD );
     870             :         }
     871             : 
     872             :         // InputRequired
     873           0 :         if ( DA_INPUT_REQUIRED & m_nIncludeDatabase )
     874             :         {
     875             :             exportBooleanPropertyAttribute(
     876           0 :                 OAttributeMetaData::getDatabaseAttributeNamespace( DA_INPUT_REQUIRED ),
     877             :                 OAttributeMetaData::getDatabaseAttributeName( DA_INPUT_REQUIRED ),
     878             :                 PROPERTY_INPUT_REQUIRED,
     879             :                 BOOLATTR_DEFAULT_TRUE
     880           0 :             );
     881             :             RESET_BIT( nIncludeDatabase, DA_INPUT_REQUIRED );
     882             :         }
     883             : 
     884             :         // the only int16 property: BoundColumn
     885           0 :         if (DA_BOUND_COLUMN & m_nIncludeDatabase)
     886             :         {
     887             :             exportInt16PropertyAttribute(
     888           0 :                 OAttributeMetaData::getDatabaseAttributeNamespace(DA_BOUND_COLUMN),
     889             :                 OAttributeMetaData::getDatabaseAttributeName(DA_BOUND_COLUMN),
     890             :                 PROPERTY_BOUNDCOLUMN,
     891           0 :                 0);
     892             :             RESET_BIT( nIncludeDatabase, DA_BOUND_COLUMN );
     893             :         }
     894             : 
     895             :         // ConvertEmptyToNull
     896           0 :         if (DA_CONVERT_EMPTY & m_nIncludeDatabase)
     897             :         {
     898             :             exportBooleanPropertyAttribute(
     899           0 :                 OAttributeMetaData::getDatabaseAttributeNamespace(DA_CONVERT_EMPTY),
     900             :                 OAttributeMetaData::getDatabaseAttributeName(DA_CONVERT_EMPTY),
     901             :                 PROPERTY_EMPTY_IS_NULL,
     902             :                 BOOLATTR_DEFAULT_FALSE
     903           0 :                 );
     904             :             RESET_BIT( nIncludeDatabase, DA_CONVERT_EMPTY );
     905             :         }
     906             : 
     907             :         // the only enum property: ListSourceType
     908           0 :         if (DA_LIST_SOURCE_TYPE & m_nIncludeDatabase)
     909             :         {
     910             :             exportEnumPropertyAttribute(
     911           0 :                 OAttributeMetaData::getDatabaseAttributeNamespace(DA_LIST_SOURCE_TYPE),
     912             :                 OAttributeMetaData::getDatabaseAttributeName(DA_LIST_SOURCE_TYPE),
     913             :                 PROPERTY_LISTSOURCETYPE,
     914             :                 OEnumMapper::getEnumMap(OEnumMapper::epListSourceType),
     915             :                 ListSourceType_VALUELIST
     916           0 :                 );
     917             :             RESET_BIT( nIncludeDatabase, DA_LIST_SOURCE_TYPE );
     918             :         }
     919             : 
     920           0 :         if (m_nIncludeDatabase & DA_LIST_SOURCE)
     921             :         {
     922           0 :             exportListSourceAsAttribute();
     923             :             RESET_BIT( nIncludeDatabase, DA_LIST_SOURCE );
     924             :         }
     925             : 
     926             : #if OSL_DEBUG_LEVEL > 0
     927             :         OSL_ENSURE(0 == nIncludeDatabase,
     928             :             "OControlExport::exportDatabaseAttributes: forgot some flags!");
     929             :             // in the dbg_util version, we should have removed every bit we handled from the mask, so it should
     930             :             // be 0 now ...
     931             : #endif
     932           0 :     }
     933             : 
     934             :     //---------------------------------------------------------------------
     935           0 :     void OControlExport::exportBindingAtributes()
     936             :     {
     937             : #if OSL_DEBUG_LEVEL > 0
     938             :         sal_Int32 nIncludeBinding = m_nIncludeBindings;
     939             : #endif
     940             : 
     941             :         // ....................................................
     942           0 :         if ( m_nIncludeBindings & BA_LINKED_CELL )
     943             :         {
     944           0 :             exportCellBindingAttributes( ( m_nIncludeBindings & BA_LIST_LINKING_TYPE ) != 0 );
     945             :         #if OSL_DEBUG_LEVEL > 0
     946             :             //  reset the bit for later checking
     947             :             nIncludeBinding = nIncludeBinding & ~( BA_LINKED_CELL | BA_LIST_LINKING_TYPE );
     948             :         #endif
     949             :         }
     950             : 
     951             :         // ....................................................
     952           0 :         if ( m_nIncludeBindings & BA_LIST_CELL_RANGE )
     953             :         {
     954           0 :             exportCellListSourceRange();
     955             :         #if OSL_DEBUG_LEVEL > 0
     956             :             //  reset the bit for later checking
     957             :             nIncludeBinding = nIncludeBinding & ~BA_LIST_CELL_RANGE;
     958             :         #endif
     959             :         }
     960             : 
     961           0 :         if ( m_nIncludeBindings & BA_XFORMS_BIND )
     962             :         {
     963           0 :             exportXFormsBindAttributes();
     964             :         #if OSL_DEBUG_LEVEL > 0
     965             :             //  reset the bit for later checking
     966             :             nIncludeBinding = nIncludeBinding & ~BA_XFORMS_BIND;
     967             :         #endif
     968             :         }
     969             : 
     970           0 :         if ( m_nIncludeBindings & BA_XFORMS_LISTBIND )
     971             :         {
     972           0 :             exportXFormsListAttributes();
     973             :         #if OSL_DEBUG_LEVEL > 0
     974             :             //  reset the bit for later checking
     975             :             nIncludeBinding = nIncludeBinding & ~BA_XFORMS_LISTBIND;
     976             :         #endif
     977             :         }
     978             : 
     979           0 :         if ( m_nIncludeBindings & BA_XFORMS_SUBMISSION )
     980             :         {
     981           0 :             exportXFormsSubmissionAttributes();
     982             :         #if OSL_DEBUG_LEVEL > 0
     983             :             //  reset the bit for later checking
     984             :             nIncludeBinding = nIncludeBinding & ~BA_XFORMS_SUBMISSION;
     985             :         #endif
     986             :         }
     987             : 
     988             :         OSL_ENSURE( 0 == nIncludeBinding,
     989             :             "OControlExport::exportBindingAtributes: forgot some flags!");
     990             :             // in the debug version, we should have removed every bit we handled from the mask, so it should
     991             :             // be 0 now ...
     992           0 :     }
     993             : 
     994             :     //---------------------------------------------------------------------
     995           0 :     void OControlExport::exportSpecialAttributes()
     996             :     {
     997           0 :         sal_Int32 i=0;
     998             : 
     999             :         // ----------------------
    1000             :         // the boolean properties
    1001             :         {
    1002             :             static const sal_Int32 nBooleanPropertyAttributeIds[] =
    1003             :             {   // attribute flags
    1004             :                 SCA_VALIDATION, SCA_MULTI_LINE, SCA_AUTOMATIC_COMPLETION, SCA_MULTIPLE, SCA_DEFAULT_BUTTON, SCA_IS_TRISTATE,
    1005             :                 SCA_TOGGLE, SCA_FOCUS_ON_CLICK
    1006             :             };
    1007             :             static const ConstAsciiString pBooleanPropertyNames[] =
    1008             :             {   // property names
    1009             :                 PROPERTY_STRICTFORMAT, PROPERTY_MULTILINE, PROPERTY_AUTOCOMPLETE, PROPERTY_MULTISELECTION, PROPERTY_DEFAULTBUTTON, PROPERTY_TRISTATE,
    1010             :                 PROPERTY_TOGGLE, PROPERTY_FOCUS_ON_CLICK
    1011           0 :             };
    1012           0 :             sal_Int32 nIdCount = sizeof(nBooleanPropertyAttributeIds) / sizeof(nBooleanPropertyAttributeIds[0]);
    1013             :         #if OSL_DEBUG_LEVEL > 0
    1014             :             sal_Int32 nNameCount = sizeof(pBooleanPropertyNames) / sizeof(pBooleanPropertyNames[0]);
    1015             :             OSL_ENSURE((nIdCount == nNameCount),
    1016             :                 "OControlExport::exportSpecialAttributes: somebody tampered with the maps (1)!");
    1017             :         #endif
    1018           0 :             const sal_Int32* pAttributeId = nBooleanPropertyAttributeIds;
    1019           0 :             for ( i = 0; i < nIdCount; ++i, ++pAttributeId )
    1020             :             {
    1021           0 :                 if ( *pAttributeId & m_nIncludeSpecial)
    1022             :                 {
    1023             :                     exportBooleanPropertyAttribute(
    1024           0 :                         OAttributeMetaData::getSpecialAttributeNamespace( *pAttributeId ),
    1025             :                         OAttributeMetaData::getSpecialAttributeName( *pAttributeId ),
    1026             :                         pBooleanPropertyNames[i],
    1027             :                         ( *pAttributeId == SCA_FOCUS_ON_CLICK ) ? BOOLATTR_DEFAULT_TRUE : BOOLATTR_DEFAULT_FALSE
    1028           0 :                     );
    1029             :             #if OSL_DEBUG_LEVEL > 0
    1030             :                 //  reset the bit for later checking
    1031             :                 m_nIncludeSpecial = m_nIncludeSpecial & ~*pAttributeId;
    1032             :             #endif
    1033             :                 }
    1034             :             }
    1035             :         }
    1036             : 
    1037             :         // ----------------------
    1038             :         // the integer properties
    1039             :         {
    1040             :             static sal_Int32 nIntegerPropertyAttributeIds[] =
    1041             :             {   // attribute flags
    1042             :                 SCA_PAGE_STEP_SIZE
    1043             :             };
    1044             :             static const ConstAsciiString pIntegerPropertyNames[] =
    1045             :             {   // property names
    1046             :                 PROPERTY_BLOCK_INCREMENT
    1047           0 :             };
    1048             :             static const sal_Int32 nIntegerPropertyAttrDefaults[] =
    1049             :             {   // attribute defaults (XML defaults, not runtime defaults!)
    1050             :                 10
    1051             :             };
    1052             : 
    1053           0 :             sal_Int32 nIdCount = sizeof( nIntegerPropertyAttributeIds ) / sizeof( nIntegerPropertyAttributeIds[0] );
    1054             :         #if OSL_DEBUG_LEVEL > 0
    1055             :             sal_Int32 nNameCount = sizeof( pIntegerPropertyNames ) / sizeof( pIntegerPropertyNames[0] );
    1056             :             OSL_ENSURE( ( nIdCount == nNameCount ),
    1057             :                 "OControlExport::exportSpecialAttributes: somebody tampered with the maps (2)!" );
    1058             :             sal_Int32 nDefaultCount = sizeof( nIntegerPropertyAttrDefaults ) / sizeof( nIntegerPropertyAttrDefaults[0] );
    1059             :             OSL_ENSURE( ( nIdCount == nDefaultCount ),
    1060             :                 "OControlExport::exportSpecialAttributes: somebody tampered with the maps (3)!" );
    1061             :         #endif
    1062           0 :             for ( i = 0; i < nIdCount; ++i )
    1063           0 :                 if ( nIntegerPropertyAttributeIds[i] & m_nIncludeSpecial )
    1064             :                 {
    1065             :                     exportInt32PropertyAttribute(
    1066           0 :                         OAttributeMetaData::getSpecialAttributeNamespace( nIntegerPropertyAttributeIds[i] ),
    1067             :                         OAttributeMetaData::getSpecialAttributeName( nIntegerPropertyAttributeIds[i] ),
    1068             :                         pIntegerPropertyNames[i],
    1069           0 :                         nIntegerPropertyAttrDefaults[i]
    1070           0 :                     );
    1071             :             #if OSL_DEBUG_LEVEL > 0
    1072             :                 //  reset the bit for later checking
    1073             :                 m_nIncludeSpecial = m_nIncludeSpecial & ~nIntegerPropertyAttributeIds[i];
    1074             :             #endif
    1075             :                 }
    1076             : 
    1077           0 :             if ( SCA_STEP_SIZE & m_nIncludeSpecial )
    1078             :             {
    1079           0 :                 ::rtl::OUString sPropertyName;
    1080           0 :                 if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_LINE_INCREMENT ) )
    1081           0 :                     sPropertyName = PROPERTY_LINE_INCREMENT;
    1082           0 :                 else if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_SPIN_INCREMENT ) )
    1083           0 :                     sPropertyName = PROPERTY_SPIN_INCREMENT;
    1084             :                 else
    1085             :                     OSL_FAIL( "OControlExport::exportSpecialAttributes: not property which can be mapped to step-size attribute!" );
    1086             : 
    1087           0 :                 if ( !sPropertyName.isEmpty() )
    1088             :                     exportInt32PropertyAttribute(
    1089           0 :                         OAttributeMetaData::getSpecialAttributeNamespace( SCA_STEP_SIZE ),
    1090             :                         OAttributeMetaData::getSpecialAttributeName( SCA_STEP_SIZE ),
    1091             :                         sPropertyName,
    1092             :                         1
    1093           0 :                     );
    1094             : 
    1095             :             #if OSL_DEBUG_LEVEL > 0
    1096             :                 //  reset the bit for later checking
    1097             :                 m_nIncludeSpecial = m_nIncludeSpecial & ~SCA_STEP_SIZE;
    1098             :             #endif
    1099             :             }
    1100             : 
    1101             :         }
    1102             : 
    1103             :         // -------------------
    1104             :         // the enum properties
    1105             :         {
    1106           0 :             if (SCA_STATE & m_nIncludeSpecial)
    1107             :             {
    1108             :                 exportEnumPropertyAttribute(
    1109           0 :                     OAttributeMetaData::getSpecialAttributeNamespace(SCA_STATE),
    1110             :                     OAttributeMetaData::getSpecialAttributeName(SCA_STATE),
    1111             :                     PROPERTY_DEFAULT_STATE,
    1112             :                     OEnumMapper::getEnumMap(OEnumMapper::epCheckState),
    1113           0 :                     STATE_NOCHECK);
    1114             :             #if OSL_DEBUG_LEVEL > 0
    1115             :                 //  reset the bit for later checking
    1116             :                 m_nIncludeSpecial = m_nIncludeSpecial & ~SCA_STATE;
    1117             :             #endif
    1118             :             }
    1119             : 
    1120           0 :             if (SCA_CURRENT_STATE & m_nIncludeSpecial)
    1121             :             {
    1122             :                 exportEnumPropertyAttribute(
    1123           0 :                     OAttributeMetaData::getSpecialAttributeNamespace(SCA_CURRENT_STATE),
    1124             :                     OAttributeMetaData::getSpecialAttributeName(SCA_CURRENT_STATE),
    1125             :                     PROPERTY_STATE,
    1126             :                     OEnumMapper::getEnumMap(OEnumMapper::epCheckState),
    1127           0 :                     STATE_NOCHECK);
    1128             :             #if OSL_DEBUG_LEVEL > 0
    1129             :                 //  reset the bit for later checking
    1130             :                 m_nIncludeSpecial = m_nIncludeSpecial & ~SCA_CURRENT_STATE;
    1131             :             #endif
    1132             :             }
    1133             :         }
    1134             : 
    1135             :         // --------------------------------------------------------------------
    1136             :         // some properties which require a special handling
    1137             :         // the repeat delay
    1138             :         {
    1139           0 :             if ( m_nIncludeSpecial & SCA_REPEAT_DELAY )
    1140             :             {
    1141             :                 DBG_CHECK_PROPERTY( PROPERTY_REPEAT_DELAY, sal_Int32 );
    1142             : 
    1143           0 :                 sal_Int32 nRepeatDelay = 0;
    1144           0 :                 m_xProps->getPropertyValue( PROPERTY_REPEAT_DELAY ) >>= nRepeatDelay;
    1145           0 :                 Time aTime( Time::SYSTEM );
    1146           0 :                 aTime.MakeTimeFromMS( nRepeatDelay );
    1147           0 :                 util::Duration aDuration;
    1148           0 :                 aDuration.Hours   = aTime.GetHour();
    1149           0 :                 aDuration.Minutes = aTime.GetMin();
    1150           0 :                 aDuration.Seconds = aTime.GetSec();
    1151           0 :                 aDuration.MilliSeconds = nRepeatDelay % 1000;
    1152             : 
    1153           0 :                 ::rtl::OUStringBuffer buf;
    1154           0 :                 ::sax::Converter::convertDuration(buf, aDuration);
    1155           0 :                 AddAttribute(OAttributeMetaData::getSpecialAttributeNamespace( SCA_REPEAT_DELAY )
    1156             :                             ,OAttributeMetaData::getSpecialAttributeName( SCA_REPEAT_DELAY )
    1157           0 :                             ,buf.makeStringAndClear());
    1158             : 
    1159           0 :                 exportedProperty( PROPERTY_REPEAT_DELAY );
    1160             : 
    1161             :             #if OSL_DEBUG_LEVEL > 0
    1162             :                 //  reset the bit for later checking
    1163             :                 m_nIncludeSpecial = m_nIncludeSpecial & ~SCA_REPEAT_DELAY;
    1164             :             #endif
    1165             :             }
    1166             :         }
    1167             : 
    1168             :         // ----------------------------------
    1169             :         // the EchoChar property needs special handling, cause it's a Int16, but must be stored as one-character-string
    1170             :         {
    1171           0 :             if (SCA_ECHO_CHAR & m_nIncludeSpecial)
    1172             :             {
    1173             :                 DBG_CHECK_PROPERTY( PROPERTY_ECHO_CHAR, sal_Int16 );
    1174           0 :                 sal_Int16 nValue(0);
    1175           0 :                 m_xProps->getPropertyValue(PROPERTY_ECHO_CHAR) >>= nValue;
    1176           0 :                 if (nValue)
    1177             :                 {
    1178           0 :                     ::rtl::OUString sCharacter(reinterpret_cast<const sal_Unicode*>(&nValue), 1);
    1179             :                     AddAttribute(
    1180           0 :                         OAttributeMetaData::getSpecialAttributeNamespace(SCA_ECHO_CHAR),
    1181             :                         OAttributeMetaData::getSpecialAttributeName(SCA_ECHO_CHAR),
    1182           0 :                         sCharacter);
    1183             :                 }
    1184           0 :                 exportedProperty(PROPERTY_ECHO_CHAR);
    1185             :             #if OSL_DEBUG_LEVEL > 0
    1186             :                 //  reset the bit for later checking
    1187             :                 m_nIncludeSpecial = m_nIncludeSpecial & ~SCA_ECHO_CHAR;
    1188             :             #endif
    1189             :             }
    1190             :         }
    1191             : 
    1192             :         // ----------------------------------
    1193             :         // the string properties
    1194             :         {
    1195             :             static sal_Int32 nStringPropertyAttributeIds[] =
    1196             :             {   // attribute flags
    1197             :                 SCA_GROUP_NAME
    1198             :             };
    1199             :             static const ConstAsciiString pStringPropertyNames[] =
    1200             :             {   // property names
    1201             :                 PROPERTY_GROUP_NAME
    1202           0 :             };
    1203             : 
    1204           0 :             sal_Int32 nIdCount = sizeof( nStringPropertyAttributeIds ) / sizeof( nStringPropertyAttributeIds[0] );
    1205             :         #if OSL_DEBUG_LEVEL > 0
    1206             :             sal_Int32 nNameCount = sizeof( pStringPropertyNames ) / sizeof( pStringPropertyNames[0] );
    1207             :             OSL_ENSURE( ( nIdCount == nNameCount ),
    1208             :                 "OControlExport::exportSpecialAttributes: somebody tampered with the maps (2)!" );
    1209             :         #endif
    1210           0 :             for ( i = 0; i < nIdCount; ++i )
    1211           0 :                 if ( nStringPropertyAttributeIds[i] & m_nIncludeSpecial )
    1212             :                 {
    1213             :                     exportStringPropertyAttribute(
    1214           0 :                         OAttributeMetaData::getSpecialAttributeNamespace( nStringPropertyAttributeIds[i] ),
    1215             :                         OAttributeMetaData::getSpecialAttributeName( nStringPropertyAttributeIds[i] ),
    1216             :                         pStringPropertyNames[i]
    1217           0 :                     );
    1218             :             #if OSL_DEBUG_LEVEL > 0
    1219             :                 //  reset the bit for later checking
    1220             :                 m_nIncludeSpecial = m_nIncludeSpecial & ~nStringPropertyAttributeIds[i];
    1221             :             #endif
    1222             :                 }
    1223             :         }
    1224             : 
    1225             :         // ----------------------------------
    1226           0 :         if ((SCA_MIN_VALUE | SCA_MAX_VALUE) & m_nIncludeSpecial)
    1227             :         {
    1228             :             // need to export the min value and the max value as attributes
    1229             :             // It depends on the real type (FormComponentType) of the control, which properties hold these
    1230             :             // values
    1231           0 :             const sal_Char* pMinValuePropertyName = NULL;
    1232           0 :             const sal_Char* pMaxValuePropertyName = NULL;
    1233           0 :             getValueLimitPropertyNames(m_nClassId, pMinValuePropertyName, pMaxValuePropertyName);
    1234             : 
    1235             :             OSL_ENSURE((NULL == pMinValuePropertyName) == (0 == (SCA_MIN_VALUE & m_nIncludeSpecial)),
    1236             :                 "OControlExport::exportCommonControlAttributes: no property found for the min value attribute!");
    1237             :             OSL_ENSURE((NULL == pMaxValuePropertyName) == (0 == (SCA_MAX_VALUE & m_nIncludeSpecial)),
    1238             :                 "OControlExport::exportCommonControlAttributes: no property found for the max value attribute!");
    1239             : 
    1240             :             // add the two attributes
    1241           0 :             static const sal_Char* pMinValueAttributeName = OAttributeMetaData::getSpecialAttributeName(SCA_MIN_VALUE);
    1242           0 :             static const sal_Char* pMaxValueAttributeName = OAttributeMetaData::getSpecialAttributeName(SCA_MAX_VALUE);
    1243           0 :             static const sal_uInt16 nMinValueNamespaceKey = OAttributeMetaData::getSpecialAttributeNamespace(SCA_MIN_VALUE);
    1244           0 :             static const sal_uInt16 nMaxValueNamespaceKey = OAttributeMetaData::getSpecialAttributeNamespace(SCA_MAX_VALUE);
    1245             : 
    1246           0 :             if (pMinValuePropertyName && (SCA_MIN_VALUE & m_nIncludeSpecial))
    1247             :                 exportGenericPropertyAttribute(
    1248             :                     nMinValueNamespaceKey,
    1249             :                     pMinValueAttributeName,
    1250           0 :                     pMinValuePropertyName);
    1251             : 
    1252           0 :             if (pMaxValuePropertyName && (SCA_MAX_VALUE & m_nIncludeSpecial))
    1253             :                 exportGenericPropertyAttribute(
    1254             :                     nMaxValueNamespaceKey,
    1255             :                     pMaxValueAttributeName,
    1256           0 :                     pMaxValuePropertyName);
    1257             :         #if OSL_DEBUG_LEVEL > 0
    1258             :             //  reset the bit for later checking
    1259             :             m_nIncludeSpecial = m_nIncludeSpecial & ~(SCA_MIN_VALUE | SCA_MAX_VALUE);
    1260             :         #endif
    1261             :         }
    1262             : 
    1263             :         // ----------------------------------
    1264           0 :         if ( SCA_IMAGE_POSITION & m_nIncludeSpecial )
    1265             :         {
    1266           0 :             exportImagePositionAttributes();
    1267             :             RESET_BIT( m_nIncludeSpecial, SCA_IMAGE_POSITION );
    1268             :         }
    1269             : 
    1270             :         OSL_ENSURE(0 == m_nIncludeSpecial,
    1271             :             "OControlExport::exportSpecialAttributes: forgot some flags!");
    1272             :             // in the dbg_util version, we should have removed every bit we handled from the mask, so it should
    1273             :             // be 0 now ...
    1274           0 :     }
    1275             : 
    1276             :     //---------------------------------------------------------------------
    1277           0 :     ::rtl::OUString OControlExport::getScalarListSourceValue() const
    1278             :     {
    1279           0 :         ::rtl::OUString sListSource;
    1280           0 :         Any aListSource = m_xProps->getPropertyValue( PROPERTY_LISTSOURCE );
    1281           0 :         if ( !( aListSource >>= sListSource ) )
    1282             :         {
    1283           0 :             Sequence< ::rtl::OUString > aListSourceSequence;
    1284           0 :             aListSource >>= aListSourceSequence;
    1285           0 :             if ( aListSourceSequence.getLength() )
    1286           0 :                 sListSource = aListSourceSequence[ 0 ];
    1287             :         }
    1288           0 :         return sListSource;
    1289             :     }
    1290             : 
    1291             :     //---------------------------------------------------------------------
    1292           0 :     void OControlExport::exportListSourceAsAttribute()
    1293             :     {
    1294             :         // DA_LIST_SOURCE needs some special handling
    1295             :         DBG_CHECK_PROPERTY_NO_TYPE( PROPERTY_LISTSOURCE );
    1296             : 
    1297           0 :         ::rtl::OUString sListSource = getScalarListSourceValue();
    1298           0 :         if ( !sListSource.isEmpty() )
    1299             :         {   // the ListSource property needs to be exported as attribute, and it is not empty
    1300             :             AddAttribute(
    1301           0 :                 OAttributeMetaData::getDatabaseAttributeNamespace(DA_LIST_SOURCE),
    1302             :                 OAttributeMetaData::getDatabaseAttributeName(DA_LIST_SOURCE),
    1303           0 :                 sListSource);
    1304             :         }
    1305             : 
    1306           0 :         exportedProperty( PROPERTY_LISTSOURCE );
    1307           0 :     }
    1308             : 
    1309             :     //---------------------------------------------------------------------
    1310           0 :     void OControlExport::getSequenceInt16PropertyAsSet(const ::rtl::OUString& _rPropertyName, Int16Set& _rOut)
    1311             :     {
    1312           0 :         Sequence< sal_Int16 > aValueSequence;
    1313             :         DBG_CHECK_PROPERTY(_rPropertyName, Sequence< sal_Int16 >);
    1314           0 :         m_xProps->getPropertyValue(_rPropertyName) >>= aValueSequence;
    1315             : 
    1316           0 :         const sal_Int16* pValues = aValueSequence.getConstArray();
    1317           0 :         for (sal_Int32 i=0; i<aValueSequence.getLength(); ++i, ++pValues)
    1318           0 :             _rOut.insert(*pValues);
    1319           0 :     }
    1320             : 
    1321             :     //---------------------------------------------------------------------
    1322           0 :     void OControlExport::exportListSourceAsElements()
    1323             :     {
    1324             :         // the string lists
    1325           0 :         Sequence< ::rtl::OUString > aItems, aValues;
    1326             :         DBG_CHECK_PROPERTY( PROPERTY_STRING_ITEM_LIST, Sequence< ::rtl::OUString > );
    1327           0 :         m_xProps->getPropertyValue(PROPERTY_STRING_ITEM_LIST) >>= aItems;
    1328             : 
    1329             :         DBG_CHECK_PROPERTY( PROPERTY_LISTSOURCE, Sequence< ::rtl::OUString > );
    1330           0 :         if ( 0 == ( m_nIncludeDatabase & DA_LIST_SOURCE ) )
    1331           0 :             m_xProps->getPropertyValue(PROPERTY_LISTSOURCE) >>= aValues;
    1332             :         // if we exported the list source as attribute, we do not repeat it as sub elements
    1333             : 
    1334             :         // the selection lists
    1335           0 :         Int16Set aSelection, aDefaultSelection;
    1336           0 :         getSequenceInt16PropertyAsSet(PROPERTY_SELECT_SEQ, aSelection);
    1337           0 :         getSequenceInt16PropertyAsSet(PROPERTY_DEFAULT_SELECT_SEQ, aDefaultSelection);
    1338             : 
    1339             :         // the string for "true"
    1340           0 :         ::rtl::OUString sTrue;
    1341           0 :         ::rtl::OUStringBuffer sBuffer;
    1342           0 :         ::sax::Converter::convertBool(sBuffer, true);
    1343           0 :         sTrue = sBuffer.makeStringAndClear();
    1344             : 
    1345             :         // loop through both lists ('til the maximum of both lengths)
    1346           0 :         const ::rtl::OUString* pItems = aItems.getConstArray();
    1347           0 :         const ::rtl::OUString* pValues = aValues.getConstArray();
    1348             : 
    1349           0 :         sal_Int32 nItems = aItems.getLength();
    1350           0 :         sal_Int32 nValues = aValues.getLength();
    1351             : 
    1352           0 :         sal_Int16 nMaxLen = (sal_Int16)std::max(nItems, nValues);
    1353             : 
    1354           0 :         for (sal_Int16 i=0; i<nMaxLen; ++i )
    1355             :         {
    1356           0 :             m_rContext.getGlobalContext().ClearAttrList();
    1357           0 :             if (i < nItems)
    1358             :             {
    1359             :                 // there is an item at this position
    1360             :                 AddAttribute(
    1361           0 :                     OAttributeMetaData::getCommonControlAttributeNamespace(CCA_LABEL),
    1362             :                     OAttributeMetaData::getCommonControlAttributeName(CCA_LABEL),
    1363           0 :                     *pItems);
    1364           0 :                 ++pItems;
    1365             :             }
    1366           0 :             if (i < nValues)
    1367             :             {
    1368             :                 // there is an value at this position
    1369             :                 AddAttribute(
    1370           0 :                     OAttributeMetaData::getCommonControlAttributeNamespace(CCA_VALUE),
    1371             :                     OAttributeMetaData::getCommonControlAttributeName(CCA_VALUE),
    1372           0 :                     *pValues);
    1373           0 :                 ++pValues;
    1374             :             }
    1375             : 
    1376           0 :             Int16SetIterator aSelectedPos = aSelection.find(i);
    1377           0 :             if (aSelection.end() != aSelectedPos)
    1378             :             {   // the item at this position is selected
    1379             :                 AddAttribute(
    1380           0 :                     OAttributeMetaData::getCommonControlAttributeNamespace(CCA_CURRENT_SELECTED),
    1381             :                     OAttributeMetaData::getCommonControlAttributeName(CCA_CURRENT_SELECTED),
    1382             :                     sTrue
    1383           0 :                     );
    1384           0 :                 aSelection.erase(aSelectedPos);
    1385             :             }
    1386             : 
    1387           0 :             Int16SetIterator aDefaultSelectedPos = aDefaultSelection.find(i);
    1388           0 :             if (aDefaultSelection.end() != aDefaultSelectedPos)
    1389             :             {   // the item at this position is selected as default
    1390             :                 AddAttribute(
    1391           0 :                     OAttributeMetaData::getCommonControlAttributeNamespace(CCA_SELECTED),
    1392             :                     OAttributeMetaData::getCommonControlAttributeName(CCA_SELECTED),
    1393             :                     sTrue
    1394           0 :                     );
    1395           0 :                 aDefaultSelection.erase(aDefaultSelectedPos);
    1396             :             }
    1397           0 :             SvXMLElementExport aFormElement(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, "option", sal_True, sal_True);
    1398           0 :         }
    1399             : 
    1400             :         // There may be more "selected" or "default-selected" items than there are in the lists in real,
    1401             :         // so we need to store some additional "form:option" items which have no name and no label, but
    1402             :         // one or both of the selected flags.
    1403             :         // 21.05.2001 - 85388 - frank.schoenheit@germany.sun.com
    1404             : 
    1405           0 :         if ( !aSelection.empty() || !aDefaultSelection.empty() )
    1406             :         {
    1407           0 :             sal_Int16 nLastSelected = -1;
    1408           0 :             if ( !aSelection.empty() )
    1409           0 :                 nLastSelected = *(--aSelection.end());
    1410             : 
    1411           0 :             sal_Int16 nLastDefaultSelected = -1;
    1412           0 :             if ( !aDefaultSelection.empty() )
    1413           0 :                 nLastDefaultSelected = *(--aDefaultSelection.end());
    1414             : 
    1415             :             // the maximum element in both sets
    1416           0 :             sal_Int16 nLastReferredEntry = std::max(nLastSelected, nLastDefaultSelected);
    1417             :             OSL_ENSURE(nLastReferredEntry >= nMaxLen, "OControlExport::exportListSourceAsElements: inconsistence!");
    1418             :                 // if the maximum (selected or default selected) entry number is less than the maximum item count
    1419             :                 // in both lists, the entry number should have been removed from the set
    1420             : 
    1421           0 :             for (sal_Int16 i=nMaxLen; i<=nLastReferredEntry; ++i)
    1422             :             {
    1423           0 :                 if (aSelection.end() != aSelection.find(i))
    1424             :                 {   // the (not existent) item at this position is selected
    1425             :                     AddAttribute(
    1426           0 :                         OAttributeMetaData::getCommonControlAttributeNamespace(CCA_CURRENT_SELECTED),
    1427             :                         OAttributeMetaData::getCommonControlAttributeName(CCA_CURRENT_SELECTED),
    1428             :                         sTrue
    1429           0 :                         );
    1430             :                 }
    1431             : 
    1432           0 :                 if (aDefaultSelection.end() != aDefaultSelection.find(i))
    1433             :                 {   // the (not existent) item at this position is selected as default
    1434             :                     AddAttribute(
    1435           0 :                         OAttributeMetaData::getCommonControlAttributeNamespace(CCA_SELECTED),
    1436             :                         OAttributeMetaData::getCommonControlAttributeName(CCA_SELECTED),
    1437             :                         sTrue
    1438           0 :                         );
    1439             :                 }
    1440           0 :                 SvXMLElementExport aFormElement(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, "option", sal_True, sal_True);
    1441           0 :             }
    1442           0 :         }
    1443           0 :     }
    1444             : 
    1445             :     //---------------------------------------------------------------------
    1446           0 :     void OControlExport::implStartElement(const sal_Char* _pName)
    1447             :     {
    1448             :         // before we let the base class start it's outer element, we add a wrapper element
    1449           0 :         const sal_Char *pOuterElementName = getOuterXMLElementName();
    1450             :         m_pOuterElement = pOuterElementName
    1451             :                                ? new SvXMLElementExport(
    1452           0 :                                         m_rContext.getGlobalContext(),
    1453             :                                         XML_NAMESPACE_FORM,
    1454             :                                         pOuterElementName, sal_True,
    1455           0 :                                         sal_True)
    1456           0 :                             : 0;
    1457             : 
    1458             :         // add the attributes for the inner element
    1459           0 :         exportInnerAttributes();
    1460             : 
    1461             :         // and start the inner element
    1462           0 :         OElementExport::implStartElement(_pName);
    1463           0 :     }
    1464             : 
    1465             :     //---------------------------------------------------------------------
    1466           0 :     void OControlExport::implEndElement()
    1467             :     {
    1468             :         // end the inner element
    1469           0 :         OElementExport::implEndElement();
    1470             : 
    1471             :         // end the outer element if it exists
    1472           0 :         delete m_pOuterElement;
    1473           0 :         m_pOuterElement = NULL;
    1474           0 :     }
    1475             : 
    1476             :     //---------------------------------------------------------------------
    1477           0 :     const sal_Char* OControlExport::getOuterXMLElementName() const
    1478             :     {
    1479           0 :         return 0;
    1480             :     }
    1481             : 
    1482             :     //---------------------------------------------------------------------
    1483           0 :     const sal_Char* OControlExport::getXMLElementName() const
    1484             :     {
    1485           0 :         return getElementName(m_eType);
    1486             :     }
    1487             : 
    1488             :     //---------------------------------------------------------------------
    1489           0 :     void OControlExport::examine()
    1490             :     {
    1491             :         OSL_ENSURE( ( m_nIncludeCommon == 0 ) && ( m_nIncludeSpecial == 0 ) && ( m_nIncludeDatabase == 0 )
    1492             :                  && ( m_nIncludeEvents == 0 ) && ( m_nIncludeBindings == 0),
    1493             :                  "OControlExport::examine: called me twice? Not initialized?" );
    1494             : 
    1495             :         // get the class id to decide which kind of element we need in the XML stream
    1496           0 :         m_nClassId = FormComponentType::CONTROL;
    1497             :         DBG_CHECK_PROPERTY( PROPERTY_CLASSID, sal_Int16 );
    1498           0 :         m_xProps->getPropertyValue(PROPERTY_CLASSID) >>= m_nClassId;
    1499           0 :         bool knownType = false;
    1500           0 :         switch (m_nClassId)
    1501             :         {
    1502             :             case FormComponentType::DATEFIELD:
    1503           0 :                 m_eType = DATE;
    1504           0 :                 knownType = true;
    1505             :                 // NO BREAK
    1506             :             case FormComponentType::TIMEFIELD:
    1507           0 :                 if ( !knownType )
    1508             :                 {
    1509           0 :                     m_eType = TIME;
    1510           0 :                     knownType = true;
    1511             :                 }
    1512           0 :                 m_nIncludeSpecial |= SCA_VALIDATION;
    1513             :                 // NO BREAK
    1514             :             case FormComponentType::NUMERICFIELD:
    1515             :             case FormComponentType::CURRENCYFIELD:
    1516             :             case FormComponentType::PATTERNFIELD:
    1517           0 :                 if ( !knownType )
    1518             :                 {
    1519           0 :                     m_eType = FORMATTED_TEXT;
    1520           0 :                     knownType = true;
    1521             :                 }
    1522             :                 // NO BREAK
    1523             :             case FormComponentType::TEXTFIELD:
    1524             :             {   // it's some kind of edit. To know which type we need further investigation
    1525             : 
    1526           0 :                 if ( !knownType )
    1527             :                 {
    1528             :                     // check if it's a formatted field
    1529           0 :                     if (m_xPropertyInfo->hasPropertyByName(PROPERTY_FORMATKEY))
    1530             :                     {
    1531           0 :                         m_eType = FORMATTED_TEXT;
    1532             :                     }
    1533             :                     else
    1534             :                     {
    1535             :                         // all other controls are represented by an ordinary edit control, but which XML control type
    1536             :                         // it is depends on the current values of some properties
    1537             : 
    1538             :                         // if the EchoChar string is not empty, it is a password field
    1539           0 :                         sal_Int16 nEchoChar = 0;
    1540           0 :                         if (m_xPropertyInfo->hasPropertyByName(PROPERTY_ECHOCHAR))
    1541             :                             // grid columns do not have this property ....
    1542           0 :                             m_xProps->getPropertyValue(PROPERTY_ECHOCHAR) >>= nEchoChar;
    1543           0 :                         if (nEchoChar)
    1544             :                         {
    1545           0 :                             m_eType = PASSWORD;
    1546           0 :                             m_nIncludeSpecial |= SCA_ECHO_CHAR;
    1547             :                         }
    1548             :                         else
    1549             :                         {
    1550             :                             // if the MultiLine property is sal_True, it is a TextArea
    1551           0 :                             sal_Bool bMultiLine = sal_False;
    1552           0 :                             if (m_xPropertyInfo->hasPropertyByName(PROPERTY_MULTILINE))
    1553             :                                 // grid columns do not have this property ....
    1554           0 :                                 bMultiLine = ::cppu::any2bool(m_xProps->getPropertyValue(PROPERTY_MULTILINE));
    1555             : 
    1556           0 :                             if ( bMultiLine )
    1557           0 :                                 m_eType = TEXT_AREA;
    1558             :                             else
    1559             :                                 // the only case left is represented by a Text element
    1560           0 :                                 m_eType = TEXT;
    1561             :                         }
    1562             :                     }
    1563           0 :                     knownType = true;
    1564             :                 }
    1565             : 
    1566             :                 // attributes which are common to all the types:
    1567             :                 // common attributes
    1568             :                 m_nIncludeCommon =
    1569             :                     CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED |
    1570           0 :                     CCA_PRINTABLE | CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE;
    1571             : 
    1572           0 :                 if  (   ( m_nClassId != FormComponentType::DATEFIELD )
    1573             :                     &&  ( m_nClassId != FormComponentType::TIMEFIELD )
    1574             :                     )
    1575             :                     // date and time field values are handled differently nowadays
    1576           0 :                     m_nIncludeCommon |= CCA_VALUE;
    1577             : 
    1578             :                 // database attributes
    1579           0 :                 m_nIncludeDatabase = DA_DATA_FIELD | DA_INPUT_REQUIRED;
    1580             : 
    1581             :                 // event attributes
    1582           0 :                 m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE | EA_ON_SELECT;
    1583             : 
    1584             :                 // only text and pattern fields have a ConvertEmptyToNull property
    1585           0 :                 if  (   ( m_nClassId == FormComponentType::TEXTFIELD )
    1586             :                     ||  ( m_nClassId == FormComponentType::PATTERNFIELD )
    1587             :                     )
    1588           0 :                     m_nIncludeDatabase |= DA_CONVERT_EMPTY;
    1589             : 
    1590             :                 // all controls but the file control fields have a readonly property
    1591           0 :                 if ( m_nClassId != FormComponentType::FILECONTROL )
    1592           0 :                     m_nIncludeCommon |= CCA_READONLY;
    1593             : 
    1594             :                 // a text field has a max text len
    1595           0 :                 if ( m_nClassId == FormComponentType::TEXTFIELD )
    1596           0 :                     m_nIncludeCommon |= CCA_MAX_LENGTH;
    1597             : 
    1598             :                 // max and min values and validation:
    1599           0 :                 if (FORMATTED_TEXT == m_eType)
    1600             :                 {   // in general all controls represented as formatted-text have these props
    1601           0 :                     if  ( FormComponentType::PATTERNFIELD != m_nClassId )   // except the PatternField
    1602           0 :                         m_nIncludeSpecial |= SCA_MAX_VALUE | SCA_MIN_VALUE;
    1603             : 
    1604           0 :                     if (FormComponentType::TEXTFIELD != m_nClassId)
    1605             :                         // and the FormattedField does not have a validation flag
    1606           0 :                         m_nIncludeSpecial |= SCA_VALIDATION;
    1607             :                 }
    1608             : 
    1609             :                 // if it's not a password field or rich text control, the CurrentValue needs to be stored, too
    1610           0 :                 if  (   ( PASSWORD != m_eType )
    1611             :                     &&  ( DATE != m_eType )
    1612             :                     &&  ( TIME != m_eType )
    1613             :                     )
    1614             :                 {
    1615           0 :                     m_nIncludeCommon |= CCA_CURRENT_VALUE;
    1616             :                 }
    1617             :             }
    1618           0 :             break;
    1619             : 
    1620             :             case FormComponentType::FILECONTROL:
    1621           0 :                 m_eType = FILE;
    1622             :                 m_nIncludeCommon =
    1623             :                     CCA_NAME | CCA_SERVICE_NAME | CCA_CURRENT_VALUE | CCA_DISABLED |
    1624             :                     CCA_PRINTABLE | CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE |
    1625           0 :                     CCA_VALUE;
    1626           0 :                 m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE | EA_ON_SELECT;
    1627           0 :                 break;
    1628             : 
    1629             :             case FormComponentType::FIXEDTEXT:
    1630           0 :                 m_eType = FIXED_TEXT;
    1631             :                 m_nIncludeCommon =
    1632             :                     CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_LABEL |
    1633           0 :                     CCA_PRINTABLE | CCA_TITLE | CCA_FOR;
    1634           0 :                 m_nIncludeSpecial = SCA_MULTI_LINE;
    1635           0 :                 m_nIncludeEvents = EA_CONTROL_EVENTS;
    1636           0 :                 break;
    1637             : 
    1638             :             case FormComponentType::COMBOBOX:
    1639           0 :                 m_eType = COMBOBOX;
    1640             :                 m_nIncludeCommon =
    1641             :                     CCA_NAME | CCA_SERVICE_NAME | CCA_CURRENT_VALUE |
    1642             :                     CCA_DISABLED | CCA_DROPDOWN | CCA_MAX_LENGTH | CCA_PRINTABLE | CCA_READONLY | CCA_SIZE |
    1643           0 :                     CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE | CCA_VALUE;
    1644           0 :                 m_nIncludeSpecial = SCA_AUTOMATIC_COMPLETION;
    1645           0 :                 m_nIncludeDatabase = DA_CONVERT_EMPTY | DA_DATA_FIELD | DA_INPUT_REQUIRED | DA_LIST_SOURCE | DA_LIST_SOURCE_TYPE;
    1646           0 :                 m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE | EA_ON_SELECT;
    1647           0 :                 break;
    1648             : 
    1649             :             case FormComponentType::LISTBOX:
    1650           0 :                 m_eType = LISTBOX;
    1651             :                 m_nIncludeCommon =
    1652             :                     CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_DROPDOWN |
    1653           0 :                     CCA_PRINTABLE | CCA_SIZE | CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE;
    1654           0 :                 m_nIncludeSpecial = SCA_MULTIPLE;
    1655           0 :                 m_nIncludeDatabase = DA_BOUND_COLUMN | DA_DATA_FIELD | DA_INPUT_REQUIRED | DA_LIST_SOURCE_TYPE;
    1656           0 :                 m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE | EA_ON_CLICK | EA_ON_DBLCLICK;
    1657             :                 // check if we need to export the ListSource as attribute
    1658             :                 {
    1659             :                     // for a list box, if the ListSourceType is VALUE_LIST, no ListSource is stored, but instead
    1660             :                     // a sequence of pairs which is build from the StringItemList and the ValueList
    1661           0 :                     ListSourceType eListSourceType = ListSourceType_VALUELIST;
    1662             :                 #if OSL_DEBUG_LEVEL > 0
    1663             :                     sal_Bool bSuccess =
    1664             :                 #endif
    1665           0 :                     m_xProps->getPropertyValue(PROPERTY_LISTSOURCETYPE) >>= eListSourceType;
    1666             :                     OSL_ENSURE(bSuccess, "OControlExport::examineControl: could not retrieve the ListSourceType!");
    1667           0 :                     if (ListSourceType_VALUELIST != eListSourceType)
    1668             :                     {
    1669           0 :                         m_nIncludeDatabase |= DA_LIST_SOURCE;
    1670             :                     }
    1671             :                 }
    1672             : 
    1673           0 :                 break;
    1674             : 
    1675             :             case FormComponentType::COMMANDBUTTON:
    1676           0 :                 m_eType = BUTTON;
    1677           0 :                 m_nIncludeCommon |= CCA_TAB_STOP | CCA_LABEL;
    1678           0 :                 m_nIncludeSpecial = SCA_DEFAULT_BUTTON | SCA_TOGGLE | SCA_FOCUS_ON_CLICK | SCA_IMAGE_POSITION | SCA_REPEAT_DELAY;
    1679             :                 // NO BREAK !
    1680             :             case FormComponentType::IMAGEBUTTON:
    1681           0 :                 if (BUTTON != m_eType)
    1682             :                 {
    1683             :                     // not coming from the previous case
    1684           0 :                     m_eType = IMAGE;
    1685             :                 }
    1686             :                 m_nIncludeCommon |=
    1687             :                     CCA_NAME | CCA_SERVICE_NAME | CCA_BUTTON_TYPE | CCA_DISABLED |
    1688             :                     CCA_IMAGE_DATA | CCA_PRINTABLE | CCA_TAB_INDEX | CCA_TARGET_FRAME |
    1689           0 :                     CCA_TARGET_LOCATION | CCA_TITLE;
    1690           0 :                 m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CLICK  | EA_ON_DBLCLICK;
    1691           0 :                 break;
    1692             : 
    1693             :             case FormComponentType::CHECKBOX:
    1694           0 :                 m_eType = CHECKBOX;
    1695           0 :                 m_nIncludeSpecial = SCA_CURRENT_STATE | SCA_IS_TRISTATE | SCA_STATE;
    1696             :                 // NO BREAK !
    1697             :             case FormComponentType::RADIOBUTTON:
    1698             :                 m_nIncludeCommon =
    1699             :                     CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_LABEL | CCA_PRINTABLE |
    1700           0 :                     CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE | CCA_VALUE | CCA_VISUAL_EFFECT;
    1701           0 :                 if (CHECKBOX != m_eType)
    1702             :                 {   // not coming from the previous case
    1703           0 :                     m_eType = RADIO;
    1704           0 :                     m_nIncludeCommon |= CCA_CURRENT_SELECTED | CCA_SELECTED;
    1705             :                 }
    1706           0 :                 if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_IMAGE_POSITION ) )
    1707           0 :                     m_nIncludeSpecial |= SCA_IMAGE_POSITION;
    1708           0 :                 if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_GROUP_NAME ) )
    1709           0 :                     m_nIncludeSpecial |= SCA_GROUP_NAME;
    1710           0 :                 m_nIncludeDatabase = DA_DATA_FIELD | DA_INPUT_REQUIRED;
    1711           0 :                 m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE;
    1712           0 :                 break;
    1713             : 
    1714             :             case FormComponentType::GROUPBOX:
    1715           0 :                 m_eType = FRAME;
    1716             :                 m_nIncludeCommon =
    1717             :                     CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_LABEL |
    1718           0 :                     CCA_PRINTABLE | CCA_TITLE | CCA_FOR;
    1719           0 :                 m_nIncludeEvents = EA_CONTROL_EVENTS;
    1720           0 :                 break;
    1721             : 
    1722             :             case FormComponentType::IMAGECONTROL:
    1723           0 :                 m_eType = IMAGE_FRAME;
    1724             :                 m_nIncludeCommon =
    1725             :                     CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_IMAGE_DATA |
    1726           0 :                     CCA_PRINTABLE | CCA_READONLY | CCA_TITLE;
    1727           0 :                 m_nIncludeDatabase = DA_DATA_FIELD | DA_INPUT_REQUIRED;
    1728           0 :                 m_nIncludeEvents = EA_CONTROL_EVENTS;
    1729           0 :                 break;
    1730             : 
    1731             :             case FormComponentType::HIDDENCONTROL:
    1732           0 :                 m_eType = HIDDEN;
    1733             :                 m_nIncludeCommon =
    1734           0 :                     CCA_NAME | CCA_SERVICE_NAME | CCA_VALUE;
    1735           0 :                 break;
    1736             : 
    1737             :             case FormComponentType::GRIDCONTROL:
    1738           0 :                 m_eType = GRID;
    1739             :                 m_nIncludeCommon =
    1740             :                     CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_PRINTABLE |
    1741           0 :                     CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE;
    1742           0 :                 m_nIncludeEvents = EA_CONTROL_EVENTS;
    1743           0 :                 break;
    1744             : 
    1745             :             case FormComponentType::SCROLLBAR:
    1746             :             case FormComponentType::SPINBUTTON:
    1747           0 :                 m_eType = VALUERANGE;
    1748             :                 m_nIncludeCommon =
    1749             :                     CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_PRINTABLE |
    1750           0 :                     CCA_TITLE | CCA_CURRENT_VALUE | CCA_VALUE | CCA_ORIENTATION;
    1751           0 :                 m_nIncludeSpecial = SCA_MAX_VALUE | SCA_STEP_SIZE | SCA_MIN_VALUE | SCA_REPEAT_DELAY;
    1752             : 
    1753           0 :                 if ( m_nClassId == FormComponentType::SCROLLBAR )
    1754           0 :                     m_nIncludeSpecial |= SCA_PAGE_STEP_SIZE ;
    1755             : 
    1756           0 :                 m_nIncludeEvents = EA_CONTROL_EVENTS;
    1757           0 :                 break;
    1758             : 
    1759             :             default:
    1760             :                 OSL_FAIL("OControlExport::examineControl: unknown control type (class id)!");
    1761             :                 // NO break!
    1762             : 
    1763             :             case FormComponentType::NAVIGATIONBAR:
    1764             :                 // TODO: should we have an own file format for this?
    1765             :                 // NO break
    1766             : 
    1767             :             case FormComponentType::CONTROL:
    1768           0 :                 m_eType = GENERIC_CONTROL;
    1769             :                 // unknown control type
    1770           0 :                 m_nIncludeCommon = CCA_NAME | CCA_SERVICE_NAME;
    1771             :                     // at least a name should be there, 'cause without a name the control could never have been
    1772             :                     // inserted into it's parent container
    1773             :                     // In addition, the service name is absolutely necessary to create the control upon reading.
    1774           0 :                 m_nIncludeEvents = EA_CONTROL_EVENTS;
    1775             :                     // we always should be able to export events - this is not control type dependent
    1776           0 :                 break;
    1777             :         }
    1778             : 
    1779             :         // in general, all control types need to export the control id
    1780           0 :         m_nIncludeCommon |= CCA_CONTROL_ID;
    1781             : 
    1782             :         // is is a control bound to a calc cell?
    1783           0 :         if ( FormCellBindingHelper::livesInSpreadsheetDocument( m_xProps ) )
    1784             :         {
    1785           0 :             FormCellBindingHelper aHelper( m_xProps, NULL );
    1786             :             {
    1787           0 :                 if ( aHelper.isCellBinding( aHelper.getCurrentBinding( ) ) )
    1788             :                 {
    1789           0 :                     m_nIncludeBindings |= BA_LINKED_CELL;
    1790           0 :                     if ( m_nClassId == FormComponentType::LISTBOX )
    1791           0 :                         m_nIncludeBindings |= BA_LIST_LINKING_TYPE;
    1792             :                 }
    1793             :             }
    1794             : 
    1795             :             // is it a list-like control which uses a calc cell range as list source?
    1796             :             {
    1797           0 :                 if ( aHelper.isCellRangeListSource( aHelper.getCurrentListSource( ) ) )
    1798           0 :                     m_nIncludeBindings |= BA_LIST_CELL_RANGE;
    1799           0 :             }
    1800             :         }
    1801             : 
    1802             :         // is control bound to XForms?
    1803           0 :         if( !getXFormsBindName( m_xProps ).isEmpty() )
    1804             :         {
    1805           0 :             m_nIncludeBindings |= BA_XFORMS_BIND;
    1806             :         }
    1807             : 
    1808             :         // is (list-)control bound to XForms list?
    1809           0 :         if( !getXFormsListBindName( m_xProps ).isEmpty() )
    1810             :         {
    1811           0 :             m_nIncludeBindings |= BA_XFORMS_LISTBIND;
    1812             :         }
    1813             : 
    1814             :         // does the control have an XForms submission?
    1815           0 :         if( !getXFormsSubmissionName( m_xProps ).isEmpty() )
    1816             :         {
    1817           0 :             m_nIncludeBindings |= BA_XFORMS_SUBMISSION;
    1818             :         }
    1819           0 :     }
    1820             : 
    1821             :     //---------------------------------------------------------------------
    1822           0 :     void OControlExport::exportCellBindingAttributes( bool _bIncludeListLinkageType )
    1823             :     {
    1824             :         try
    1825             :         {
    1826           0 :             FormCellBindingHelper aHelper( m_xProps, NULL );
    1827           0 :             Reference< XValueBinding > xBinding( aHelper.getCurrentBinding() );
    1828             :             OSL_ENSURE( xBinding.is(), "OControlExport::exportCellBindingAttributes: invalid bindable or invalid binding!" );
    1829           0 :             if ( xBinding.is() )
    1830             :             {
    1831             :                 // ....................................................
    1832             :                 AddAttribute(
    1833           0 :                     OAttributeMetaData::getBindingAttributeNamespace( BA_LINKED_CELL ),
    1834             :                     OAttributeMetaData::getBindingAttributeName( BA_LINKED_CELL ),
    1835             :                     aHelper.getStringAddressFromCellBinding( xBinding )
    1836           0 :                 );
    1837             : 
    1838             :                 // ....................................................
    1839           0 :                 if ( _bIncludeListLinkageType )
    1840             :                 {
    1841           0 :                     sal_Int16 nLinkageType = aHelper.isCellIntegerBinding( xBinding ) ? 1 : 0;
    1842             : 
    1843           0 :                     ::rtl::OUStringBuffer sBuffer;
    1844           0 :                     m_rContext.getGlobalContext().GetMM100UnitConverter().convertEnum(
    1845             :                         sBuffer,
    1846             :                         (sal_uInt16)nLinkageType,
    1847             :                         OEnumMapper::getEnumMap( OEnumMapper::epListLinkageType )
    1848           0 :                     );
    1849             : 
    1850             :                     AddAttribute(
    1851           0 :                         OAttributeMetaData::getBindingAttributeNamespace( BA_LIST_LINKING_TYPE ),
    1852             :                         OAttributeMetaData::getBindingAttributeName( BA_LIST_LINKING_TYPE ),
    1853             :                         sBuffer.makeStringAndClear()
    1854           0 :                     );
    1855             :                 }
    1856             : 
    1857           0 :             }
    1858             :         }
    1859           0 :         catch( const Exception& )
    1860             :         {
    1861             :             OSL_FAIL( "OControlExport::exportCellBindingAttributes: caught an exception!" );
    1862             :         }
    1863           0 :     }
    1864             : 
    1865             :     //---------------------------------------------------------------------
    1866           0 :     void OControlExport::exportXFormsBindAttributes()
    1867             :     {
    1868           0 :         rtl::OUString sBindName = getXFormsBindName( m_xProps );
    1869           0 :         AddAttribute( XML_NAMESPACE_XFORMS, XML_BIND, sBindName );
    1870           0 :     }
    1871             :     //---------------------------------------------------------------------
    1872           0 :     void OControlExport::exportXFormsListAttributes()
    1873             :     {
    1874           0 :         rtl::OUString sBindName = getXFormsListBindName( m_xProps );
    1875           0 :         AddAttribute( XML_NAMESPACE_FORM, XML_XFORMS_LIST_SOURCE, sBindName );
    1876           0 :     }
    1877             :     //---------------------------------------------------------------------
    1878           0 :     void OControlExport::exportXFormsSubmissionAttributes()
    1879             :     {
    1880           0 :         rtl::OUString sSubmission = getXFormsSubmissionName( m_xProps );
    1881           0 :         AddAttribute( XML_NAMESPACE_FORM, XML_XFORMS_SUBMISSION, sSubmission );
    1882           0 :     }
    1883             :     //---------------------------------------------------------------------
    1884           0 :     void OControlExport::exportCellListSourceRange( )
    1885             :     {
    1886             :         try
    1887             :         {
    1888           0 :             Reference< XListEntrySink > xSink( m_xProps, UNO_QUERY );
    1889           0 :             Reference< XListEntrySource > xSource;
    1890           0 :             if ( xSink.is() )
    1891           0 :                 xSource = xSource.query( xSink->getListEntrySource() );
    1892             :             OSL_ENSURE( xSource.is(), "OControlExport::exportCellListSourceRange: list source or sink!" );
    1893           0 :             if ( xSource.is() )
    1894             :             {
    1895           0 :                 FormCellBindingHelper aHelper( m_xProps, NULL );
    1896             : 
    1897             :                 AddAttribute(
    1898           0 :                     OAttributeMetaData::getBindingAttributeNamespace( BA_LIST_CELL_RANGE ),
    1899             :                     OAttributeMetaData::getBindingAttributeName( BA_LIST_CELL_RANGE ),
    1900             :                     aHelper.getStringAddressFromCellListSource( xSource )
    1901           0 :                 );
    1902           0 :             }
    1903             :         }
    1904           0 :         catch( const Exception& )
    1905             :         {
    1906             :             OSL_FAIL( "OControlExport::exportCellListSourceRange: caught an exception!" );
    1907             :         }
    1908           0 :     }
    1909             : 
    1910             :     //---------------------------------------------------------------------
    1911           0 :     void OControlExport::exportImagePositionAttributes()
    1912             :     {
    1913             :         try
    1914             :         {
    1915           0 :             sal_Int16 nImagePosition = ImagePosition::Centered;
    1916           0 :             OSL_VERIFY( m_xProps->getPropertyValue( PROPERTY_IMAGE_POSITION ) >>= nImagePosition );
    1917             :             OSL_ENSURE( ( nImagePosition >= ImagePosition::LeftTop ) && ( nImagePosition <= ImagePosition::Centered ),
    1918             :                 "OControlExport::exportImagePositionAttributes: don't know this image position!" );
    1919             : 
    1920           0 :             if ( ( nImagePosition < ImagePosition::LeftTop ) || ( nImagePosition > ImagePosition::Centered ) )
    1921             :                 // this is important to prevent potential buffer overflows below, so don't optimize
    1922           0 :                 nImagePosition = ImagePosition::Centered;
    1923             : 
    1924           0 :             if ( nImagePosition == ImagePosition::Centered )
    1925             :             {
    1926           0 :                 AddAttribute( XML_NAMESPACE_FORM, GetXMLToken( XML_IMAGE_POSITION ), GetXMLToken( XML_CENTER ) );
    1927             :             }
    1928             :             else
    1929             :             {
    1930             :                 XMLTokenEnum eXmlImagePositions[] =
    1931             :                 {
    1932             :                     XML_START, XML_END, XML_TOP, XML_BOTTOM
    1933           0 :                 };
    1934             :                 XMLTokenEnum eXmlImageAligns[] =
    1935             :                 {
    1936             :                     XML_START, XML_CENTER, XML_END
    1937           0 :                 };
    1938             : 
    1939           0 :                 XMLTokenEnum eXmlImagePosition = eXmlImagePositions[ nImagePosition / 3 ];
    1940           0 :                 XMLTokenEnum eXmlImageAlign    = eXmlImageAligns   [ nImagePosition % 3 ];
    1941             : 
    1942           0 :                 AddAttribute( XML_NAMESPACE_FORM, GetXMLToken( XML_IMAGE_POSITION ), GetXMLToken( eXmlImagePosition ) );
    1943           0 :                 AddAttribute( XML_NAMESPACE_FORM, GetXMLToken( XML_IMAGE_ALIGN    ), GetXMLToken( eXmlImageAlign    ) );
    1944             :             }
    1945             : 
    1946           0 :             exportedProperty( PROPERTY_IMAGE_POSITION );
    1947             :             // some of the controls which have an ImagePosition also have an ImageAlign for compatibility
    1948             :             // reasons. Since the ImageAlign values simply represent a sub set of the ImagePosition values,
    1949             :             // we don't need to export ImageAlign anymore
    1950           0 :             exportedProperty( PROPERTY_IMAGE_ALIGN );
    1951             :         }
    1952           0 :         catch( const Exception& )
    1953             :         {
    1954             :             DBG_UNHANDLED_EXCEPTION();
    1955             :         }
    1956           0 :     }
    1957             : 
    1958             :     //---------------------------------------------------------------------
    1959           0 :     bool OControlExport::controlHasActiveDataBinding() const
    1960             :     {
    1961             :         try
    1962             :         {
    1963             :             // currently exchanging the data with a database column?
    1964           0 :             ::rtl::OUString sBoundFieldPropertyName( RTL_CONSTASCII_USTRINGPARAM( "BoundField" ) );
    1965           0 :             if ( m_xPropertyInfo.is() && m_xPropertyInfo->hasPropertyByName( sBoundFieldPropertyName ) )
    1966             :             {
    1967           0 :                 Reference< XPropertySet > xBoundField;
    1968           0 :                 m_xProps->getPropertyValue( sBoundFieldPropertyName ) >>= xBoundField;
    1969           0 :                 if ( xBoundField.is() )
    1970           0 :                     return true;
    1971             :             }
    1972             : 
    1973             :             // currently exchanging data with an external binding?
    1974           0 :             Reference< XBindableValue > xBindable( m_xProps, UNO_QUERY );
    1975           0 :             if ( xBindable.is() && xBindable->getValueBinding().is() )
    1976           0 :                 return true;
    1977             :         }
    1978           0 :         catch( const Exception& )
    1979             :         {
    1980             :             OSL_FAIL( "OColumnExport::controlHasActiveDataBinding: caught an exception!" );
    1981             :         }
    1982             : 
    1983           0 :         return false;
    1984             :     }
    1985             : 
    1986             :     //---------------------------------------------------------------------
    1987           0 :     bool OControlExport::controlHasUserSuppliedListEntries() const
    1988             :     {
    1989             :         try
    1990             :         {
    1991             :             // an external list source?
    1992           0 :             Reference< XListEntrySink > xEntrySink( m_xProps, UNO_QUERY );
    1993           0 :             if ( xEntrySink.is() && xEntrySink->getListEntrySource().is() )
    1994           0 :                 return false;
    1995             : 
    1996           0 :             if ( m_xPropertyInfo.is() && m_xPropertyInfo->hasPropertyByName( PROPERTY_LISTSOURCETYPE ) )
    1997             :             {
    1998           0 :                 ListSourceType eListSourceType = ListSourceType_VALUELIST;
    1999           0 :                 OSL_VERIFY( m_xProps->getPropertyValue( PROPERTY_LISTSOURCETYPE ) >>= eListSourceType );
    2000           0 :                 if ( eListSourceType == ListSourceType_VALUELIST )
    2001             :                     // for value lists, the list entries as entered by the user are used
    2002           0 :                     return true;
    2003             : 
    2004             :                 // for every other type, the list entries are filled with some data obtained
    2005             :                 // from a database - if and only if the ListSource property is not empty
    2006           0 :                 return getScalarListSourceValue().isEmpty();
    2007           0 :             }
    2008             :         }
    2009           0 :         catch( const Exception& )
    2010             :         {
    2011             :             OSL_FAIL( "OControlExport::controlHasUserSuppliedListEntries: caught an exception!" );
    2012             :         }
    2013             : 
    2014             :         OSL_FAIL( "OControlExport::controlHasUserSuppliedListEntries: unreachable code!" );
    2015             :             // this method should be called for list and combo boxes only
    2016           0 :         return true;
    2017             :     }
    2018             : 
    2019             :     //=====================================================================
    2020             :     //= OColumnExport
    2021             :     //=====================================================================
    2022             :     //---------------------------------------------------------------------
    2023           0 :     OColumnExport::OColumnExport(IFormsExportContext& _rContext, const Reference< XPropertySet >& _rxControl, const ::rtl::OUString& _rControlId,
    2024             :         const Sequence< ScriptEventDescriptor >& _rEvents)
    2025           0 :         :OControlExport(_rContext, _rxControl, _rControlId, ::rtl::OUString(), _rEvents)
    2026             :     {
    2027           0 :     }
    2028             : 
    2029             :     //---------------------------------------------------------------------
    2030           0 :     OColumnExport::~OColumnExport()
    2031             :     {
    2032           0 :         implEndElement();
    2033           0 :     }
    2034             : 
    2035             :     //---------------------------------------------------------------------
    2036           0 :     void OColumnExport::exportServiceNameAttribute()
    2037             :     {
    2038             :         // the attribute "service name" (which has a slightly different meaning for columns
    2039             :         DBG_CHECK_PROPERTY( PROPERTY_COLUMNSERVICENAME, ::rtl::OUString );
    2040           0 :         ::rtl::OUString sColumnServiceName;
    2041           0 :         m_xProps->getPropertyValue(PROPERTY_COLUMNSERVICENAME) >>= sColumnServiceName;
    2042             :         // the service name is a full qualified one (i.e. com.sun.star.form.TextField), but the
    2043             :         // real service name for the column (for use with the XGridColumnFactory) is only the last
    2044             :         // token of this complete name.
    2045           0 :         sal_Int32 nLastSep = sColumnServiceName.lastIndexOf('.');
    2046             :         OSL_ENSURE(-1 != nLastSep, "OColumnExport::startExportElement: invalid service name!");
    2047           0 :         sColumnServiceName = sColumnServiceName.copy(nLastSep + 1);
    2048             :         sColumnServiceName =
    2049           0 :             m_rContext.getGlobalContext().GetNamespaceMap().GetQNameByKey(
    2050           0 :                 XML_NAMESPACE_OOO, sColumnServiceName );
    2051             :         // add the attribute
    2052           0 :         AddAttribute( OAttributeMetaData::getCommonControlAttributeNamespace(CCA_SERVICE_NAME)
    2053             :                     , OAttributeMetaData::getCommonControlAttributeName(CCA_SERVICE_NAME)
    2054           0 :                     , sColumnServiceName);
    2055             :         // flag the property as "handled"
    2056           0 :         exportedProperty(PROPERTY_COLUMNSERVICENAME);
    2057             : 
    2058           0 :     }
    2059             : 
    2060             :     //---------------------------------------------------------------------
    2061           0 :     const sal_Char* OColumnExport::getOuterXMLElementName() const
    2062             :     {
    2063           0 :         return "column";
    2064             :     }
    2065             : 
    2066             :     //---------------------------------------------------------------------
    2067           0 :     void OColumnExport::exportAttributes()
    2068             :     {
    2069           0 :         OControlExport::exportAttributes();
    2070             : 
    2071             :         // the attribute "label"
    2072             :         exportStringPropertyAttribute(
    2073           0 :             OAttributeMetaData::getCommonControlAttributeNamespace(CCA_LABEL),
    2074             :             OAttributeMetaData::getCommonControlAttributeName(CCA_LABEL),
    2075           0 :             PROPERTY_LABEL);
    2076             : 
    2077             :         // the style attribute
    2078           0 :         ::rtl::OUString sStyleName = m_rContext.getObjectStyleName( m_xProps );
    2079           0 :         if ( !sStyleName.isEmpty() )
    2080             :         {
    2081             :             AddAttribute(
    2082           0 :                 OAttributeMetaData::getSpecialAttributeNamespace( SCA_COLUMN_STYLE_NAME ),
    2083             :                 OAttributeMetaData::getSpecialAttributeName( SCA_COLUMN_STYLE_NAME ),
    2084             :                 sStyleName
    2085           0 :             );
    2086           0 :         }
    2087           0 :     }
    2088             : 
    2089             :     //---------------------------------------------------------------------
    2090           0 :     void OColumnExport::examine()
    2091             :     {
    2092           0 :         OControlExport::examine();
    2093             : 
    2094             :         // grid columns miss some properties of the controls they're representing
    2095           0 :         m_nIncludeCommon &= ~(CCA_FOR | CCA_PRINTABLE | CCA_TAB_INDEX | CCA_TAB_STOP | CCA_LABEL);
    2096           0 :         m_nIncludeSpecial &= ~(SCA_ECHO_CHAR | SCA_AUTOMATIC_COMPLETION | SCA_MULTIPLE | SCA_MULTI_LINE);
    2097             : 
    2098           0 :         if (FormComponentType::DATEFIELD != m_nClassId)
    2099             :             // except date fields, no column has the DropDown property
    2100           0 :             m_nIncludeCommon &= ~CCA_DROPDOWN;
    2101           0 :     }
    2102             : 
    2103             :     //=====================================================================
    2104             :     //= OFormExport
    2105             :     //=====================================================================
    2106             :     //---------------------------------------------------------------------
    2107           0 :     OFormExport::OFormExport(IFormsExportContext& _rContext, const Reference< XPropertySet >& _rxForm,
    2108             :         const Sequence< ScriptEventDescriptor >& _rEvents)
    2109             :         :OElementExport(_rContext, _rxForm, _rEvents)
    2110           0 :         ,m_bCreateConnectionResourceElement(sal_False)
    2111             :     {
    2112             :         OSL_ENSURE(m_xProps.is(), "OFormExport::OFormExport: invalid arguments!");
    2113           0 :     }
    2114             : 
    2115             :     //---------------------------------------------------------------------
    2116           0 :     const sal_Char* OFormExport::getXMLElementName() const
    2117             :     {
    2118           0 :         return "form";
    2119             :     }
    2120             : 
    2121             :     //---------------------------------------------------------------------
    2122           0 :     void OFormExport::exportSubTags()
    2123             :     {
    2124           0 :         if ( m_bCreateConnectionResourceElement && m_xProps.is() )
    2125             :         {
    2126           0 :             m_rContext.getGlobalContext().ClearAttrList();
    2127           0 :             ::rtl::OUString sPropValue;
    2128           0 :             m_xProps->getPropertyValue( PROPERTY_DATASOURCENAME ) >>= sPropValue; // if set it is a file url
    2129           0 :             if ( sPropValue.isEmpty() )
    2130           0 :                 m_xProps->getPropertyValue( PROPERTY_URL ) >>= sPropValue;
    2131           0 :             if ( !sPropValue.isEmpty() )
    2132             :                 AddAttribute(
    2133           0 :                     OAttributeMetaData::getCommonControlAttributeNamespace(CCA_TARGET_LOCATION),
    2134             :                     OAttributeMetaData::getCommonControlAttributeName(CCA_TARGET_LOCATION),
    2135           0 :                     sPropValue);
    2136           0 :             if ( m_rContext.getGlobalContext().GetAttrList().getLength() )
    2137             :             {
    2138           0 :                 SvXMLElementExport aFormElement(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, xmloff::token::XML_CONNECTION_RESOURCE, sal_True, sal_True);
    2139           0 :             }
    2140             :         }
    2141             : 
    2142             :         // let the base class export the remaining properties and the events
    2143           0 :         OElementExport::exportSubTags();
    2144             :         // loop through all children
    2145           0 :         Reference< XIndexAccess > xCollection(m_xProps, UNO_QUERY);
    2146             :         OSL_ENSURE(xCollection.is(), "OFormLayerXMLExport::implExportForm: a form which is not an index access? Suspic´┐Żous!");
    2147             : 
    2148           0 :         if (xCollection.is())
    2149           0 :             m_rContext.exportCollectionElements(xCollection);
    2150           0 :     }
    2151             : 
    2152             :     //---------------------------------------------------------------------
    2153           0 :     void OFormExport::exportAttributes()
    2154             :     {
    2155           0 :         sal_Int32 i=0;
    2156             : 
    2157             :         // ---------------------
    2158             :         // the string properties
    2159             :         {
    2160             :             static FormAttributes eStringPropertyIds[] =
    2161             :             {
    2162             :                 faName, /*faAction,*/ faCommand, faFilter, faOrder
    2163             :             };
    2164             :             static ::rtl::OUString aStringPropertyNames[] =
    2165             :             {
    2166             :                 PROPERTY_NAME, /*PROPERTY_TARGETURL,*/ PROPERTY_COMMAND, PROPERTY_FILTER, PROPERTY_ORDER
    2167           0 :             };
    2168           0 :             sal_Int32 nIdCount = sizeof(eStringPropertyIds) / sizeof(eStringPropertyIds[0]);
    2169             :         #if OSL_DEBUG_LEVEL > 0
    2170             :             sal_Int32 nNameCount = sizeof(aStringPropertyNames) / sizeof(aStringPropertyNames[0]);
    2171             :             OSL_ENSURE((nIdCount == nNameCount),
    2172             :                 "OFormExport::exportAttributes: somebody tampered with the maps (1)!");
    2173             :         #endif
    2174           0 :             for (i=0; i<nIdCount; ++i)
    2175             :                 exportStringPropertyAttribute(
    2176           0 :                     OAttributeMetaData::getFormAttributeNamespace(eStringPropertyIds[i]),
    2177             :                     OAttributeMetaData::getFormAttributeName(eStringPropertyIds[i]),
    2178           0 :                     aStringPropertyNames[i]);
    2179             : 
    2180             :             // #i112082# xlink:type is added as part of exportTargetLocationAttribute
    2181             : 
    2182             :             // now export the data source name or databaselocation or connection resource
    2183           0 :             ::rtl::OUString sPropValue;
    2184           0 :             m_xProps->getPropertyValue( PROPERTY_DATASOURCENAME ) >>= sPropValue;
    2185           0 :             m_bCreateConnectionResourceElement = sPropValue.isEmpty();
    2186           0 :             if ( !m_bCreateConnectionResourceElement )
    2187             :             {
    2188           0 :                 INetURLObject aURL(sPropValue);
    2189           0 :                 m_bCreateConnectionResourceElement = ( aURL.GetProtocol() == INET_PROT_FILE );
    2190           0 :                 if ( !m_bCreateConnectionResourceElement )
    2191             :                     exportStringPropertyAttribute(
    2192           0 :                         OAttributeMetaData::getFormAttributeNamespace(faDatasource),
    2193             :                         OAttributeMetaData::getFormAttributeName(faDatasource),
    2194           0 :                         PROPERTY_DATASOURCENAME);
    2195             :             }
    2196             :             else
    2197           0 :                 exportedProperty(PROPERTY_URL);
    2198           0 :             if ( m_bCreateConnectionResourceElement )
    2199           0 :                 exportedProperty(PROPERTY_DATASOURCENAME);
    2200             :         }
    2201             : 
    2202             :         // ----------------------
    2203             :         // the boolean properties
    2204             :         {
    2205             :             static FormAttributes eBooleanPropertyIds[] =
    2206             :             {
    2207             :                 faAllowDeletes, faAllowInserts, faAllowUpdates, faApplyFilter, faEscapeProcessing, faIgnoreResult
    2208             :             };
    2209             :             static const ConstAsciiString pBooleanPropertyNames[] =
    2210             :             {
    2211             :                 PROPERTY_ALLOWDELETES, PROPERTY_ALLOWINSERTS, PROPERTY_ALLOWUPDATES, PROPERTY_APPLYFILTER, PROPERTY_ESCAPEPROCESSING, PROPERTY_IGNORERESULT
    2212           0 :             };
    2213             :             static sal_Int8 nBooleanPropertyAttrFlags[] =
    2214             :             {
    2215             :                 BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE
    2216             :             };
    2217           0 :             sal_Int32 nIdCount = sizeof(eBooleanPropertyIds) / sizeof(eBooleanPropertyIds[0]);
    2218             :         #if OSL_DEBUG_LEVEL > 0
    2219             :             sal_Int32 nNameCount = sizeof(pBooleanPropertyNames) / sizeof(pBooleanPropertyNames[0]);
    2220             :             sal_Int32 nFlagsCount = sizeof(nBooleanPropertyAttrFlags) / sizeof(nBooleanPropertyAttrFlags[0]);
    2221             :             OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nFlagsCount),
    2222             :                 "OFormExport::exportAttributes: somebody tampered with the maps (2)!");
    2223             :         #endif
    2224           0 :             for (i=0; i<nIdCount; ++i)
    2225             :                 exportBooleanPropertyAttribute(
    2226           0 :                     OAttributeMetaData::getFormAttributeNamespace(eBooleanPropertyIds[i]),
    2227             :                     OAttributeMetaData::getFormAttributeName(eBooleanPropertyIds[i]),
    2228             :                     pBooleanPropertyNames[i],
    2229           0 :                     nBooleanPropertyAttrFlags[i]
    2230           0 :                 );
    2231             :         }
    2232             : 
    2233             :         // -------------------
    2234             :         // the enum properties
    2235             :         {
    2236             :             static FormAttributes eEnumPropertyIds[] =
    2237             :             {
    2238             :                 faEnctype, faMethod, faCommandType, faNavigationMode, faTabbingCycle
    2239             :             };
    2240             :             static const ConstAsciiString pEnumPropertyNames[] =
    2241             :             {
    2242             :                 PROPERTY_SUBMIT_ENCODING, PROPERTY_SUBMIT_METHOD, PROPERTY_COMMAND_TYPE, PROPERTY_NAVIGATION, PROPERTY_CYCLE
    2243           0 :             };
    2244             :             static OEnumMapper::EnumProperties eEnumPropertyMaps[] =
    2245             :             {
    2246             :                 OEnumMapper::epSubmitEncoding, OEnumMapper::epSubmitMethod, OEnumMapper::epCommandType, OEnumMapper::epNavigationType, OEnumMapper::epTabCyle
    2247             :             };
    2248             :             static sal_Int32 nEnumPropertyAttrDefaults[] =
    2249             :             {
    2250             :                 FormSubmitEncoding_URL, FormSubmitMethod_GET, CommandType::COMMAND, NavigationBarMode_CURRENT, TabulatorCycle_RECORDS
    2251             :             };
    2252             :             static sal_Bool nEnumPropertyAttrDefaultFlags[] =
    2253             :             {
    2254             :                 sal_False, sal_False, sal_False, sal_False, sal_True
    2255             :             };
    2256           0 :             sal_Int32 nIdCount = sizeof(eEnumPropertyIds) / sizeof(eEnumPropertyIds[0]);
    2257             :         #if OSL_DEBUG_LEVEL > 0
    2258             :             sal_Int32 nNameCount = sizeof(pEnumPropertyNames) / sizeof(pEnumPropertyNames[0]);
    2259             :             sal_Int32 nDefaultCount = sizeof(nEnumPropertyAttrDefaults) / sizeof(nEnumPropertyAttrDefaults[0]);
    2260             :             sal_Int32 nDefaultFlagCount = sizeof(nEnumPropertyAttrDefaultFlags) / sizeof(nEnumPropertyAttrDefaultFlags[0]);
    2261             :             sal_Int32 nMapCount = sizeof(eEnumPropertyMaps) / sizeof(eEnumPropertyMaps[0]);
    2262             :             OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nDefaultCount) && (nDefaultCount == nDefaultFlagCount) && (nDefaultFlagCount == nMapCount),
    2263             :                 "OFormExport::exportAttributes: somebody tampered with the maps (3)!");
    2264             :         #endif
    2265           0 :             for (i=0; i<nIdCount; ++i)
    2266             :                 exportEnumPropertyAttribute(
    2267           0 :                     OAttributeMetaData::getFormAttributeNamespace(eEnumPropertyIds[i]),
    2268             :                     OAttributeMetaData::getFormAttributeName(eEnumPropertyIds[i]),
    2269             :                     pEnumPropertyNames[i],
    2270             :                     OEnumMapper::getEnumMap(eEnumPropertyMaps[i]),
    2271             :                     nEnumPropertyAttrDefaults[i],
    2272           0 :                     nEnumPropertyAttrDefaultFlags[i]
    2273           0 :                 );
    2274             :         }
    2275             : 
    2276             :         // the service name
    2277           0 :         exportServiceNameAttribute();
    2278             :         // the target frame
    2279           0 :         exportTargetFrameAttribute();
    2280             :         // the target URL
    2281           0 :         exportTargetLocationAttribute(true);    // #i110911# add type attribute (for form, but not for control)
    2282             : 
    2283             :         // master fields
    2284             :         exportStringSequenceAttribute(
    2285           0 :             OAttributeMetaData::getFormAttributeNamespace(faMasterFields),
    2286             :             OAttributeMetaData::getFormAttributeName(faMasterFields),
    2287           0 :             PROPERTY_MASTERFIELDS);
    2288             :         // detail fields
    2289             :         exportStringSequenceAttribute(
    2290           0 :             OAttributeMetaData::getFormAttributeNamespace(faDetailFiels),
    2291             :             OAttributeMetaData::getFormAttributeName(faDetailFiels),
    2292           0 :             PROPERTY_DETAILFIELDS);
    2293           0 :     }
    2294             : //.........................................................................
    2295             : }   // namespace xmloff
    2296             : //.........................................................................
    2297             : 
    2298             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10