summaryrefslogtreecommitdiff
path: root/framework/source/layoutmanager/toolbarlayoutmanager.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-12-21 15:22:06 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-12-21 17:14:14 +0100
commit489bce598626390d9c0aa5e5b8514e26070add61 (patch)
tree170ec95dcb393dbe4f7178bc08e6d96b6b76954b /framework/source/layoutmanager/toolbarlayoutmanager.cxx
parentf19599c929ac6ae2708b19b9eff62ff70b44ee75 (diff)
loplugin:flatten in filter..framework
Change-Id: I15a577b3c6da03001bbbf2c2b43b29b41c4007c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127234 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework/source/layoutmanager/toolbarlayoutmanager.cxx')
-rw-r--r--framework/source/layoutmanager/toolbarlayoutmanager.cxx250
1 files changed, 125 insertions, 125 deletions
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index c190b1a40f23..4191f7434f6e 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -795,81 +795,81 @@ bool ToolbarLayoutManager::dockToolbar( std::u16string_view rResourceURL, ui::Do
{
UIElement aUIElement = implts_findToolbar( rResourceURL );
- if ( aUIElement.m_xUIElement.is() )
+ if ( !aUIElement.m_xUIElement.is() )
+ return false;
+
+ try
{
- try
+ uno::Reference< awt::XWindow > xWindow( aUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
+ uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
+ if ( xDockWindow.is() )
{
- uno::Reference< awt::XWindow > xWindow( aUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
- uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
- if ( xDockWindow.is() )
- {
- if ( eDockingArea != ui::DockingArea_DOCKINGAREA_DEFAULT )
- aUIElement.m_aDockedData.m_nDockedArea = eDockingArea;
+ if ( eDockingArea != ui::DockingArea_DOCKINGAREA_DEFAULT )
+ aUIElement.m_aDockedData.m_nDockedArea = eDockingArea;
- if ( !isDefaultPos( aPos ))
- aUIElement.m_aDockedData.m_aPos = aPos;
+ if ( !isDefaultPos( aPos ))
+ aUIElement.m_aDockedData.m_aPos = aPos;
- if ( !xDockWindow->isFloating() )
- {
- vcl::Window* pWindow( nullptr );
- ToolBox* pToolBox( nullptr );
+ if ( !xDockWindow->isFloating() )
+ {
+ vcl::Window* pWindow( nullptr );
+ ToolBox* pToolBox( nullptr );
+ {
+ SolarMutexGuard aGuard;
+ pWindow = VCLUnoHelper::GetWindow( xWindow );
+ if ( pWindow && pWindow->GetType() == WindowType::TOOLBOX )
{
- SolarMutexGuard aGuard;
- pWindow = VCLUnoHelper::GetWindow( xWindow );
- if ( pWindow && pWindow->GetType() == WindowType::TOOLBOX )
- {
- pToolBox = static_cast<ToolBox *>(pWindow);
+ pToolBox = static_cast<ToolBox *>(pWindow);
- // We have to set the alignment of the toolbox. It's possible that the toolbox is moved from a
- // horizontal to a vertical docking area!
- pToolBox->SetAlign( ImplConvertAlignment( aUIElement.m_aDockedData.m_nDockedArea ));
- }
+ // We have to set the alignment of the toolbox. It's possible that the toolbox is moved from a
+ // horizontal to a vertical docking area!
+ pToolBox->SetAlign( ImplConvertAlignment( aUIElement.m_aDockedData.m_nDockedArea ));
}
+ }
- if ( hasDefaultPosValue( aUIElement.m_aDockedData.m_aPos ))
- {
- // Docking on its default position without a preset position -
- // we have to find a good place for it.
- ::Size aSize;
-
- SolarMutexGuard aGuard;
- {
- if (pToolBox)
- aSize = pToolBox->CalcWindowSizePixel( 1, ImplConvertAlignment( aUIElement.m_aDockedData.m_nDockedArea ) );
- else if (pWindow)
- aSize = pWindow->GetSizePixel();
- }
+ if ( hasDefaultPosValue( aUIElement.m_aDockedData.m_aPos ))
+ {
+ // Docking on its default position without a preset position -
+ // we have to find a good place for it.
+ ::Size aSize;
- ::Point aPixelPos;
- awt::Point aDockPos;
- implts_findNextDockingPos(aUIElement.m_aDockedData.m_nDockedArea, aSize, aDockPos, aPixelPos );
- aUIElement.m_aDockedData.m_aPos = aDockPos;
+ SolarMutexGuard aGuard;
+ {
+ if (pToolBox)
+ aSize = pToolBox->CalcWindowSizePixel( 1, ImplConvertAlignment( aUIElement.m_aDockedData.m_nDockedArea ) );
+ else if (pWindow)
+ aSize = pWindow->GetSizePixel();
}
+
+ ::Point aPixelPos;
+ awt::Point aDockPos;
+ implts_findNextDockingPos(aUIElement.m_aDockedData.m_nDockedArea, aSize, aDockPos, aPixelPos );
+ aUIElement.m_aDockedData.m_aPos = aDockPos;
}
+ }
- implts_setToolbar( aUIElement );
+ implts_setToolbar( aUIElement );
- if ( xDockWindow->isFloating() )
- {
- // ATTENTION: This will call toggleFloatingMode() via notifications which
- // sets the floating member of the UIElement correctly!
- xDockWindow->setFloatingMode( false );
- }
- else
- {
- implts_writeWindowStateData( aUIElement );
- implts_sortUIElements();
+ if ( xDockWindow->isFloating() )
+ {
+ // ATTENTION: This will call toggleFloatingMode() via notifications which
+ // sets the floating member of the UIElement correctly!
+ xDockWindow->setFloatingMode( false );
+ }
+ else
+ {
+ implts_writeWindowStateData( aUIElement );
+ implts_sortUIElements();
- if ( aUIElement.m_bVisible )
- implts_setLayoutDirty();
- }
- return true;
+ if ( aUIElement.m_bVisible )
+ implts_setLayoutDirty();
}
+ return true;
}
- catch (const lang::DisposedException&)
- {
- }
+ }
+ catch (const lang::DisposedException&)
+ {
}
return false;
@@ -3549,33 +3549,33 @@ sal_Bool SAL_CALL ToolbarLayoutManager::prepareToggleFloatingMode( const lang::E
bool bWinFound( !aUIDockingElement.m_aName.isEmpty() );
uno::Reference< awt::XWindow > xWindow( e.Source, uno::UNO_QUERY );
- if ( bWinFound && xWindow.is() )
+ if ( !bWinFound || !xWindow.is() )
+ return true;
+
+ if ( bDockingInProgress )
+ return true;
+
+ uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
+ if ( !xDockWindow->isFloating() )
+ return true;
+
{
- if ( !bDockingInProgress )
+ SolarMutexGuard aGuard;
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
+ if ( pWindow && pWindow->GetType() == WindowType::TOOLBOX )
{
- uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
- if ( xDockWindow->isFloating() )
- {
- {
- SolarMutexGuard aGuard;
- VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
- if ( pWindow && pWindow->GetType() == WindowType::TOOLBOX )
- {
- ToolBox* pToolBox = static_cast< ToolBox *>( pWindow.get() );
- aUIDockingElement.m_aFloatingData.m_aPos = AWTPoint(pToolBox->GetPosPixel());
- aUIDockingElement.m_aFloatingData.m_aSize = AWTSize(pToolBox->GetOutputSizePixel());
- aUIDockingElement.m_aFloatingData.m_nLines = pToolBox->GetFloatingLines();
- aUIDockingElement.m_aFloatingData.m_bIsHorizontal = isToolboxHorizontalAligned( pToolBox );
- }
- }
-
- UIElement aUIElement = implts_findToolbar( aUIDockingElement.m_aName );
- if ( aUIElement.m_aName == aUIDockingElement.m_aName )
- implts_setToolbar( aUIDockingElement );
- }
+ ToolBox* pToolBox = static_cast< ToolBox *>( pWindow.get() );
+ aUIDockingElement.m_aFloatingData.m_aPos = AWTPoint(pToolBox->GetPosPixel());
+ aUIDockingElement.m_aFloatingData.m_aSize = AWTSize(pToolBox->GetOutputSizePixel());
+ aUIDockingElement.m_aFloatingData.m_nLines = pToolBox->GetFloatingLines();
+ aUIDockingElement.m_aFloatingData.m_bIsHorizontal = isToolboxHorizontalAligned( pToolBox );
}
}
+ UIElement aUIElement = implts_findToolbar( aUIDockingElement.m_aName );
+ if ( aUIElement.m_aName == aUIDockingElement.m_aName )
+ implts_setToolbar( aUIDockingElement );
+
return true;
}
@@ -3934,26 +3934,26 @@ uno::Sequence< uno::Reference< ui::XUIElement > > ToolbarLayoutManager::getToolb
bool ToolbarLayoutManager::floatToolbar( std::u16string_view rResourceURL )
{
UIElement aUIElement = implts_findToolbar( rResourceURL );
- if ( aUIElement.m_xUIElement.is() )
+ if ( !aUIElement.m_xUIElement.is() )
+ return false;
+
+ try
{
- try
+ uno::Reference< awt::XDockableWindow > xDockWindow( aUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
+ if ( xDockWindow.is() && !xDockWindow->isFloating() )
{
- uno::Reference< awt::XDockableWindow > xDockWindow( aUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
- if ( xDockWindow.is() && !xDockWindow->isFloating() )
- {
- aUIElement.m_bFloating = true;
- implts_writeWindowStateData( aUIElement );
- xDockWindow->setFloatingMode( true );
+ aUIElement.m_bFloating = true;
+ implts_writeWindowStateData( aUIElement );
+ xDockWindow->setFloatingMode( true );
- implts_setLayoutDirty();
- implts_setToolbar( aUIElement );
- return true;
- }
- }
- catch (const lang::DisposedException&)
- {
+ implts_setLayoutDirty();
+ implts_setToolbar( aUIElement );
+ return true;
}
}
+ catch (const lang::DisposedException&)
+ {
+ }
return false;
}
@@ -3961,26 +3961,26 @@ bool ToolbarLayoutManager::floatToolbar( std::u16string_view rResourceURL )
bool ToolbarLayoutManager::lockToolbar( std::u16string_view rResourceURL )
{
UIElement aUIElement = implts_findToolbar( rResourceURL );
- if ( aUIElement.m_xUIElement.is() )
+ if ( !aUIElement.m_xUIElement.is() )
+ return false;
+
+ try
{
- try
+ uno::Reference< awt::XDockableWindow > xDockWindow( aUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
+ if ( xDockWindow.is() && !xDockWindow->isFloating() && !xDockWindow->isLocked() )
{
- uno::Reference< awt::XDockableWindow > xDockWindow( aUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
- if ( xDockWindow.is() && !xDockWindow->isFloating() && !xDockWindow->isLocked() )
- {
- aUIElement.m_aDockedData.m_bLocked = true;
- implts_writeWindowStateData( aUIElement );
- xDockWindow->lock();
+ aUIElement.m_aDockedData.m_bLocked = true;
+ implts_writeWindowStateData( aUIElement );
+ xDockWindow->lock();
- implts_setLayoutDirty();
- implts_setToolbar( aUIElement );
- return true;
- }
- }
- catch (const lang::DisposedException&)
- {
+ implts_setLayoutDirty();
+ implts_setToolbar( aUIElement );
+ return true;
}
}
+ catch (const lang::DisposedException&)
+ {
+ }
return false;
}
@@ -3988,26 +3988,26 @@ bool ToolbarLayoutManager::lockToolbar( std::u16string_view rResourceURL )
bool ToolbarLayoutManager::unlockToolbar( std::u16string_view rResourceURL )
{
UIElement aUIElement = implts_findToolbar( rResourceURL );
- if ( aUIElement.m_xUIElement.is() )
+ if ( !aUIElement.m_xUIElement.is() )
+ return false;
+
+ try
{
- try
+ uno::Reference< awt::XDockableWindow > xDockWindow( aUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
+ if ( xDockWindow.is() && !xDockWindow->isFloating() && xDockWindow->isLocked() )
{
- uno::Reference< awt::XDockableWindow > xDockWindow( aUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
- if ( xDockWindow.is() && !xDockWindow->isFloating() && xDockWindow->isLocked() )
- {
- aUIElement.m_aDockedData.m_bLocked = false;
- implts_writeWindowStateData( aUIElement );
- xDockWindow->unlock();
+ aUIElement.m_aDockedData.m_bLocked = false;
+ implts_writeWindowStateData( aUIElement );
+ xDockWindow->unlock();
- implts_setLayoutDirty();
- implts_setToolbar( aUIElement );
- return true;
- }
- }
- catch (const lang::DisposedException&)
- {
+ implts_setLayoutDirty();
+ implts_setToolbar( aUIElement );
+ return true;
}
}
+ catch (const lang::DisposedException&)
+ {
+ }
return false;
}