summaryrefslogtreecommitdiff
path: root/forms
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2013-04-22 17:34:50 +0200
committerLionel Elie Mamane <lionel@mamane.lu>2013-04-22 17:55:55 +0200
commita2c54dc208278afca127c049f069b48b2a35710e (patch)
treec745fa39f830f0674a2180744b2b4cbe479d8896 /forms
parent1e698bb7f1614f69caa5a30df64a47d18435c89b (diff)
ListBox: take care of validation (use binding value when appropriate)
Change-Id: I7c2ab0e42a82baa39e1b48124cc8cf58bfa126d5
Diffstat (limited to 'forms')
-rw-r--r--forms/source/component/ListBox.cxx15
-rw-r--r--forms/source/component/ListBox.hxx2
-rw-r--r--forms/source/inc/FormComponent.hxx2
3 files changed, 16 insertions, 3 deletions
diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx
index 18421abf8dfa..2ea90a99dacf 100644
--- a/forms/source/component/ListBox.cxx
+++ b/forms/source/component/ListBox.cxx
@@ -1513,6 +1513,13 @@ namespace frm
return aReturn;
}
+ //------------------------------------------------------------------------------
+ Any OListBoxModel::translateControlValueToValidatableValue( ) const
+ {
+ OSL_PRECOND( hasValidator(), "OListBoxModel::translateControlValueToValidatableValue: no validator, so why should I?" );
+ return getCurrentFormComponentValue();
+ }
+
//--------------------------------------------------------------------
Any OListBoxModel::getCurrentSingleValue() const
{
@@ -1552,8 +1559,12 @@ namespace frm
//--------------------------------------------------------------------
Any OListBoxModel::getCurrentFormComponentValue() const
{
- if ( hasValidator() )
- return OBoundControlModel::getCurrentFormComponentValue();
+ {
+ Reference< com::sun::star::form::validation::XValidator > vtor (const_cast<OListBoxModel*>(this)->getValidator());
+ Reference< XValueBinding > extBinding (const_cast<OListBoxModel*>(this)->getValueBinding());
+ if ( vtor.is() && vtor == extBinding )
+ return translateControlValueToExternalValue();
+ }
Any aCurrentValue;
diff --git a/forms/source/component/ListBox.hxx b/forms/source/component/ListBox.hxx
index 7b77883d6b0a..fe60540bd8b9 100644
--- a/forms/source/component/ListBox.hxx
+++ b/forms/source/component/ListBox.hxx
@@ -186,6 +186,8 @@ protected:
translateExternalValueToControlValue( const ::com::sun::star::uno::Any& _rExternalValue ) const;
virtual ::com::sun::star::uno::Any
translateControlValueToExternalValue( ) const;
+ virtual ::com::sun::star::uno::Any
+ translateControlValueToValidatableValue( ) const;
virtual sal_Bool commitControlValueToDbColumn( bool _bPostReset );
virtual void onConnectedDbColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxForm );
diff --git a/forms/source/inc/FormComponent.hxx b/forms/source/inc/FormComponent.hxx
index 69cb0922db17..85ddf90a2d0f 100644
--- a/forms/source/inc/FormComponent.hxx
+++ b/forms/source/inc/FormComponent.hxx
@@ -1081,7 +1081,7 @@ public:
virtual void SAL_CALL reloading( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL reloaded( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException);
-private:
+protected:
// XBindableValue
virtual void SAL_CALL setValueBinding( const ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding >& _rxBinding ) throw (::com::sun::star::form::binding::IncompatibleTypesException, ::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::binding::XValueBinding > SAL_CALL getValueBinding( ) throw (::com::sun::star::uno::RuntimeException);