#103388# introduced ElementDescription to cache some information (interfaces) about to-be-inserted objects
This commit is contained in:
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: DatabaseForm.hxx,v $
|
* $RCSfile: DatabaseForm.hxx,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.14 $
|
* $Revision: 1.15 $
|
||||||
*
|
*
|
||||||
* last change: $Author: fs $ $Date: 2002-03-04 14:01:11 $
|
* last change: $Author: fs $ $Date: 2002-10-04 08:14:15 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@@ -520,7 +520,7 @@ public:
|
|||||||
inline void submitNBC( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& Control, const ::com::sun::star::awt::MouseEvent& MouseEvt );
|
inline void submitNBC( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& Control, const ::com::sun::star::awt::MouseEvent& MouseEvt );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void implInserted(const InterfaceRef& _rxObject);
|
virtual void implInserted( const ElementDescription* _pElement );
|
||||||
virtual void implRemoved(const InterfaceRef& _rxObject);
|
virtual void implRemoved(const InterfaceRef& _rxObject);
|
||||||
|
|
||||||
// OPropertyChangeListener
|
// OPropertyChangeListener
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: Grid.cxx,v $
|
* $RCSfile: Grid.cxx,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.24 $
|
* $Revision: 1.25 $
|
||||||
*
|
*
|
||||||
* last change: $Author: fs $ $Date: 2001-11-08 11:24:52 $
|
* last change: $Author: fs $ $Date: 2002-10-04 08:11:48 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@@ -984,8 +984,8 @@ void SAL_CALL OGridControlModel::reloaded(const EventObject& rEvent) throw(Runti
|
|||||||
OGridColumn* OGridControlModel::getColumnImplementation(const InterfaceRef& _rxIFace) const
|
OGridColumn* OGridControlModel::getColumnImplementation(const InterfaceRef& _rxIFace) const
|
||||||
{
|
{
|
||||||
OGridColumn* pImplementation = NULL;
|
OGridColumn* pImplementation = NULL;
|
||||||
Reference<XUnoTunnel> xUnoTunnel(_rxIFace, UNO_QUERY);
|
Reference< XUnoTunnel > xUnoTunnel( _rxIFace, UNO_QUERY );
|
||||||
if (xUnoTunnel.is())
|
if ( xUnoTunnel.is() )
|
||||||
pImplementation = reinterpret_cast<OGridColumn*>(xUnoTunnel->getSomething(OGridColumn::getUnoTunnelImplementationId()));
|
pImplementation = reinterpret_cast<OGridColumn*>(xUnoTunnel->getSomething(OGridColumn::getUnoTunnelImplementationId()));
|
||||||
|
|
||||||
return pImplementation;
|
return pImplementation;
|
||||||
@@ -1032,33 +1032,43 @@ void OGridControlModel::implRemoved(const InterfaceRef& _rxObject)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void OGridControlModel::implInserted(const InterfaceRef& _rxObject)
|
void OGridControlModel::implInserted( const ElementDescription* _pElement )
|
||||||
{
|
{
|
||||||
OInterfaceContainer::implInserted(_rxObject);
|
OInterfaceContainer::implInserted( _pElement );
|
||||||
|
|
||||||
Reference< XSQLErrorBroadcaster > xBroadcaster( _rxObject, UNO_QUERY );
|
Reference< XSQLErrorBroadcaster > xBroadcaster( _pElement->xInterface, UNO_QUERY );
|
||||||
if ( xBroadcaster.is() )
|
if ( xBroadcaster.is() )
|
||||||
xBroadcaster->addSQLErrorListener( this );
|
xBroadcaster->addSQLErrorListener( this );
|
||||||
|
|
||||||
gotColumn(_rxObject);
|
gotColumn( _pElement->xInterface );
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void OGridControlModel::implReplaced(const InterfaceRef& _rxReplacedObject, const InterfaceRef& _rxNewObject)
|
void OGridControlModel::implReplaced( const InterfaceRef& _rxReplacedObject, const ElementDescription* _pElement )
|
||||||
{
|
{
|
||||||
OInterfaceContainer::implReplaced(_rxReplacedObject, _rxNewObject);
|
OInterfaceContainer::implReplaced( _rxReplacedObject, _pElement );
|
||||||
lostColumn(_rxReplacedObject);
|
lostColumn( _rxReplacedObject );
|
||||||
gotColumn(_rxNewObject);
|
gotColumn( _pElement->xInterface );
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
InterfaceRef OGridControlModel::approveNewElement( const InterfaceRef& _rxObject )
|
ElementDescription* OGridControlModel::createElementMetaData( )
|
||||||
|
{
|
||||||
|
return new ColumnDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
void OGridControlModel::approveNewElement( const Reference< XPropertySet >& _rxObject, ElementDescription* _pElement )
|
||||||
{
|
{
|
||||||
OGridColumn* pCol = getColumnImplementation( _rxObject );
|
OGridColumn* pCol = getColumnImplementation( _rxObject );
|
||||||
if ( !pCol )
|
if ( !pCol )
|
||||||
throw IllegalArgumentException();
|
throw IllegalArgumentException();
|
||||||
|
|
||||||
return OInterfaceContainer::approveNewElement( _rxObject );
|
OInterfaceContainer::approveNewElement( _rxObject, _pElement );
|
||||||
|
|
||||||
|
// if we're here, the object passed all tests
|
||||||
|
if ( _pElement )
|
||||||
|
static_cast< ColumnDescription* >( _pElement )->pColumn = pCol;
|
||||||
}
|
}
|
||||||
|
|
||||||
// XPersistObject
|
// XPersistObject
|
||||||
@@ -1222,7 +1232,7 @@ void OGridControlModel::read(const Reference<XObjectInputStream>& _rxInStream) t
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( xCol.is() )
|
if ( xCol.is() )
|
||||||
implInsert( i, xCol, sal_False, sal_False, sal_False );
|
implInsert( i, xCol, sal_False, NULL, sal_False );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: Grid.hxx,v $
|
* $RCSfile: Grid.hxx,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.12 $
|
* $Revision: 1.13 $
|
||||||
*
|
*
|
||||||
* last change: $Author: fs $ $Date: 2001-10-16 16:19:02 $
|
* last change: $Author: fs $ $Date: 2002-10-04 08:11:48 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@@ -96,6 +96,18 @@ namespace frm
|
|||||||
{
|
{
|
||||||
//.........................................................................
|
//.........................................................................
|
||||||
|
|
||||||
|
class OGridColumn;
|
||||||
|
|
||||||
|
//==================================================================
|
||||||
|
// ColumnDescription
|
||||||
|
//==================================================================
|
||||||
|
|
||||||
|
struct ColumnDescription : public ElementDescription
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
OGridColumn* pColumn; // not owned by this instance! only to prevent duplicate XUnoTunnel usage
|
||||||
|
};
|
||||||
|
|
||||||
//==================================================================
|
//==================================================================
|
||||||
// OGridControlModel
|
// OGridControlModel
|
||||||
//==================================================================
|
//==================================================================
|
||||||
@@ -107,7 +119,6 @@ typedef ::cppu::ImplHelper6 < ::com::sun::star::awt::XControlModel
|
|||||||
, ::com::sun::star::sdb::XSQLErrorListener
|
, ::com::sun::star::sdb::XSQLErrorListener
|
||||||
> OGridControlModel_BASE;
|
> OGridControlModel_BASE;
|
||||||
|
|
||||||
class OGridColumn;
|
|
||||||
class OGridControlModel :public OControlModel
|
class OGridControlModel :public OControlModel
|
||||||
,public OInterfaceContainer
|
,public OInterfaceContainer
|
||||||
,public OErrorBroadcaster
|
,public OErrorBroadcaster
|
||||||
@@ -228,16 +239,21 @@ public:
|
|||||||
IMPLEMENT_INFO_SERVICE()
|
IMPLEMENT_INFO_SERVICE()
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual InterfaceRef approveNewElement( const InterfaceRef& _rxObject );
|
virtual void approveNewElement(
|
||||||
|
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject,
|
||||||
|
ElementDescription* _pElement
|
||||||
|
);
|
||||||
|
|
||||||
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> createColumn(sal_Int32 nTypeId) const;
|
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> createColumn(sal_Int32 nTypeId) const;
|
||||||
|
|
||||||
OGridColumn* getColumnImplementation(const InterfaceRef& _rxIFace) const;
|
OGridColumn* getColumnImplementation(const InterfaceRef& _rxIFace) const;
|
||||||
|
|
||||||
|
virtual ElementDescription* createElementMetaData( );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void implRemoved(const InterfaceRef& _rxObject);
|
virtual void implRemoved(const InterfaceRef& _rxObject);
|
||||||
virtual void implInserted(const InterfaceRef& _rxObject);
|
virtual void implInserted( const ElementDescription* _pElement );
|
||||||
virtual void implReplaced(const InterfaceRef& _rxReplacedObject, const InterfaceRef& _rxNewObject);
|
virtual void implReplaced( const InterfaceRef& _rxReplacedObject, const ElementDescription* _pElement );
|
||||||
|
|
||||||
void gotColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxColumn);
|
void gotColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxColumn);
|
||||||
void lostColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxColumn);
|
void lostColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxColumn);
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: InterfaceContainer.hxx,v $
|
* $RCSfile: InterfaceContainer.hxx,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.7 $
|
* $Revision: 1.8 $
|
||||||
*
|
*
|
||||||
* last change: $Author: fs $ $Date: 2001-10-16 16:18:23 $
|
* last change: $Author: fs $ $Date: 2002-10-04 08:08:18 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@@ -102,6 +102,9 @@
|
|||||||
#ifndef _COM_SUN_STAR_BEANS_PROPERTYCHANGEEVENT_HPP_
|
#ifndef _COM_SUN_STAR_BEANS_PROPERTYCHANGEEVENT_HPP_
|
||||||
#include <com/sun/star/beans/PropertyChangeEvent.hpp>
|
#include <com/sun/star/beans/PropertyChangeEvent.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
|
||||||
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||||
|
#endif
|
||||||
#ifndef _COM_SUN_STAR_SCRIPT_XEVENTATTACHERMANAGER_HPP_
|
#ifndef _COM_SUN_STAR_SCRIPT_XEVENTATTACHERMANAGER_HPP_
|
||||||
#include <com/sun/star/script/XEventAttacherManager.hpp>
|
#include <com/sun/star/script/XEventAttacherManager.hpp>
|
||||||
#endif
|
#endif
|
||||||
@@ -146,15 +149,30 @@ namespace frm
|
|||||||
//.........................................................................
|
//.........................................................................
|
||||||
|
|
||||||
|
|
||||||
|
//==================================================================
|
||||||
|
struct ElementDescription
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xInterface;
|
||||||
|
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropertySet;
|
||||||
|
::com::sun::star::uno::Reference< ::com::sun::star::container::XChild > xChild;
|
||||||
|
::com::sun::star::uno::Any aElementTypeInterface;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ElementDescription( );
|
||||||
|
virtual ~ElementDescription();
|
||||||
|
|
||||||
|
private:
|
||||||
|
ElementDescription( const ElementDescription& ); // never implemented
|
||||||
|
ElementDescription& operator=( const ElementDescription& ); // never implemented
|
||||||
|
};
|
||||||
|
|
||||||
typedef ::std::vector<InterfaceRef> OInterfaceArray;
|
typedef ::std::vector<InterfaceRef> OInterfaceArray;
|
||||||
typedef ::std::hash_multimap< ::rtl::OUString, InterfaceRef, ::comphelper::UStringHash, ::comphelper::UStringEqual> OInterfaceMap;
|
typedef ::std::hash_multimap< ::rtl::OUString, InterfaceRef, ::comphelper::UStringHash, ::comphelper::UStringEqual> OInterfaceMap;
|
||||||
|
|
||||||
//==================================================================
|
//==================================================================
|
||||||
// FmForms
|
// OInterfaceContainer
|
||||||
// Implementiert den UNO-Container fuer Formulare
|
// implements a container for form components
|
||||||
// enthaelt alle zugeordneten Forms
|
|
||||||
// dieses Container kann selbst den Context fuer Formulare darstellen
|
|
||||||
// oder au<61>en einen Context uebergeben bekommen
|
|
||||||
//==================================================================
|
//==================================================================
|
||||||
typedef ::cppu::ImplHelper7< ::com::sun::star::container::XNameContainer,
|
typedef ::cppu::ImplHelper7< ::com::sun::star::container::XNameContainer,
|
||||||
::com::sun::star::container::XIndexContainer,
|
::com::sun::star::container::XIndexContainer,
|
||||||
@@ -250,23 +268,44 @@ protected:
|
|||||||
virtual void SAL_CALL disposing();
|
virtual void SAL_CALL disposing();
|
||||||
virtual void removeElementsNoEvents(sal_Int32 nIndex);
|
virtual void removeElementsNoEvents(sal_Int32 nIndex);
|
||||||
|
|
||||||
/// to be overridden if elements which are to be inserted into the container shall be checked
|
/** to be overridden if elements which are to be inserted into the container shall be checked
|
||||||
virtual InterfaceRef approveNewElement( const ::com::sun::star::uno::Any& _rObject );
|
|
||||||
virtual InterfaceRef approveNewElement( const InterfaceRef& _rxObject );
|
<p>the ElementDescription given can be used to cache information about the object - it will be passed
|
||||||
|
later on to implInserted/implReplaced.</p>
|
||||||
|
*/
|
||||||
|
virtual void approveNewElement(
|
||||||
|
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject,
|
||||||
|
ElementDescription* _pElement
|
||||||
|
);
|
||||||
|
|
||||||
|
virtual ElementDescription* createElementMetaData( );
|
||||||
|
|
||||||
|
/** inserts an object into our internal structures
|
||||||
|
|
||||||
|
@param _nIndex
|
||||||
|
the index at which position it should be inserted
|
||||||
|
@param _bEvents
|
||||||
|
if <TRUE/>, event knittings will be done
|
||||||
|
@param _pApprovalResult
|
||||||
|
must contain the result of an approveNewElement call. Can be <NULL/>, in this case, the approval
|
||||||
|
is done within implInsert.
|
||||||
|
@param _bFire
|
||||||
|
if <TRUE/>, a notification about the insertion will be fired
|
||||||
|
*/
|
||||||
void implInsert(
|
void implInsert(
|
||||||
sal_Int32 _nIndex,
|
sal_Int32 _nIndex,
|
||||||
const InterfaceRef& _rxObject,
|
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject,
|
||||||
sal_Bool _bEvents = sal_True,
|
sal_Bool _bEvents /* = sal_True */,
|
||||||
sal_Bool _bApprove = sal_True,
|
ElementDescription* _pApprovalResult /* = NULL */ ,
|
||||||
sal_Bool _bFire = sal_True
|
sal_Bool _bFire /* = sal_True */
|
||||||
) throw(::com::sun::star::lang::IllegalArgumentException);
|
) throw(::com::sun::star::lang::IllegalArgumentException);
|
||||||
|
|
||||||
// called after the object is inserted, but before the "real listeners" are notified
|
// called after the object is inserted, but before the "real listeners" are notified
|
||||||
virtual void implInserted(const InterfaceRef& _rxObject) { }
|
virtual void implInserted( const ElementDescription* _pElement ) { }
|
||||||
// called after the object is removed, but before the "real listeners" are notified
|
// called after the object is removed, but before the "real listeners" are notified
|
||||||
virtual void implRemoved(const InterfaceRef& _rxObject) { }
|
virtual void implRemoved(const InterfaceRef& _rxObject) { }
|
||||||
// called after an object was replaced, but before the "real listeners" are notified
|
// called after an object was replaced, but before the "real listeners" are notified
|
||||||
virtual void implReplaced(const InterfaceRef& _rxReplacedObject, const InterfaceRef& _rxNewObject) { }
|
virtual void implReplaced( const InterfaceRef& _rxReplacedObject, const ElementDescription* _pElement ) { }
|
||||||
|
|
||||||
void SAL_CALL writeEvents(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream);
|
void SAL_CALL writeEvents(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream);
|
||||||
void SAL_CALL readEvents(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream);
|
void SAL_CALL readEvents(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream);
|
||||||
|
Reference in New Issue
Block a user