LCOV - code coverage report
Current view: top level - extensions/source/propctrlr - cellbindinghandler.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 10 195 5.1 %
Date: 2014-11-03 Functions: 5 17 29.4 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "cellbindinghandler.hxx"
      21             : #include "formstrings.hxx"
      22             : #include "formmetadata.hxx"
      23             : #include "cellbindinghelper.hxx"
      24             : #include "pcrservices.hxx"
      25             : 
      26             : #include <com/sun/star/form/binding/XValueBinding.hpp>
      27             : #include <com/sun/star/table/CellAddress.hpp>
      28             : #include <com/sun/star/inspection/XObjectInspectorUI.hpp>
      29             : #include <tools/debug.hxx>
      30             : 
      31             : 
      32           4 : extern "C" void SAL_CALL createRegistryInfo_CellBindingPropertyHandler()
      33             : {
      34           4 :     ::pcr::CellBindingPropertyHandler::registerImplementation();
      35           4 : }
      36             : 
      37             : 
      38             : namespace pcr
      39             : {
      40             : 
      41             : 
      42             :     using namespace ::com::sun::star::uno;
      43             :     using namespace ::com::sun::star::table;
      44             :     using namespace ::com::sun::star::lang;
      45             :     using namespace ::com::sun::star::beans;
      46             :     using namespace ::com::sun::star::script;
      47             :     using namespace ::com::sun::star::frame;
      48             :     using namespace ::com::sun::star::inspection;
      49             :     using namespace ::com::sun::star::form::binding;
      50             :     using namespace ::comphelper;
      51             : 
      52             : 
      53             :     //= CellBindingPropertyHandler
      54             : 
      55             : 
      56           0 :     CellBindingPropertyHandler::CellBindingPropertyHandler( const Reference< XComponentContext >& _rxContext )
      57             :         :CellBindingPropertyHandler_Base( _rxContext )
      58           0 :         ,m_pCellExchangeConverter( new DefaultEnumRepresentation( *m_pInfoService, ::cppu::UnoType<sal_Int16>::get(), PROPERTY_ID_CELL_EXCHANGE_TYPE ) )
      59             :     {
      60           0 :     }
      61             : 
      62             : 
      63           4 :     OUString SAL_CALL CellBindingPropertyHandler::getImplementationName_static(  ) throw (RuntimeException)
      64             :     {
      65           4 :         return OUString( "com.sun.star.comp.extensions.CellBindingPropertyHandler" );
      66             :     }
      67             : 
      68             : 
      69           4 :     Sequence< OUString > SAL_CALL CellBindingPropertyHandler::getSupportedServiceNames_static(  ) throw (RuntimeException)
      70             :     {
      71           4 :         Sequence< OUString > aSupported( 1 );
      72           4 :         aSupported[0] = "com.sun.star.form.inspection.CellBindingPropertyHandler";
      73           4 :         return aSupported;
      74             :     }
      75             : 
      76             : 
      77           0 :     void CellBindingPropertyHandler::onNewComponent()
      78             :     {
      79           0 :         PropertyHandlerComponent::onNewComponent();
      80             : 
      81           0 :         Reference< XModel > xDocument( impl_getContextDocument_nothrow() );
      82             :         DBG_ASSERT( xDocument.is(), "CellBindingPropertyHandler::onNewComponent: no document!" );
      83           0 :         if ( CellBindingHelper::isSpreadsheetDocument( xDocument ) )
      84           0 :             m_pHelper.reset( new CellBindingHelper( m_xComponent, xDocument ) );
      85           0 :     }
      86             : 
      87             : 
      88           0 :     CellBindingPropertyHandler::~CellBindingPropertyHandler( )
      89             :     {
      90           0 :     }
      91             : 
      92             : 
      93           0 :     Sequence< OUString > SAL_CALL CellBindingPropertyHandler::getActuatingProperties( ) throw (RuntimeException, std::exception)
      94             :     {
      95           0 :         Sequence< OUString > aInterestingProperties( 3 );
      96           0 :         aInterestingProperties[0] = PROPERTY_LIST_CELL_RANGE;
      97           0 :         aInterestingProperties[1] = PROPERTY_BOUND_CELL;
      98           0 :         aInterestingProperties[2] = PROPERTY_CONTROLSOURCE;
      99           0 :         return aInterestingProperties;
     100             :     }
     101             : 
     102             : 
     103           0 :     void SAL_CALL CellBindingPropertyHandler::actuatingPropertyChanged( const OUString& _rActuatingPropertyName, const Any& _rNewValue, const Any& /*_rOldValue*/, const Reference< XObjectInspectorUI >& _rxInspectorUI, sal_Bool _bFirstTimeInit ) throw (NullPointerException, RuntimeException, std::exception)
     104             :     {
     105           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     106           0 :         PropertyId nActuatingPropId( impl_getPropertyId_throwRuntime( _rActuatingPropertyName ) );
     107             :         OSL_PRECOND( m_pHelper.get(), "CellBindingPropertyHandler::actuatingPropertyChanged: inconsistentcy!" );
     108             :             // if we survived impl_getPropertyId_throwRuntime, we should have a helper, since no helper implies no properties
     109             : 
     110             :         OSL_PRECOND( _rxInspectorUI.is(), "FormComponentPropertyHandler::actuatingPropertyChanged: no access to the UI!" );
     111           0 :         if ( !_rxInspectorUI.is() )
     112           0 :             throw NullPointerException();
     113             : 
     114           0 :         ::std::vector< PropertyId > aDependentProperties;
     115             : 
     116           0 :         switch ( nActuatingPropId )
     117             :         {
     118             :         // ----- BoundCell -----
     119             :         case PROPERTY_ID_BOUND_CELL:
     120             :         {
     121             :             // the SQL-data-binding related properties need to be enabled if and only if
     122             :             // there is *no* valid cell binding
     123           0 :             Reference< XValueBinding > xBinding;
     124           0 :             _rNewValue >>= xBinding;
     125             : 
     126           0 :             if ( impl_isSupportedProperty_nothrow( PROPERTY_ID_CELL_EXCHANGE_TYPE ) )
     127           0 :                 _rxInspectorUI->enablePropertyUI( PROPERTY_CELL_EXCHANGE_TYPE, xBinding.is() );
     128           0 :             if ( impl_componentHasProperty_throw( PROPERTY_CONTROLSOURCE ) )
     129           0 :                 _rxInspectorUI->enablePropertyUI( PROPERTY_CONTROLSOURCE, !xBinding.is() );
     130             : 
     131           0 :             if ( impl_isSupportedProperty_nothrow( PROPERTY_ID_FILTERPROPOSAL ) )
     132           0 :                 _rxInspectorUI->enablePropertyUI( PROPERTY_FILTERPROPOSAL, !xBinding.is() );
     133           0 :             if ( impl_isSupportedProperty_nothrow( PROPERTY_ID_EMPTY_IS_NULL ) )
     134           0 :                 _rxInspectorUI->enablePropertyUI( PROPERTY_EMPTY_IS_NULL, !xBinding.is() );
     135             : 
     136           0 :             aDependentProperties.push_back( PROPERTY_ID_BOUNDCOLUMN );
     137             : 
     138           0 :             if ( !xBinding.is() && m_pHelper->getCurrentBinding().is() )
     139             :             {
     140             :                 // ensure that the "transfer selection as" property is reset. Since we can't remember
     141             :                 // it at the object itself, but derive it from the binding only, we have to normalize
     142             :                 // it now that there *is* no binding anymore.
     143           0 :                 setPropertyValue( PROPERTY_CELL_EXCHANGE_TYPE, makeAny( (sal_Int16) 0 ) );
     144           0 :             }
     145             :         }
     146           0 :         break;
     147             : 
     148             :         // ----- CellRange -----
     149             :         case PROPERTY_ID_LIST_CELL_RANGE:
     150             :         {
     151             :             // the list source related properties need to be enabled if and only if
     152             :             // there is *no* valid external list source for the control
     153           0 :             Reference< XListEntrySource > xSource;
     154           0 :             _rNewValue >>= xSource;
     155             : 
     156           0 :             _rxInspectorUI->enablePropertyUI( PROPERTY_STRINGITEMLIST, !xSource.is() );
     157           0 :             _rxInspectorUI->enablePropertyUI( PROPERTY_LISTSOURCE, !xSource.is() );
     158           0 :             _rxInspectorUI->enablePropertyUI( PROPERTY_LISTSOURCETYPE, !xSource.is() );
     159             : 
     160           0 :             aDependentProperties.push_back( PROPERTY_ID_BOUNDCOLUMN );
     161             : 
     162             :             // also reset the list entries if the cell range is reset
     163             :             // #i28319#
     164           0 :             if ( !_bFirstTimeInit )
     165             :             {
     166             :                 try
     167             :                 {
     168           0 :                     if ( !xSource.is() )
     169           0 :                         setPropertyValue( PROPERTY_STRINGITEMLIST, makeAny( Sequence< OUString >() ) );
     170             :                 }
     171           0 :                 catch( const Exception& )
     172             :                 {
     173             :                     OSL_FAIL( "OPropertyBrowserController::actuatingPropertyChanged( ListCellRange ): caught an exception while resetting the string items!" );
     174             :                 }
     175           0 :             }
     176             :         }
     177           0 :         break;  // case PROPERTY_ID_LIST_CELL_RANGE
     178             : 
     179             :         // ----- DataField -----
     180             :         case PROPERTY_ID_CONTROLSOURCE:
     181             :         {
     182           0 :             OUString sControlSource;
     183           0 :             _rNewValue >>= sControlSource;
     184           0 :             if ( impl_isSupportedProperty_nothrow( PROPERTY_ID_BOUND_CELL ) )
     185           0 :                 _rxInspectorUI->enablePropertyUI( PROPERTY_BOUND_CELL, sControlSource.isEmpty() );
     186             :         }
     187           0 :         break;  // case PROPERTY_ID_CONTROLSOURCE
     188             : 
     189             :         default:
     190             :             OSL_FAIL( "CellBindingPropertyHandler::actuatingPropertyChanged: did not register for this property!" );
     191             :         }
     192             : 
     193           0 :         for ( ::std::vector< PropertyId >::const_iterator loopAffected = aDependentProperties.begin();
     194           0 :               loopAffected != aDependentProperties.end();
     195             :               ++loopAffected
     196             :             )
     197             :         {
     198           0 :             impl_updateDependentProperty_nothrow( *loopAffected, _rxInspectorUI );
     199           0 :         }
     200           0 :     }
     201             : 
     202             : 
     203           0 :     void CellBindingPropertyHandler::impl_updateDependentProperty_nothrow( PropertyId _nPropId, const Reference< XObjectInspectorUI >& _rxInspectorUI ) const
     204             :     {
     205             :         try
     206             :         {
     207           0 :             switch ( _nPropId )
     208             :             {
     209             :             // ----- BoundColumn -----
     210             :             case PROPERTY_ID_BOUNDCOLUMN:
     211             :             {
     212           0 :                 CellBindingPropertyHandler* pNonConstThis = const_cast< CellBindingPropertyHandler* >( this );
     213           0 :                 Reference< XValueBinding > xBinding( pNonConstThis->getPropertyValue( PROPERTY_BOUND_CELL ), UNO_QUERY );
     214           0 :                 Reference< XListEntrySource > xListSource( pNonConstThis->getPropertyValue( PROPERTY_LIST_CELL_RANGE ), UNO_QUERY );
     215             : 
     216           0 :                 if ( impl_isSupportedProperty_nothrow( PROPERTY_ID_BOUNDCOLUMN ) )
     217           0 :                     _rxInspectorUI->enablePropertyUI( PROPERTY_BOUNDCOLUMN, !xBinding.is() && !xListSource.is() );
     218             :             }
     219           0 :             break;  // case PROPERTY_ID_BOUNDCOLUMN
     220             : 
     221             :             }   // switch
     222             : 
     223             :         }
     224           0 :         catch( const Exception& )
     225             :         {
     226             :             OSL_FAIL( "CellBindingPropertyHandler::impl_updateDependentProperty_nothrow: caught an exception!" );
     227             :         }
     228           0 :     }
     229             : 
     230             : 
     231           0 :     Any SAL_CALL CellBindingPropertyHandler::getPropertyValue( const OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException, std::exception)
     232             :     {
     233           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     234           0 :         PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
     235             : 
     236             :         OSL_ENSURE( m_pHelper.get(), "CellBindingPropertyHandler::getPropertyValue: inconsistency!" );
     237             :             // if we survived impl_getPropertyId_throwUnknownProperty, we should have a helper, since no helper implies no properties
     238             : 
     239           0 :         Any aReturn;
     240           0 :         switch ( nPropId )
     241             :         {
     242             :         case PROPERTY_ID_BOUND_CELL:
     243             :         {
     244           0 :             Reference< XValueBinding > xBinding( m_pHelper->getCurrentBinding() );
     245           0 :             if ( !m_pHelper->isCellBinding( xBinding ) )
     246           0 :                 xBinding.clear();
     247             : 
     248           0 :             aReturn <<= xBinding;
     249             :         }
     250           0 :         break;
     251             : 
     252             :         case PROPERTY_ID_LIST_CELL_RANGE:
     253             :         {
     254           0 :             Reference< XListEntrySource > xSource( m_pHelper->getCurrentListSource() );
     255           0 :             if ( !m_pHelper->isCellRangeListSource( xSource ) )
     256           0 :                 xSource.clear();
     257             : 
     258           0 :             aReturn <<= xSource;
     259             :         }
     260           0 :         break;
     261             : 
     262             :         case PROPERTY_ID_CELL_EXCHANGE_TYPE:
     263             :         {
     264           0 :             Reference< XValueBinding > xBinding( m_pHelper->getCurrentBinding() );
     265           0 :             aReturn <<= (sal_Int16)( m_pHelper->isCellIntegerBinding( xBinding ) ? 1 : 0 );
     266             :         }
     267           0 :         break;
     268             : 
     269             :         default:
     270             :             OSL_FAIL( "CellBindingPropertyHandler::getPropertyValue: cannot handle this!" );
     271           0 :             break;
     272             :         }
     273           0 :         return aReturn;
     274             :     }
     275             : 
     276             : 
     277           0 :     void SAL_CALL CellBindingPropertyHandler::setPropertyValue( const OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException, std::exception)
     278             :     {
     279           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     280           0 :         PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
     281             : 
     282             :         OSL_ENSURE( m_pHelper.get(), "CellBindingPropertyHandler::setPropertyValue: inconsistency!" );
     283             :             // if we survived impl_getPropertyId_throwUnknownProperty, we should have a helper, since no helper implies no properties
     284             : 
     285             :         try
     286             :         {
     287           0 :             Any aOldValue = getPropertyValue( _rPropertyName );
     288             : 
     289           0 :             switch ( nPropId )
     290             :             {
     291             :             case PROPERTY_ID_BOUND_CELL:
     292             :             {
     293           0 :                 Reference< XValueBinding > xBinding;
     294           0 :                 _rValue >>= xBinding;
     295           0 :                 m_pHelper->setBinding( xBinding );
     296             :             }
     297           0 :             break;
     298             : 
     299             :             case PROPERTY_ID_LIST_CELL_RANGE:
     300             :             {
     301           0 :                 Reference< XListEntrySource > xSource;
     302           0 :                 _rValue >>= xSource;
     303           0 :                 m_pHelper->setListSource( xSource );
     304             :             }
     305           0 :             break;
     306             : 
     307             :             case PROPERTY_ID_CELL_EXCHANGE_TYPE:
     308             :             {
     309           0 :                 sal_Int16 nExchangeType = 0;
     310           0 :                 OSL_VERIFY( _rValue >>= nExchangeType );
     311             : 
     312           0 :                 Reference< XValueBinding > xBinding = m_pHelper->getCurrentBinding( );
     313           0 :                 if ( xBinding.is() )
     314             :                 {
     315           0 :                     bool bNeedIntegerBinding = ( nExchangeType == 1 );
     316           0 :                     if ( (bool)bNeedIntegerBinding != m_pHelper->isCellIntegerBinding( xBinding ) )
     317             :                     {
     318           0 :                         CellAddress aAddress;
     319           0 :                         if ( m_pHelper->getAddressFromCellBinding( xBinding, aAddress ) )
     320             :                         {
     321           0 :                             xBinding = m_pHelper->createCellBindingFromAddress( aAddress, bNeedIntegerBinding );
     322           0 :                             m_pHelper->setBinding( xBinding );
     323             :                         }
     324             :                     }
     325           0 :                 }
     326             :             }
     327           0 :             break;
     328             : 
     329             :             default:
     330             :                 OSL_FAIL( "CellBindingPropertyHandler::setPropertyValue: cannot handle this!" );
     331           0 :                 break;
     332             :             }
     333             : 
     334           0 :             impl_setContextDocumentModified_nothrow();
     335             : 
     336           0 :             Any aNewValue( getPropertyValue( _rPropertyName ) );
     337           0 :             firePropertyChange( _rPropertyName, nPropId, aOldValue, aNewValue );
     338             :             // TODO/UNOize: can't we make this a part of the base class, for all those "virtual"
     339             :             // properties? Base class'es |setPropertyValue| could call some |doSetPropertyValue|,
     340             :             // and handle the listener notification itself
     341             :         }
     342           0 :         catch( const Exception& )
     343             :         {
     344             :             OSL_FAIL( "CellBindingPropertyHandler::setPropertyValue: caught an exception!" );
     345           0 :         }
     346           0 :     }
     347             : 
     348             : 
     349           0 :     Any SAL_CALL CellBindingPropertyHandler::convertToPropertyValue( const OUString& _rPropertyName, const Any& _rControlValue ) throw (UnknownPropertyException, RuntimeException, std::exception)
     350             :     {
     351           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     352           0 :         Any aPropertyValue;
     353             : 
     354             :         OSL_ENSURE( m_pHelper.get(), "CellBindingPropertyHandler::convertToPropertyValue: we have no SupportedProperties!" );
     355           0 :         if ( !m_pHelper.get() )
     356           0 :             return aPropertyValue;
     357             : 
     358           0 :         PropertyId nPropId( m_pInfoService->getPropertyId( _rPropertyName ) );
     359             : 
     360           0 :         OUString sControlValue;
     361           0 :         OSL_VERIFY( _rControlValue >>= sControlValue );
     362           0 :         switch( nPropId )
     363             :         {
     364             :             case PROPERTY_ID_LIST_CELL_RANGE:
     365           0 :                 aPropertyValue <<= m_pHelper->createCellListSourceFromStringAddress( sControlValue );
     366           0 :                 break;
     367             : 
     368             :             case PROPERTY_ID_BOUND_CELL:
     369             :             {
     370             :                 // if we have the possibility of an integer binding, then we must preserve
     371             :                 // this property's value (e.g. if the current binding is an integer binding, then
     372             :                 // the newly created one must be, too)
     373           0 :                 bool bIntegerBinding = false;
     374           0 :                 if ( m_pHelper->isCellIntegerBindingAllowed() )
     375             :                 {
     376           0 :                     sal_Int16 nCurrentBindingType = 0;
     377           0 :                     getPropertyValue( PROPERTY_CELL_EXCHANGE_TYPE ) >>= nCurrentBindingType;
     378           0 :                     bIntegerBinding = ( nCurrentBindingType != 0 );
     379             :                 }
     380           0 :                 aPropertyValue <<= m_pHelper->createCellBindingFromStringAddress( sControlValue, bIntegerBinding );
     381             :             }
     382           0 :             break;
     383             : 
     384             :             case PROPERTY_ID_CELL_EXCHANGE_TYPE:
     385           0 :                 m_pCellExchangeConverter->getValueFromDescription( sControlValue, aPropertyValue );
     386           0 :                 break;
     387             : 
     388             :             default:
     389             :                 OSL_FAIL( "CellBindingPropertyHandler::convertToPropertyValue: cannot handle this!" );
     390           0 :                 break;
     391             :         }
     392             : 
     393           0 :         return aPropertyValue;
     394             :     }
     395             : 
     396             : 
     397           0 :     Any SAL_CALL CellBindingPropertyHandler::convertToControlValue( const OUString& _rPropertyName,
     398             :         const Any& _rPropertyValue, const Type& /*_rControlValueType*/ ) throw (UnknownPropertyException, RuntimeException, std::exception)
     399             :     {
     400           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     401           0 :         Any aControlValue;
     402             : 
     403             :         OSL_ENSURE( m_pHelper.get(), "CellBindingPropertyHandler::convertToControlValue: we have no SupportedProperties!" );
     404           0 :         if ( !m_pHelper.get() )
     405           0 :             return aControlValue;
     406             : 
     407           0 :         PropertyId nPropId( m_pInfoService->getPropertyId( _rPropertyName ) );
     408             : 
     409           0 :         switch ( nPropId )
     410             :         {
     411             :             case PROPERTY_ID_BOUND_CELL:
     412             :             {
     413           0 :                 Reference< XValueBinding > xBinding;
     414             : #if OSL_DEBUG_LEVEL > 0
     415             :                 bool bSuccess =
     416             : #endif
     417           0 :                 _rPropertyValue >>= xBinding;
     418             :                 OSL_ENSURE( bSuccess, "CellBindingPropertyHandler::convertToControlValue: invalid value (1)!" );
     419             : 
     420             :                 // the only value binding we support so far is linking to spreadsheet cells
     421           0 :                 aControlValue <<= m_pHelper->getStringAddressFromCellBinding( xBinding );
     422             :             }
     423           0 :             break;
     424             : 
     425             :             case PROPERTY_ID_LIST_CELL_RANGE:
     426             :             {
     427           0 :                 Reference< XListEntrySource > xSource;
     428             : #if OSL_DEBUG_LEVEL > 0
     429             :                 bool bSuccess =
     430             : #endif
     431           0 :                 _rPropertyValue >>= xSource;
     432             :                 OSL_ENSURE( bSuccess, "CellBindingPropertyHandler::convertToControlValue: invalid value (2)!" );
     433             : 
     434             :                 // the only value binding we support so far is linking to spreadsheet cells
     435           0 :                 aControlValue <<= m_pHelper->getStringAddressFromCellListSource( xSource );
     436             :             }
     437           0 :             break;
     438             : 
     439             :             case PROPERTY_ID_CELL_EXCHANGE_TYPE:
     440           0 :                 aControlValue <<= m_pCellExchangeConverter->getDescriptionForValue( _rPropertyValue );
     441           0 :                 break;
     442             : 
     443             :             default:
     444             :                 OSL_FAIL( "CellBindingPropertyHandler::convertToControlValue: cannot handle this!" );
     445           0 :                 break;
     446             :         }
     447             : 
     448           0 :         return aControlValue;
     449             :     }
     450             : 
     451             : 
     452           0 :     Sequence< Property > SAL_CALL CellBindingPropertyHandler::doDescribeSupportedProperties() const
     453             :     {
     454           0 :         ::std::vector< Property > aProperties;
     455             : 
     456           0 :         bool bAllowCellLinking      = m_pHelper.get() && m_pHelper->isCellBindingAllowed();
     457           0 :         bool bAllowCellIntLinking   = m_pHelper.get() && m_pHelper->isCellIntegerBindingAllowed();
     458           0 :         bool bAllowListCellRange    = m_pHelper.get() && m_pHelper->isListCellRangeAllowed();
     459           0 :         if ( bAllowCellLinking || bAllowListCellRange || bAllowCellIntLinking )
     460             :         {
     461             :             sal_Int32 nPos =  ( bAllowCellLinking    ? 1 : 0 )
     462           0 :                             + ( bAllowListCellRange  ? 1 : 0 )
     463           0 :                             + ( bAllowCellIntLinking ? 1 : 0 );
     464           0 :             aProperties.resize( nPos );
     465             : 
     466           0 :             if ( bAllowCellLinking )
     467             :             {
     468           0 :                 aProperties[ --nPos ] = Property( PROPERTY_BOUND_CELL, PROPERTY_ID_BOUND_CELL,
     469           0 :                     ::cppu::UnoType<OUString>::get(), 0 );
     470             :             }
     471           0 :             if ( bAllowCellIntLinking )
     472             :             {
     473           0 :                 aProperties[ --nPos ] = Property( PROPERTY_CELL_EXCHANGE_TYPE, PROPERTY_ID_CELL_EXCHANGE_TYPE,
     474           0 :                     ::cppu::UnoType<sal_Int16>::get(), 0 );
     475             :             }
     476           0 :             if ( bAllowListCellRange )
     477             :             {
     478           0 :                 aProperties[ --nPos ] = Property( PROPERTY_LIST_CELL_RANGE, PROPERTY_ID_LIST_CELL_RANGE,
     479           0 :                     ::cppu::UnoType<OUString>::get(), 0 );
     480             :             }
     481             :         }
     482             : 
     483           0 :         if ( aProperties.empty() )
     484           0 :             return Sequence< Property >();
     485           0 :         return Sequence< Property >( &(*aProperties.begin()), aProperties.size() );
     486             :     }
     487             : 
     488             : 
     489          12 : }   // namespace pcr
     490             : 
     491             : 
     492             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10