#97156# check if we are already suspended

This commit is contained in:
Ocke Janssen 2002-07-08 07:15:44 +00:00
parent 62121934df
commit 30a563676f
3 changed files with 33 additions and 10 deletions

View file

@ -2,9 +2,9 @@
*
* $RCSfile: JoinController.hxx,v $
*
* $Revision: 1.13 $
* $Revision: 1.14 $
*
* last change: $Author: oj $ $Date: 2002-02-19 14:13:36 $
* last change: $Author: oj $ $Date: 2002-07-08 08:14:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -113,7 +113,6 @@ namespace dbaui
sal_Bool m_bModified; // is the data modified
sal_Bool m_bViewsAllowed; // true when the Add Table dialog should also show views
// state of a feature. 'feature' may be the handle of a ::com::sun::star::util::URL somebody requested a dispatch interface for OR a toolbar slot.
virtual FeatureState GetState(sal_uInt16 nId) const;
// execute a feature

View file

@ -2,9 +2,9 @@
*
* $RCSfile: singledoccontroller.cxx,v $
*
* $Revision: 1.6 $
* $Revision: 1.7 $
*
* last change: $Author: oj $ $Date: 2002-05-06 08:50:00 $
* last change: $Author: oj $ $Date: 2002-07-08 08:15:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -165,6 +165,7 @@ namespace dbaui
:OSingleDocumentController_CBASE( _rxORB )
,OSingleDocumentController_PBASE( getBroadcastHelper() )
,m_bOwnConnection( sal_False )
,m_bSuspended( sal_False )
{
registerProperty( PROPERTY_ACTIVECONNECTION, PROPERTY_ID_ACTIVECONNECTION, PropertyAttribute::READONLY | PropertyAttribute::BOUND,
&m_xConnection, ::getCppuType( &m_xConnection ) );
@ -324,6 +325,7 @@ namespace dbaui
//--------------------------------------------------------------------
void OSingleDocumentController::reconnect( sal_Bool _bUI )
{
OSL_ENSURE(!m_bSuspended, "Cannot reconnect while suspended!");
OConnectionChangeBroadcaster( this );
stopConnectionListening(m_xConnection);
@ -408,7 +410,12 @@ namespace dbaui
//--------------------------------------------------------------------
void SAL_CALL OSingleDocumentController::disposing(const EventObject& _rSource) throw( RuntimeException )
{
if ( !getBroadcastHelper().bInDispose && !getBroadcastHelper().bDisposed && isConnected() && ( _rSource.Source == getConnection() ) )
if ( !m_bSuspended // when already suspended then we don't have to reconnect
&& !getBroadcastHelper().bInDispose
&& !getBroadcastHelper().bDisposed
&& isConnected()
&& ( _rSource.Source == getConnection() )
)
{
losingConnection();
}
@ -471,6 +478,17 @@ namespace dbaui
return m_aCurrentError.hasValue();
}
//--------------------------------------------------------------------
sal_Bool SAL_CALL OSingleDocumentController::suspend(sal_Bool bSuspend) throw( RuntimeException )
{
m_bSuspended = bSuspend;
if ( !bSuspend && !isConnected() )
reconnect(sal_True);
return sal_True;
}
// -----------------------------------------------------------------------------
//--------------------------------------------------------------------
//........................................................................
} // namespace dbaui
@ -479,6 +497,9 @@ namespace dbaui
/*************************************************************************
* history:
* $Log: not supported by cvs2svn $
* Revision 1.6 2002/05/06 08:50:00 oj
* #96363# impl new interface
*
* Revision 1.5 2001/09/07 10:03:53 fs
* ::disposing: don't reconnect if we're InDispose
*

View file

@ -2,9 +2,9 @@
*
* $RCSfile: JoinController.cxx,v $
*
* $Revision: 1.25 $
* $Revision: 1.26 $
*
* last change: $Author: oj $ $Date: 2002-05-29 08:30:22 $
* last change: $Author: oj $ $Date: 2002-07-08 08:15:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -431,9 +431,12 @@ void OJoinController::AddSupportedFeatures()
m_aSupportedFeatures[ ::rtl::OUString::createFromAscii(".uno:DB/AddTable")] = ID_BROWSER_ADDTABLE;
}
// -----------------------------------------------------------------------------
sal_Bool SAL_CALL OJoinController::suspend(sal_Bool bSuspend) throw( RuntimeException )
sal_Bool SAL_CALL OJoinController::suspend(sal_Bool _bSuspend) throw( RuntimeException )
{
return saveModified() != RET_CANCEL;
sal_Bool bCheck = saveModified() != RET_CANCEL;
if ( bCheck )
OSingleDocumentController::suspend(_bSuspend);
return bCheck;
}
// -----------------------------------------------------------------------------