[Libreoffice-commits] core.git: 10 commits - framework/inc framework/source

Stephan Bergmann sbergman at redhat.com
Tue Mar 18 09:38:24 PDT 2014


 framework/inc/jobs/job.hxx                              |    4 
 framework/inc/jobs/jobdata.hxx                          |    3 
 framework/inc/jobs/jobresult.hxx                        |    3 
 framework/inc/jobs/joburl.hxx                           |    3 
 framework/inc/recording/dispatchrecorder.hxx            |    4 
 framework/inc/recording/dispatchrecordersupplier.hxx    |    7 
 framework/inc/services/desktop.hxx                      |    2 
 framework/inc/services/layoutmanager.hxx                |    8 
 framework/source/jobs/job.cxx                           |   80 ---
 framework/source/jobs/jobdata.cxx                       |   90 ---
 framework/source/jobs/jobdispatch.cxx                   |   30 -
 framework/source/jobs/jobresult.cxx                     |   25 
 framework/source/jobs/joburl.cxx                        |   47 -
 framework/source/layoutmanager/layoutmanager.cxx        |  407 +++++++---------
 framework/source/layoutmanager/toolbarlayoutmanager.cxx |  262 ++++------
 framework/source/layoutmanager/toolbarlayoutmanager.hxx |    4 
 framework/source/recording/dispatchrecorder.cxx         |   12 
 framework/source/recording/dispatchrecordersupplier.cxx |   21 
 framework/source/services/desktop.cxx                   |   52 --
 19 files changed, 420 insertions(+), 644 deletions(-)

New commits:
commit 28e68298a40c02b47ccaa602a464ddf12ddbe3cd
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Mar 18 16:54:50 2014 +0100

    Use SolarMutexGuard directly
    
    Change-Id: I1eeaebf1411b44c5881e2c08d95debb533e66b4e

diff --git a/framework/inc/services/desktop.hxx b/framework/inc/services/desktop.hxx
index f2a1c10..c1abc04 100644
--- a/framework/inc/services/desktop.hxx
+++ b/framework/inc/services/desktop.hxx
@@ -23,7 +23,6 @@
 #include <sal/config.h>
 
 #include <classes/framecontainer.hxx>
-#include <threadhelp/threadhelpbase.hxx>
 
 #include <com/sun/star/frame/XUntitledNumbers.hpp>
 #include <com/sun/star/frame/XController.hpp>
@@ -98,7 +97,6 @@ typedef cppu::WeakComponentImplHelper6<
            css::frame::XUntitledNumbers > Desktop_BASE;
 
 class Desktop : private cppu::BaseMutex,
-                private ThreadHelpBase,
                 private TransactionBase,
                 public Desktop_BASE,
                 public cppu::OPropertySetHelper
diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx
index b2be9b8..44948d3 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -29,7 +29,6 @@
 #include <dispatch/interceptionhelper.hxx>
 #include <classes/taskcreator.hxx>
 #include <threadhelp/transactionguard.hxx>
-#include <threadhelp/guard.hxx>
 #include <general.h>
 #include <properties.h>
 
@@ -154,15 +153,14 @@ void Desktop::constructorInit()
     @onerror    We throw an ASSERT in debug version or do nothing in relaese version.
 *//*-*************************************************************************************************************/
 Desktop::Desktop( const css::uno::Reference< css::uno::XComponentContext >& xContext )
-        :   ThreadHelpBase          ( &Application::GetSolarMutex()                 )
-        ,   TransactionBase         (                                               )
+        :   TransactionBase         (                                               )
         ,   Desktop_BASE            ( m_aMutex )
         ,   cppu::OPropertySetHelper( cppu::WeakComponentImplHelperBase::rBHelper   )
         // Init member
         ,   m_bIsTerminated         ( sal_False                                     )   // see dispose() for further information!
         ,   m_xContext              ( xContext                                      )
         ,   m_aChildTaskContainer   (                                               )
-        ,   m_aListenerContainer    ( m_aLock.getShareableOslMutex()                )
+        ,   m_aListenerContainer    ( m_aMutex )
         ,   m_xFramesHelper         (                                               )
         ,   m_xDispatchHelper       (                                               )
         ,   m_eLoadState            ( E_NOTSET                                      )
