Kaydet (Commit) 511845e0 authored tarafından Frank Schoenheit [fs]'s avatar Frank Schoenheit [fs] Kaydeden (comit) Michael Meeks

fs34b: #i117039# restore old behavior of SfxUndoManager::EnableUndo

don't count the calls, but maintain a simple flag.
Consequently, let sw's UndoManager simply delegate now, and
change the UndoManagerHelper to maintain a lock counter itself.
Conflicts:

	framework/source/fwe/helper/undomanagerhelper.cxx
üst fc68fb4b
......@@ -218,6 +218,7 @@ namespace framework
bool m_disposed;
bool m_bAPIActionRunning;
bool m_bProcessingEvents;
sal_Int32 m_nLockCount;
::cppu::OInterfaceContainerHelper m_aUndoListeners;
::cppu::OInterfaceContainerHelper m_aModifyListeners;
IUndoManagerImplementation& m_rUndoManagerImplementation;
......@@ -239,6 +240,7 @@ namespace framework
,m_disposed( false )
,m_bAPIActionRunning( false )
,m_bProcessingEvents( false )
,m_nLockCount( 0 )
,m_aUndoListeners( m_aMutex )
,m_aModifyListeners( m_aMutex )
,m_rUndoManagerImplementation( i_undoManagerImpl )
......@@ -288,6 +290,9 @@ namespace framework
void clearRedo( IMutexGuard& i_instanceLock );
void reset( IMutexGuard& i_instanceLock );
void lock();
void unlock();
void addUndoManagerListener( const Reference< XUndoManagerListener >& i_listener )
{
m_aUndoListeners.addInterface( i_listener );
......@@ -477,6 +482,37 @@ namespace framework
);
}
//------------------------------------------------------------------------------------------------------------------
void UndoManagerHelper_Impl::lock()
{
// SYNCHRONIZED --->
::osl::MutexGuard aGuard( getMutex() );
if ( ++m_nLockCount == 1 )
{
IUndoManager& rUndoManager = getUndoManager();
rUndoManager.EnableUndo( false );
}
// <--- SYNCHRONIZED
}
//------------------------------------------------------------------------------------------------------------------
void UndoManagerHelper_Impl::unlock()
{
// SYNCHRONIZED --->
::osl::MutexGuard aGuard( getMutex() );
if ( m_nLockCount == 0 )
throw NotLockedException( "Undo manager is not locked", getXUndoManager() );
if ( --m_nLockCount == 0 )
{
IUndoManager& rUndoManager = getUndoManager();
rUndoManager.EnableUndo( true );
}
// <--- SYNCHRONIZED
}
//------------------------------------------------------------------------------------------------------------------
void UndoManagerHelper_Impl::impl_processRequest( ::boost::function0< void > const& i_request, IMutexGuard& i_instanceLock )
{
......@@ -1098,25 +1134,13 @@ namespace framework
//------------------------------------------------------------------------------------------------------------------
void UndoManagerHelper::lock()
{
// SYNCHRONIZED --->
::osl::MutexGuard aGuard( m_pImpl->getMutex() );
IUndoManager& rUndoManager = m_pImpl->getUndoManager();
rUndoManager.EnableUndo( false );
// <--- SYNCHRONIZED
m_pImpl->lock();
}
//------------------------------------------------------------------------------------------------------------------
void UndoManagerHelper::unlock()
{
// SYNCHRONIZED --->
::osl::MutexGuard aGuard( m_pImpl->getMutex() );
IUndoManager& rUndoManager = m_pImpl->getUndoManager();
if ( rUndoManager.IsUndoEnabled() )
throw NotLockedException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Undo manager is not locked" )), m_pImpl->getXUndoManager() );
rUndoManager.EnableUndo( true );
// <--- SYNCHRONIZED
m_pImpl->unlock();
}
//------------------------------------------------------------------------------------------------------------------
......
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