1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: eformspropertyhandler.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_extensions.hxx"
33 #include "eformspropertyhandler.hxx"
34 #include "formstrings.hxx"
35 #include "formmetadata.hxx"
36 #ifndef EXTENSIONS_INC_EXTENSIO_HRC
37 #include "extensio.hrc"
39 #include "formbrowsertools.hxx"
40 #include "eformshelper.hxx"
41 #include "handlerhelper.hxx"
43 /** === begin UNO includes === **/
44 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
45 #include <com/sun/star/inspection/PropertyControlType.hpp>
46 #include <com/sun/star/inspection/XObjectInspectorUI.hpp>
47 /** === end UNO includes === **/
48 #include <tools/debug.hxx>
52 //------------------------------------------------------------------------
53 extern "C" void SAL_CALL
createRegistryInfo_EFormsPropertyHandler()
55 ::pcr::EFormsPropertyHandler::registerImplementation();
58 //........................................................................
61 //........................................................................
63 using namespace ::com::sun::star
;
64 using namespace ::com::sun::star::uno
;
65 using namespace ::com::sun::star::lang
;
66 using namespace ::com::sun::star::beans
;
67 using namespace ::com::sun::star::xforms
;
68 using namespace ::com::sun::star::script
;
69 using namespace ::com::sun::star::ui::dialogs
;
70 using namespace ::com::sun::star::form::binding
;
71 using namespace ::com::sun::star::inspection
;
73 //====================================================================
74 //= EFormsPropertyHandler
75 //====================================================================
76 DBG_NAME( EFormsPropertyHandler
)
77 //--------------------------------------------------------------------
78 EFormsPropertyHandler::EFormsPropertyHandler( const Reference
< XComponentContext
>& _rxContext
)
79 :EFormsPropertyHandler_Base( _rxContext
)
80 ,m_bSimulatingModelChange( false )
82 DBG_CTOR( EFormsPropertyHandler
, NULL
);
85 //--------------------------------------------------------------------
86 EFormsPropertyHandler::~EFormsPropertyHandler( )
88 DBG_DTOR( EFormsPropertyHandler
, NULL
);
91 //--------------------------------------------------------------------
92 ::rtl::OUString SAL_CALL
EFormsPropertyHandler::getImplementationName_static( ) throw (RuntimeException
)
94 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.extensions.EFormsPropertyHandler" ) );
97 //--------------------------------------------------------------------
98 Sequence
< ::rtl::OUString
> SAL_CALL
EFormsPropertyHandler::getSupportedServiceNames_static( ) throw (RuntimeException
)
100 Sequence
< ::rtl::OUString
> aSupported( 1 );
101 aSupported
[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.inspection.XMLFormsPropertyHandler" ) );
105 //--------------------------------------------------------------------
106 ::rtl::OUString
EFormsPropertyHandler::getModelNamePropertyValue() const
108 ::rtl::OUString sModelName
= m_pHelper
->getCurrentFormModelName();
109 if ( !sModelName
.getLength() )
110 sModelName
= m_sBindingLessModelName
;
114 //--------------------------------------------------------------------
115 Any SAL_CALL
EFormsPropertyHandler::getPropertyValue( const ::rtl::OUString
& _rPropertyName
) throw (UnknownPropertyException
, RuntimeException
)
117 ::osl::MutexGuard
aGuard( m_aMutex
);
118 PropertyId
nPropId( impl_getPropertyId_throw( _rPropertyName
) );
120 OSL_ENSURE( m_pHelper
.get(), "EFormsPropertyHandler::getPropertyValue: we don't have any SupportedProperties!" );
121 // if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties
128 case PROPERTY_ID_LIST_BINDING
:
129 aReturn
<<= m_pHelper
->getCurrentListSourceBinding();
132 case PROPERTY_ID_XML_DATA_MODEL
:
133 aReturn
<<= getModelNamePropertyValue();
136 case PROPERTY_ID_BINDING_NAME
:
137 aReturn
<<= m_pHelper
->getCurrentBindingName();
140 case PROPERTY_ID_BIND_EXPRESSION
:
141 case PROPERTY_ID_XSD_CONSTRAINT
:
142 case PROPERTY_ID_XSD_CALCULATION
:
143 case PROPERTY_ID_XSD_REQUIRED
:
144 case PROPERTY_ID_XSD_RELEVANT
:
145 case PROPERTY_ID_XSD_READONLY
:
147 Reference
< XPropertySet
> xBindingProps( m_pHelper
->getCurrentBinding() );
148 if ( xBindingProps
.is() )
150 aReturn
= xBindingProps
->getPropertyValue( _rPropertyName
);
151 DBG_ASSERT( aReturn
.getValueType().equals( ::getCppuType( static_cast< ::rtl::OUString
* >( NULL
) ) ),
152 "EFormsPropertyHandler::getPropertyValue: invalid BindingExpression value type!" );
155 aReturn
<<= ::rtl::OUString();
160 DBG_ERROR( "EFormsPropertyHandler::getPropertyValue: cannot handle this property!" );
164 catch( const Exception
& )
166 #if OSL_DEBUG_LEVEL > 0
167 ::rtl::OString
sMessage( "EFormsPropertyHandler::getPropertyValue: caught an exception!" );
168 sMessage
+= "\n(have been asked for the \"";
169 sMessage
+= ::rtl::OString( _rPropertyName
.getStr(), _rPropertyName
.getLength(), RTL_TEXTENCODING_ASCII_US
);
170 sMessage
+= "\" property.)";
171 OSL_ENSURE( sal_False
, sMessage
.getStr() );
177 //--------------------------------------------------------------------
178 void SAL_CALL
EFormsPropertyHandler::setPropertyValue( const ::rtl::OUString
& _rPropertyName
, const Any
& _rValue
) throw (UnknownPropertyException
, RuntimeException
)
180 ::osl::MutexGuard
aGuard( m_aMutex
);
181 PropertyId
nPropId( impl_getPropertyId_throw( _rPropertyName
) );
183 OSL_ENSURE( m_pHelper
.get(), "EFormsPropertyHandler::setPropertyValue: we don't have any SupportedProperties!" );
184 // if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties
188 Any aOldValue
= getPropertyValue( _rPropertyName
);
192 case PROPERTY_ID_LIST_BINDING
:
194 Reference
< XListEntrySource
> xSource
;
195 OSL_VERIFY( _rValue
>>= xSource
);
196 m_pHelper
->setListSourceBinding( xSource
);
200 case PROPERTY_ID_XML_DATA_MODEL
:
202 OSL_VERIFY( _rValue
>>= m_sBindingLessModelName
);
204 // if the model changed, reset the binding to NULL
205 if ( m_pHelper
->getCurrentFormModelName() != m_sBindingLessModelName
)
207 ::rtl::OUString sOldBindingName
= m_pHelper
->getCurrentBindingName();
208 m_pHelper
->setBinding( NULL
);
209 firePropertyChange( PROPERTY_BINDING_NAME
, PROPERTY_ID_BINDING_NAME
,
210 makeAny( sOldBindingName
), makeAny( ::rtl::OUString() ) );
215 case PROPERTY_ID_BINDING_NAME
:
217 ::rtl::OUString sNewBindingName
;
218 OSL_VERIFY( _rValue
>>= sNewBindingName
);
220 bool bPreviouslyEmptyModel
= !m_pHelper
->getCurrentFormModel().is();
222 Reference
< XPropertySet
> xNewBinding
;
223 if ( sNewBindingName
.getLength() )
224 // obtain the binding with this name, for the current model
225 xNewBinding
= m_pHelper
->getOrCreateBindingForModel( getModelNamePropertyValue(), sNewBindingName
);
227 m_pHelper
->setBinding( xNewBinding
);
229 if ( bPreviouslyEmptyModel
)
230 { // simulate a property change for the model property
231 // This is because we "simulate" the Model property by remembering the
232 // value ourself. Other instances might, however, not know this value,
233 // but prefer to retrieve it somewhere else - e.g. from the EFormsHelper
235 // The really correct solution would be if *all* property handlers
236 // obtain a "current property value" for *all* properties from a central
237 // instance. Then, handler A could ask it for the value of property
238 // X, and this request would be re-routed to handler B, which ultimately
239 // knows the current value.
240 // However, there's no such mechanism in place currently.
241 m_bSimulatingModelChange
= true;
242 firePropertyChange( PROPERTY_XML_DATA_MODEL
, PROPERTY_ID_XML_DATA_MODEL
,
243 makeAny( ::rtl::OUString() ), makeAny( getModelNamePropertyValue() ) );
244 m_bSimulatingModelChange
= false;
249 case PROPERTY_ID_BIND_EXPRESSION
:
251 Reference
< XPropertySet
> xBinding( m_pHelper
->getCurrentBinding() );
252 OSL_ENSURE( xBinding
.is(), "You should not reach this without an active binding!" );
254 xBinding
->setPropertyValue( PROPERTY_BIND_EXPRESSION
, _rValue
);
258 case PROPERTY_ID_XSD_REQUIRED
:
259 case PROPERTY_ID_XSD_RELEVANT
:
260 case PROPERTY_ID_XSD_READONLY
:
261 case PROPERTY_ID_XSD_CONSTRAINT
:
262 case PROPERTY_ID_XSD_CALCULATION
:
264 Reference
< XPropertySet
> xBindingProps( m_pHelper
->getCurrentBinding() );
265 DBG_ASSERT( xBindingProps
.is(), "EFormsPropertyHandler::setPropertyValue: how can I set a property if there's no binding?" );
266 if ( xBindingProps
.is() )
268 DBG_ASSERT( _rValue
.getValueType().equals( ::getCppuType( static_cast< ::rtl::OUString
* >( NULL
) ) ),
269 "EFormsPropertyHandler::setPropertyValue: invalid value type!" );
270 xBindingProps
->setPropertyValue( _rPropertyName
, _rValue
);
276 DBG_ERROR( "EFormsPropertyHandler::setPropertyValue: cannot handle this property!" );
280 impl_setContextDocumentModified_nothrow();
282 Any
aNewValue( getPropertyValue( _rPropertyName
) );
283 firePropertyChange( _rPropertyName
, nPropId
, aOldValue
, aNewValue
);
285 catch( const Exception
& )
287 OSL_ENSURE( sal_False
, "EFormsPropertyHandler::setPropertyValue: caught an exception!" );
291 //--------------------------------------------------------------------
292 void EFormsPropertyHandler::onNewComponent()
294 EFormsPropertyHandler_Base::onNewComponent();
296 Reference
< frame::XModel
> xDocument( impl_getContextDocument_nothrow() );
297 DBG_ASSERT( xDocument
.is(), "EFormsPropertyHandler::onNewComponent: no document!" );
298 if ( EFormsHelper::isEForm( xDocument
) )
299 m_pHelper
.reset( new EFormsHelper( m_aMutex
, m_xComponent
, xDocument
) );
301 m_pHelper
.reset( NULL
);
304 //--------------------------------------------------------------------
305 Sequence
< Property
> SAL_CALL
EFormsPropertyHandler::doDescribeSupportedProperties() const
307 ::std::vector
< Property
> aProperties
;
309 if ( m_pHelper
.get() )
311 if ( m_pHelper
->canBindToAnyDataType() )
313 aProperties
.reserve( 7 );
314 addStringPropertyDescription( aProperties
, PROPERTY_XML_DATA_MODEL
);
315 addStringPropertyDescription( aProperties
, PROPERTY_BINDING_NAME
);
316 addStringPropertyDescription( aProperties
, PROPERTY_BIND_EXPRESSION
);
317 addStringPropertyDescription( aProperties
, PROPERTY_XSD_REQUIRED
);
318 addStringPropertyDescription( aProperties
, PROPERTY_XSD_RELEVANT
);
319 addStringPropertyDescription( aProperties
, PROPERTY_XSD_READONLY
);
320 addStringPropertyDescription( aProperties
, PROPERTY_XSD_CONSTRAINT
);
321 addStringPropertyDescription( aProperties
, PROPERTY_XSD_CALCULATION
);
323 if ( m_pHelper
->isListEntrySink() )
325 implAddPropertyDescription( aProperties
, PROPERTY_LIST_BINDING
,
326 ::getCppuType( static_cast< Reference
< XListEntrySource
> * >( NULL
) ) );
330 if ( aProperties
.empty() )
331 return Sequence
< Property
>();
332 return Sequence
< Property
>( &(*aProperties
.begin()), aProperties
.size() );
335 //--------------------------------------------------------------------
336 Any SAL_CALL
EFormsPropertyHandler::convertToPropertyValue( const ::rtl::OUString
& _rPropertyName
, const Any
& _rControlValue
) throw (UnknownPropertyException
, RuntimeException
)
338 ::osl::MutexGuard
aGuard( m_aMutex
);
341 OSL_ENSURE( m_pHelper
.get(), "EFormsPropertyHandler::convertToPropertyValue: we have no SupportedProperties!" );
342 if ( !m_pHelper
.get() )
345 PropertyId
nPropId( m_pInfoService
->getPropertyId( _rPropertyName
) );
347 ::rtl::OUString sControlValue
;
350 case PROPERTY_ID_LIST_BINDING
:
352 OSL_VERIFY( _rControlValue
>>= sControlValue
);
353 Reference
< XListEntrySource
> xListSource( m_pHelper
->getModelElementFromUIName( EFormsHelper::Binding
, sControlValue
), UNO_QUERY
);
354 OSL_ENSURE( xListSource
.is() || !m_pHelper
->getModelElementFromUIName( EFormsHelper::Binding
, sControlValue
).is(),
355 "EFormsPropertyHandler::convertToPropertyValue: there's a binding which is no ListEntrySource!" );
356 aReturn
<<= xListSource
;
361 aReturn
= EFormsPropertyHandler_Base::convertToPropertyValue( _rPropertyName
, _rControlValue
);
368 //--------------------------------------------------------------------
369 Any SAL_CALL
EFormsPropertyHandler::convertToControlValue( const ::rtl::OUString
& _rPropertyName
, const Any
& _rPropertyValue
, const Type
& _rControlValueType
) throw (UnknownPropertyException
, RuntimeException
)
371 ::osl::MutexGuard
aGuard( m_aMutex
);
374 OSL_ENSURE( m_pHelper
.get(), "EFormsPropertyHandler::convertToControlValue: we have no SupportedProperties!" );
375 if ( !m_pHelper
.get() )
378 PropertyId
nPropId( m_pInfoService
->getPropertyId( _rPropertyName
) );
380 OSL_ENSURE( _rControlValueType
.getTypeClass() == TypeClass_STRING
,
381 "EFormsPropertyHandler::convertToControlValue: all our controls should use strings for value exchange!" );
385 case PROPERTY_ID_LIST_BINDING
:
387 Reference
< XPropertySet
> xListSourceBinding( _rPropertyValue
, UNO_QUERY
);
388 if ( xListSourceBinding
.is() )
389 aReturn
<<= m_pHelper
->getModelElementUIName( EFormsHelper::Binding
, xListSourceBinding
);
394 aReturn
= EFormsPropertyHandler_Base::convertToControlValue( _rPropertyName
, _rPropertyValue
, _rControlValueType
);
401 //--------------------------------------------------------------------
402 Sequence
< ::rtl::OUString
> SAL_CALL
EFormsPropertyHandler::getActuatingProperties( ) throw (RuntimeException
)
404 ::osl::MutexGuard
aGuard( m_aMutex
);
405 if ( !m_pHelper
.get() )
406 return Sequence
< ::rtl::OUString
>();
408 ::std::vector
< ::rtl::OUString
> aInterestedInActuations( 2 );
409 aInterestedInActuations
[ 0 ] = PROPERTY_XML_DATA_MODEL
;
410 aInterestedInActuations
[ 1 ] = PROPERTY_BINDING_NAME
;
411 return Sequence
< ::rtl::OUString
>( &(*aInterestedInActuations
.begin()), aInterestedInActuations
.size() );
414 //--------------------------------------------------------------------
415 Sequence
< ::rtl::OUString
> SAL_CALL
EFormsPropertyHandler::getSupersededProperties( ) throw (RuntimeException
)
417 ::osl::MutexGuard
aGuard( m_aMutex
);
418 if ( !m_pHelper
.get() )
419 return Sequence
< ::rtl::OUString
>();
421 Sequence
< ::rtl::OUString
> aReturn( 1 );
422 aReturn
[ 0 ] = PROPERTY_INPUT_REQUIRED
;
426 //--------------------------------------------------------------------
427 LineDescriptor SAL_CALL
EFormsPropertyHandler::describePropertyLine( const ::rtl::OUString
& _rPropertyName
,
428 const Reference
< XPropertyControlFactory
>& _rxControlFactory
)
429 throw (UnknownPropertyException
, NullPointerException
, RuntimeException
)
431 ::osl::MutexGuard
aGuard( m_aMutex
);
432 if ( !_rxControlFactory
.is() )
433 throw NullPointerException();
434 if ( !m_pHelper
.get() )
435 throw RuntimeException();
437 LineDescriptor aDescriptor
;
438 sal_Int16 nControlType
= PropertyControlType::TextField
;
439 ::std::vector
< ::rtl::OUString
> aListEntries
;
440 PropertyId
nPropId( impl_getPropertyId_throw( _rPropertyName
) );
443 case PROPERTY_ID_LIST_BINDING
:
444 nControlType
= PropertyControlType::ListBox
;
445 const_cast< EFormsHelper
* >( m_pHelper
.get() )->getAllElementUINames( EFormsHelper::Binding
, aListEntries
, true );
448 case PROPERTY_ID_XML_DATA_MODEL
:
449 nControlType
= PropertyControlType::ListBox
;
450 m_pHelper
->getFormModelNames( aListEntries
);
453 case PROPERTY_ID_BINDING_NAME
:
455 nControlType
= PropertyControlType::ComboBox
;
456 ::rtl::OUString
sCurrentModel( getModelNamePropertyValue() );
457 if ( sCurrentModel
.getLength() )
458 m_pHelper
->getBindingNames( sCurrentModel
, aListEntries
);
462 case PROPERTY_ID_BIND_EXPRESSION
: aDescriptor
.PrimaryButtonId
= UID_PROP_DLG_BIND_EXPRESSION
; break;
463 case PROPERTY_ID_XSD_REQUIRED
: aDescriptor
.PrimaryButtonId
= UID_PROP_DLG_XSD_REQUIRED
; break;
464 case PROPERTY_ID_XSD_RELEVANT
: aDescriptor
.PrimaryButtonId
= UID_PROP_DLG_XSD_RELEVANT
; break;
465 case PROPERTY_ID_XSD_READONLY
: aDescriptor
.PrimaryButtonId
= UID_PROP_DLG_XSD_READONLY
; break;
466 case PROPERTY_ID_XSD_CONSTRAINT
: aDescriptor
.PrimaryButtonId
= UID_PROP_DLG_XSD_CONSTRAINT
; break;
467 case PROPERTY_ID_XSD_CALCULATION
: aDescriptor
.PrimaryButtonId
= UID_PROP_DLG_XSD_CALCULATION
; break;
470 DBG_ERROR( "EFormsPropertyHandler::describePropertyLine: cannot handle this property!" );
474 switch ( nControlType
)
476 case PropertyControlType::ListBox
:
477 aDescriptor
.Control
= PropertyHandlerHelper::createListBoxControl( _rxControlFactory
, aListEntries
, sal_False
, sal_True
);
479 case PropertyControlType::ComboBox
:
480 aDescriptor
.Control
= PropertyHandlerHelper::createComboBoxControl( _rxControlFactory
, aListEntries
, sal_False
, sal_True
);
483 aDescriptor
.Control
= _rxControlFactory
->createPropertyControl( nControlType
, sal_False
);
487 aDescriptor
.DisplayName
= m_pInfoService
->getPropertyTranslation( nPropId
);
488 aDescriptor
.Category
= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Data" ) );
489 aDescriptor
.HelpURL
= HelpIdUrl::getHelpURL( m_pInfoService
->getPropertyHelpId( nPropId
) );
493 //--------------------------------------------------------------------
494 InteractiveSelectionResult SAL_CALL
EFormsPropertyHandler::onInteractivePropertySelection( const ::rtl::OUString
& _rPropertyName
, sal_Bool
/*_bPrimary*/, Any
& _rData
, const Reference
< XObjectInspectorUI
>& _rxInspectorUI
) throw (UnknownPropertyException
, NullPointerException
, RuntimeException
)
496 if ( !_rxInspectorUI
.is() )
497 throw NullPointerException();
499 ::osl::MutexGuard
aGuard( m_aMutex
);
500 OSL_ENSURE( m_pHelper
.get(), "EFormsPropertyHandler::onInteractivePropertySelection: we do not have any SupportedProperties!" );
501 if ( !m_pHelper
.get() )
502 return InteractiveSelectionResult_Cancelled
;
504 PropertyId
nPropId( impl_getPropertyId_throw( _rPropertyName
) );
506 OSL_ENSURE( ( PROPERTY_ID_BINDING_NAME
== nPropId
)
507 || ( PROPERTY_ID_BIND_EXPRESSION
== nPropId
)
508 || ( PROPERTY_ID_XSD_REQUIRED
== nPropId
)
509 || ( PROPERTY_ID_XSD_RELEVANT
== nPropId
)
510 || ( PROPERTY_ID_XSD_READONLY
== nPropId
)
511 || ( PROPERTY_ID_XSD_CONSTRAINT
== nPropId
)
512 || ( PROPERTY_ID_XSD_CALCULATION
== nPropId
), "EFormsPropertyHandler::onInteractivePropertySelection: unexpected!" );
516 Reference
< XExecutableDialog
> xDialog
;
517 m_aContext
.createComponent( "com.sun.star.xforms.ui.dialogs.AddCondition", xDialog
);
518 Reference
< XPropertySet
> xDialogProps( xDialog
, UNO_QUERY_THROW
);
520 // the model for the dialog to work with
521 Reference
< xforms::XModel
> xModel( m_pHelper
->getCurrentFormModel() );
522 // the binding for the dialog to work with
523 Reference
< XPropertySet
> xBinding( m_pHelper
->getCurrentBinding() );
524 // the aspect of the binding which the dialog should modify
525 ::rtl::OUString
sFacetName( _rPropertyName
);
527 OSL_ENSURE( xModel
.is() && xBinding
.is() && sFacetName
.getLength(),
528 "EFormsPropertyHandler::onInteractivePropertySelection: something is missing for the dialog initialization!" );
529 if ( !( xModel
.is() && xBinding
.is() && sFacetName
.getLength() ) )
530 return InteractiveSelectionResult_Cancelled
;
532 xDialogProps
->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FormModel" ) ), makeAny( xModel
) );
533 xDialogProps
->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Binding" ) ), makeAny( xBinding
) );
534 xDialogProps
->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FacetName" ) ), makeAny( sFacetName
) );
536 if ( !xDialog
->execute() )
538 return InteractiveSelectionResult_Cancelled
;
540 _rData
= xDialogProps
->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ConditionValue" ) ) );
541 return InteractiveSelectionResult_ObtainedValue
;
543 catch( const Exception
& )
545 OSL_ENSURE( sal_False
, "EFormsPropertyHandler::onInteractivePropertySelection: caught an exception!" );
548 // something went wrong here ...(but has been asserted already)
549 return InteractiveSelectionResult_Cancelled
;
552 //--------------------------------------------------------------------
553 void SAL_CALL
EFormsPropertyHandler::addPropertyChangeListener( const Reference
< XPropertyChangeListener
>& _rxListener
) throw (RuntimeException
)
555 ::osl::MutexGuard
aGuard( m_aMutex
);
556 EFormsPropertyHandler_Base::addPropertyChangeListener( _rxListener
);
557 if ( m_pHelper
.get() )
558 m_pHelper
->registerBindingListener( _rxListener
);
561 //--------------------------------------------------------------------
562 void SAL_CALL
EFormsPropertyHandler::removePropertyChangeListener( const Reference
< XPropertyChangeListener
>& _rxListener
) throw (RuntimeException
)
564 ::osl::MutexGuard
aGuard( m_aMutex
);
565 if ( m_pHelper
.get() )
566 m_pHelper
->revokeBindingListener( _rxListener
);
567 EFormsPropertyHandler_Base::removePropertyChangeListener( _rxListener
);
570 //--------------------------------------------------------------------
571 void SAL_CALL
EFormsPropertyHandler::actuatingPropertyChanged( const ::rtl::OUString
& _rActuatingPropertyName
, const Any
& _rNewValue
, const Any
& /*_rOldValue*/, const Reference
< XObjectInspectorUI
>& _rxInspectorUI
, sal_Bool
) throw (NullPointerException
, RuntimeException
)
573 if ( !_rxInspectorUI
.is() )
574 throw NullPointerException();
576 ::osl::MutexGuard
aGuard( m_aMutex
);
577 PropertyId
nActuatingPropId( impl_getPropertyId_throw( _rActuatingPropertyName
) );
578 OSL_PRECOND( m_pHelper
.get(), "EFormsPropertyHandler::actuatingPropertyChanged: inconsistentcy!" );
579 // if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties
581 DBG_ASSERT( _rxInspectorUI
.is(), "EFormsPropertyHandler::actuatingPropertyChanged: invalid callback!" );
582 if ( !_rxInspectorUI
.is() )
585 switch ( nActuatingPropId
)
587 case PROPERTY_ID_XML_DATA_MODEL
:
589 if ( m_bSimulatingModelChange
)
591 ::rtl::OUString sDataModelName
;
592 OSL_VERIFY( _rNewValue
>>= sDataModelName
);
593 sal_Bool bBoundToSomeModel
= 0 != sDataModelName
.getLength();
594 _rxInspectorUI
->rebuildPropertyUI( PROPERTY_BINDING_NAME
);
595 _rxInspectorUI
->enablePropertyUI( PROPERTY_BINDING_NAME
, bBoundToSomeModel
);
599 case PROPERTY_ID_BINDING_NAME
:
601 sal_Bool bHaveABinding
= ( m_pHelper
->getCurrentBindingName().getLength() > 0 );
602 _rxInspectorUI
->enablePropertyUI( PROPERTY_BIND_EXPRESSION
, bHaveABinding
);
603 _rxInspectorUI
->enablePropertyUI( PROPERTY_XSD_REQUIRED
, bHaveABinding
);
604 _rxInspectorUI
->enablePropertyUI( PROPERTY_XSD_RELEVANT
, bHaveABinding
);
605 _rxInspectorUI
->enablePropertyUI( PROPERTY_XSD_READONLY
, bHaveABinding
);
606 _rxInspectorUI
->enablePropertyUI( PROPERTY_XSD_CONSTRAINT
, bHaveABinding
);
607 _rxInspectorUI
->enablePropertyUI( PROPERTY_XSD_CALCULATION
, bHaveABinding
);
608 _rxInspectorUI
->enablePropertyUI( PROPERTY_XSD_DATA_TYPE
, bHaveABinding
);
613 DBG_ERROR( "EFormsPropertyHandler::actuatingPropertyChanged: cannot handle this property!" );
618 //........................................................................
620 //........................................................................