@@ -220,7 +218,7 @@ sal_Bool SAL_CALL Desktop::terminate()
 {
     TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
 
-    Guard aReadLock( m_aLock ); // start synchronize
+    SolarMutexClearableGuard aReadLock;
 
     css::uno::Reference< css::frame::XTerminateListener > xPipeTerminator    = m_xPipeTerminator;
     css::uno::Reference< css::frame::XTerminateListener > xQuickLauncher     = m_xQuickLauncher;
@@ -230,7 +228,7 @@ sal_Bool SAL_CALL Desktop::terminate()
     css::lang::EventObject                                aEvent             ( static_cast< ::cppu::OWeakObject* >(this) );
     ::sal_Bool                                            bAskQuickStart     = !m_bSuspendQuickstartVeto                  ;
 
-    aReadLock.unlock(); // end synchronize
+    aReadLock.clear();
 
 
     // Ask normal terminate listener. They could stop terminate without closing any open document.
@@ -315,9 +313,9 @@ sal_Bool SAL_CALL Desktop::terminate()
             // "Protect" us against dispose before terminate calls!
             // see dispose() for further information.
             /* SAFE AREA --------------------------------------------------------------------------------------- */
-            Guard aWriteLock( m_aLock );
+            SolarMutexClearableGuard aWriteLock;
             m_bIsTerminated = sal_True;
-            aWriteLock.unlock();
+            aWriteLock.clear();
             /* UNSAFE AREA ------------------------------------------------------------------------------------- */
 
         impl_sendNotifyTerminationEvent();
@@ -387,8 +385,7 @@ void SAL_CALL Desktop::addTerminateListener( const css::uno::Reference< css::fra
     {
         OUString sImplementationName = xInfo->getImplementationName();
 
-        // SYCNHRONIZED ->
-        Guard aWriteLock( m_aLock );
+        SolarMutexGuard g;
 
         if( sImplementationName == "com.sun.star.comp.sfx2.SfxTerminateListener" )
         {
@@ -410,9 +407,6 @@ void SAL_CALL Desktop::addTerminateListener( const css::uno::Reference< css::fra
             m_xSWThreadManager = xListener;
             return;
         }
-
-        aWriteLock.unlock();
-        // <- SYCNHRONIZED
     }
 
     // No lock required ... container is threadsafe by itself.
@@ -430,8 +424,7 @@ void SAL_CALL Desktop::removeTerminateListener( const css::uno::Reference< css::
     {
         OUString sImplementationName = xInfo->getImplementationName();
 
-        // SYCNHRONIZED ->
-        Guard aWriteLock( m_aLock );
+        SolarMutexGuard g;
 
         if( sImplementationName == "com.sun.star.comp.sfx2.SfxTerminateListener" )
         {
@@ -456,9 +449,6 @@ void SAL_CALL Desktop::removeTerminateListener( const css::uno::Reference< css::
             m_xSWThreadManager.clear();
             return;
         }
-
-        aWriteLock.unlock();
-        // <- SYCNHRONIZED
     }
 
     // No lock required ... container is threadsafe by itself.
@@ -846,19 +836,14 @@ css::uno::Reference< css::frame::XFramesSupplier > SAL_CALL Desktop::getCreator(
 
 OUString SAL_CALL Desktop::getName() throw( css::uno::RuntimeException, std::exception )
 {
-    /* SAFE { */
-    Guard aReadLock( m_aLock );
+    SolarMutexGuard g;
     return m_sName;
-    /* } SAFE */
 }
 
 void SAL_CALL Desktop::setName( const OUString& sName ) throw( css::uno::RuntimeException, std::exception )
 {
-    /* SAFE { */
-    Guard aWriteLock( m_aLock );
+    SolarMutexGuard g;
     m_sName = sName;
-    aWriteLock.unlock();
-    /* } SAFE */
 }
 
 sal_Bool SAL_CALL Desktop::isTop() throw( css::uno::RuntimeException, std::exception )
@@ -1087,7 +1072,7 @@ void SAL_CALL Desktop::disposing()
     // tests for instance in sc/qa/unit) nothing bad happens.
     SAL_WARN_IF( !m_bIsTerminated, "fwk", "Desktop disposed before terminating it" );
 
-    Guard aWriteLock( m_aLock ); // start synchronize
+    SolarMutexClearableGuard aWriteLock;
 
     // Look for multiple calls of this method!
     // If somewhere call dispose() twice - he will be stopped here really!!!
@@ -1108,7 +1093,7 @@ void SAL_CALL Desktop::disposing()
     // and reject all new incoming requests!
     m_aTransactionManager.setWorkingMode( E_BEFORECLOSE );
 
-    aWriteLock.unlock(); // end synchronize
+    aWriteLock.clear();
 
     // Following lines of code can be called outside a synchronized block ...
     // Because our transaction manager will block all new requests to this object.
@@ -1210,8 +1195,7 @@ void SAL_CALL Desktop::dispatchFinished( const css::frame::DispatchResultEvent&
     // Register transaction and reject wrong calls.
     TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
 
-    /* SAFE AREA ------------------------------------------------------------------------------------------- */
-    Guard aWriteLock( m_aLock );
+    SolarMutexGuard g;
     if( m_eLoadState != E_INTERACTION )
     {
         m_xLastFrame = css::uno::Reference< css::frame::XFrame >();
@@ -1223,7 +1207,6 @@ void SAL_CALL Desktop::dispatchFinished( const css::frame::DispatchResultEvent&
                 m_eLoadState = E_SUCCESSFUL;
         }
     }
-    /* UNSAFE AREA ----------------------------------------------------------------------------------------- */
 }
 
 /*-************************************************************************************************************
@@ -1334,18 +1317,15 @@ void SAL_CALL Desktop::handle( const css::uno::Reference< css::task::XInteractio
         bAbort = sal_True;
     }
 
-    /* SAFE AREA ------------------------------------------------------------------------------------------- */
     // Ok now it's time to break yield loop of loadComponentFromURL().
     // But only for really aborted requests!
     // For example warnings will be approved and we wait for any success story ...
     if (bAbort)
     {
-        Guard aWriteLock( m_aLock );
+        SolarMutexGuard g;
         m_eLoadState          = E_INTERACTION;
         m_aInteractionRequest = aRequest     ;
-        aWriteLock.unlock();
     }
-    /* UNSAFE AREA ----------------------------------------------------------------------------------------- */
 }
 
 
@@ -1804,9 +1784,9 @@ void Desktop::impl_sendNotifyTerminationEvent()
 
 ::sal_Bool Desktop::impl_closeFrames(::sal_Bool bAllowUI)
 {
-    Guard aReadLock( m_aLock ); // start synchronize
+    SolarMutexClearableGuard aReadLock;
     css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > lFrames = m_aChildTaskContainer.getAllElements();
-    aReadLock.unlock(); // end synchronize
+    aReadLock.clear();
 
     ::sal_Int32 c                = lFrames.getLength();
     ::sal_Int32 i                = 0;
commit 8a2e5420fe584aa4f2785acc72cd8403beb88073
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Mar 18 16:49:49 2014 +0100

    Use SolarMutexGuard directly
    
    Change-Id: I0ff561aecfd16f59be90f054d076d771179c77cd

diff --git a/framework/inc/recording/dispatchrecordersupplier.hxx b/framework/inc/recording/dispatchrecordersupplier.hxx
index df01707..996010e 100644
--- a/framework/inc/recording/dispatchrecordersupplier.hxx
+++ b/framework/inc/recording/dispatchrecordersupplier.hxx
@@ -20,7 +20,6 @@
 #ifndef INCLUDED_FRAMEWORK_INC_RECORDING_DISPATCHRECORDERSUPPLIER_HXX
 #define INCLUDED_FRAMEWORK_INC_RECORDING_DISPATCHRECORDERSUPPLIER_HXX
 
-#include <threadhelp/threadhelpbase.hxx>
 #include <macros/xinterface.hxx>
 #include <macros/xtypeprovider.hxx>
 #include <macros/xserviceinfo.hxx>
@@ -45,11 +44,7 @@ namespace framework{
 
     @threadsafe     yes
  */
-class DispatchRecorderSupplier  :   // baseclasses
-                                    // Order is necessary for right initialization!
-                                    private ThreadHelpBase                          ,
-                                    // interfaces
-                                    public  ::cppu::WeakImplHelper2<
+class DispatchRecorderSupplier  :   public  ::cppu::WeakImplHelper2<
                                                 css::lang::XServiceInfo             ,
                                                 css::frame::XDispatchRecorderSupplier >
 {
diff --git a/framework/source/recording/dispatchrecordersupplier.cxx b/framework/source/recording/dispatchrecordersupplier.cxx
index 6fbcad4..41e9c26 100644
--- a/framework/source/recording/dispatchrecordersupplier.cxx
+++ b/framework/source/recording/dispatchrecordersupplier.cxx
@@ -18,7 +18,6 @@
  */
 
 #include <recording/dispatchrecordersupplier.hxx>
-#include <threadhelp/guard.hxx>
 #include <services.h>
 
 #include <com/sun/star/frame/XRecordableDispatch.hpp>
@@ -55,11 +54,7 @@ DEFINE_INIT_SERVICE(
             it's not necessary to do anything here.
  */
 DispatchRecorderSupplier::DispatchRecorderSupplier( const css::uno::Reference< css::lang::XMultiServiceFactory >& )
-        //  init baseclasses first!
-        //  Attention: Don't change order of initialization!
-        : ThreadHelpBase     ( &Application::GetSolarMutex() )
-        //  init member
-        , m_xDispatchRecorder( NULL                          )
+        : m_xDispatchRecorder( NULL                          )
 {
 }
 
@@ -95,10 +90,8 @@ DispatchRecorderSupplier::~DispatchRecorderSupplier()
  */
 void SAL_CALL DispatchRecorderSupplier::setDispatchRecorder( const css::uno::Reference< css::frame::XDispatchRecorder >& xRecorder ) throw (css::uno::RuntimeException, std::exception)
 {
-    // SAFE =>
-    Guard aWriteLock(m_aLock);
+    SolarMutexGuard g;
     m_xDispatchRecorder=xRecorder;
-    // => SAFE
 }
 
 /**
@@ -117,10 +110,8 @@ void SAL_CALL DispatchRecorderSupplier::setDispatchRecorder( const css::uno::Ref
  */
 css::uno::Reference< css::frame::XDispatchRecorder > SAL_CALL DispatchRecorderSupplier::getDispatchRecorder() throw (css::uno::RuntimeException, std::exception)
 {
-    // SAFE =>
-    Guard aReadLock(m_aLock);
+    SolarMutexGuard g;
     return m_xDispatchRecorder;
-    // => SAFE
 }
 
 
@@ -141,11 +132,9 @@ void SAL_CALL DispatchRecorderSupplier::dispatchAndRecord( const css::util::URL&
                                                            const css::uno::Sequence< css::beans::PropertyValue >& lArguments  ,
                                                            const css::uno::Reference< css::frame::XDispatch >&    xDispatcher ) throw (css::uno::RuntimeException, std::exception)
 {
-    // SAFE =>
-    Guard aReadLock(m_aLock);
+    SolarMutexClearableGuard aReadLock;
     css::uno::Reference< css::frame::XDispatchRecorder > xRecorder = m_xDispatchRecorder;
-    aReadLock.unlock();
-    // => SAFE
+    aReadLock.clear();
 
     // clear unspecific situations
     if (!xDispatcher.is())
commit 98861476f23c54adb1514f9ebf62b28a34002e99
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Mar 18 16:48:14 2014 +0100

    Use SolarMutexGuard directly
    
    Change-Id: Ifa48a4cb78466b120e357412c64031f5de2b75d1

diff --git a/framework/inc/recording/dispatchrecorder.hxx b/framework/inc/recording/dispatchrecorder.hxx
index 8daeee7..d27025a 100644
--- a/framework/inc/recording/dispatchrecorder.hxx
+++ b/framework/inc/recording/dispatchrecorder.hxx
@@ -25,7 +25,6 @@
 */
 #include <vector>
 
-#include <threadhelp/threadhelpbase.hxx>
 #include <macros/xinterface.hxx>
 #include <macros/xtypeprovider.hxx>
 #include <macros/xserviceinfo.hxx>
@@ -49,8 +48,7 @@ namespace framework{
 typedef ::std::vector < com::sun::star::frame::DispatchStatement > DispatchStatementList;
 
 class DispatchRecorder
-    : private ThreadHelpBase
-    , public  ::cppu::WeakImplHelper3<
+    : public  ::cppu::WeakImplHelper3<
                 css::lang::XServiceInfo
               , css::frame::XDispatchRecorder
               , css::container::XIndexReplace >
diff --git a/framework/source/recording/dispatchrecorder.cxx b/framework/source/recording/dispatchrecorder.cxx
index 9e10d7b..1017885 100644
--- a/framework/source/recording/dispatchrecorder.cxx
+++ b/framework/source/recording/dispatchrecorder.cxx
@@ -21,7 +21,6 @@
 #include <recording/dispatchrecorder.hxx>
 #include <com/sun/star/frame/DispatchStatement.hpp>
 #include <com/sun/star/script/Converter.hpp>
-#include <threadhelp/guard.hxx>
 #include <services.h>
 #include <vcl/svapp.hxx>
 #include <comphelper/processfactory.hxx>
@@ -101,8 +100,7 @@ Sequence< Any > make_seq_out_of_struct(
 
 
 DispatchRecorder::DispatchRecorder( const css::uno::Reference< css::uno::XComponentContext >& xContext )
-        : ThreadHelpBase     ( &Application::GetSolarMutex() )
-        , m_xConverter( css::script::Converter::create(xContext) )
+        : m_xConverter( css::script::Converter::create(xContext) )
 {
 }
 
@@ -142,16 +140,13 @@ void SAL_CALL  DispatchRecorder::recordDispatchAsComment( const css::util::URL&
 
 void SAL_CALL DispatchRecorder::endRecording() throw( css::uno::RuntimeException, std::exception )
 {
-    /* SAFE{ */
-    Guard aWriteLock(m_aLock);
+    SolarMutexGuard g;
     m_aStatements.clear();
-    /* } */
 }
 
 OUString SAL_CALL DispatchRecorder::getRecordedMacro() throw( css::uno::RuntimeException, std::exception )
 {
-    /* SAFE{ */
-    Guard aWriteLock(m_aLock);
+    SolarMutexGuard g;
 
     if ( m_aStatements.empty() )
         return OUString();
@@ -174,7 +169,6 @@ OUString SAL_CALL DispatchRecorder::getRecordedMacro() throw( css::uno::RuntimeE
         implts_recordMacro( p->aCommand, p->aArgs, p->bIsComment, aScriptBuffer );
     OUString sScript = aScriptBuffer.makeStringAndClear();
     return sScript;
-    /* } */
 }
 
 
commit 5d54e99312002553c33ac43803ba1df2f40d08cd
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Mar 18 16:45:14 2014 +0100

    Use SolarMutexGuard directly
    
    Change-Id: I6e558d312e1c0b4243d9ce7a44cc3be346863bab

diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index 76e06b0..068567f 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -23,7 +23,6 @@
 #include <helpers.hxx>
 #include <services.h>
 #include <services/layoutmanager.hxx>
-#include <threadhelp/guard.hxx>
 #include <classes/resource.hrc>
 #include <classes/fwkresid.hxx>
 
@@ -54,8 +53,7 @@ namespace framework
 ToolbarLayoutManager::ToolbarLayoutManager(
     const uno::Reference< uno::XComponentContext >& rxContext,
     const uno::Reference< ui::XUIElementFactory >& xUIElementFactory,
-    ILayoutNotifications* pParentLayouter )
-    : ThreadHelpBase( &Application::GetSolarMutex() ),
+    ILayoutNotifications* pParentLayouter ):
     m_xContext( rxContext),
     m_xUIElementFactoryManager( xUIElementFactory ),
     m_pParentLayouter( pParentLayouter ),
@@ -121,38 +119,37 @@ void SAL_CALL ToolbarLayoutManager::disposing( const lang::EventObject& aEvent )
 
 awt::Rectangle ToolbarLayoutManager::getDockingArea()
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexResettableGuard aWriteLock;
     Rectangle aNewDockingArea( m_aDockingArea );
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     if ( isLayoutDirty() )
         aNewDockingArea = implts_calcDockingArea();
 
-    aWriteLock.lock();
+    aWriteLock.reset();
     m_aDockingArea = aNewDockingArea;
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     return putRectangleValueToAWT(aNewDockingArea);
 }
 
 void ToolbarLayoutManager::setDockingArea( const awt::Rectangle& rDockingArea )
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexGuard g;
     m_aDockingArea = putAWTToRectangle( rDockingArea );
     m_bLayoutDirty = true;
-    aWriteLock.unlock();
 }
 
 void ToolbarLayoutManager::implts_setDockingAreaWindowSizes( const awt::Rectangle& rBorderSpace )
 {
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
     Rectangle aDockOffsets = m_aDockingAreaOffsets;
     uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow );
     uno::Reference< awt::XWindow > xTopDockAreaWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] );
     uno::Reference< awt::XWindow > xBottomDockAreaWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] );
     uno::Reference< awt::XWindow > xLeftDockAreaWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] );
     uno::Reference< awt::XWindow > xRightDockAreaWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT] );
-    aReadLock.unlock();
+    aReadLock.clear();
 
     uno::Reference< awt::XDevice > xDevice( xContainerWindow, uno::UNO_QUERY );
 
@@ -213,11 +210,11 @@ bool ToolbarLayoutManager::isLayoutDirty()
 
 void ToolbarLayoutManager::doLayout(const ::Size& aContainerSize)
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexResettableGuard aWriteLock;
     bool bLayoutInProgress( m_bLayoutInProgress );
     m_bLayoutInProgress = true;
     awt::Rectangle aDockingArea = putRectangleValueToAWT( m_aDockingArea );
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     if ( bLayoutInProgress )
         return;
@@ -242,15 +239,15 @@ void ToolbarLayoutManager::doLayout(const ::Size& aContainerSize)
 
     implts_setDockingAreaWindowSizes( aDockingArea );
 
-    aWriteLock.lock();
+    aWriteLock.reset();
     m_bLayoutDirty      = false;
     m_bLayoutInProgress = false;
-    aWriteLock.unlock();
+    aWriteLock.clear();
 }
 
 bool ToolbarLayoutManager::implts_isParentWindowVisible() const
 {
-    Guard aReadLock( m_aLock );
+    SolarMutexGuard g;
     bool bVisible( false );
     if ( m_xContainerWindow.is() )
         bVisible = m_xContainerWindow->isVisible();
@@ -260,9 +257,9 @@ bool ToolbarLayoutManager::implts_isParentWindowVisible() const
 
 Rectangle ToolbarLayoutManager::implts_calcDockingArea()
 {
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
     UIElementVector aWindowVector( m_aUIElements );
-    aReadLock.unlock();
+    aReadLock.clear();
 
     Rectangle                aBorderSpace;
     sal_Int32                nCurrRowColumn( 0 );
@@ -360,14 +357,14 @@ Rectangle ToolbarLayoutManager::implts_calcDockingArea()
 
 void ToolbarLayoutManager::reset()
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexClearableGuard aWriteLock;
     uno::Reference< ui::XUIConfigurationManager > xModuleCfgMgr( m_xModuleCfgMgr );
     uno::Reference< ui::XUIConfigurationManager > xDocCfgMgr( m_xDocCfgMgr );
     m_xModuleCfgMgr.clear();
     m_xDocCfgMgr.clear();
     m_ePreviewDetection = PREVIEWFRAME_UNKNOWN;
     m_bComponentAttached = false;
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     destroyToolbars();
     resetDockingArea();
@@ -383,7 +380,7 @@ void ToolbarLayoutManager::attach(
     if ( m_xFrame.is() && m_xFrame != xFrame )
         reset();
 
-    Guard aWriteLock( m_aLock );
+    SolarMutexGuard g;
     m_xFrame                 = xFrame;
     m_xModuleCfgMgr          = xModuleCfgMgr;
     m_xDocCfgMgr             = xDocCfgMgr;
@@ -393,14 +390,13 @@ void ToolbarLayoutManager::attach(
 
 bool ToolbarLayoutManager::isPreviewFrame()
 {
-    Guard aReadLock( m_aLock );
+    SolarMutexGuard g;
     if (m_ePreviewDetection == PREVIEWFRAME_UNKNOWN)
     {
         uno::Reference< frame::XFrame > xFrame( m_xFrame );
 
         uno::Reference< frame::XModel > xModel( impl_getModelFromFrame( xFrame ));
 
-        Guard aWriteLock( m_aLock );
         m_ePreviewDetection = (implts_isPreviewModel( xModel ) ? PREVIEWFRAME_YES : PREVIEWFRAME_NO);
     }
     return m_ePreviewDetection == PREVIEWFRAME_YES;
@@ -469,7 +465,7 @@ bool ToolbarLayoutManager::destroyToolbar( const OUString& rResourceURL )
     bool bMustLayouted( false );
     bool bMustBeDestroyed( !rResourceURL.startsWith("private:resource/toolbar/addon_") );
 
-    Guard aWriteLock( m_aLock );
+    SolarMutexClearableGuard aWriteLock;
     for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
     {
         if ( pIter->m_aName == rResourceURL )
@@ -482,7 +478,7 @@ bool ToolbarLayoutManager::destroyToolbar( const OUString& rResourceURL )
             break;
         }
     }
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     uno::Reference< ui::XUIElement > xUIElement( xComponent, uno::UNO_QUERY );
     if ( xUIElement.is() )
@@ -545,10 +541,10 @@ void ToolbarLayoutManager::destroyToolbars()
     UIElementVector aUIElementVector;
     implts_getUIElementVectorCopy( aUIElementVector );
 
-    Guard aWriteLock( m_aLock );
+    SolarMutexClearableGuard aWriteLock;
     m_aUIElements.clear();
     m_bLayoutDirty = true;
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     UIElementVector::iterator pIter;
     for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); ++pIter )
@@ -615,9 +611,9 @@ void ToolbarLayoutManager::refreshToolbarsVisibility( bool bAutomaticToolbars )
 {
     UIElementVector aUIElementVector;
 
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
     bool bVisible( m_bVisible );
-    aReadLock.unlock();
+    aReadLock.clear();
 
     if ( !bVisible || !bAutomaticToolbars )
         return;
@@ -632,7 +628,7 @@ void ToolbarLayoutManager::refreshToolbarsVisibility( bool bAutomaticToolbars )
         if ( implts_readWindowStateData( pIter->m_aName, aUIElement ) &&
              ( pIter->m_bVisible != aUIElement.m_bVisible ) && !pIter->m_bMasterHide )
         {
-            Guard aWriteLock( m_aLock );
+            SolarMutexGuard g;
             UIElement& rUIElement = impl_findToolbar( pIter->m_aName );
             if ( rUIElement.m_aName == pIter->m_aName )
             {
@@ -789,14 +785,14 @@ bool ToolbarLayoutManager::dockAllToolbars()
 {
     std::vector< OUString > aToolBarNameVector;
 
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
     UIElementVector::iterator pIter;
     for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
     {
         if ( pIter->m_aType == "toolbar" && pIter->m_xUIElement.is() && pIter->m_bFloating && pIter->m_bVisible )
             aToolBarNameVector.push_back( pIter->m_aName );
     }
-    aReadLock.unlock();
+    aReadLock.clear();
 
     bool bResult(true);
     const sal_uInt32 nCount = aToolBarNameVector.size();
@@ -833,7 +829,7 @@ long ToolbarLayoutManager::childWindowEvent( VclSimpleEvent* pEvent )
 
             if ( !aToolbarName.isEmpty() && !aCommand.isEmpty() )
             {
-                Guard aReadLock( m_aLock );
+                SolarMutexClearableGuard aReadLock;
                 ::std::vector< uno::Reference< ui::XUIFunctionListener > > aListenerArray;
                 UIElementVector::iterator pIter;
 
@@ -846,7 +842,7 @@ long ToolbarLayoutManager::childWindowEvent( VclSimpleEvent* pEvent )
                             aListenerArray.push_back( xListener );
                     }
                 }
-                aReadLock.unlock();
+                aReadLock.clear();
 
                 const sal_uInt32 nCount = aListenerArray.size();
                 for ( sal_uInt32 i = 0; i < nCount; ++i )
@@ -896,12 +892,12 @@ long ToolbarLayoutManager::childWindowEvent( VclSimpleEvent* pEvent )
 
 void ToolbarLayoutManager::resetDockingArea()
 {
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
     uno::Reference< awt::XWindow > xTopDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] );
     uno::Reference< awt::XWindow > xLeftDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] );
     uno::Reference< awt::XWindow > xRightDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT] );
     uno::Reference< awt::XWindow > xBottomDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] );
