diff options
author | sb <sb@openoffice.org> | 2010-04-21 22:01:20 +0200 |
---|---|---|
committer | sb <sb@openoffice.org> | 2010-04-21 22:01:20 +0200 |
commit | a96cf58dd04981626950691cd387c9979fae6c36 (patch) | |
tree | 7bb691fef136c6ca7d570088ba40324ecd3b3fa7 /forms/source/component | |
parent | c6cdbc5217ccaf2d06370ff51dc019396cbacfe7 (diff) | |
parent | 2165e104cf4e670d14075da4c6d938865f9bb8ad (diff) |
sb120: merged in DEV300_m77
Diffstat (limited to 'forms/source/component')
-rw-r--r-- | forms/source/component/Columns.cxx | 20 | ||||
-rw-r--r-- | forms/source/component/ListBox.cxx | 22 | ||||
-rw-r--r-- | forms/source/component/ListBox.hxx | 5 |
3 files changed, 29 insertions, 18 deletions
diff --git a/forms/source/component/Columns.cxx b/forms/source/component/Columns.cxx index 5473c9446..1c5de4df8 100644 --- a/forms/source/component/Columns.cxx +++ b/forms/source/component/Columns.cxx @@ -32,6 +32,7 @@ #include "property.hrc" #endif #include "property.hxx" +#include "componenttools.hxx" #include "ids.hxx" #include "findpos.hxx" #include <com/sun/star/io/XPersistObject.hpp> @@ -169,11 +170,20 @@ Sequence<sal_Int8> SAL_CALL OGridColumn::getImplementationId() throw(RuntimeExce //------------------------------------------------------------------ Sequence<Type> SAL_CALL OGridColumn::getTypes() throw(RuntimeException) { - Reference<XTypeProvider> xProv; - - if (query_aggregation(m_xAggregate, xProv)) - return concatSequences(OGridColumn_BASE::getTypes(), xProv->getTypes()); - return OGridColumn_BASE::getTypes(); + TypeBag aTypes( OGridColumn_BASE::getTypes() ); + // erase the types which we do not support + aTypes.removeType( XFormComponent::static_type() ); + 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() ); + + Reference< XTypeProvider > xProv; + if ( query_aggregation( m_xAggregate, xProv )) + aTypes.addTypes( xProv->getTypes() ); + + return aTypes.getTypes(); } //------------------------------------------------------------------ diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index 8c00f5ea1..23a679ba1 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -41,7 +41,6 @@ /** === begin UNO includes === **/ #include <com/sun/star/util/XNumberFormatTypes.hpp> #include <com/sun/star/sdbc/XRowSet.hpp> -#include <com/sun/star/sdbc/DataType.hpp> #include <com/sun/star/container/XIndexAccess.hpp> #include <com/sun/star/sdb/XSQLQueryComposerFactory.hpp> #include <com/sun/star/sdb/XQueriesSupplier.hpp> @@ -167,7 +166,7 @@ namespace frm ,OErrorBroadcaster( OComponentHelper::rBHelper ) ,m_aListRowSet( getContext() ) ,m_nNULLPos(-1) - ,m_bBoundComponent(sal_False) + ,m_nBoundColumnType( DataType::SQLNULL ) { DBG_CTOR(OListBoxModel,NULL); @@ -189,7 +188,7 @@ namespace frm ,m_aBoundValues( _pOriginal->m_aBoundValues ) ,m_aDefaultSelectSeq( _pOriginal->m_aDefaultSelectSeq ) ,m_nNULLPos(-1) - ,m_bBoundComponent(sal_False) + ,m_nBoundColumnType( DataType::SQLNULL ) { DBG_CTOR(OListBoxModel,NULL); } @@ -629,7 +628,7 @@ namespace frm DBG_ASSERT( !hasExternalListSource(), "OListBoxModel::loadData: cannot load from DB when I have an external list source!" ); m_nNULLPos = -1; - m_bBoundComponent = sal_False; + m_nBoundColumnType = DataType::SQLNULL; // pre-requisites: // PRE1: connection @@ -832,20 +831,19 @@ namespace frm ::dbtools::FormattedColumnValue aValueFormatter( getContext(), m_xCursor, xDataField ); // Feld der BoundColumn des ResultSets holen - sal_Int32 nBoundColumnType = DataType::SQLNULL; + m_nBoundColumnType = DataType::SQLNULL; if ( ( nBoundColumn > 0 ) && m_xColumn.is() ) { // don't look for a bound column if we're not connected to a field try { Reference< XPropertySet > xBoundField( xColumns->getByIndex( nBoundColumn ), UNO_QUERY_THROW ); - OSL_VERIFY( xBoundField->getPropertyValue( ::rtl::OUString::createFromAscii( "Type" ) ) >>= nBoundColumnType ); + OSL_VERIFY( xBoundField->getPropertyValue( ::rtl::OUString::createFromAscii( "Type" ) ) >>= m_nBoundColumnType ); } catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } } - m_bBoundComponent = ( nBoundColumnType != DataType::SQLNULL ); // Ist die LB an ein Feld gebunden und sind Leereintraege zulaessig // dann wird die Position fuer einen Leereintrag gemerkt @@ -860,9 +858,9 @@ namespace frm aStr = aValueFormatter.getFormattedValue(); aDisplayList.push_back( aStr ); - if ( m_bBoundComponent ) + if ( impl_hasBoundComponent() ) { - aBoundValue.fill( nBoundColumn + 1, nBoundColumnType, xCursorRow ); + aBoundValue.fill( nBoundColumn + 1, m_nBoundColumnType, xCursorRow ); aValueList.push_back( aBoundValue ); } @@ -907,7 +905,7 @@ namespace frm // NULL eintrag hinzufuegen if (bUseNULL && m_nNULLPos == -1) { - if ( m_bBoundComponent ) + if ( impl_hasBoundComponent() ) aValueList.insert( aValueList.begin(), ORowSetValue() ); aDisplayList.insert( aDisplayList.begin(), ORowSetValue( ::rtl::OUString() ) ); @@ -940,7 +938,7 @@ namespace frm { ValueList().swap(m_aBoundValues); m_nNULLPos = -1; - m_bBoundComponent = sal_False; + m_nBoundColumnType = DataType::SQLNULL; if ( !hasExternalListSource() ) setFastPropertyValue( PROPERTY_ID_STRINGITEMLIST, makeAny( StringSequence() ) ); @@ -1035,7 +1033,7 @@ namespace frm Sequence< sal_Int16 > aSelectionIndicies; ORowSetValue aCurrentValue; - aCurrentValue.fill( getFieldType(), m_xColumn ); + aCurrentValue.fill( impl_hasBoundComponent() ? m_nBoundColumnType : getFieldType(), m_xColumn ); // reset selection for NULL values if ( aCurrentValue.isNull() ) diff --git a/forms/source/component/ListBox.hxx b/forms/source/component/ListBox.hxx index 6b84bcc0e..28260794a 100644 --- a/forms/source/component/ListBox.hxx +++ b/forms/source/component/ListBox.hxx @@ -41,6 +41,7 @@ #include <com/sun/star/awt/XFocusListener.hpp> #include <com/sun/star/awt/XListBox.hpp> #include <com/sun/star/form/XChangeBroadcaster.hpp> +#include <com/sun/star/sdbc/DataType.hpp> /** === end UNO includes === **/ #include <comphelper/asyncnotification.hxx> @@ -82,7 +83,7 @@ class OListBoxModel :public OBoundControlModel // </properties> sal_Int16 m_nNULLPos; // position of the NULL value in our list - sal_Bool m_bBoundComponent : 1; + sal_Int32 m_nBoundColumnType; private: ::connectivity::ORowSetValue getFirstSelectedValue() const; @@ -177,6 +178,8 @@ private: void impl_refreshDbEntryList( bool _bForce ); ValueList impl_getValues() const; + + bool impl_hasBoundComponent() const { return m_nBoundColumnType != ::com::sun::star::sdbc::DataType::SQLNULL; } }; //================================================================== |