INTEGRATION: CWS frmcontrols01 (1.28.2); FILE MERGED

2003/11/04 12:24:06 fs 1.28.2.1: whitespacing
This commit is contained in:
Kurt Zenker 2003-12-11 11:29:45 +00:00
parent a306420240
commit 4befadb3d2

View file

@ -1,63 +1,63 @@
/*************************************************************************
*
* $RCSfile: ListBox.cxx,v $
*
* $Revision: 1.28 $
*
* last change: $Author: obo $ $Date: 2003-10-21 08:59:07 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
*
* $RCSfile: ListBox.cxx,v $
*
* $Revision: 1.29 $
*
* last change: $Author: kz $ $Date: 2003-12-11 12:29:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _FORMS_LISTBOX_HXX_
#include "ListBox.hxx"
@ -157,32 +157,32 @@
//.........................................................................
namespace frm
{
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::form;
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 ::drafts::com::sun::star::form;
using namespace ::dbtools;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::form;
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 ::drafts::com::sun::star::form;
using namespace ::dbtools;
//==================================================================
//= OListBoxModel
//==================================================================
//------------------------------------------------------------------
InterfaceRef SAL_CALL OListBoxModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) throw (RuntimeException)
{
//==================================================================
//= OListBoxModel
//==================================================================
//------------------------------------------------------------------
InterfaceRef SAL_CALL OListBoxModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) throw (RuntimeException)
{
return *(new OListBoxModel(_rxFactory));
}
}
//------------------------------------------------------------------------------
Sequence< Type> OListBoxModel::_getTypes()
{
//------------------------------------------------------------------------------
Sequence< Type> OListBoxModel::_getTypes()
{
return ::comphelper::concatSequences(
::comphelper::concatSequences(
OBoundControlModel::_getTypes(),
@ -191,12 +191,12 @@ Sequence< Type> OListBoxModel::_getTypes()
),
OErrorBroadcaster::getTypes()
);
}
}
DBG_NAME(OListBoxModel);
//------------------------------------------------------------------
OListBoxModel::OListBoxModel(const Reference<XMultiServiceFactory>& _rxFactory)
DBG_NAME(OListBoxModel);
//------------------------------------------------------------------
OListBoxModel::OListBoxModel(const Reference<XMultiServiceFactory>& _rxFactory)
:OBoundControlModel( _rxFactory, VCL_CONTROLMODEL_LISTBOX, FRM_CONTROL_LISTBOX, sal_True, sal_True )
// use the old control name for compytibility reasons
,OEntryListHelper( m_aMutex )
@ -205,17 +205,17 @@ OListBoxModel::OListBoxModel(const Reference<XMultiServiceFactory>& _rxFactory)
,m_bBoundComponent(sal_False)
,m_eTransferSelectionAs( tsEntry )
,m_nNULLPos(-1)
{
{
DBG_CTOR(OListBoxModel,NULL);
m_nClassId = FormComponentType::LISTBOX;
m_eListSourceType = ListSourceType_VALUELIST;
m_aBoundColumn <<= (sal_Int16)1;
initValueProperty( PROPERTY_SELECT_SEQ, PROPERTY_ID_SELECT_SEQ);
}
}
//------------------------------------------------------------------
OListBoxModel::OListBoxModel( const OListBoxModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory )
//------------------------------------------------------------------
OListBoxModel::OListBoxModel( const OListBoxModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory )
:OBoundControlModel( _pOriginal, _rxFactory )
,OEntryListHelper( m_aMutex )
,OErrorBroadcaster( OComponentHelper::rBHelper )
@ -223,15 +223,15 @@ OListBoxModel::OListBoxModel( const OListBoxModel* _pOriginal, const Reference<X
,m_bBoundComponent(sal_False)
,m_eTransferSelectionAs( tsEntry )
,m_nNULLPos(-1)
{
{
DBG_CTOR(OListBoxModel,NULL);
m_eListSourceType = _pOriginal->m_eListSourceType;
m_aBoundColumn = _pOriginal->m_aBoundColumn;
}
}
//------------------------------------------------------------------
OListBoxModel::~OListBoxModel()
{
//------------------------------------------------------------------
OListBoxModel::~OListBoxModel()
{
if (!OComponentHelper::rBHelper.bDisposed)
{
acquire();
@ -239,16 +239,16 @@ OListBoxModel::~OListBoxModel()
}
DBG_DTOR(OListBoxModel,NULL);
}
}
// XCloneable
//------------------------------------------------------------------------------
IMPLEMENT_DEFAULT_CLONING( OListBoxModel )
// XCloneable
//------------------------------------------------------------------------------
IMPLEMENT_DEFAULT_CLONING( OListBoxModel )
// XServiceInfo
//------------------------------------------------------------------------------
StringSequence SAL_CALL OListBoxModel::getSupportedServiceNames() throw(RuntimeException)
{
// XServiceInfo
//------------------------------------------------------------------------------
StringSequence SAL_CALL OListBoxModel::getSupportedServiceNames() throw(RuntimeException)
{
StringSequence aSupported = OBoundControlModel::getSupportedServiceNames();
aSupported.realloc(aSupported.getLength() + 3);
@ -257,11 +257,11 @@ StringSequence SAL_CALL OListBoxModel::getSupportedServiceNames() throw(RuntimeE
pArray[aSupported.getLength()-2] = FRM_SUN_COMPONENT_DATABASE_LISTBOX;
pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_LISTBOX;
return aSupported;
}
}
//------------------------------------------------------------------------------
Any SAL_CALL OListBoxModel::queryAggregation(const Type& _rType) throw (RuntimeException)
{
//------------------------------------------------------------------------------
Any SAL_CALL OListBoxModel::queryAggregation(const Type& _rType) throw (RuntimeException)
{
Any aReturn = OBoundControlModel::queryAggregation( _rType );
if ( !aReturn.hasValue() )
aReturn = OListBoxModel_BASE::queryInterface( _rType );
@ -270,36 +270,36 @@ Any SAL_CALL OListBoxModel::queryAggregation(const Type& _rType) throw (RuntimeE
if ( !aReturn.hasValue() )
aReturn = OErrorBroadcaster::queryInterface( _rType );
return aReturn;
}
}
// OComponentHelper
//------------------------------------------------------------------------------
void OListBoxModel::disposing()
{
// OComponentHelper
//------------------------------------------------------------------------------
void OListBoxModel::disposing()
{
EventObject aEvt( static_cast< XWeak* >( this ) );
m_aRefreshListeners.disposeAndClear(aEvt);
OBoundControlModel::disposing();
OEntryListHelper::disposing();
OErrorBroadcaster::disposing();
}
}
// XRefreshable
//------------------------------------------------------------------------------
void SAL_CALL OListBoxModel::addRefreshListener(const Reference<XRefreshListener>& _rxListener) throw(RuntimeException)
{
// XRefreshable
//------------------------------------------------------------------------------
void SAL_CALL OListBoxModel::addRefreshListener(const Reference<XRefreshListener>& _rxListener) throw(RuntimeException)
{
m_aRefreshListeners.addInterface(_rxListener);
}
}
//------------------------------------------------------------------------------
void SAL_CALL OListBoxModel::removeRefreshListener(const Reference<XRefreshListener>& _rxListener) throw(RuntimeException)
{
//------------------------------------------------------------------------------
void SAL_CALL OListBoxModel::removeRefreshListener(const Reference<XRefreshListener>& _rxListener) throw(RuntimeException)
{
m_aRefreshListeners.removeInterface(_rxListener);
}
}
//------------------------------------------------------------------------------
void SAL_CALL OListBoxModel::refresh() throw(RuntimeException)
{
//------------------------------------------------------------------------------
void SAL_CALL OListBoxModel::refresh() throw(RuntimeException)
{
{
::osl::MutexGuard aGuard( m_aMutex );
if ( !hasExternalListSource() )
@ -308,11 +308,11 @@ void SAL_CALL OListBoxModel::refresh() throw(RuntimeException)
EventObject aEvt(static_cast< XWeak*>(this));
NOTIFY_LISTENERS(m_aRefreshListeners, XRefreshListener, refreshed, aEvt);
}
}
//------------------------------------------------------------------------------
void OListBoxModel::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) const
{
//------------------------------------------------------------------------------
void OListBoxModel::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) const
{
switch (_nHandle)
{
case PROPERTY_ID_BOUNDCOLUMN:
@ -342,11 +342,11 @@ void OListBoxModel::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) const
default:
OBoundControlModel::getFastPropertyValue(_rValue, _nHandle);
}
}
}
//------------------------------------------------------------------------------
void OListBoxModel::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const Any& _rValue) throw (com::sun::star::uno::Exception)
{
//------------------------------------------------------------------------------
void OListBoxModel::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const Any& _rValue) throw (com::sun::star::uno::Exception)
{
switch (_nHandle)
{
case PROPERTY_ID_BOUNDCOLUMN :
@ -399,13 +399,13 @@ void OListBoxModel::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const A
default:
OBoundControlModel::setFastPropertyValue_NoBroadcast(_nHandle, _rValue);
}
}
}
//------------------------------------------------------------------------------
sal_Bool OListBoxModel::convertFastPropertyValue(
//------------------------------------------------------------------------------
sal_Bool OListBoxModel::convertFastPropertyValue(
Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue)
throw (IllegalArgumentException)
{
{
sal_Bool bModified(sal_False);
switch (_nHandle)
{
@ -437,26 +437,26 @@ sal_Bool OListBoxModel::convertFastPropertyValue(
return OBoundControlModel::convertFastPropertyValue(_rConvertedValue, _rOldValue, _nHandle, _rValue);
}
return bModified;
}
}
//------------------------------------------------------------------------------
Reference<XPropertySetInfo> SAL_CALL OListBoxModel::getPropertySetInfo() throw(RuntimeException)
{
//------------------------------------------------------------------------------
Reference<XPropertySetInfo> SAL_CALL OListBoxModel::getPropertySetInfo() throw(RuntimeException)
{
Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
return xInfo;
}
}
//------------------------------------------------------------------------------
cppu::IPropertyArrayHelper& OListBoxModel::getInfoHelper()
{
//------------------------------------------------------------------------------
cppu::IPropertyArrayHelper& OListBoxModel::getInfoHelper()
{
return *const_cast<OListBoxModel*>(this)->getArrayHelper();
}
}
//------------------------------------------------------------------------------
void OListBoxModel::fillProperties(
//------------------------------------------------------------------------------
void OListBoxModel::fillProperties(
Sequence< Property >& _rProps,
Sequence< Property >& _rAggregateProps ) const
{
{
FRM_BEGIN_PROP_HELPER(14)
RemoveProperty( _rAggregateProps, PROPERTY_STRINGITEMLIST );
// we want to "override" this property
@ -476,18 +476,18 @@ void OListBoxModel::fillProperties(
DECL_PROP2(CONTROLSOURCEPROPERTY, rtl::OUString, READONLY, TRANSIENT);
DECL_PROP1(STRINGITEMLIST, Sequence< ::rtl::OUString >, BOUND);
FRM_END_PROP_HELPER();
}
}
//------------------------------------------------------------------------------
::rtl::OUString SAL_CALL OListBoxModel::getServiceName() throw(RuntimeException)
{
//------------------------------------------------------------------------------
::rtl::OUString SAL_CALL OListBoxModel::getServiceName() throw(RuntimeException)
{
return FRM_COMPONENT_LISTBOX; // old (non-sun) name for compatibility !
}
}
//------------------------------------------------------------------------------
void SAL_CALL OListBoxModel::write(const Reference<stario::XObjectOutputStream>& _rxOutStream)
//------------------------------------------------------------------------------
void SAL_CALL OListBoxModel::write(const Reference<stario::XObjectOutputStream>& _rxOutStream)
throw(stario::IOException, RuntimeException)
{
{
OBoundControlModel::write(_rxOutStream);
// Dummy-Seq, um Kompatible zu bleiben, wenn SelectSeq nicht mehr gespeichert wird
@ -519,11 +519,11 @@ void SAL_CALL OListBoxModel::write(const Reference<stario::XObjectOutputStream>&
// from version 0x0004 : common properties
writeCommonProperties(_rxOutStream);
}
}
//------------------------------------------------------------------------------
void SAL_CALL OListBoxModel::read(const Reference<stario::XObjectInputStream>& _rxInStream) throw(stario::IOException, RuntimeException)
{
//------------------------------------------------------------------------------
void SAL_CALL OListBoxModel::read(const Reference<stario::XObjectInputStream>& _rxInStream) throw(stario::IOException, RuntimeException)
{
// Bei manchen Variblen muessen Abhaengigkeiten beruecksichtigt werden.
// Deshalb muessen sie explizit ueber setPropertyValue() gesetzt werden.
@ -622,11 +622,11 @@ void SAL_CALL OListBoxModel::read(const Reference<stario::XObjectInputStream>& _
if (m_aControlSource.getLength())
// (not if we don't have a control source - the "State" property acts like it is persistent, then
resetNoBroadcast();
}
}
//------------------------------------------------------------------------------
void OListBoxModel::loadData()
{
//------------------------------------------------------------------------------
void OListBoxModel::loadData()
{
DBG_ASSERT( m_eListSourceType != ListSourceType_VALUELIST, "OListBoxModel::loadData: cannot load value list from DB!" );
DBG_ASSERT( !hasExternalListSource(), "OListBoxModel::loadData: cannot load from DB when I have an external list source!" );
@ -680,6 +680,7 @@ void OListBoxModel::loadData()
case ListSourceType_TABLEFIELDS:
// don't work with a statement here, the fields will be collected below
break;
case ListSourceType_TABLE:
{
Reference<XNameAccess> xFieldsByName = getTableFields(xConnection, sListSource);
@ -763,7 +764,9 @@ void OListBoxModel::loadData()
xContentSetProperties->setPropertyValue(PROPERTY_COMMAND, makeAny(aStatement));
bExecute = sal_True;
} break;
}
break;
case ListSourceType_QUERY:
{
Reference<XQueriesSupplier> xSupplyQueries(xConnection, UNO_QUERY);
@ -772,7 +775,9 @@ void OListBoxModel::loadData()
xContentSetProperties->setPropertyValue(PROPERTY_COMMAND, xQuery->getPropertyValue(PROPERTY_COMMAND));
bExecute = sal_True;
} break;
}
break;
default:
{
if (ListSourceType_SQLPASSTHROUGH == m_eListSourceType)
@ -980,11 +985,11 @@ void OListBoxModel::loadData()
// Statement + Cursor zerstoeren
disposeComponent(xListCursor);
}
}
//------------------------------------------------------------------------------
void OListBoxModel::implRefreshListFromDbBinding( )
{
//------------------------------------------------------------------------------
void OListBoxModel::implRefreshListFromDbBinding( )
{
DBG_ASSERT( !hasExternalListSource( ), "OListBoxModel::implRefreshListFromDbBinding: invalid call!" );
if ( m_eListSourceType != ListSourceType_VALUELIST )
@ -995,11 +1000,11 @@ void OListBoxModel::implRefreshListFromDbBinding( )
if ( m_xCursor.is() )
loadData();
}
}
}
//------------------------------------------------------------------------------
void OListBoxModel::onConnectedDbColumn( const Reference< XInterface >& _rxForm )
{
//------------------------------------------------------------------------------
void OListBoxModel::onConnectedDbColumn( const Reference< XInterface >& _rxForm )
{
// list boxes which are bound to a db column don't have multi selection
// - this would be unable to reflect in the db column
if ( getField().is() )
@ -1009,11 +1014,11 @@ void OListBoxModel::onConnectedDbColumn( const Reference< XInterface >& _rxForm
if ( !hasExternalListSource() )
implRefreshListFromDbBinding( );
}
}
//------------------------------------------------------------------------------
void OListBoxModel::onDisconnectedDbColumn()
{
//------------------------------------------------------------------------------
void OListBoxModel::onDisconnectedDbColumn()
{
if (m_eListSourceType != ListSourceType_VALUELIST)
{
m_aValueSeq = StringSequence();
@ -1023,11 +1028,11 @@ void OListBoxModel::onDisconnectedDbColumn()
if ( !hasExternalListSource() )
setFastPropertyValue( PROPERTY_ID_STRINGITEMLIST, makeAny( StringSequence() ) );
}
}
}
//------------------------------------------------------------------------------
StringSequence OListBoxModel::GetCurValueSeq() const
{
//------------------------------------------------------------------------------
StringSequence OListBoxModel::GetCurValueSeq() const
{
StringSequence aCurValues;
// Aus den selektierten Indizes Werte-Sequence aufbauen
@ -1080,11 +1085,11 @@ StringSequence OListBoxModel::GetCurValueSeq() const
}
}
return aCurValues;
}
}
//------------------------------------------------------------------------------
sal_Bool OListBoxModel::commitControlValueToDbColumn( bool _bPostReset )
{
//------------------------------------------------------------------------------
sal_Bool OListBoxModel::commitControlValueToDbColumn( bool _bPostReset )
{
// current selektion list
Any aCurrentValue;
StringSequence aCurValueSeq = GetCurValueSeq();
@ -1111,12 +1116,12 @@ sal_Bool OListBoxModel::commitControlValueToDbColumn( bool _bPostReset )
m_aSaveValue = aCurrentValue;
}
return sal_True;
}
}
// XPropertiesChangeListener
//------------------------------------------------------------------------------
Any OListBoxModel::translateDbColumnToControlValue()
{
// XPropertiesChangeListener
//------------------------------------------------------------------------------
Any OListBoxModel::translateDbColumnToControlValue()
{
DBG_ASSERT( m_xAggregateFastSet.is() && m_xAggregateSet.is(), "OListBoxModel::translateDbColumnToControlValue: invalid aggregate !" );
if ( !m_xAggregateFastSet.is() || !m_xAggregateSet.is() )
return Any();
@ -1149,12 +1154,12 @@ Any OListBoxModel::translateDbColumnToControlValue()
}
}
return makeAny( aSelSeq );
}
}
// XReset
//------------------------------------------------------------------------------
Any OListBoxModel::getDefaultForReset() const
{
// XReset
//------------------------------------------------------------------------------
Any OListBoxModel::getDefaultForReset() const
{
Any aValue;
if (m_aDefaultSelectSeq.getLength())
aValue <<= m_aDefaultSelectSeq;
@ -1171,18 +1176,18 @@ Any OListBoxModel::getDefaultForReset() const
}
return aValue;
}
}
//--------------------------------------------------------------------
void SAL_CALL OListBoxModel::disposing( const EventObject& _rSource ) throw ( RuntimeException )
{
//--------------------------------------------------------------------
void SAL_CALL OListBoxModel::disposing( const EventObject& _rSource ) throw ( RuntimeException )
{
if ( !OEntryListHelper::handleDisposing( _rSource ) )
OBoundControlModel::disposing( _rSource );
}
}
//--------------------------------------------------------------------
Any OListBoxModel::translateExternalValueToControlValue( )
{
//--------------------------------------------------------------------
Any OListBoxModel::translateExternalValueToControlValue( )
{
OSL_PRECOND( hasExternalValueBinding(),
"OListBoxModel::translateExternalValueToControlValue: precondition not met!" );
@ -1265,11 +1270,11 @@ Any OListBoxModel::translateExternalValueToControlValue( )
}
return makeAny( aSelectIndexes );
}
}
//--------------------------------------------------------------------
void OListBoxModel::onConnectedExternalValue( )
{
//--------------------------------------------------------------------
void OListBoxModel::onConnectedExternalValue( )
{
OSL_ENSURE( hasExternalValueBinding(), "OListBoxModel::onConnectedExternalValue: no external value binding!" );
// if the binding supports string sequences, we prefer this
@ -1296,11 +1301,11 @@ void OListBoxModel::onConnectedExternalValue( )
}
OBoundControlModel::onConnectedExternalValue( );
}
}
//....................................................................
namespace
{
//....................................................................
namespace
{
struct ExtractStringFromSequence_Safe : public ::std::unary_function< sal_Int16, ::rtl::OUString >
{
protected:
@ -1317,11 +1322,11 @@ namespace
return ::rtl::OUString();
}
};
}
}
//--------------------------------------------------------------------
Any OListBoxModel::translateControlValueToExternalValue( )
{
//--------------------------------------------------------------------
Any OListBoxModel::translateControlValueToExternalValue( )
{
OSL_PRECOND( hasExternalValueBinding(), "OListBoxModel::translateControlValueToExternalValue: no binding!" );
Sequence< sal_Int16 > aSelectSequence;
@ -1386,11 +1391,11 @@ Any OListBoxModel::translateControlValueToExternalValue( )
}
return aReturn;
}
}
//--------------------------------------------------------------------
sal_Bool OListBoxModel::approveValueBinding( const Reference< XValueBinding >& _rxBinding )
{
//--------------------------------------------------------------------
sal_Bool OListBoxModel::approveValueBinding( const Reference< XValueBinding >& _rxBinding )
{
OSL_PRECOND( _rxBinding.is(), "OListBoxModel::approveValueBinding: precondition not met!" );
// only strings are accepted for simplicity
@ -1400,11 +1405,11 @@ sal_Bool OListBoxModel::approveValueBinding( const Reference< XValueBinding >& _
|| _rxBinding->supportsType( ::getCppuType( static_cast< sal_Int32* >( NULL ) ) )
|| _rxBinding->supportsType( ::getCppuType( static_cast< Sequence< sal_Int32 >* >( NULL ) ) )
);
}
}
//--------------------------------------------------------------------
void OListBoxModel::stringItemListChanged( )
{
//--------------------------------------------------------------------
void OListBoxModel::stringItemListChanged( )
{
if ( m_xAggregateSet.is() )
{
suspendValueListening();
@ -1426,57 +1431,57 @@ void OListBoxModel::stringItemListChanged( )
// TODO: update the selection in case we're bound to a database column
}
}
}
}
//--------------------------------------------------------------------
void OListBoxModel::connectedExternalListSource( )
{
//--------------------------------------------------------------------
void OListBoxModel::connectedExternalListSource( )
{
// TODO?
}
}
//--------------------------------------------------------------------
void OListBoxModel::disconnectedExternalListSource( )
{
//--------------------------------------------------------------------
void OListBoxModel::disconnectedExternalListSource( )
{
// TODO: in case we're part of an already loaded form, we should probably simulate
// an onConnectedDbColumn, so our list get's filled with the data as indicated
// by our SQL-binding related properties
}
}
//==================================================================
// OListBoxControl
//==================================================================
//==================================================================
// OListBoxControl
//==================================================================
//------------------------------------------------------------------
InterfaceRef SAL_CALL OListBoxControl_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) throw (RuntimeException)
{
//------------------------------------------------------------------
InterfaceRef SAL_CALL OListBoxControl_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) throw (RuntimeException)
{
return *(new OListBoxControl(_rxFactory));
}
}
//------------------------------------------------------------------------------
Sequence< Type> OListBoxControl::_getTypes()
{
//------------------------------------------------------------------------------
Sequence< Type> OListBoxControl::_getTypes()
{
return concatSequences(
OBoundControl::_getTypes(),
OListBoxControl_BASE::getTypes()
);
}
}
//------------------------------------------------------------------
Any SAL_CALL OListBoxControl::queryAggregation(const Type& _rType) throw (RuntimeException)
{
//------------------------------------------------------------------
Any SAL_CALL OListBoxControl::queryAggregation(const Type& _rType) throw (RuntimeException)
{
Any aReturn = OBoundControl::queryAggregation(_rType);
if (!aReturn.hasValue())
aReturn = OListBoxControl_BASE::queryInterface(_rType);
return aReturn;
}
}
DBG_NAME(OListBoxControl);
//------------------------------------------------------------------------------
OListBoxControl::OListBoxControl(const Reference<XMultiServiceFactory>& _rxFactory)
DBG_NAME(OListBoxControl);
//------------------------------------------------------------------------------
OListBoxControl::OListBoxControl(const Reference<XMultiServiceFactory>& _rxFactory)
:OBoundControl(_rxFactory, VCL_CONTROL_LISTBOX)
,m_aChangeListeners(m_aMutex)
{
{
DBG_CTOR(OListBoxControl,NULL);
increment(m_refCount);
@ -1496,11 +1501,11 @@ OListBoxControl::OListBoxControl(const Reference<XMultiServiceFactory>& _rxFacto
m_aChangeTimer.SetTimeout(500);
m_aChangeTimer.SetTimeoutHdl(LINK(this,OListBoxControl,OnTimeout));
}
}
//------------------------------------------------------------------------------
OListBoxControl::~OListBoxControl()
{
//------------------------------------------------------------------------------
OListBoxControl::~OListBoxControl()
{
if (!OComponentHelper::rBHelper.bDisposed)
{
acquire();
@ -1508,24 +1513,24 @@ OListBoxControl::~OListBoxControl()
}
DBG_DTOR(OListBoxControl,NULL);
}
}
//------------------------------------------------------------------------------
StringSequence SAL_CALL OListBoxControl::getSupportedServiceNames() throw(RuntimeException)
{
//------------------------------------------------------------------------------
StringSequence SAL_CALL OListBoxControl::getSupportedServiceNames() throw(RuntimeException)
{
StringSequence aSupported = OBoundControl::getSupportedServiceNames();
aSupported.realloc(aSupported.getLength() + 1);
::rtl::OUString* pArray = aSupported.getArray();
pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_LISTBOX;
return aSupported;
}
}
// XFocusListener
//------------------------------------------------------------------------------
void SAL_CALL OListBoxControl::focusGained(const FocusEvent& _rEvent) throw(RuntimeException)
{
// XFocusListener
//------------------------------------------------------------------------------
void SAL_CALL OListBoxControl::focusGained(const FocusEvent& _rEvent) throw(RuntimeException)
{
::osl::MutexGuard aGuard(m_aMutex);
if (m_aChangeListeners.getLength()) // only if there are listeners
{
@ -1536,18 +1541,18 @@ void SAL_CALL OListBoxControl::focusGained(const FocusEvent& _rEvent) throw(Runt
m_aCurrentSelection = xSet->getPropertyValue(PROPERTY_SELECT_SEQ);
}
}
}
}
//------------------------------------------------------------------------------
void SAL_CALL OListBoxControl::focusLost(const FocusEvent& _rEvent) throw(RuntimeException)
{
//------------------------------------------------------------------------------
void SAL_CALL OListBoxControl::focusLost(const FocusEvent& _rEvent) throw(RuntimeException)
{
m_aCurrentSelection.clear();
}
}
// XItemListener
//------------------------------------------------------------------------------
void SAL_CALL OListBoxControl::itemStateChanged(const ItemEvent& _rEvent) throw(RuntimeException)
{
// XItemListener
//------------------------------------------------------------------------------
void SAL_CALL OListBoxControl::itemStateChanged(const ItemEvent& _rEvent) throw(RuntimeException)
{
// call the changelistener delayed
::osl::ClearableMutexGuard aGuard(m_aMutex);
if (m_aChangeTimer.IsActive())
@ -1593,32 +1598,32 @@ void SAL_CALL OListBoxControl::itemStateChanged(const ItemEvent& _rEvent) throw(
else if (m_aCurrentSelection.hasValue())
m_aCurrentSelection.clear();
}
}
}
// XEventListener
//------------------------------------------------------------------------------
void SAL_CALL OListBoxControl::disposing(const EventObject& _rSource) throw (RuntimeException)
{
// XEventListener
//------------------------------------------------------------------------------
void SAL_CALL OListBoxControl::disposing(const EventObject& _rSource) throw (RuntimeException)
{
OBoundControl::disposing(_rSource);
}
}
// XChangeBroadcaster
//------------------------------------------------------------------------------
void SAL_CALL OListBoxControl::addChangeListener(const Reference<XChangeListener>& _rxListener) throw(RuntimeException)
{
// XChangeBroadcaster
//------------------------------------------------------------------------------
void SAL_CALL OListBoxControl::addChangeListener(const Reference<XChangeListener>& _rxListener) throw(RuntimeException)
{
m_aChangeListeners.addInterface(_rxListener);
}
}
//------------------------------------------------------------------------------
void SAL_CALL OListBoxControl::removeChangeListener(const Reference<XChangeListener>& _rxListener) throw(RuntimeException)
{
//------------------------------------------------------------------------------
void SAL_CALL OListBoxControl::removeChangeListener(const Reference<XChangeListener>& _rxListener) throw(RuntimeException)
{
m_aChangeListeners.removeInterface(_rxListener);
}
}
// OComponentHelper
//------------------------------------------------------------------------------
void OListBoxControl::disposing()
{
// OComponentHelper
//------------------------------------------------------------------------------
void OListBoxControl::disposing()
{
if (m_aChangeTimer.IsActive())
m_aChangeTimer.Stop();
@ -1626,15 +1631,15 @@ void OListBoxControl::disposing()
m_aChangeListeners.disposeAndClear(aEvt);
OBoundControl::disposing();
}
}
//------------------------------------------------------------------------------
IMPL_LINK(OListBoxControl, OnTimeout, void*, EMPTYTAG)
{
//------------------------------------------------------------------------------
IMPL_LINK(OListBoxControl, OnTimeout, void*, EMPTYTAG)
{
EventObject aEvt(static_cast< XWeak*>(this));
NOTIFY_LISTENERS(m_aChangeListeners, XChangeListener, changed, aEvt);
return 1;
}
}
//.........................................................................
}