-    aReadLock.unlock();
+    aReadLock.clear();
 
     if ( xTopDockingWindow.is() )
         xTopDockingWindow->setPosSize( 0, 0, 0, 0, awt::PosSize::POSSIZE );
@@ -923,13 +919,13 @@ void ToolbarLayoutManager::setParentWindow(
     uno::Reference< awt::XWindow > xRightDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xContext, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
     uno::Reference< awt::XWindow > xBottomDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xContext, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
 
-    Guard aWriteLock( m_aLock );
+    SolarMutexClearableGuard aWriteLock;
     m_xContainerWindow = uno::Reference< awt::XWindow2 >( xParentWindow, uno::UNO_QUERY );
     m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP]    = xTopDockWindow;
     m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT]   = xLeftDockWindow;
     m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT]  = xRightDockWindow;
     m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] = xBottomDockWindow;
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     if ( xParentWindow.is() )
     {
@@ -953,7 +949,7 @@ void ToolbarLayoutManager::setParentWindow(
 
 void ToolbarLayoutManager::setDockingAreaOffsets( const ::Rectangle aOffsets )
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexGuard g;
     m_aDockingAreaOffsets = aOffsets;
     m_bLayoutDirty        = true;
 }
@@ -971,13 +967,13 @@ OUString ToolbarLayoutManager::implts_generateGenericAddonToolbarTitle( sal_Int3
 
 void ToolbarLayoutManager::implts_createAddonsToolBars()
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexClearableGuard aWriteLock;
     if ( !m_pAddonOptions )
         m_pAddonOptions = new AddonsOptions;
 
     uno::Reference< ui::XUIElementFactory > xUIElementFactory( m_xUIElementFactoryManager );
     uno::Reference< frame::XFrame > xFrame( m_xFrame );
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     if (isPreviewFrame())
         return; // no addon toolbars for preview frame!
@@ -1084,7 +1080,7 @@ void ToolbarLayoutManager::implts_createAddonsToolBars()
 
 void ToolbarLayoutManager::implts_createCustomToolBars()
 {
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
     if ( !m_bComponentAttached )
         return;
 
@@ -1092,7 +1088,7 @@ void ToolbarLayoutManager::implts_createCustomToolBars()
     uno::Reference< frame::XFrame > xFrame( m_xFrame );
     uno::Reference< ui::XUIConfigurationManager > xModuleCfgMgr( m_xModuleCfgMgr, uno::UNO_QUERY );
     uno::Reference< ui::XUIConfigurationManager > xDocCfgMgr( m_xDocCfgMgr, uno::UNO_QUERY );
-    aReadLock.unlock();
+    aReadLock.clear();
 
     if ( xFrame.is() )
     {
@@ -1115,14 +1111,14 @@ void ToolbarLayoutManager::implts_createCustomToolBars()
 
 void ToolbarLayoutManager::implts_createNonContextSensitiveToolBars()
 {
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
 
     if ( !m_xPersistentWindowState.is() || !m_xFrame.is() || !m_bComponentAttached )
         return;
 
     uno::Reference< ui::XUIElementFactory >  xUIElementFactory( m_xUIElementFactoryManager );
     uno::Reference< container::XNameAccess > xPersistentWindowState( m_xPersistentWindowState );
-    aReadLock.unlock();
+    aReadLock.clear();
 
     if (isPreviewFrame())
         return;
@@ -1142,8 +1138,7 @@ void ToolbarLayoutManager::implts_createNonContextSensitiveToolBars()
             uno::Reference< ui::XUIElement > xUIElement;
             aMakeVisibleToolbars.reserve(aToolbarNames.getLength());
 
-            /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-            Guard aWriteLock( m_aLock );
+            SolarMutexGuard g;
 
             const OUString* pTbNames = aToolbarNames.getConstArray();
             for ( sal_Int32 i = 0; i < aToolbarNames.getLength(); i++ )
@@ -1170,7 +1165,6 @@ void ToolbarLayoutManager::implts_createNonContextSensitiveToolBars()
                     }
                 }
             }
-            /* SAFE AREA ----------------------------------------------------------------------------------------------- */
         }
     }
     catch (const uno::RuntimeException&)
@@ -1229,14 +1223,14 @@ void ToolbarLayoutManager::implts_createCustomToolBar( const OUString& aTbxResNa
 
 void ToolbarLayoutManager::implts_reparentToolbars()
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexClearableGuard aWriteLock;
     UIElementVector aUIElementVector = m_aUIElements;
     Window* pContainerWindow  = VCLUnoHelper::GetWindow( m_xContainerWindow );
     Window* pTopDockWindow    = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] );
     Window* pBottomDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] );
     Window* pLeftDockWindow   = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] );
     Window* pRightDockWindow  = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT] );
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     SolarMutexGuard aGuard;
     if ( pContainerWindow )
@@ -1287,22 +1281,22 @@ void ToolbarLayoutManager::implts_reparentToolbars()
 
 void ToolbarLayoutManager::implts_setToolbarCreation( bool bStart )
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexGuard g;
     m_bToolbarCreation = bStart;
 }
 
 bool ToolbarLayoutManager::implts_isToolbarCreationActive()
 {
-    Guard aReadLock( m_aLock );
+    SolarMutexGuard g;
     return m_bToolbarCreation;
 }
 
 void ToolbarLayoutManager::implts_createToolBar( const OUString& aName, bool& bNotify, uno::Reference< ui::XUIElement >& rUIElement )
 {
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
     uno::Reference< frame::XFrame > xFrame( m_xFrame );
     uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow );
-    aReadLock.unlock();
+    aReadLock.clear();
 
     bNotify = false;
 
@@ -1338,7 +1332,7 @@ void ToolbarLayoutManager::implts_createToolBar( const OUString& aName, bool& bN
             }
 
             /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-            Guard aWriteLock( m_aLock );
+            SolarMutexClearableGuard aWriteLock;
 
             UIElement& rElement = impl_findToolbar( aName );
             if ( !rElement.m_aName.isEmpty() )
@@ -1360,7 +1354,7 @@ void ToolbarLayoutManager::implts_createToolBar( const OUString& aName, bool& bN
                 bVisible = aNewToolbar.m_bVisible;
                 bFloating = rElement.m_bFloating;
             }
-            aWriteLock.unlock();
+            aWriteLock.clear();
             /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
             // set toolbar menu style according to customize command state
@@ -1391,14 +1385,14 @@ uno::Reference< ui::XUIElement > ToolbarLayoutManager::implts_createElement( con
 {
     uno::Reference< ui::XUIElement > xUIElement;
 
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
     uno::Sequence< beans::PropertyValue > aPropSeq( 2 );
     aPropSeq[0].Name = "Frame";
     aPropSeq[0].Value <<= m_xFrame;
     aPropSeq[1].Name = "Persistent";
     aPropSeq[1].Value <<= true;
     uno::Reference< ui::XUIElementFactory > xUIElementFactory( m_xUIElementFactoryManager );
-    aReadLock.unlock();
+    aReadLock.clear();
 
     implts_setToolbarCreation( true );
     try
@@ -1419,9 +1413,9 @@ uno::Reference< ui::XUIElement > ToolbarLayoutManager::implts_createElement( con
 
 void ToolbarLayoutManager::implts_setElementData( UIElement& rElement, const uno::Reference< awt::XDockableWindow >& rDockWindow )
 {
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
     bool bShowElement( rElement.m_bVisible && !rElement.m_bMasterHide && implts_isParentWindowVisible() );
-    aReadLock.unlock();
+    aReadLock.clear();
 
     uno::Reference< awt::XDockableWindow > xDockWindow( rDockWindow );
     uno::Reference< awt::XWindow2 >        xWindow( xDockWindow, uno::UNO_QUERY );
@@ -1549,7 +1543,7 @@ void ToolbarLayoutManager::implts_setElementData( UIElement& rElement, const uno
 
 void ToolbarLayoutManager::implts_destroyDockingAreaWindows()
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexClearableGuard aWriteLock;
     uno::Reference< awt::XWindow > xTopDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] );
     uno::Reference< awt::XWindow > xLeftDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] );
     uno::Reference< awt::XWindow > xRightDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT] );
@@ -1558,7 +1552,7 @@ void ToolbarLayoutManager::implts_destroyDockingAreaWindows()
     m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT].clear();
     m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT].clear();
     m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM].clear();
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     // destroy windows
     xTopDockingWindow->dispose();
