Kaydet (Commit) 89abc2a2 authored tarafından Rüdiger Timm's avatar Rüdiger Timm

INTEGRATION: CWS dba24f_SRC680 (1.55.18); FILE MERGED

2008/01/14 10:31:32 fs 1.55.18.1: #i85215# don't reset m_aValueSeq prematurely
üst 7318c02c
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
* *
* $RCSfile: ListBox.cxx,v $ * $RCSfile: ListBox.cxx,v $
* *
* $Revision: 1.55 $ * $Revision: 1.56 $
* *
* last change: $Author: ihi $ $Date: 2007-11-21 17:16:39 $ * last change: $Author: rt $ $Date: 2008-01-29 14:39:37 $
* *
* The Contents of this file are made available subject to * The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1. * the terms of GNU Lesser General Public License Version 2.1.
...@@ -318,7 +318,6 @@ namespace frm ...@@ -318,7 +318,6 @@ namespace frm
// listbox is already connected to a database, and no external list source // listbox is already connected to a database, and no external list source
// data source changed -> refresh // data source changed -> refresh
loadData(); loadData();
break; break;
case PROPERTY_ID_VALUE_SEQ : case PROPERTY_ID_VALUE_SEQ :
...@@ -613,32 +612,30 @@ namespace frm ...@@ -613,32 +612,30 @@ namespace frm
m_nNULLPos = -1; m_nNULLPos = -1;
m_bBoundComponent = sal_False; m_bBoundComponent = sal_False;
// Connection holen // pre-requisites:
Reference<XRowSet> xForm(m_xCursor, UNO_QUERY); // PRE1: connection
if (!xForm.is()) Reference< XConnection > xConnection;
return; // is the active connection of our form
Reference<XConnection> xConnection = getConnection(xForm); Reference< XPropertySet > xFormProps( m_xCursor, UNO_QUERY );
if (!xConnection.is()) if ( xFormProps.is() )
return; xFormProps->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ) >>= xConnection;
// we need a com::sun::star::sdb::Connection for some of the code below ... // PRE2: list source
Reference<XServiceInfo> xServiceInfo(xConnection, UNO_QUERY); ::rtl::OUString sListSource;
if (!xServiceInfo.is() || !xServiceInfo->supportsService(SRV_SDB_CONNECTION)) // if our list source type is no value list, we need to concatenete
// the single list source elements
const ::rtl::OUString* pListSourceItem = m_aListSourceSeq.getConstArray();
sal_Int32 i(0);
for ( i=0; i<m_aListSourceSeq.getLength(); ++i, ++pListSourceItem )
sListSource = sListSource + *pListSourceItem;
// outta here if we don't have all pre-requisites
if ( !xConnection.is() || !sListSource.getLength() )
{ {
DBG_ERROR("OListBoxModel::loadData : invalid connection !"); m_aValueSeq = StringSequence();
return; return;
} }
// Wenn der ListSourceType keine Werteliste ist,
// muss die String-Seq zu einem String zusammengefasst werden
::rtl::OUString sListSource;
const ::rtl::OUString* pustrListSouceStrings = m_aListSourceSeq.getConstArray();
sal_Int32 i;
for (i=0; i<m_aListSourceSeq.getLength(); ++i)
sListSource = sListSource + pustrListSouceStrings[i];
if (!sListSource.getLength())
return;
sal_Int16 nBoundColumn = 0; sal_Int16 nBoundColumn = 0;
if (m_aBoundColumn.getValueType().getTypeClass() == TypeClass_SHORT) if (m_aBoundColumn.getValueType().getTypeClass() == TypeClass_SHORT)
m_aBoundColumn >>= nBoundColumn; m_aBoundColumn >>= nBoundColumn;
...@@ -691,10 +688,9 @@ namespace frm ...@@ -691,10 +688,9 @@ namespace frm
Reference<XSQLQueryComposer> xComposer = xFactory->createQueryComposer(); Reference<XSQLQueryComposer> xComposer = xFactory->createQueryComposer();
try try
{ {
Reference<XPropertySet> xFormAsSet(xForm, UNO_QUERY);
::rtl::OUString aStatement; ::rtl::OUString aStatement;
xFormAsSet->getPropertyValue(PROPERTY_ACTIVECOMMAND) >>= aStatement; xFormProps->getPropertyValue( PROPERTY_ACTIVECOMMAND ) >>= aStatement;
xComposer->setQuery(aStatement); xComposer->setQuery( aStatement );
} }
catch(Exception&) catch(Exception&)
{ {
...@@ -814,7 +810,7 @@ namespace frm ...@@ -814,7 +810,7 @@ namespace frm
if ( !xDataField.is() ) if ( !xDataField.is() )
return; return;
::dbtools::FormattedColumnValue aValueFormatter( getContext(), xForm, xDataField ); ::dbtools::FormattedColumnValue aValueFormatter( getContext(), m_xCursor, xDataField );
// Feld der BoundColumn des ResultSets holen // Feld der BoundColumn des ResultSets holen
Reference<XColumn> xBoundField; Reference<XColumn> xBoundField;
...@@ -890,15 +886,15 @@ namespace frm ...@@ -890,15 +886,15 @@ namespace frm
} }
m_aValueSeq.realloc(aValueList.size()); m_aValueSeq.realloc(aValueList.size());
::rtl::OUString* pustrValues = m_aValueSeq.getArray(); ::rtl::OUString* pValues = m_aValueSeq.getArray();
for (i = 0; i < (sal_Int32)aValueList.size(); ++i) for ( i = 0; i < (sal_Int32)aValueList.size(); ++i, ++pValues)
pustrValues[i] = aValueList[i]; *pValues = aValueList[i];
// String-Sequence fuer ListBox erzeugen // String-Sequence fuer ListBox erzeugen
StringSequence aStringSeq(aStringList.size()); StringSequence aStringSeq(aStringList.size());
::rtl::OUString* pustrStrings = aStringSeq.getArray(); ::rtl::OUString* pStrings = aStringSeq.getArray();
for (i = 0; i < (sal_Int32)aStringList.size(); ++i) for ( i = 0; i < (sal_Int32)aStringList.size(); ++i, ++pStrings )
pustrStrings[i] = aStringList[i]; *pStrings = aStringList[i];
setFastPropertyValue(PROPERTY_ID_STRINGITEMLIST, makeAny(aStringSeq)); setFastPropertyValue(PROPERTY_ID_STRINGITEMLIST, makeAny(aStringSeq));
} }
...@@ -910,9 +906,6 @@ namespace frm ...@@ -910,9 +906,6 @@ namespace frm
if ( m_eListSourceType != ListSourceType_VALUELIST ) if ( m_eListSourceType != ListSourceType_VALUELIST )
{ {
if ( hasField() )
m_aValueSeq = StringSequence();
if ( m_xCursor.is() ) if ( m_xCursor.is() )
loadData(); loadData();
} }
...@@ -966,15 +959,7 @@ namespace frm ...@@ -966,15 +959,7 @@ namespace frm
if (nSelCount) if (nSelCount)
{ {
StringSequence aValues; StringSequence aValues( impl_getValues() );
if ( m_aValueSeq.getLength() )
{
aValues = m_aValueSeq;
}
else
{
aValues = getStringItemList();
}
const ::rtl::OUString *pVals = aValues.getConstArray(); const ::rtl::OUString *pVals = aValues.getConstArray();
sal_Int32 nValCnt = aValues.getLength(); sal_Int32 nValCnt = aValues.getLength();
...@@ -1061,15 +1046,7 @@ namespace frm ...@@ -1061,15 +1046,7 @@ namespace frm
{ {
m_aSaveValue <<= sValue; m_aSaveValue <<= sValue;
// In der Werteliste nur einzelne Werte suchen, wenn das Control mit einem Datenbankfeld verbunden ist aSelSeq = findValue( impl_getValues(), sValue, m_bBoundComponent );
if ( m_aValueSeq.getLength() ) // value list
{
aSelSeq = findValue( m_aValueSeq, sValue, m_bBoundComponent );
}
else
{
aSelSeq = findValue( getStringItemList(), sValue, m_bBoundComponent );
}
} }
return makeAny( aSelSeq ); return makeAny( aSelSeq );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment