LCOV - code coverage report
Current view: top level - svx/source/form - dataaccessdescriptor.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 140 167 83.8 %
Date: 2012-08-25 Functions: 23 26 88.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 79 192 41.1 %

           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                 :            : #include <svx/dataaccessdescriptor.hxx>
      30                 :            : #include <comphelper/stl_types.hxx>
      31                 :            : #include <comphelper/propertysetinfo.hxx>
      32                 :            : #include <comphelper/genericpropertyset.hxx>
      33                 :            : #include <osl/diagnose.h>
      34                 :            : #include <com/sun/star/sdbc/XConnection.hpp>
      35                 :            : #include <com/sun/star/ucb/XContent.hpp>
      36                 :            : #include <com/sun/star/beans/PropertyAttribute.hpp>
      37                 :            : #include <tools/urlobj.hxx>
      38                 :            : 
      39                 :            : //........................................................................
      40                 :            : namespace svx
      41                 :            : {
      42                 :            : //........................................................................
      43                 :            : 
      44                 :            :     using namespace ::com::sun::star::uno;
      45                 :            :     using namespace ::com::sun::star::sdbc;
      46                 :            :     using namespace ::com::sun::star::beans;
      47                 :            :     using namespace ::com::sun::star::ucb;
      48                 :            :     using namespace ::comphelper;
      49                 :            : 
      50                 :            : #define CONST_CHAR( propname ) propname, sizeof(propname) - 1
      51                 :            : 
      52                 :            :     //====================================================================
      53                 :            :     //= ODADescriptorImpl
      54                 :            :     //====================================================================
      55         [ +  - ]:        118 :     class ODADescriptorImpl
      56                 :            :     {
      57                 :            :     protected:
      58                 :            :         sal_Bool                    m_bSetOutOfDate         : 1;
      59                 :            :         sal_Bool                    m_bSequenceOutOfDate    : 1;
      60                 :            : 
      61                 :            :     public:
      62                 :            :         typedef ::std::map< DataAccessDescriptorProperty, Any >     DescriptorValues;
      63                 :            :         DescriptorValues            m_aValues;
      64                 :            :         Sequence< PropertyValue >   m_aAsSequence;
      65                 :            :         Reference< XPropertySet >   m_xAsSet;
      66                 :            : 
      67                 :            :         typedef ::std::map< ::rtl::OUString, PropertyMapEntry* >    MapString2PropertyEntry;
      68                 :            : 
      69                 :            :     public:
      70                 :            :         ODADescriptorImpl();
      71                 :            :         ODADescriptorImpl(const ODADescriptorImpl& _rSource);
      72                 :            : 
      73                 :            :         void invalidateExternRepresentations();
      74                 :            : 
      75                 :            :         void updateSequence();
      76                 :            : 
      77                 :            :         /** builds the descriptor from a property value sequence
      78                 :            :             @return <TRUE/>
      79                 :            :                 if and only if the sequence contained valid properties only
      80                 :            :         */
      81                 :            :         sal_Bool buildFrom( const Sequence< PropertyValue >& _rValues );
      82                 :            : 
      83                 :            :         /** builds the descriptor from a property set
      84                 :            :             @return <TRUE/>
      85                 :            :                 if and only if the set contained valid properties only
      86                 :            :         */
      87                 :            :         sal_Bool buildFrom( const Reference< XPropertySet >& _rValues );
      88                 :            : 
      89                 :            :     protected:
      90                 :            :         static PropertyValue                    buildPropertyValue( const DescriptorValues::const_iterator& _rPos );
      91                 :            :         static const MapString2PropertyEntry&   getPropertyMap( );
      92                 :            :         static PropertyMapEntry*                getPropertyMapEntry( const DescriptorValues::const_iterator& _rPos );
      93                 :            :     };
      94                 :            : 
      95                 :            :     //--------------------------------------------------------------------
      96                 :        114 :     ODADescriptorImpl::ODADescriptorImpl()
      97                 :            :         :m_bSetOutOfDate(sal_True)
      98         [ +  - ]:        114 :         ,m_bSequenceOutOfDate(sal_True)
      99                 :            :     {
     100                 :        114 :     }
     101                 :            : 
     102                 :            :     //--------------------------------------------------------------------
     103                 :          4 :     ODADescriptorImpl::ODADescriptorImpl(const ODADescriptorImpl& _rSource)
     104                 :            :         :m_bSetOutOfDate( _rSource.m_bSetOutOfDate )
     105                 :            :         ,m_bSequenceOutOfDate( _rSource.m_bSequenceOutOfDate )
     106         [ +  - ]:          4 :         ,m_aValues( _rSource.m_aValues )
     107                 :            :     {
     108         [ -  + ]:          4 :         if (!m_bSetOutOfDate)
     109         [ #  # ]:          0 :             m_xAsSet = _rSource.m_xAsSet;
     110         [ +  - ]:          4 :         if (!m_bSequenceOutOfDate)
     111         [ +  - ]:          4 :             m_aAsSequence = _rSource.m_aAsSequence;
     112                 :          4 :     }
     113                 :            : 
     114                 :            :     //--------------------------------------------------------------------
     115                 :          8 :     sal_Bool ODADescriptorImpl::buildFrom( const Sequence< PropertyValue >& _rValues )
     116                 :            :     {
     117                 :          8 :         const MapString2PropertyEntry& rProperties = getPropertyMap();
     118                 :            : 
     119                 :          8 :         sal_Bool bValidPropsOnly = sal_True;
     120                 :            : 
     121                 :            :         // loop through the sequence, and fill our m_aValues
     122                 :          8 :         const PropertyValue* pValues = _rValues.getConstArray();
     123                 :          8 :         const PropertyValue* pValuesEnd = pValues + _rValues.getLength();
     124         [ +  + ]:        130 :         for (;pValues != pValuesEnd; ++pValues)
     125                 :            :         {
     126         [ +  - ]:        122 :             MapString2PropertyEntry::const_iterator aPropPos = rProperties.find( pValues->Name );
     127         [ +  + ]:        122 :             if ( aPropPos != rProperties.end() )
     128                 :            :             {
     129                 :         30 :                 DataAccessDescriptorProperty eProperty = (DataAccessDescriptorProperty)aPropPos->second->mnHandle;
     130         [ +  - ]:         30 :                 m_aValues[eProperty] = pValues->Value;
     131                 :            :             }
     132                 :            :             else
     133                 :            :                 // unknown property
     134                 :         92 :                 bValidPropsOnly = sal_False;
     135                 :            :         }
     136                 :            : 
     137         [ +  + ]:          8 :         if (bValidPropsOnly)
     138                 :            :         {
     139                 :          6 :             m_aAsSequence = _rValues;
     140                 :          6 :             m_bSequenceOutOfDate = sal_False;
     141                 :            :         }
     142                 :            :         else
     143                 :          2 :             m_bSequenceOutOfDate = sal_True;
     144                 :            : 
     145                 :          8 :         return bValidPropsOnly;
     146                 :            :     }
     147                 :            : 
     148                 :            :     //--------------------------------------------------------------------
     149                 :          2 :     sal_Bool ODADescriptorImpl::buildFrom( const Reference< XPropertySet >& _rxValues )
     150                 :            :     {
     151                 :          2 :         Reference< XPropertySetInfo > xPropInfo;
     152         [ +  - ]:          2 :         if (_rxValues.is())
     153 [ +  - ][ +  - ]:          2 :             xPropInfo = _rxValues->getPropertySetInfo();
                 [ +  - ]
     154         [ -  + ]:          2 :         if (!xPropInfo.is())
     155                 :            :         {
     156                 :            :             OSL_FAIL("ODADescriptorImpl::buildFrom: invalid property set!");
     157                 :          0 :             return sal_False;
     158                 :            :         }
     159                 :            : 
     160                 :            :         // build a PropertyValue sequence with the current values
     161 [ +  - ][ +  - ]:          2 :         Sequence< Property > aProperties = xPropInfo->getProperties();
     162                 :          2 :         const Property* pProperty = aProperties.getConstArray();
     163                 :          2 :         const Property* pPropertyEnd = pProperty + aProperties.getLength();
     164                 :            : 
     165         [ +  - ]:          2 :         Sequence< PropertyValue > aValues(aProperties.getLength());
     166         [ +  - ]:          2 :         PropertyValue* pValues = aValues.getArray();
     167                 :            : 
     168         [ +  + ]:        106 :         for (;pProperty != pPropertyEnd; ++pProperty, ++pValues)
     169                 :            :         {
     170                 :        104 :             pValues->Name = pProperty->Name;
     171 [ +  - ][ +  - ]:        104 :             pValues->Value = _rxValues->getPropertyValue(pProperty->Name);
     172                 :            :         }
     173                 :            : 
     174         [ +  - ]:          2 :         sal_Bool bValidPropsOnly = buildFrom(aValues);
     175         [ -  + ]:          2 :         if (bValidPropsOnly)
     176                 :            :         {
     177         [ #  # ]:          0 :             m_xAsSet = _rxValues;
     178                 :          0 :             m_bSetOutOfDate = sal_False;
     179                 :            :         }
     180                 :            :         else
     181                 :          2 :             m_bSetOutOfDate = sal_True;
     182                 :            : 
     183 [ +  - ][ +  - ]:          2 :         return bValidPropsOnly;
     184                 :            :     }
     185                 :            : 
     186                 :            :     //--------------------------------------------------------------------
     187                 :         32 :     void ODADescriptorImpl::invalidateExternRepresentations()
     188                 :            :     {
     189                 :         32 :         m_bSetOutOfDate = sal_True;
     190                 :         32 :         m_bSequenceOutOfDate = sal_True;
     191                 :         32 :     }
     192                 :            : 
     193                 :            :     //--------------------------------------------------------------------
     194                 :         20 :     const ODADescriptorImpl::MapString2PropertyEntry& ODADescriptorImpl::getPropertyMap( )
     195                 :            :     {
     196                 :            :         // the properties we know
     197 [ +  + ][ +  - ]:         20 :         static MapString2PropertyEntry s_aProperties;
         [ +  - ][ #  # ]
     198         [ +  + ]:         20 :         if ( s_aProperties.empty() )
     199                 :            :         {
     200                 :            :             static PropertyMapEntry s_aDesriptorProperties[] =
     201                 :            :             {
     202         [ +  - ]:          2 :                 { CONST_CHAR("ActiveConnection"),   daConnection,           &::getCppuType( static_cast< Reference< XConnection >* >(NULL) ),   PropertyAttribute::TRANSIENT, 0 },
     203         [ +  - ]:          2 :                 { CONST_CHAR("BookmarkSelection"),  daBookmarkSelection,    &::getBooleanCppuType( ),                                           PropertyAttribute::TRANSIENT, 0 },
     204         [ +  - ]:          2 :                 { CONST_CHAR("Column"),             daColumnObject,         &::getCppuType( static_cast< Reference< XPropertySet >* >(NULL) ),  PropertyAttribute::TRANSIENT, 0 },
     205         [ +  - ]:          2 :                 { CONST_CHAR("ColumnName"),         daColumnName,           &::getCppuType( static_cast< ::rtl::OUString* >(NULL) ),            PropertyAttribute::TRANSIENT, 0 },
     206         [ +  - ]:          2 :                 { CONST_CHAR("Command"),            daCommand,              &::getCppuType( static_cast< ::rtl::OUString* >(NULL) ),            PropertyAttribute::TRANSIENT, 0 },
     207         [ +  - ]:          2 :                 { CONST_CHAR("CommandType"),        daCommandType,          &::getCppuType( static_cast< sal_Int32* >(NULL) ),                  PropertyAttribute::TRANSIENT, 0 },
     208         [ +  - ]:          2 :                 { CONST_CHAR("Component"),          daComponent,            &::getCppuType( static_cast< Reference< XContent >* >(NULL) ),      PropertyAttribute::TRANSIENT, 0 },
     209         [ +  - ]:          2 :                 { CONST_CHAR("ConnectionResource"), daConnectionResource,   &::getCppuType( static_cast< ::rtl::OUString* >(NULL) ),            PropertyAttribute::TRANSIENT, 0 },
     210         [ +  - ]:          2 :                 { CONST_CHAR("Cursor"),             daCursor,               &::getCppuType( static_cast< Reference< XResultSet>* >(NULL) ),     PropertyAttribute::TRANSIENT, 0 },
     211         [ +  - ]:          2 :                 { CONST_CHAR("DataSourceName"),     daDataSource,           &::getCppuType( static_cast< ::rtl::OUString* >(NULL) ),            PropertyAttribute::TRANSIENT, 0 },
     212         [ +  - ]:          2 :                 { CONST_CHAR("DatabaseLocation"),   daDatabaseLocation,     &::getCppuType( static_cast< ::rtl::OUString* >(NULL) ),            PropertyAttribute::TRANSIENT, 0 },
     213         [ +  - ]:          2 :                 { CONST_CHAR("EscapeProcessing"),   daEscapeProcessing,     &::getBooleanCppuType( ),                                           PropertyAttribute::TRANSIENT, 0 },
     214         [ +  - ]:          2 :                 { CONST_CHAR("Filter"),             daFilter,               &::getCppuType( static_cast< ::rtl::OUString* >(NULL) ),            PropertyAttribute::TRANSIENT, 0 },
     215         [ +  - ]:          2 :                 { CONST_CHAR("Selection"),          daSelection,            &::getCppuType( static_cast< Sequence< Any >* >(NULL) ),            PropertyAttribute::TRANSIENT, 0 },
     216                 :            :                 { NULL, 0, 0, NULL, 0, 0 }
     217 [ +  - ][ +  - ]:          4 :             };
                 [ #  # ]
     218                 :            : 
     219                 :          2 :             PropertyMapEntry* pEntry = s_aDesriptorProperties;
     220         [ +  + ]:         30 :             while ( pEntry->mpName )
     221                 :            :             {
     222         [ +  - ]:         28 :                 s_aProperties[ ::rtl::OUString::createFromAscii( pEntry->mpName ) ] = pEntry;
     223                 :         28 :                 ++pEntry;
     224                 :            :             }
     225                 :            :         }
     226                 :            : 
     227                 :         20 :         return s_aProperties;
     228                 :            :     }
     229                 :            : 
     230                 :            :     //--------------------------------------------------------------------
     231                 :         12 :     PropertyMapEntry* ODADescriptorImpl::getPropertyMapEntry( const DescriptorValues::const_iterator& _rPos )
     232                 :            :     {
     233                 :         12 :         const MapString2PropertyEntry& rProperties = getPropertyMap();
     234                 :            : 
     235                 :         12 :         sal_Int32 nNeededHandle = (sal_Int32)(_rPos->first);
     236                 :            : 
     237         [ +  - ]:        168 :         for ( MapString2PropertyEntry::const_iterator loop = rProperties.begin();
     238                 :         84 :               loop != rProperties.end();
     239                 :            :               ++loop
     240                 :            :             )
     241                 :            :         {
     242         [ +  + ]:         84 :             if ( nNeededHandle == loop->second->mnHandle )
     243                 :         12 :                 return loop->second;
     244                 :            :         }
     245         [ #  # ]:          0 :         throw RuntimeException();
     246                 :            :     }
     247                 :            : 
     248                 :            :     //--------------------------------------------------------------------
     249                 :         12 :     PropertyValue ODADescriptorImpl::buildPropertyValue( const DescriptorValues::const_iterator& _rPos )
     250                 :            :     {
     251                 :            :         // the map entry
     252                 :         12 :         PropertyMapEntry* pProperty = getPropertyMapEntry( _rPos );
     253                 :            : 
     254                 :            :         // build the property value
     255                 :         12 :         PropertyValue aReturn;
     256         [ +  - ]:         12 :         aReturn.Name    = ::rtl::OUString( pProperty->mpName, pProperty->mnNameLen, RTL_TEXTENCODING_ASCII_US );
     257                 :         12 :         aReturn.Handle  = pProperty->mnHandle;
     258                 :         12 :         aReturn.Value   = _rPos->second;
     259                 :         12 :         aReturn.State   = PropertyState_DIRECT_VALUE;
     260                 :            : 
     261                 :            :         // outta here
     262                 :         12 :         return aReturn;
     263                 :            :     }
     264                 :            : 
     265                 :            :     //--------------------------------------------------------------------
     266                 :          4 :     void ODADescriptorImpl::updateSequence()
     267                 :            :     {
     268         [ -  + ]:          4 :         if (!m_bSequenceOutOfDate)
     269                 :          4 :             return;
     270                 :            : 
     271                 :          4 :         m_aAsSequence.realloc(m_aValues.size());
     272                 :          4 :         PropertyValue* pValue = m_aAsSequence.getArray();
     273                 :            : 
     274                 :            :         // loop through all our values
     275         [ +  + ]:         32 :         for (   DescriptorValues::const_iterator aLoop = m_aValues.begin();
     276                 :         16 :                 aLoop != m_aValues.end();
     277                 :            :                 ++aLoop, ++pValue
     278                 :            :             )
     279                 :            :         {
     280         [ +  - ]:         12 :             *pValue = buildPropertyValue(aLoop);
     281                 :            :         }
     282                 :            : 
     283                 :            :         // don't need to rebuild next time
     284                 :          4 :         m_bSequenceOutOfDate = sal_False;
     285                 :            :     }
     286                 :            : 
     287                 :            :     //====================================================================
     288                 :            :     //= ODataAccessDescriptor
     289                 :            :     //====================================================================
     290                 :            :     //--------------------------------------------------------------------
     291                 :        108 :     ODataAccessDescriptor::ODataAccessDescriptor()
     292         [ +  - ]:        108 :         :m_pImpl(new ODADescriptorImpl)
     293                 :            :     {
     294                 :        108 :     }
     295                 :            : 
     296                 :            :     //--------------------------------------------------------------------
     297                 :          0 :     ODataAccessDescriptor::ODataAccessDescriptor( const ODataAccessDescriptor& _rSource )
     298         [ #  # ]:          0 :         :m_pImpl(new ODADescriptorImpl(*_rSource.m_pImpl))
     299                 :            :     {
     300                 :          0 :     }
     301                 :            : 
     302                 :            :     //--------------------------------------------------------------------
     303                 :          4 :     const ODataAccessDescriptor& ODataAccessDescriptor::operator=(const ODataAccessDescriptor& _rSource)
     304                 :            :     {
     305         [ +  - ]:          4 :         delete m_pImpl;
     306         [ +  - ]:          4 :         m_pImpl = new ODADescriptorImpl(*_rSource.m_pImpl);
     307                 :          4 :         return *this;
     308                 :            :     }
     309                 :            : 
     310                 :            :     //--------------------------------------------------------------------
     311                 :          2 :     ODataAccessDescriptor::ODataAccessDescriptor( const Reference< XPropertySet >& _rValues )
     312         [ +  - ]:          2 :         :m_pImpl(new ODADescriptorImpl)
     313                 :            :     {
     314                 :          2 :         m_pImpl->buildFrom(_rValues);
     315                 :          2 :     }
     316                 :            : 
     317                 :            :     //--------------------------------------------------------------------
     318                 :          0 :     ODataAccessDescriptor::ODataAccessDescriptor( const Any& _rValues )
     319         [ #  # ]:          0 :         :m_pImpl(new ODADescriptorImpl)
     320                 :            :     {
     321                 :            :         // check if we know the format in the Any
     322         [ #  # ]:          0 :         Sequence< PropertyValue > aValues;
     323                 :          0 :         Reference< XPropertySet > xValues;
     324 [ #  # ][ #  # ]:          0 :         if ( _rValues >>= aValues )
     325         [ #  # ]:          0 :             m_pImpl->buildFrom( aValues );
     326 [ #  # ][ #  # ]:          0 :         else if ( _rValues >>= xValues )
     327 [ #  # ][ #  # ]:          0 :             m_pImpl->buildFrom( xValues );
     328                 :          0 :     }
     329                 :            : 
     330                 :            :     //--------------------------------------------------------------------
     331                 :          4 :     ODataAccessDescriptor::ODataAccessDescriptor( const Sequence< PropertyValue >& _rValues )
     332         [ +  - ]:          4 :         :m_pImpl(new ODADescriptorImpl)
     333                 :            :     {
     334                 :          4 :         m_pImpl->buildFrom(_rValues);
     335                 :          4 :     }
     336                 :            : 
     337                 :            :     //--------------------------------------------------------------------
     338                 :        114 :     ODataAccessDescriptor::~ODataAccessDescriptor()
     339                 :            :     {
     340         [ +  - ]:        114 :         delete m_pImpl;
     341                 :        114 :     }
     342                 :            : 
     343                 :            :     //--------------------------------------------------------------------
     344                 :          2 :     void ODataAccessDescriptor::clear()
     345                 :            :     {
     346                 :          2 :         m_pImpl->m_aValues.clear();
     347                 :          2 :     }
     348                 :            : 
     349                 :            :     //--------------------------------------------------------------------
     350                 :          0 :     void ODataAccessDescriptor::erase(DataAccessDescriptorProperty _eWhich)
     351                 :            :     {
     352                 :            :         OSL_ENSURE(has(_eWhich), "ODataAccessDescriptor::erase: invalid call!");
     353         [ #  # ]:          0 :         if (has(_eWhich))
     354                 :          0 :             m_pImpl->m_aValues.erase(_eWhich);
     355                 :          0 :     }
     356                 :            : 
     357                 :            :     //--------------------------------------------------------------------
     358                 :         82 :     sal_Bool ODataAccessDescriptor::has(DataAccessDescriptorProperty _eWhich) const
     359                 :            :     {
     360         [ +  - ]:         82 :         return m_pImpl->m_aValues.find(_eWhich) != m_pImpl->m_aValues.end();
     361                 :            :     }
     362                 :            : 
     363                 :            :     //--------------------------------------------------------------------
     364                 :         28 :     const Any& ODataAccessDescriptor::operator [] ( DataAccessDescriptorProperty _eWhich ) const
     365                 :            :     {
     366         [ -  + ]:         28 :         if (!has(_eWhich))
     367                 :            :         {
     368                 :            :             OSL_FAIL("ODataAccessDescriptor::operator[]: invalid acessor!");
     369 [ #  # ][ #  # ]:          0 :             static const Any aDummy;
     370                 :          0 :             return aDummy;
     371                 :            :         }
     372                 :            : 
     373                 :         28 :         return m_pImpl->m_aValues[_eWhich];
     374                 :            :     }
     375                 :            : 
     376                 :            :     //--------------------------------------------------------------------
     377                 :         32 :     Any& ODataAccessDescriptor::operator[] ( DataAccessDescriptorProperty _eWhich )
     378                 :            :     {
     379                 :         32 :         m_pImpl->invalidateExternRepresentations();
     380                 :         32 :         return m_pImpl->m_aValues[_eWhich];
     381                 :            :     }
     382                 :            : 
     383                 :            :     //--------------------------------------------------------------------
     384                 :          2 :     void ODataAccessDescriptor::initializeFrom(const Sequence< PropertyValue >& _rValues, sal_Bool _bClear)
     385                 :            :     {
     386         [ +  - ]:          2 :         if (_bClear)
     387                 :          2 :             clear();
     388                 :          2 :         m_pImpl->buildFrom(_rValues);
     389                 :          2 :     }
     390                 :            : 
     391                 :            :     //--------------------------------------------------------------------
     392                 :          4 :     Sequence< PropertyValue > ODataAccessDescriptor::createPropertyValueSequence()
     393                 :            :     {
     394                 :          4 :         m_pImpl->updateSequence();
     395                 :          4 :         return m_pImpl->m_aAsSequence;
     396                 :            :     }
     397                 :            : 
     398                 :            :     //--------------------------------------------------------------------
     399                 :         16 :     ::rtl::OUString ODataAccessDescriptor::getDataSource() const
     400                 :            :     {
     401                 :         16 :         ::rtl::OUString sDataSourceName;
     402 [ +  - ][ +  - ]:         16 :         if ( has(daDataSource) )
     403         [ +  - ]:         16 :             (*this)[daDataSource] >>= sDataSourceName;
     404 [ #  # ][ #  # ]:          0 :         else if ( has(daDatabaseLocation) )
     405         [ #  # ]:          0 :             (*this)[daDatabaseLocation] >>= sDataSourceName;
     406                 :         16 :         return sDataSourceName;
     407                 :            :     }
     408                 :            :     //--------------------------------------------------------------------
     409                 :         12 :     void ODataAccessDescriptor::setDataSource(const ::rtl::OUString& _sDataSourceNameOrLocation)
     410                 :            :     {
     411         [ -  + ]:         12 :         if ( !_sDataSourceNameOrLocation.isEmpty() )
     412                 :            :         {
     413         [ #  # ]:          0 :             INetURLObject aURL(_sDataSourceNameOrLocation);
     414 [ #  # ][ #  # ]:          0 :             (*this)[ (( aURL.GetProtocol() == INET_PROT_FILE ) ? daDatabaseLocation : daDataSource)] <<= _sDataSourceNameOrLocation;
         [ #  # ][ #  # ]
     415                 :            :         }
     416                 :            :         else
     417 [ +  - ][ +  - ]:         12 :             (*this)[ daDataSource ] <<= ::rtl::OUString();
     418                 :         12 :     }
     419                 :            : 
     420                 :            : //........................................................................
     421                 :            : }   // namespace svx
     422                 :            : //........................................................................
     423                 :            : 
     424                 :            : 
     425                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10