@@ -1579,10 +1573,10 @@ sal_Bool ToolbarLayoutManager::implts_readWindowStateData( const OUString& aName
 
 void ToolbarLayoutManager::implts_writeWindowStateData( const UIElement& rElementData )
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexResettableGuard aWriteLock;
     uno::Reference< container::XNameAccess > xPersistentWindowState( m_xPersistentWindowState );
     m_bStoreWindowState = true; // set flag to determine that we triggered the notification
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     bool bPersistent( false );
     uno::Reference< beans::XPropertySet > xPropSet( rElementData.m_xUIElement, uno::UNO_QUERY );
@@ -1650,9 +1644,9 @@ void ToolbarLayoutManager::implts_writeWindowStateData( const UIElement& rElemen
     }
 
     // Reset flag
-    aWriteLock.lock();
+    aWriteLock.reset();
     m_bStoreWindowState = false;
-    aWriteLock.unlock();
+    aWriteLock.clear();
 }
 
 /******************************************************************************
@@ -1664,7 +1658,7 @@ UIElement& ToolbarLayoutManager::impl_findToolbar( const OUString& aName )
     static UIElement aEmptyElement;
     UIElementVector::iterator pIter;
 
-    Guard aReadLock( m_aLock );
+    SolarMutexGuard g;
     for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
     {
         if ( pIter->m_aName == aName )
@@ -1676,11 +1670,8 @@ UIElement& ToolbarLayoutManager::impl_findToolbar( const OUString& aName )
 
 UIElement ToolbarLayoutManager::implts_findToolbar( const OUString& aName )
 {
-    Guard aReadLock( m_aLock );
-    UIElement aElement = impl_findToolbar( aName );
-    aReadLock.unlock();
-
-    return aElement;
+    SolarMutexGuard g;
+    return impl_findToolbar( aName );
 }
 
 UIElement ToolbarLayoutManager::implts_findToolbar( const uno::Reference< uno::XInterface >& xToolbar )
@@ -1688,7 +1679,7 @@ UIElement ToolbarLayoutManager::implts_findToolbar( const uno::Reference< uno::X
     UIElement                       aToolbar;
     UIElementVector::const_iterator pIter;
 
-    Guard aReadLock( m_aLock );
+    SolarMutexGuard g;
     for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
     {
         if ( pIter->m_xUIElement.is() )
@@ -1710,7 +1701,7 @@ uno::Reference< awt::XWindow > ToolbarLayoutManager::implts_getXWindow( const OU
     UIElementVector::iterator pIter;
     uno::Reference< awt::XWindow > xWindow;
 
-    Guard aReadLock( m_aLock );
+    SolarMutexGuard g;
     for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
     {
         if ( pIter->m_aName == aName && pIter->m_xUIElement.is() )
@@ -1743,7 +1734,7 @@ bool ToolbarLayoutManager::implts_insertToolbar( const UIElement& rUIElement )
 
     if ( !bFound )
     {
-        Guard aWriteLock( m_aLock );
+        SolarMutexGuard g;
         m_aUIElements.push_back( rUIElement );
         bResult = true;
     }
@@ -1753,7 +1744,7 @@ bool ToolbarLayoutManager::implts_insertToolbar( const UIElement& rUIElement )
 
 void ToolbarLayoutManager::implts_setToolbar( const UIElement& rUIElement )
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexGuard g;
     UIElement& rData = impl_findToolbar( rUIElement.m_aName );
     if ( rData.m_aName == rUIElement.m_aName )
         rData = rUIElement;
@@ -1772,11 +1763,11 @@ awt::Point ToolbarLayoutManager::implts_findNextCascadeFloatingPos()
     const sal_Int32 nCascadeIndentX = 15;
     const sal_Int32 nCascadeIndentY = 15;
 
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
     uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow );
     uno::Reference< awt::XWindow > xTopDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] );
     uno::Reference< awt::XWindow > xLeftDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] );
-    aReadLock.unlock();
+    aReadLock.clear();
 
     awt::Point aStartPos( nCascadeIndentX, nCascadeIndentY );
     awt::Point aCurrPos( aStartPos );
@@ -1832,7 +1823,7 @@ awt::Point ToolbarLayoutManager::implts_findNextCascadeFloatingPos()
 
 void ToolbarLayoutManager::implts_sortUIElements()
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexGuard g;
     UIElementVector::iterator pIterStart = m_aUIElements.begin();
     UIElementVector::iterator pIterEnd   = m_aUIElements.end();
 
@@ -1842,12 +1833,11 @@ void ToolbarLayoutManager::implts_sortUIElements()
     UIElementVector::iterator pIter;
     for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
         pIter->m_bUserActive = false;
-    aWriteLock.unlock();
 }
 
 void ToolbarLayoutManager::implts_getUIElementVectorCopy( UIElementVector& rCopy )
 {
-    Guard aReadLock( m_aLock );
+    SolarMutexGuard g;
     rCopy = m_aUIElements;
 }
 
@@ -1857,10 +1847,10 @@ void ToolbarLayoutManager::implts_getUIElementVectorCopy( UIElementVector& rCopy
     uno::Reference< awt::XWindow > xTopDockingAreaWindow;
     uno::Reference< awt::XWindow > xBottomDockingAreaWindow;
 
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
     xTopDockingAreaWindow    = m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP];
     xBottomDockingAreaWindow = m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM];
-    aReadLock.unlock();
+    aReadLock.clear();
 
     if ( xTopDockingAreaWindow.is() )
         aSize.Width() = xTopDockingAreaWindow->getPosSize().Height;
@@ -1880,7 +1870,7 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfos( ui::DockingArea eD
     uno::Reference< awt::XWindow > xDockAreaWindow;
 
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
     aWindowVector.reserve(m_aUIElements.size());
     xDockAreaWindow = m_xDockAreaWindows[eDockingArea];
     UIElementVector::iterator   pIter;
@@ -1901,7 +1891,7 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfos( ui::DockingArea eD
             }
         }
     }
-    aReadLock.unlock();
+    aReadLock.clear();
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
     rRowColumnsWindowData.clear();
@@ -2065,7 +2055,7 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( ui::D
     bool bHorzDockArea = isHorizontalDockingArea( eDockingArea );
 
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
     UIElementVector::iterator   pIter;
     UIElementVector::iterator   pEnd = m_aUIElements.end();
     for ( pIter = m_aUIElements.begin(); pIter != pEnd; ++pIter )
@@ -2089,7 +2079,7 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( ui::D
             }
         }
     }
-    aReadLock.unlock();
+    aReadLock.clear();
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
     // Initialize structure
@@ -2178,10 +2168,10 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( ui::D
         return aWinRect;
     else
     {
-        Guard aReadLock( m_aLock );
+        SolarMutexClearableGuard aReadLock;
         Window* pContainerWindow( VCLUnoHelper::GetWindow( m_xContainerWindow ));
         Window* pDockingAreaWindow( VCLUnoHelper::GetWindow( m_xDockAreaWindows[DockingArea] ));
-        aReadLock.unlock();
+        aReadLock.clear();
 
         // Calc correct position of the column/row rectangle to be able to compare it with mouse pos/tracking rect
         SolarMutexGuard aGuard;
@@ -2274,11 +2264,11 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( ui::D
 
 void ToolbarLayoutManager::implts_findNextDockingPos( ui::DockingArea DockingArea, const ::Size& aUIElementSize, awt::Point& rVirtualPos, ::Point& rPixelPos )
 {
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
     uno::Reference< awt::XWindow > xDockingWindow( m_xDockAreaWindows[DockingArea] );
     ::Size                         aDockingWinSize;
     Window*                        pDockingWindow( 0 );
-    aReadLock.unlock();
+    aReadLock.clear();
 
     if (( DockingArea < ui::DockingArea_DOCKINGAREA_TOP ) || ( DockingArea > ui::DockingArea_DOCKINGAREA_RIGHT ))
         DockingArea = ui::DockingArea_DOCKINGAREA_TOP;
@@ -2555,9 +2545,9 @@ void ToolbarLayoutManager::implts_calcWindowPosSizeOnSingleRowColumn(
         }
     }
 
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
     Window* pDockAreaWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[nDockingArea] );
-    aReadLock.unlock();
+    aReadLock.clear();
 
     sal_Int32 nCurrPos( 0 );
 
@@ -2593,13 +2583,13 @@ void ToolbarLayoutManager::implts_calcWindowPosSizeOnSingleRowColumn(
 
 void ToolbarLayoutManager::implts_setLayoutDirty()
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexGuard g;
     m_bLayoutDirty = true;
 }
 
 void ToolbarLayoutManager::implts_setLayoutInProgress( bool bInProgress )
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexGuard g;
     m_bLayoutInProgress = bInProgress;
 }
 
@@ -2621,12 +2611,12 @@ void ToolbarLayoutManager::implts_calcDockingPosSize(
     ::Rectangle&        rTrackingRect,
     const Point&        rMousePos )
 {
-    Guard aReadLock( m_aLock );
+    SolarMutexResettableGuard aReadLock;
     uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow );
     ::Size                          aContainerWinSize;
     Window*                         pContainerWindow( 0 );
     ::Rectangle                     aDockingAreaOffsets( m_aDockingAreaOffsets );
-    aReadLock.unlock();
+    aReadLock.clear();
 
     if ( !rUIElement.m_xUIElement.is() )
     {
@@ -2659,9 +2649,9 @@ void ToolbarLayoutManager::implts_calcDockingPosSize(
                                                                aDockingAreaOffsets.Bottom();
     ::Rectangle                    aDockingAreaRect;
 
-    aReadLock.lock();
+    aReadLock.reset();
     xDockingAreaWindow = m_xDockAreaWindows[eDockedArea];
-    aReadLock.unlock();
+    aReadLock.clear();
 
     {
         SolarMutexGuard aGuard;
@@ -3043,9 +3033,9 @@ framework::ToolbarLayoutManager::DockingOperation ToolbarLayoutManager::implts_d
     const ::Rectangle& rRowColumnRect,
     const ::Size& rContainerWinSize )
 {
-    Guard aReadGuard( m_aLock );
+    SolarMutexResettableGuard aReadGuard;
     ::Rectangle aDockingAreaOffsets( m_aDockingAreaOffsets );
-    aReadGuard.unlock();
+    aReadGuard.clear();
 
     bool      bHorizontalDockArea( isHorizontalDockingArea( eDockingArea ));
 
@@ -3094,10 +3084,10 @@ framework::ToolbarLayoutManager::DockingOperation ToolbarLayoutManager::implts_d
         aTrackingRect.setWidth( rRowColumnRect.getWidth() );
         aTrackingRect.setHeight( nSize );
 
-        aReadGuard.lock();
+        aReadGuard.reset();
         uno::Reference< awt::XWindow  > xDockingAreaWindow( m_xDockAreaWindows[eDockingArea] );
         uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow );
-        aReadGuard.unlock();
+        aReadGuard.clear();
 
         sal_Int32 nDockPosY( 0 );
         Window* pDockingAreaWindow( 0 );
@@ -3132,15 +3122,15 @@ void ToolbarLayoutManager::implts_renumberRowColumnData(
     DockingOperation /*eDockingOperation*/,
     const UIElement& rUIElement )
 {
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
     uno::Reference< container::XNameAccess > xPersistentWindowState( m_xPersistentWindowState );
-    aReadLock.unlock();
+    aReadLock.clear();
 
     bool bHorzDockingArea( isHorizontalDockingArea( eDockingArea ));
     sal_Int32 nRowCol( bHorzDockingArea ? rUIElement.m_aDockedData.m_aPos.Y : rUIElement.m_aDockedData.m_aPos.X );
 
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aWriteLock( m_aLock );
+    SolarMutexClearableGuard aWriteLock;
     UIElementVector::iterator pIter;
     for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
     {
@@ -3160,7 +3150,7 @@ void ToolbarLayoutManager::implts_renumberRowColumnData(
             }
         }
     }
-    aWriteLock.unlock();
+    aWriteLock.clear();
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
     // We have to change the persistent window state part
@@ -3222,10 +3212,10 @@ void ToolbarLayoutManager::implts_renumberRowColumnData(
 void SAL_CALL ToolbarLayoutManager::windowResized( const awt::WindowEvent& aEvent )
 throw( uno::RuntimeException, std::exception )
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexClearableGuard aWriteLock;
     bool bLocked( m_bDockingInProgress );
     bool bLayoutInProgress( m_bLayoutInProgress );
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     // Do not do anything if we are in the middle of a docking process. This would interfere all other
     // operations. We will store the new position and size in the docking handlers.
@@ -3292,10 +3282,10 @@ throw (uno::RuntimeException, std::exception)
 {
     bool bWinFound( false );
 
-    Guard aReadGuard( m_aLock );
+    SolarMutexClearableGuard aReadGuard;
     uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow );
     uno::Reference< awt::XWindow2 > xWindow( e.Source, uno::UNO_QUERY );
-    aReadGuard.unlock();
+    aReadGuard.clear();
 
     Window* pContainerWindow( 0 );
     Window* pWindow( 0 );
@@ -3334,12 +3324,11 @@ throw (uno::RuntimeException, std::exception)
         }
     }
 
-    Guard aWriteLock( m_aLock );
+    SolarMutexGuard g;
     m_bDockingInProgress = bWinFound;
     m_aDockUIElement = aUIElement;
     m_aDockUIElement.m_bUserActive = true;
     m_aStartDockMousePos = aMousePos;
-    aWriteLock.unlock();
 }
 
 awt::DockingData SAL_CALL ToolbarLayoutManager::docking( const awt::DockingEvent& e )
