Index: sc/source/ui/vba/vbavalidation.cxx =================================================================== --- sc/source/ui/vba/vbavalidation.cxx (revision 1241588) +++ sc/source/ui/vba/vbavalidation.cxx (working copy) @@ -21,6 +21,7 @@ #include "vbavalidation.hxx" +#include "vbaformatcondition.hxx" //liuchen 2009-11-11 #include #include #include @@ -222,7 +223,7 @@ lcl_setValidationProps( m_xRange, xProps ); } void SAL_CALL -ScVbaValidation::Add( const uno::Any& Type, const uno::Any& AlertStyle, const uno::Any& /*Operator*/, const uno::Any& Formula1, const uno::Any& Formula2 ) throw (uno::RuntimeException) +ScVbaValidation::Add( const uno::Any& Type, const uno::Any& AlertStyle, const uno::Any& Operator, const uno::Any& Formula1, const uno::Any& Formula2 ) throw (uno::RuntimeException) { uno::Reference< beans::XPropertySet > xProps( lcl_getValidationProps( m_xRange ) ); uno::Reference< sheet::XSheetCondition > xCond( xProps, uno::UNO_QUERY_THROW ); @@ -287,6 +288,13 @@ xProps->setPropertyValue( ALERTSTYLE, uno::makeAny( eStyle ) ); + //liuchen 2009-11-11 fix the defect that validation cannot work when the input should be limited between a lower bound and an upper bound + if ( Operator.hasValue() ) + { + css::sheet::ConditionOperator conOperator = ScVbaFormatCondition::retrieveAPIOperator( Operator ); + xCond->setOperator( conOperator ); + } //liuchen 2009-11-11 + if ( sFormula1.getLength() ) xCond->setFormula1( sFormula1 ); if ( sFormula2.getLength() )