diff options
author | Jan Holesovsky <kendy@suse.cz> | 2011-05-27 20:39:30 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2011-05-27 20:39:30 +0200 |
commit | 88c1a56d1127376284095465cf85f5b4e71a08e5 (patch) | |
tree | 4b7ae852d8a8b86f9125b9218d36faf574b9a1a7 /forms | |
parent | 779b389116e7112c7ca29cb08e56cfcb043ecc4d (diff) | |
parent | 84d9f0ceb2048550acf763879993348fb1cfb473 (diff) |
Merge remote-tracking branch 'origin/integration/dev300_m106'
Conflicts:
extensions/source/svg/svgaction.cxx
extensions/source/svg/svguno.cxx
package/source/xstor/owriteablestream.cxx
package/source/xstor/xstorage.cxx
package/source/zippackage/ZipPackageStream.cxx
setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java
Diffstat (limited to 'forms')
-rw-r--r-- | forms/source/component/Columns.cxx | 9 | ||||
-rw-r--r-- | forms/source/component/DatabaseForm.cxx | 2 | ||||
-rw-r--r-- | forms/source/component/Edit.cxx | 58 | ||||
-rw-r--r-- | forms/source/component/Edit.hxx | 1 | ||||
-rw-r--r-- | forms/source/component/Filter.cxx | 34 | ||||
-rw-r--r-- | forms/source/component/FormattedField.cxx | 4 |
6 files changed, 64 insertions, 44 deletions
diff --git a/forms/source/component/Columns.cxx b/forms/source/component/Columns.cxx index 9bc330360e56..f98b6cb862cc 100644 --- a/forms/source/component/Columns.cxx +++ b/forms/source/component/Columns.cxx @@ -42,9 +42,11 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/form/binding/XBindableValue.hpp> #include <com/sun/star/beans/XPropertyContainer.hpp> +#include <com/sun/star/text/XText.hpp> #include <comphelper/sequence.hxx> #include <comphelper/property.hxx> #include <comphelper/basicio.hxx> +#include <comphelper/types.hxx> #include "services.hxx" #include "frm_resource.hrc" #include <tools/debug.hxx> @@ -63,6 +65,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; @@ -173,6 +176,7 @@ Sequence<Type> 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() ); @@ -180,6 +184,10 @@ Sequence<Type> 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(); } @@ -192,6 +200,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; diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index a6a14e652f62..fbde5883ebcf 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -2904,7 +2904,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 diff --git a/forms/source/component/Edit.cxx b/forms/source/component/Edit.cxx index d745a1b3837a..260acf5d97cb 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 e3c84612443f..bbe7063c66f1 100644 --- a/forms/source/component/Edit.hxx +++ b/forms/source/component/Edit.hxx @@ -45,7 +45,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 <TRUE/> when we change the MaxTextLen of the aggregate diff --git a/forms/source/component/Filter.cxx b/forms/source/component/Filter.cxx index 69643053bed8..4decc560fa4b 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 ); diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx index 871385c207a6..9d0170078da1 100644 --- a/forms/source/component/FormattedField.cxx +++ b/forms/source/component/FormattedField.cxx @@ -1038,10 +1038,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 ); } |