LCOV - code coverage report
Current view: top level - xmloff/source/forms - elementexport.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 765 0.0 %
Date: 2012-08-25 Functions: 0 53 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 1531 0.0 %

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

Generated by: LCOV version 1.10