@@ -3348,7 +3337,7 @@ throw (uno::RuntimeException, std::exception)
     const sal_Int32 MAGNETIC_DISTANCE_UNDOCK = 25;
     const sal_Int32 MAGNETIC_DISTANCE_DOCK   = 20;
 
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
     awt::DockingData                       aDockingData;
     uno::Reference< awt::XDockableWindow > xDockWindow( e.Source, uno::UNO_QUERY );
     uno::Reference< awt::XWindow >         xWindow( e.Source, uno::UNO_QUERY );
@@ -3362,7 +3351,7 @@ throw (uno::RuntimeException, std::exception)
 
     DockingOperation                       eDockingOperation( DOCKOP_ON_COLROW );
     bool                                   bDockingInProgress( m_bDockingInProgress );
-    aReadLock.unlock();
+    aReadLock.clear();
 
     if ( bDockingInProgress )
         aDockingData.TrackingRectangle = e.TrackingRectangle;
@@ -3499,7 +3488,7 @@ throw (uno::RuntimeException, std::exception)
             aDockingData.bFloating = ( eDockingArea == -1 );
 
             // Write current data to the member docking progress data
-            Guard aWriteLock( m_aLock );
+            SolarMutexGuard g;
             m_aDockUIElement.m_bFloating = aDockingData.bFloating;
             if ( !aDockingData.bFloating )
             {
@@ -3510,7 +3499,6 @@ throw (uno::RuntimeException, std::exception)
             }
             else
                 m_aDockUIElement.m_aFloatingData = aUIDockingElement.m_aFloatingData;
