From c070ae66b97fc0662e97a96048741b0f56a5157a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 1 Nov 2010 12:05:01 +0100 Subject: dba34a: during #i115312#: getFastPropertyValue( FILTER ): don't deliver an invalid filter when one predicate string cannot be generated, instead just skip this particular string --- svx/source/form/formcontroller.cxx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'svx') diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx index b2c79c9cd9bc..8bc10453b55f 100644 --- a/svx/source/form/formcontroller.cxx +++ b/svx/source/form/formcontroller.cxx @@ -865,15 +865,13 @@ void FormController::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) cons if ( aFilter.getLength() ) aFilter.appendAscii( " OR " ); - aFilter.appendAscii( "( " ); + ::rtl::OUStringBuffer aRowFilter; for ( FmFilterRow::const_iterator condition = rRow.begin(); condition != rRow.end(); ++condition ) { // get the field of the controls map Reference< XControl > xControl( condition->first, UNO_QUERY_THROW ); Reference< XPropertySet > xModelProps( xControl->getModel(), UNO_QUERY_THROW ); Reference< XPropertySet > xField( xModelProps->getPropertyValue( FM_PROP_BOUNDFIELD ), UNO_QUERY_THROW ); - if ( condition != rRow.begin() ) - aFilter.appendAscii( " AND " ); sal_Int32 nDataType = DataType::OTHER; OSL_VERIFY( xField->getPropertyValue( FM_PROP_FIELDTYPE ) >>= nDataType ); @@ -897,10 +895,17 @@ void FormController::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) cons { // don't use a parse context here, we need it unlocalized xParseNode->parseNodeToStr( sCriteria, xConnection, NULL ); - aFilter.append( sCriteria ); + if ( condition != rRow.begin() ) + aRowFilter.appendAscii( " AND " ); + aRowFilter.append( sCriteria ); } } - aFilter.appendAscii( " )" ); + if ( aRowFilter.getLength() > 0 ) + { + aFilter.appendAscii( "( " ); + aFilter.append( aRowFilter.makeStringAndClear() ); + aFilter.appendAscii( " )" ); + } } } catch( const Exception& ) -- cgit