#88610# added the XPropertyChangeListener - removed from the base class / disambiguated acquire/release (potential GPFs)

This commit is contained in:
Frank Schönheit 2001-06-21 16:52:32 +00:00
parent ab6af71df6
commit 6622ad1bbb
2 changed files with 91 additions and 40 deletions

View file

@ -2,9 +2,9 @@
*
* $RCSfile: brwctrlr.cxx,v $
*
* $Revision: 1.35 $
* $Revision: 1.36 $
*
* last change: $Author: fs $ $Date: 2001-05-29 10:23:07 $
* last change: $Author: fs $ $Date: 2001-06-21 17:52:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -162,6 +162,9 @@
#ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_
#include <com/sun/star/container/XNamed.hpp>
#endif
#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
#include <cppuhelper/typeprovider.hxx>
#endif
#ifndef _SV_MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
#endif
@ -180,8 +183,8 @@
#ifndef _TOOLS_COLOR_HXX
#include <tools/color.hxx>
#endif
#ifndef _COMPHELPER_PROCESSFACTORY_HXX_
#include <comphelper/processfactory.hxx>
#ifndef _COMPHELPER_SEQUENCE_HXX_
#include <comphelper/sequence.hxx>
#endif
#ifndef _CONNECTIVITY_DBTOOLS_HXX_
#include <connectivity/dbtools.hxx>
@ -476,6 +479,28 @@ void SAL_CALL SbaXDataBrowserController::FormControllerImpl::disposing(const ::c
//==================================================================
//= SbaXDataBrowserController
//==================================================================
//------------------------------------------------------------------
Sequence< Type > SAL_CALL SbaXDataBrowserController::getTypes( ) throw (RuntimeException)
{
Sequence< Type > aTypes1 = ::comphelper::concatSequences(
OGenericUnoController::getTypes(),
SbaXDataBrowserController_Base::getTypes(),
OPropertyContainer::getTypes()
);
return ::comphelper::concatSequences(
aTypes1,
m_pFormControllerImpl->getTypes()
);
}
//------------------------------------------------------------------
Sequence< sal_Int8 > SAL_CALL SbaXDataBrowserController::getImplementationId( ) throw (RuntimeException)
{
static ::cppu::OImplementationId aId;
return aId.getImplementationId();
}
//------------------------------------------------------------------
Any SAL_CALL SbaXDataBrowserController::queryInterface(const Type& _rType) throw (RuntimeException)
{
// check for our additional interfaces
@ -497,6 +522,18 @@ Any SAL_CALL SbaXDataBrowserController::queryInterface(const Type& _rType) throw
return aRet;
}
//------------------------------------------------------------------------------
void SAL_CALL SbaXDataBrowserController::acquire( ) throw ()
{
OGenericUnoController::acquire();
}
//------------------------------------------------------------------------------
void SAL_CALL SbaXDataBrowserController::release( ) throw ()
{
OGenericUnoController::release();
}
//------------------------------------------------------------------------------
SbaXDataBrowserController::SbaXDataBrowserController(const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM)
:OGenericUnoController(_rM)
@ -668,13 +705,13 @@ sal_Bool SbaXDataBrowserController::Construct(Window* pParent)
Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY);
if (xFormSet.is())
{
xFormSet->addPropertyChangeListener(PROPERTY_ISNEW, (XPropertyChangeListener*)this);
xFormSet->addPropertyChangeListener(PROPERTY_ISMODIFIED, (XPropertyChangeListener*)this);
xFormSet->addPropertyChangeListener(PROPERTY_ROWCOUNT, (XPropertyChangeListener*)this);
xFormSet->addPropertyChangeListener(PROPERTY_ACTIVECOMMAND, (XPropertyChangeListener*)this);
xFormSet->addPropertyChangeListener(PROPERTY_ORDER, (XPropertyChangeListener*)this);
xFormSet->addPropertyChangeListener(PROPERTY_FILTER, (XPropertyChangeListener*)this);
xFormSet->addPropertyChangeListener(PROPERTY_APPLYFILTER, (XPropertyChangeListener*)this);
xFormSet->addPropertyChangeListener(PROPERTY_ISNEW, static_cast<XPropertyChangeListener*>(this));
xFormSet->addPropertyChangeListener(PROPERTY_ISMODIFIED, static_cast<XPropertyChangeListener*>(this));
xFormSet->addPropertyChangeListener(PROPERTY_ROWCOUNT, static_cast<XPropertyChangeListener*>(this));
xFormSet->addPropertyChangeListener(PROPERTY_ACTIVECOMMAND, static_cast<XPropertyChangeListener*>(this));
xFormSet->addPropertyChangeListener(PROPERTY_ORDER, static_cast<XPropertyChangeListener*>(this));
xFormSet->addPropertyChangeListener(PROPERTY_FILTER, static_cast<XPropertyChangeListener*>(this));
xFormSet->addPropertyChangeListener(PROPERTY_APPLYFILTER, static_cast<XPropertyChangeListener*>(this));
}
Reference< ::com::sun::star::sdb::XSQLErrorBroadcaster > xFormError(getRowSet(), UNO_QUERY);
if (xFormError.is())
@ -803,12 +840,12 @@ void SbaXDataBrowserController::addControlListeners(const Reference< ::com::sun:
// to ge the 'modified' for the current cell
Reference< XModifyBroadcaster > xBroadcaster(getBrowserView()->getGridControl(), UNO_QUERY);
if (xBroadcaster.is())
xBroadcaster->addModifyListener((XModifyListener*)this);
xBroadcaster->addModifyListener(static_cast<XModifyListener*>(this));
// introduce ourself as dispatch provider for the grid
Reference< XDispatchProviderInterception > xInterception(getBrowserView()->getGridControl(), UNO_QUERY);
if (xInterception.is())
xInterception->registerDispatchProviderInterceptor((XDispatchProviderInterceptor*)this);
xInterception->registerDispatchProviderInterceptor(static_cast<XDispatchProviderInterceptor*>(this));
// add as focus listener to the control (needed for the form controller functionality)
Reference< XWindow > xWindow(_xGridControl, UNO_QUERY);
@ -821,11 +858,11 @@ void SbaXDataBrowserController::removeControlListeners(const Reference< ::com::s
{
Reference< XModifyBroadcaster > xBroadcaster(_xGridControl, UNO_QUERY);
if (xBroadcaster.is())
xBroadcaster->removeModifyListener((XModifyListener*)this);
xBroadcaster->removeModifyListener(static_cast<XModifyListener*>(this));
Reference< XDispatchProviderInterception > xInterception(_xGridControl, UNO_QUERY);
if (xInterception.is())
xInterception->releaseDispatchProviderInterceptor((XDispatchProviderInterceptor*)this);
xInterception->releaseDispatchProviderInterceptor(static_cast<XDispatchProviderInterceptor*>(this));
Reference< XWindow > xWindow(_xGridControl, UNO_QUERY);
if (xWindow.is())
@ -839,7 +876,7 @@ void SAL_CALL SbaXDataBrowserController::focusGained(const FocusEvent& e) throw(
EventObject aEvt(*this);
::cppu::OInterfaceIteratorHelper aIter(m_pFormControllerImpl->m_aActivateListeners);
while (aIter.hasMoreElements())
((XFormControllerListener*)aIter.next())->formActivated(aEvt);
static_cast<XFormControllerListener*>(aIter.next())->formActivated(aEvt);
}
//------------------------------------------------------------------
@ -866,7 +903,7 @@ void SAL_CALL SbaXDataBrowserController::focusLost(const FocusEvent& e) throw( R
EventObject aEvt(*this);
::cppu::OInterfaceIteratorHelper aIter(m_pFormControllerImpl->m_aActivateListeners);
while (aIter.hasMoreElements())
((XFormControllerListener*)aIter.next())->formDeactivated(aEvt);
static_cast<XFormControllerListener*>(aIter.next())->formDeactivated(aEvt);
// commit the changes of the grid control (as we're deactivated)
Reference< XBoundComponent > xCommitable(getBrowserView()->getGridControl(), UNO_QUERY);
@ -894,13 +931,13 @@ void SbaXDataBrowserController::disposingFormModel(const ::com::sun::star::lang:
Reference< XPropertySet > xSourceSet(Source.Source, UNO_QUERY);
if (xSourceSet.is())
{
xSourceSet->removePropertyChangeListener(PROPERTY_ISNEW, (XPropertyChangeListener*)this);
xSourceSet->removePropertyChangeListener(PROPERTY_ISMODIFIED, (XPropertyChangeListener*)this);
xSourceSet->removePropertyChangeListener(PROPERTY_ROWCOUNT, (XPropertyChangeListener*)this);
xSourceSet->removePropertyChangeListener(PROPERTY_ACTIVECOMMAND, (XPropertyChangeListener*)this);
xSourceSet->removePropertyChangeListener(PROPERTY_ORDER, (XPropertyChangeListener*)this);
xSourceSet->removePropertyChangeListener(PROPERTY_FILTER, (XPropertyChangeListener*)this);
xSourceSet->removePropertyChangeListener(PROPERTY_APPLYFILTER, (XPropertyChangeListener*)this);
xSourceSet->removePropertyChangeListener(PROPERTY_ISNEW, static_cast<XPropertyChangeListener*>(this));
xSourceSet->removePropertyChangeListener(PROPERTY_ISMODIFIED, static_cast<XPropertyChangeListener*>(this));
xSourceSet->removePropertyChangeListener(PROPERTY_ROWCOUNT, static_cast<XPropertyChangeListener*>(this));
xSourceSet->removePropertyChangeListener(PROPERTY_ACTIVECOMMAND, static_cast<XPropertyChangeListener*>(this));
xSourceSet->removePropertyChangeListener(PROPERTY_ORDER, static_cast<XPropertyChangeListener*>(this));
xSourceSet->removePropertyChangeListener(PROPERTY_FILTER, static_cast<XPropertyChangeListener*>(this));
xSourceSet->removePropertyChangeListener(PROPERTY_APPLYFILTER, static_cast<XPropertyChangeListener*>(this));
}
Reference< ::com::sun::star::sdb::XSQLErrorBroadcaster > xFormError(Source.Source, UNO_QUERY);
@ -1165,13 +1202,13 @@ void SbaXDataBrowserController::disposing()
Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY);
if (xFormSet.is())
{
xFormSet->removePropertyChangeListener(PROPERTY_ISNEW, (XPropertyChangeListener*)this);
xFormSet->removePropertyChangeListener(PROPERTY_ISMODIFIED, (XPropertyChangeListener*)this);
xFormSet->removePropertyChangeListener(PROPERTY_ROWCOUNT, (XPropertyChangeListener*)this);
xFormSet->removePropertyChangeListener(PROPERTY_ACTIVECOMMAND, (XPropertyChangeListener*)this);
xFormSet->removePropertyChangeListener(PROPERTY_ORDER, (XPropertyChangeListener*)this);
xFormSet->removePropertyChangeListener(PROPERTY_FILTER, (XPropertyChangeListener*)this);
xFormSet->removePropertyChangeListener(PROPERTY_APPLYFILTER, (XPropertyChangeListener*)this);
xFormSet->removePropertyChangeListener(PROPERTY_ISNEW, static_cast<XPropertyChangeListener*>(this));
xFormSet->removePropertyChangeListener(PROPERTY_ISMODIFIED, static_cast<XPropertyChangeListener*>(this));
xFormSet->removePropertyChangeListener(PROPERTY_ROWCOUNT, static_cast<XPropertyChangeListener*>(this));
xFormSet->removePropertyChangeListener(PROPERTY_ACTIVECOMMAND, static_cast<XPropertyChangeListener*>(this));
xFormSet->removePropertyChangeListener(PROPERTY_ORDER, static_cast<XPropertyChangeListener*>(this));
xFormSet->removePropertyChangeListener(PROPERTY_FILTER, static_cast<XPropertyChangeListener*>(this));
xFormSet->removePropertyChangeListener(PROPERTY_APPLYFILTER, static_cast<XPropertyChangeListener*>(this));
}
Reference< ::com::sun::star::sdb::XSQLErrorBroadcaster > xFormError(getRowSet(), UNO_QUERY);
@ -1299,7 +1336,7 @@ sal_Bool SbaXDataBrowserController::approveParameter(const ::com::sun::star::for
pParamRequest->addContinuation(pAbort);
// create the handler, let it handle the request
Reference< XInteractionHandler > xHandler(getProcessServiceFactory()->createInstance(SERVICE_SDB_INTERACTION_HANDLER), UNO_QUERY);
Reference< XInteractionHandler > xHandler(getORB()->createInstance(SERVICE_SDB_INTERACTION_HANDLER), UNO_QUERY);
if (xHandler.is())
{
::vos::OGuard aGuard(Application::GetSolarMutex());

View file

@ -2,9 +2,9 @@
*
* $RCSfile: brwctrlr.hxx,v $
*
* $Revision: 1.7 $
* $Revision: 1.8 $
*
* last change: $Author: fs $ $Date: 2001-05-16 14:24:18 $
* last change: $Author: fs $ $Date: 2001-06-21 17:49:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -68,6 +68,9 @@
#ifndef _SBA_GRID_HXX
#include "sbagrid.hxx"
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XCONTAINERLISTENER_HPP_
#include <com/sun/star/container/XContainerListener.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_XSQLERRORLISTENER_HPP_
#include <com/sun/star/sdb/XSQLErrorListener.hpp>
#endif
@ -89,6 +92,9 @@
#ifndef _COM_SUN_STAR_AWT_XFOCUSLISTENER_HPP_
#include <com/sun/star/awt/XFocusListener.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCHANGELISTENER_HPP_
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
#endif
#ifndef _SV_TIMER_HXX
#include <vcl/timer.hxx>
#endif
@ -104,8 +110,8 @@
#ifndef _SFXCANCEL_HXX
#include <svtools/cancel.hxx>
#endif
#ifndef _CPPUHELPER_IMPLBASE6_HXX_
#include <cppuhelper/implbase6.hxx>
#ifndef _CPPUHELPER_IMPLBASE8_HXX_
#include <cppuhelper/implbase8.hxx>
#endif
#ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_
#include <comphelper/proparrhlp.hxx>
@ -127,12 +133,14 @@ namespace dbaui
// =========================================================================
typedef ::cppu::ImplHelper6 < ::com::sun::star::sdb::XSQLErrorListener
typedef ::cppu::ImplHelper8 < ::com::sun::star::sdb::XSQLErrorListener
, ::com::sun::star::form::XDatabaseParameterListener
, ::com::sun::star::form::XConfirmDeleteListener
, ::com::sun::star::form::XLoadListener
, ::com::sun::star::form::XResetListener
, ::com::sun::star::awt::XFocusListener
, ::com::sun::star::container::XContainerListener
, ::com::sun::star::beans::XPropertyChangeListener
> SbaXDataBrowserController_Base;
class SbaXDataBrowserController
@ -223,13 +231,16 @@ namespace dbaui
// UNO
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL acquire( ) throw ();
virtual void SAL_CALL release( ) throw ();
// XTypeProvider
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException);
// ::com::sun::star::lang::XEventListener
virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException );
// ::com::sun::star::beans::XPropertyChangeListener
virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt);
// ::com::sun::star::util::XModifyListener
virtual void SAL_CALL modified(const ::com::sun::star::lang::EventObject& aEvent) throw( ::com::sun::star::uno::RuntimeException );
@ -238,6 +249,9 @@ namespace dbaui
virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& Event) throw( ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& Event) throw( ::com::sun::star::uno::RuntimeException );
// XPropertyChangeListener
virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException);
// ::com::sun::star::awt::XFocusListener
virtual void SAL_CALL focusGained(const ::com::sun::star::awt::FocusEvent& e) throw( ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL focusLost(const ::com::sun::star::awt::FocusEvent& e) throw( ::com::sun::star::uno::RuntimeException );