-            aWriteLock.unlock();
         }
         catch (const uno::Exception&)
         {
@@ -3529,7 +3517,7 @@ throw (uno::RuntimeException, std::exception)
     UIElement aUIDockingElement;
 
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aWriteLock( m_aLock );
+    SolarMutexResettableGuard aWriteLock;
     bDockingInProgress = m_bDockingInProgress;
     aUIDockingElement  = m_aDockUIElement;
     bFloating          = aUIDockingElement.m_bFloating;
@@ -3567,7 +3555,7 @@ throw (uno::RuntimeException, std::exception)
     // reset member for next docking operation
     m_aDockUIElement.m_xUIElement.clear();
     m_eDockOperation = DOCKOP_ON_COLROW;
-    aWriteLock.unlock();
+    aWriteLock.clear();
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
     implts_writeWindowStateData( aUIDockingElement );
@@ -3606,11 +3594,11 @@ throw (uno::RuntimeException, std::exception)
 
     implts_sortUIElements();
 
-    aWriteLock.lock();
+    aWriteLock.reset();
     m_bDockingInProgress = false;
     m_bLayoutDirty       = !bStartDockFloated || !bFloating;
     bool bNotify         = m_bLayoutDirty;
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     if ( bNotify )
         m_pParentLayouter->requestLayout( ILayoutNotifications::HINT_TOOLBARSPACE_HAS_CHANGED );
@@ -3619,9 +3607,9 @@ throw (uno::RuntimeException, std::exception)
 sal_Bool SAL_CALL ToolbarLayoutManager::prepareToggleFloatingMode( const lang::EventObject& e )
 throw (uno::RuntimeException, std::exception)
 {
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
     bool bDockingInProgress = m_bDockingInProgress;
-    aReadLock.unlock();
+    aReadLock.clear();
 
     UIElement aUIDockingElement = implts_findToolbar( e.Source );
     bool bWinFound( !aUIDockingElement.m_aName.isEmpty() );
@@ -3663,11 +3651,11 @@ throw (uno::RuntimeException, std::exception)
 {
     UIElement aUIDockingElement;
 
-    Guard aReadLock( m_aLock );
+    SolarMutexResettableGuard aReadLock;
     bool bDockingInProgress( m_bDockingInProgress );
     if ( bDockingInProgress )
         aUIDockingElement = m_aDockUIElement;
-    aReadLock.unlock();
+    aReadLock.clear();
 
     Window*  pWindow( 0 );
     ToolBox* pToolBox( 0 );
@@ -3763,9 +3751,9 @@ throw (uno::RuntimeException, std::exception)
             implts_sortUIElements();
             implts_setLayoutDirty();
 
-            aReadLock.lock();
+            aReadLock.reset();
             ILayoutNotifications* pParentLayouter( m_pParentLayouter );
-            aReadLock.unlock();
+            aReadLock.clear();
 
             if ( pParentLayouter )
                 pParentLayouter->requestLayout( ILayoutNotifications::HINT_TOOLBARSPACE_HAS_CHANGED );
@@ -3796,7 +3784,7 @@ throw (uno::RuntimeException, std::exception)
     UIElement     aUIElement;
     UIElementVector::iterator pIter;
 
-    Guard aWriteLock( m_aLock );
+    SolarMutexClearableGuard aWriteLock;
     for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
     {
         uno::Reference< ui::XUIElement > xUIElement( pIter->m_xUIElement );
@@ -3818,7 +3806,7 @@ throw (uno::RuntimeException, std::exception)
             }
         }
     }
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     // destroy element
     if ( !aName.isEmpty() )
@@ -3826,10 +3814,10 @@ throw (uno::RuntimeException, std::exception)
         implts_writeWindowStateData( aUIElement );
         destroyToolbar( aName );
 
-        Guard aReadLock( m_aLock );
+        SolarMutexClearableGuard aReadLock;
         bool bLayoutDirty = m_bLayoutDirty;
         ILayoutNotifications* pParentLayouter( m_pParentLayouter );
-        aWriteLock.unlock();
+        aWriteLock.clear();
 
         if ( bLayoutDirty && pParentLayouter )
             pParentLayouter->requestLayout( ILayoutNotifications::HINT_TOOLBARSPACE_HAS_CHANGED );
@@ -3911,11 +3899,11 @@ throw (uno::RuntimeException, std::exception)
 void SAL_CALL ToolbarLayoutManager::elementRemoved( const ui::ConfigurationEvent& rEvent )
 throw (uno::RuntimeException, std::exception)
 {
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
     uno::Reference< awt::XWindow > xContainerWindow( m_xContainerWindow, uno::UNO_QUERY );
     uno::Reference< ui::XUIConfigurationManager > xModuleCfgMgr( m_xModuleCfgMgr );
     uno::Reference< ui::XUIConfigurationManager > xDocCfgMgr( m_xDocCfgMgr );
-    aReadLock.unlock();
+    aReadLock.clear();
 
     UIElement aUIElement = implts_findToolbar( rEvent.ResourceURL );
     uno::Reference< ui::XUIElementSettings > xElementSettings( aUIElement.m_xUIElement, uno::UNO_QUERY );
@@ -3979,11 +3967,11 @@ throw (uno::RuntimeException, std::exception)
         {
             xElementSettings->updateSettings();
 
-            Guard aWriteLock( m_aLock );
+            SolarMutexClearableGuard aWriteLock;
             bool bNotify = !aUIElement.m_bFloating;
             m_bLayoutDirty = bNotify;
             ILayoutNotifications* pParentLayouter( m_pParentLayouter );
-            aWriteLock.unlock();
+            aWriteLock.clear();
 
             if ( bNotify && pParentLayouter )
                 pParentLayouter->requestLayout( ILayoutNotifications::HINT_TOOLBARSPACE_HAS_CHANGED );
@@ -4000,7 +3988,7 @@ uno::Sequence< uno::Reference< ui::XUIElement > > ToolbarLayoutManager::getToolb
 {
     uno::Sequence< uno::Reference< ui::XUIElement > > aSeq;
 
-    Guard aReadLock( m_aLock );
+    SolarMutexGuard g;
     if ( m_aUIElements.size() > 0 )
     {
         sal_uInt32 nCount(0);
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.hxx b/framework/source/layoutmanager/toolbarlayoutmanager.hxx
index a507ea3..796f775 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.hxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.hxx
@@ -25,7 +25,6 @@
 */
 #include <vector>
 
-#include <threadhelp/threadhelpbase.hxx>
 #include <macros/generic.hxx>
 #include <macros/xinterface.hxx>
 #include <macros/xtypeprovider.hxx>
@@ -62,8 +61,7 @@ namespace framework
 
 class ToolbarLayoutManager : public ::cppu::WeakImplHelper3< ::com::sun::star::awt::XDockableWindowListener,
                                                              ::com::sun::star::ui::XUIConfigurationListener,
-                                                             ::com::sun::star::awt::XWindowListener >,
-                             private ThreadHelpBase // Struct for right initalization of mutex member! Must be first of baseclasses.
+                                                             ::com::sun::star::awt::XWindowListener >
 {
     public:
         enum { DOCKINGAREAS_COUNT = 4 };
commit 690b76aa2792ded47d944f11e175579b263afd19
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Mar 18 16:23:59 2014 +0100

    Use SolarMutexGuard directly
    
    Change-Id: I3818b2972771dc934f524b2bf1ee1bddd8e7868b

diff --git a/framework/inc/services/layoutmanager.hxx b/framework/inc/services/layoutmanager.hxx
index 7f4d8e0..cca40bc 100644
--- a/framework/inc/services/layoutmanager.hxx
+++ b/framework/inc/services/layoutmanager.hxx
@@ -20,7 +20,6 @@
 #ifndef INCLUDED_FRAMEWORK_INC_SERVICES_LAYOUTMANAGER_HXX
 #define INCLUDED_FRAMEWORK_INC_SERVICES_LAYOUTMANAGER_HXX
 
-#include <threadhelp/threadhelpbase.hxx>
 #include <macros/xinterface.hxx>
 #include <macros/xtypeprovider.hxx>
 #include <properties.h>
@@ -48,6 +47,7 @@
 #include <com/sun/star/frame/XMenuBarMergingAcceptor.hpp>
 #include <com/sun/star/frame/XLayoutManagerEventBroadcaster.hpp>
 
+#include <cppuhelper/basemutex.hxx>
 #include <cppuhelper/propshlp.hxx>
 #include <cppuhelper/implbase3.hxx>
 #include <cppuhelper/interfacecontainer.hxx>
@@ -73,9 +73,7 @@ namespace framework
                                     >   LayoutManager_Base;
     typedef ::comphelper::OPropertyContainer    LayoutManager_PBase;
     class LayoutManager : public  LayoutManager_Base                    ,
-                          // base classes
-                          // Order is necessary for right initialization!
-                          private ThreadHelpBase                        ,   // Struct for right initalization of mutex member! Must be first of baseclasses.
+                          private cppu::BaseMutex,
                           public  ::cppu::OBroadcastHelper              ,
                           public  ILayoutNotifications                  ,
                           public  LayoutManager_PBase
@@ -183,7 +181,7 @@ namespace framework
 
             /// Reading of settings - shared with ToolbarLayoutManager.
             static sal_Bool readWindowStateData( const OUString& rName, UIElement& rElementData,
-                    LockHelper &rLock, const css::uno::Reference< css::container::XNameAccess > &rPersistentWindowState,
+                    const css::uno::Reference< css::container::XNameAccess > &rPersistentWindowState,
                     GlobalSettings* &rGlobalSettings, bool &bInGlobalSettings,
                     const css::uno::Reference< css::uno::XComponentContext > &rComponentContext );
 
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index 2e9ce24..af60d6b 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -19,7 +19,6 @@
 
 #include <services/layoutmanager.hxx>
 #include <helpers.hxx>
-#include <threadhelp/guard.hxx>
 
 #include <framework/sfxhelperfunctions.hxx>
 #include <uielement/menubarwrapper.hxx>
@@ -100,8 +99,7 @@ IMPLEMENT_FORWARD_XTYPEPROVIDER2( LayoutManager, LayoutManager_Base, LayoutManag
 IMPLEMENT_FORWARD_XINTERFACE2( LayoutManager, LayoutManager_Base, LayoutManager_PBase )
 
 LayoutManager::LayoutManager( const Reference< XComponentContext >& xContext ) : LayoutManager_Base()
-        , ThreadHelpBase( &Application::GetSolarMutex())
-        , ::cppu::OBroadcastHelperVar< ::cppu::OMultiTypeInterfaceContainerHelper, ::cppu::OMultiTypeInterfaceContainerHelper::keyType >( m_aLock.getShareableOslMutex())
+        , ::cppu::OBroadcastHelperVar< ::cppu::OMultiTypeInterfaceContainerHelper, ::cppu::OMultiTypeInterfaceContainerHelper::keyType >(m_aMutex)
         , LayoutManager_PBase( *(static_cast< ::cppu::OBroadcastHelper* >(this)) )
         , m_xContext( xContext )
         , m_xURLTransformer( URLTransformer::create(xContext) )
@@ -126,7 +124,7 @@ LayoutManager::LayoutManager( const Reference< XComponentContext >& xContext ) :
         , m_xUIElementFactoryManager( ui::theUIElementFactoryManager::get(xContext) )
         , m_xPersistentWindowStateSupplier( ui::theWindowStateConfiguration::get( xContext ) )
         , m_pGlobalSettings( 0 )
-        , m_aListenerContainer( m_aLock.getShareableOslMutex() )
+        , m_aListenerContainer( m_aMutex )
         , m_pToolbarManager( 0 )
         , m_xToolbarManager( 0 )
 {
@@ -222,13 +220,13 @@ void LayoutManager::impl_clearUpMenuBar()
 
 void LayoutManager::implts_lock()
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexGuard g;
     ++m_nLockCount;
 }
 
 sal_Bool LayoutManager::implts_unlock()
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexGuard g;
     m_nLockCount = std::max( m_nLockCount-1, static_cast<sal_Int32>(0) );
     return ( m_nLockCount == 0 );
 }
@@ -236,7 +234,7 @@ sal_Bool LayoutManager::implts_unlock()
 void LayoutManager::implts_reset( sal_Bool bAttached )
 {
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
     Reference< XFrame > xFrame = m_xFrame;
     Reference< awt::XWindow > xContainerWindow( m_xContainerWindow );
     Reference< XUIConfiguration > xModuleCfgMgr( m_xModuleCfgMgr, UNO_QUERY );
@@ -247,7 +245,7 @@ void LayoutManager::implts_reset( sal_Bool bAttached )
     ToolbarLayoutManager* pToolbarManager( m_pToolbarManager );
     OUString aModuleIdentifier( m_aModuleIdentifier );
     bool bAutomaticToolbars( m_bAutomaticToolbars );
-    aReadLock.unlock();
+    aReadLock.clear();
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
     implts_lock();
@@ -376,7 +374,7 @@ void LayoutManager::implts_reset( sal_Bool bAttached )
         Reference< XUIConfigurationManager > xDokCfgMgr( xDocCfgMgr, UNO_QUERY );
 
         /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-        Guard aWriteLock( m_aLock );
+        SolarMutexClearableGuard aWriteLock;
         m_xModel = xModel;
         m_aDockingArea = awt::Rectangle();
         m_bComponentAttached = bAttached;
@@ -385,7 +383,7 @@ void LayoutManager::implts_reset( sal_Bool bAttached )
         m_xDocCfgMgr = xDokCfgMgr;
         m_xPersistentWindowState = xPersistentWindowState;
         m_aStatusBarElement.m_bStateRead = false; // reset state to read data again!
-        aWriteLock.unlock();
+        aWriteLock.clear();
         /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
         // reset/notify toolbar layout manager
@@ -412,10 +410,10 @@ void LayoutManager::implts_reset( sal_Bool bAttached )
 
 sal_Bool LayoutManager::implts_isEmbeddedLayoutManager() const
 {
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
     Reference< XFrame > xFrame = m_xFrame;
     Reference< awt::XWindow > xContainerWindow( m_xContainerWindow );
-    aReadLock.unlock();
+    aReadLock.clear();
 
     Reference< awt::XWindow > xFrameContainerWindow = xFrame->getContainerWindow();
     if ( xFrameContainerWindow == xContainerWindow )
@@ -426,25 +424,25 @@ sal_Bool LayoutManager::implts_isEmbeddedLayoutManager() const
 
 void LayoutManager::implts_destroyElements()
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexResettableGuard aWriteLock;
     ToolbarLayoutManager* pToolbarManager = m_pToolbarManager;
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     if ( pToolbarManager )
         pToolbarManager->destroyToolbars();
 
     implts_destroyStatusBar();
 
-    aWriteLock.lock();
+    aWriteLock.reset();
     impl_clearUpMenuBar();
-    aWriteLock.unlock();
+    aWriteLock.clear();
 }
 
 void LayoutManager::implts_toggleFloatingUIElementsVisibility( sal_Bool bActive )
 {
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
     ToolbarLayoutManager* pToolbarManager = m_pToolbarManager;
-    aReadLock.unlock();
+    aReadLock.clear();
 
     if ( pToolbarManager )
         pToolbarManager->setFloatingToolbarsVisibility( bActive );
@@ -472,24 +470,24 @@ uno::Reference< ui::XUIElement > LayoutManager::implts_findElement( const OUStri
 
 sal_Bool LayoutManager::implts_readWindowStateData( const OUString& aName, UIElement& rElementData )
 {
-    return readWindowStateData( aName, rElementData, m_aLock, m_xPersistentWindowState,
+    return readWindowStateData( aName, rElementData, m_xPersistentWindowState,
             m_pGlobalSettings, m_bGlobalSettings, m_xContext );
 }
 
 sal_Bool LayoutManager::readWindowStateData( const OUString& aName, UIElement& rElementData,
-        LockHelper &rLock, const Reference< XNameAccess > &rPersistentWindowState,
+        const Reference< XNameAccess > &rPersistentWindowState,
         GlobalSettings* &rGlobalSettings, bool &bInGlobalSettings,
         const Reference< XComponentContext > &rComponentContext )
 {
     bool bGetSettingsState( false );
 
-    Guard aWriteLock( rLock );
+    SolarMutexResettableGuard aWriteLock;
     Reference< XNameAccess > xPersistentWindowState( rPersistentWindowState );
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     if ( xPersistentWindowState.is() )
     {
-        aWriteLock.lock();
+        aWriteLock.reset();
         bool bGlobalSettings( bInGlobalSettings );
         GlobalSettings* pGlobalSettings( 0 );
         if ( rGlobalSettings == 0 )
@@ -498,7 +496,7 @@ sal_Bool LayoutManager::readWindowStateData( const OUString& aName, UIElement& r
             bGetSettingsState = true;
         }
         pGlobalSettings = rGlobalSettings;
-        aWriteLock.unlock();
+        aWriteLock.clear();
 
         try
         {
@@ -583,9 +581,9 @@ sal_Bool LayoutManager::readWindowStateData( const OUString& aName, UIElement& r
             {
                 if ( pGlobalSettings->HasStatesInfo( GlobalSettings::UIELEMENT_TYPE_TOOLBAR ))
                 {
-                    Guard aWriteLock2( rLock );
+                    SolarMutexClearableGuard aWriteLock2;
                     bInGlobalSettings = true;
-                    aWriteLock2.unlock();
+                    aWriteLock2.clear();
 
                     uno::Any aValue;
                     sal_Bool bValue = sal_Bool();
@@ -615,12 +613,12 @@ sal_Bool LayoutManager::readWindowStateData( const OUString& aName, UIElement& r
 
 void LayoutManager::implts_writeWindowStateData( const OUString& aName, const UIElement& rElementData )
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexResettableGuard aWriteLock;
     Reference< XNameAccess > xPersistentWindowState( m_xPersistentWindowState );
 
     // set flag to determine that we triggered the notification
     m_bStoreWindowState = true;
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     sal_Bool bPersistent( sal_False );
     Reference< XPropertySet > xPropSet( rElementData.m_xUIElement, UNO_QUERY );
@@ -685,9 +683,9 @@ void LayoutManager::implts_writeWindowStateData( const OUString& aName, const UI
     }
 
     // Reset flag
-    aWriteLock.lock();
+    aWriteLock.reset();
     m_bStoreWindowState = false;
-    aWriteLock.unlock();
+    aWriteLock.clear();
 }
 
 ::Size LayoutManager::implts_getContainerWindowOutputSize()
@@ -708,7 +706,7 @@ Reference< XUIElement > LayoutManager::implts_createElement( const OUString& aNa
 {
     Reference< ui::XUIElement > xUIElement;
 
-    Guard   aReadLock( m_aLock );
+    SolarMutexGuard g;
     Sequence< PropertyValue > aPropSeq( 2 );
     aPropSeq[0].Name = "Frame";
     aPropSeq[0].Value <<= m_xFrame;
@@ -731,9 +729,9 @@ Reference< XUIElement > LayoutManager::implts_createElement( const OUString& aNa
 
 void LayoutManager::implts_setVisibleState( sal_Bool bShow )
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexClearableGuard aWriteLock;
     m_aStatusBarElement.m_bMasterHide = !bShow;
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     implts_updateUIElementsVisibleState( bShow );
 }
@@ -747,12 +745,12 @@ void LayoutManager::implts_updateUIElementsVisibleState( sal_Bool bSetVisible )
     else
         implts_notifyListeners( frame::LayoutManagerEvents::INVISIBLE, a );
 
-    Guard aWriteLock( m_aLock );
+    SolarMutexResettableGuard aWriteLock;
     Reference< XUIElement >   xMenuBar( m_xMenuBar, UNO_QUERY );
     Reference< awt::XWindow > xContainerWindow( m_xContainerWindow );
     Reference< XComponent >   xInplaceMenuBar( m_xInplaceMenuBar );
     MenuBarManager*           pInplaceMenuBar( m_pInplaceMenuBar );
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     bool bMustDoLayout(false);
     if (( xMenuBar.is() || xInplaceMenuBar.is() ) && xContainerWindow.is() )
@@ -785,9 +783,9 @@ void LayoutManager::implts_updateUIElementsVisibleState( sal_Bool bSetVisible )
     else
         bMustDoLayout = !implts_hideStatusBar();
 
-    aWriteLock.lock();
+    aWriteLock.reset();
     ToolbarLayoutManager* pToolbarManager( m_pToolbarManager );
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     if ( pToolbarManager )
     {
@@ -801,12 +799,12 @@ void LayoutManager::implts_updateUIElementsVisibleState( sal_Bool bSetVisible )
 
 void LayoutManager::implts_setCurrentUIVisibility( sal_Bool bShow )
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexClearableGuard aWriteLock;
     if ( !bShow && m_aStatusBarElement.m_bVisible && m_aStatusBarElement.m_xUIElement.is() )
         m_aStatusBarElement.m_bMasterHide = true;
     else if ( bShow && m_aStatusBarElement.m_bVisible )
         m_aStatusBarElement.m_bMasterHide = false;
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     implts_updateUIElementsVisibleState( bShow );
 }
@@ -815,11 +813,11 @@ void LayoutManager::implts_destroyStatusBar()
 {
     Reference< XComponent > xCompStatusBar;
 
-    Guard aWriteLock( m_aLock );
+    SolarMutexClearableGuard aWriteLock;
     m_aStatusBarElement.m_aName = OUString();
     xCompStatusBar = Reference< XComponent >( m_aStatusBarElement.m_xUIElement, UNO_QUERY );
     m_aStatusBarElement.m_xUIElement.clear();
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     if ( xCompStatusBar.is() )
         xCompStatusBar->dispose();
@@ -829,21 +827,21 @@ void LayoutManager::implts_destroyStatusBar()
 
 void LayoutManager::implts_createStatusBar( const OUString& aStatusBarName )
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexClearableGuard aWriteLock;
     if ( !m_aStatusBarElement.m_xUIElement.is() )
     {
         implts_readStatusBarState( aStatusBarName );
         m_aStatusBarElement.m_aName      = aStatusBarName;
         m_aStatusBarElement.m_xUIElement = implts_createElement( aStatusBarName );
     }
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     implts_createProgressBar();
 }
 
 void LayoutManager::implts_readStatusBarState( const OUString& rStatusBarName )
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexGuard g;
     if ( !m_aStatusBarElement.m_bStateRead )
     {
         // Read persistent data for status bar if not yet read!
@@ -859,13 +857,13 @@ void LayoutManager::implts_createProgressBar()
     Reference< XUIElement > xProgressBarBackup;
     Reference< awt::XWindow > xContainerWindow;
 
-    Guard aWriteLock( m_aLock );
+    SolarMutexResettableGuard aWriteLock;
     xStatusBar = Reference< XUIElement >( m_aStatusBarElement.m_xUIElement, UNO_QUERY );
     xProgressBar = Reference< XUIElement >( m_aProgressBarElement.m_xUIElement, UNO_QUERY );
     xProgressBarBackup = m_xProgressBarBackup;
     m_xProgressBarBackup.clear();
     xContainerWindow = m_xContainerWindow;
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     sal_Bool            bRecycled = xProgressBarBackup.is();
     ProgressBarWrapper* pWrapper  = 0;
@@ -900,10 +898,10 @@ void LayoutManager::implts_createProgressBar()
     }
 
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    aWriteLock.lock();
+    aWriteLock.reset();
     m_aProgressBarElement.m_xUIElement = Reference< XUIElement >(
         static_cast< cppu::OWeakObject* >( pWrapper ), UNO_QUERY );
-    aWriteLock.unlock();
+    aWriteLock.clear();
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
     if ( bRecycled )
@@ -912,8 +910,7 @@ void LayoutManager::implts_createProgressBar()
 
 void LayoutManager::implts_backupProgressBarWrapper()
 {
-    // SAFE -> ----------------------------------
-    Guard aWriteLock(m_aLock);
+    SolarMutexGuard g;
 
     if (m_xProgressBarBackup.is())
         return;
@@ -935,9 +932,6 @@ void LayoutManager::implts_backupProgressBarWrapper()
 
     // prevent us from dispose() the m_aProgressBarElement.m_xUIElement inside implts_reset()
     m_aProgressBarElement.m_xUIElement.clear();
-
-    aWriteLock.unlock();
-    // <- SAFE ----------------------------------
 }
 
 void LayoutManager::implts_destroyProgressBar()
@@ -956,7 +950,7 @@ void LayoutManager::implts_setStatusBarPosSize( const ::Point& rPos, const ::Siz
     Reference< awt::XWindow > xContainerWindow;
 
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
     xStatusBar = Reference< XUIElement >( m_aStatusBarElement.m_xUIElement, UNO_QUERY );
     xProgressBar = Reference< XUIElement >( m_aProgressBarElement.m_xUIElement, UNO_QUERY );
     xContainerWindow = m_xContainerWindow;
@@ -970,7 +964,7 @@ void LayoutManager::implts_setStatusBarPosSize( const ::Point& rPos, const ::Siz
         if ( pWrapper )
             xWindow = pWrapper->getStatusBar();
     }
-    aReadLock.unlock();
+    aReadLock.clear();
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
     if ( xWindow.is() )
@@ -995,7 +989,7 @@ sal_Bool LayoutManager::implts_showProgressBar()
     Reference< awt::XWindow > xWindow;
 
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aWriteLock( m_aLock );
+    SolarMutexClearableGuard aWriteLock;
     xStatusBar = Reference< XUIElement >( m_aStatusBarElement.m_xUIElement, UNO_QUERY );
     xProgressBar = Reference< XUIElement >( m_aProgressBarElement.m_xUIElement, UNO_QUERY );
     sal_Bool bVisible( m_bVisible );
@@ -1014,7 +1008,7 @@ sal_Bool LayoutManager::implts_showProgressBar()
                 xWindow = pWrapper->getStatusBar();
         }
     }
-    aWriteLock.unlock();
+    aWriteLock.clear();
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
     SolarMutexGuard aGuard;
@@ -1039,8 +1033,7 @@ sal_Bool LayoutManager::implts_hideProgressBar()
     Reference< awt::XWindow > xWindow;
     sal_Bool bHideStatusBar( sal_False );
 
-    /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aWriteLock( m_aLock );
+    SolarMutexGuard g;
     xProgressBar = Reference< XUIElement >( m_aProgressBarElement.m_xUIElement, UNO_QUERY );
 
     sal_Bool bInternalStatusBar( sal_False );
@@ -1058,10 +1051,7 @@ sal_Bool LayoutManager::implts_hideProgressBar()
     m_aProgressBarElement.m_bVisible = false;
     implts_readStatusBarState( STATUS_BAR_ALIAS );
     bHideStatusBar = !m_aStatusBarElement.m_bVisible;
-    aWriteLock.unlock();
-    /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
-    SolarMutexGuard aGuard;
     Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
     if ( pWindow && pWindow->IsVisible() && ( bHideStatusBar || bInternalStatusBar ))
     {
@@ -1076,11 +1066,11 @@ sal_Bool LayoutManager::implts_hideProgressBar()
 
 sal_Bool LayoutManager::implts_showStatusBar( sal_Bool bStoreState )
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexClearableGuard aWriteLock;
     Reference< ui::XUIElement > xStatusBar = m_aStatusBarElement.m_xUIElement;
     if ( bStoreState )
         m_aStatusBarElement.m_bVisible = true;
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     if ( xStatusBar.is() )
     {
@@ -1102,11 +1092,11 @@ sal_Bool LayoutManager::implts_showStatusBar( sal_Bool bStoreState )
 
 sal_Bool LayoutManager::implts_hideStatusBar( sal_Bool bStoreState )
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexClearableGuard aWriteLock;
     Reference< ui::XUIElement > xStatusBar = m_aStatusBarElement.m_xUIElement;
     if ( bStoreState )
         m_aStatusBarElement.m_bVisible = false;
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     if ( xStatusBar.is() )
     {
@@ -1140,7 +1130,7 @@ void LayoutManager::implts_setInplaceMenuBar( const Reference< XIndexAccess >& x
 throw (uno::RuntimeException)
 {
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aWriteLock( m_aLock );
+    SolarMutexClearableGuard aWriteLock;
 
     if ( !m_bInplaceMenuSet )
     {
@@ -1170,7 +1160,7 @@ throw (uno::RuntimeException)
             m_xInplaceMenuBar = Reference< XComponent >( (OWeakObject *)m_pInplaceMenuBar, UNO_QUERY );
         }
 
-        aWriteLock.unlock();
+        aWriteLock.clear();
         /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
         implts_updateMenuBarClose();
@@ -1180,8 +1170,7 @@ throw (uno::RuntimeException)
 void LayoutManager::implts_resetInplaceMenuBar()
 throw (uno::RuntimeException)
 {
-    /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aWriteLock( m_aLock );
+    SolarMutexGuard g;
     m_bInplaceMenuSet = false;
 
     if ( m_xContainerWindow.is() )
@@ -1203,13 +1192,12 @@ throw (uno::RuntimeException)
     if ( m_xInplaceMenuBar.is() )
         m_xInplaceMenuBar->dispose();
     m_xInplaceMenuBar.clear();
-    /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 }
 
 void SAL_CALL LayoutManager::attachFrame( const Reference< XFrame >& xFrame )
 throw (uno::RuntimeException, std::exception)
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexGuard g;
     m_xFrame = xFrame;
 }
 
@@ -1242,14 +1230,14 @@ throw (uno::RuntimeException, std::exception)
 awt::Rectangle SAL_CALL LayoutManager::getCurrentDockingArea()
 throw ( RuntimeException, std::exception )
 {
-    Guard aReadLock( m_aLock );
+    SolarMutexGuard g;
     return m_aDockingArea;
 }
 
 Reference< XDockingAreaAcceptor > SAL_CALL LayoutManager::getDockingAreaAcceptor()
 throw (uno::RuntimeException, std::exception)
 {
-    Guard aReadLock( m_aLock );
+    SolarMutexGuard g;
     return m_xDockingAreaAcceptor;
 }
 
@@ -1257,7 +1245,7 @@ void SAL_CALL LayoutManager::setDockingAreaAcceptor( const Reference< ui::XDocki
 throw ( RuntimeException, std::exception )
 {
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aWriteLock( m_aLock );
+    SolarMutexClearableGuard aWriteLock;
 
     if (( m_xDockingAreaAcceptor == xDockingAreaAcceptor ) || !m_xFrame.is() )
         return;
@@ -1315,7 +1303,7 @@ throw ( RuntimeException, std::exception )
         uno::Reference< awt::XWindowPeer > xParent( m_xContainerWindow, UNO_QUERY );
     }
 
-    aWriteLock.unlock();
+    aWriteLock.clear();
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
     if ( xDockingAreaAcceptor.is() )
@@ -1354,10 +1342,10 @@ throw ( RuntimeException, std::exception )
 
 void LayoutManager::implts_reparentChildWindows()
 {
-    Guard aWriteLock( m_aLock );
+    SolarMutexResettableGuard aWriteLock;
     UIElement aStatusBarElement = m_aStatusBarElement;
     uno::Reference< awt::XWindow > xContainerWindow  = m_xContainerWindow;
-    aWriteLock.unlock();
+    aWriteLock.clear();
 
     uno::Reference< awt::XWindow > xStatusBarWindow;
     if ( aStatusBarElement.m_xUIElement.is() )
@@ -1386,11 +1374,11 @@ void LayoutManager::implts_reparentChildWindows()
 
     implts_resetMenuBar();
 
-    aWriteLock.lock();
+    aWriteLock.reset();
     ToolbarLayoutManager* pToolbarManager = m_pToolbarManager;
     if ( pToolbarManager )
         pToolbarManager->setParentWindow( uno::Reference< awt::XWindowPeer >( xContainerWindow, uno::UNO_QUERY ));
-    aWriteLock.unlock();
+    aWriteLock.clear();
 }
 
 uno::Reference< ui::XUIElement > LayoutManager::implts_createDockingWindow( const OUString& aElementName )
@@ -1408,9 +1396,9 @@ IMPL_LINK( LayoutManager, WindowEventListener, VclSimpleEvent*, pEvent )
         Window* pWindow = static_cast< VclWindowEvent* >(pEvent)->GetWindow();
         if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX )
         {
-            Guard aReadLock( m_aLock );
+            SolarMutexClearableGuard aReadLock;
             ToolbarLayoutManager* pToolbarManager( m_pToolbarManager );
-            aReadLock.unlock();
+            aReadLock.clear();
 
             if ( pToolbarManager )
                 nResult = pToolbarManager->childWindowEvent( pEvent );
@@ -1425,17 +1413,17 @@ throw (RuntimeException, std::exception)
 {
     SAL_INFO( "fwk", "framework (cd100003) ::LayoutManager::createElement" );
 
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
     Reference< XFrame > xFrame = m_xFrame;
     Reference< XURLTransformer > xURLTransformer = m_xURLTransformer;
     sal_Bool    bInPlaceMenu = m_bInplaceMenuSet;
-    aReadLock.unlock();
+    aReadLock.clear();
 
     if ( !xFrame.is() )
         return;
 
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aWriteLock( m_aLock );
+    SolarMutexClearableGuard aWriteLock;
 
     bool bMustBeLayouted( false );
     bool bNotify( false );
@@ -1513,7 +1501,7 @@ throw (RuntimeException, std::exception)
                     }
                 }
             }
-            aWriteLock.unlock();
+            aWriteLock.clear();
         }
         else if ( aElementType.equalsIgnoreAsciiCase("statusbar") &&
                   ( implts_isFrameOrWindowTop(xFrame) || implts_isEmbeddedLayoutManager() ))
@@ -1560,7 +1548,7 @@ throw (RuntimeException, std::exception)
     SAL_INFO( "fwk", "framework (cd100003) ::LayoutManager::destroyElement" );
 
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aWriteLock( m_aLock );
+    SolarMutexClearableGuard aWriteLock;
 
     bool            bMustBeLayouted( false );
     bool            bNotify( false );
@@ -1584,7 +1572,7 @@ throw (RuntimeException, std::exception)
                aElementName.equalsIgnoreAsciiCase("statusbar") ) ||
              ( m_aStatusBarElement.m_aName == aName ))
     {
-        aWriteLock.unlock();
+        aWriteLock.clear();
         implts_destroyStatusBar();
         bMustBeLayouted = true;
         bNotify         = true;
@@ -1592,14 +1580,14 @@ throw (RuntimeException, std::exception)
     else if ( aElementType.equalsIgnoreAsciiCase("progressbar") &&
               aElementName.equalsIgnoreAsciiCase("progressbar") )
     {
-        aWriteLock.unlock();
+        aWriteLock.clear();
         implts_createProgressBar();
         bMustBeLayouted = true;
         bNotify = true;
     }
     else if ( aElementType.equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ) && m_pToolbarManager != NULL )
     {
-        aWriteLock.unlock();
+        aWriteLock.clear();
         bNotify         = m_pToolbarManager->destroyToolbar( aName );
         bMustBeLayouted = m_pToolbarManager->isLayoutDirty();
     }
@@ -1607,13 +1595,13 @@ throw (RuntimeException, std::exception)
     {
         uno::Reference< frame::XFrame > xFrame( m_xFrame );
         uno::Reference< XComponentContext > xContext( m_xContext );
-        aWriteLock.unlock();
+        aWriteLock.clear();
 
         impl_setDockingWindowVisibility( xContext, xFrame, aElementName, false );
         bMustBeLayouted = false;
         bNotify         = false;
     }
-    aWriteLock.unlock();
+    aWriteLock.clear();
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
     if ( bMustBeLayouted )
@@ -1633,7 +1621,7 @@ throw (uno::RuntimeException, std::exception)
 
     parseResourceURL( rResourceURL, aElementType, aElementName );
 
-    Guard aWriteLock( m_aLock );
+    SolarMutexClearableGuard aWriteLock;
 
     OString aResName = OUStringToOString( aElementName, RTL_TEXTENCODING_ASCII_US );
     SAL_INFO( "fwk", "framework (cd100003) Element " << aResName.getStr() << " requested." );
@@ -1645,7 +1633,7 @@ throw (uno::RuntimeException, std::exception)
         implts_readStatusBarState( rResourceURL );
         if ( m_aStatusBarElement.m_bVisible && !m_aStatusBarElement.m_bMasterHide )
         {
-            aWriteLock.unlock();
+            aWriteLock.clear();
             createElement( rResourceURL );
 
             // There are some situation where we are not able to create an element.
@@ -1670,7 +1658,7 @@ throw (uno::RuntimeException, std::exception)
     else if ( aElementType.equalsIgnoreAsciiCase("progressbar") &&
               aElementName.equalsIgnoreAsciiCase("progressbar") )
     {
-        aWriteLock.unlock();
+        aWriteLock.clear();
         implts_showProgressBar();
         bResult   = true;
         bNotify   = true;
@@ -1679,7 +1667,7 @@ throw (uno::RuntimeException, std::exception)
     {
         bool bComponentAttached( !m_aModuleIdentifier.isEmpty() );
         ToolbarLayoutManager* pToolbarManager = m_pToolbarManager;
-        aWriteLock.unlock();
+        aWriteLock.clear();
 
         if ( pToolbarManager && bComponentAttached )
         {
@@ -1689,7 +1677,7 @@ throw (uno::RuntimeException, std::exception)
     else if ( aElementType.equalsIgnoreAsciiCase("dockingwindow"))
     {
         uno::Reference< frame::XFrame > xFrame( m_xFrame );
-        aWriteLock.unlock();
+        aWriteLock.clear();
 
         CreateDockingWindow( xFrame, aElementName );
     }
@@ -1706,9 +1694,9 @@ throw (RuntimeException, std::exception)
     Reference< XUIElement > xUIElement = implts_findElement( aName );
     if ( !xUIElement.is() )
     {
-        Guard aReadLock( m_aLock );
+        SolarMutexClearableGuard aReadLock;
         ToolbarLayoutManager*             pToolbarManager( m_pToolbarManager );
-        aReadLock.unlock();
+        aReadLock.clear();
 
         if ( pToolbarManager )
             xUIElement = pToolbarManager->getToolbar( aName );
@@ -1720,11 +1708,11 @@ throw (RuntimeException, std::exception)
 Sequence< Reference< ui::XUIElement > > SAL_CALL LayoutManager::getElements()
 throw (uno::RuntimeException, std::exception)
 {
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
     uno::Reference< ui::XUIElement >  xMenuBar( m_xMenuBar );
     uno::Reference< ui::XUIElement >  xStatusBar( m_aStatusBarElement.m_xUIElement );
     ToolbarLayoutManager*             pToolbarManager( m_pToolbarManager );
-    aReadLock.unlock();
+    aReadLock.clear();
 
     Sequence< Reference< ui::XUIElement > > aSeq;
     if ( pToolbarManager )
@@ -1772,9 +1760,9 @@ throw (RuntimeException, std::exception)
     if ( aElementType.equalsIgnoreAsciiCase("menubar") &&
          aElementName.equalsIgnoreAsciiCase("menubar") )
     {
-        Guard aWriteLock( m_aLock );
+        SolarMutexClearableGuard aWriteLock;
         m_bMenuVisible = true;
-        aWriteLock.unlock();
+        aWriteLock.clear();
 
         bResult = implts_resetMenuBar();
         bNotify = bResult;
@@ -1783,11 +1771,11 @@ throw (RuntimeException, std::exception)
                aElementName.equalsIgnoreAsciiCase("statusbar") ) ||
              ( m_aStatusBarElement.m_aName == aName ))
     {
-        Guard aWriteLock( m_aLock );
+        SolarMutexClearableGuard aWriteLock;
         if ( m_aStatusBarElement.m_xUIElement.is() && !m_aStatusBarElement.m_bMasterHide &&
              implts_showStatusBar( sal_True ))
         {
-            aWriteLock.unlock();
+            aWriteLock.clear();
 
             implts_writeWindowStateData( STATUS_BAR_ALIAS, m_aStatusBarElement );
             bMustLayout = true;
@@ -1802,9 +1790,9 @@ throw (RuntimeException, std::exception)
     }
     else if ( aElementType.equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
     {
-        Guard aReadLock( m_aLock );
+        SolarMutexClearableGuard aReadLock;
         ToolbarLayoutManager* pToolbarManager = m_pToolbarManager;
-        aReadLock.unlock();
+        aReadLock.clear();
 
         if ( pToolbarManager )
         {
@@ -1814,18 +1802,18 @@ throw (RuntimeException, std::exception)
     }
     else if ( aElementType.equalsIgnoreAsciiCase("dockingwindow"))
     {
-        Guard aReadGuard( m_aLock );
+        SolarMutexClearableGuard aReadGuard;
         uno::Reference< frame::XFrame > xFrame( m_xFrame );
         uno::Reference< XComponentContext > xContext( m_xContext );
-        aReadGuard.unlock();
+        aReadGuard.clear();
 
         impl_setDockingWindowVisibility( xContext, xFrame, aElementName, true );
     }
     else if ( aElementType.equalsIgnoreAsciiCase("toolpanel"))
     {
-        Guard aReadGuard( m_aLock );
+        SolarMutexClearableGuard aReadGuard;
         uno::Reference< frame::XFrame > xFrame( m_xFrame );
-        aReadGuard.unlock();
+        aReadGuard.clear();
         ActivateToolPanel( m_xFrame, aName );
     }
 
@@ -1855,7 +1843,7 @@ throw (RuntimeException, std::exception)
     if ( aElementType.equalsIgnoreAsciiCase("menubar") &&
          aElementName.equalsIgnoreAsciiCase("menubar") )
     {
-        Guard aWriteLock( m_aLock );
+        SolarMutexGuard g;
 
         if ( m_xContainerWindow.is() )
         {
@@ -1878,7 +1866,7 @@ throw (RuntimeException, std::exception)
                aElementName.equalsIgnoreAsciiCase("statusbar") ) ||
              ( m_aStatusBarElement.m_aName == aName ))
     {
-        Guard aWriteLock( m_aLock );
+        SolarMutexGuard g;
         if ( m_aStatusBarElement.m_xUIElement.is() && !m_aStatusBarElement.m_bMasterHide &&
              implts_hideStatusBar( sal_True ))
         {
@@ -1894,9 +1882,9 @@ throw (RuntimeException, std::exception)
     }
     else if ( aElementType.equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
     {
-        Guard aReadLock( m_aLock );
+        SolarMutexClearableGuard aReadLock;
         ToolbarLayoutManager* pToolbarManager = m_pToolbarManager;
-        aReadLock.unlock();
+        aReadLock.clear();
 
         if ( pToolbarManager )
         {
@@ -1906,10 +1894,10 @@ throw (RuntimeException, std::exception)
     }
     else if ( aElementType.equalsIgnoreAsciiCase("dockingwindow"))
     {
-        Guard aReadGuard( m_aLock );
+        SolarMutexClearableGuard aReadGuard;
         uno::Reference< frame::XFrame > xFrame( m_xFrame );
         uno::Reference< XComponentContext > xContext( m_xContext );
-        aReadGuard.unlock();
+        aReadGuard.clear();
 
         impl_setDockingWindowVisibility( xContext, xFrame, aElementName, false );
     }
@@ -1932,9 +1920,9 @@ throw (RuntimeException, std::exception)
     parseResourceURL( aName, aElementType, aElementName );
     if ( aElementType.equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
     {
-        Guard aReadLock( m_aLock );
+        SolarMutexClearableGuard aReadLock;
         ToolbarLayoutManager*             pToolbarManager = m_pToolbarManager;
-        aReadLock.unlock();
+        aReadLock.clear();
 
         if ( pToolbarManager )
         {
@@ -1948,10 +1936,10 @@ throw (RuntimeException, std::exception)
 
 ::sal_Bool SAL_CALL LayoutManager::dockAllWindows( ::sal_Int16 /*nElementType*/ ) throw (uno::RuntimeException, std::exception)
 {
-    Guard aReadLock( m_aLock );
+    SolarMutexClearableGuard aReadLock;
     bool bResult( false );
     ToolbarLayoutManager*             pToolbarManager = m_pToolbarManager;
-    aReadLock.unlock();
+    aReadLock.clear();
 
     if ( pToolbarManager )
     {
@@ -1968,9 +1956,9 @@ throw (RuntimeException, std::exception)
     bool bResult( false );
     if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
     {
-        Guard aReadLock( m_aLock );
+        SolarMutexClearableGuard aReadLock;
         ToolbarLayoutManager*             pToolbarManager = m_pToolbarManager;
-        aReadLock.unlock();
+        aReadLock.clear();
 
         if ( pToolbarManager )
         {
@@ -1988,9 +1976,9 @@ throw (uno::RuntimeException, std::exception)
     bool bResult( false );
     if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
     {
-        Guard aReadLock( m_aLock );
+        SolarMutexClearableGuard aReadLock;
         ToolbarLayoutManager*             pToolbarManager = m_pToolbarManager;
-        aReadLock.unlock();
+        aReadLock.clear();
 
         if ( pToolbarManager )
         {
@@ -2008,9 +1996,9 @@ throw (uno::RuntimeException, std::exception)
     bool bResult( false );
     if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
     {
-        Guard aReadLock( m_aLock );
+        SolarMutexClearableGuard aReadLock;
         ToolbarLayoutManager*             pToolbarManager = m_pToolbarManager;
-        aReadLock.unlock();
+        aReadLock.clear();
 
         if ( pToolbarManager )
         {
@@ -2027,9 +2015,9 @@ throw (RuntimeException, std::exception)
 {
     if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
     {
-        Guard aReadLock( m_aLock );
+        SolarMutexClearableGuard aReadLock;
         ToolbarLayoutManager*             pToolbarManager = m_pToolbarManager;
-        aReadLock.unlock();
+        aReadLock.clear();
 
         if ( pToolbarManager )
         {
@@ -2045,9 +2033,9 @@ throw (RuntimeException, std::exception)
 {
     if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
     {
-        Guard aReadLock( m_aLock );
+        SolarMutexClearableGuard aReadLock;
         ToolbarLayoutManager* pToolbarManager( m_pToolbarManager );
-        aReadLock.unlock();
+        aReadLock.clear();
 
         if ( pToolbarManager )
         {
@@ -2063,9 +2051,9 @@ throw (RuntimeException, std::exception)
 {
     if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
     {
-        Guard aReadLock( m_aLock );
+        SolarMutexClearableGuard aReadLock;
         ToolbarLayoutManager* pToolbarManager( m_pToolbarManager );
-        aReadLock.unlock();
+        aReadLock.clear();
 
         if ( pToolbarManager )
         {
@@ -2086,10 +2074,10 @@ throw (RuntimeException, std::exception)
     if ( aElementType.equalsIgnoreAsciiCase("menubar") &&
          aElementName.equalsIgnoreAsciiCase("menubar") )
     {
-        Guard aReadLock( m_aLock );
+        SolarMutexResettableGuard aReadLock;
         if ( m_xContainerWindow.is() )
         {
-            aReadLock.unlock();
+            aReadLock.clear();
 
             SolarMutexGuard aGuard;
             SystemWindow* pSysWindow = getTopSystemWindow( m_xContainerWindow );
@@ -2101,7 +2089,7 @@ throw (RuntimeException, std::exception)
             }
             else
             {
-                aReadLock.lock();
+                aReadLock.reset();
                 return m_bMenuVisible;
             }
         }
@@ -2131,18 +2119,18 @@ throw (RuntimeException, std::exception)
     }
     else if ( aElementType.equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
     {
-        Guard aReadLock( m_aLock );
+        SolarMutexClearableGuard aReadLock;
         ToolbarLayoutManager* pToolbarManager = m_pToolbarManager;
-        aReadLock.unlock();
+        aReadLock.clear();
 
         if ( pToolbarManager )
             return pToolbarManager->isToolbarVisible( aName );
     }
     else if ( aElementType.equalsIgnoreAsciiCase("dockingwindow"))
     {
-        Guard aReadGuard( m_aLock );
+        SolarMutexClearableGuard aReadGuard;
         uno::Reference< frame::XFrame > xFrame( m_xFrame );
-        aReadGuard.unlock();
+        aReadGuard.clear();
 
         return IsDockingWindowVisible( xFrame, aElementName );
     }
@@ -2155,9 +2143,9 @@ throw (RuntimeException, std::exception)
 {
     if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
     {
-        Guard aReadLock( m_aLock );
+        SolarMutexClearableGuard aReadLock;
         ToolbarLayoutManager* pToolbarManager = m_pToolbarManager;
-        aReadLock.unlock();
+        aReadLock.clear();
 
         if ( pToolbarManager )
             return pToolbarManager->isToolbarFloating( aName );
@@ -2171,9 +2159,9 @@ throw (RuntimeException, std::exception)
 {
     if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
     {
-        Guard aReadLock( m_aLock );
+        SolarMutexClearableGuard aReadLock;
         ToolbarLayoutManager* pToolbarManager = m_pToolbarManager;
-        aReadLock.unlock();
+        aReadLock.clear();
 
         if ( pToolbarManager )
             return pToolbarManager->isToolbarDocked( aName );
@@ -2187,9 +2175,9 @@ throw (uno::RuntimeException, std::exception)
 {
     if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
     {
-        Guard aReadLock( m_aLock );
+        SolarMutexClearableGuard aReadLock;
         ToolbarLayoutManager* pToolbarManager = m_pToolbarManager;
-        aReadLock.unlock();
+        aReadLock.clear();
 
         if ( pToolbarManager )
             return pToolbarManager->isToolbarLocked( aName );

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list