summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2011-04-14 15:29:52 +0200
committerKurt Zenker <kz@openoffice.org>2011-04-14 15:29:52 +0200
commitd937dc8c1151b223e085257238dc1742423bc858 (patch)
tree6a42a2d9a36e9fffe8a0136b503dbe6a6bd1f548 /framework
parent80283e1fb7c6d47afb385339dbae708805d74ca0 (diff)
parent2c1329eb2da092247e6ebf2bce192526222576bd (diff)
CWS-TOOLING: integrate CWS fs34b_OOO340
Diffstat (limited to 'framework')
-rwxr-xr-xframework/source/fwe/helper/undomanagerhelper.cxx52
1 files changed, 38 insertions, 14 deletions
diff --git a/framework/source/fwe/helper/undomanagerhelper.cxx b/framework/source/fwe/helper/undomanagerhelper.cxx
index 891504adbe71..9e3b6c7265e0 100755
--- a/framework/source/fwe/helper/undomanagerhelper.cxx
+++ b/framework/source/fwe/helper/undomanagerhelper.cxx
@@ -220,6 +220,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;
@@ -241,6 +242,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 )
@@ -290,6 +292,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 );
@@ -480,6 +485,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( ::rtl::OUString::createFromAscii( "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 )
{
// create the request, and add it to our queue
@@ -1100,25 +1136,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::createFromAscii( "Undo manager is not locked" ), m_pImpl->getXUndoManager() );
- rUndoManager.EnableUndo( true );
- // <--- SYNCHRONIZED
+ m_pImpl->unlock();
}
//------------------------------------------------------------------------------------------------------------------