From c0ec842414bb213c7124a2c4d9745231d508fe6d Mon Sep 17 00:00:00 2001 From: "Ocke.Janssen" Date: Fri, 26 Nov 2010 15:22:57 +0100 Subject: dba34c: #i94053# remove lastvalue --- forms/source/component/Edit.cxx | 58 ++++++++++++++++++----------------------- forms/source/component/Edit.hxx | 1 - 2 files changed, 25 insertions(+), 34 deletions(-) (limited to 'forms/source') diff --git a/forms/source/component/Edit.cxx b/forms/source/component/Edit.cxx index 3a36078a7fed..f409e154096c 100644 --- a/forms/source/component/Edit.cxx +++ b/forms/source/component/Edit.cxx @@ -675,7 +675,6 @@ sal_Bool OEditModel::approveDbColumnType( sal_Int32 _nColumnType ) void OEditModel::resetNoBroadcast() { OEditBaseModel::resetNoBroadcast(); - m_aLastKnownValue.clear(); } //------------------------------------------------------------------------------ @@ -683,38 +682,34 @@ sal_Bool OEditModel::commitControlValueToDbColumn( bool /*_bPostReset*/ ) { Any aNewValue( m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ) ); - if ( aNewValue != m_aLastKnownValue ) - { - ::rtl::OUString sNewValue; - aNewValue >>= sNewValue; + ::rtl::OUString sNewValue; + aNewValue >>= sNewValue; - if ( !aNewValue.hasValue() - || ( !sNewValue.getLength() // an empty string - && m_bEmptyIsNull // which should be interpreted as NULL - ) + if ( !aNewValue.hasValue() + || ( !sNewValue.getLength() // an empty string + && m_bEmptyIsNull // which should be interpreted as NULL ) + ) + { + m_xColumnUpdate->updateNull(); + } + else + { + OSL_PRECOND( m_pValueFormatter.get(), "OEditModel::commitControlValueToDbColumn: no value formatter!" ); + try { - m_xColumnUpdate->updateNull(); - } - else - { - OSL_PRECOND( m_pValueFormatter.get(), "OEditModel::commitControlValueToDbColumn: no value formatter!" ); - try + if ( m_pValueFormatter.get() ) { - if ( m_pValueFormatter.get() ) - { - if ( !m_pValueFormatter->setFormattedValue( sNewValue ) ) - return sal_False; - } - else - m_xColumnUpdate->updateString( sNewValue ); - } - catch ( const Exception& ) - { - return sal_False; + if ( !m_pValueFormatter->setFormattedValue( sNewValue ) ) + return sal_False; } + else + m_xColumnUpdate->updateString( sNewValue ); + } + catch ( const Exception& ) + { + return sal_False; } - m_aLastKnownValue = aNewValue; } return sal_True; @@ -724,6 +719,7 @@ sal_Bool OEditModel::commitControlValueToDbColumn( bool /*_bPostReset*/ ) Any OEditModel::translateDbColumnToControlValue() { OSL_PRECOND( m_pValueFormatter.get(), "OEditModel::translateDbColumnToControlValue: no value formatter!" ); + Any aRet; if ( m_pValueFormatter.get() ) { ::rtl::OUString sValue( m_pValueFormatter->getFormattedValue() ); @@ -732,7 +728,6 @@ Any OEditModel::translateDbColumnToControlValue() && m_pValueFormatter->getColumn()->wasNull() ) { - m_aLastKnownValue.clear(); } else { @@ -744,14 +739,11 @@ Any OEditModel::translateDbColumnToControlValue() sValue = sValue.replaceAt( nMaxTextLen, nDiff, ::rtl::OUString() ); } - m_aLastKnownValue <<= sValue; + aRet <<= sValue; } } - else - m_aLastKnownValue.clear(); - return m_aLastKnownValue.hasValue() ? m_aLastKnownValue : makeAny( ::rtl::OUString() ); - // (m_aLastKnownValue is alllowed to be VOID, the control value isn't) + return aRet.hasValue() ? aRet : makeAny( ::rtl::OUString() ); } //------------------------------------------------------------------------------ diff --git a/forms/source/component/Edit.hxx b/forms/source/component/Edit.hxx index 5b4146b82d06..3b4c7c55a436 100644 --- a/forms/source/component/Edit.hxx +++ b/forms/source/component/Edit.hxx @@ -44,7 +44,6 @@ namespace frm class OEditModel :public OEditBaseModel { - ::com::sun::star::uno::Any m_aLastKnownValue; ::std::auto_ptr< ::dbtools::FormattedColumnValue > m_pValueFormatter; sal_Bool m_bMaxTextLenModified : 1; // set to when we change the MaxTextLen of the aggregate -- cgit From 6697a4827b4dd0aee507840c4c1ebf6e19186282 Mon Sep 17 00:00:00 2001 From: "Ocke.Janssen" Date: Thu, 2 Dec 2010 13:16:48 +0100 Subject: dba34c: #i102625# only fetch rows when the view moves outside the scope of the rowset window --- forms/source/component/DatabaseForm.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'forms/source') diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index 154ed4b00272..31f933f136bc 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -2905,7 +2905,7 @@ void ODatabaseForm::load_impl(sal_Bool bCausedByParentForm, sal_Bool bMoveToFirs // a database form always uses caching // we use starting fetchsize with at least 10 rows if (bConnected) - m_xAggregateSet->setPropertyValue(PROPERTY_FETCHSIZE, makeAny((sal_Int32)10)); + m_xAggregateSet->setPropertyValue(PROPERTY_FETCHSIZE, makeAny((sal_Int32)40)); // if we're loaded as sub form we got a "rowSetChanged" from the parent rowset _before_ we got the "loaded" // so we don't need to execute the statement again, this was already done -- cgit From e89ecedf654df0267c260ef2dc489be1b261fb5a Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Mon, 3 Jan 2011 13:58:05 +0100 Subject: dba34c: #i110323# fix for double --- forms/source/component/FormattedField.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'forms/source') diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx index 697b39d4931e..193ed4b1a693 100644 --- a/forms/source/component/FormattedField.cxx +++ b/forms/source/component/FormattedField.cxx @@ -1040,10 +1040,10 @@ sal_Bool OFormattedModel::commitControlValueToDbColumn( bool /*_bPostReset*/ ) m_xColumnUpdate->updateNull(); else { - // als Value koennen nur double, string oder void auftreten try { - if ( aControlValue.getValueType().getTypeClass() == TypeClass_DOUBLE ) + double f = 0.0; + if ( aControlValue.getValueType().getTypeClass() == TypeClass_DOUBLE || (aControlValue >>= f)) // #i110323 { DBTypeConversion::setValue( m_xColumnUpdate, m_aNullDate, getDouble( aControlValue ), m_nKeyType ); } -- cgit From 41e6c179e73191e15ad24af4d7fa18aff4878f8d Mon Sep 17 00:00:00 2001 From: "Ocke.Janssen" Date: Mon, 17 Jan 2011 10:11:36 +0100 Subject: dba34d: #i111015# XTextRange and derivee are not supported anymore by column object --- forms/source/component/Columns.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'forms/source') diff --git a/forms/source/component/Columns.cxx b/forms/source/component/Columns.cxx index a93d121d4b99..f8559fa2fbac 100644 --- a/forms/source/component/Columns.cxx +++ b/forms/source/component/Columns.cxx @@ -43,9 +43,11 @@ #include #include #include +#include #include #include #include +#include #include "services.hxx" #ifndef _FRM_RESOURCE_HRC_ #include "frm_resource.hrc" @@ -66,6 +68,7 @@ using namespace ::com::sun::star::awt; using namespace ::com::sun::star::io; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::util; +using namespace ::com::sun::star::text; using namespace ::com::sun::star::form::binding; const sal_uInt16 WIDTH = 0x0001; @@ -176,6 +179,7 @@ Sequence SAL_CALL OGridColumn::getTypes() throw(RuntimeException) aTypes.removeType( XServiceInfo::static_type() ); aTypes.removeType( XBindableValue::static_type() ); aTypes.removeType( XPropertyContainer::static_type() ); + // but re-add their base class(es) aTypes.addType( XChild::static_type() ); @@ -183,6 +187,10 @@ Sequence SAL_CALL OGridColumn::getTypes() throw(RuntimeException) if ( query_aggregation( m_xAggregate, xProv )) aTypes.addTypes( xProv->getTypes() ); + aTypes.removeType( XTextRange::static_type() ); + aTypes.removeType( XSimpleText::static_type() ); + aTypes.removeType( XText::static_type() ); + return aTypes.getTypes(); } @@ -195,6 +203,7 @@ Any SAL_CALL OGridColumn::queryAggregation( const Type& _rType ) throw (RuntimeE || _rType.equals(::getCppuType(static_cast< Reference< XServiceInfo >* >(NULL))) || _rType.equals(::getCppuType(static_cast< Reference< XBindableValue >* >(NULL))) || _rType.equals(::getCppuType(static_cast< Reference< XPropertyContainer >* >(NULL))) + || comphelper::isAssignableFrom(::getCppuType(static_cast< Reference< XTextRange >* >(NULL)),_rType) ) return aReturn; -- cgit From 4c47c0802599e0d24c192ed0cb73b5d64fbfc421 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 16 Feb 2011 14:35:27 +0100 Subject: dba34d: #i116215# de-select all items when the to-be-selected string is invalid or empty --- forms/source/component/Filter.cxx | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'forms/source') diff --git a/forms/source/component/Filter.cxx b/forms/source/component/Filter.cxx index f9f17524756f..a5159679c9de 100644 --- a/forms/source/component/Filter.cxx +++ b/forms/source/component/Filter.cxx @@ -631,19 +631,39 @@ namespace frm if (xListBox.is()) { m_aText = aText; - xListBox->selectItem(m_aText, sal_True); - if ( xListBox->getSelectedItemPos() >= 0 ) + MapString2String::const_iterator itemPos = m_aDisplayItemToValueItem.find( m_aText ); + if ( itemPos == m_aDisplayItemToValueItem.end() ) { - const bool isQuoted = ( aText.getLength() > 0 ) - && ( aText[0] == '\'' ) - && ( aText[aText.getLength() - 1] == '\'' ); + const bool isQuoted = ( m_aText.getLength() > 1 ) + && ( m_aText[0] == '\'' ) + && ( m_aText[ m_aText.getLength() - 1 ] == '\'' ); if ( isQuoted ) { - xListBox->selectItem( aText.copy( 1, aText.getLength() - 2 ), sal_True ); + m_aText = m_aText.copy( 1, m_aText.getLength() - 2 ); + itemPos = m_aDisplayItemToValueItem.find( m_aText ); } } + + OSL_ENSURE( ( itemPos != m_aDisplayItemToValueItem.end() ) || ( m_aText.getLength() == 0 ), + "OFilterControl::setText: this text is not in my display list!" ); + if ( itemPos == m_aDisplayItemToValueItem.end() ) + m_aText = ::rtl::OUString(); + + if ( m_aText.getLength() == 0) + { + while ( xListBox->getSelectedItemPos() >= 0 ) + { + xListBox->selectItemPos( xListBox->getSelectedItemPos(), sal_False ); + } + } + else + { + xListBox->selectItem( m_aText, sal_True ); + } } - } break; + } + break; + default: { Reference< XTextComponent > xText( getPeer(), UNO_QUERY ); -- cgit