diff options
author | Eike Rathke <erack@redhat.com> | 2017-02-11 01:17:12 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-02-11 01:19:37 +0100 |
commit | d3293c7173210e0246d0dc29377f687f41588da2 (patch) | |
tree | f44faff71d99dfe6cec402c2abbb9b06bd834e23 /forms/source | |
parent | b46ed21a33849d2268406feb875f46bc925a65ec (diff) |
Revert "Resolves: tdf#79250 add typed list to form control listbox"
This reverts commit e387b69967aabc44d5da5aaad8d94191437dc57c.
It breaks toolkit.subsequentcheck with
propertyChangeListener wasn´t called for ´TypedItemList´
Back to the drawing board for the twisted property logic of forms and
toolkit uno control models.
Diffstat (limited to 'forms/source')
-rw-r--r-- | forms/source/component/ComboBox.cxx | 17 | ||||
-rw-r--r-- | forms/source/component/ListBox.cxx | 47 | ||||
-rw-r--r-- | forms/source/component/entrylisthelper.cxx | 54 | ||||
-rw-r--r-- | forms/source/component/entrylisthelper.hxx | 13 | ||||
-rw-r--r-- | forms/source/inc/frm_strings.hxx | 1 | ||||
-rw-r--r-- | forms/source/inc/property.hrc | 2 |
6 files changed, 8 insertions, 126 deletions
diff --git a/forms/source/component/ComboBox.cxx b/forms/source/component/ComboBox.cxx index dd419a171ff4..57ff1e6b2122 100644 --- a/forms/source/component/ComboBox.cxx +++ b/forms/source/component/ComboBox.cxx @@ -193,10 +193,6 @@ void OComboBoxModel::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) cons _rValue <<= comphelper::containerToSequence(getStringItemList()); break; - case PROPERTY_ID_TYPEDITEMLIST: - _rValue <<= getTypedItemList(); - break; - default: OBoundControlModel::getFastPropertyValue(_rValue, _nHandle); } @@ -251,11 +247,6 @@ void OComboBoxModel::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const } break; - // XXX NOTE: PROPERTY_ID_TYPEDITEMLIST not handled here because only - // set for external sources in which case not even - // setNewStringItemList() for PROPERTY_ID_STRINGITEMLIST above should - // had been called ... - default: OBoundControlModel::setFastPropertyValue_NoBroadcast(_nHandle, _rValue); } @@ -313,7 +304,6 @@ void OComboBoxModel::describeAggregateProperties( Sequence< Property >& _rAggreg // superseded properties: RemoveProperty( _rAggregateProps, PROPERTY_STRINGITEMLIST ); - RemoveProperty( _rAggregateProps, PROPERTY_TYPEDITEMLIST ); } @@ -442,7 +432,6 @@ void SAL_CALL OComboBoxModel::read(const Reference<css::io::XObjectInputStream>& ) { setFastPropertyValue( PROPERTY_ID_STRINGITEMLIST, makeAny( css::uno::Sequence<OUString>() ) ); - setFastPropertyValue( PROPERTY_ID_TYPEDITEMLIST, makeAny( css::uno::Sequence<css::uno::Any>() ) ); } if (nVersion > 0x0004) @@ -666,8 +655,6 @@ void OComboBoxModel::loadData( bool _bForce ) // Set String-Sequence at ListBox setFastPropertyValue( PROPERTY_ID_STRINGITEMLIST, makeAny( comphelper::containerToSequence(aStringList) ) ); - // Reset TypedItemList, no matching data. - setFastPropertyValue( PROPERTY_ID_TYPEDITEMLIST, makeAny( css::uno::Sequence<css::uno::Any>() ) ); } @@ -778,7 +765,6 @@ bool OComboBoxModel::commitControlValueToDbColumn( bool _bPostReset ) aStringItemList.getArray()[ nOldLen ] = sNewValue; setFastPropertyValue( PROPERTY_ID_STRINGITEMLIST, makeAny( aStringItemList ) ); - setFastPropertyValue( PROPERTY_ID_TYPEDITEMLIST, makeAny( css::uno::Sequence<css::uno::Any>() ) ); } } } @@ -824,10 +810,7 @@ Any OComboBoxModel::getDefaultForReset() const void OComboBoxModel::stringItemListChanged( ControlModelLock& /*_rInstanceLock*/ ) { if ( m_xAggregateSet.is() ) - { m_xAggregateSet->setPropertyValue( PROPERTY_STRINGITEMLIST, makeAny( comphelper::containerToSequence(getStringItemList()) ) ); - m_xAggregateSet->setPropertyValue( PROPERTY_TYPEDITEMLIST, makeAny( getTypedItemList()) ) ; - } } diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index 5fd3e9b96a0f..2b5426f23a6c 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -147,7 +147,6 @@ namespace frm void OListBoxModel::init() { startAggregatePropertyListening( PROPERTY_STRINGITEMLIST ); - startAggregatePropertyListening( PROPERTY_TYPEDITEMLIST ); } @@ -287,10 +286,6 @@ namespace frm _rValue <<= comphelper::containerToSequence(getStringItemList()); break; - case PROPERTY_ID_TYPEDITEMLIST: - _rValue <<= getTypedItemList(); - break; - default: OBoundControlModel::getFastPropertyValue(_rValue, _nHandle); } @@ -387,10 +382,6 @@ namespace frm resetNoBroadcast(); break; - case PROPERTY_ID_TYPEDITEMLIST: - /* TODO: anything? */ - break; - default: OBoundControlModel::setFastPropertyValue_NoBroadcast(_nHandle, _rValue); } @@ -443,10 +434,6 @@ namespace frm bModified = convertNewListSourceProperty( _rConvertedValue, _rOldValue, _rValue ); break; - case PROPERTY_ID_TYPEDITEMLIST: - /* TODO: anything? */ - break; - default: return OBoundControlModel::convertFastPropertyValue(_rConvertedValue, _rOldValue, _nHandle, _rValue); } @@ -518,7 +505,6 @@ namespace frm // <----- SYNCHRONIZED return; } - // XXX NOTE: PROPERTY_TYPEDITEMLIST not handled, used only with external list source. OBoundControlModel::_propertyChanged( i_rEvent ); } @@ -529,7 +515,6 @@ namespace frm // superseded properties: RemoveProperty( _rAggregateProps, PROPERTY_STRINGITEMLIST ); - RemoveProperty( _rAggregateProps, PROPERTY_TYPEDITEMLIST ); } @@ -684,7 +669,6 @@ namespace frm ) { setFastPropertyValue( PROPERTY_ID_STRINGITEMLIST, makeAny( css::uno::Sequence<OUString>() ) ); - setFastPropertyValue( PROPERTY_ID_TYPEDITEMLIST, makeAny( css::uno::Sequence<css::uno::Any>() ) ); } if (nVersion > 3) @@ -1007,7 +991,6 @@ namespace frm setBoundValues(aValueList); setFastPropertyValue( PROPERTY_ID_STRINGITEMLIST, makeAny( lcl_convertToStringSequence( aDisplayList ) ) ); - setFastPropertyValue( PROPERTY_ID_TYPEDITEMLIST, makeAny( css::uno::Sequence<css::uno::Any>() ) ); } @@ -1473,26 +1456,6 @@ namespace frm }; - Any lcl_getSingleSelectedEntryTyped( const Sequence< sal_Int16 >& _rSelectSequence, const Sequence<Any>& _rTypedList ) - { - Any aReturn; - - // by definition, multiple selected entries are transferred as NULL if the - // binding does not support lists - if ( _rSelectSequence.getLength() <= 1 ) - { - if ( _rSelectSequence.getLength() == 1 ) - { - sal_Int32 nIndex = _rSelectSequence[0]; - if (0 <= nIndex && nIndex < _rTypedList.getLength()) - aReturn = _rTypedList[nIndex]; - } - } - - return aReturn; - } - - Any lcl_getSingleSelectedEntry( const Sequence< sal_Int16 >& _rSelectSequence, const std::vector< OUString >& _rStringList ) { Any aReturn; @@ -1623,14 +1586,7 @@ namespace frm break; case eEntry: - { - const std::vector<OUString>& rStrings = getStringItemList(); - const Sequence<Any>& rValues = getTypedItemList(); - if (rStrings.size() == static_cast<size_t>(rValues.getLength())) - aReturn = lcl_getSingleSelectedEntryTyped( aSelectSequence, rValues ); - else - aReturn = lcl_getSingleSelectedEntry( aSelectSequence, rStrings ); - } + aReturn = lcl_getSingleSelectedEntry( aSelectSequence, getStringItemList() ); break; } @@ -1733,7 +1689,6 @@ namespace frm try { m_xAggregateSet->setPropertyValue( PROPERTY_STRINGITEMLIST, makeAny( comphelper::containerToSequence(getStringItemList()) ) ); - m_xAggregateSet->setPropertyValue( PROPERTY_TYPEDITEMLIST, makeAny( getTypedItemList() ) ); } catch( const Exception& ) { diff --git a/forms/source/component/entrylisthelper.cxx b/forms/source/component/entrylisthelper.cxx index 4e9202be73da..b306256463f9 100644 --- a/forms/source/component/entrylisthelper.cxx +++ b/forms/source/component/entrylisthelper.cxx @@ -23,7 +23,6 @@ #include <osl/diagnose.h> #include <comphelper/sequence.hxx> #include <comphelper/property.hxx> -#include <com/sun/star/form/binding/XListEntryTypedSource.hpp> #include <algorithm> @@ -93,8 +92,6 @@ namespace frm ) { m_aStringItems[ _rEvent.Position ] = _rEvent.Entries[ 0 ]; - if (m_aTypedItems.getLength()) - m_aTypedItems = Sequence<Any>(); // doesn't match anymore stringItemListChanged( aLock ); } } @@ -115,8 +112,7 @@ namespace frm ) { m_aStringItems.insert(m_aStringItems.begin() + _rEvent.Position, _rEvent.Entries.begin(), _rEvent.Entries.end()); - if (m_aTypedItems.getLength()) - m_aTypedItems = Sequence<Any>(); // doesn't match anymore + stringItemListChanged( aLock ); } } @@ -138,26 +134,6 @@ namespace frm { m_aStringItems.erase(m_aStringItems.begin() + _rEvent.Position, m_aStringItems.begin() + _rEvent.Position + _rEvent.Count ); - if (_rEvent.Position + _rEvent.Count <= m_aTypedItems.getLength()) - { - Sequence<Any> aTmp( m_aTypedItems.getLength() - _rEvent.Count ); - sal_Int32 nStop = _rEvent.Position; - sal_Int32 i = 0; - for ( ; i < nStop; ++i) - { - aTmp[i] = m_aTypedItems[i]; - } - nStop = aTmp.getLength(); - for (sal_Int32 j = _rEvent.Position + _rEvent.Count; i < nStop; ++i, ++j) - { - aTmp[i] = m_aTypedItems[j]; - } - m_aTypedItems = aTmp; - } - else if (m_aTypedItems.getLength()) - { - m_aTypedItems = Sequence<Any>(); // doesn't match anymore - } stringItemListChanged( aLock ); } } @@ -208,7 +184,10 @@ namespace frm void OEntryListHelper::impl_lock_refreshList( ControlModelLock& _rInstanceLock ) { if ( hasExternalListSource() ) - obtainListSourceEntries( _rInstanceLock ); + { + comphelper::sequenceToContainer(m_aStringItems, m_xListSource->getAllListEntries()); + stringItemListChanged( _rInstanceLock ); + } else refreshInternalEntryList(); } @@ -272,7 +251,8 @@ namespace frm // be notified when the list changes ... m_xListSource->addListEntryListener( this ); - obtainListSourceEntries( _rInstanceLock ); + comphelper::sequenceToContainer( m_aStringItems, m_xListSource->getAllListEntries() ); + stringItemListChanged( _rInstanceLock ); // let derivees react on the new list source connectedExternalListSource(); @@ -280,24 +260,6 @@ namespace frm } - void OEntryListHelper::obtainListSourceEntries( ControlModelLock& _rInstanceLock ) - { - Reference< XListEntryTypedSource > xTyped; - xTyped.set( m_xListSource, UNO_QUERY); - if (xTyped.is()) - { - comphelper::sequenceToContainer( m_aStringItems, xTyped->getAllListEntriesTyped( m_aTypedItems)); - } - else - { - comphelper::sequenceToContainer( m_aStringItems, m_xListSource->getAllListEntries()); - if (m_aTypedItems.getLength()) - m_aTypedItems = Sequence<Any>(); - } - stringItemListChanged( _rInstanceLock ); - } - - bool OEntryListHelper::convertNewListSourceProperty( Any& _rConvertedValue, Any& _rOldValue, const Any& _rValue ) { @@ -315,8 +277,6 @@ namespace frm css::uno::Sequence<OUString> aTmp; OSL_VERIFY( _rValue >>= aTmp ); comphelper::sequenceToContainer(m_aStringItems, aTmp); - if (m_aTypedItems.getLength()) - m_aTypedItems = Sequence<Any>(); // doesn't match anymore stringItemListChanged( _rInstanceLock ); } diff --git a/forms/source/component/entrylisthelper.hxx b/forms/source/component/entrylisthelper.hxx index 3ad407c6fea7..3ae722c92e3e 100644 --- a/forms/source/component/entrylisthelper.hxx +++ b/forms/source/component/entrylisthelper.hxx @@ -53,8 +53,6 @@ namespace frm m_xListSource; /// our external list source std::vector< OUString > m_aStringItems; /// "overridden" StringItemList property value - css::uno::Sequence< css::uno::Any > - m_aTypedItems; /// "overridden" TypedItemList property value ::comphelper::OInterfaceContainerHelper2 m_aRefreshListeners; @@ -68,10 +66,6 @@ namespace frm inline const std::vector< OUString >& getStringItemList() const { return m_aStringItems; } - /// returns the current typed item list - inline const css::uno::Sequence< css::uno::Any >& - getTypedItemList() const { return m_aTypedItems; } - /// determines whether we actually have an external list source inline bool hasExternalListSource( ) const { return m_xListSource.is(); } @@ -167,13 +161,6 @@ namespace frm ControlModelLock& _rInstanceLock ); - /** obtains list entries and possibly data values from list source - - @precond - m_xListSource has to hold an external list source - */ - void obtainListSourceEntries( ControlModelLock& _rInstanceLock ); - /** refreshes our list entries In case we have an external list source, its used to obtain the new entries, and then diff --git a/forms/source/inc/frm_strings.hxx b/forms/source/inc/frm_strings.hxx index 868772abc744..7415ebee90ea 100644 --- a/forms/source/inc/frm_strings.hxx +++ b/forms/source/inc/frm_strings.hxx @@ -70,7 +70,6 @@ namespace frm #define PROPERTY_HIDDEN_VALUE "HiddenValue" #define PROPERTY_BUTTONTYPE "ButtonType" #define PROPERTY_STRINGITEMLIST "StringItemList" - #define PROPERTY_TYPEDITEMLIST "TypedItemList" #define PROPERTY_DEFAULT_TEXT "DefaultText" #define PROPERTY_DEFAULT_STATE "DefaultState" #define PROPERTY_FORMATKEY "FormatKey" diff --git a/forms/source/inc/property.hrc b/forms/source/inc/property.hrc index 57b6202d085e..2086db0c94ed 100644 --- a/forms/source/inc/property.hrc +++ b/forms/source/inc/property.hrc @@ -292,8 +292,6 @@ namespace frm #define PROPERTY_ID_CONTROL_TYPE_IN_MSO ( PROPERTY_ID_START + 261 ) #define PROPERTY_ID_OBJ_ID_IN_MSO ( PROPERTY_ID_START + 262 ) -#define PROPERTY_ID_TYPEDITEMLIST ( PROPERTY_ID_START + 263 ) // Sequence<Any> - // start ID fuer aggregierte Properties #define PROPERTY_ID_AGGREGATE_ID (PROPERTY_ID_START + 10000) |