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

Generated by: LCOV version 1.10