diff options
-rw-r--r-- | embeddedobj/source/general/docholder.cxx | 30 | ||||
-rw-r--r-- | sd/source/ui/view/ToolBarManager.cxx | 10 | ||||
-rw-r--r-- | sfx2/source/appl/workwin.cxx | 1 |
3 files changed, 22 insertions, 19 deletions
diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx index 6afbba4aa50c..75f61282fcc2 100644 --- a/embeddedobj/source/general/docholder.cxx +++ b/embeddedobj/source/general/docholder.cxx @@ -691,8 +691,8 @@ bool DocumentHolder::ShowUI( const uno::Reference< css::frame::XLayoutManager >& if ( xOwnLM.is() && xDocAreaAcc.is() ) { // make sure that lock state of LM is correct even if an exception is thrown in between - bool bUnlock = false; - bool bLock = false; + bool bUnlockContainerLM = false; + bool bLockOwnLM = false; try { // take over the control over the containers window @@ -706,18 +706,14 @@ bool DocumentHolder::ShowUI( const uno::Reference< css::frame::XLayoutManager >& // this must be done after merging menus as we won't get the container menu otherwise xContainerLM->setDockingAreaAcceptor( uno::Reference < ui::XDockingAreaAcceptor >() ); - bool bIsChart = false; uno::Reference< lang::XServiceInfo> xServiceInfo(m_xComponent, uno::UNO_QUERY); - if (xServiceInfo.is() && xServiceInfo->supportsService("com.sun.star.chart2.ChartDocument")) - bIsChart = true; - // prevent further changes at this LM - // TODO: moggi: why is this necessary? - if (!bIsChart) + if (!xServiceInfo.is() || !xServiceInfo->supportsService("com.sun.star.chart2.ChartDocument")) { - xContainerLM->setVisible( false ); + // prevent further changes at this LM + xContainerLM->setVisible(false); xContainerLM->lock(); + bUnlockContainerLM = true; } - bUnlock = true; // by unlocking the LM each layout change will now resize the containers window; pending layouts will be processed now xOwnLM->setVisible( true ); @@ -727,7 +723,7 @@ bool DocumentHolder::ShowUI( const uno::Reference< css::frame::XLayoutManager >& xSupp->setActiveFrame( m_xFrame ); xOwnLM->unlock(); - bLock = true; + bLockOwnLM = true; bResult = true; // TODO/LATER: The following action should be done only if the window is not hidden @@ -746,7 +742,7 @@ bool DocumentHolder::ShowUI( const uno::Reference< css::frame::XLayoutManager >& xSupp->setActiveFrame( nullptr ); // remove control about containers window from own LM - if ( bLock ) + if (bLockOwnLM) xOwnLM->lock(); xOwnLM->setVisible( false ); xOwnLM->setDockingAreaAcceptor( uno::Reference< css::ui::XDockingAreaAcceptor >() ); @@ -762,7 +758,7 @@ bool DocumentHolder::ShowUI( const uno::Reference< css::frame::XLayoutManager >& // reestablish control of containers window xContainerLM->setDockingAreaAcceptor( xDocAreaAcc ); xContainerLM->setVisible( true ); - if ( bUnlock ) + if (bUnlockContainerLM) xContainerLM->unlock(); } catch( const uno::Exception& ) {} @@ -805,8 +801,12 @@ bool DocumentHolder::HideUI( const uno::Reference< css::frame::XLayoutManager >& xMerge->removeMergedMenuBar(); xContainerLM->setDockingAreaAcceptor( xDocAreaAcc ); - xContainerLM->setVisible( true ); - xContainerLM->unlock(); + uno::Reference< lang::XServiceInfo> xServiceInfo(m_xComponent, uno::UNO_QUERY); + if (!xServiceInfo.is() || !xServiceInfo->supportsService("com.sun.star.chart2.ChartDocument")) + { + xContainerLM->setVisible(true); + xContainerLM->unlock(); + } xContainerLM->doLayout(); bResult = true; diff --git a/sd/source/ui/view/ToolBarManager.cxx b/sd/source/ui/view/ToolBarManager.cxx index 178efab47d41..20f8a7979534 100644 --- a/sd/source/ui/view/ToolBarManager.cxx +++ b/sd/source/ui/view/ToolBarManager.cxx @@ -60,11 +60,13 @@ class ToolBarRules; /** Lock of the frame::XLayoutManager. */ -struct LayouterLock +class LayouterLock { + Reference<frame::XLayoutManager> mxLayouter; +public: explicit LayouterLock (const Reference<frame::XLayoutManager>& rxLayouter); ~LayouterLock(); - Reference<frame::XLayoutManager> mxLayouter; + bool is() const { return mxLayouter.is(); } }; /** Store a list of tool bars for each of the tool bar groups. From @@ -577,8 +579,8 @@ void ToolBarManager::Implementation::SetValid (bool bValid) aValue >>= mxLayouter; // tdf#119997 if mpSynchronousLayouterLock was created before mxLayouter was // set then update it now that its available - if (mpSynchronousLayouterLock && !mpSynchronousLayouterLock->mxLayouter) - mpSynchronousLayouterLock->mxLayouter = mxLayouter; + if (mpSynchronousLayouterLock && !mpSynchronousLayouterLock->is()) + mpSynchronousLayouterLock.reset(new LayouterLock(mxLayouter)); } catch (const RuntimeException&) { diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index 26c211d644f8..b7f6eddd9777 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -543,6 +543,7 @@ void SfxWorkWindow::Lock_Impl( bool bLock ) if ( m_nLock<0 ) { OSL_FAIL("Lock count underflow!"); + assert(m_nLock >= 0); m_nLock = 0; } |