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